Skip to content

Commit

Permalink
fix(asana): use a modern iso8601 parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Moreno authored and photonbit committed Oct 21, 2021
1 parent 8578050 commit ef966d8
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 49 deletions.
66 changes: 36 additions & 30 deletions dev_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,46 @@ attrs==21.2.0
# semgrep
backports.entry-points-selectable==1.1.0
# via virtualenv
black==21.8b0
black==21.9b0
# via -r dev_requirements.in
boto3==1.18.32
boto3==1.18.62
# via -r dev_requirements.in
botocore==1.21.32
botocore==1.21.62
# via
# boto3
# s3transfer
bracex==2.1.1
# via wcmatch
certifi==2021.5.30
certifi==2021.10.8
# via requests
cfgv==3.3.1
# via pre-commit
charset-normalizer==2.0.4
charset-normalizer==2.0.7
# via requests
click==8.0.1
# via black
click==8.0.3
# via
# black
# click-option-group
# semgrep
click-option-group==0.5.3
# via semgrep
colorama==0.4.4
# via semgrep
coverage==5.5
coverage[toml]==6.0.2
# via pytest-cov
distlib==0.3.2
distlib==0.3.3
# via virtualenv
factory-boy==3.2.0
# via pytest-factoryboy
faker==8.12.1
faker==9.3.1
# via factory-boy
filelock==3.0.12
filelock==3.3.1
# via virtualenv
flake8==3.9.2
flake8==4.0.1
# via -r dev_requirements.in
identify==2.2.13
identify==2.3.0
# via pre-commit
idna==3.2
idna==3.3
# via
# requests
# yarl
Expand All @@ -64,7 +69,7 @@ lxml==4.6.3
# via -r dev_requirements.in
mccabe==0.6.1
# via flake8
multidict==5.1.0
multidict==5.2.0
# via yarl
mypy==0.910
# via -r dev_requirements.in
Expand All @@ -82,19 +87,19 @@ pathspec==0.9.0
# via black
peewee==3.14.4
# via semgrep
platformdirs==2.3.0
platformdirs==2.4.0
# via
# black
# virtualenv
pluggy==1.0.0
# via pytest
pre-commit==2.14.1
pre-commit==2.15.0
# via -r dev_requirements.in
py==1.10.0
# via pytest
pycodestyle==2.7.0
pycodestyle==2.8.0
# via flake8
pyflakes==2.3.1
pyflakes==2.4.0
# via flake8
pyparsing==2.4.7
# via packaging
Expand All @@ -106,7 +111,7 @@ pytest==6.2.5
# pytest-cov
# pytest-factoryboy
# pytest-recording
pytest-cov==2.12.1
pytest-cov==3.0.0
# via -r dev_requirements.in
pytest-factoryboy==2.1.0
# via -r dev_requirements.in
Expand All @@ -116,11 +121,11 @@ python-dateutil==2.8.2
# via
# botocore
# faker
pyyaml==5.4.1
pyyaml==6.0
# via
# pre-commit
# vcrpy
regex==2021.8.28
regex==2021.10.8
# via black
requests==2.26.0
# via semgrep
Expand All @@ -130,7 +135,7 @@ ruamel.yaml.clib==0.2.6
# via ruamel.yaml
s3transfer==0.5.0
# via boto3
semgrep==0.63.0
semgrep==0.69.1
# via -r dev_requirements.in
six==1.16.0
# via
Expand All @@ -145,28 +150,29 @@ toml==0.10.2
# mypy
# pre-commit
# pytest
# pytest-cov
tomli==1.2.1
# via black
tqdm==4.62.2
# via
# black
# coverage
tqdm==4.62.3
# via semgrep
typing-extensions==3.10.0.2
# via
# black
# mypy
urllib3==1.26.6
urllib3==1.26.7
# via
# botocore
# requests
vcrpy==4.1.1
# via pytest-recording
virtualenv==20.7.2
virtualenv==20.8.1
# via pre-commit
wcmatch==8.2
# via semgrep
wrapt==1.12.1
wrapt==1.13.2
# via vcrpy
yarl==1.6.3
yarl==1.7.0
# via vcrpy

# The following packages are considered to be unsafe in a requirements file:
Expand Down
6 changes: 3 additions & 3 deletions giges/cli/asana.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import asana
import click
import dateutil
import iso8601
from flask import current_app
from flask.cli import with_appcontext

Expand Down Expand Up @@ -175,8 +175,8 @@ def add_projects(add_all: bool = False) -> None:
p = Project(
external_id=project["gid"],
name=project["name"],
created_at=dateutil.parser.parse(project["created_at"]),
updated_at=dateutil.parser.parse(project["modified_at"]),
created_at=iso8601.parse_date(project["created_at"]),
updated_at=iso8601.parse_date(project["modified_at"]),
)
db.session.add(p)
added += 1
Expand Down
6 changes: 2 additions & 4 deletions giges/handlers/asana.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any, Dict, List, Tuple, Union

import asana
import dateutil
import iso8601
import structlog
from connexion import request
from flask import current_app
Expand Down Expand Up @@ -35,9 +35,7 @@ def update_task(task: Task, asana_task: Dict[str, Any]) -> TaskChange:
"""
task.completed = asana_task.get("completed")
if asana_task.get("completed_at"):
task.completed_at = dateutil.parser.parse(
asana_task.get("completed_at")
)
task.completed_at = iso8601.parse_date(asana_task.get("completed_at"))
task.name = asana_task.get("name")
task.description = asana_task.get("description")
if len(asana_task["memberships"]):
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
asana
dictalchemy
iso8601
flask-migrate
flask-sqlalchemy
psycopg2-binary
Expand All @@ -9,6 +10,5 @@ slack-sdk
structlog

# All the package restrictions are due to zappa :(
troposphere<3
flask==1.1.4
connexion[swagger-ui]==2.7.0
22 changes: 11 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ attrs==21.2.0
# via jsonschema
blinker==1.4
# via sentry-sdk
boto3==1.18.59
boto3==1.18.62
# via
# kappa
# zappa
botocore==1.21.59
botocore==1.21.62
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -64,14 +64,16 @@ greenlet==1.1.2
# via sqlalchemy
hjson==3.0.2
# via zappa
idna==3.2
idna==3.3
# via requests
importlib-metadata==4.8.1
# via alembic
importlib-resources==5.2.2
# via alembic
inflection==0.5.1
# via connexion
iso8601==0.1.16
# via -r requirements.in
isodate==0.6.0
# via openapi-schema-validator
itsdangerous==1.1.0
Expand Down Expand Up @@ -106,7 +108,7 @@ openapi-spec-validator==0.3.1
# via connexion
pep517==0.11.0
# via pip-tools
pip-tools==6.3.1
pip-tools==6.4.0
# via zappa
placebo==0.10.0
# via kappa
Expand All @@ -120,7 +122,7 @@ python-dateutil==2.8.2
# zappa
python-slugify==5.0.2
# via zappa
pyyaml==5.4.1
pyyaml==6.0
# via
# cfn-flip
# clickclick
Expand Down Expand Up @@ -155,7 +157,7 @@ sqlalchemy==1.4.25
# alembic
# dictalchemy
# flask-sqlalchemy
structlog==21.1.0
structlog==21.2.0
# via -r requirements.in
swagger-ui-bundle==0.0.9
# via connexion
Expand All @@ -167,10 +169,8 @@ tomli==1.2.1
# via pep517
tqdm==4.62.3
# via zappa
troposphere==2.7.1
# via
# -r requirements.in
# zappa
troposphere==3.0.3
# via zappa
urllib3==1.26.7
# via
# botocore
Expand All @@ -186,7 +186,7 @@ wheel==0.37.0
# zappa
wsgi-request-logger==0.4.6
# via zappa
zappa==0.53.0
zappa==0.54.0
# via -r requirements.in
zipp==3.6.0
# via
Expand Down

0 comments on commit ef966d8

Please sign in to comment.