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 |
|---|---|---|---|---|---|---|---|
opencommit | github_2023 | typescript | 209 | di-sukharev | BlakeEddie | @@ -1,228 +1,193 @@
import {
- ChatCompletionRequestMessage,
- ChatCompletionRequestMessageRoleEnum
+ ChatCompletionRequestMessage,
+ ChatCompletionRequestMessageRoleEnum
} from 'openai';
-import {api} from './api';
-import {DEFAULT_MODEL_TOKEN_LIMIT, getConfig} from './commands/config';
-import {mergeDiffs} ... | ```suggestion
``` |
opencommit | github_2023 | typescript | 209 | di-sukharev | di-sukharev | @@ -0,0 +1,79 @@
+import { spinner } from '@clack/prompts';
+
+import { api } from '../../api';
+import { getConfig } from '../../commands/config';
+import { i18n, I18nLocals } from '../../i18n';
+import { COMMITLINT_LLM_CONFIG_PATH } from './constants';
+import { computeHash } from './crypto';
+import { commitlintProm... | do we need this? |
opencommit | github_2023 | typescript | 209 | di-sukharev | di-sukharev | @@ -0,0 +1,79 @@
+import { spinner } from '@clack/prompts';
+
+import { api } from '../../api';
+import { getConfig } from '../../commands/config';
+import { i18n, I18nLocals } from '../../i18n';
+import { COMMITLINT_LLM_CONFIG_PATH } from './constants';
+import { computeHash } from './crypto';
+import { commitlintProm... | do we need this? |
opencommit | github_2023 | others | 132 | di-sukharev | di-sukharev | @@ -155,4 +157,4 @@ Or follow the process of your IDE Source Control feature, when it calls `git com
## Payments
-You pay for your own requests to OpenAI API. OpenCommit uses ChatGPT official model, that is ~10x times cheaper than GPT-3 and ~6x times cheaper than GPT-4.
+You pay for your own requests to OpenAI API... | this is also in dev, why is that highlighted? |
opencommit | github_2023 | typescript | 171 | di-sukharev | di-sukharev | @@ -67,7 +67,7 @@ export const configValidators = {
[CONFIG_KEYS.OPENAI_MAX_TOKENS](value: any) {
validateConfig(
CONFIG_KEYS.OPENAI_MAX_TOKENS,
- typeof value === 'number',
+ isNaN(+value), | it should be `typeof value === 'number' && !isNaN(+value)` |
opencommit | github_2023 | typescript | 25 | di-sukharev | austinamorusoyardstick | @@ -75,14 +80,13 @@ const configPath = pathJoin(homedir(), '.opencommit');
export const getConfig = (): ConfigType | null => {
const configExists = existsSync(configPath);
- if (!configExists) return null;
- const configFile = readFileSync(configPath, 'utf8');
- const config = iniParse(configFile);
+ const ... | Wouldn't you want the inverse of this setting the .env file as the priority and not the global config as priority?
Usually I think local config then fallback to global. I can also see just wanting to force the usage of one or the other via a process.env flag too. |
opencommit | github_2023 | typescript | 25 | di-sukharev | di-sukharev | @@ -25,7 +25,7 @@ export const prepareCommitMessageHook = async () => {
const config = getConfig();
- if (!config?.OPENAI_API_KEY) {
+ if (!config?.OPENCOMMIT_OPENAI_API_KEY) {
throw new Error(
'No OPEN_AI_API exists. Set your OPEN_AI_API=<key> in ~/.opencommit' | ```suggestion
'No OPENCOMMIT_OPENAI_API_KEY exists. Set your OPENCOMMIT_OPENAI_API_KEY=<key> in "~/.opencommit" or local ".env" file'
``` |
opencommit | github_2023 | typescript | 25 | di-sukharev | AdrielBento | @@ -7,10 +7,13 @@ import { intro, outro } from '@clack/prompts';
import chalk from 'chalk';
import { COMMANDS } from '../CommandsEnum';
+import * as dotenv from 'dotenv'
+dotenv.config()
+
export enum CONFIG_KEYS { | @0xKrauser A new setting was added in this PR: https://github.com/di-sukharev/opencommit/pull/31.
So it will be necessary to update the branch to adjust it |
opencommit | github_2023 | typescript | 70 | di-sukharev | di-sukharev | @@ -61,58 +62,127 @@ ${chalk.grey('——————————————————')}
${commitMessage}
${chalk.grey('——————————————————')}`
);
+
+ const promptUserConfirm = async(commitText: string ) => {
+
+ const isCommitConfirmedByUser = await select({
+ message: 'Confirm the commit message',
+ options: [
+ {value: "... | it exports `isCancel(updatedCommitMessage)` function, you should use it for consistency |
opencommit | github_2023 | typescript | 70 | di-sukharev | di-sukharev | @@ -60,79 +62,147 @@ ${chalk.grey('——————————————————')}
${commitMessage}
${chalk.grey('——————————————————')}`
);
+
+ const promptUserConfirm = async(commitText: string ) => {
+
+ const isCommitConfirmedByUser = await select({
+ message: 'Confirm the commit message',
+ options: [
+ {value: "... | remove comment |
opencommit | github_2023 | typescript | 70 | di-sukharev | di-sukharev | @@ -60,79 +62,147 @@ ${chalk.grey('——————————————————')}
${commitMessage}
${chalk.grey('——————————————————')}`
);
+
+ const promptUserConfirm = async(commitText: string ) => {
+
+ const isCommitConfirmedByUser = await select({
+ message: 'Confirm the commit message',
+ options: [
+ {value: "... | same |
opencommit | github_2023 | typescript | 48 | di-sukharev | AdrielBento | @@ -47,6 +62,7 @@ export const hookCommand = command(
);
}
+ console.log("made it") | @matt-degraffenreid I think you forgot to remove that log
```suggestion
``` |
opencommit | github_2023 | typescript | 43 | di-sukharev | di-sukharev | @@ -198,4 +198,4 @@ export async function commit(
}
process.exit(0);
-}
+} | could you remove this change pls :) |
opencommit | github_2023 | typescript | 42 | di-sukharev | di-sukharev | @@ -78,39 +71,32 @@ ${chalk.grey('——————————————————')}`
outro(stdout);
const remotes = await getGitRemotes();
-
+ const currentBranch = await getCurrentBranch();
+
if (remotes.length === 1) {
- const isPushConfirmedByUser = await confirm({
- message: 'Do you want to run `git push`?'... | prettier issue |
opencommit | github_2023 | typescript | 42 | di-sukharev | di-sukharev | @@ -185,6 +172,8 @@ export async function commit(
.join('\n')}`
);
+ await generateCommitMessageFromGitDiff(staged.diff); | this is old code :) have you tested the code running `npm run dev`? it doesn't work :0 |
opencommit | github_2023 | typescript | 20 | di-sukharev | di-sukharev | @@ -55,9 +61,17 @@ ${chalk.grey('——————————————————')}`
if (isPushConfirmedByUser && !isCancel(isPushConfirmedByUser)) {
const pushSpinner = spinner();
- pushSpinner.start('Running `git push`');
- const { stdout } = await execa('git', ['push']);
- pushSpinner.stop(`${chalk.green('✔')} succe... | that's an awesome job! let's do `if (remotes.length === 1) push the remote without asking`. WDYT? |
opencommit | github_2023 | typescript | 35 | di-sukharev | AdrielBento | @@ -0,0 +1,23 @@
+import { getOpenCommitLatestVersion } from '../api';
+import currentPackage from '../../package.json' assert { type: 'json' };
+import chalk from 'chalk';
+export const checkIsLatestVersion = async () => {
+ const latestVersion = await getOpenCommitLatestVersion();
+
+ if (latestVersion) {
+ cons... | @nader-zouaoui What do you think about already suggesting the command to perform the update? ex:
> 🎉 Update to latest version by running: `npm update opencommit` |
opencommit | github_2023 | others | 35 | di-sukharev | AdrielBento | @@ -1,6 +1,6 @@
{
"name": "opencommit",
- "version": "1.1.11", | @nader-zouaoui the current version is already 1.1.16. Is your branch up to date? |
opencommit | github_2023 | others | 22 | di-sukharev | di-sukharev | @@ -84,6 +84,18 @@ To remove description:
oc config set description=false
```
+### Ignore files
+You can ignore files from submission to OpenGPT by creating a `.opencommitignore` file. For example: | ```suggestion
You can ignore files from submission to OpenAI by creating a `.opencommitignore` file. For example:
``` |
opencommit | github_2023 | others | 6 | di-sukharev | di-sukharev | @@ -53,10 +54,12 @@
"dotenv": "^16.0.3",
"esbuild": "^0.15.18",
"eslint": "^8.28.0",
+ "prettier": "^2.8.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
},
"dependencies": {
+ "@bdsqqq/try": "^2.3.1", | let's change this to a separate file with code:
```
export const trytm = async <T>(
promise: Promise<T>,
): Promise<[T, null] | [null, Error]> => {
try {
const data = await promise;
return [data, null];
} catch (throwable) {
if (throwable instanceof Error) return [null, throwable];
... |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -65,7 +80,14 @@ ${chalk.grey('——————————————————')}`
};
export async function commit(isStageAllFlag = false) {
+ const [stagedFiles, errorStagedFiles] = await trytm(getStagedFiles()); | this is same as line 94, pick one pls |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -65,7 +80,14 @@ ${chalk.grey('——————————————————')}`
};
export async function commit(isStageAllFlag = false) {
+ const [stagedFiles, errorStagedFiles] = await trytm(getStagedFiles());
+ const [changedFiles, errorChangedFiles] = await trytm(getChangedFiles()); | nice idea of checking isAnyFileChanged |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -47,3 +47,34 @@ export const getStagedGitDiff = async (
diff
};
};
+
+export const getStagedFiles = async (): Promise<string[]> => { | this is same as `getStagedGitDiff` line 21, but i would refactor it, so it's really a `get` function. now it's also staging files. could you refactor it to something like `getAndSetStagedDiff`? using your `gitAdd` function |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -65,13 +79,28 @@ ${chalk.grey('——————————————————')}`
};
export async function commit(isStageAllFlag = false) {
+ if (isStageAllFlag) {
+ await gitAdd({ files: await getChangedFiles() }); | <3 |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -13,37 +13,41 @@ const excludeBigFilesFromDiff = ['*-lock.*', '*.lock'].map(
(file) => `:(exclude)${file}`
);
-export interface StagedDiff {
- files: string[];
- diff: string;
-}
-
-export const getStagedGitDiff = async (
- isStageAllFlag = false
-): Promise<StagedDiff | null> => {
- if (isStageAllFlag) {
... | why do you remove this? package-lock.json is gonna be counted like a change, and it's too big for openAI api, splitting it in chunks looks like overengineering and waste of tokens sent to the API. I'd provide an error message if only `excluded` files are staged like: "staged files are .lock files which are excluded by ... |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -17,7 +17,9 @@ export const prepareCommitMessageHook = async () => {
if (commitSource) return;
- const staged = await getStagedGitDiff();
+ await gitAdd({ files: await getChangedFiles() }); | ```suggestion
const changedFiles = await getChangedFiles();
if (changedFiles) await gitAdd({ files: changedFiles });
else {
outro("No changes detected, write some code and run `oc` again");
process.exit(1);
}
``` |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -9,41 +9,88 @@ export const assertGitRepo = async () => {
}
};
-const excludeBigFilesFromDiff = ['*-lock.*', '*.lock'].map(
- (file) => `:(exclude)${file}`
-);
-
-export interface StagedDiff {
- files: string[];
- diff: string;
-}
-
-export const getStagedGitDiff = async (
- isStageAllFlag = false
-): Prom... | great! |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -9,41 +9,88 @@ export const assertGitRepo = async () => {
}
};
-const excludeBigFilesFromDiff = ['*-lock.*', '*.lock'].map(
- (file) => `:(exclude)${file}`
-);
-
-export interface StagedDiff {
- files: string[];
- diff: string;
-}
-
-export const getStagedGitDiff = async (
- isStageAllFlag = false
-): Prom... | ```suggestion
.filter(Boolean)
``` |
opencommit | github_2023 | typescript | 6 | di-sukharev | di-sukharev | @@ -106,14 +140,37 @@ export async function commit(isStageAllFlag = false) {
await commit(true); | ```suggestion
return await commit(true);
``` |
mysqldump | github_2023 | go | 7 | jarvanstack | jarvanstack | @@ -42,7 +42,6 @@ func NewDBWrapper(db *sql.DB, dryRun bool) *DBWrapper {
}
func (db *DBWrapper) Exec(query string, args ...interface{}) (sql.Result, error) {
- fmt.Printf("[SQL] query: %s , args: %v \n", query, args) | 这行代码对于某些情况下的调试是十分有用的,如果你不想要输出调试信息。可以添加一个 option 来控制是否输出调试信息。 |
gwater2 | github_2023 | others | 39 | meetric1 | bloodycop7 | @@ -0,0 +1,1214 @@
+
+This is the gwater localization file. Everything in this file is added as a language string to gmod.
+Note that the translation cannot be longer than 4000 bytes (1 english character is 1 byte).
+
+Input format:
+"gwater2.key_here"=[[
+Your translation here
+]]
+
+Do NOT edit 'gwater2.key_here'
+
+... | Wouldn't it be better to say "Ляв-клик" |
gwater2 | github_2023 | others | 39 | meetric1 | bloodycop7 | @@ -0,0 +1,1214 @@
+
+This is the gwater localization file. Everything in this file is added as a language string to gmod.
+Note that the translation cannot be longer than 4000 bytes (1 english character is 1 byte).
+
+Input format:
+"gwater2.key_here"=[[
+Your translation here
+]]
+
+Do NOT edit 'gwater2.key_here'
+
+... | Same thing here, "Десен-клик" |
gwater2 | github_2023 | others | 39 | meetric1 | bloodycop7 | @@ -0,0 +1,1214 @@
+
+This is the gwater localization file. Everything in this file is added as a language string to gmod.
+Note that the translation cannot be longer than 4000 bytes (1 english character is 1 byte).
+
+Input format:
+"gwater2.key_here"=[[
+Your translation here
+]]
+
+Do NOT edit 'gwater2.key_here'
+
+... | Replace ЛИКВИД with ТЕЧНОСТ |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,318 @@
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+
+from .song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+class Lyri... | Python models shouldn't have any private fields other than the proto and a reference to its parent instance. This is because we write and read based on the proto, all the model instances is only created on-demand and only serves as a wrapper of the proto.
For lines: You should get lines on-demand, otherwise you will... |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,318 @@
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+
+from .song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+class Lyri... | Same here, this is anti-pattern. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You can define the 3 classes in the order of LyricWord, LyricLine and Lyrics so that you can use the original type instead strings. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | I'm a little hesitant to inexplicitly add this line into lyrics here since this seems like a side-effect and is not expected to happen in the constructor. We should probably add the line in Lyrics.create_line or Lyrics.create_line_from_string instead. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Add comments for the function so that people know how to use it. Same below. Feel free to check the documentation in typescript SDK. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Do you need to pass a line proto as the second param here? Since we are comparing them as line protos. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Since we are building models as proto wrappers, cloning a model instance is simply as easy as cloning the proto, which you can simply do with CopyFrom, example: https://github.com/tuneflow/tuneflow-py/blob/main/src/tuneflow_py/models/track.py#L406 |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You should probably use a common method defined in LyricLine to get the start tick of the line, so that it is consistent everywhere and catches edge cases. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Why would we compare this to a proto? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -85,6 +86,113 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_bar_beats(self, end_tick: int) -> List[BarBeat]: | Please add tests for all bar beat related methods, too. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | round? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | round? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | round? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | round? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Return the new word? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You should pass in word._proto as the second param for lower_equal, be sure to double check this with a test. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Add comment documentation so that people know the default tokenizer behaviour. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,313 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Sort words. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,133 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+
+class MockLyricLine: | Mocks are usually used as a substitute for a component that will be running in the test but not the primary test target. For example if class A has an private member instance of class B, when you test class A, you don't want to test anything related to class B, so you can mock the instance of class B instead.
In thi... |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Does this check for empty string ''? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Also check if you need to delete the word. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | The second line is not necessary information for users since they should never be interacting with protos directly |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | The return type is a generator |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Do we have another method to update the line from a string? If it is only used to add words to the line it should be fine and we can mark it as a private method, but we also need another user-facing method that takes a string input and updates words in the line, in that case, we should clear the line if the input is em... |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | new_line is not used here, or you should probably create the proto first, copy it, then return a wrapper for the cloned proto |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | `self._proto.words[search_index]` doesn't seem to do your job, if you want to check index boundary in python you need to do it explicitly, otherwise, accessing an out of range index raises error. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | How does this work? Does it check for all subfields? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | I guess we should break here since we do not want to delete all occurences. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | I guess this is only needed when proto is not provided. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You don't have to provide start_tick if you just need to return a wrapper. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You don't have to provide start_tick if you just need to return a wrapper. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,421 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | The wrapper should be returned instead of the proto |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | You also need to provide a method to update the line with a string and test it here. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | assert before this to check the word count is larger than 1. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | Assert the word content as well. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | Same here, assert both before and after your primary operation, and make sure your assertion captures the difference outcome before and after, so that it's clear that your operation did what you want. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | You also need to add a test where moving the word changes the order of lines. I would split the tests into 3: test_move_to_basic, test_move_to_delete_word, test_move_to_changes_line_order |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | Add another test for when we delete the word after changing start tick. Same for end tick. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,205 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | You should also check for the change of line order |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,420 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | You probably also want to add a `get_word_at_index` method. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,420 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | Test this as well. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,420 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str]]
+DEFAULT... | This invalidates the whole purpose of this binary search since its complexity is already O(N). You could pass a key function that checks for the type of element and returns tick if it is a number, or LyricLine._get_start_tick(line) otherwise. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -465,6 +469,27 @@ def seconds_to_tick(self, seconds: float):
)
return round(base_tempo_change_proto.ticks + time_delta * ticks_per_second_since_last_tempo_change)
+ def advance_tick_by_bars(original_tick: int, offset_bar: int, offset_beat: int, bar_beats: List[BarBeat]) -> Optional[int]: | If we want to check this in we need to add tests for it. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,503 @@
+from __future__ import annotations
+import re
+from typing import Callable, List, Optional, Generator
+import unicodedata
+
+from tuneflow_py.utils import lower_equal
+from tuneflow_py.models.protos import song_pb2
+from tuneflow_py.models.song import Song
+
+LyricTokenizer = Callable[[str], List[str... | I think the principle here is that you don't need to provide more params if you already provided the proto and the parent |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -12,7 +12,8 @@
from miditoolkit.midi import MidiFile, TempoChange as ToolkitTempoChange, TimeSignature as ToolkitTimeSignature, \
Instrument, Note as ToolkitNote
from types import SimpleNamespace
-from typing import List
+from typing import List, List, Optional
+from dataclasses import dataclass | Is this used? |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -12,7 +12,8 @@
from miditoolkit.midi import MidiFile, TempoChange as ToolkitTempoChange, TimeSignature as ToolkitTimeSignature, \
Instrument, Note as ToolkitNote
from types import SimpleNamespace
-from typing import List
+from typing import List, List, Optional | List imported twice |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,397 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | We also need to test the words in it, making sure the tokenizer is working intended and the timespan of the words are assigned correctly. |
tuneflow-py | github_2023 | python | 3 | tuneflow | andantei | @@ -0,0 +1,397 @@
+import unittest
+from typing import Dict
+from tuneflow_py.models.song import Song
+from tuneflow_py.models.lyric import Lyrics, LyricLine, LyricWord
+
+DEFAULT_PPQ = Song.get_default_resolution()
+
+
+def assert_lyric_lines_equal(expected: Dict, actual: LyricLine):
+ if expected["sentence"] != ac... | I meant setting a start tick or end tick that could delete the word, for example here if you set start tick to be >= end tick we should delete the word from the line. This is not tested currently. |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -0,0 +1,29 @@
+from __future__ import annotations
+from tuneflow_py.models.protos import song_pb2
+
+StructureType = song_pb2.StructureType | `StructureType = song_pb2.StructureMarker.StructureType` |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -244,7 +244,7 @@
serialized_end=2705,
)
_sym_db.RegisterEnumDescriptor(_STRUCTUREMARKER_STRUCTURETYPE)
-
+StructureType = enum_type_wrapper.EnumTypeWrapper(_STRUCTUREMARKER_STRUCTURETYPE) | This is an auto-generated file, which will be overwritten every time the proto recompiles. We should not manually edit this file. |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | You can combine this function and `get_structure_at_tick` into one method, since there is only one usage. The TS version has separate methods because the impl method was used elsewhere. |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures | You probably want to wrap the protos with StructureMarker class:
```
for structure_proto in self._proto.structures:
yield StructureMarker(proto=structure_proto)
``` |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index] | Same here, you probably want to wrap it in `StructureMarker` |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | Please format the files before submitting (preferred formatter autopep8) |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | Proto's append/insert/... methods creates a copy of your original proto instance, so you need to update your input wrapper's `_proto` to the newly inserted proto if you want to use your wrapper instance later.
```
self._proto.structures.append(structure._proto)
structure._proto = self._proto.structures[-1]
```
... |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | get_structure_at_index |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | get_structure_at_index |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | Use snake_case, here: structure_index and move_to_tick, same below |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +84,95 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return self._proto.structures
+
+ def get_structure_at_index(self, index: int):
+ return self._proto.structures[index]
+
+ def get_structure_a... | self._proto.structures.pop(index) |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +85,89 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return [StructureMarker(song=self, proto=structure_proto) for structure_proto in self._proto.structures]
+
+ def get_structure_at_index(self, index: int... | The above two checks are probably error-prone, the user might provide an out of range index (e.g. 999) and still get some structure which can lead to potential errors.
Note that this is different from get structure at tick since the index is more specific here. |
tuneflow-py | github_2023 | python | 2 | tuneflow | andantei | @@ -83,6 +85,89 @@ def remove_track(self, track_id: str):
dep_track.remove_output()
return track
+ def get_structures(self):
+ return [StructureMarker(song=self, proto=structure_proto) for structure_proto in self._proto.structures]
+
+ def get_structure_at_index(self, index: int... | For example here, if structure_index is set to 9999 and get_structure_at_index still returns the last structure, this if check would not be able catch that. |
ai-pr-reviewer | github_2023 | typescript | 524 | coderabbitai | github-actions[bot] | @@ -6,19 +6,30 @@ export class TokenLimits {
constructor(model = 'gpt-3.5-turbo') {
this.knowledgeCutOff = '2021-09-01'
- if (model === 'gpt-4-32k') {
- this.maxTokens = 32600
- this.responseTokens = 4000
- } else if (model === 'gpt-3.5-turbo-16k') {
- this.maxTokens = 16300
- this.r... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
The switch-case structure is a good improvement over the previous if-else chain for readability and maintainability. However, there's no handling for when an unsupported model is passed to the c... |
ai-pr-reviewer | github_2023 | others | 524 | coderabbitai | github-actions[bot] | @@ -136,6 +134,8 @@ inputs:
!**/*.min.js.css
!**/*.tfstate
!**/*.tfstate.backup
+ !**/vault.yml
+ !**/vault.yaml | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
The exclusion of `vault.yml` and `vault.yaml` files might have security implications. If these files contain sensitive data like secrets or passwords, they should not be part of the repository i... |
ai-pr-reviewer | github_2023 | others | 524 | coderabbitai | github-actions[bot] | @@ -156,7 +156,7 @@ inputs:
openai_heavy_model:
required: false
description: 'Model to use for complex tasks such as code reviews.'
- default: 'gpt-4'
+ default: 'gpt-4-turbo-preview' | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
Switching from 'gpt-4' to 'gpt-4-turbo-preview' as the default model for complex tasks is a significant change. Ensure that this new model has been thoroughly tested and validated for all use ca... |
ai-pr-reviewer | github_2023 | others | 524 | coderabbitai | github-actions[bot] | @@ -212,9 +212,6 @@ inputs:
specific files within 80 words.
- **Changes**: A markdown table of files and their summaries. Group files
with similar changes together into a single row to save space.
- - **Poem**: Below the changes, include a whimsical, short poem written by
- a rabb... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
Removing the "Poem" section simplifies the PR template and makes it more focused on the code changes. This is a good move for clarity and professionalism. However, ensure that all contributors a... |
ai-pr-reviewer | github_2023 | others | 521 | coderabbitai | github-actions[bot] | @@ -28,9 +28,11 @@
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@dqbd/tiktoken": "^1.0.7",
+ "@langchain/openai": "^0.0.14",
"@octokit/action": "^6.0.4", | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
The new dependencies `@langchain/openai` and `langchain` have been added. Please ensure that these packages are reliable, well-maintained, and do not introduce any security vulnerabilities. It's... |
ai-pr-reviewer | github_2023 | typescript | 521 | coderabbitai | github-actions[bot] | @@ -10,14 +10,9 @@ import {
} from 'chatgpt'
import pRetry from 'p-retry'
import {OpenAIOptions, Options} from './options'
+import {BotProtocol, Ids} from './bot-interface'
-// define type to save parentMessageId and conversationId
-export interface Ids {
- parentMessageId?: string
- conversationId?: string
-}
-... | <img src="https://avatars.githubusercontent.com/in/347564?s=41" alt="Image description" width="20" height="20"> CodeRabbit
The changes made here are good. The `BotProtocol` and `Ids` interfaces have been moved to a separate file, which improves the modularity of the code. Now, the `Bot` class implements the `BotProt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.