Skip to content

Commit 8457144

Browse files
committed
Upgrade dependencies
1 parent fb6fc72 commit 8457144

File tree

3 files changed

+38
-24
lines changed

3 files changed

+38
-24
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ If the locale does not exist you will need to create it by using the ``clock`` u
203203

204204
.. code-block:: bash
205205
206-
./clock locale:create <your-locale>
206+
./clock locale create <your-locale>
207207
208208
It will generate a directory in ``pendulum/locales`` named after your locale, with the following
209209
structure:

clock

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ from babel.dates import tokenize_pattern, PATTERN_CHARS
1717
from babel.localedata import load, normalize_locale, LocaleDataDict
1818

1919
from cleo import Application, Command
20+
from cleo import argument
2021
from pendulum import __version__
2122

2223

@@ -43,12 +44,11 @@ class _LambdaCompiler(_GettextCompiler):
4344

4445

4546
class LocaleCreate(Command):
46-
"""
47-
Creates locale translations.
4847

49-
locale:create
50-
{locales?* : Locales to dump}
51-
"""
48+
name = "create"
49+
description = "Creates locale translations."
50+
51+
arguments = [argument("locales", "Locales to dump.", optional=False, multiple=True)]
5252

5353
TEMPLATE = """# -*- coding: utf-8 -*-
5454
from __future__ import unicode_literals
@@ -93,7 +93,7 @@ translations = {{}}
9393

9494
normalized = normalize_locale(locale.replace("-", "_"))
9595
if not normalized:
96-
self.error("Locale [{}] does not exist.".format(locale))
96+
self.line("<error>Locale [{}] does not exist.</error>".format(locale))
9797
continue
9898

9999
self.line("<info>Generating <comment>{}</> locale.</>".format(locale))
@@ -229,11 +229,9 @@ translations = {{}}
229229

230230

231231
class LocaleRecreate(Command):
232-
"""
233-
Recreate existing locales.
234232

235-
locale:recreate
236-
"""
233+
name = "recreate"
234+
description = "Recreate existing locales."
237235

238236
def handle(self):
239237
# Listing locales
@@ -245,12 +243,21 @@ class LocaleRecreate(Command):
245243
self.call("locale:create", [("locales", locales)])
246244

247245

246+
class LocaleCommand(Command):
247+
248+
name = "locale"
249+
description = "Locale related commands."
250+
251+
commands = [LocaleCreate()]
252+
253+
def handle(self):
254+
self.call("help", self._config.name)
255+
256+
248257
class WindowsTzDump(Command):
249-
"""
250-
Dumps the mapping of Windows timezones to IANA timezones.
251258

252-
windows:tz:dump
253-
"""
259+
name = "dump-timezones"
260+
description = "Dumps the mapping of Windows timezones to IANA timezones."
254261

255262
MAPPING_DIR = os.path.join("pendulum", "tz", "data")
256263

@@ -269,10 +276,20 @@ class WindowsTzDump(Command):
269276
f.write(mapping)
270277

271278

272-
app = Application("Clock", __version__)
273-
app.add(LocaleCreate())
274-
app.add(LocaleRecreate())
275-
app.add(WindowsTzDump())
279+
class WindowsCommand(Command):
280+
281+
name = "windows"
282+
description = "Windows related commands."
283+
284+
commands = [WindowsTzDump()]
285+
286+
def handle(self):
287+
self.call("help", self._config.name)
288+
289+
290+
app = Application("clock", __version__)
291+
app.add(LocaleCommand())
292+
app.add(WindowsCommand())
276293

277294

278295
if __name__ == "__main__":

pyproject.toml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ version = "2.0.5"
44
description = "Python datetimes made easy"
55
authors = ["Sébastien Eustace <sebastien@eustace.io>"]
66
license = "MIT"
7-
87
readme = 'README.rst'
9-
108
homepage = "https://pendulum.eustace.io"
119
repository = "https://github.com/sdispater/pendulum"
1210
documentation = "https://pendulum.eustace.io/docs"
13-
1411
keywords = ['datetime', 'date', 'time']
1512

1613
build = "build.py"
@@ -25,11 +22,11 @@ pytzdata = ">=2018.3"
2522
typing = { version = "^3.6", python = "<3.5" }
2623

2724
[tool.poetry.dev-dependencies]
28-
pytest = "^3.4"
25+
pytest = "^4.6"
2926
pytest-cov = "^2.5"
3027
pytz = ">=2018.3"
3128
babel = "^2.5"
32-
cleo = "^0.6.1"
29+
cleo = "^0.7.5"
3330
tox = "^3.0"
3431
black = { version = "^19.3b0", python = "^3.6" }
3532
pre-commit = "^1.10"

0 commit comments

Comments
 (0)