Skip to content

Commit

Permalink
refactor: str.startswith usage is simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
myhailo-chernyshov-rg committed Dec 19, 2024
1 parent 5349f35 commit 6e5509e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
],
description=("Command line tool, that converts Common Cartridge " "courses to Open edX Studio imports."),
entry_points={"console_scripts": ["cc2olx=cc2olx.main:main"]},
install_requires=load_requirements("requirements/base.txt"),
install_requires=load_requirements("requirements/base.in"),
license="GNU Affero General Public License",
long_description=readme,
include_package_data=True,
Expand Down
11 changes: 2 additions & 9 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ def is_requirement(line):
line = line.strip()

# Skip blank lines, comments, and editable installs
return not (
line == ''
or line.startswith('-r')
or line.startswith('#')
or line.startswith('-e')
or line.startswith('git+')
or line.startswith('-c')
)
return bool(line) and not line.startswith(("-r", "#", "-e", "git+", "-c"))


def load_requirements(*requirements_paths):
Expand All @@ -43,7 +36,7 @@ def load_requirements(*requirements_paths):
requirements = set()
for path in requirements_paths:
requirements.update(
line.split('#')[0].strip() for line in open(path).readlines()
line.split("#")[0].strip() for line in open(path).readlines()
if is_requirement(line)
)
return list(requirements)

0 comments on commit 6e5509e

Please sign in to comment.