Skip to content

Commit dba1522

Browse files
authored
Enforce use of single-quotes via lint plugin (#46)
1 parent ebbe4aa commit dba1522

File tree

8 files changed

+30
-28
lines changed

8 files changed

+30
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Changelog
77
### Internal changes
88

99
- updated development dependencies
10+
- enforced unified use of single quotes and double quotes
1011

1112
[0.0.1](../../releases/tag/v0.0.1) - 2021-05-13
1213
-----------------------------------------------

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
'flake8-commas ~= 2.0.0',
5757
'flake8-docstrings ~= 1.6.0',
5858
'flake8-isort ~= 4.0.0',
59+
'flake8-quotes ~= 3.2.0',
5960
'isort ~= 5.8.0',
6061
'mypy ~= 0.901',
6162
'pep8-naming ~= 0.11.1',

src/apify_client/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def _encode_webhook_list_to_base64(webhooks: List[Dict]) -> bytes:
145145
webhook_representation['payloadTemplate'] = webhook['payload_template']
146146
data.append(webhook_representation)
147147

148-
return base64.b64encode(json.dumps(data).encode("utf-8"))
148+
return base64.b64encode(json.dumps(data).encode('utf-8'))
149149

150150

151151
def _filter_out_none_values(dictionary: Dict) -> Dict:
@@ -182,9 +182,9 @@ def _snake_case_to_camel_case(str_snake_case: str) -> str:
182182
>>> _snake_case_to_camel_case("making_the_WEB_programmable")
183183
'makingTheWebProgrammable'
184184
"""
185-
return "".join([
185+
return ''.join([
186186
part.capitalize() if i > 0 else part
187-
for i, part in enumerate(str_snake_case.split("_"))
187+
for i, part in enumerate(str_snake_case.split('_'))
188188
])
189189

190190

@@ -198,7 +198,7 @@ def _encode_key_value_store_record_value(value: Any, content_type: Optional[str]
198198
content_type = 'application/json; charset=utf-8'
199199

200200
if 'application/json' in content_type and not _is_file_or_bytes(value) and not isinstance(value, str):
201-
value = json.dumps(value, ensure_ascii=False, indent=2).encode("utf-8")
201+
value = json.dumps(value, ensure_ascii=False, indent=2).encode('utf-8')
202202

203203
return (value, content_type)
204204

src/apify_client/clients/base/base_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ def _params(self, **kwargs: Any) -> Dict:
6060

6161
def _sub_resource_init_options(self, **kwargs: Any) -> Dict:
6262
options = {
63-
"base_url": self.url,
64-
"http_client": self.http_client,
65-
"params": self.params,
66-
"root_client": self.root_client,
63+
'base_url': self.url,
64+
'http_client': self.http_client,
65+
'params': self.params,
66+
'root_client': self.root_client,
6767
}
6868

6969
return {

src/apify_client/clients/resource_clients/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def dataset(self) -> DatasetClient:
117117
DatasetClient: A client allowing access to the default dataset of this actor run.
118118
"""
119119
return DatasetClient(
120-
**self._sub_resource_init_options(resource_path="dataset"),
120+
**self._sub_resource_init_options(resource_path='dataset'),
121121
)
122122

123123
def key_value_store(self) -> KeyValueStoreClient:
@@ -129,7 +129,7 @@ def key_value_store(self) -> KeyValueStoreClient:
129129
KeyValueStoreClient: A client allowing access to the default key-value store of this actor run.
130130
"""
131131
return KeyValueStoreClient(
132-
**self._sub_resource_init_options(resource_path="key-value-store"),
132+
**self._sub_resource_init_options(resource_path='key-value-store'),
133133
)
134134

135135
def request_queue(self) -> RequestQueueClient:
@@ -141,7 +141,7 @@ def request_queue(self) -> RequestQueueClient:
141141
RequestQueueClient: A client allowing access to the default request_queue of this actor run.
142142
"""
143143
return RequestQueueClient(
144-
**self._sub_resource_init_options(resource_path="request-queue"),
144+
**self._sub_resource_init_options(resource_path='request-queue'),
145145
)
146146

147147
def log(self) -> LogClient:
@@ -153,5 +153,5 @@ def log(self) -> LogClient:
153153
LogClient: A client allowing access to the log of this actor run.
154154
"""
155155
return LogClient(
156-
**self._sub_resource_init_options(resource_path="log"),
156+
**self._sub_resource_init_options(resource_path='log'),
157157
)

src/apify_client/clients/resource_clients/task.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ def update(
5353
dict: The updated task
5454
"""
5555
updated_fields = {
56-
"name": name,
57-
"options": {
58-
"build": build,
59-
"memoryMbytes": memory_mbytes,
60-
"timeoutSecs": timeout_secs,
56+
'name': name,
57+
'options': {
58+
'build': build,
59+
'memoryMbytes': memory_mbytes,
60+
'timeoutSecs': timeout_secs,
6161
},
62-
"input": task_input,
62+
'input': task_input,
6363
}
6464

6565
return self._update(_filter_out_none_values_recursively(updated_fields))

src/apify_client/clients/resource_clients/task_collection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,14 @@ def create(
6161
dict: The created task.
6262
"""
6363
new_fields = {
64-
"actId": actor_id,
65-
"name": name,
66-
"options": {
67-
"build": build,
68-
"memoryMbytes": memory_mbytes,
69-
"timeoutSecs": timeout_secs,
64+
'actId': actor_id,
65+
'name': name,
66+
'options': {
67+
'build': build,
68+
'memoryMbytes': memory_mbytes,
69+
'timeoutSecs': timeout_secs,
7070
},
71-
"input": task_input,
71+
'input': task_input,
7272
}
7373

7474
return self._create(_filter_out_none_values_recursively(new_fields))

src/apify_client/clients/resource_clients/webhook.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _prepare_webhook_representation(
2121
"""Prepare webhook dictionary representation for clients."""
2222
webhook: Dict[str, Any] = {
2323
_snake_case_to_camel_case(key): value
24-
for key, value in locals().items() if value is not None and key not in ["actor_run_id", "actor_task_id", "actor_id"]
24+
for key, value in locals().items() if value is not None and key not in ['actor_run_id', 'actor_task_id', 'actor_id']
2525
}
2626

2727
condition = {}
@@ -35,7 +35,7 @@ def _prepare_webhook_representation(
3535
condition['actorId'] = actor_id
3636

3737
if condition != {}:
38-
webhook["condition"] = condition
38+
webhook['condition'] = condition
3939

4040
return webhook
4141

@@ -113,5 +113,5 @@ def dispatches(self) -> WebhookDispatchCollectionClient:
113113
WebhookDispatchCollectionClient: A client allowing access to dispatches of this webhook using its list method
114114
"""
115115
return WebhookDispatchCollectionClient(
116-
**self._sub_resource_init_options(resource_path="dispatches"),
116+
**self._sub_resource_init_options(resource_path='dispatches'),
117117
)

0 commit comments

Comments
 (0)