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

applied 2to3 + some manual fixes. #3

Open
wants to merge 1 commit 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: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
language: python

python:
- "2.7"
- 3.6
- latest

virtualenv:
system_site_packages: true
Expand Down
190 changes: 95 additions & 95 deletions quantulum/classes.py
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""quantulum classes."""


###############################################################################
class Quantity(object):
"""Class for a quantity (e.g. "4.2 gallons")."""

def __init__(self, value=None, unit=None, surface=None, span=None,
uncertainty=None):
"""Initialization method."""
self.value = value
self.unit = unit
self.surface = surface
self.span = span
self.uncertainty = uncertainty

def __repr__(self):
"""Representation method."""
msg = u'Quantity(%g, "%s")'
msg = msg % (self.value, self.unit.name)
return msg.encode('utf-8')

def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False

def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)


###############################################################################
class Unit(object):
"""Class for a unit (e.g. "gallon")."""

def __init__(self, name=None, surfaces=None, entity=None, uri=None,
symbols=None, dimensions=None):
"""Initialization method."""
self.name = name
self.surfaces = surfaces
self.entity = entity
self.uri = uri
self.symbols = symbols
self.dimensions = dimensions

def __repr__(self):
"""Representation method."""
msg = u'Unit(name="%s", entity=Entity("%s"), uri=%s)'
msg = msg % (self.name, self.entity.name, self.uri)
return msg.encode('utf-8')

def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False

def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)


###############################################################################
class Entity(object):
"""Class for an entity (e.g. "volume")."""

def __init__(self, name=None, dimensions=None, uri=None):
"""Initialization method."""
self.name = name
self.dimensions = dimensions
self.uri = uri

def __repr__(self):
"""Representation method."""
msg = u'Entity(name="%s", uri=%s)'
msg = msg % (self.name, self.uri)
return msg.encode('utf-8')

def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False

def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""quantulum classes."""
###############################################################################
class Quantity(object):
"""Class for a quantity (e.g. "4.2 gallons")."""
def __init__(self, value=None, unit=None, surface=None, span=None,
uncertainty=None):
"""Initialization method."""
self.value = value
self.unit = unit
self.surface = surface
self.span = span
self.uncertainty = uncertainty
def __repr__(self):
"""Representation method."""
msg = 'Quantity(%g, "%s")'
msg = msg % (self.value, self.unit.name)
return msg
def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False
def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)
###############################################################################
class Unit(object):
"""Class for a unit (e.g. "gallon")."""
def __init__(self, name=None, surfaces=None, entity=None, uri=None,
symbols=None, dimensions=None):
"""Initialization method."""
self.name = name
self.surfaces = surfaces
self.entity = entity
self.uri = uri
self.symbols = symbols
self.dimensions = dimensions
def __repr__(self):
"""Representation method."""
msg = 'Unit(name="%s", entity=Entity("%s"), uri=%s)'
msg = msg % (self.name, self.entity.name, self.uri)
return msg
def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False
def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)
###############################################################################
class Entity(object):
"""Class for an entity (e.g. "volume")."""
def __init__(self, name=None, dimensions=None, uri=None):
"""Initialization method."""
self.name = name
self.dimensions = dimensions
self.uri = uri
def __repr__(self):
"""Representation method."""
msg = 'Entity(name="%s", uri=%s)'
msg = msg % (self.name, self.uri)
return msg
def __eq__(self, other):
"""Equality method."""
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False
def __ne__(self, other):
"""Non equality method."""
return not self.__eq__(other)
Loading