Skip to content

Commit

Permalink
remove tomlkit from poetry-core
Browse files Browse the repository at this point in the history
tomli is smaller, faster, and being adopted by the standard library.

poetry-core has no need of the extra features that tomlkit brings.
  • Loading branch information
dimbleby committed Nov 2, 2022
1 parent 432ba1a commit 9c10aeb
Show file tree
Hide file tree
Showing 60 changed files with 1,274 additions and 5,435 deletions.
62 changes: 39 additions & 23 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ tox = "^3.0"
vendoring = {version = "^1.0", python = "^3.8"}
build = "^0.7.0"
mypy = ">=0.960"
tomli-w = "^1.0.0"
types-jsonschema = ">=4.4.4"
types-setuptools = ">=57.4.14"

Expand Down Expand Up @@ -91,7 +92,6 @@ exclude = "(?x)(^tests/.*/fixtures | ^src/poetry/core/_vendor)"
[[tool.mypy.overrides]]
module = [
'lark.*',
'tomlkit.*',
'virtualenv.*',
]
ignore_missing_imports = true
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/_vendor/_pyrsistent_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.18.1'
__version__ = '0.19.1'
11 changes: 11 additions & 0 deletions src/poetry/core/_vendor/jsonschema/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import json
import sys
import traceback
import warnings

try:
from importlib import metadata
Expand All @@ -24,6 +25,16 @@
from jsonschema.exceptions import SchemaError
from jsonschema.validators import RefResolver, validator_for

warnings.warn(
(
"The jsonschema CLI is deprecated and will be removed in a future "
"version. Please use check-jsonschema instead, which can be installed "
"from https://pypi.org/project/check-jsonschema/"
),
DeprecationWarning,
stacklevel=2,
)


class _CannotLoadFile(Exception):
pass
Expand Down
4 changes: 3 additions & 1 deletion src/poetry/core/_vendor/jsonschema/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,9 @@ def __len__(self):
return self.total_errors

def __repr__(self):
return f"<{self.__class__.__name__} ({len(self)} total errors)>"
total = len(self)
errors = "error" if total == 1 else "errors"
return f"<{self.__class__.__name__} ({total} total {errors})>"

@property
def total_errors(self):
Expand Down
19 changes: 7 additions & 12 deletions src/poetry/core/_vendor/jsonschema/schemas/draft3.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"properties" : {
"type" : "object",
"additionalProperties" : {"$ref" : "#", "type" : "object"},
"additionalProperties" : {"$ref" : "#"},
"default" : {}
},

Expand Down Expand Up @@ -47,7 +47,7 @@
},

"dependencies" : {
"type" : ["string", "array", "object"],
"type" : "object",
"additionalProperties" : {
"type" : ["string", "array", {"$ref" : "#"}],
"items" : {
Expand Down Expand Up @@ -75,11 +75,6 @@
"default" : false
},

"maxDecimal": {
"minimum": 0,
"type": "number"
},

"minItems" : {
"type" : "integer",
"minimum" : 0,
Expand Down Expand Up @@ -112,7 +107,9 @@
},

"enum" : {
"type" : "array"
"type" : "array",
"minItems" : 1,
"uniqueItems" : true
},

"default" : {
Expand Down Expand Up @@ -153,13 +150,11 @@
},

"id" : {
"type" : "string",
"format" : "uri"
"type" : "string"
},

"$ref" : {
"type" : "string",
"format" : "uri"
"type" : "string"
},

"$schema" : {
Expand Down
8 changes: 4 additions & 4 deletions src/poetry/core/_vendor/jsonschema/schemas/draft4.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@
"type": "object",
"properties": {
"id": {
"format": "uri",
"type": "string"
},
"$schema": {
"type": "string",
"format": "uri"
"type": "string"
},
"title": {
"type": "string"
Expand Down Expand Up @@ -122,7 +120,9 @@
}
},
"enum": {
"type": "array"
"type": "array",
"minItems": 1,
"uniqueItems": true
},
"type": {
"anyOf": [
Expand Down
12 changes: 9 additions & 3 deletions src/poetry/core/_vendor/jsonschema/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,15 @@ def __attrs_post_init__(self):
)

@classmethod
def check_schema(cls, schema):
def check_schema(cls, schema, format_checker=_UNSET):
Validator = validator_for(cls.META_SCHEMA, default=cls)
for error in Validator(cls.META_SCHEMA).iter_errors(schema):
if format_checker is _UNSET:
format_checker = Validator.FORMAT_CHECKER
validator = Validator(
schema=cls.META_SCHEMA,
format_checker=format_checker,
)
for error in validator.iter_errors(schema):
raise exceptions.SchemaError.create_from(error)

def evolve(self, **changes):
Expand Down Expand Up @@ -758,7 +764,7 @@ def from_schema(cls, schema, id_of=_id_of, *args, **kwargs):
`RefResolver`
"""

return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs)
return cls(base_uri=id_of(schema), referrer=schema, *args, **kwargs) # noqa: B026, E501

def push_scope(self, scope):
"""
Expand Down
1 change: 0 additions & 1 deletion src/poetry/core/_vendor/lark/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

43 changes: 36 additions & 7 deletions src/poetry/core/_vendor/lark/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,38 @@
from .utils import logger
from .tree import Tree, ParseTree
from .visitors import Transformer, Visitor, v_args, Discard, Transformer_NonRecursive
from .exceptions import (ParseError, LexError, GrammarError, UnexpectedToken,
UnexpectedInput, UnexpectedCharacters, UnexpectedEOF, LarkError)
from .lexer import Token
from .exceptions import (
GrammarError,
LarkError,
LexError,
ParseError,
UnexpectedCharacters,
UnexpectedEOF,
UnexpectedInput,
UnexpectedToken,
)
from .lark import Lark
from .lexer import Token
from .tree import ParseTree, Tree
from .utils import logger
from .visitors import Discard, Transformer, Transformer_NonRecursive, Visitor, v_args

__version__: str = "1.1.4"

__version__: str = "1.1.3"
__all__ = (
"GrammarError",
"LarkError",
"LexError",
"ParseError",
"UnexpectedCharacters",
"UnexpectedEOF",
"UnexpectedInput",
"UnexpectedToken",
"Lark",
"Token",
"ParseTree",
"Tree",
"logger",
"Discard",
"Transformer",
"Transformer_NonRecursive",
"Visitor",
"v_args",
)
Loading

0 comments on commit 9c10aeb

Please sign in to comment.