-
Notifications
You must be signed in to change notification settings - Fork 5
Sourcery refactored master branch #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,16 +18,16 @@ | |
| arg_parser.add_argument('--verbose', action='store_true', | ||
| help='verbose output') | ||
| options = arg_parser.parse_args() | ||
| count = dict() | ||
| count = {} | ||
| with open(options.input, 'r') as in_file: | ||
| for line_nr in xrange(options.start): | ||
| for _ in xrange(options.start): | ||
| _ = in_file.readline() | ||
| for line_nr in xrange(options.start, options.end): | ||
| line = in_file.readline().rstrip() | ||
| if not line: | ||
| break | ||
| if options.verbose: | ||
| sys.stderr.write('processing line ' + str(line_nr) + '\n') | ||
| sys.stderr.write(f'processing line {str(line_nr)}' + '\n') | ||
|
Comment on lines
-21
to
+30
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
| for word in line.split(): | ||
| if word not in count: | ||
| count[word] = 0 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,8 +16,6 @@ | |
| for _ in xrange(options.lines): | ||
| words = [] | ||
| for _ in xrange(options.words_per_line): | ||
| word = '' | ||
| for _ in xrange(options.word_length): | ||
| word += random.choice('ABCDE') | ||
| word = ''.join(random.choice('ABCDE') for _ in xrange(options.word_length)) | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
| words.append(word) | ||
| print(' '.join(words)) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,6 @@ | |
| 'dictionary') | ||
| arg_parser.add_argument('out', help='name of the pickle file') | ||
| options = arg_parser.parse_args() | ||
| counter = dict() | ||
| counter = {} | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lines
|
||
| with open(options.out, 'wb') as out_file: | ||
| pickle.dump(counter, out_file) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
walltime2secondsrefactored with the following changes:sum-comprehension)inline-immediately-returned-variable)