Skip to content

Commit 2286aa1

Browse files
committed
🚀 Added pre-commit config for gh workflow
1 parent efac5d0 commit 2286aa1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/bqapi/RequestsMonkeyPatch/requests_patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def format_header_param(name, value):
4747
The value of the parameter, provided as a unicode string.
4848
"""
4949
if not any(ch in value for ch in '"\\\r\n'):
50-
result = '%s="%s"' % (name, value)
50+
result = '{}="{}"'.format(name, value)
5151
try:
5252
result.encode("ascii")
5353
except UnicodeEncodeError:
@@ -59,7 +59,7 @@ def format_header_param(name, value):
5959
if not six.PY3: # Python 2:
6060
value_encode = value.encode("utf-8")
6161

62-
value = '%s="%s"; %s*=%s' % (
62+
value = '{}="{}"; {}*={}'.format(
6363
name,
6464
value,
6565
name,

src/bqapi/comm.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def __init__(self, token, user=None):
113113
elif user in token.split(":")[0]: # check if token contains user
114114
self.username = "Mex %s" % (token)
115115
else:
116-
self.username = "Mex %s:%s" % (user, token)
116+
self.username = "Mex {}:{}".format(user, token)
117117

118118
def __call__(self, r):
119119
"""
@@ -132,7 +132,7 @@ class BQServer(Session):
132132
"""
133133

134134
def __init__(self):
135-
super(BQServer, self).__init__()
135+
super().__init__()
136136
# Disable https session authentication..
137137
# self.verify = False
138138
self.root = None
@@ -193,7 +193,7 @@ def prepare_url(self, url, **params):
193193
raise BQApiError("No root provided")
194194

195195
# query
196-
query = ["%s=%s" % (k, v) for k, v in urllib.parse.parse_qsl(u.query, True)]
196+
query = ["{}={}".format(k, v) for k, v in urllib.parse.parse_qsl(u.query, True)]
197197
unordered_query = []
198198
ordered_query = []
199199

@@ -205,7 +205,7 @@ def prepare_url(self, url, **params):
205205
ordered_query.append("%s=%s" % odict.popitem(False))
206206

207207
if params:
208-
unordered_query = ["%s=%s" % (k, v) for k, v in list(params.items())]
208+
unordered_query = ["{}={}".format(k, v) for k, v in list(params.items())]
209209

210210
query = query + unordered_query + ordered_query
211211
query = "&".join(query)
@@ -290,7 +290,7 @@ def push(
290290
@exception: BQCommError if the requests returns an error code and
291291
message
292292
"""
293-
log.debug("POST %s req %s" % (url, headers))
293+
log.debug("POST {} req {}".format(url, headers))
294294

295295
try: # error checking
296296
r = self.request(
@@ -303,7 +303,7 @@ def push(
303303
)
304304
r.raise_for_status()
305305
except requests.exceptions.HTTPError:
306-
log.exception("In push request: %s %s %s" % (method, url, r.content))
306+
log.exception("In push request: {} {} {}".format(method, url, r.content))
307307
raise BQCommError(r)
308308

309309
if path:
@@ -314,7 +314,7 @@ def push(
314314
return r.content
315315

316316

317-
class BQSession(object):
317+
class BQSession:
318318
"""
319319
Top level Bisque communication object
320320
"""
@@ -664,7 +664,7 @@ def postxml(self, url, xml, path=None, method="POST", **params):
664664
if not isinstance(xml, str):
665665
xml = self.factory.to_string(xml)
666666

667-
log.debug("postxml %s content %s " % (url, xml))
667+
log.debug("postxml {} content {} ".format(url, xml))
668668

669669
url = self.c.prepare_url(url, **params)
670670

@@ -761,7 +761,7 @@ def service_url(self, service_type, path="", query=None):
761761
if root is None:
762762
raise BQApiError("Not a service type")
763763
if query:
764-
path = "%s?%s" % (path, urllib.parse.urlencode(query))
764+
path = "{}?{}".format(path, urllib.parse.urlencode(query))
765765
return urllib.parse.urljoin(root, path)
766766

767767
def _load_services(self):

0 commit comments

Comments
 (0)