Fixing flake8 errors.

This commit is contained in:
Cassowary Rusnov 2021-11-22 10:35:44 -08:00
parent d35a35f6ad
commit b0e8bb1307
3 changed files with 22 additions and 7 deletions

View File

@ -6,12 +6,11 @@ import logging
from typing import List, Optional, Dict, Union
from bs4 import BeautifulSoup
log = logging.getLogger(__name__)
#
# TODOs and FIXMEs
#
# * come up with a better way to specify `where` clauses.
@ -75,7 +74,7 @@ class APIv4:
"""
self.session = requests.Session()
### Perform login post
# Perform login post
self.session.cookies.update({"has_js": "1"})
postdata = {
"name": user,
@ -118,7 +117,7 @@ class APIv4:
url = self.api_url+'/'+objName+'/'+action
if params:
result = self.session.post(url, params={'params':json.dumps(params)}, data="")
result = self.session.post(url, params={'params': json.dumps(params)}, data="")
else:
result = self.session.post(url, data="")
if (not result.ok):
@ -188,7 +187,11 @@ class APIv4:
return [x["name"] for x in ent]
def get(self, objName: str, where: Optional[List]=None, limit: Optional[int]=None, select=Optional[List[str]]) -> List:
def get(self,
objName: str,
where: Optional[List] = None,
limit: Optional[int] = None,
select=Optional[List[str]]) -> List:
"""
Get objects based on a where clause, optional limit and optional field list.
@ -207,7 +210,7 @@ class APIv4:
params["limit"] = limit
if where is not None:
params["where"] = where
if columns is not None and columns:
if select is not None and select:
params["select"] = select
return self.call_values(objName, "get", params=params)

View File

@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools-build_meta"

12
tox.ini
View File

@ -1,3 +1,15 @@
[tox]
envlist = py36, py37, py38, py39
[testenv]
deps =
flake8
mypy
commands =
flake8
mypy civicrmapi4
[flake8]
max-line-length = 120
max-complexity = 20