text:
drupal/decoupled_router patch install failed

Package containing the bug
next-drupal (NPM package)
Describe the bug
A clear and concise description of what the bug is.

It's not possible to apply the drupal/decoupled_router patch when installing drupal
A call to drupal.translatePathFromContext always returns null and results to every route handle by slug returning 404.

Steps to reproduce:

First, install drupal and apply drupal/decoupled_router patch

composer create-project drupal/recommended-project drupal-site

composer require drupal/next

Open your Drupal composer.json file.

Add the following patches under "extra".
"extra": {
// highlight-start
"patches": {
"drupal/subrequests": {
"Get same results on different request": "https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch"
},
"drupal/decoupled_router": {
"Unable to resolve path on node in other language than default": "https://www.drupal.org/files/issues/2022-11-30/decouple_router-3111456-resolve-language-issue-58.patch"
}
},
// highlight-end
}

composer require cweagans/composer-patches

Then, a call to drupal.translatePathFromContext always returns null and results to every route handle by slug returning 404.

Same problem; patch not applied.

for latest version of decoupled_router 2.0.5 Used this patch -
https://www.drupal.org/files/issues/2024-07-11/decouple_router-3111456-resolve-language-issue-63--get-translation-re-rolled.patch

If that's the preferred solution, could somebody please update the code at https://next-drupal.org/learn/quick-start/apply-patches accordingly.

Kind reminder

authors: Vacilando omkar-pd salem-cxdesigns

repo: chapter-three/next-drupal


text:
Null bitmap for chaquopy-matplotlib project while displaying in imageview

I am creating a project similar to chaquopy-matplotlib. Bitmap is null while image is getting displayed from the byte array returned from python script
 val bytes = module.callAttr("plot",
                                            findViewById<EditText>(R.id.etX).text.toString(),
                                            findViewById<EditText>(R.id.etY).text.toString())
                    .toJava(ByteArray::class.java)
                val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.size)
                findViewById<ImageView>(R.id.imageView).setImageBitmap(bitmap)

import io
import matplotlib.pyplot as plt

def plot(x, y):
    xa = [float(word) for word in x.split()]
    ya = [float(word) for word in y.split()]

    fig, ax = plt.subplots()
    ax.plot(xa, ya)

    f = io.BytesIO()
    plt.savefig(f, format="png")
    return f.getvalue()

Did you close the issue because you've solved the problem? If so, what was the solution?

source: gharchive/issue

repo: chaquo/chaquopy-matplotlib

license: MIT

license_type: permissive

license_source: github-api


text:
Switch from whitelist to allow_list

As discussed via email, this PR changes all occurrences of whitelist to allow_list.

Thank you @citizen428

source: gharchive/pull-request

repo: charkost/prosopite


text:
Zundo clear is not working

the clear function is not working.
Sandbox:
https://codesandbox.io/p/sandbox/zundo-forked-3sjgk9
Code:
import { temporal, TemporalState } from "zundo";
import { create, useStore } from "zustand";
import "./styles.css";

interface MyState {
  bears: number;
  increment: () => void;
  decrement: () => void;
}

const useMyStore = create(
  temporal<MyState>((set) => ({
    bears: {},
    increment: () => set((state) => ({ bears: { a: Math.random() } })),
    decrement: () =>
      set((state) => ({
        bears: { a: Math.random(), def: { r: Math.random() } },
      })),
  })),
);

const App = () => {
  const store = useMyStore();
  const { bears, increment, decrement } = store;
  const { undo, redo, futureStates, pastStates, clear } =
    useMyStore.temporal.getState();

  // const { undo, redo, futureStates, pastStates } = useMyStore.temporal.getState();

  return (

        {" "}

          🐻
        {" "}

          ♻
        {" "}
        Zundo!

      past states: {JSON.stringify(pastStates)}

      future states: {JSON.stringify(futureStates)}

      current state: {JSON.stringify(store)}

      bears: {JSON.stringify(bears)}

      <button onClick={increment}>increment</button>
      <button onClick={decrement}>decrement</button>

      <button onClick={() => undo()}>undo</button>
      <button onClick={() => redo()}>redo</button>
      <button onClick={() => clear()}>clear</button>

  );
};

export default App;

HI @tmanager2025,
Sorry for the confusion! You'll need to use the useStore from zustand to make the temporal selector reactive. Maybe I can update the docs to avoid confusion.
Add this to your <App /> function:
const { undo, redo, futureStates, pastStates, clear } = useStore(
    useMyStore.temporal,
 );

Here's a sandbox: https://codesandbox.io/p/sandbox/zundo-forked-l9dl2s

Sorry can't open the sandbox. Giving below message.
[Back to the dashboard](https://codesandbox.io/dashboard)
Sandbox not found
It's likely that the Sandbox you're trying to access doesn't exist or you don't have the required permissions to access it.
If the issue persists, please contact our support team at [support@codesandbox.io](mailto:support@codesandbox.io) for further assistance, making sure to copy the error details below.

Problem details and configurations

Review GitHub permissions

Show details

Ok I am able to work. Thank you so much 😊
For anyone looking below is updated sandbox.
https://codesandbox.io/p/sandbox/zundo-forked-3sjgk9?file=%2Fsrc%2FApp.tsx%3A17%2C27

repo: charkour/zundo


text:
[BUG] Errors when using vpn

With nordvpn, idk why, my internet always stop working when using it, maybe this is the reason
Error Log
C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master>ms_rewards_farmer.py
←[91m
███╗   ███╗███████╗    ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗██████╗
████╗ ████║██╔════╝    ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔══██╗
██╔████╔██║███████╗    █████╗  ███████║██████╔╝██╔████╔██║█████╗  ██████╔╝
██║╚██╔╝██║╚════██║    ██╔══╝  ██╔══██║██╔══██╗██║╚██╔╝██║██╔══╝  ██╔══██╗
██║ ╚═╝ ██║███████║    ██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗██║  ██║
╚═╝     ╚═╝╚══════╝    ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝←[00m
←[95m        by Charles Bel (@charlesbel)               version 1.1
←[00m
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 169, in _new_
conn
    conn = connection.create_connection(
  File "C:\Python39\lib\site-packages\urllib3\util\connection.py", line 73, in c
reate_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
  File "C:\Python39\lib\socket.py", line 953, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in u
rlopen
    httplib_response = self._make_request(
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _
make_request
    self._validate_conn(conn)
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in
_validate_conn
    conn.connect()
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 353, in conne
ct
    conn = self._new_conn()
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 181, in _new_
conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection objec
t at 0x0000005D64B1F6D0>: Failed to establish a new connection: [Errno 11001] ge
taddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in u
rlopen
    retries = retries.increment(
  File "C:\Python39\lib\site-packages\urllib3\util\retry.py", line 574, in incre
ment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ipapi.co', port=443)
: Max retries exceeded with url: /json/ (Caused by NewConnectionError('<urllib3.
connection.HTTPSConnection object at 0x0000005D64B1F6D0>: Failed to establish a
new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 729, in <module>
    LANG, GEO, TZ = getCCodeLangAndOffset()
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 200, in getCCodeLangAndOffset
    nfo = ipapi.location()
  File "C:\Python39\lib\site-packages\ipapi\ipapi.py", line 76, in location
    resp = get(url, headers=headers, **options)
  File "C:\Python39\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python39\lib\site-packages\requests\sessions.py", line 542, in reques
t
    resp = self.send(prep, **send_kwargs)
  File "C:\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python39\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ipapi.co', port=4
43): Max retries exceeded with url: /json/ (Caused by NewConnectionError('<urlli
b3.connection.HTTPSConnection object at 0x0000005D64B1F6D0>: Failed to establish
 a new connection: [Errno 11001] getaddrinfo failed'))

C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master>ms_rewards_farmer.py
←[91m
███╗   ███╗███████╗    ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗██████╗
████╗ ████║██╔════╝    ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔══██╗
██╔████╔██║███████╗    █████╗  ███████║██████╔╝██╔████╔██║█████╗  ██████╔╝
██║╚██╔╝██║╚════██║    ██╔══╝  ██╔══██║██╔══██╗██║╚██╔╝██║██╔══╝  ██╔══██╗
██║ ╚═╝ ██║███████║    ██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗██║  ██║
╚═╝     ╚═╝╚══════╝    ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝←[00m
←[95m        by Charles Bel (@charlesbel)               version 1.1

DevTools listening on ws://127.0.0.1:30960/devtools/browser/2be5414c-6d6d-456e-a
71c-541bfc6d4abd
[LOGIN] Logging-in...
Traceback (most recent call last):
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 754, in <module>
    login(browser, account['username'], account['password'])
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 41, in login
    waitUntilVisible(browser, By.ID, 'loginHeader', 10)
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 146, in waitUntilVisible
    WebDriverWait(browser, time_to_wait).until(ec.visibility_of_element_located(
(by_, selector)))
  File "C:\Python39\lib\site-packages\selenium\webdriver\support\wait.py", line
80, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master>ms_rewards_farmer.py
←[91m
███╗   ███╗███████╗    ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗██████╗
████╗ ████║██╔════╝    ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔══██╗
██╔████╔██║███████╗    █████╗  ███████║██████╔╝██╔████╔██║█████╗  ██████╔╝
██║╚██╔╝██║╚════██║    ██╔══╝  ██╔══██║██╔══██╗██║╚██╔╝██║██╔══╝  ██╔══██╗
██║ ╚═╝ ██║███████║    ██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗██║  ██║
╚═╝     ╚═╝╚══════╝    ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝←[00m
←[95m        by Charles Bel (@charlesbel)               version 1.1
←[00m
Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 169, in _new_
conn
    conn = connection.create_connection(
  File "C:\Python39\lib\site-packages\urllib3\util\connection.py", line 96, in c
reate_connection
    raise err
  File "C:\Python39\lib\site-packages\urllib3\util\connection.py", line 86, in c
reate_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] Nenhuma conexão pôde ser feita porque a
 máquina de destino as recusou ativamente

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 699, in u
rlopen
    httplib_response = self._make_request(
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 382, in _
make_request
    self._validate_conn(conn)
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 1010, in
_validate_conn
    conn.connect()
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 353, in conne
ct
    conn = self._new_conn()
  File "C:\Python39\lib\site-packages\urllib3\connection.py", line 181, in _new_
conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection objec
t at 0x000000B123DFF6D0>: Failed to establish a new connection: [WinError 10061]
 Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativament
e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python39\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Python39\lib\site-packages\urllib3\connectionpool.py", line 755, in u
rlopen
    retries = retries.increment(
  File "C:\Python39\lib\site-packages\urllib3\util\retry.py", line 574, in incre
ment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ipapi.co', port=443)
: Max retries exceeded with url: /json/ (Caused by NewConnectionError('<urllib3.
connection.HTTPSConnection object at 0x000000B123DFF6D0>: Failed to establish a
new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina
 de destino as recusou ativamente'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 729, in <module>
    LANG, GEO, TZ = getCCodeLangAndOffset()
  File "C:\Users\Lucas\Desktop\Microsoft-Rewards-Farmer-master\ms_rewards_farmer
.py", line 200, in getCCodeLangAndOffset
    nfo = ipapi.location()
  File "C:\Python39\lib\site-packages\ipapi\ipapi.py", line 76, in location
    resp = get(url, headers=headers, **options)
  File "C:\Python39\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Python39\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python39\lib\site-packages\requests\sessions.py", line 542, in reques
t
    resp = self.send(prep, **send_kwargs)
  File "C:\Python39\lib\site-packages\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python39\lib\site-packages\requests\adapters.py", line 516, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ipapi.co', port=4
43): Max retries exceeded with url: /json/ (Caused by NewConnectionError('<urlli
b3.connection.HTTPSConnection object at 0x000000B123DFF6D0>: Failed to establish
 a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máqu
ina de destino as recusou ativamente'))

The problem is because i have not good vpn

Hehe, never thought a free vpn(windscribe) so good
←[91m
███╗   ███╗███████╗    ███████╗ █████╗ ██████╗ ███╗   ███╗███████╗██████╗
████╗ ████║██╔════╝    ██╔════╝██╔══██╗██╔══██╗████╗ ████║██╔════╝██╔══██╗
██╔████╔██║███████╗    █████╗  ███████║██████╔╝██╔████╔██║█████╗  ██████╔╝
██║╚██╔╝██║╚════██║    ██╔══╝  ██╔══██║██╔══██╗██║╚██╔╝██║██╔══╝  ██╔══██╗
██║ ╚═╝ ██║███████║    ██║     ██║  ██║██║  ██║██║ ╚═╝ ██║███████╗██║  ██║
╚═╝     ╚═╝╚══════╝    ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚══════╝╚═╝  ╚═╝←[00m
←[95m        by Charles Bel (@charlesbel)               version 1.1

DevTools listening on ws://127.0.0.1:40603/devtools/browser/069e1b57-b5bc-4b2c-8
295-32040e5eb9a5
[LOGIN] Logging-in...
[LOGIN] Writing email...
[LOGIN] Writing password...
[LOGIN] Passing security checks...
[LOGIN] Logged-in !
[LOGIN] Ensuring login on Bing...
←[92m[LOGIN] Logged-in successfully !←[00m
←[92m[POINTS] You have 763 points on your account !←[00m
[DAILY SET] Trying to complete the Daily Set...
[DAILY SET] Completing search of card 1
[DAILY SET] Completing quiz of card 2
[DAILY SET] Completing poll of card 3
←[92m[DAILY SET] Completed the Daily Set successfully !←[00m
[PUNCH CARDS] Trying to complete the Punch Cards...
←[92m[PUNCH CARDS] Completed the Punch Cards successfully !←[00m
[MORE PROMO] Trying to complete More Promotions...
←[92m[MORE PROMO] Completed More Promotions successfully !←[00m
[BING] Starting Desktop and Edge Bing searches...
[BING] 1/32
[BING] 2/32
[BING] 3/32
[BING] 4/32
[BING] 5/32
[BING] 6/32
[BING] 7/32
[BING] 8/32
[BING] 9/32
[BING] 10/32
[BING] 11/32
[BING] 12/32
[BING] 13/32
[BING] 14/32
[BING] 15/32
[BING] 16/32
[BING] 17/32
[BING] 18/32

and still going :) maybe 1 hour every 2 days will be so good

Had the same issue but I managed to fix it by turning Cybersec off since it was causing issues with the farmer

repo: charlesbel/Microsoft-Rewards-Farmer


text:
Exception has been thrown by the target of an invocation.  (x64 bit machine)

OCR is working and performing on my machine. when deployed on another machine throws an error. (x64 bit machine)
another machine has all .dll and library and the exact the same path.
Exception has been thrown by the target of an invocation

Please help, thanks in advance.

I found the solution on my way, I install C++ Microsoft Visual C++ runtimes library and the problem solved.
https://aka.ms/vs/17/release/vc_redist.x64.exe

repo: charlesw/tesseract

license_source: bigquery


text:
Explore use of cargo nextest for test running

We should profile this to understand whether it's faster for our project.
See: https://twitter.com/boshen_c/status/1639878432820727809.
See: https://github.com/Boshen/oxc/blob/d4af69930ceb9f083e6358f60b0967abb3bfc5f5/.github/workflows/check.yaml#L104-L115.

Nextest does not run doctest so I disabled doctest by replacing /// ```rust with /// ```no_run.
❯ hyperfine 'cargo nextest run --all --all-features'
Benchmark 1: cargo nextest run --all --all-features
  Time (mean ± σ):      6.459 s ±  0.115 s    [User: 63.093 s, System: 6.695 s]
  Range (min … max):    6.292 s …  6.700 s    10 runs

❯ hyperfine 'cargo test --all --all-features'
Benchmark 1: cargo test --all --all-features
  Time (mean ± σ):     11.376 s ±  0.056 s    [User: 43.252 s, System: 9.700 s]
  Range (min … max):   11.296 s … 11.509 s    10 runs

I cannot get to run cargo test --doc.
I have this error:
❯ cargo test --doc
    Finished test [unoptimized + debuginfo] target(s) in 0.19s
   Doc-tests ruff

running 11 tests
…
test src/map_codes.rs - map_codes::Entry::parse (line 283) ... FAILED

failures:

---- src/map_codes.rs - map_codes::Entry::parse (line 283) stdout ----
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `=>`
 --> src/map_codes.rs:284:23
  |
3 | (Pycodestyle, "E101") => Rule::MixedSpacesAndTabs,
  |                       ^^ expected one of `.`, `;`, `?`, `}`, or an operator

error: aborting due to previous error

Couldn't compile the test.

failures:
    src/map_codes.rs - map_codes::Entry::parse (line 283)

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.03s

error: doctest failed, to rerun pass `-p ruff_macros --doc`

Strange, fixed in https://github.com/charliermarsh/ruff/pull/3766

We've explored it a bit -- not using for now, so closing.

authors: JonathanPlasse charliermarsh konstin

repo: charliermarsh/ruff


text:
Do not skip analysis if *args present for F523

The *args argument will be skipped while collecting indices for extra positional arguments. Here, it's not required for the argument name to be args.
fixes: #2567

Thanks!

authors: charliermarsh dhruvmanila


text:
Replace row/column based Location with byte-offsets.

Summary
This PR changes ruff to use our own fork of RustPython that replaces Location { row: u32, column: u32 } with TextSize https://github.com/charliermarsh/RustPython/pull/4. The main motivation for this change is to ship the logical line rules. Enabling the logical line rules regresses performance by as much as 50% because the rules need to slice into the source string, which requires building and querying the LineIndex. Using byte offsets everywhere trades the need from having to build the LineIndex to inspect the source text in lint rules with re-computing the row and column information when rendering diagnostics. This is a favourable trade because most projects using ruff only have very few diagnostics.
Notable Changes
SourceCodeFile
It is now necessary to always include the source code when passing Messages because the source text is necessary to re-compute the row and column positions for byte offsets (TextSize). Previously, the source text was only included when using --show-source. This results in a noticeable slowdown in projects with many (ten thousand) diagnostics.
Locator
The Locator now exposes methods to:

For a byte offset, compute its line's start and end positions. Useful to compute the indent or when replacing a full line.
For a text range, compute the offset of the first line and the last line in that range. Useful when replacing all lines in a range.

The computations are performed on demand without querying the LineIndex.
The Locator still has a lazy computed LineIndex because we have a few diagnostics that use a line number as part of their message.
SourceCode
SourceCode now provides methods to compute the SourceLocation (row column information) given an offset.
UniversalNewline
The UniversalNewline iterator now returns Line items instead of &str. This is necessary because many lints need to know the offset of the nth line and summing the text.text_len() doesn't give you the right result because the text does not include the trailing newline character:
def f:
    pass

The text len of the first line is 6 bytes because the line does not include the trailing newline character.
The Line struct provides methods o get a line's start offset, end offset, range, and text. It also provides methods to get the text, end offset, and range, including the trailing newline character.
Use TextRange for ranges
Consistently uses TextRange in favor of: (Location, Location) and start: Location, end: Location because TextRange better communicates that the two offsets are related.
Replaces all references of Range with TextRange and deletes Range.
Use TextSize instead of Location
Replaces all references to Location with TextSize.
Stylist
This PR removes the lazy computations for indention and quote because slicing into the source string is now cheap.
Indexer
The Indexer used to store the line numbers of commented lines, lines with continuations, and lines with multiline strings.  This is no longer feasible because it would require computing the line numbers. The new implementation stores the line-start offset for continuous lines and the TextRange for comments and multiline strings.
Storing the TextRange instead of line numbers helped to fix a false-negative where a mixed spaces-tab indent at the start of a multiline string was not reported because the analysis incorrectly assumed that it is part of the multiline string.
Noqa
This PR now stores the TextRange of the line for each noqa comment sorted in ascending order by the start position. Testing whether a diagnostic is suppressed requires a binary search on the ranges to test if any range contains the diagnostics start location.
This PR further replaces the mapping to suppress some syntaxes on other lines by a TextRange vector where every entry means that a position falling into that range should be remapped to the end of the range.
isort directives
Similar to noqa. It now stores the TextRanges instead of the line numbers for the areas where sorting is disabled. This PR now only stores the TextSize for split positions as this proves to be sufficient.
Benchmark
TLDR: 10% performance improvement for projects with few diagnostics. Identical performance or small regression for projects with many diagnostics. The new implementation with logical-lines enabled outperforms main with logical-lines disabled.
Micro Benchmarks
This PR improves the default-rules benchmark by 6-15% and the all-rules benchmark by 4-8%. More importantly, ruff with logical-lines enabled is as fast or even faster than main. This should allow us to ship logical lines without causing a runtime regression.
group                                      bytes                                  bytes-logical                          main                                   main-logical
-----                                      -----                                  -------------                          ----                                   ------------
linter/all-rules/large/dataset.py          1.00      8.6±0.08ms     4.7 MB/sec    1.03      8.9±0.17ms     4.6 MB/sec    1.04      8.9±0.12ms     4.6 MB/sec    1.10      9.4±0.01ms     4.3 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.0±0.07ms     8.3 MB/sec    1.05      2.1±0.03ms     7.9 MB/sec    1.05      2.1±0.03ms     7.9 MB/sec    1.13      2.3±0.00ms     7.4 MB/sec
linter/all-rules/numpy/globals.py          1.00    220.7±4.63µs    13.4 MB/sec    1.04    228.8±2.74µs    12.9 MB/sec    1.08    238.8±1.17µs    12.4 MB/sec    1.16    256.8±1.25µs    11.5 MB/sec
linter/all-rules/pydantic/types.py         1.00      3.5±0.04ms     7.3 MB/sec    1.05      3.7±0.10ms     6.9 MB/sec    1.07      3.7±0.02ms     6.8 MB/sec    1.14      4.0±0.02ms     6.4 MB/sec
linter/default-rules/large/dataset.py      1.00      4.3±0.07ms     9.5 MB/sec    1.07      4.6±0.03ms     8.8 MB/sec    1.08      4.6±0.05ms     8.8 MB/sec    1.18      5.1±0.08ms     8.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00    870.1±5.69µs    19.1 MB/sec    1.12    971.9±3.08µs    17.1 MB/sec    1.15   1002.2±4.42µs    16.6 MB/sec    1.27   1108.6±3.25µs    15.0 MB/sec
linter/default-rules/numpy/globals.py      1.00     95.9±0.72µs    30.8 MB/sec    1.08    103.2±1.69µs    28.6 MB/sec    1.06    102.0±1.01µs    28.9 MB/sec    1.19    114.5±0.47µs    25.8 MB/sec
linter/default-rules/pydantic/types.py     1.00  1883.0±10.58µs    13.5 MB/sec    1.12      2.1±0.01ms    12.1 MB/sec    1.10      2.1±0.00ms    12.3 MB/sec    1.23      2.3±0.01ms    11.0 MB/sec

It's worth pointing out that the relative slowdown introduced by enabling the logical lines lint rules remains unchanged. I'm surprised by this because it doesn't show the improvement I expected from removing the LineIndex computation from the linting path.
group                                      main                                   main-logical
-----                                      ----                                   ------------
linter/all-rules/large/dataset.py          1.00      8.9±0.12ms     4.6 MB/sec    1.06      9.4±0.01ms     4.3 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.1±0.03ms     7.9 MB/sec    1.07      2.3±0.00ms     7.4 MB/sec
linter/all-rules/numpy/globals.py          1.00    238.8±1.17µs    12.4 MB/sec    1.08    256.8±1.25µs    11.5 MB/sec
linter/all-rules/pydantic/types.py         1.00      3.7±0.02ms     6.8 MB/sec    1.07      4.0±0.02ms     6.4 MB/sec
linter/default-rules/large/dataset.py      1.00      4.6±0.05ms     8.8 MB/sec    1.09      5.1±0.08ms     8.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1002.2±4.42µs    16.6 MB/sec    1.11   1108.6±3.25µs    15.0 MB/sec
linter/default-rules/numpy/globals.py      1.00    102.0±1.01µs    28.9 MB/sec    1.12    114.5±0.47µs    25.8 MB/sec
linter/default-rules/pydantic/types.py     1.00      2.1±0.00ms    12.3 MB/sec    1.12      2.3±0.01ms    11.0 MB/sec

group                                      bytes                                  bytes-logical
-----                                      -----                                  -------------
linter/all-rules/large/dataset.py          1.00      8.6±0.08ms     4.7 MB/sec    1.03      8.9±0.17ms     4.6 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      2.0±0.07ms     8.3 MB/sec    1.05      2.1±0.03ms     7.9 MB/sec
linter/all-rules/numpy/globals.py          1.00    220.7±4.63µs    13.4 MB/sec    1.04    228.8±2.74µs    12.9 MB/sec
linter/all-rules/pydantic/types.py         1.00      3.5±0.04ms     7.3 MB/sec    1.05      3.7±0.10ms     6.9 MB/sec
linter/default-rules/large/dataset.py      1.00      4.3±0.07ms     9.5 MB/sec    1.07      4.6±0.03ms     8.8 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00    870.1±5.69µs    19.1 MB/sec    1.12    971.9±3.08µs    17.1 MB/sec
linter/default-rules/numpy/globals.py      1.00     95.9±0.72µs    30.8 MB/sec    1.08    103.2±1.69µs    28.6 MB/sec
linter/default-rules/pydantic/types.py     1.00  1883.0±10.58µs    13.5 MB/sec    1.12      2.1±0.01ms    12.1 MB/sec

CPython
This benchmark measures the worst-case performance: A project with many violations.

Performance regresses for loading cached results (except when using --show-source). This is expected because printing diagnostics now always requires storing the source text and computing the source locations adds some overhead as well.
Slight improvement for --no-cache as seen in the micro benchmarks
10% performance improvement when using silent (-s). This shows the potential of the refactor for projects with few or no diagnostics. Silent still pays the overhead for storing the source text for every diagnostic, but the implementation doesn't compute the LineIndex.

Benchmark results

Command
Mean [ms]
Min [ms]
Max [ms]
Relative

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e
44.4 ± 2.0
40.3
49.0
1.17 ± 0.08

./ruff-main ./crates/ruff/resources/test/cpython/ -e
37.9 ± 1.8
34.1
43.5
1.00

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e --no-cache
200.2 ± 4.0
194.5
210.1
5.28 ± 0.28

./ruff-main ./crates/ruff/resources/test/cpython/ -e --no-cache
215.7 ± 6.5
203.5
228.0
5.69 ± 0.32

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e  --select=ALL
401.6 ± 9.6
391.4
420.1
10.60 ± 0.57

./ruff-main ./crates/ruff/resources/test/cpython/ -e  --select=ALL
395.6 ± 8.8
383.8
412.5
10.44 ± 0.55

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e --no-cache --select=ALL
691.1 ± 9.6
677.6
709.3
18.24 ± 0.91

./ruff-main ./crates/ruff/resources/test/cpython/ -e --no-cache --select=ALL
716.7 ± 11.3
700.7
736.3
18.91 ± 0.96

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e   --show-source
85.7 ± 2.4
81.7
93.2
2.26 ± 0.13

./ruff-main ./crates/ruff/resources/test/cpython/ -e   --show-source
85.0 ± 2.0
81.9
90.4
2.24 ± 0.12

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e --no-cache  --show-source
245.7 ± 4.4
238.5
251.2
6.48 ± 0.33

./ruff-main ./crates/ruff/resources/test/cpython/ -e --no-cache  --show-source
259.8 ± 5.1
251.3
272.6
6.86 ± 0.36

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e  --select=ALL --show-source
1507.1 ± 18.6
1474.6
1531.3
39.77 ± 1.98

./ruff-main ./crates/ruff/resources/test/cpython/ -e  --select=ALL --show-source
1459.6 ± 23.5
1426.0
1500.0
38.52 ± 1.96

./ruff-bytes ./crates/ruff/resources/test/cpython/ -e --no-cache --select=ALL --show-source
1770.1 ± 21.8
1747.0
1822.1
46.71 ± 2.32

./ruff-main ./crates/ruff/resources/test/cpython/ -e --no-cache --select=ALL --show-source
1799.7 ± 31.7
1762.7
1856.2
47.49 ± 2.44

Homeassitant
Best case benchmark: A project with very few diagnostics (10).

Performance is unchanged when running with caching
Performance improves by about 10% when caching is disabled.

Command
Mean [ms]
Min [ms]
Max [ms]
Relative

../ruff/ruff-bytes . -e
51.4 ± 2.0
44.6
55.7
1.00

../ruff/ruff-main . -e
51.4 ± 2.3
45.4
57.3
1.00 ± 0.06

../ruff/ruff-bytes . -e --no-cache
360.0 ± 3.0
355.4
364.0
7.01 ± 0.28

../ruff/ruff-main . -e --no-cache
387.4 ± 5.9
380.1
396.2
7.54 ± 0.32

Enabling logical lines introduces many new errors (2000), no longer showing the best case. But the new implementation still outperforms the old with logical-lines enabled and remains about 10% faster.

Command
Mean [ms]
Min [ms]
Max [ms]
Relative

../ruff/ruff-bytes-logical . -e
53.7 ± 2.3
49.1
59.8
1.03 ± 0.06

../ruff/ruff-main-logical . -e
52.1 ± 2.4
46.6
56.6
1.00

../ruff/ruff-bytes-logical . -e --no-cache
383.2 ± 2.7
378.9
387.6
7.35 ± 0.34

../ruff/ruff-main-logical . -e --no-cache
417.7 ± 6.3
411.8
433.6
8.01 ± 0.38

Test Plan

[x] The ecosystem check shows no changes (after applying #4006, #4007, and #4005)
[x] WASM playground
[ ] Test LSP
[x] Test fixes across repositories

~Breaking Changes~
~This PR changes the column numbers of fixes in the JSON output to be one indexed to align the column numbers with the Diagnostic start and end columns. I can undo this change but I got it "for free" by using SourceLocation consistently.~
I reverted the change in this PR and extracted it into https://github.com/charliermarsh/ruff/pull/4007

Just for my own curiosity, what's the context for this? Why's it necessary?

Just for my own curiosity, what's the context for this? Why's it necessary?

Strictly speaking, it isn't necessary from a functional point of view, but using byte offsets helps to improve performance and reduce memory consumption.
I started investigating switching to byte offsets because enabling the pycodestyle (logical line) rules #3689 results in a 20%-50% performance regression, even tough I already improved the performance of the rules themselves. A key observation is that benchmarks for the default-rules regress more than for the all rules benchmarks.
group                                      main                                   pr
-----                                      ----                                   --
linter/all-rules/large/dataset.py          1.00     13.5±0.06ms     3.0 MB/sec    1.20     16.3±0.09ms     2.5 MB/sec
linter/all-rules/numpy/ctypeslib.py        1.00      3.5±0.01ms     4.7 MB/sec    1.18      4.2±0.01ms     4.0 MB/sec
linter/all-rules/numpy/globals.py          1.00    490.6±2.52µs     6.0 MB/sec    1.16    567.3±0.81µs     5.2 MB/sec
linter/all-rules/pydantic/types.py         1.00      6.0±0.02ms     4.3 MB/sec    1.23      7.4±0.02ms     3.5 MB/sec
linter/default-rules/large/dataset.py      1.00      7.2±0.01ms     5.7 MB/sec    1.38      9.9±0.04ms     4.1 MB/sec
linter/default-rules/numpy/ctypeslib.py    1.00   1615.1±3.91µs    10.3 MB/sec    1.39      2.3±0.01ms     7.4 MB/sec
linter/default-rules/numpy/globals.py      1.00    180.5±0.32µs    16.3 MB/sec    1.52    274.0±4.45µs    10.8 MB/sec
linter/default-rules/pydantic/types.py     1.00      3.4±0.01ms     7.6 MB/sec    1.41      4.8±0.02ms     5.4 MB/sec

This is because the pycodestyle rules are the first rules in the default set that inspect the source code (trivia). The challenge with inspecting the source code is that you can't slice a string with a row/column location. This isn't possible: string[row=1, column=5..10]. Ruff works around this by building a LineIndex that maps row and column locations to byte offsets (somewhat expensive), and than uses that index (lookup is cheap) to retrieve the string locations.
My goal with using byte-offsets is to remove the need to build a LineIndex from the linting phase. It will still be necessary to build the line index when we emit diagnostics, because, as a user, I strongly prefer row/column numbers over byte indices ;). Having to build a LineIndex for all files with diagnostics  may result in a performance regression for projects where most files have diagnostics, but this is rare for projects using ruff that tend to have zero or only few diagnostics.
There are other, non-pycodestyle specific reasons why I want to adopt byte offsets:

Code size reduction: Comparing a byte-offset is a single u32 comparison, compared to two u32 comparisons for a row/column based source location. I further made end_location mandatory on Located which helps removing some unwrap code paths. The result for ruff_python_formatter is a small code size reduction: ~4.4MB → 4.3
Reduced memory consumption: A row/column based Location uses 8 bytes (4 bytes for the row and column). A byte offset only uses half of that (single u32). This means, we reduce the size of every LexResult, Located, and AST node by 8 bytes (-4 bytes for the start, and -4 bytes for the end locations).
Performance improvements: Writing and reading less data, and fewer CPU instructions should help to improve overall performance. A preliminary benchmark comparing the parser and visitor (counting all statements) performance shows a 10-15% performance improvement. Whether we're able to reap all these improvements in Ruff depends on how efficiently we can rewrite the logic that uses row information in the linting phase today (noqa, isort comments, commented lines, etc)

parser/numpy/globals.py time:   [65.752 µs 65.844 µs 65.973 µs]
                        thrpt:  [44.725 MiB/s 44.813 MiB/s 44.876 MiB/s]
                 change:
                        time:   [-5.8033% -5.5729% -5.3542%] (p = 0.00 < 0.05)
                        thrpt:  [+5.6571% +5.9018% +6.1609%]
                        Performance has improved.
Found 21 outliers among 100 measurements (21.00%)
  15 (15.00%) low severe
  2 (2.00%) low mild
  3 (3.00%) high mild
  1 (1.00%) high severe
parser/pydantic/types.py
                        time:   [1.4442 ms 1.4453 ms 1.4466 ms]
                        thrpt:  [17.630 MiB/s 17.646 MiB/s 17.659 MiB/s]
                 change:
                        time:   [-12.393% -12.225% -11.904%] (p = 0.00 < 0.05)
                        thrpt:  [+13.512% +13.927% +14.146%]
                        Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
  3 (3.00%) high mild
  6 (6.00%) high severe
parser/numpy/ctypeslib.py
                        time:   [647.58 µs 650.18 µs 652.90 µs]
                        thrpt:  [25.503 MiB/s 25.610 MiB/s 25.713 MiB/s]
                 change:
                        time:   [-14.351% -14.154% -13.948%] (p = 0.00 < 0.05)
                        thrpt:  [+16.209% +16.488% +16.756%]
                        Performance has improved.
Found 18 outliers among 100 measurements (18.00%)
  17 (17.00%) high mild
  1 (1.00%) high severe
parser/large/dataset.py time:   [3.5024 ms 3.5104 ms 3.5195 ms]
                        thrpt:  [11.559 MiB/s 11.589 MiB/s 11.616 MiB/s]
                 change:
                        time:   [-11.825% -11.603% -11.374%] (p = 0.00 < 0.05)
                        thrpt:  [+12.834% +13.126% +13.411%]
                        Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
  7 (7.00%) low severe
  1 (1.00%) low mild
  1 (1.00%) high mild
  4 (4.00%) high severe

Current dependencies on/for this PR:

main

PR #3931   👈

This comment was auto-generated by Graphite.

Thanks for the detailed explanation @MichaReiser!

Thanks for the detailed explanation @MichaReiser! If you don't mind - where do the offsets come from? Column offset makes sense (obviously just offsetting from index 0), but how are rows represented? Or is a total byte-offset calculated from what is effectively row 0, column 0?
E: Never mind, just found locator.rs. Seems like we essentially treat the file as one giant string, then define rows as being delimited by \n/\r and then the columns as the offsets from that offset?

Sorry for the late reply.
The RustPython Lexer generates the offsets. The old implementation counted the rows and columns (from the start of the row). The lexer increments the current row index and resets the column to zero for every new line character.
Byte offsets don't use row or columns. Instead, it's an offset from the beginning of the file. Think of the string as a byte array and the byte offset is the index into that array:
def f(): pass
x = 20

The position of the identifier f:

row/column representation: Location { row: 1, column 4 }
byte offsets: TextSize::from(4)

The position of the = sign

row/column representation: Location { row: 2, column: 2 }
byte offsets: TextSize::from(16)

The fixes to the UnnecessaryAssign rule look correct to me:
https://github.com/apache/airflow/blob/bb5f63a971f29702294e88853130bb31292fe08b/airflow/www/extensions/init_appbuilder.py#L354-L359
https://github.com/apache/airflow/blob/bb5f63a971f29702294e88853130bb31292fe08b/airflow/security/utils.py#L78-L83
https://github.com/apache/airflow/blob/bb5f63a971f29702294e88853130bb31292fe08b/airflow/api_connexion/endpoints/task_instance_endpoint.py#L271-L274

maybe you are interested in this change in lalrpop
https://github.com/lalrpop/lalrpop/pull/743

maybe you are interested in this change in lalrpop lalrpop/lalrpop#743

Nice! Improvements to the parser are extremely impactful for ruff because it's where it spends the majority of the time if only few rules are enabled.

ah, i am sorry, I didn't check if it is a parse speed up or lalrpop compliation speed up.

ah, i am sorry, I didn't check if it is a parse speed up or lalrpop compliation speed up.

We happily take any improvements to the compile time :)

A couple questions on benchmarks and performance (which don't map to specific lines of code):

"Performance regresses for loading cached results." Am I correct that the regression here is, e.g., between the first two rows of the table? From 37.9ms to 44.4ms? And then the fifth and six lines, from 395.6ms to 401.6ms? So it's like a ~fixed 6ms regression? Seems totally fine, but confirming my understanding.
I am a little surprised that we see an improvement in the cpython default ruleset benchmark (without caching) -- lines 3 and 4. We have to build the line index for every file that contains at least one violation, right? So aren't we building the line index more often now than we were before in that case?

A couple questions on benchmarks and performance (which don't map to specific lines of code):
1. "Performance regresses for loading cached results." Am I correct that the regression here is, e.g., between the first two rows of the table? From 37.9ms to 44.4ms? And then the fifth and six lines, from 395.6ms to 401.6ms? So it's like a ~fixed 6ms regression? Seems totally fine, but confirming my understanding.

That's correct. Interesting that it is 6ms in both cases

2. I am a little surprised that we see an improvement in the cpython default ruleset benchmark (without caching) -- lines 3 and 4. We have to build the line index for every file that contains at least one violation, right? So aren't we building the line index _more often_ now than we were before in that case?

It's correct that we build the LineIndex more often. But it seems that the performance improvements to the parser and AST traversal outweigh the cost for building the additional LineIndexs, so that, overall, it still results in a perf win.

authors: MichaReiser charliermarsh evanrittenhouse youknowone


text:
Add support for GitHub Copilot

Adds support to interact with OpenAi GPT-4 Models using Copilot.

something like this:
diff --git a/config_template.yml b/config_template.yml
index 432a580..d806436 100644
--- a/config_template.yml
+++ b/config_template.yml
@@ -92,6 +92,12 @@ apis:
         fallback:
   copilot:
     base-url: https://api.githubcopilot.com
+    models:
+      gpt-4o-2024-05-13:
+        max-input-chars: 392000
+        fallback: gpt-4
+      gpt-4:
+        max-input-chars: 392000
   anthropic:
     base-url: https://api.anthropic.com/v1
     api-key:
diff --git a/mods.go b/mods.go
index 0f2ea63..2017dc2 100644
--- a/mods.go
+++ b/mods.go
@@ -3,6 +3,7 @@ package main
 import (
 	"bufio"
 	"context"
+	"encoding/json"
 	"errors"
 	"fmt"
 	"io"
@@ -351,34 +352,25 @@ func (m *Mods) startCompletionCmd(content string) tea.Cmd {
 			if mod.API == "azure-ad" {
 				ccfg.APIType = openai.APITypeAzureAD
 			}
+		case "copilot":
+			filePath := os.Getenv("HOME") + "/.config/github-copilot/hosts.json"
+			bts, err := os.ReadFile(filePath)
+			if err != nil {
+				return err
+			}
+			hosts := map[string]map[string]string{}
+			if err := json.Unmarshal(bts, &hosts); err != nil {
+				return err
+			}
+			authToken := hosts["github.com"]["oauth_token"]
+			ccfg = openai.DefaultConfig(authToken)
+			ccfg.BaseURL = api.BaseURL
 		default:
 			var key string
-			if cfg.API == "copilot" {
-				filePath := os.Getenv("HOME") + "/.config/github-copilot/hosts.json"
-				data, err := os.ReadFile(filePath)
-				if err != nil {
-					return err
-				}
-				fileContent := string(data)
-				re := regexp.MustCompile(`.*oauth_token...|\".*`)
-				key = re.ReplaceAllString(fileContent, "")
-				if key == "" {
-					return fmt.Errorf("No Copilot OAuth token found in %s", filePath)
-				}
-				key = strings.TrimSpace(key)
-				ccfg = openai.DefaultConfig(key)
-				for _, a := range cfg.APIs {
-					if "copilot" == a.Name {
-						api = a
-						break
-					}
-				}
-			} else {
-				var err error
-				key, err = m.ensureKey(api, "OPENAI_API_KEY", "https://platform.openai.com/account/api-keys")
-				if err != nil {
-					return err
-				}
+			var err error
+			key, err = m.ensureKey(api, "OPENAI_API_KEY", "https://platform.openai.com/account/api-keys")
+			if err != nil {
+				return err
 			}
 			ccfg = openai.DefaultConfig(key)
 			if api.BaseURL != "" {
@@ -447,7 +439,7 @@ func (m *Mods) handleRequestError(err error, mod Model, content string) tea.Msg
 	if errors.As(err, &ae) {
 		return m.handleAPIError(ae, mod, content)
 	}
-	return modsError{ae, fmt.Sprintf(
+	return modsError{err, fmt.Sprintf(
 		"There was a problem with the %s API request.",
 		mod.API,
 	)}

although, testing this, it doesn't seem to work...

Yes, that doesn't work because of the way we select the value of mod.API. At that point in the code, the value is openai, thus it never falls into that case statement.
That's why I added the check inside the default case.

tried to get it to work in #345, but I always get error responses from copilot... I think we're missing something, not sure what though

Mmm... I have it working on my end, albeit with my crude implementation:

I'll check that PR and see if I can make it work

can you run something like mods --api copilot "who are you?"? Just to make sure it is really copilot replying

Since they are both using the same model, they tend to answer the same thing, so I added back the logs:

yeah, for me both branches give the same error

Mmm... If you run this from your console, do you get an answer?
curl -n "https://api.githubcopilot.com/chat/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $(cat ~/.config/github-copilot/hosts.json | sed -e 's/.*oauth_token...//;s/\".*//')" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Who won the world series in 2020?"
      },
      {
        "role": "assistant",
        "content": "The Los Angeles Dodgers won the World Series in 2020."
      },
      {
        "role": "user",
        "content": "Where was it played?"
      }
    ]
  }'

I get an "unknown integration" error

That command work for me, I wonder what's the difference.

That command work for me, I wonder what's the difference.

same... no idea, it works inside neovim apparently... dunno what's the difference 🤔

repo: charmbracelet/mods


text:
How to load Utils via CDN?

Documentation Is:

[X] Missing or needed?
[ ] Confusing
[ ] Not sure?

Please Explain in Detail...
From the documentation I am redirected to https://www.jsdelivr.com/package/npm/chart.js?path=types to load chart.js via cdn.
But when I do that I get Uncaught ReferenceError: Utils is not defined.
How to load that via CDN? I didn't see an url.
Your Proposal for Changes
Add url for utils.js
Example
No response

You copied some code from the samples?
Please see: https://www.chartjs.org/docs/latest/samples/utils.html

The sample you linked to is loading utils via npm. I use a cdn, so I can't use this, right?


text:
Giving a solid background color to canvas and display always tooltip values

I need the canvas to looks like this: http://screencast.com/t/cTLppe8E9f6
What do I need:
1- Change the main canvas background color (http://screencast.com/t/WSsE0LZ4g), just the section where the bars are located.
2- I need to enable values into bar graphics always (http://screencast.com/t/6Am7ylZV).
I've tried several solutions but they works for old versions of chartjs
I would really appreciate your help on this.

Hi, I did this personnally (not a big fan but at least it works!
           var originalDraw = Chart.controllers.line.prototype.draw;            Chart.controllers.line.prototype.draw = function() {             if (this.chart.ctype !== 'mini') {               this.chart.chart.ctx.fillStyle = '#FFFFFF';               this.chart.chart.ctx.fillRect(this.chart.chartArea.left, this.chart.chartArea.top, this.chart.chartArea.right, this.chart.chartArea.bottom);             }             originalDraw.apply(this, arguments);           };
This is for a line chart but it should work the same for a bar. It hides the grid lines though, but maybe someone will be able to help with that!

Another option to draw the background is to add a plugin to do this. It will run before the scales are drawn and will not hide them. If you search around on the issues here, you can also find a plugin to label the bars that you could adapt.
Chart.plugins.register({
  beforeDraw: function(chartInstance, easing) {
    var ctx = chartInstance.chart.ctx,
          chartArea = chartInstance.chartArea;
    ctx.fillStyle = chartInstance.options.backgroundColor; // config option for color
    ctx.fillRect(chartArea.left, chartArea.top, chartArea.right - chartArea.left, chartArea.bottom - chartArea.top);
  }
});

authors: etimberg julienfouilhe steven-github


text:
Doughnut anticlockwise animation

Hi,
i am not an pro coder but i managed to get this result.
http://www.bluemediaproductions.de/chart/evaluation.html
My question is how i can reverse the dougnut animation in a anticlockwise animation?
And I use the chart.bundle.js for my project.
Thanks

This is not possible to do in the current version of chartjs

This can be done in v3: https://codepen.io/kurkle/pen/QWGXxbX

authors: BlackWolfie etimberg kurkle


text:
Plot scatter points logarithmically but show tics based off of linear scale

Not sure if this is even possible but, I have both my x and y axes set to type: 'logarithmic' and although that is the view I'm wanting for my plotted points, I'm wondering if there is a way to have the tics evenly distributed along the x and y axis and with labels that increment up in linear fashion that makes sense. i.e. 100k - 500k - 1mil - 1.5mil....using the lowest value in my data and the highest as min/max?

Thank you!

I don't understand the request. If you use a linear scale with log data then the data won't align with the corresponding numbers on the scale. If what you want is for the ticks to be evenly spaced then you could just show every multiple of 10 by filtering the ticks in afterBuildTicks or with the ticks.callback option.
Also, it looks to me like you're using 3.0.0-alpha. We had a fix for the log scale in master since then that might make the log scale render a bit better: https://www.chartjs.org/dist/master/Chart.min.js
Hope this helps!

authors: benmccann btbritz


text:
Feat: Layout border

Filename
Size
Change

dist/chart.esm.js
69.7 kB
+278 B (0%)

dist/chart.js
88.5 kB
+313 B (0%)

dist/chart.min.js
63 kB
+193 B (0%)

dist/chunks/helpers.segment.js
19.8 kB
+1 B (0%)

Filename
Size
Change

dist/chart.esm.js
69.7 kB
+302 B (0%)

dist/chart.js
88.5 kB
+332 B (0%)

dist/chart.min.js
63 kB
+187 B (0%)

dist/chunks/helpers.segment.js
19.8 kB
+1 B (0%)

Decided to add sample plugin instead.


text:
notes component layout and styling

see the notes mocksite http://localhost:5000/x/mocksite/notes
in the javascript console, call fakeNote() whenever you want to spawn a note for the current user -- then you have to refresh the browser, because we don't have realtime updates for this

[ ] make the xiome-notes component look nice, matching the designs (see comment below)
[ ] css parts and custom properties for customizability

:moneybag: bitcoin bounty 50k satoshis
:money_with_wings: falls in value by 5k satoshis each day after 2021-11-15

Commenting for assignment

Is this issue still available @chase-moskal

Could I be assigned to this please?

@LewBlu assigned :muscle:

:tada: merged!

authors: Dexterl00 LewBlu Tuasegun chase-moskal

repo: chase-moskal/xiome


text:
[FEATURE] 可以返回tokens总数吗

功能描述 / Feature Description
与知识库对话的接口可以返回总tokens消耗吗？方便费用统计。
使用zhipu-api 的event.meta中有'{"task_status":"SUCCESS","usage":{"completion_tokens":212,"prompt_tokens":3,"total_tokens":215},"task_id":"8107272798747869504","request_id":"8107272798747869504"}'，这个total_tokens该怎么传到langchain中？求助

由于您的Issue不符合 Issue 规范 该issue被关闭

repo: chatchat-space/Langchain-Chatchat


text:
创建知识库错误 chatchat-kb -r

详细报错
recreating all vector stores
/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/langchain/_api/module_import.py:87: LangChainDeprecationWarning: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated. Please replace the import with the following:
from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser
warnings.warn(
2024-07-05 17:03:45,456 - utils.py[line:260] - ERROR: failed to create Embeddings for model: custom.
Traceback (most recent call last):
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/utils.py", line 258, in get_Embeddings
return LocalAIEmbeddings(**params)
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/pydantic/v1/main.py", line 341, in init
raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for LocalAIEmbeddings
root
Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)
2024-07-05 17:03:45,457 - faiss_cache.py[line:140] - ERROR: 'NoneType' object has no attribute 'embed_documents'
Traceback (most recent call last):
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 126, in load_vector_store
vector_store = self.new_vector_store(
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 63, in new_vector_store
vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True)
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 550, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 930, in from_texts
embeddings = embedding.embed_documents(texts)
AttributeError: 'NoneType' object has no attribute 'embed_documents'
2024-07-05 17:03:45,458 - init_database.py[line:150] - ERROR: 向量库 samples 加载失败。
Traceback (most recent call last):
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 126, in load_vector_store
vector_store = self.new_vector_store(
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 63, in new_vector_store
vector_store = FAISS.from_documents([doc], embeddings, normalize_L2=True)
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/langchain_core/vectorstores.py", line 550, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/langchain_community/vectorstores/faiss.py", line 930, in from_texts
embeddings = embedding.embed_documents(texts)
AttributeError: 'NoneType' object has no attribute 'embed_documents'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/init_database.py", line 129, in main
folder2db(
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/migrate.py", line 157, in folder2db
kb.create_kb()
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_service/base.py", line 102, in create_kb
self.do_create_kb()
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 57, in do_create_kb
self.load_vector_store()
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_service/faiss_kb_service.py", line 32, in load_vector_store
return kb_faiss_pool.load_vector_store(
File "/home/zhaozhizhuo22/.conda/envs/llm_tl/lib/python3.10/site-packages/chatchat/server/knowledge_base/kb_cache/faiss_cache.py", line 141, in load_vector_store
raise RuntimeError(f"向量库 {kb_name} 加载失败。")
RuntimeError: 向量库 samples 加载失败。
2024-07-05 17:03:45,459 - init_database.py[line:151] - WARNING: Caught KeyboardInterrupt! Setting stop event...

请问解决了吗？

如果你自定义了模型的uid你需要更改一下在langchain环境下的xinference的默认参数：对应的命令是：chatchat-config model --set_model_platforms "[{
"platform_name": "xinference",
"platform_type": "xinference",
"api_base_url": "http://127.0.0.1:9997/v1\",
"api_key": "EMPT",
"api_concurrencies": 5,
"llm_models": [
"qwen2-7b-langchain","chatglm4-9b-chat","qwen1.5-14b-langchain"
],
"embed_models": [
"bge-embedding-model"
],
"image_models": [],
"reranking_models": [],
"speech2text_models": [],
"tts_models": []
}]"

如果你自定义了模型的uid你需要更改一下在langchain环境下的xinference的默认参数：对应的命令是：chatchat-config model --set_model_platforms "[{ "platform_name": "xinference", "platform_type": "xinference", "api_base_url": "http://127.0.0.1:9997/v1", "api_key": "EMPT", "api_concurrencies": 5, "llm_models": [ "qwen2-7b-langchain","chatglm4-9b-chat","qwen1.5-14b-langchain" ], "embed_models": [ "bge-embedding-model" ], "image_models": [], "reranking_models": [], "speech2text_models": [], "tts_models": [] }]"

按照你的设置也不对，报错如下：(langchain0.3.0) PS H:> chatchat-config model --set_model_platforms "[{

"platform_name": "xinference",
"platform_type": "xinference",
"api_base_url": "http://127.0.0.1:9997/v1",
"api_key": "EMPT",
"api_concurrencies": 5,
"llm_models": [
"qwen2-7b-langchain","chatglm4-9b-chat","qwen1.5-14b-langchain"
],
"embed_models": [
"bge-embedding-model"
],
"image_models": [],
"reranking_models": [],
"speech2text_models": [],
"tts_models": []
}]"
Usage: chatchat-config model [OPTIONS]
Try 'chatchat-config model --help' for help.

Error: Got unexpected extra argument (platform_name: xinference,
platform_type: xinference,
api_base_url: http://127.0.0.1:9997/v1,
api_key: EMPT,
api_concurrencies: 5,
llm_models: [
qwen2-7b-langchain,chatglm4-9b-chat,qwen1.5-14b-langchain
],
embed_models: [
bge-embedding-model
],
image_models: [],
reranking_models: [],
speech2text_models: [],
tts_models: []
}])

你的llm_models跟我设置的uid一样？你需要换成你自己的id，我是挂载了三个模型，如果你只有一个模型，你需要删除掉哪些跟你没有关系的参数

如果你自定义了模型的uid你需要更改一下在langchain环境下的xinference的默认参数：对应的命令是：chatchat-config model --set_model_platforms "[{ "platform_name": "xinference", "platform_type": "xinference", "api_base_url": "http://127.0.0.1:9997/v1", "api_key": "EMPT", "api_concurrencies": 5, "llm_models": [ "qwen2-7b-langchain","chatglm4-9b-chat","qwen1.5-14b-langchain" ], "embed_models": [ "bge-embedding-model" ], "image_models": [], "reranking_models": [], "speech2text_models": [], "tts_models": [] }]"

这个配置模型平台的命令应该放在哪边执行啊？在cmd命令行里似乎无法执行吧

这个是在你安装chat模型的环境里边运行，我是linux系统

这个是在你安装chat模型的环境里边运行，我是linux系统

那在windows系统中无法修改配置吗？我现在执行chatchat-kb -r会报错说向量库sample加载失败，是不是因为我没有修改配置的原因啊？

我也不清楚win系统是什么样的，如果你在加载模型的json文件的时候更改了模型的uid，感觉你需要想办法改一下你环境里边的配置

我也不清楚win系统是什么样的，如果你在加载模型的json文件的时候更改了模型的uid，感觉你需要想办法改一下你环境里边的配置

额，加载模型的json文件是哪一步啊，我就是按照readme里面执行的，就是到修改配置这一步卡住了

你没有用xinference挂载模型？xinference register --model-type LLM --file Qwen1.5-7B-Chat.json --persis

你没有用xinference挂载模型？xinference register --model-type LLM --file Qwen1.5-7B-Chat.json --persis

用了啊，xinference我是按照https://blog.csdn.net/python123456_/article/details/140065474 这篇帖子里面来配置的，Language Models用的chatglm3，Embedding Models用的bge-large-zh-v1.5

你没有用xinference挂载模型？xinference register --model-type LLM --file Qwen1.5-7B-Chat.json --persis

我试着直接修改anaconda虚拟环境中chatchat\configs_model_config.py文件， 修改了以下代码：
创建一个全局的共享字典
    self.MODEL_PLATFORMS = [
        {
            "platform_name": "oneapi",
            "platform_type": "oneapi",
            "api_base_url": "http://127.0.0.1:3000/v1",
            "api_key": "sk-",
            "api_concurrencies": 5,
            "llm_models": [
                # 智谱 API
                "chatglm_pro",
                "chatglm_turbo",
                "chatglm_std",
                "chatglm_lite",
                # 千问 API
                "qwen-turbo",
                "qwen-plus",
                "qwen-max",
                "qwen-max-longcontext",
                # 千帆 API
                "ERNIE-Bot",
                "ERNIE-Bot-turbo",
                "ERNIE-Bot-4",
                # 星火 API
                "SparkDesk",
            ],
            "embed_models": [
                # 千问 API
                "text-embedding-v1",
                # 千帆 API
                "Embedding-V1",
            ],
            "image_models": [],
            "reranking_models": [],
            "speech2text_models": [],
            "tts_models": [],
        },
        {
            "platform_name": "xinference",
            "platform_type": "xinference",
            "api_base_url": "http://127.0.0.1:9997/v1",
            "api_key": "EMPT",
            "api_concurrencies": 5,
            "llm_models": [
                "chatglm3",
            ],
            "embed_models": [
                "bge-large-zh-v1.5",
            ],
            "image_models": [],
            "reranking_models": [],
            "speech2text_models": [],
            "tts_models": [],
        },
    ]

我感觉这段代码似乎就是修改xinference参数的，但是修改完之后执行初始化知识库时依然会报错说向量库sample加载失败

0.3.1 版已经发布，优化了配置方式，修改配置项无需重启服务器，可以更新尝试。


text:
⚠ Chatwoot has degraded performance

In 6612093, Chatwoot (https://app.chatwoot.com) experienced degraded performance:

HTTP code: 200
Response time: 16954 ms

Resolved: Chatwoot performance has improved in 4730480.

repo: chatwoot/status


text:
Don't cache files served via http

Describe the bug
The browser seems to cache the served output of dt server .
To Reproduce
Steps to reproduce the behavior:

call dt server /tmp and opens it in the browser
call dt server /usr and opens it in the browser

On the 2nd run, one will see the result of the 1st run.
Expected behavior
The output shouldn't be cached when serving local files

Server will now prevent caching via setting http-header described here

repo: chclaus/dt


text:
why chdb version 2.1 no arm64 Linux whl while version 2.04 has.

why chdb version 2.1 no arm64 Linux whl while version 2.04 has.

This is what I‘m fixing now. v2.1.1 is on the way.
See #274

repo: chdb-io/chdb


text:
Handle error string returned in the JSON-RPC response

Closes: https://github.com/checksum0/go-electrum/issues/5
Here we provide a workaround for servers that don't follow the JSON-RPC 2.0 specification for error objects.
According to the specification, an error should be an object containing code, message, and data properties (see: https://www.jsonrpc.org/specification#error_object).
Unfortunately, Electrs returns an error as a string (see: https://github.com/Blockstream/esplora/issues/453).
We define an error unmarshaling function to handle both types of errors.
Sample outputs from servers that the client has to handle:
ElectrumX
✗ echo '{"jsonrpc": "2.0", "method": "blockchain.block.header", "params": [4294967295], "id": 0}' | netcat 49.12.127.114 10068
{"jsonrpc":"2.0","error":{"code":1,"message":"height 4,294,967,295 out of range"},"id":0}

Fulcrum
✗ echo '{"jsonrpc": "2.0", "method": "blockchain.block.header", "params": [4294967295], "id": 0}' | netcat 203.132.94.196 51001
{"error":{"code":1,"message":"Invalid height"},"id":0,"jsonrpc":"2.0"}

Esplora/Electrs
✗ echo '{"jsonrpc": "2.0", "method": "blockchain.block.header", "params": [4294967295], "id": 0}' | netcat 35.225.54.191 50001
{"error":"missing header","id":0,"jsonrpc":"2.0"}

Closing in favor of https://github.com/checksum0/go-electrum/pull/9.


text:
Fixing version detection in Perl modules

Description
Fixing the removal of the leading v and the conversion of the underscores to dots in Perl module versions.
The test case where it didn’t work before is DateTime::Format::RFC3339 module which uses “v1.2.0” for its version.

It doesn't look like the changed line was working before at all — /v_/ would have matched only v_ string exactly (so cases like v1.2.0 would not be caught) and then the substutution was changing v to 3 (sic!) and _ to ., but the match was always v_ or nothing, so no substituation was taking place.

@eych Can you add the installation of that module to the test recipe with a note of why it's important to test that module. This will prevent us from introducing a change that would break this sometime in the future.

@tas50 Do you have any ideas on how to test this? I see that currently the test recipe installs a specific version of Test::MockModule module and the uninstalls it. However, the issue that I am fixing in this pull request is that DateTime::Format::RFC3339 is always re-installed, even if it's already installed and there is no requirement for the version at all. How would you test for that in the recipe?

So what we want to do in the test is to install the module once, then try to install it again, but produce an error if the installation actually happens. Can you do this in a test recipe?

Since I'm not exactly sure how we can test this until we enhance chefspec to support custom resources I'm just going to merge it. I tested it out by hand. Looks super solid. Handles more string formats. Thanks for fixing this up.

repo: chef-cookbooks/perl


text:
Automate infra views ui changes

:nut_and_bolt: Description: What code changed, and why?

Minor UI changes

[ ] Rename Add Chef Server to Connect Chef Server
--Note: Reverted  "Connect Chef Server" to "Add Chef Server".

[x] Chef Server detail page input padding.

[x] Rename "org" with "organizations" for cookbooks list, orgs detail page.

[x] Rename "Add Chef Org" with "Add Chef Organization" modal and rename button to.

[x] Rename "Org Name" with "Name" on orgs list page.

[x] Make Admin Key field optional on Org detail page until we will remove it.

[x] Padding issue on Add Org modal between form fields.

[x] Loading spinner on chef servers list and orgs list page

[ ] Org "admin_key" is being removed from org responses need changes in UI models as well.
--Note: Skipping this for now due to some dependent code got hampered. Tracked in #3450

[x] Wrap buttons with the app-authorized component show it get hidden if user lacks permission.

NOTE: Do we need to change the 'Add Chef Server' to 'Connect Chef Server' modal pop-up tittle as well?

:chains: Related Resources
fixes #3538
:+1: Definition of Done

Added padding changes in Add Org modal between form fields.

Renamed "org" with "organizations".

Wrapped buttons with the app-authorized.

:athletic_shoe: How to Build and Test the Change
STEP 1
inside the hab studio

[default:/src:0]# build components/automate-ui-devproxy/
[default:/src:0]# start_automate_ui_background
[default:/src:0]# start_all_services

STEP 2
open new window
go to automate UI path

$ cd components/automate-ui
and run the command

npm run serve:hab

:white_check_mark: Checklist

[x] I have read the CONTRIBUTING document.
[ ] Tests added/updated?
[ ] Docs added/updated?
[x] All commits have been signed-off for the Developer Certification of Origin.

:camera: Screenshots, if applicable

@samshinde is  "Org "admin_key" is being removed from org responses need changes in UI models as well." unchecked because that is being done in another PR?

@susanev I think we want the server and organization modals and buttons to all say "Connect Chef Server" and "Connect Chef Organization" yes? Because "add" sounds like "create."
Connect Chef Server:

[X] button on /infrastructure/chef-servers (done in this PR)
[ ] title on "add" modal
[ ] button on "add" modal

Connect Chef Organization:

[ ] button on /infrastructure/chef-servers/b784894d-238c-4035-ae4f-b4903cbd6566
[ ] title on "add" modal
[ ] button on "add" modal

so the ux standard is create when you are creating an automate object and add when you are adding an object that was created outside of automate. i could bring up changing all of our adds to connect with the ux team if you feel strongly about it. let me know.

@susanev i think connect is better but not strongly enough. but where did "Rename Add Chef Server to Connect Chef Server" come from on #3240, because now it is Connect Chef Server on that one button, as seen in the screenshot above behind the modal, but Add in the modal.

i have no idea. @jonong1972 did that come from you?

@jonong1972 @susanev looking at the edit history on #1544, it looks like I left words indicating we should do that over two months ago. I still don't remember that edit even though GitHub says I made it, so we want to change the 'Connect' button here back to 'Add' and forget I ever said anything.

@samshinde is "Org "admin_key" is being removed from org responses need changes in UI models as well." unchecked because that is being done in another PR?

@btm Yes, will do this changes with reset admin key issue https://github.com/chef/automate/issues/3450
also, I have updated the description for the same and revert the Connect chef-server label.

@samshinde I just merged #3589 and then looked at this issue. I see it has merge conflicts and that you force-pushed recently, so these might be new merge conflicts to resolve. Sorry. :(

@samshinde I just merged #3589 and then looked at this issue. I see it has merge conflicts and that you force-pushed recently, so these might be new merge conflicts to resolve. Sorry. :(

@btm it's okay, I have resolved the merge conflicts and pushed it again Thanks! :)

@msorens thanks for the review, I have created a PR for the same: https://github.com/chef/automate/pull/3658

authors: btm samshinde susanev

repo: chef/automate


text:
WIP:[partybus] Add infer command to fix missing migration-level file

Some users may be restoring a backup of external data sources and no
longer have a migration-level file. In this case, a chef-server-ctl upgrade will fail because it will attempt to run all migrations,
starting from the beginning.
The partybus infer command attempts to reconstruct the
migration-level based on what it sees in the database.
For migrations that deploy a sqitch tag, we infer the migration has
run from the presence of the sqitch tag in the sqitch table.
Non-sqitch migrations are less reliable to detect and in most cases we
do not attempt to detect them since most should be idempotent.
Further, we assume the following:

Migrations from versions prior to Enterprise Chef 11.1 are not
supported and thus the lowest possible migration level we should
ever infer is 1.13

The Chef Server 12.0.0 upgrade deployed migrations 1.14 through
1.19.  We will assume that our system has either completely applied
this set of upgrades (and is thus on 1.19 or greater) or hasn't (and
is thus on 1.13)

For the migrations we will currently infer, the following identifies
how we infer them or why we think it is safe to rerun.
Migration-level Detection Methods

1.34: Detect sqitch tag

1.33: Detect sqitch tag

1.32: Safe to rerun: simple service restart

1.31: Safe to rerun: rabbitmqctl change_password to the /existing/ password

1.30: Custom check function since migration appears unsafe to rerun.

1.29: Likely safe to rerun: ACL addition should be idempotent in
bifrost. We could be overwriting a user's intention to /remove/
the server-admins from having READ on their user

1.28: Likely safe to rerun: server-admins group isn't recreated if it
exists:
https://github.com/chef/chef-server/blob/master/src/chef-mover/src/mover_server_admins_global_group_callback.erl#L74-L76
ACL modifications should be idempotent:
https://github.com/chef/chef-server/blob/master/src/chef-mover/src/mover_server_admins_global_group_callback.erl#L79-L96

1.27: Detect sqitch tag

1.26: Safe to rerun: Only un-renamed groups are selected for
migration:
https://github.com/chef/chef-server/blob/master/src/chef-mover/src/mover_global_admins_rename_callback.erl#L48-L56

1.25: Safe to rerun: Group member addition should be
idempotent. Since global groups aren't user-modifiable, we
can't be modifying user-altered data

1.24: Safe to rerun: rm -rf on a cache directory

1.23: Safe to rerun: Only orgs without policy containers are
selected:
https://github.com/chef/chef-server/blob/master/src/chef-mover/src/mover_policies_containers_creation_callback.erl#L76-L81

1.22: Detect sqitch tag

1.21: Detect sqitch tag

1.20: Detect sqitch tag

1.19: Detect sqitch tag of migration 1.16, assume all of 1.14-1.19
have completed.  See note on this above.

1.13: Detect sqitch tag

Signed-off-by: Steven Danna steve@chef.io

Would you think that this is could be reliable enough to get rid of the migration level file altogether?

That is an interesting question.  I'm not sure.  For anyone who successfully upgrades to the latest version, we could make it reliable going forward by requiring that every migration has a well-defined check function.
Currently, the approach I am taking is to move that migration state into a database table to make it less likely that it gets lost, but it is interesting to think about whether we could remove the state tracking completely.

repo: chef/chef-server


text:
package resource execution fails - update wasn't executed

Description
When executing the first package resource execution, an update should be executed. For instance:
apt-get update
apt-get install
package resouce should take care of the update step
Chef Version
12.12.5
Tell us which version of chef-client you are using (see below for Server+ChefDK bugs).
Chef Development Kit Version: 0.16.28
chef-client version: 12.12.15
delivery version: master (921828facad8a8bbbd767368bfc72f19bd30e7bd)
berks version: 4.3.5
kitchen version: 1.10.2
Tell us which Operating System distribution and version chef-client is running on.
Ubuntu 12.04
Replication Case
A recipe which includes only one resource on a fresh instance
package ""
Client Output
Fails cause 'apt-get update' was not executed
Stacktrace
NOTE: CHEF CLIENT BUGS ONLY
This issue tracker is for the code contained within this repo -- chef-client, base knife functionality (not
plugins), chef-apply, chef-solo, chef-client -z, etc.

Server issues
ChefDK issues
Cookbook Issues (see the https://github.com/chef-cookbooks repos or search Supermarket or GitHub/Google)

Unfortunately this isn't really doable, apt-get update is a relatively heavy-weight operation so this would be too slow. Check out the new apt_update resource for this task.

authors: coderanger lioramilbaum

repo: chef/chef


text:
Testing CI 1

Testing CI 1

This provided their value of evaluating a couple of different paths. The summary is that it was somewhat simpler to inject a dll load path via spec_helper.rb instead of setting RUBY_DLL_PATH environment variable.


text:
Merging https://github.com/chef/chef/pull/2707

Merging https://github.com/chef/chef/pull/2707

Hi. I am an automated pull request bot named Curry. There are commits in this pull request whose authors are not yet authorized to contribute to Chef Software, Inc. projects or are using a non-GitHub verified email address. To become authorized to contribute, you will need to sign the Contributor License Agreement (CLA) as an individual or on behalf of your company. You can read more on Chef's blog.
GitHub Users Who Are Not Authorized To Contribute
The following GitHub users do not appear to have signed a CLA:

@habermann24

Please sign the CLA here.

Hi. I am an automated pull request bot named Curry. There are commits in this pull request whose authors are not yet authorized to contribute to Chef Software, Inc. projects or are using a non-GitHub verified email address. To become authorized to contribute, you will need to sign the Contributor License Agreement (CLA) as an individual or on behalf of your company. You can read more on Chef's blog.
GitHub Users Who Are Not Authorized To Contribute
The following GitHub users do not appear to have signed a CLA:

@haberbyte

Please sign the CLA here.

authors: chef-supermarket tyler-ball


text:
Now user can use tagged?(tags) method in both only_if and not_if

Signed-off-by: Kapil Chouhan kapil.chouhan@msystechnologies.com
Description

I have added a new module CommonHelpers for using common methods on both recipe.rb and resource.rb
In this module has added tagged?(tags) method and included this module on both recipe.rb and resource.rb
Added test cases
Ensured chef-style on the code changes made

Issues Resolved
Fixes ZD 20517
Fixed #7449
Check List

[x] New functionality includes tests
[x] All tests pass
[ ] RELEASE_NOTES.md has been updated if required (not required for bugfixes, required for API changes)
[x] All commits have been signed-off for the Developer Certificate of Origin. See https://github.com/chef/chef/blob/master/CONTRIBUTING.md#developer-certification-of-origin-dco

@btm @tas50 I have added a new module CommonHelpers (Is this module name fine or we need to change it?) for using common methods on both recipe.rb and resource.rb so now user can use tagged?(tags) directly on both the levels recipe and resource, now user can use it like:
  command "echo 'blah'"
  action :run
  live_stream true
  not_if { tagged?('blah') }
end```
Please let me know if you have any require changes.

not_if { node.tagged?('blah') } already works FWIW.

Right @coderanger we are aware of that. But we just want to know do we want this to be called directly on resource level too ? So we thought of creating PR and then let everyone review it. We already conveyed to customer support team that this #7449 issue can be resolved using recipe.tagged?  or as you suggested node.tagged?. and

@tas50 and @btm let us know your thoughts on this.

i'm not sure being able to write tagged? vs. node.tagged? is compelling enough of a use case to inject the method into all these contexts and potentially result in name-space collisions.  think i'm agreeing somewhat with the direction @coderanger is leaning.

@lamont-granquist Fixed review comments, Please let me know if you have any require changes.

yeah i guess this looks fine and we've got past issues and users in ZD tickets that want it.
and i'm feeling less worried about the predicate method being injected today since it already has meaning in chef-land, this just makes it broader.


text:
chef-server-ctl install locally with --path only works on fully qualified path

Works:
chef-server-ctl install opscode-manage --path /home/vagrant
Doesn't work:
cd /home
chef-server-ctl install opscode-manage --path ./vagrant

HTTP 301 https://github.com/chef/chef-server/issues/192

authors: stevendanna tylercloke

repo: chef/opscode-omnibus


text:
🛑 Homepage is down

In 012ea9f, Homepage (https://larrychen.tech) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Homepage is back up in 7cb3df2.

repo: chendachao/uptime


text:
🛑 Homepage is down

In c256a2d, Homepage (https://larrychen.tech) was down:

HTTP code: 0
Response time: 0 ms

Resolved: Homepage is back up in 5e201c4.


text:
Ignore sublime configuration files

Noticed that latest NPM package release (0.3.0) contains Sublime configuration files, which seems like got there accidentally. To prevent it further, it's better to ignore those files from adding to NPM package.

Damn it! I thought I made sure this didn't happen again...
Thanks!

authors: chenglou operatino

repo: chenglou/react-motion

license: mit


text:
🛑 tt is down

In 3070351, tt (https://telebot-app-serverless-i7z8-chenhaonanniubi.vercel.app/checkhealth) was down:

HTTP code: 500
Response time: 3532 ms

Resolved: tt is back up in c807079.

repo: chenhaonanniubi/upptime


text:
🛑 tt is down

In b2c3728, tt (https://telebot-app-serverless-i7z8-chenhaonanniubi.vercel.app/checkhealth) was down:

HTTP code: 500
Response time: 3708 ms

Resolved: tt is back up in ed58d85 after 10 minutes.


text:
🛑 tt is down

In 3587613, tt (https://telebot-app-serverless-i7z8-chenhaonanniubi.vercel.app/checkhealth) was down:

HTTP code: 500
Response time: 5042 ms

Resolved: tt is back up in 009f5e7 after 49 minutes.


text:
🛑 tt is down

In 1dceefa, tt (https://telebot-app-serverless-i7z8-chenhaonanniubi.vercel.app/checkhealth) was down:

HTTP code: 500
Response time: 3299 ms

Resolved: tt is back up in 0a4d65c.


text:
如何解决paddlespeech_stream模式CPU占用极高问题?

在Linux机器上测试paddlespeech_stream模型时，CPU占用极高，基本上打满了：
./build/examples/paddlespeech_stream models/paddlespeech_stream/ models/paddlespeech_stream/long.wav

我可以通过设置线程数OPENBLAS_NUM_THREADS解决cpu核数问题，但会造成性能低，且单核打满。
这种情况导致我无法在生产环境使用，请问有没有解决方案？

用这个项目吧，https://github.com/k2-fsa/sherpa-onnx，里面提了很多预训练模型，https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html，如果太占CPU可以选择模型小一些的模型，或者使用int8量化的版本。

conformer_online,这个流式的在测试长音频的时候, 运行到一半就卡住,或者报 Segmentation fault (core dumped)


text:
关于训练的batchsize

我用自己的训练框架和这里的模型，同时使用24GB显存的RTX A5000显卡，但是对于256×256的图片，我最高只可以设置到16的batchsize，设置为32就会显示显存不足了，请问可以发布您的训练代码吗？或者请问您使用了哪些能够降低显存的方法呢？

256只能到16是有点不合理，你网络完全用的我给的配置吗？或者能够用我提供的pth推理吗？

发现是自己代码框架的问题了，感谢作者！