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

🐛 Fix CLI when using --minimal output in certain cases #103

Merged
merged 2 commits into from
Sep 16, 2021

Conversation

Ousret
Copy link
Member

@Ousret Ousret commented Sep 16, 2021

Happen when used with -a (alternative)

Here is the traceback

(venv) [ahmed@fedora charset_normalizer]$ normalizer -a -m ./data/sample.1.fr.srt 
Traceback (most recent call last):
  File "/home/ahmed/PycharmProjects/charset_normalizer/venv/bin/normalizer", line 33, in <module>
    sys.exit(load_entry_point('charset-normalizer==2.0.6', 'console_scripts', 'normalizer')())
  File "/home/ahmed/PycharmProjects/charset_normalizer/venv/lib/python3.9/site-packages/charset_normalizer-2.0.6-py3.9.egg/charset_normalizer/cli/normalizer.py", line 198, in cli_detect
  File "/home/ahmed/PycharmProjects/charset_normalizer/venv/lib/python3.9/site-packages/charset_normalizer-2.0.6-py3.9.egg/charset_normalizer/models.py", line 42, in __eq__
TypeError: __eq__ cannot be invoked on <class 'charset_normalizer.models.CharsetMatches'> and <class 'charset_normalizer.models.CharsetMatch'>.

In addition to the actual bugfix, the minimal output was confusing as when using multiple files in args, the results were on the same line.

Before:

(venv) [ahmed@fedora charset_normalizer]$ normalizer -a -m ./data/sample.1.fr.srt 
cp1252, cp775, mac_latin2, cp1250, cp1257, iso8859_10, cp852, hp_roman8, cp850, cp1125, cp1251, cp855, cp866, iso8859_5, koi8_r, cp1253, cp437, cp864, cp869, iso8859_11, mac_greek, mac_iceland, mac_roman
(venv) [ahmed@fedora charset_normalizer]$ normalizer -a -m ./data/sample.1.fr.srt ./data/sample.1.ar.srt 
cp1252, cp775, mac_latin2, cp1250, cp1257, iso8859_10, cp852, hp_roman8, cp850, cp1125, cp1251, cp855, cp866, iso8859_5, koi8_r, cp1253, cp437, cp864, cp869, iso8859_11, mac_greek, mac_iceland, mac_roman, cp1256, cp1251, kz1048, ptcp154, iso8859_5

After:

(venv) [ahmed@fedora charset_normalizer]$ normalizer -a -m ./data/sample.1.fr.srt ./data/sample.1.ar.srt 
cp1252, cp775, mac_latin2, cp1250, cp1257, iso8859_10, cp852, hp_roman8, cp850, cp1125, cp1251, cp855, cp866, iso8859_5, koi8_r, cp1253, cp437, cp864, cp869, iso8859_11, mac_greek, mac_iceland, mac_roman
cp1256, cp1251, kz1048, ptcp154, iso8859_5
(venv) [ahmed@fedora charset_normalizer]$ normalizer -m ./data/sample.1.fr.srt ./data/sample.1.ar.srt 
cp1252
cp1256

Happen when used with -a (alternative)
@Ousret Ousret added bug Something isn't working enhancement New feature or request CLI Anything related to the CLI script (normalizer) labels Sep 16, 2021
@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2021

Codecov Report

Merging #103 (97f8b65) into master (4db2367) will increase coverage by 0.51%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #103      +/-   ##
==========================================
+ Coverage   85.51%   86.02%   +0.51%     
==========================================
  Files          11       11              
  Lines        1194     1195       +1     
==========================================
+ Hits         1021     1028       +7     
+ Misses        173      167       -6     
Impacted Files Coverage Δ
charset_normalizer/cli/normalizer.py 69.56% <100.00%> (+4.73%) ⬆️
charset_normalizer/models.py 87.50% <0.00%> (+1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4db2367...97f8b65. Read the comment docs.

@Ousret Ousret merged commit 26be638 into master Sep 16, 2021
@Ousret Ousret deleted the bugfix-cli-minimal-out branch September 16, 2021 22:25
@Ousret Ousret mentioned this pull request Sep 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI Anything related to the CLI script (normalizer) enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants