Skip to content

Commit cc168cd

Browse files
committed
Version 1.7.6.
1 parent 2e39795 commit cc168cd

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

erlang.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# MIT License
66
#
7-
# Copyright (c) 2011-2018 Michael Truog <mjtruog at protonmail dot com>
7+
# Copyright (c) 2011-2019 Michael Truog <mjtruog at protonmail dot com>
88
#
99
# Permission is hereby granted, free of charge, to any person obtaining a
1010
# copy of this software and associated documentation files (the "Software"),
@@ -371,6 +371,7 @@ def _blocked_attribute(self):
371371
pop = popitem = setdefault = update = _blocked_attribute
372372
def __new__(cls, *args, **kw):
373373
# pylint: disable=unused-argument
374+
# pylint: disable=too-many-nested-blocks
374375
new = dict.__new__(cls)
375376
args_ = []
376377
for arg in args:
@@ -485,8 +486,8 @@ def _binary_to_term(i, data):
485486
i += 1
486487
if tag == _TAG_REFERENCE_EXT:
487488
return (i, OtpErlangReference(node, id_value, creation))
488-
elif tag == _TAG_PORT_EXT:
489-
return (i, OtpErlangPort(node, id_value, creation))
489+
# tag == _TAG_PORT_EXT
490+
return (i, OtpErlangPort(node, id_value, creation))
490491
elif tag == _TAG_PID_EXT:
491492
i, node = _binary_to_atom(i, data)
492493
id_value = data[i:i + 4]
@@ -569,8 +570,7 @@ def _binary_to_term(i, data):
569570
return (i, True)
570571
elif atom_name == b'false':
571572
return (i, False)
572-
else:
573-
return (i, OtpErlangAtom(atom_name))
573+
return (i, OtpErlangAtom(atom_name))
574574
elif tag == _TAG_MAP_EXT:
575575
length = struct.unpack(b'>I', data[i:i + 4])[0]
576576
i += 4
@@ -707,7 +707,7 @@ def _term_to_binary(term):
707707
return _tuple_to_binary(term)
708708
elif isinstance(term, bool):
709709
return OtpErlangAtom(term and b'true' or b'false').binary()
710-
elif isinstance(term, int) or isinstance(term, TypeLong):
710+
elif isinstance(term, (int, TypeLong)):
711711
return _long_to_binary(term)
712712
elif isinstance(term, float):
713713
return _float_to_binary(term)
@@ -781,14 +781,12 @@ def _dict_to_binary(term):
781781
def _integer_to_binary(term):
782782
if 0 <= term <= 255:
783783
return b_chr(_TAG_SMALL_INTEGER_EXT) + b_chr(term)
784-
else:
785-
return b_chr(_TAG_INTEGER_EXT) + struct.pack(b'>i', term)
784+
return b_chr(_TAG_INTEGER_EXT) + struct.pack(b'>i', term)
786785

787786
def _long_to_binary(term):
788787
if -2147483648 <= term <= 2147483647:
789788
return _integer_to_binary(term)
790-
else:
791-
return _bignum_to_binary(term)
789+
return _bignum_to_binary(term)
792790

793791
def _bignum_to_binary(term):
794792
bignum = abs(term)
@@ -923,4 +921,3 @@ def consult(string_in):
923921
list_out.append(character)
924922
i += 1
925923
return eval(''.join(list_out))
926-

setup.cfg

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#-*-Mode:python;coding:utf-8;tab-width:4;c-basic-offset:4;indent-tabs-mode:()-*-
22
# ex: set ft=python fenc=utf-8 sts=4 ts=4 sw=4 et:
3-
import setuptools
4-
from distutils.core import setup, Command, Extension
3+
4+
try:
5+
from setuptools import setup, Command
6+
except ImportError:
7+
from distutils.core import setup, Command
58

69
class PyTest(Command):
710
user_options = []
@@ -16,11 +19,10 @@ def run(self):
1619
suite.addTests(tests.erlang_tests.get_suite())
1720
unittest.TextTestRunner().run(suite)
1821

19-
long_description = open('README.markdown', 'r').read()
2022
setup(
2123
name='erlang_py',
2224
py_modules=['erlang'],
23-
cmdclass = {'test': PyTest},
25+
cmdclass={'test': PyTest},
2426
license='MIT',
2527
classifiers=[
2628
'Development Status :: 5 - Production/Stable',
@@ -33,10 +35,8 @@ def run(self):
3335
'Topic :: Software Development :: Libraries :: Python Modules',
3436
'Topic :: System :: Distributed Computing',
3537
],
36-
version='1.7.5',
38+
version='1.7.6',
3739
description='Erlang Binary Term Format for Python',
38-
long_description=long_description,
39-
long_description_content_type="text/markdown",
4040
author='Michael Truog',
4141
author_email='mjtruog@protonmail.com',
4242
url='https://github.com/okeuday/erlang_py',

0 commit comments

Comments
 (0)