Skip to content

Commit

Permalink
pep8 and release docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xrotwang committed Dec 21, 2017
1 parent ed9a2c7 commit a51e882
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 9 deletions.
43 changes: 43 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Releasing csvw
==============

- Do platform test via tox:
```
tox -r --skip-missing-interpreters
```

- Make sure statement coverage is at 100%
- Make sure flake8 passes:
```
flake8 csvw
```

- Change version to the new version number in

- `setup.py`
- `csvw/__init__.py`

- Bump version number:
```
git commit -a -m"bumped version number"
```

- Create a release tag:
```
git tag -a v<version> -m"first version to be released on pypi"
```

- Push to github:
```
git push origin
git push --tags
```

- Make sure your system Python has ``setuptools-git`` installed and release to PyPI:
```
git checkout tags/v$1
rm dist/*
python setup.py sdist bdist_wheel
twine upload dist/*
```
1 change: 1 addition & 0 deletions csvw/_compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# _compat.py - Python 2/3 compatibility
# flake8: noqa

import io
import sys
Expand Down
14 changes: 7 additions & 7 deletions csvw/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def asdict(self, omit_defaults=True):
return self[None]
return collections.OrderedDict(
('und' if k is None else k, v[0] if len(v) == 1 else v)
for k, v in iteritems(self))
for k, v in iteritems(self))

def add(self, string, lang=None):
if lang not in self:
Expand Down Expand Up @@ -192,15 +192,15 @@ def _asdict_multiple(v):

for k, v in sorted(iteritems(self.common_props)):
yield k, _asdict_multiple(v)

for k, v in iteritems(utils.attr_asdict(self, omit_defaults=omit_defaults)):
if k not in ('common_props', 'at_props'):
yield k, _asdict_multiple(v)

def asdict(self, omit_defaults=True):
return collections.OrderedDict(
(k, v) for k, v in
self._iter_dict_items(omit_defaults) if v not in (None, [], {}))
self._iter_dict_items(omit_defaults) if v not in (None, [], {}))


def optional_int():
Expand Down Expand Up @@ -287,12 +287,12 @@ def validate(self, v):
if v is None:
return v
try:
l = len(v or '')
if self.length is not None and l != self.length:
l_ = len(v or '')
if self.length is not None and l_ != self.length:
raise ValueError()
if self.minLength is not None and l < self.minLength:
if self.minLength is not None and l_ < self.minLength:
raise ValueError()
if self.maxLength is not None and l > self.maxLength:
if self.maxLength is not None and l_ > self.maxLength:
raise ValueError()
except TypeError:
pass
Expand Down
4 changes: 2 additions & 2 deletions csvw/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ class lazyproperty(object):

def __init__(self, fget):
self.fget = fget
for attr in ('__module__', '__name__', '__doc__'):
setattr(self, attr, getattr(fget, attr))
for attr_ in ('__module__', '__name__', '__doc__'):
setattr(self, attr_, getattr(fget, attr_))

def __get__(self, instance, owner):
if instance is None:
Expand Down

0 comments on commit a51e882

Please sign in to comment.