| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| parser.add_argument('name', help='Name to greet') | ||
| args = parser.parse_args() | ||
| print('Hello, ' + args.name + '!') | ||
| print(f'Hello, {args.name}!') |
There was a problem hiding this comment.
Lines 9-9 refactored with the following changes:
Sorry, something went wrong.
| default='World', help='Name to greet') | ||
| args = parser.parse_args() | ||
| print('Hello, ' + args.name + '!') | ||
| print(f'Hello, {args.name}!') |
There was a problem hiding this comment.
Lines 10-10 refactored with the following changes:
Sorry, something went wrong.
| default='World', help='Name to greet') | ||
| args = parser.parse_args() | ||
| print('Hello, ' + args.name + '!') | ||
| print(f'Hello, {args.name}!') |
There was a problem hiding this comment.
Function main refactored with the following changes:
Sorry, something went wrong.
| def main(): | ||
| args = get_args() | ||
| print('Hello, ' + args.name + '!') | ||
| print(f'Hello, {args.name}!') |
There was a problem hiding this comment.
Function main refactored with the following changes:
Sorry, something went wrong.
|
|
||
| args = get_args() | ||
| print('Hello, ' + args.name + '!') | ||
| print(f'Hello, {args.name}!') |
There was a problem hiding this comment.
Function main refactored with the following changes:
Sorry, something went wrong.
| pattern = ( | ||
| '([' + consonants + ']+)?' # capture one or more, optional | ||
| '([' + vowels + '])' # capture at least one vowel | ||
| '(.*)' # capture zero or more of anything | ||
| ) | ||
| pattern = (((f'([{consonants}' + ']+)?' # capture one or more, optional | ||
| '([') + vowels) + '])' # capture at least one vowel | ||
| '(.*)') | ||
| pattern = f'([{consonants}]+)?([{vowels}])(.*)' | ||
|
|
||
| match = re.match(pattern, word) | ||
| if match: | ||
| p1 = match.group(1) or '' | ||
| p2 = match.group(2) or '' | ||
| p3 = match.group(3) or '' | ||
| return (p1, p2 + p3) | ||
| else: | ||
| if not (match := re.match(pattern, word)): | ||
| return (word, '') | ||
| p1 = match.group(1) or '' | ||
| p2 = match.group(2) or '' | ||
| p3 = match.group(3) or '' | ||
| return (p1, p2 + p3) |
There was a problem hiding this comment.
Function stemmer refactored with the following changes:
This removes the following comments ( why? ):
# capture zero or more of anything
Sorry, something went wrong.
| vowel_pos = list(map(word.index, filter(lambda v: v in word, 'aeiou'))) | ||
|
|
||
| if vowel_pos: | ||
| if vowel_pos := list( | ||
| map(word.index, filter(lambda v: v in word, 'aeiou')) | ||
| ): |
There was a problem hiding this comment.
Function stemmer refactored with the following changes:
Sorry, something went wrong.
| if word.endswith('ing'): | ||
| if any(map(lambda c: c.lower() in 'aeiouy', word[:-3])): | ||
| return word[:-1] + "'" | ||
| if word.endswith('ing') and any( | ||
| map(lambda c: c.lower() in 'aeiouy', word[:-3]) | ||
| ): | ||
| return word[:-1] + "'" |
There was a problem hiding this comment.
Function fry refactored with the following changes:
Sorry, something went wrong.
|
|
||
| assert os.path.isfile(file) | ||
| expected_file = file + '.out' | ||
| expected_file = f'{file}.out' |
There was a problem hiding this comment.
Function run_file refactored with the following changes:
Sorry, something went wrong.
| article = 'an' if pos.lower()[0] in 'aeiou' else 'a' | ||
| answer = inputs.pop(0) if inputs else input(tmpl.format(article, pos)) | ||
| text = text[0:start] + answer + text[stop + 1:] | ||
| text = text[:start] + answer + text[stop + 1:] |
There was a problem hiding this comment.
Function main refactored with the following changes:
Sorry, something went wrong.
| if name and reps: | ||
| match = re.match(r'(\d+)-(\d+)', reps) | ||
| if match: | ||
| if match := re.match(r'(\d+)-(\d+)', reps): |
There was a problem hiding this comment.
Function read_csv refactored with the following changes:
Sorry, something went wrong.
| for rec in reader: | ||
| records.append(rec) | ||
|
|
||
| records = list(reader) |
There was a problem hiding this comment.
Lines 8-11 refactored with the following changes:
Sorry, something went wrong.
| cells = [] | ||
| for i, char in enumerate(board, start=1): | ||
| cells.append(str(i) if char == '.' else char) | ||
| cells = [ | ||
| str(i) if char == '.' else char | ||
| for i, char in enumerate(board, start=1) | ||
| ] |
There was a problem hiding this comment.
Function format_board refactored with the following changes:
Sorry, something went wrong.
|
|
||
| losing_board = list('XXOO.....') | ||
| for i in range(10): | ||
| for _ in range(10): |
There was a problem hiding this comment.
Function test_losing refactored with the following changes:
Sorry, something went wrong.
| for i in range(10): | ||
| for _ in range(10): | ||
| random.shuffle(losing_state) | ||
| assert find_winner(''.join(losing_state)) == None | ||
| assert find_winner(''.join(losing_state)) is None |
There was a problem hiding this comment.
Function test_losing refactored with the following changes:
Sorry, something went wrong.
| rv, out = getstatusoutput(f'{prg} "{word}"') | ||
| assert rv == 0 | ||
| assert out == f'input is space.' | ||
| assert out == 'input is space.' |
There was a problem hiding this comment.
Function test_space refactored with the following changes:
Sorry, something went wrong.
| out_file, out_arg = (random_file, | ||
| '-o ' + random_file) if flip == 1 else ('out.txt', | ||
| '') | ||
| out_file, out_arg = ( | ||
| (random_file, f'-o {random_file}') | ||
| if flip == 1 | ||
| else ('out.txt', '') | ||
| ) | ||
|
|
There was a problem hiding this comment.
Function run refactored with the following changes:
Sorry, something went wrong.
| """runs on good input""" | ||
|
|
||
| out_file = random_string() + '.fasta' | ||
| out_file = f'{random_string()}.fasta' |
There was a problem hiding this comment.
Function test_options refactored with the following changes:
Sorry, something went wrong.
| out_fh = open(out_file, 'wt') | ||
| num_taken = 0 | ||
| with open(out_file, 'wt') as out_fh: | ||
| num_taken = 0 | ||
|
|
||
| for rec in SeqIO.parse(fh, 'fasta'): | ||
| if random.random() <= args.pct: | ||
| num_taken += 1 | ||
| SeqIO.write(rec, out_fh, 'fasta') | ||
| for rec in SeqIO.parse(fh, 'fasta'): | ||
| if random.random() <= args.pct: | ||
| num_taken += 1 | ||
| SeqIO.write(rec, out_fh, 'fasta') | ||
|
|
||
| out_fh.close() |
There was a problem hiding this comment.
Function main refactored with the following changes:
Sorry, something went wrong.
| seqs_written = 0 | ||
| for file in files: | ||
| seqs_written += len( | ||
| list(SeqIO.parse(os.path.join(out_dir, file), 'fasta'))) | ||
| seqs_written = sum( | ||
| len(list(SeqIO.parse(os.path.join(out_dir, file), 'fasta'))) | ||
| for file in files | ||
| ) |
There was a problem hiding this comment.
Function test_options refactored with the following changes:
Sorry, something went wrong.
Sourcery Code Quality Report❌ Merging this PR will decrease code quality in the affected files by 0.07%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Branch master refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
See our documentation here.
Run Sourcery locallyReduce the feedback loop during development by using the Sourcery editor plugin:
- VS Code
- PyCharm
Review changes via command lineTo manually merge these changes, make sure you're on the master branch, then run:
Help us improve this pull request!