Skip to content

Commit

Permalink
Merge pull request #61 from kelockhart/py3
Browse files Browse the repository at this point in the history
Make compatible with Python 2.7 and 3
  • Loading branch information
romanchyla authored Apr 16, 2020
2 parents 97970b0 + 7b3c9c0 commit 156990a
Show file tree
Hide file tree
Showing 26 changed files with 737 additions and 1,085 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ python/

# emacs
*~

**/.DS_Store
*.idea
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ RUN \
apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes autoconf automake libtool curl make g++ unzip wget && \
rm -rf /var/lib/apt/lists/* && \
wget https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-python-3.3.0.tar.gz && \
tar -zxvf protobuf-python-3.3.0.tar.gz && \
cd protobuf-3.3.0/ && \
wget https://github.com/google/protobuf/releases/download/v3.11.3/protobuf-python-3.11.3.tar.gz && \
tar -zxvf protobuf-python-3.11.3.tar.gz && \
cd protobuf-3.11.3/ && \
./configure && \
make -j 2 && \
make install && \
Expand Down
1 change: 0 additions & 1 deletion adsmsg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from .status import Status
from .citation_changes import CitationChanges, CitationChange
from .citation_changes_content_type import CitationChangeContentType
from .turbobee import TurboBeeMsg



7 changes: 5 additions & 2 deletions adsmsg/msg.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from builtins import str
from past.builtins import basestring
from builtins import object
from datetime import datetime
from google.protobuf import json_format
from google.protobuf import timestamp_pb2
Expand All @@ -17,12 +20,12 @@ def __init__(self, instance, args, kwargs):
if isinstance(kwargs['status'], basestring) and hasattr(Status, kwargs['status']):
kwargs['status'] = getattr(Status, kwargs['status'])

for k, v in kwargs.items():
for k, v in list(kwargs.items()):
if isinstance(v, list) or isinstance(v, tuple):
getattr(instance, k).extend(v) #TODO(rca): use some smarter reflection
elif isinstance(v, dict):
x = getattr(instance, k)
for dk in v.keys():
for dk in list(v.keys()):
x[dk] = v[dk]
elif isinstance(v, datetime):
getattr(instance, k).FromDatetime(v)
Expand Down
91 changes: 45 additions & 46 deletions adsmsg/protobuf/augmentrecord_pb2.py

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

Loading

0 comments on commit 156990a

Please sign in to comment.