Skip to content

Commit

Permalink
Add ruff gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
cblakkan committed Mar 20, 2024
1 parent 7d4ee06 commit 612dea2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 23 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: chartboost/ruff-action@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down
3 changes: 3 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
line-length = 121
indent-width = 4

[lint]
ignore = ["F401", "F403"]
4 changes: 2 additions & 2 deletions yamale/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ def _validate_any(self, validator, data, path, strict):
def _validate_subset(self, validator, data, path, strict):
def _internal_validate(internal_data):
sub_errors = []
for val in validator.validators:
err = self._validate(val, internal_data, path, strict)
for v in validator.validators:
err = self._validate(v, internal_data, path, strict)
if not err:
break
sub_errors += err
Expand Down
25 changes: 5 additions & 20 deletions yamale/util.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,12 @@
# ABCs for containers were moved to their own module
try:
from collections.abc import Mapping, Set, Sequence
except ImportError:
from collections import Mapping, Set, Sequence
from collections import Mapping, Sequence


# Python 3 has no basestring, lets test it.
try:
basestring # attempt to evaluate basestring
def isstr(s):
return isinstance(s, str)

def isstr(s):
return isinstance(s, basestring)

def to_unicode(s):
return unicode(s)

except NameError:

def isstr(s):
return isinstance(s, str)

def to_unicode(s):
return s
def to_unicode(s):
return s


def is_list(obj):
Expand Down
2 changes: 1 addition & 1 deletion yamale/yamale_testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def validate(self, validators=None):
if schema is None:
return

if type(yaml) != list:
if not isinstance(yaml, list):
yaml = [yaml]

if base_dir is not None:
Expand Down

0 comments on commit 612dea2

Please sign in to comment.