Skip to content

Commit

Permalink
Convert all the python2 scripts to python3. (#45)
Browse files Browse the repository at this point in the history
## Summary:
There was only one!  I used `2to3` to do most of the conversion.

Issue: https://khanacademy.atlassian.net/browse/INFRA-10116

## Test plan:
I ran `./add_pep8_disable_lines.py` with success.  (It ran to
completion and editing a few files.)

Author: csilvers

Reviewers: nathanjd

Required Reviewers:

Approved By: nathanjd

Checks:

Pull Request URL: #45
  • Loading branch information
csilvers authored May 7, 2024
1 parent 1f15c55 commit aead10d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions add_pep8_disable_lines.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
"""A script to add linter ignore lines to python files within webapp.
Use this when upgrading the linter so that you don't have to fix all the
Expand Down Expand Up @@ -35,9 +35,10 @@ def lint_with_todo_target(files, todo_target):
[os.path.join(os.path.dirname(__file__), 'runlint.py'),
'--extra-linter=',
file],
stderr=subprocess.STDOUT)
stderr=subprocess.STDOUT,
).decode('utf-8')
except subprocess.CalledProcessError as e:
lint = e.output
lint = e.output.decode('utf-8')
rules_violated = ','.join(sorted(set(
lint_violation_re.findall(lint))))
if rules_violated:
Expand All @@ -56,9 +57,9 @@ def lint_with_todo_target(files, todo_target):
contents = lint_disable_lines + contents
with open(file, 'w') as f:
f.writelines(contents)
print 'Added lint ignore line to %s' % file
print('Added lint ignore line to %s' % file)
else:
print 'No lint problems in %s' % file
print('No lint problems in %s' % file)


def main():
Expand Down

0 comments on commit aead10d

Please sign in to comment.