Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #423 from DriverX/fix_lock_attr_default
Browse files Browse the repository at this point in the history
Fix Converter.lock default value for subclasses
  • Loading branch information
orsinium committed Apr 27, 2020
2 parents 6303f41 + a13feba commit 10cec39
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 13 deletions.
2 changes: 2 additions & 0 deletions dephell/converters/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from dephell_specifier import RangeSpecifier
from packaging.utils import canonicalize_name
Expand All @@ -16,6 +17,7 @@
from .base import BaseConverter


@attr.s()
class CondaConverter(BaseConverter):
def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if isinstance(path, str):
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/egginfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from typing import Dict, Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from dephell_links import parse_link
from dephell_markers import Markers
Expand Down Expand Up @@ -401,9 +402,10 @@ def _format_req(req, with_envs: bool) -> str:
return line


@attr.s()
class EggInfoConverter(_Reader, _Writer, BaseConverter):
"""
PEP-314, PEP-345, PEP-566
https://packaging.python.org/specifications/core-metadata/
"""
lock = False
lock = attr.ib(type=bool, default=False)
4 changes: 3 additions & 1 deletion dephell/converters/flit.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Optional

# external
import attr
import tomlkit
from dephell_discover import Root as PackageRoot
from dephell_specifier import RangeSpecifier
Expand All @@ -17,8 +18,9 @@
from .egginfo import EggInfoConverter


@attr.s()
class FlitConverter(BaseConverter):
lock = False
lock = attr.ib(type=bool, default=False)

def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if not content:
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Dict, List, Set

# external
import attr
from dephell_discover import Root as PackageRoot

# app
Expand All @@ -23,8 +24,9 @@
CACHE_TTL = 3600 * 24 * 30 # 30 days


@attr.s()
class ImportsConverter(BaseConverter):
lock = True
lock = attr.ib(type=bool, default=True)

def can_parse(self, path: Path, content: str = None) -> bool:
if isinstance(path, str):
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import Iterable, Union

# external
import attr
from dephell_discover import Root as PackageRoot
from packaging.utils import canonicalize_name

Expand All @@ -15,8 +16,9 @@
from .wheel import WheelConverter


@attr.s()
class InstalledConverter(BaseConverter):
lock = True
lock = attr.ib(type=bool, default=True)

_blacklist = {
'pkg-resources', # https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
Expand Down
2 changes: 2 additions & 0 deletions dephell/converters/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from typing import Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from dephell_links import DirLink, FileLink
from pip._internal.req import parse_requirements
Expand Down Expand Up @@ -33,6 +34,7 @@
from pip._internal.network.session import PipSession


@attr.s()
class PIPConverter(BaseConverter):
sep = ' \\\n '

Expand Down
5 changes: 4 additions & 1 deletion dephell/converters/pipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import List, Optional

# external
import attr
import tomlkit
from dephell_discover import Root as PackageRoot
from dephell_pythons import Pythons
Expand All @@ -19,8 +20,10 @@
VCS_LIST = ('git', 'svn', 'hg', 'bzr')


@attr.s()
class PIPFileConverter(BaseConverter):
lock = False
lock = attr.ib(type=bool, default=False)

fields = (
'version', 'editable', 'extras', 'markers',
'ref', 'vcs', 'index', 'hashes',
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/pipfilelock.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from dephell_pythons import Pythons
from dephell_specifier import RangeSpecifier
Expand All @@ -22,8 +23,9 @@
# https://github.com/pypa/pipfile/blob/master/pipfile/api.py


@attr.s()
class PIPFileLockConverter(PIPFileConverter):
lock = True
lock = attr.ib(type=bool, default=True)

def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if isinstance(path, str):
Expand Down
5 changes: 4 additions & 1 deletion dephell/converters/poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import List, Optional

# external
import attr
import tomlkit
from dephell_discover import Root as PackageRoot
from dephell_specifier import RangeSpecifier
Expand All @@ -16,8 +17,10 @@
from .base import BaseConverter


@attr.s()
class PoetryConverter(BaseConverter):
lock = False
lock = attr.ib(type=bool, default=False)

fields = (
'version', 'python', 'platform', 'allows-prereleases',
'optional', 'extras', 'develop',
Expand Down
5 changes: 4 additions & 1 deletion dephell/converters/poetrylock.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from typing import List, Optional

# external
import attr
import tomlkit
from dephell_discover import Root as PackageRoot
from dephell_links import DirLink
Expand All @@ -16,8 +17,10 @@
from .base import BaseConverter


@attr.s()
class PoetryLockConverter(BaseConverter):
lock = True
lock = attr.ib(type=bool, default=True)

fields = (
'category', 'description', 'name', 'marker', 'optional',
'python-versions', 'version', 'dependencies',
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/pyproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from packaging.requirements import Requirement
from tomlkit import document, dumps, parse
Expand All @@ -13,8 +14,9 @@
from .base import BaseConverter


@attr.s()
class PyProjectConverter(BaseConverter):
lock = False
lock = attr.ib(type=bool, default=False)

def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if isinstance(path, str):
Expand Down
2 changes: 1 addition & 1 deletion dephell/converters/sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SDistConverter(BaseConverter):
# ratio of tests and project size after which tests will be excluded from sdist
ratio = attr.ib(type=Optional[float], default=None)

lock = False
lock = attr.ib(type=bool, default=False)

def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if content is not None:
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/setuppy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Optional

# external
import attr
from dephell_discover import Root as PackageRoot
from dephell_links import DirLink, FileLink, URLLink, VCSLink, parse_link
from dephell_setuptools import read_setup
Expand Down Expand Up @@ -54,8 +55,9 @@
"""


@attr.s()
class SetupPyConverter(BaseConverter):
lock = False
lock = attr.ib(type=bool, default=False)

def can_parse(self, path: Path, content: Optional[str] = None) -> bool:
if isinstance(path, str):
Expand Down
4 changes: 3 additions & 1 deletion dephell/converters/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo

# external
import attr
from dephell_archive import ArchivePath
from dephell_discover import Root as PackageRoot

Expand Down Expand Up @@ -207,9 +208,10 @@ def make_records(self, path: str) -> str:
return content + ('\n{},,'.format(path))


@attr.s()
class WheelConverter(_Reader, _Writer, BaseConverter):
"""
PEP-0427
https://www.python.org/dev/peps/pep-0427/
"""
lock = False
lock = attr.ib(type=bool, default=False)
1 change: 0 additions & 1 deletion tests/requirements/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# external
from setuptools import setup


here = path.abspath(path.dirname(__file__))
root = path.dirname(path.dirname(here))
with open(path.join(root, 'README.md'), encoding='utf-8') as f:
Expand Down

0 comments on commit 10cec39

Please sign in to comment.