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

v0.0.3 - Add support for Vyper 0.4.0 #35

Merged
merged 10 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ repos:
rev: 23.1.0
hooks:
- id: black
language_version: python3.10
language_version: python3.11
args: [ --line-length=79 ]

- repo: https://github.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
language_version: python3.10
language_version: python3.11
args: [ --max-line-length=79 ]
stages: [ commit, push ]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.971
hooks:
- id: mypy
language_version: python3.10
language_version: python3.11
additional_dependencies: ['types-requests']
stages: [ commit, push ]
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pytest = ">=7.0.0"
pytest-cov = ">=3.0.0"
coverage = ">=6.5.0"
bump2version = ">=1.0.0"
mypy-extensions = "==0.4.3"

[dev-packages]

Expand Down
360 changes: 187 additions & 173 deletions Pipfile.lock

Large diffs are not rendered by default.

558 changes: 558 additions & 0 deletions poetry.lock

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,27 @@ ignore_missing_imports = true
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"

[tool.poetry]
name = "mamushi"
version = "0.0.3"
description = "Vyper Formatter"
authors = ["benny <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.8"
click = "8.1.3"
black = "23.1.0"
pre-commit = "2.20.0"
types-attrs = "^19.1.0"
lark = ">=1.0.0"
mypy-extensions = "0.4.3"

[tool.poetry.dev-dependencies]
pytest = ">=7.0.0"
pytest-cov = ">=3.0.0"
coverage = ">=6.5.0"
bump2version = ">=1.0.0"

[tool.poetry.scripts]
mamushi = "mamushi.__main__:main"
28 changes: 17 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,34 +1,36 @@
[bumpversion]
current_version = 0.0.2-b0
current_version = 0.0.3
commit = False
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+)(?P<build>\d+))?
serialize =
serialize =
{major}.{minor}.{patch}-{release}{build}
{major}.{minor}.{patch}

[options]
package_dir =
package_dir =
= src
packages = find:
python_requires = >= 3.9
install_requires =
install_requires =
click>=8.0.0
pathspec>=0.9.0
lark>=1.0.0
mypy-extensions==0.4.3
py_modules = mamushi
include_package_data = True

[options.package_data]
mamushi.parsing = *.lark

[options.entry_points]
console_scripts =
console_scripts =
mamushi=mamushi:main

[options.extras_require]
dev =
black>=22.6.0
dev =
black==23.1.0
pre-commit==2.20.0
mypy_extensions==0.4.3
mypy>=0.900
flake8==5.0.4
Expand All @@ -40,7 +42,7 @@ dev =

[options.packages.find]
where = src
exclude =
exclude =
tests

[metadata]
Expand All @@ -51,10 +53,10 @@ long_description = file: README.md
long_description_content_type = text/markdown
version = attr: mamushi.__version__.__version__
url = https://github.com/benber86/mamushi
project_urls =
project_urls =
Source = https://github.com/benber86/mamushi
Tracker = https://github.com/benber86/mamushi/issues
classifiers =
classifiers =
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Expand All @@ -69,11 +71,15 @@ classifiers =

[bumpversion:part:release]
optional_value = release
values =
values =
a
b
release

[bumpversion:file:./src/mamushi/__version__.py]

[bumpversion:part:build]

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
2 changes: 1 addition & 1 deletion src/mamushi/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.2-b0"
__version__ = "0.0.3"
14 changes: 12 additions & 2 deletions src/mamushi/formatting/whitespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def whitespace(leaf: Leaf) -> str:
):
return NO

elif (
prevp.parent
and prevp.parent.parent
and prevp.parent.parent.type == tokens.INITIALIZES_STMT
):
return NO

elif p.type == tokens.KWARG:
if prev.type != tokens.COMMA:
return NO
Expand All @@ -80,7 +87,7 @@ def whitespace(leaf: Leaf) -> str:
):
return NO

elif p.type == tokens.GET_ATTR:
elif p.type == tokens.ATTRIBUTE:
# variable access
if t == tokens.DOT or prev.type == tokens.DOT:
return NO
Expand All @@ -93,10 +100,13 @@ def whitespace(leaf: Leaf) -> str:
tokens.FUNCTION_SIG,
tokens.CALL,
tokens.EMPTY,
tokens.GET_ITEM,
tokens.ABI_DECODE,
tokens.SUBSCRIPT,
tokens.INDEXED_ARGS,
tokens.LOG_STMT,
tokens.CONSTANT,
tokens.IMPLEMENTS,
tokens.USES,
tokens.IMMUTABLE,
}
):
Expand Down
Loading
Loading