Skip to content

Commit e8ca2ea

Browse files
committed
[DevOps]: removing the other python version so builds succeed, and cleaning up the use of locals
1 parent 0ad09dd commit e8ca2ea

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
language: python
22
dist: xenial
33
python:
4-
- '3.5'
54
- '3.6'
65
install:
76
- pip install -r requirements.txt

pyclickup/globals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55

6-
__version__ = "0.0.6"
6+
__version__ = "0.0.7"
77

88

99
LIBRARY = "pyclickup"

pyclickup/models/client.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from pyclickup.globals import __version__, API_URL, LIBRARY, TEST_TOKEN, TEST_API_URL
77
from pyclickup.models import User, Task, Team
88
from pyclickup.models.error import RateLimited
9-
from pyclickup.utils.text import datetime_to_ts
9+
from pyclickup.utils.text import datetime_to_ts, filter_locals
1010

1111

1212
def test_client():
@@ -117,10 +117,10 @@ def _get_tasks(
117117
**kwargs
118118
):
119119
"""fetches the tasks according to the given options"""
120-
params = locals()
120+
params = filter_locals(locals(), extras=["team_id"])
121121

122122
for option in self.task_boolean_options:
123-
if params[option] is not None:
123+
if option in params:
124124
params[option] = str(params[option]).lower()
125125

126126
options = [
@@ -130,7 +130,6 @@ def _get_tasks(
130130
",".join(params[x]) if x in self.task_list_options else params[x],
131131
)
132132
for x in params
133-
if params[x] is not None and x not in ["team_id", "self", "kwargs"]
134133
]
135134
path = "team/{}/task?{}".format(team_id, "&".join(options))
136135
return [Task(x, client=self) for x in self.get(path)["tasks"]]

pyclickup/utils/text.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
FIRST_CAP = re.compile("(.)([A-Z][a-z]+)")
99
ALL_CAP = re.compile("([a-z0-9])([A-Z])")
10+
LOCALS_FILTER = ["self", "kwargs"]
1011

1112

1213
def snakeify(text):
@@ -23,3 +24,15 @@ def ts_to_datetime(timestamp):
2324
def datetime_to_ts(date_object):
2425
"""converts a datetime to a posix x1000 timestamp"""
2526
return int(date_object.timestamp() * 1000)
27+
28+
29+
def filter_locals(local_variables, extras=None):
30+
"""filters out builtin variables in the local scope and returns locals as a dict"""
31+
var_filter = LOCALS_FILTER.copy()
32+
if extras and isinstance(extras, list):
33+
var_filter += extras
34+
return {
35+
x: local_variables[x]
36+
for x in local_variables
37+
if local_variables[x] is not None and x not in var_filter
38+
}

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
packages=find_packages(),
2525
classifiers=[
2626
"Programming Language :: Python :: 3",
27-
"Programming Language :: Python :: 3.4",
2827
"Programming Language :: Python :: 3.5",
2928
"Programming Language :: Python :: 3.6",
3029
"Programming Language :: Python :: 3.7",

0 commit comments

Comments
 (0)