repo_name
stringlengths
1
62
dataset
stringclasses
1 value
lang
stringclasses
11 values
pr_id
int64
1
20.1k
owner
stringlengths
2
34
reviewer
stringlengths
2
39
diff_hunk
stringlengths
15
262k
code_review_comment
stringlengths
1
99.6k
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -0,0 +1,292 @@ +# Copyright 2023 The Wordcab Team. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unles...
```suggestion data = { "alignment": alignment, "diarization": diarization, "source_lang": source_lang, "timestamps": timestamps, "word_timestamps": word_timestamps, "dual_channel": dual_channel, } if vocab: data["vocab"] = vocab with o...
wordcab-transcribe
github_2023
python
94
Wordcab
chainyo
@@ -14,6 +14,7 @@ """Utils module of the Wordcab Transcribe.""" import asyncio import json +import requests import math import re import subprocess # noqa: S404
```suggestion """Utils module of the Wordcab Transcribe.""" import asyncio import json import math import re import subprocess # noqa: S404 ```
wordcab-transcribe
github_2023
python
179
Wordcab
chainyo
@@ -398,9 +398,12 @@ def __call__( # ) # if not use_batch and not isinstance(audio, tuple): - if vocab: - words = ", ".join(vocab) - prompt = f"Vocab: {words[:-2]}" + if vocab is not None: + if isinstance(vocab, list) and len(vocab) > 0 and vocab[0]...
```suggestion if ( vocab is not None and isinstance(vocab, list) and len(vocab) > 0 and vocab[0].strip() ): words = ", ".join(vocab) prompt = f"Vocab: {words.strip()}" else: prompt = None ```
wordcab-transcribe
github_2023
python
18
Wordcab
chainyo
@@ -127,6 +130,41 @@ async def download_file_from_youtube(url: str, filename: str) -> str: return filename + ".wav" +async def download_audio_file(url: str, filename: str) -> str: + """ + Download an audio file from a URL. + + Args: + url (str): URL of the audio file. + filename (str): F...
I added `url_headers` because some signed url can require authentication. ```suggestion async def download_audio_file( url: str, filename: str, url_headers: Optional[Dict[str, str]] = None ) -> str: """ Download an audio file from a URL. Args: url (str): URL of the audio file. ...
wordcab-transcribe
github_2023
python
18
Wordcab
chainyo
@@ -12,15 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. """Utils module of the Wordcab Transcribe.""" - import asyncio import math +import mimetypes import re import subprocess # noqa: S404 import sys from pathlib import Path from typing impo...
```suggestion from typing import Dict, List, Optional ```
wordcab-transcribe
github_2023
python
16
Wordcab
aleksandr-smechov
@@ -50,6 +51,15 @@ async def startup_event(): """Startup event handler.""" logger.debug("Starting up...") + + user_platform = retrieve_user_platform() + if user_platform != "Ubuntu" or user_platform != "Linux": + logger.warning( + "You are not running the application on Ubuntu or Linu...
Did you mean MacOS or Linux
wordcab-transcribe
github_2023
python
8
Wordcab
chainyo
@@ -131,18 +133,20 @@ async def inference_with_audio( else: filepath = filename - utterances = await asr.process_input( + raw_utterances = await asr.process_input( filepath, num_speakers, source_lang, timestamps ) - utterances = [ - { - "text": str(utterance["tex...
I would keep the list comprehension style for readability. ```suggestion utterances = [ { "text": format_punct(utterance["text"]), "start": utterance["start"], "end": utterance["end"], "speaker": int(utterance["speaker"]), } for utte...
wordcab-transcribe
github_2023
python
8
Wordcab
chainyo
@@ -187,18 +191,20 @@ async def inference_with_youtube( filename = f"yt_{shortuuid.ShortUUID().random(length=32)}" filepath = await download_file_from_youtube(url, filename) - utterances = await asr.process_input( + raw_utterances = await asr.process_input( filepath, num_speakers, source_lang...
Same here: ```suggestion utterances = [ { "text": format_punct(utterance["text"]), "start": utterance["start"], "end": utterance["end"], "speaker": int(utterance["speaker"]), } for utterance in raw_utterances if not is_empty_s...
wordcab-transcribe
github_2023
python
8
Wordcab
chainyo
@@ -139,6 +139,26 @@ def delete_file(filepath: str) -> None: filepath.unlink() +def is_empty_string(text): + text = text.replace(".", "") + text = re.sub(r"\s+", "", text) + if text.strip(): + return False + return True + + +def format_punct(text): + text = text.replace("...", "")
I think `.maketrans()` could be faster than multiple `.replace()`, but it's probably irrelevant here.
php-tui
github_2023
php
193
php-tui
dantleech
@@ -65,19 +65,20 @@ public function render(WidgetRenderer $renderer, Widget $widget, Buffer $buffer) ->setStyle($widget->yAxis->style); } - foreach ($widget->dataSets as $dataSet) { - $subBuffer = Buffer::empty($layout->graphArea); - $renderer->render($renderer, ...
not sure this needs a "sub buffer"? the buffer passed to the widget should already be empty
php-tui
github_2023
php
169
php-tui
dantleech
@@ -8,16 +8,16 @@ final class Modifier { - public const NONE = 0b000000000000; - public const BOLD = 0b000000000001; - public const DIM = 0b000000000010; - public const ITALIC = 0b000000000100; - public const UNDERLINED = 0b000000001000; - public const SLOWBLINK = 0b0...
would be nice if these could stay aligned somehow as it's good visual validation
php-tui
github_2023
php
140
php-tui
dantleech
@@ -0,0 +1,10 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Model; + +interface Parseable +{ + public static function parse(string $string): self;
This interface is a bit anaemic (it's about Style but the naming implies anything or everything) and it's role is more of a Parser and not something that can be parsed? - maybe rename to StyleParser with return type Style?
php-tui
github_2023
php
140
php-tui
dantleech
@@ -80,10 +78,7 @@ public function lorem(): ParagraphWidget $text = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'; return ParagraphWidget::fromText( - Text::styled( - $text, - Sty...
minor: use `sprintf` instead, maybe there's a CS rule for that :thinking:
php-tui
github_2023
php
140
php-tui
dantleech
@@ -58,6 +59,13 @@ public static function fromString(string $string): self ], null); } + public static function parse(string $string): self + { + return self::fromSpans( + SpanParser::new()->parse($string)
not related to this PR but I want to make all `fromFoos(` variadics, so should be `fromSpans(...SpanParser::new()->parse($string))`
php-tui
github_2023
php
140
php-tui
dantleech
@@ -0,0 +1,135 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Model\Widget; + +use PhpTui\Tui\Model\Color; +use PhpTui\Tui\Model\Color\AnsiColor; +use PhpTui\Tui\Model\Color\RgbColor; +use PhpTui\Tui\Model\Modifier; +use PhpTui\Tui\Model\Style; + +final class SpanParser +{ + private const OPEN_TAG_REG...
maybe avoid state and pass `&$styleStack` in the function calls?
php-tui
github_2023
php
140
php-tui
dantleech
@@ -0,0 +1,135 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Model\Widget; + +use PhpTui\Tui\Model\Color; +use PhpTui\Tui\Model\Color\AnsiColor; +use PhpTui\Tui\Model\Color\RgbColor; +use PhpTui\Tui\Model\Modifier; +use PhpTui\Tui\Model\Style; + +final class SpanParser
let's make this a subset of the Symfony Console component markup, and add a class comment here with a link to: `https://symfony.com/doc/current/console/coloring.html`
php-tui
github_2023
php
140
php-tui
dantleech
@@ -0,0 +1,135 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Model\Widget; + +use PhpTui\Tui\Model\Color; +use PhpTui\Tui\Model\Color\AnsiColor; +use PhpTui\Tui\Model\Color\RgbColor; +use PhpTui\Tui\Model\Modifier; +use PhpTui\Tui\Model\Style; + +final class SpanParser +{ + private const OPEN_TAG_REG...
in Symfony the delimiter is `;` not space...
php-tui
github_2023
php
140
php-tui
dantleech
@@ -26,6 +27,22 @@ public static function fromString(string $string): self }, explode("\n", $string))); } + public static function parse(string $string): self + { + $placeholder = sprintf('{{new_line_%s}}', microtime(true));
`uniqid` would be safer than `microtime`
php-tui
github_2023
php
140
php-tui
dantleech
@@ -0,0 +1,278 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Tests\Unit\Model\Widget; + +use InvalidArgumentException; +use PhpTui\Tui\Model\Color\AnsiColor; +use PhpTui\Tui\Model\Color\RgbColor; +use PhpTui\Tui\Model\Modifier; +use PhpTui\Tui\Model\Widget\SpanParser; +use PHPUnit\Framework\TestCase; + ...
as mentioned previously, to be compatible with Symfony we need this to be delimited with `;`
php-tui
github_2023
php
140
php-tui
dantleech
@@ -10,6 +10,12 @@ use PhpTui\Tui\Model\Modifier; use PhpTui\Tui\Model\Style; +/** + * This class is a subset of the Symfony Console component's OutputFormatter class. + * It parses strings containing tags into a list of spans.
Technically it's not a subset of the class but a subset of the ... markup?
php-tui
github_2023
php
136
php-tui
dantleech
@@ -0,0 +1,97 @@ +<?php + +declare(strict_types=1); + +namespace PhpTui\Tui\Model\Style; + +use PhpTui\Tui\Model\AnsiColor; +use PhpTui\Tui\Model\Color; +use PhpTui\Tui\Model\Style; + +trait InteractsWithBgColor
do we need 3 traits? either something can have a style or it cannot? I would call it `StyleableTrait`.
php-tui
github_2023
php
131
php-tui
dantleech
@@ -41,7 +41,7 @@ public function toStyledGraphemes(Style $baseStyle): array return array_map(function (string $grapheme) use ($baseStyle) { return new StyledGrapheme( symbol: $grapheme, - style: $baseStyle->patch($this->style), + style: $this->style-...
note the original is faithful to Ratatui: https://github.com/ratatui-org/ratatui/blob/9f371000968044e09545d66068c4ed4ea4b35d8a/src/text/span.rs#L141 opened a PR on your PR https://github.com/KennedyTedesco/php-tui/pull/1
php-tui
github_2023
php
104
php-tui
dantleech
@@ -25,10 +25,11 @@ public function testEmpty(): void public function testFilled(): void { - $buffer = Buffer::filled(Area::fromScalars(0, 0, 10, 10), Cell::fromChar('X')); + $cell = Cell::fromChar('X'); + $buffer = Buffer::filled(Area::fromScalars(0, 0, 10, 10), $cell); self::...
Same is an identity check anyway, so `spl_object_id` is redundant here I think
php-tui
github_2023
php
78
php-tui
dantleech
@@ -103,12 +97,10 @@ private static function renderChar( } } - $maxX = null; foreach ($points as $point) { - if (null === $point) { - continue; + if (null !== $point) {
this was an "early continue" and is intentional, it's a guard condition.
php-tui
github_2023
php
66
php-tui
dantleech
@@ -53,16 +53,18 @@ public function advance(): void */ public function parseLine(): string { - $taken = $this->takeWhile(fn (?string $token) => $token !== "\n"); + $taken = $this->takeWhile( + static fn (string $token): bool => $token !== PHP_EOL
`PHP_EOL` is platform dependent IIRC. really we should be checking for any type of new line `\n`, `\r`, `\r\n` or whatever, but otherwise happy to keep it with `"\n"`
php-tui
github_2023
php
66
php-tui
dantleech
@@ -0,0 +1,26 @@ +<?php + +namespace PhpTui\Bdf\Tests\Benchmark; + +use RuntimeException; +use PhpTui\BDF\BdfParser; +use PhpBench\Attributes\Iterations; +use PhpBench\Attributes\Revs; + +#[Iterations(10)] +#[Revs(25)] +final class BdfParserBench +{ + public function benchParseRealFont(): void + { + $conte...
it won't make much difference, but it's better to do any setup _outside_ of the `bench` method as it can muddy the results (we're not benchmarking `file_get_contents`). The simplest way is to do it in the constructor (you can also add custom `setUp` methods but `__construct` is fine
php-tui
github_2023
php
65
php-tui
dantleech
@@ -66,4 +75,13 @@ public function paint(Position $position, Color $color): void $this->colors[$index] = $color; } } + + private function cacheBrailleChars(): void + { + [$from, $to] = BrailleSet::RANGE; + + for ($i = $from; $i <= $to; $i++) { + $this->brailleCh...
hm, is there any point in doing this and lazily loading the char on line 54? i think we could remove this function no?
babyagi-ui
github_2023
typescript
80
miurla
miurla
@@ -5,22 +5,22 @@ export class AgentExecuter { objective: string; modelName: string; messageCallback: (message: Message) => void; - statusCallback: (status: AgentStatus) => void; + statusCallback: (status: AgentStatus, taskId?: number | string | undefined | null) => void; cancelCallback: () => void; ve...
Do we need a string type?
babyagi-ui
github_2023
typescript
80
miurla
miurla
@@ -61,9 +61,56 @@ export class AgentExecuter { this.isRunning = false; } - // prepare() is called before loop() async prepare() { this.printer.printObjective(this.objective); } - async loop() {} + + async loop() { + while (this.isRunning && this.taskList.length > 0) {
I wasn't sure if I should write the loop process, but I didn't dare because the loop condition changes for each agent executor. https://github.com/miurla/babyagi-ui/blob/main/src/agents/babycatagi/agent.ts#L528
babyagi-ui
github_2023
typescript
80
miurla
miurla
@@ -61,9 +61,56 @@ export class AgentExecuter { this.isRunning = false; } - // prepare() is called before loop() async prepare() { this.printer.printObjective(this.objective); } - async loop() {} + + async loop() { + while (this.isRunning && this.taskList.length > 0) { + const currentTas...
I’d like to put all the task convenience functions in utils/task.ts https://github.com/miurla/babyagi-ui/blob/main/src/utils/task.ts
babyagi-ui
github_2023
typescript
80
miurla
miurla
@@ -54,6 +54,9 @@ export type AgentStatusType = | 'executing' | 'prioritizing' | 'saving' + | 'running'
`AgentStatusType` is mainly used to display status on the UI. I don't see how `running` is consistent with other statuses, since it is not exclusive of other statuses.
babyagi-ui
github_2023
others
74
miurla
miurla
@@ -364,7 +364,9 @@ class Translator { 'en', 'ko', 'pt', + 'pt-BR',
Since `pt-BR` and `ar-SA` are locale that did not exist originally, there are no directories for them and I am getting an error. ``` > babyagi-ui@0.1.0 translate > node ./translator.cjs [ATi18n]:> Would you like me to translate the entire project automatically to all the locales you have enabled? (y/n) n [AT...
babyagi-ui
github_2023
typescript
57
miurla
miurla
@@ -34,9 +35,31 @@ export const availableLanguages: Language[] = [ { code: 'fi', name: 'Suomi', flag: '🇫🇮' }, { code: 'no', name: 'Norsk', flag: '🇳🇴' }, { code: 'tr', name: 'TÜRKİSH', flag: '🇹🇷' }, - { code: "pl", name: "Polski", flag: "🇵🇱" }, + { code: 'pl', name: 'Polski', flag: '🇵🇱' }, { code...
duplication `hi` https://github.com/miurla/babyagi-ui/pull/57/files#diff-6703b91dc8242fb5425dfa1a282a7ea5c9a9bc92cd8f453a61aa06dc6b2eb5b0R16
babyagi-ui
github_2023
typescript
57
miurla
miurla
@@ -34,9 +35,31 @@ export const availableLanguages: Language[] = [ { code: 'fi', name: 'Suomi', flag: '🇫🇮' }, { code: 'no', name: 'Norsk', flag: '🇳🇴' }, { code: 'tr', name: 'TÜRKİSH', flag: '🇹🇷' }, - { code: "pl", name: "Polski", flag: "🇵🇱" }, + { code: 'pl', name: 'Polski', flag: '🇵🇱' }, { code...
duplication `uk` https://github.com/miurla/babyagi-ui/pull/57/files#diff-6703b91dc8242fb5425dfa1a282a7ea5c9a9bc92cd8f453a61aa06dc6b2eb5b0R25
babyagi-ui
github_2023
others
56
miurla
miurla
@@ -20,7 +20,7 @@ This is a port of [babyagi](https://github.com/yoheinakajima/babyagi) with [Lang - [x] Exporting Execution Results - [x] Execution history - [x] Faster speeds and fewer errors. ([😺 BabyCatAGI](https://twitter.com/yoheinakajima/status/1657448504112091136)) -- [x] i18n support ( '🇧🇷', '🇩🇪', '🇺�...
Thx 🙏
babyagi-ui
github_2023
typescript
55
miurla
miurla
@@ -17,6 +17,27 @@ export const availableLanguages: Language[] = [ { code: 'ja', name: '日本語', flag: '🇯🇵' }, { code: 'ru', name: 'Русский', flag: '🇷🇺' }, { code: 'th', name: 'ไทย', flag: '🇹🇭' }, + { code: 'en', name: 'English', flag: '🇺🇸' },
In this project, availableLanguages is used directly for the selection items. https://github.com/miurla/babyagi-ui/blob/main/src/components/Sidebar/SidebarSettings.tsx#L175 So I’d like to sort this list in ascending order by language code. Alternatively, the sorting logic can be added on the component side.
babyagi-ui
github_2023
typescript
55
miurla
miurla
@@ -17,6 +17,27 @@ export const availableLanguages: Language[] = [ { code: 'ja', name: '日本語', flag: '🇯🇵' }, { code: 'ru', name: 'Русский', flag: '🇷🇺' }, { code: 'th', name: 'ไทย', flag: '🇹🇭' }, + { code: 'en', name: 'English', flag: '🇺🇸' }, + { code: 'ko', name: '한국어', flag: '🇰🇷' }, + { code: 'pt'...
In order to support Arabic, I think we need to support right-justification as well as text. https://en.wikipedia.org/wiki/Right-to-left_script So, it would be better to remove it once.
babyagi-ui
github_2023
others
47
miurla
miurla
@@ -344,16 +369,14 @@ const rl = readline.createInterface({ output: process.stdout, }); -rl.question(`Choose a mode:\n1. Automatic mode\n2. Manual mode\n`, (answer) => { - rl.question('Enter source language code: ', (srcLang) => { - srcLang === '' ? (srcLang = 'en') : (srcLang = srcLang); - rl.question('En...
[nits] Unnecessary
babyagi-ui
github_2023
others
38
miurla
miurla
@@ -21,7 +21,7 @@ This is a port of [babyagi](https://github.com/yoheinakajima/babyagi) with [Lang - [x] Execution history - [x] Faster speeds and fewer errors. ([😺 BabyCatAGI](https://twitter.com/yoheinakajima/status/1657448504112091136)) - [ ] Display the current task and task list -- [ ] i18n support +- [x] i18n...
🙌 🙌
babyagi-ui
github_2023
typescript
38
miurla
miurla
@@ -0,0 +1,112 @@ +import { SelectItem } from '@/types';
FYI: The language selection menu was implemented separately, so this file was removed in #40. 🙏
babyagi-ui
github_2023
others
38
miurla
miurla
@@ -6,7 +6,8 @@ "dev": "next dev", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "translate": "node ./translate.cjs"
File name is wrong. `translate.cjs` -> `translator.cjs`
babyagi-ui
github_2023
others
38
miurla
miurla
@@ -0,0 +1,359 @@ +require('dotenv').config(); +const fs = require('fs'); +const path = require('path'); +const { Configuration, OpenAIApi } = require('openai'); + +class Translator {
🆒
basaran
github_2023
others
150
hyperonym
fardeon
@@ -0,0 +1,46 @@ +name: basaran +adopt-info: basaran +summary: Basaran is an open-source alternative to the OpenAI text completion API. +description: | + Basaran is an open-source alternative to the OpenAI text completion API. + It provides a compatible streaming API for your Hugging Face Transformers-based text gene...
I'm not familiar with snap, would this make the user install a `download` command? If so, it might be too broad. Perhaps something like `basaran-download` or `download-model` would be less ambiguous?
basaran
github_2023
others
34
hyperonym
peakji
@@ -40,13 +40,19 @@ body { .pg-prompt { -moz-user-modify: read-write-plaintext-only; -webkit-user-modify: read-write-plaintext-only;
Remove `-moz-user-modify` and `-webkit-user-modify` since we're now using textarea?
basaran
github_2023
javascript
34
hyperonym
peakji
@@ -434,8 +434,14 @@ class Inspector { } }); + let resizePrompt = () => { + prompt.style.height = 0; + prompt.style.height = prompt.scrollHeight + "px";
Great solution! Actually the only reason I use `contenteditable` is just to make it auto-growing. 😂
basaran
github_2023
others
34
hyperonym
peakji
@@ -16,10 +16,11 @@ <h4 class="pg-title">{{ model }}</h4> <div class="pg-body"> <div class="pg-left"> <div class="pg-inputs"> - <div class="pg-prompt" role="textbox" placeholder="Enter prompt here" contenteditable></div> + <textarea class="pg-...
The only problem with adding another button is that it may cause wrapping on narrower screens. Perhaps we could display an ellipsis for the last two buttons? ![IMG_6625](https://user-images.githubusercontent.com/219051/224759038-98913eed-e602-46e5-ac7d-fa0c75d1e3ef.PNG)
basaran
github_2023
others
34
hyperonym
peakji
@@ -0,0 +1,122 @@ +[ + { + "id": "default", + "name": "Default", + "temperature": 0.7, + "top_k": 40, + "top_p": 1, + "typical_p": 1, + "penalty_alpha": 0, + "repetition_penalty": 1.17
The default preset should be consistent with the OpenAI API, so I think it should be 0 here? Reference: https://platform.openai.com/docs/api-reference/completions/create
basaran
github_2023
others
34
hyperonym
peakji
@@ -38,15 +38,19 @@ body { } .pg-prompt { - -moz-user-modify: read-write-plaintext-only; - -webkit-user-modify: read-write-plaintext-only; + background-color: transparent; + border: 0; + box-sizing: border-box; font-size: 16px; + font-family: inherit; line-height: 24px; min-height: ...
Can we use `resize: none;` instead to hide the little resize handle and let auto-growing do the job?
openai-go
github_2023
go
5
rakyll
rakyll
@@ -29,3 +35,27 @@ type Image struct { URL string `json:"url,omitempty"` Base64JSON string `json:"b64_json,omitempty"` } + +func (c *Image) Save(filename string, toBase64 bool) (ok bool, err error) {
Base64JSON is populated by the server when response type is set to `b64_json`. We shouldn't mutate it. On the other hand, instead of assuming that the user have access to a file system, we should turn this method into something that returns an io.ReadCloser for flexibility. What about something like below? ``` f...
openai-go
github_2023
go
2
rakyll
rakyll
@@ -78,6 +79,71 @@ func (s *Session) MakeRequest(ctx context.Context, endpoint string, input, outpu return json.NewDecoder(resp.Body).Decode(output) } +// Upload makes a multi-part form data upload them with +// session's API key. Upload combines the file with the given params +// and unmarshals the response as ou...
We should probably consider splitting this into its own function.
OpenNept4une
github_2023
others
234
OpenNeptune3D
barrenechea
@@ -287,6 +306,20 @@ install_feature() { # Proceed if the user agrees or if auto_yes is true if [[ $user_input =~ ^[Yy]$ || -z $user_input || $auto_yes = "true" ]]; then echo -e "Running $feature_name Installer...\n" + + if [ "$feature_name" = "Updated Display Firmware" ]; then + if...
What `--filter=blob:none --sparse` brings to the table? Just curious
OpenNept4une
github_2023
others
234
OpenNeptune3D
barrenechea
@@ -763,7 +800,7 @@ print_menu() { echo "" echo -e "(${R} Q ${NC}) Quit" echo "==========================================================" - echo "Select an option by entering (1-7 / q):" + echo "Select an option by entering (1-6 / q):"
I think the main menu still has 7 options? It seems the added option for `display_firmware` is in the Advanced menu, and wouldn't require to decrease the options from the main menu. Can you double-check please? ```suggestion echo "Select an option by entering (1-7 / q):" ```
OpenNept4une
github_2023
others
153
OpenNeptune3D
anarsoul
@@ -59,19 +59,18 @@ gcode: Part_Light_ON G92 E0 G90 ; Use absolute coordinates - BED_MESH_CLEAR - G28
It may be better to home, then move head up by 50mm, and then start to heat the bed. Otherwise we don't know where the head is, and it may be heating up from the bed if it is too low
OpenNept4une
github_2023
others
105
OpenNeptune3D
barrenechea
@@ -24,7 +24,7 @@ variable_detach_macro: 'Dock_Probe' # The macro that is used to store th # The following variables are for adjusting adaptive purge settings for KAMP. variable_purge_height: 0.8 # Z position of nozzle during purge, default is 0.8. variable_tip_distance: 1.8 ...
Awesome tweak!
OpenNept4une
github_2023
others
88
OpenNeptune3D
barrenechea
@@ -1,19 +1,18 @@ <p align="center"> - <img src="pictures/OpenNept4une.png" alt="OpenNept4une Logo"> + <img src="pictures/OpenNept4une.png" width="350" alt="OpenNept4une Logo"> <h1 align="center">OpenNept4une</h1> + <h1 align="center">De-Elegoo-izing the Neptune 4 Series 3D Printers</h1> </p> -## De-Elegoo-iz...
I just noticed this, thank you!!
OpenNept4une
github_2023
others
71
OpenNeptune3D
barrenechea
@@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identit...
GitHub does not allow direct messaging to users. Maybe consider setting up a point of contact for this project? So you don't have to disclose PII. Or maybe refer to Elegoo Discord with your username 😄
snagboot
github_2023
others
53
bootlin
rgantois
@@ -0,0 +1,46 @@ +
You should link to this new doc file from an existing one, or people won't find it. Linking this one from docs/snagflash.md seems appropriate to me.
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,166 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + +from snagrecover.utils import BinFileHeader +from dataclasses import dataclass +import struct + +SPARSE_FILEHEADER_LEN = 28 +SPARSE_CHUNKHEADER_LEN = 12 +SPARSE_FILE_MA...
I guess this is WIP. When implementing this, you can use logger.error() + sys.exit(-1)
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,69 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + + +from snagflash.android_sparse_file.sparse import AndroidSparseFile +from snagflash.android_sparse_file.sparse import SPARSE_CHUNKHEADER_LEN +from snagflash.android_spa...
Please group these into a single import line
snagboot
github_2023
python
53
bootlin
rgantois
@@ -30,6 +35,9 @@ for more information on fastboot support in U-Boot. """ +class FastbootError(Exception): + pass
same comment as for SparseFileFormatError. Also, could you change other Fastboot methods in this file to use this as well?
snagboot
github_2023
python
53
bootlin
rgantois
@@ -218,3 +226,43 @@ def reset(self): self.dev.write(self.ep_out, packet, timeout=self.timeout) + def flash_sparse(self, args: str): + """ + Download and flash an android sparse file. + If the file is too big, it's splitting into + smaller android sparse files. + """ + try: + maxsize = int(self.getvar("m...
Could you make sure that this context manager automatically remove the directory when you're done with it?
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,67 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + + +from snagflash.android_sparse_file.sparse import AndroidSparseFile, SPARSE_CHUNKHEADER_LEN, CHUNK_TYPE_DONTCARE + +def unpack(path, outpath): + with open(outpath, "...
it doesn't seem like this is closed anywhere
snagboot
github_2023
python
53
bootlin
rgantois
@@ -226,3 +230,41 @@ def reset(self): self.dev.write(self.ep_out, packet, timeout=self.timeout) + def flash_sparse(self, args: str): + """ + Download and flash an android sparse file. + If the file is too big, it's splitting into + smaller android sparse files. + """ + try: + maxsize = int(self.getvar("m...
That would be "Downloading" not "Uploading", as per the Fastboot spec
snagboot
github_2023
python
53
bootlin
rgantois
@@ -226,3 +230,41 @@ def reset(self): self.dev.write(self.ep_out, packet, timeout=self.timeout) + def flash_sparse(self, args: str): + """ + Download and flash an android sparse file. + If the file is too big, it's splitting into + smaller android sparse files. + """ + try: + maxsize = int(self.getvar("m...
ditto
snagboot
github_2023
python
53
bootlin
rgantois
@@ -226,3 +230,41 @@ def reset(self): self.dev.write(self.ep_out, packet, timeout=self.timeout) + def flash_sparse(self, args: str): + """ + Download and flash an android sparse file. + If the file is too big, it's splitting into + smaller android sparse files. + """ + try: + maxsize = int(self.getvar("m...
Is the second parameter supposed to be an f-string? Also, I don't see "count" defined anywhere.
snagboot
github_2023
python
53
bootlin
rgantois
@@ -226,3 +230,41 @@ def reset(self): self.dev.write(self.ep_out, packet, timeout=self.timeout) + def flash_sparse(self, args: str): + """ + Download and flash an android sparse file. + If the file is too big, it's splitting into + smaller android sparse files. + """ + try: + maxsize = int(self.getvar("m...
nit: s/Splitted/Split/
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,67 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + + +from snagflash.android_sparse_file.sparse import AndroidSparseFile, SPARSE_CHUNKHEADER_LEN, CHUNK_TYPE_DONTCARE + +def unpack(path, outpath):
Is this function used anywhere? If not, please remove it.
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,171 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + +from snagrecover.utils import BinFileHeader +from dataclasses import dataclass +import struct + +SPARSE_FILEHEADER_LEN = 28 +SPARSE_CHUNKHEADER_LEN = 12 +SPARSE_FILE_MA...
It seems like the "unpack" argument is always initialized to False, except in the unpack() function which isn't called anywhere. So I suppose this second parameter could be dropped along with all associated conditional paths.
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,67 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + + +from snagflash.android_sparse_file.sparse import AndroidSparseFile, SPARSE_CHUNKHEADER_LEN, CHUNK_TYPE_DONTCARE + +def unpack(path, outpath): + with open(outpath, "...
I'd rather you used "new_fname" here, to distinguish it from the "fname" used in flash_sparse(), which refers to the input sparse file.
snagboot
github_2023
python
53
bootlin
rgantois
@@ -0,0 +1,67 @@ +# Copyright 2025 Collabora Ltd. +# +# SPDX-License-Identifier: GPL-2.0+ +# +# Author: Arnaud Patard <arnaud.patard@collabora.com> + + +from snagflash.android_sparse_file.sparse import AndroidSparseFile, SPARSE_CHUNKHEADER_LEN, CHUNK_TYPE_DONTCARE + +def unpack(path, outpath): + with open(outpath, "...
This seems like quite a roundabout way to check for a non-raw chunk. Why not simply check "header.type != CHUNK_TYPE_RAW"?
snagboot
github_2023
python
55
bootlin
rgantois
@@ -0,0 +1,29 @@ +import usb +import logging +logger = logging.getLogger("snagrecover") +from snagrecover.firmware.firmware import run_firmware +from snagrecover.utils import get_usb +from snagrecover.config import recovery_config +from snagrecover.protocols import dfu
The dfu import is unused, please remove it
snagboot
github_2023
python
28
bootlin
rgantois
@@ -77,17 +77,70 @@ "imx93" ] +# SoCs that use raw bulk endpoints rather than HID +raw_bulk_ep_socs = [ +"imx53", +] + +def build_hid_dev(vid, pid): + try: + return hid.Device(vid, pid) + except hid.HIDException: + access_error("USB HID", f"{vid:04x}:{pid:04x}") + +def build_raw_ep_dev(vid, pid): + dev = usb.core...
Could you please move this class definition outside of the function body?
snagboot
github_2023
python
28
bootlin
rgantois
@@ -145,49 +147,157 @@ def write32(self, addr: int, value: int) -> bool: logger.debug(f"Sending SDP packet {packet}") self.dev.write(packet) self.check_hab() - complete_status = self.dev.read(65, timeout=5000)[1:5] + complete_status = self._read(64, timeout=5000)[:4] self.end_cmd() return complete_stat...
I find this a bit hard to read. Could you please move this function definition outside of the SDPCommand class def? I think it would be more appropriate since it doesn't explicitly use the class attributes. Plus, it would tame the indentation a bit.
snagboot
github_2023
python
25
bootlin
rgantois
@@ -32,22 +32,24 @@ def dfu_cli(args): pid = int(dev_addr[1], 16) dev = get_usb(vid, pid) dev.default_timeout = int(args.timeout) - for dfu_config in args.dfu_config: - (altsetting,sep,path) = dfu_config.partition(":") - altsetting = int(altsetting) - with open(path, "rb") as file: - blob = file.read(-1) - ...
Could you please move the body of this `for` loop into a separate function? The indentation is getting a little too deep here.
snagboot
github_2023
others
24
bootlin
rgantois
@@ -260,3 +260,33 @@ DM firmware, U-Boot SPL for A53 and device tree blobs configuration: * path +## For TI AM62Ax devices + +[example](../src/snagrecover/templates/am62ax.yaml) + +**Warning** Please refer to +[this documentation](https://software-dl.ti.com/processor-sdk-linux/esd/AM62AX/latest/exports/docs/linux/...
This link would be useful to have in the docs but since the rest of the doc is identical to the AM62x case, could you just rename the AM62x doc section to AM62x/AM62AX and put this link there?
snagboot
github_2023
python
21
bootlin
rgantois
@@ -34,7 +34,7 @@ def dfu_cli(args): dev.default_timeout = int(args.timeout) for dfu_config in args.dfu_config: (altsetting,sep,path) = dfu_config.partition(":") - if args.size:
This is actually a deprecated command line arg which is why you got an AttributeError. Could you please remove this check entirely?
snagboot
github_2023
python
21
bootlin
rgantois
@@ -34,7 +34,7 @@ def dfu_cli(args): dev.default_timeout = int(args.timeout) for dfu_config in args.dfu_config: (altsetting,sep,path) = dfu_config.partition(":") - if args.size: + if hasattr(args, "size"):
This entire if/else block and the `if size is None` check a few lines below will be unecessary. Could you please remove those?
snagboot
github_2023
python
22
bootlin
rgantois
@@ -162,7 +163,11 @@ def detach(self, partid: int): self.set_partition(partid) self.get_status() logger.info("Sending DFU_DETACH...") - self.dev.ctrl_transfer(0xa1, 0, wValue=0x7530, wIndex=0, data_or_wLength=0) + try: + self.dev.ctrl_transfer(0xa1, 0, wValue=0x7530, wIndex=0, data_or_wLength=0) + except ...
Could you please add an else block with a warning log?
pyspark-ai
github_2023
others
177
pyspark-ai
gengliangwang
@@ -19,6 +19,14 @@ nav: - udf_generation.md - contributing.md - resources.md + - Examples: + - "notebooks/create_udf.ipynb" + - "notebooks/example.ipynb"
Shall we move this one to the first so that users can have a quick overview?
pyspark-ai
github_2023
python
195
pyspark-ai
grundprinzip
@@ -582,7 +582,7 @@ def plot_df( instruction = f"The purpose of the plot: {desc}" if desc is not None else "" tags = self._get_tags(cache) plot_chain = PythonExecutor( - df=df, + df=DataFrameLike(df),
Interesting, was this enough for you to silence pydantic? Down the path it uses the spark sql chain and this was expecting a classic DataFrame and I had to change the annotation in the pydantic BaseModel
pyspark-ai
github_2023
others
107
pyspark-ai
gengliangwang
@@ -37,6 +37,7 @@ grpcio = ">=1.56.0" plotly = "^5.15.0" pyarrow = ">=4.0.0" grpcio-status = ">=1.56.0" +pyfakefs = "^5.2.4"
@xinrong-meng since it's just for benchmark, we can move the new one to [tool.poetry.dev-dependencies]
pyspark-ai
github_2023
python
107
pyspark-ai
gengliangwang
@@ -0,0 +1,160 @@ +import contextlib +import io +from pyfakefs.fake_filesystem_unittest import Patcher + +from pyspark.sql import SparkSession +from pyspark_ai import SparkAI +from pyspark_ai.ai_utils import AIUtils +from benchmark.plot.benchmark_util import * + + +def prep_df(spark_ai): + data = [ + ("2023-0...
nit: not a big deal but we can assign better names to these funcitons
pyspark-ai
github_2023
others
182
pyspark-ai
gengliangwang
@@ -31,6 +31,7 @@ pygments = "^2.15.1" # plot extras pandas = { version = ">=1.0.5", optional = true } plotly = { version = "^5.15.0", optional = true } +pyarrow = { version = ">=4.0.0", optional = true }
pyarrow is used on plotting ? As per https://spark.apache.org/docs/2.4.0/sql-pyspark-pandas-with-arrow.html, seems so..
pyspark-ai
github_2023
others
176
pyspark-ai
gengliangwang
@@ -69,7 +69,7 @@ llm = AzureChatOpenAI( spark_ai = SparkAI(llm=llm) spark_ai.activate() # active partial functions for Spark DataFrame ``` -As per [Microsoft's Data Privacy page](https://learn.microsoft.com/en-us/legal/cognitive-services/openai/data-privacy), using the Azure OpenAI service can provide better data ...
let's remove the changes from the other PR about README
pyspark-ai
github_2023
others
176
pyspark-ai
gengliangwang
@@ -127,28 +127,6 @@ Now when you call df.ai.transform as before, the agent will use word embeddings For a detailed walkthrough, please refer to our [vector_similarity_search.ipynb](./examples/vector_similarity_search.ipynb). -### Data Ingestion
@asl3 the readme changes are still here.
pyspark-ai
github_2023
others
175
pyspark-ai
gengliangwang
@@ -127,28 +127,6 @@ Now when you call df.ai.transform as before, the agent will use word embeddings For a detailed walkthrough, please refer to our [vector_similarity_search.ipynb](./examples/vector_similarity_search.ipynb). -### Data Ingestion -If you have [set up the Google Python client](https://developers.goo...
Let's add one line for the creation of `auto_df` e.g ``` # auto sales data from https://www.carpro.com/blog/full-year-2022-national-auto-sales-by-brand data = [('Toyota', 1849751, -9), ('Ford', 1767439, -2), ('Chevrolet', 1502389, 6), ('Honda', 881201, -33), ('Hyundai', 724265, -2), ('Kia', 693549, -1), ...
pyspark-ai
github_2023
others
175
pyspark-ai
gengliangwang
@@ -127,30 +127,31 @@ Now when you call df.ai.transform as before, the agent will use word embeddings For a detailed walkthrough, please refer to our [vector_similarity_search.ipynb](./examples/vector_similarity_search.ipynb). -### Data Ingestion -If you have [set up the Google Python client](https://developers.go...
where is `spark` from? We can create a new SparkSession
pyspark-ai
github_2023
python
132
pyspark-ai
gengliangwang
@@ -62,5 +62,25 @@ def test_multiple_sql_code_blocks(self): self.assertEqual(AIUtils.extract_code_blocks(text), ["SELECT a FROM b;", "SELECT c FROM d;"]) +class TestRetryExecution(unittest.TestCase):
@xinrong-meng can we have a test case which mocks the response from LLM and generates bad code?
pyspark-ai
github_2023
python
132
pyspark-ai
gengliangwang
@@ -132,3 +132,17 @@ def extract_code_blocks(text: str) -> List[str]: if text.startswith("`") and text.endswith("`"): return [text.strip("`")] return [text] + + @staticmethod + def retry_execution(callback, max_tries=3): + tries = 0 + last_exception = None ...
We need to have a conversation with LLM and feedback the error message
pyspark-ai
github_2023
python
132
pyspark-ai
gengliangwang
@@ -484,21 +484,30 @@ def explain_df(self, df: DataFrame, cache: bool = True) -> str: def plot_df( self, df: DataFrame, desc: Optional[str] = None, cache: bool = True ) -> None: - instruction = f"The purpose of the plot: {desc}" if desc is not None else "" tags = self._get_tags(cache)...
TBH I prefer a clean way as follows: ``` SystemMessage("you are an assistant on plotting...") HumanMessage("plot 4 week moving average") AIMessage("import pandas as pd...") HumanMessage("Error:...") AIMessage("....") ```
pyspark-ai
github_2023
python
171
pyspark-ai
asl3
@@ -205,6 +216,22 @@ prefix=SPARK_SQL_PREFIX, ) +SQL_CHAIN_EXAMPLES = [ + sql_question1 + f"\nAnswer:\n```{sql_answer1}```", + sql_question2 + f"\nAnswer:\n```{sql_answer2}```",
do we want to give it all 4 examples?
pyspark-ai
github_2023
python
163
pyspark-ai
gengliangwang
@@ -40,13 +40,85 @@ template=SQL_TEMPLATE, ) -SPARK_SQL_EXAMPLES = [ +SPARK_SQL_EXAMPLES_NO_VECTOR_SEARCH = [ """QUESTION: Given a Spark temp view `spark_ai_temp_view_14kjd0` with the following sample vals, in the format (column_name: type, [sample_value_1, sample_value_2...]): ``` -(a: STRING, [Kong...
We can store the common examples into variables to avoid duplicated code. So that in the future we don't need to modify two examples together.
pyspark-ai
github_2023
python
163
pyspark-ai
gengliangwang
@@ -40,13 +40,85 @@ template=SQL_TEMPLATE, ) -SPARK_SQL_EXAMPLES = [ +SPARK_SQL_EXAMPLES_NO_VECTOR_SEARCH = [ """QUESTION: Given a Spark temp view `spark_ai_temp_view_14kjd0` with the following sample vals, in the format (column_name: type, [sample_value_1, sample_value_2...]): ``` -(a: STRING, [Kong...
we should unify the output here even when there area no sample values, comparing to ``` (a: string, [Kongur Tagh, Grossglockner]) (b: int, [7649, 3798]) (c: string, [China, Austria]) ``` But we can do it in a follow-up PR
pyspark-ai
github_2023
python
163
pyspark-ai
gengliangwang
@@ -26,7 +26,10 @@ def _agent_type(self) -> str: @classmethod def create_prompt(cls, tools: Sequence[BaseTool]) -> BasePromptTemplate: """Return default prompt.""" - return SPARK_SQL_PROMPT + if len(tools) == 2:
Shall we can whether SimilarValueTool in the tools instead? In the future there can be more tools
pyspark-ai
github_2023
python
163
pyspark-ai
gengliangwang
@@ -363,6 +364,44 @@ def test_vector_file_lru_store_prepopulated_files(self): finally: self.spark.sql(f"DROP TABLE IF EXISTS {table_name}") + @unittest.skipUnless( + os.environ.get("OPENAI_API_KEY") and os.environ["OPENAI_API_KEY"].strip() != "", + "OPENAI_API_KEY is not...
```suggestion def test_transform_without_similar_value_tool(self): ```
pyspark-ai
github_2023
python
163
pyspark-ai
gengliangwang
@@ -98,43 +155,27 @@ Observation: OK Thought: I now know the final answer. Final Answer: SELECT COUNT(`Student`) FROM `spark_ai_temp_view_12qcl3` WHERE `Birthday` = '01-01-2006'""" - """QUESTION: Given a Spark temp view `spark_ai_temp_view_wl2sdf` with the following columns: -``` -PassengerId INT -Survived INT -P...
Let's abstract the common parts of * spark_sql_vector_example_1 & spark_sql_no_vector_example_1 * spark_sql_no_vector_example_2 & spark_sql_vector_example_2 into variables.
pyspark-ai
github_2023
others
162
pyspark-ai
gengliangwang
@@ -22,29 +22,43 @@ classifiers = [ ] [tool.poetry.dependencies] +# default required dependencies python = "^3.8.1" pydantic = "^1.10.10" -requests = "^2.31.0" -tiktoken = "0.4.0" -beautifulsoup4 = "^4.12.2" openai = "^0.27.8" langchain = ">=0.0.271,<0.1.0" -pandas = ">=1.0.5" pygments = "^2.15.1" -google-api-...
this one is for spark connect. We can have a group for spark connect.
pyspark-ai
github_2023
others
162
pyspark-ai
gengliangwang
@@ -22,29 +22,43 @@ classifiers = [ ] [tool.poetry.dependencies] +# default required dependencies python = "^3.8.1" pydantic = "^1.10.10" -requests = "^2.31.0" -tiktoken = "0.4.0" -beautifulsoup4 = "^4.12.2" openai = "^0.27.8" langchain = ">=0.0.271,<0.1.0" -pandas = ">=1.0.5" pygments = "^2.15.1" -google-api-...
this one is for spark connect. We can have a group for spark connect.
pyspark-ai
github_2023
others
162
pyspark-ai
gengliangwang
@@ -22,29 +22,43 @@ classifiers = [ ] [tool.poetry.dependencies] +# default required dependencies python = "^3.8.1" pydantic = "^1.10.10" -requests = "^2.31.0" -tiktoken = "0.4.0" -beautifulsoup4 = "^4.12.2" openai = "^0.27.8" langchain = ">=0.0.271,<0.1.0" -pandas = ">=1.0.5" pygments = "^2.15.1" -google-api-...
let's rename it as ingestion
pyspark-ai
github_2023
others
162
pyspark-ai
gengliangwang
@@ -22,29 +22,43 @@ classifiers = [ ] [tool.poetry.dependencies] +# default required dependencies python = "^3.8.1" pydantic = "^1.10.10" -requests = "^2.31.0" -tiktoken = "0.4.0" -beautifulsoup4 = "^4.12.2" openai = "^0.27.8" langchain = ">=0.0.271,<0.1.0" -pandas = ">=1.0.5" pygments = "^2.15.1" -google-api-...
This will be included in default too. I think we can have the following: ``` [tool.poetry.dependencies] python = "^3.8.1" pydantic = "^1.10.10" openai = "^0.27.8" langchain = ">=0.0.271,<0.1.0" [tool.poetry.dependencies.plot] pandas = ">=1.0.5" plotly = "^5.15.0" [tool.poetry.dependencies.vector-search] ...