Skip to content
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

Support extraction by filename as well as directory #324

Merged
merged 1 commit into from
Jan 15, 2016

Conversation

ENuge
Copy link
Contributor

@ENuge ENuge commented Jan 12, 2016

Reason for the change: #253 . This obviates the need for parallelizing to make things faster (on the consumer's side, we only scan files that are different in a given branch compared to origin's master, which brings scan time down from ~4min 30s to ~5-20s, depending on how old one's branch is).

Code changes: moved half of the logic from extract_from_dir into its own function. Then added a few "is this a path or directory?" type checks to frontend.py to use the right thing. Those checks are kind of ugly right now but I couldn't think of a more elegant way of doing it. Added/rejiggered a couple of tests.

@sils
Copy link
Member

sils commented Jan 12, 2016

Hi, can you fix the issues pointed out by the gitmate bot and refactor your stuff into atomic commits as described in http://coala.readthedocs.org/en/latest/Getting_Involved/Writing_Good_Commits/ ?

@sils
Copy link
Member

sils commented Jan 12, 2016

Thanks for submitting :)

@codecov-io
Copy link

Current coverage is 88.38%

Merging #324 into master will increase coverage by +0.04% as of 59793db

@@            master    #324   diff @@
======================================
  Files           23      23       
  Stmts         3612    3626    +14
  Branches         0       0       
  Methods          0       0       
======================================
+ Hit           3191    3205    +14
  Partial          0       0       
  Missed         421     421       

Review entire Coverage Diff as of 59793db

Powered by Codecov. Updated on successful CI builds.

@ENuge
Copy link
Contributor Author

ENuge commented Jan 12, 2016

Appeased the LineLengthBot with Yelp's preferred syntax (which is vertically long, but eh this line is super-awkward regardless).

I'll refactor my commits later today or tomorrow. (I started this change on Yelp's old fork of babel, so this version was more of a copy/paste job. But I'll make the history make some sense.)

@sils
Copy link
Member

sils commented Jan 12, 2016

@ENuge cool, ping us when it's done.

strip_comment_tags=self.strip_comments
)
else:
extracted = check_and_call_extract_file(path, method_map,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you use the same indent style as in the extract_from_dir call above? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Done.

@akx
Copy link
Member

akx commented Jan 12, 2016

And aside from the handful of comments I had, great work @ENuge ! :)

I'd appreciate a test that passes in a direct filename to the command line command though. :)

EDIT: Wagh, I'm a dummy who can't scroll down.

@akx
Copy link
Member

akx commented Jan 13, 2016

@ENuge: Looking good!

Please squash all of the commits into one though :)

@sils
Copy link
Member

sils commented Jan 13, 2016

Interesting, travis errored out on mac only for pypy 2.6, maybe a nondeterministic bug?

@akx
Copy link
Member

akx commented Jan 13, 2016

@sils1297 Heh, yes... race condition against the clock, it seems. If the wallclock ticks forward a second while those tests are being run, they may fail.

We should probably freeze time for the duration of those tests or maybe compare the outputs ignoring datetime differences.

@ENuge ENuge force-pushed the eoin_babel_extract_with_files branch from 79ddbf4 to 4b0d4c5 Compare January 14, 2016 18:08
One can now supply a filename or a directory to be extracted. For
large codebases, this allows the consumer to optimize their
string extraction process by, for instance, only supplying the
files that have actually been changed on the given dev's branch
compared to master.

Relates to python-babel#253 . I
don't want to say "fixes", but makes further optimization
unnecessary for most use cases.
@ENuge ENuge force-pushed the eoin_babel_extract_with_files branch from 4b0d4c5 to 19957e2 Compare January 14, 2016 18:15
@akx
Copy link
Member

akx commented Jan 15, 2016

Super nice work @ENuge!

I'm gonna merge this, but come to think of it, we should add an alias for input-paths called input-dirs for backward compatibility. I'll make an issue out of that. :)

akx added a commit that referenced this pull request Jan 15, 2016
Support extraction by filename as well as directory
@akx akx merged commit 459d30f into python-babel:master Jan 15, 2016
@pyup-bot pyup-bot mentioned this pull request Apr 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants