Update pendulum to 2.1.2

This commit is contained in:
Thor77 2023-01-14 19:02:53 +01:00
parent 1a7c1cce9d
commit 4c872930db
No known key found for this signature in database
GPG Key ID: 5051E71B46AA669A
6 changed files with 41 additions and 58 deletions

77
poetry.lock generated
View File

@ -250,28 +250,38 @@ files = [
[[package]] [[package]]
name = "pendulum" name = "pendulum"
version = "1.5.1" version = "2.1.2"
description = "Python datetimes made easy." description = "Python datetimes made easy"
category = "main" category = "main"
optional = false optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
files = [ files = [
{file = "pendulum-1.5.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:ddaf97a061eb5e2ae37857a8cb548e074125017855690d20e443ad8d9f31e164"}, {file = "pendulum-2.1.2-cp27-cp27m-macosx_10_15_x86_64.whl", hash = "sha256:b6c352f4bd32dff1ea7066bd31ad0f71f8d8100b9ff709fb343f3b86cee43efe"},
{file = "pendulum-1.5.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:c04fcf955e622e97e405e5f6d1b1f4a7adc69d79d82f3609643de69283170d6d"}, {file = "pendulum-2.1.2-cp27-cp27m-win_amd64.whl", hash = "sha256:318f72f62e8e23cd6660dbafe1e346950281a9aed144b5c596b2ddabc1d19739"},
{file = "pendulum-1.5.1-cp34-cp34m-manylinux1_i686.whl", hash = "sha256:dd6500d27bb7ccc029d497da4f9bd09549bd3c0ea276dad894ea2fdf309e83f3"}, {file = "pendulum-2.1.2-cp35-cp35m-macosx_10_15_x86_64.whl", hash = "sha256:0731f0c661a3cb779d398803655494893c9f581f6488048b3fb629c2342b5394"},
{file = "pendulum-1.5.1-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:95536b33ae152e3c831eb236c1bf9ac9dcfb3b5b98fdbe8e9e601eab6c373897"}, {file = "pendulum-2.1.2-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:3481fad1dc3f6f6738bd575a951d3c15d4b4ce7c82dce37cf8ac1483fde6e8b0"},
{file = "pendulum-1.5.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:f4eee1e1735487d9d25cc435c519fd4380cb1f82cde3ebad1efbc2fc30deca5b"}, {file = "pendulum-2.1.2-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:9702069c694306297ed362ce7e3c1ef8404ac8ede39f9b28b7c1a7ad8c3959e3"},
{file = "pendulum-1.5.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:4173ce3e81ad0d9d61dbce86f4286c43a26a398270df6a0a89f501f0c28ad27d"}, {file = "pendulum-2.1.2-cp35-cp35m-win_amd64.whl", hash = "sha256:fb53ffa0085002ddd43b6ca61a7b34f2d4d7c3ed66f931fe599e1a531b42af9b"},
{file = "pendulum-1.5.1-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:e9732b8bb214fad2c72ddcbfec07542effa8a8b704e174347ede1ff8dc679cce"}, {file = "pendulum-2.1.2-cp36-cp36m-macosx_10_15_x86_64.whl", hash = "sha256:c501749fdd3d6f9e726086bf0cd4437281ed47e7bca132ddb522f86a1645d360"},
{file = "pendulum-1.5.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:56a347d0457859c84b8cdba161fc37c7df5db9b3becec7881cd770e9d2058b3c"}, {file = "pendulum-2.1.2-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:c807a578a532eeb226150d5006f156632df2cc8c5693d778324b43ff8c515dd0"},
{file = "pendulum-1.5.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:e7df37447824f9af0b58c7915a4caf349926036afd86ad38e7529a6b2f8fc34b"}, {file = "pendulum-2.1.2-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:2d1619a721df661e506eff8db8614016f0720ac171fe80dda1333ee44e684087"},
{file = "pendulum-1.5.1.tar.gz", hash = "sha256:738878168eb26e5446da5d1f7b3312ae993a542061be8882099c00ef4866b1a2"}, {file = "pendulum-2.1.2-cp36-cp36m-win_amd64.whl", hash = "sha256:f888f2d2909a414680a29ae74d0592758f2b9fcdee3549887779cd4055e975db"},
{file = "pendulum-2.1.2-cp37-cp37m-macosx_10_15_x86_64.whl", hash = "sha256:e95d329384717c7bf627bf27e204bc3b15c8238fa8d9d9781d93712776c14002"},
{file = "pendulum-2.1.2-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:4c9c689747f39d0d02a9f94fcee737b34a5773803a64a5fdb046ee9cac7442c5"},
{file = "pendulum-2.1.2-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:1245cd0075a3c6d889f581f6325dd8404aca5884dea7223a5566c38aab94642b"},
{file = "pendulum-2.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:db0a40d8bcd27b4fb46676e8eb3c732c67a5a5e6bfab8927028224fbced0b40b"},
{file = "pendulum-2.1.2-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:f5e236e7730cab1644e1b87aca3d2ff3e375a608542e90fe25685dae46310116"},
{file = "pendulum-2.1.2-cp38-cp38-manylinux1_i686.whl", hash = "sha256:de42ea3e2943171a9e95141f2eecf972480636e8e484ccffaf1e833929e9e052"},
{file = "pendulum-2.1.2-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7c5ec650cb4bec4c63a89a0242cc8c3cebcec92fcfe937c417ba18277d8560be"},
{file = "pendulum-2.1.2-cp38-cp38-win_amd64.whl", hash = "sha256:33fb61601083f3eb1d15edeb45274f73c63b3c44a8524703dc143f4212bf3269"},
{file = "pendulum-2.1.2-cp39-cp39-manylinux1_i686.whl", hash = "sha256:29c40a6f2942376185728c9a0347d7c0f07905638c83007e1d262781f1e6953a"},
{file = "pendulum-2.1.2-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:94b1fc947bfe38579b28e1cccb36f7e28a15e841f30384b5ad6c5e31055c85d7"},
{file = "pendulum-2.1.2.tar.gz", hash = "sha256:b06a0ca1bfe41c990bbf0c029f0b6501a7f2ec4e38bfec730712015e8860f207"},
] ]
[package.dependencies] [package.dependencies]
python-dateutil = ">=2.6.0.0,<3.0.0.0" python-dateutil = ">=2.6,<3.0"
pytzdata = ">=2018.3.0.0" pytzdata = ">=2020.1"
tzlocal = ">=1.5.0.0,<2.0.0.0"
[[package]] [[package]]
name = "pluggy" name = "pluggy"
@ -380,14 +390,14 @@ vulture = ["vulture"]
[[package]] [[package]]
name = "pytest" name = "pytest"
version = "7.2.0" version = "7.2.1"
description = "pytest: simple powerful testing with Python" description = "pytest: simple powerful testing with Python"
category = "dev" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "pytest-7.2.0-py3-none-any.whl", hash = "sha256:892f933d339f068883b6fd5a459f03d85bfcb355e4981e146d2c7616c21fef71"}, {file = "pytest-7.2.1-py3-none-any.whl", hash = "sha256:c7c6ca206e93355074ae32f7403e8ea12163b1163c976fee7d4d84027c162be5"},
{file = "pytest-7.2.0.tar.gz", hash = "sha256:c4014eb40e10f11f355ad4e3c2fb2c6c6d1919c73f3b5a433de4708202cade59"}, {file = "pytest-7.2.1.tar.gz", hash = "sha256:d45e0952f3727241918b8fd0f376f5ff6b301cc0777c6f9a556935c92d8a7d42"},
] ]
[package.dependencies] [package.dependencies]
@ -436,18 +446,6 @@ files = [
[package.dependencies] [package.dependencies]
six = ">=1.5" six = ">=1.5"
[[package]]
name = "pytz"
version = "2022.7"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
files = [
{file = "pytz-2022.7-py2.py3-none-any.whl", hash = "sha256:93007def75ae22f7cd991c84e02d434876818661f8df9ad5df9e950ff4e52cfd"},
{file = "pytz-2022.7.tar.gz", hash = "sha256:7ccfae7b4b2c067464a6733c6261673fdb8fd1be905460396b97a073e9fa683a"},
]
[[package]] [[package]]
name = "pytzdata" name = "pytzdata"
version = "2020.1" version = "2020.1"
@ -508,22 +506,7 @@ files = [
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
] ]
[[package]]
name = "tzlocal"
version = "2.0.0"
description = "tzinfo object for the local timezone"
category = "main"
optional = false
python-versions = "*"
files = [
{file = "tzlocal-2.0.0-py2.py3-none-any.whl", hash = "sha256:11c9f16e0a633b4b60e1eede97d8a46340d042e67b670b290ca526576e039048"},
{file = "tzlocal-2.0.0.tar.gz", hash = "sha256:949b9dd5ba4be17190a80c0268167d7e6c92c62b30026cf9764caf3e308e5590"},
]
[package.dependencies]
pytz = "*"
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.10" python-versions = "^3.10"
content-hash = "d15547283752f947e56221de5e8042a0418c9e1b349005dff8de2ff96ecc1066" content-hash = "f60d42d4c06c5c2d3a0bcc61f921cb5ee329f4b033d36a95748725268243b01d"

View File

@ -10,7 +10,7 @@ include = ["tsstats/templates/*.jinja2"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.10" python = "^3.10"
jinja2 = "^3.1.2" jinja2 = "^3.1.2"
pendulum = "1.5.1" pendulum = "^2.1.2"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
pytest = "^7.2.0" pytest = "^7.2.0"

View File

@ -161,7 +161,7 @@ def parse_logs(log_glob, ident_map=None, online_dc=True):
# last iteration # last iteration
# => disconnect online clients if desired # => disconnect online clients if desired
for online_client in online_clients: for online_client in online_clients:
online_client.disconnect(pendulum.utcnow()) online_client.disconnect(pendulum.now('UTC'))
online_client.connected += 1 online_client.connected += 1
else: else:
logger.warn( logger.warn(

View File

@ -105,6 +105,6 @@ def render_servers(servers, output, title='TeamspeakStats',
logger.debug('Rendering template %s', template) logger.debug('Rendering template %s', template)
template.stream(title=title, servers=prepared_servers, template.stream(title=title, servers=prepared_servers,
debug=logger.level <= logging.DEBUG, debug=logger.level <= logging.DEBUG,
creation_time=pendulum.utcnow())\ creation_time=pendulum.now('UTC'))\
.dump(output, encoding='utf-8') .dump(output, encoding='utf-8')
logger.debug('Wrote rendered template to %s', output) logger.debug('Wrote rendered template to %s', output)

View File

@ -8,7 +8,7 @@ from tsstats.template import render_servers
testlog_path = 'tsstats/tests/res/test.log' testlog_path = 'tsstats/tests/res/test.log'
static_timestamp = pendulum.Pendulum(2015, 5, 18, 15, 52, 52, 685612) static_timestamp = pendulum.datetime(2015, 5, 18, 15, 52, 52, 685612)
@pytest.fixture @pytest.fixture
@ -21,9 +21,9 @@ def test_log_client_count(clients):
def test_log_onlinetime(clients): def test_log_onlinetime(clients):
assert clients['1'].onlinetime == pendulum.Interval( assert clients['1'].onlinetime == pendulum.duration(
seconds=402, microseconds=149208) seconds=402, microseconds=149208)
assert clients['2'].onlinetime == pendulum.Interval( assert clients['2'].onlinetime == pendulum.duration(
seconds=19, microseconds=759644) seconds=19, microseconds=759644)
@ -57,14 +57,14 @@ def test_log_pbans(clients):
'1': [ '1': [
TimedLog( TimedLog(
'ts3server_2016-06-06__14_22_09.527229_1.log', 'ts3server_2016-06-06__14_22_09.527229_1.log',
pendulum.create( pendulum.datetime(
year=2016, month=6, day=6, hour=14, minute=22, year=2016, month=6, day=6, hour=14, minute=22,
second=9, microsecond=527229 second=9, microsecond=527229
) )
), ),
TimedLog( TimedLog(
'ts3server_2017-07-07__15_23_10.638340_1.log', 'ts3server_2017-07-07__15_23_10.638340_1.log',
pendulum.create( pendulum.datetime(
year=2017, month=7, day=7, hour=15, minute=23, year=2017, month=7, day=7, hour=15, minute=23,
second=10, microsecond=638340 second=10, microsecond=638340
) )

View File

@ -47,7 +47,7 @@ def test_onlinetime(soup):
onlinetime = onlinetime.text onlinetime = onlinetime.text
# find corresponding client-object # find corresponding client-object
client = list(filter( client = list(filter(
lambda c: c.nick == nick and c.onlinetime > pendulum.Interval(), lambda c: c.nick == nick and c.onlinetime > pendulum.duration(),
clients.values() clients.values()
)) ))
# assert existence # assert existence
@ -73,9 +73,9 @@ def test_lastseen_relative(output):
soup = BeautifulSoup(open(output), 'html.parser') soup = BeautifulSoup(open(output), 'html.parser')
assert soup.find('ul', id='1.onlinetime')\ assert soup.find('ul', id='1.onlinetime')\
.select('div.hint--left')[0]['data-hint'] == \ .select('div.hint--left')[0]['data-hint'] == \
pendulum.create(2015, 5, 18).diff_for_humans() pendulum.datetime(2015, 5, 18).diff_for_humans()
render_servers(servers, output, lastseen_relative=False) render_servers(servers, output, lastseen_relative=False)
soup = BeautifulSoup(open(output), 'html.parser') soup = BeautifulSoup(open(output), 'html.parser')
assert soup.find('ul', id='1.onlinetime')\ assert soup.find('ul', id='1.onlinetime')\
.select('div.hint--left')[0]['data-hint'] == \ .select('div.hint--left')[0]['data-hint'] == \
'05/18/15 15:54:38 GMT' '05/18/15 15:54:38 UTC'