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

Python syntax errors and undefined names #21510

Closed
cclauss opened this issue Aug 12, 2018 · 1 comment
Closed

Python syntax errors and undefined names #21510

cclauss opened this issue Aug 12, 2018 · 1 comment

Comments

@cclauss
Copy link

cclauss commented Aug 12, 2018

flake8 testing of https://github.com/dimagi/commcare-hq on Python 3.7.0

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./custom/bihar/reports/indicators/indicators.py:287:27: F821 undefined name 'SortedDict'
        self.indicators = SortedDict()
                          ^
./custom/_legacy/pact/dot_data.py:205:16: F821 undefined name 'cmp'
        return cmp(y.submitted_date, x.submitted_date)
               ^
./custom/_legacy/pact/dot_data.py:215:16: F821 undefined name 'cmp'
        return cmp(y.encounter_date, x.encounter_date)
               ^
./custom/_legacy/pact/dot_data.py:228:16: F821 undefined name 'cmp'
        return cmp(y.encounter_date, x.encounter_date)
               ^
./corehq/warehouse/tests/utils.py:118:30: F821 undefined name 'DEFAULT_BATCH_ID'
        batch_id=batch_id or DEFAULT_BATCH_ID,
                             ^
./corehq/form_processor/backends/couch/update_strategy.py:392:20: F821 undefined name 'cmp'
            return cmp(first_action.server_date, second_action.server_date)
                   ^
./corehq/form_processor/backends/couch/update_strategy.py:398:24: F821 undefined name 'cmp'
                return cmp(
                       ^
./corehq/form_processor/backends/couch/update_strategy.py:421:20: F821 undefined name 'cmp'
            return cmp(_sortkey(first_action), _sortkey(second_action))
                   ^
./corehq/util/workbook_json/excel.py:194:32: F821 undefined name 'file'
        elif not isinstance(f, file):
                               ^
./corehq/util/tests/test_log.py:19:45: F821 undefined name 'e'
        self.assertIn(result, six.text_type(e))
                                            ^
./corehq/util/tests/test_log.py:20:64: F821 undefined name 'e'
        self.assertNotIn(result, six.text_type(clean_exception(e)))
                                                               ^
./corehq/apps/reports/views.py:523:11: E999 SyntaxError: invalid syntax
    async = req.get('async') == 'true'
          ^
./corehq/apps/reports/standard/forms/reports.py:26:12: F821 undefined name 'cmp'
    return cmp(y.received_on, x.received_on)
           ^
./corehq/apps/domain/views.py:2391:36: F821 undefined name 'cmp'
        diff.sort(cmp=lambda x, y: cmp(x['label'], y['label']))
                                   ^
./corehq/apps/ota/views.py:259:13: E999 SyntaxError: invalid syntax
        async=async_restore_enabled,
            ^
./corehq/ex-submodules/couchforms/management/commands/submit_form.py:60:41: F821 undefined name 'file'
        print(post_data(None, url, path=file, use_curl=use_curl, use_chunked=use_chunked,
                                        ^
./corehq/ex-submodules/casexml/apps/case/sharedmodels.py:61:16: F821 undefined name 'cmp'
        return cmp(six.text_type(self), six.text_type(other))
               ^
./corehq/ex-submodules/casexml/apps/phone/fixtures.py:79:13: E999 SyntaxError: invalid syntax
        async=False,
            ^
./corehq/ex-submodules/casexml/apps/phone/restore.py:322:59: E999 SyntaxError: invalid syntax
    def __init__(self, project, restore_user, params, async=False,
                                                          ^
./corehq/ex-submodules/casexml/apps/phone/tests/utils.py:84:13: E999 SyntaxError: invalid syntax
        async=False,
            ^
./corehq/ex-submodules/casexml/apps/phone/tests/test_async_restore.py:55:35: E999 SyntaxError: invalid syntax
    def _restore_config(self, async=True, sync_log_id='', overwrite_cache=False):
                                  ^
./corehq/ex-submodules/couchexport/writers.py:195:24: F821 undefined name 'unicode'
                name = unicode(name) if six.PY2 else str(name)
                       ^
./corehq/ex-submodules/dimagi/utils/gmailloghandler.py:40:9: F821 undefined name 'RECIPIENTS'
        RECIPIENTS,
        ^
./corehq/ex-submodules/dimagi/utils/gmailloghandler.py:42:34: F821 undefined name 'SMTP_PASS'
        ('emailacct@dimagi.com', SMTP_PASS)
                                 ^
./corehq/ex-submodules/auditcare/forms.py:16:45: F821 undefined name '_'
                raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
                                            ^
./corehq/ex-submodules/auditcare/forms.py:18:45: F821 undefined name '_'
                raise forms.ValidationError(_("This account is inactive."))
                                            ^
6     E999 SyntaxError: invalid syntax
20    F821 undefined name 'cmp'
26
@emord
Copy link
Contributor

emord commented Aug 13, 2018

Thanks for the detail. We do not currently support python 3 but are in the process of transitioning towards that. All of these seem like syntax errors that will be found in that effort

@emord emord closed this as completed Aug 13, 2018
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

No branches or pull requests

2 participants