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

Unicode #17

Merged
merged 6 commits into from
Jun 18, 2015
Merged

Unicode #17

merged 6 commits into from
Jun 18, 2015

Conversation

casperdcl
Copy link
Sponsor Member

Fallback ascii if not specified and not explicitly supported by stream

@casperdcl
Copy link
Sponsor Member Author

fixes #15

# n - number of finished iterations
# total - total number of iterations, or None
# elapsed - number of seconds passed since start
# ncols - the output width in chars. If specified, dynamically resizes bar.
# [default bar width: 10].
# prefix - prepend message (included in total width)
# ascii - whether to use ascii (otherwise unicode) character set
if total and n > total:
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a proper doctstring for parameters please ?

@hadim
Copy link
Contributor

hadim commented Jun 18, 2015

Thanks for working on this !

@casperdcl
Copy link
Sponsor Member Author

lol tbh I'm just using this as procrastination. It might look like I've been working on this all day for the last few days but really I haven't. I work better when constantly switching projects :P

@casperdcl
Copy link
Sponsor Member Author

sheesh. @kmike late to the party, yes, maybe, but definitely partyin'

Total number of files: 14
Total number of lines: 586
Total number of commits: 60
+----------------------+-----+---------+-------+--------------------+
| name                 | loc | commits | files | distribution       |
+----------------------+-----+---------+-------+--------------------+
| Casper da Costa-Luis | 219 | 15      | 4     | 37.4 / 25.0 / 28.6 |
| Hadrien Mary         | 97  | 8       | 6     | 16.6 / 13.3 / 42.9 |
| Mikhail Korobov      | 75  | 10      | 9     | 12.8 / 16.7 / 64.3 |
| Ivan Ivanov          | 68  | 11      | 4     | 11.6 / 18.3 / 28.6 |
| noamraph             | 65  | 3       | 3     | 11.1 / 5.0 / 21.4  |
| Noam Yorav-Raphael   | 55  | 8       | 2     | 9.4 / 13.3 / 14.3  |
| arkottke             | 5   | 1       | 1     | 0.9 / 1.7 / 7.1    |
| stonebig             | 2   | 1       | 1     | 0.3 / 1.7 / 7.1    |
| Ford Hurley          | 0   | 1       | 0     | 0.0 / 1.7 / 0.0    |
| Jack McCracken       | 0   | 2       | 0     | 0.0 / 3.3 / 0.0    |
+----------------------+-----+---------+-------+--------------------+

('utf' in file.encoding) or
('UTF' in file.encoding))
else:
ascii = True
Copy link
Contributor

Choose a reason for hiding this comment

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

What about extracting this to a helper function? Something like file_suports_unicode:

def _is_utf(encoding):
    return ('U8' == encoding) or ('utf' in encoding) or ('UTF' in encoding))

def file_supports_unicode(fp):
    if not getattr(fp, 'encoding', None):
        return False    
    return _is_utf(file.encoding)

Copy link
Contributor

Choose a reason for hiding this comment

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

+1

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

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

will leave it to you ;) i'm not pedantic about loop startup overhead so don't mind abstractions at this level.

@casperdcl
Copy link
Sponsor Member Author

haha @kmike rebase, sure. I've done it before -- #11 . But you still have to do your file_suports_unicode

@casperdcl
Copy link
Sponsor Member Author

nvm. was easier to correct than type chat message about it lol

@casperdcl
Copy link
Sponsor Member Author

going to sleep, then spend weekend at a data science competition hackathon (used nltk a LOT in the buildup stages, you might be interested to know, @kmike ). May rebase in a few days...

hadim added a commit that referenced this pull request Jun 18, 2015
@hadim hadim merged commit 86d6cfa into master Jun 18, 2015
@hadim hadim deleted the unicode branch June 18, 2015 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants