times
Advanced tools
+1
-1
| Metadata-Version: 1.0 | ||
| Name: times | ||
| Version: 0.3 | ||
| Version: 0.4 | ||
| Summary: Times is a small, minimalistic, Python library for dealing with time conversions between universal time and arbitrary timezones. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/nvie/times/ |
+10
-1
@@ -0,1 +1,2 @@ | ||
| import sys | ||
| import os | ||
@@ -12,2 +13,10 @@ from setuptools import setup | ||
| def get_dependencies(): | ||
| deps = ['pytz'] | ||
| if sys.version_info[0] == 3: # Python >= 3 | ||
| deps.append('python-dateutil >= 2') | ||
| else: | ||
| deps.append('python-dateutil < 2') | ||
| return deps | ||
| setup( | ||
@@ -28,3 +37,3 @@ name='times', | ||
| platforms='any', | ||
| install_requires=['pytz'], | ||
| install_requires=get_dependencies(), | ||
| classifiers=[ | ||
@@ -31,0 +40,0 @@ # As from http://pypi.python.org/pypi?%3Aaction=list_classifiers |
| Metadata-Version: 1.0 | ||
| Name: times | ||
| Version: 0.3 | ||
| Version: 0.4 | ||
| Summary: Times is a small, minimalistic, Python library for dealing with time conversions between universal time and arbitrary timezones. | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/nvie/times/ |
@@ -1,1 +0,2 @@ | ||
| pytz | ||
| pytz | ||
| python-dateutil < 2 |
| import datetime | ||
| import calendar | ||
| import pytz | ||
| from dateutil.parser import parse | ||
| from .version import VERSION | ||
@@ -9,2 +10,3 @@ | ||
| _default_fmt = '%Y-%m-%d %H:%M:%S%z' | ||
@@ -21,6 +23,8 @@ def to_universal(local_dt, timezone=None): | ||
| return from_unix(local_dt) | ||
| else: | ||
| return from_local(local_dt, timezone) | ||
| elif isinstance(local_dt, basestring): | ||
| local_dt = parse(local_dt) | ||
| return from_local(local_dt, timezone) | ||
| def from_local(local_dt, timezone=None): | ||
@@ -89,3 +93,3 @@ """Converts the given local datetime to a universal datetime.""" | ||
| if fmt is None: | ||
| fmt = '%Y-%m-%d %H:%M:%S%z' | ||
| fmt = _default_fmt | ||
| if timezone is None: | ||
@@ -92,0 +96,0 @@ raise ValueError('Please give an explicit timezone.') |
+1
-1
@@ -1,1 +0,1 @@ | ||
| VERSION = '0.3' | ||
| VERSION = '0.4' |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
9499
4.1%153
7.75%