Skip to content

Commit 01b8b7a

Browse files
committed
RF: Enum name
1 parent 7b48abe commit 01b8b7a

File tree

1 file changed

+51
-51
lines changed

1 file changed

+51
-51
lines changed

migas/operations.py

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
from migas.config import Config, logger, telemetry_enabled
1313
from migas.request import request
1414

15-
class TextType(enum.Enum):
16-
LITERAL = 1
17-
FREE = 2
15+
class QueryParamType(enum.Enum):
16+
LITERAL = enum.auto()
17+
TEXT = enum.auto()
1818

1919
ERROR = '[migas-py] An error occurred.'
2020

@@ -52,23 +52,23 @@ class AddBreadcrumb(Operation):
5252
operation_type = "mutation"
5353
operation_name = "add_breadcrumb"
5454
query_args = {
55-
"project": TextType.FREE,
56-
"project_version": TextType.FREE,
57-
"language": TextType.FREE,
58-
"language_version": TextType.FREE,
55+
"project": QueryParamType.TEXT,
56+
"project_version": QueryParamType.TEXT,
57+
"language": QueryParamType.TEXT,
58+
"language_version": QueryParamType.TEXT,
5959
"ctx": {
60-
"session_id": TextType.FREE,
61-
"user_id": TextType.FREE,
62-
"user_type": TextType.LITERAL,
63-
"platform": TextType.FREE,
64-
"container": TextType.LITERAL,
65-
"is_ci": TextType.LITERAL,
60+
"session_id": QueryParamType.TEXT,
61+
"user_id": QueryParamType.TEXT,
62+
"user_type": QueryParamType.LITERAL,
63+
"platform": QueryParamType.TEXT,
64+
"container": QueryParamType.LITERAL,
65+
"is_ci": QueryParamType.LITERAL,
6666
},
6767
"proc": {
68-
"status": TextType.LITERAL,
69-
"status_desc": TextType.FREE,
70-
"error_type": TextType.FREE,
71-
"error_desc": TextType.FREE,
68+
"status": QueryParamType.LITERAL,
69+
"status_desc": QueryParamType.TEXT,
70+
"error_type": QueryParamType.TEXT,
71+
"error_desc": QueryParamType.TEXT,
7272
},
7373
}
7474
fingerprint = True
@@ -118,21 +118,21 @@ class AddProject(Operation):
118118
operation_name = "add_project"
119119
query_args = {
120120
"p": {
121-
"project": TextType.FREE,
122-
"project_version": TextType.FREE,
123-
"language": TextType.FREE,
124-
"language_version": TextType.FREE,
125-
"is_ci": TextType.LITERAL,
126-
"status": TextType.LITERAL,
127-
"status_desc": TextType.FREE,
128-
"error_type": TextType.FREE,
129-
"error_desc": TextType.FREE,
130-
"user_id": TextType.FREE,
131-
"session_id": TextType.FREE,
132-
"container": TextType.LITERAL,
133-
"user_type": TextType.LITERAL,
134-
"platform": TextType.FREE,
135-
"arguments": TextType.FREE,
121+
"project": QueryParamType.TEXT,
122+
"project_version": QueryParamType.TEXT,
123+
"language": QueryParamType.TEXT,
124+
"language_version": QueryParamType.TEXT,
125+
"is_ci": QueryParamType.LITERAL,
126+
"status": QueryParamType.LITERAL,
127+
"status_desc": QueryParamType.TEXT,
128+
"error_type": QueryParamType.TEXT,
129+
"error_desc": QueryParamType.TEXT,
130+
"user_id": QueryParamType.TEXT,
131+
"session_id": QueryParamType.TEXT,
132+
"container": QueryParamType.LITERAL,
133+
"user_type": QueryParamType.LITERAL,
134+
"platform": QueryParamType.TEXT,
135+
"arguments": QueryParamType.TEXT,
136136
},
137137
}
138138
fingerprint = True
@@ -178,20 +178,20 @@ class CheckProject(Operation):
178178
operation_type = "query"
179179
operation_name = "check_project"
180180
query_args = {
181-
"project": TextType.FREE,
182-
"project_version": TextType.FREE,
183-
"language": TextType.FREE,
184-
"language_version": TextType.FREE,
185-
"is_ci": TextType.LITERAL,
186-
"status": TextType.LITERAL,
187-
"status_desc": TextType.FREE,
188-
"error_type": TextType.FREE,
189-
"error_desc": TextType.FREE,
190-
"user_id": TextType.FREE,
191-
"session_id": TextType.FREE,
192-
"container": TextType.LITERAL,
193-
"platform": TextType.FREE,
194-
"arguments": TextType.FREE,
181+
"project": QueryParamType.TEXT,
182+
"project_version": QueryParamType.TEXT,
183+
"language": QueryParamType.TEXT,
184+
"language_version": QueryParamType.TEXT,
185+
"is_ci": QueryParamType.LITERAL,
186+
"status": QueryParamType.LITERAL,
187+
"status_desc": QueryParamType.TEXT,
188+
"error_type": QueryParamType.TEXT,
189+
"error_desc": QueryParamType.TEXT,
190+
"user_id": QueryParamType.TEXT,
191+
"session_id": QueryParamType.TEXT,
192+
"container": QueryParamType.LITERAL,
193+
"platform": QueryParamType.TEXT,
194+
"arguments": QueryParamType.TEXT,
195195
}
196196
selections = ('success', 'flagged', 'latest', 'message')
197197

@@ -220,10 +220,10 @@ class GetUsage(Operation):
220220
operation_type = 'query'
221221
operation_name = 'get_usage'
222222
query_args = {
223-
"project": TextType.FREE,
224-
"start": TextType.FREE,
225-
"end": TextType.FREE,
226-
"unique": TextType.LITERAL,
223+
"project": QueryParamType.TEXT,
224+
"start": QueryParamType.TEXT,
225+
"end": QueryParamType.TEXT,
226+
"unique": QueryParamType.LITERAL,
227227
}
228228

229229

@@ -278,7 +278,7 @@ def _parse_format_params(params: dict, query_args: dict) -> str:
278278
if isinstance(val, bool):
279279
val = str(val).lower()
280280

281-
if qval.name == 'FREE':
281+
if qval.name == 'TEXT':
282282
fval = json.dumps(val)
283283
elif qval.name == 'LITERAL':
284284
fval = val

0 commit comments

Comments
 (0)