Skip to content

Commit

Permalink
PSF black
Browse files Browse the repository at this point in the history
  • Loading branch information
VelizarVESSELINOV committed Oct 24, 2022
1 parent 70edcc7 commit d33c5b9
Show file tree
Hide file tree
Showing 8 changed files with 323 additions and 306 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
| Fossa | [![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSchlumberger%2FUOM.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSchlumberger%2FUOM?ref=badge_shield) |
| PyPI | [![PyPI Latest Release](https://img.shields.io/pypi/v/uom.svg)](https://pypi.org/project/uom/) [![Package Status](https://img.shields.io/pypi/status/uom.svg)](https://pypi.org/project/uom/) [![Python](https://img.shields.io/pypi/pyversions/uom.svg?style=plastic)](https://badge.fury.io/py/uom) |
| PePy | [![Downloads](https://pepy.tech/badge/uom)](https://pepy.tech/project/uom) [![Downloads](https://pepy.tech/badge/uom/month)](https://pepy.tech/project/uom) [![Downloads](https://pepy.tech/badge/uom/week)](https://pepy.tech/project/uom) |
| Code formatting | [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |

<!--
## Build package
Expand Down
78 changes: 42 additions & 36 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,53 @@

def requirements():
"""Requirement from source."""
with open('requirements.txt', 'r', encoding='utf8') as fil:
with open("requirements.txt", "r", encoding="utf8") as fil:
return fil.read().splitlines()


def readme():
"""Readme from source."""
with open('README.md', 'r', encoding='utf8') as fil:
with open("README.md", "r", encoding="utf8") as fil:
return fil.read()


setup(name='uom',
version='0.6.1',
description='Unit of Measure conversion tool',
long_description=readme(),
long_description_content_type='text/markdown',
classifiers=['Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Intended Audience :: Customer Service',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Topic :: Scientific/Engineering',
'Topic :: Scientific/Engineering :: Information Analysis'],
keywords='uom unit measurement measure Energistics oilfield',
url='http://github.com/schlumberger/UOM',
author='Velizar VESSELINOV',
author_email='vvesselinov@slb.com',
license='BSD 2-Clause “Simplified” License',
license_file='LICENSE.md',
packages=['uom'],
install_requires=requirements(),
python_requires='>=3.6',
test_suite='uom.tests',
entry_points={
'console_scripts': ['uom_convert_value=uom.cmd_line:cmd_convert',
'uom_base_unit=uom.cmd_line:cmd_base_unit'],
},
include_package_data=True,
zip_safe=False)
setup(
name="uom",
version="0.6.2",
description="Unit of Measure conversion tool",
long_description=readme(),
long_description_content_type="text/markdown",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Customer Service",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Information Analysis",
],
keywords="uom unit measurement measure Energistics oilfield",
url="http://github.com/schlumberger/UOM",
author="Velizar VESSELINOV",
author_email="vvesselinov@slb.com",
license="BSD 2-Clause “Simplified” License",
license_file="LICENSE.md",
packages=["uom"],
install_requires=requirements(),
python_requires=">=3.6",
test_suite="uom.tests",
entry_points={
"console_scripts": [
"uom_convert_value=uom.cmd_line:cmd_convert",
"uom_base_unit=uom.cmd_line:cmd_base_unit",
],
},
include_package_data=True,
zip_safe=False,
)
2 changes: 1 addition & 1 deletion uom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
from .unit_alias import unit_alias
from .uom import base_unit, conversion_factors, convert

__all__ = ['unit_alias', 'base_unit', 'conversion_factors', 'convert']
__all__ = ["unit_alias", "base_unit", "conversion_factors", "convert"]
23 changes: 10 additions & 13 deletions uom/cmd_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@

def cmd_convert(arg=None):
"""Convert value."""
parser = ArgumentParser(prog='uom_convert_value')
parser = ArgumentParser(prog="uom_convert_value")

parser.add_argument('value', type=float, nargs='+',
help='value to be converted')
parser.add_argument("value", type=float, nargs="+", help="value to be converted")

parser.add_argument('-s', dest='source', help='unit source')
parser.add_argument("-s", dest="source", help="unit source")

parser.add_argument('-t', dest='target', help='unit target')
parser.add_argument("-t", dest="target", help="unit target")

parser.add_argument('-v', dest='verbose', action='store_true',
help='verbose')
parser.add_argument("-v", dest="verbose", action="store_true", help="verbose")

if arg is not None:
args = parser.parse_args(arg.split())
Expand All @@ -33,19 +31,18 @@ def cmd_convert(arg=None):
out = convert(args.value, args.source, args.target, args.verbose)

if args.verbose:
print(f'Output: {out}')
print(f"Output: {out}")

return out


def cmd_base_unit(arg=None):
"""Base unit."""
parser = ArgumentParser(prog='uom_base_unit')
parser = ArgumentParser(prog="uom_base_unit")

parser.add_argument('unit', help='input unit')
parser.add_argument("unit", help="input unit")

parser.add_argument('-v', dest='verbose', action='store_true',
help='verbose')
parser.add_argument("-v", dest="verbose", action="store_true", help="verbose")

if arg is not None:
args = parser.parse_args(arg.split())
Expand All @@ -57,6 +54,6 @@ def cmd_base_unit(arg=None):
out = base_unit(args.unit, args.verbose)

if args.verbose:
print(f'Output: {out}')
print(f"Output: {out}")

return out

0 comments on commit d33c5b9

Please sign in to comment.