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

Python 3 port #1

Open
wants to merge 2 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
6 changes: 3 additions & 3 deletions crm/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ def _identifier(uri_ref):
delim = '#'
else:
delim = '/'
ident_parts = unicode(uri_ref).split(delim)[-1].split('_')
ident_parts = str(uri_ref).split(delim)[-1].split('_')
# Can you think of a hackier way to do this? I can't.
return ' '.join(ident_parts).title().replace(' ', '').replace('-', ''), \
'_'.join(ident_parts).replace('-', '_'), ident_parts[0]
'_'.join(ident_parts).replace('-', '_'), ident_parts[0]


def import_schema(schema_url):
Expand Down Expand Up @@ -127,7 +127,7 @@ def import_schema(schema_url):
# Build RDFClasses first, so that we can use them in the domain and range
# of RDFProperty instances.
for class_ref in classes:
identifier, safe_name, code = _identifier(class_ref)
identifier, safe_name, code = _identifier(class_ref)

# We prefer to use the description, but comment is fine, too.
comment = _get_object(g, class_ref, DESCRIPTION)
Expand Down
4 changes: 2 additions & 2 deletions crm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def primary_label(self):
_, cls = sorted(zip(map(lambda cls: len(cls.mro()),
class_objs),
class_objs),
key=lambda (size, cls): size)[-1]
key=lambda size, cls: size)[-1]
return cls.__name__


Expand Down Expand Up @@ -107,7 +107,7 @@ def downcast(self, target_class=None):
_, cls = sorted(zip(map(lambda cls: len(cls.mro()),
class_objs),
class_objs),
key=lambda (size, cls): size)[-1]
key=lambda size, cls: size)[-1]
else: # Caller has specified a target class.
if not isinstance(target_class, basestring):
# In the spirit of neomodel, we might as well support both
Expand Down