Skip to content

Commit

Permalink
Implemented the review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mugdhadhole1 committed Dec 16, 2024
1 parent 5d2e94e commit a7897d1
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions lobster/tools/codebeamer/codebeamer.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,20 +162,19 @@ def get_query(mh, cb_config, query):
total_items = None

while total_items is None or len(rv) < total_items:
print("Fetching page %u of query..." % page_id)
if query is not None:
if isinstance(query, int):
url = ("%s/reports/%u/items?page=%u&pageSize=%u" %
(cb_config["base"],
query,
page_id,
cb_config["page_size"]))
elif isinstance(query, str):
url = ("%s/items/query?queryString=%s" %
(cb_config["base"],
query))
data = query_cb_single(cb_config, url)
assert len(data) == 4
print("Fetching page %u of query..." % page_id)
if isinstance(query, int):
url = ("%s/reports/%u/items?page=%u&pageSize=%u" %
(cb_config["base"],
query,
page_id,
cb_config["page_size"]))
elif isinstance(query, str):
url = ("%s/items/query?queryString=%s" %
(cb_config["base"],
query))
data = query_cb_single(cb_config, url)
assert len(data) == 4

if page_id == 1 and len(data["items"]) == 0:
print("This query doesn't generate items. Please check:")
Expand Down Expand Up @@ -539,19 +538,17 @@ def main():
if isinstance(options.import_query, int):
query = int(options.import_query)
if query < 1:
raise ValueError("query_string must be a positive integer"
"or valid string")
ap.error("query_string must be a positive integer")
elif isinstance(options.import_query, str):
if options.import_query.startswith("-"):
raise ValueError("query_string must be a positive integer"
"or valid string")
ap.error("query_string must be a positive integer"
" or valid string")
elif options.import_query.isdigit():
query = int(options.import_query)
if query < 1:
raise ValueError("query_string must be a positive integer"
"or valid string")
elif isinstance(options.import_query, str):
query = str(options.import_query)
ap.error("query_string must be a positive integer")
else:
query = str(options.import_query)
except ValueError as e:
ap.error(str(e))

Expand Down

0 comments on commit a7897d1

Please sign in to comment.