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

installable, dual py2+py3 compatibility, that fixes/tolerates some non-standard nodes #7

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ doc*/build/*
*.json
*.dat
*.log
dist
build
*.egg-info
4,089 changes: 674 additions & 3,415 deletions LICENSE

Large diffs are not rendered by default.

File renamed without changes.
1 change: 0 additions & 1 deletion __init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.append(os.path.abspath('../../.'))
sys.path.append(os.path.abspath('../../vamdclib'))

# -- General configuration -----------------------------------------------------

Expand Down Expand Up @@ -48,9 +48,9 @@
# built documents.
#
# The short X.Y version.
version = '0.1'
version = '0.3'
# The full version, including alpha/beta/rc tags.
release = '0.1'
release = '0.3'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
24 changes: 24 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import setuptools

with open("README", "r") as fh:
long_description = fh.read()

setuptools.setup(
name="vamdclib",
version="0.3",
author="Christian Endres, Jacob Laas",
author_email="[email protected]",
description="A pure-python library for the VAMDC.",
long_description=long_description,
long_description_content_type="text/plain",
url="https://github.com/notlaast/vamdclib",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GPLv3 License",
"Operating System :: Linux",
"Operating System :: Windows",
"Operating System :: MacOS"
],
)
13 changes: 13 additions & 0 deletions vamdclib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
__version__ = '0.3'
__all__ = ["basemodel",
"database",
"functions",
"inchi",
"local_registry",
"nodes",
"query",
"registry",
"request",
"results",
"settings",
"specmodel"]
19 changes: 12 additions & 7 deletions basemodel.py → vamdclib/basemodel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# -*- coding: utf-8 -*-
import functions
import numpy
import sys
import os
import numpy

if sys.version_info[0] == 3:
from . import functions
else:
import functions

NAMESPACE='http://vamdc.org/xml/xsams/1.0'

Expand All @@ -21,7 +26,7 @@ def get_attributes(element):
"""
Returns a list of attributes-tuples (attribute, value)
"""
return element.items()
return list(element.items())

def convert_tabulateddata(item):
"""
Expand Down Expand Up @@ -140,7 +145,7 @@ def construct_model(dictionary):
elif len(code_add) > 0:
code = "self.xml.%s" % (code_add,)
else:
print "ERROR --------"
print("ERROR --------")
else:
if function is not None:
if function == 'self':
Expand Down Expand Up @@ -233,7 +238,7 @@ def __repr__(self):
retval += "None "
return retval

if model_definitions.has_key('methods'):
if 'methods' in model_definitions:
for method in model_definitions['methods']:
setattr(_Model, method['name'], method['method'])

Expand All @@ -247,14 +252,14 @@ def register_models(DICT_MODELS, module):
DICT_MODELS: Dictionary which defines Classes and its properties
"""
for model in DICT_MODELS['model_types']:
print "Register Class %s in %s" % (model['Name'], module.__name__)
print("Register Class %s in %s" % (model['Name'], module.__name__))
model_class = _construct_class(model)
setattr(sys.modules[__name__], model['Name'], model_class )
setattr(module, model['Name'], model_class )


for model in DICT_MODELS['dict_types']:
print "Register DictClass %s in %s" % (model['Name'], module.__name__)
print("Register DictClass %s in %s" % (model['Name'], module.__name__))
setattr(module, model['Name'], _construct_dictmodelclass(model, module))


Loading