Ad
  • Custom User Avatar
  • Custom User Avatar

    this one is good before sleeping also

    on every line add .replace("codewars", "sheep")

  • Custom User Avatar

    Improvise, adapt, overcome.

  • Custom User Avatar

    To pass tests, I have added time.sleep(0.1) in my function to avoid the error.
    With 3 attempts, 2 are ok. Maybe time.sleep(0.2) would be better.

  • Custom User Avatar

    i have deployed a quick-fix that should allow the kata to be solveable again in Python, though it is probably not a long-term solution. I have reduced the number of random tests and added some delay in-between requests.

  • Custom User Avatar

    I have narrowed down the cause of the bug. It seems that Wikidata lowered their allowed request rate. The test suite makes too many requests with too short a delay between them. As a result, wikidata responds with the error code 429 (Too Many Requests). As there is then no JSON response to parse when that occurs, the error cascade shown above is triggered. By deleting some of the fixed tests and calling time.sleep() with a reasonable delay between random tests, the error no longer occurs.

  • Custom User Avatar

    yup same
    such a good problem but unsolveable

  • Custom User Avatar

    It gives this weird error on the second random test. Don't ask me why.

    Traceback (most recent call last):
    File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/json/init.py", line 346, in loads
    return _default_decoder.decode(s)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
    json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "/workspace/default/.venv/lib/python3.11/site-packages/codewars_test/test_framework.py", line 112, in wrapper
    func()
    File "/workspace/default/tests.py", line 75, in random_tests
    expected = referance(f"https://www.wikidata.org/wiki/Special:EntityData/Q404.json")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/workspace/default/tests.py", line 59, in referance
    data = refsession.get(url).json()['entities']
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
    requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    At work, developers constantly complain about clients giving unclear instructions. And now look at this — 90% of Katas fail on random tests because critical info is missing from the task description.

    It’s driving me absolutely mad!
    🤬

    Check out this gem of a task — so confusing even an AI stumbled:

    -- do you see how "hello" is 54 bytes?

    -- That’s a fun observation — but the word "hello" is definitely not 54 bytes. Let’s break it down:
    Each character in "hello" is typically 1 byte in UTF-8 or ASCII encoding.

    😂

  • Custom User Avatar
  • Custom User Avatar

    to make the issue extra clear in case anyone is trying to fix this:

    there is a fixed test mentioned in the description for entity Q42 that expects:

    {'ID': 'Q42', 'LABEL': 'Douglas Adams', 'DESCRIPTION': 'English science fiction writer and humourist'}
    

    but it seems that this wikidata entry was modified since the kata creation, and as per the rules the correct answer should now be:

    { 'ID': 'Q42', 'LABEL': 'Douglas Adams', 'DESCRIPTION': 'English science fiction writer and humorist (1952–2001)'
    

    I fixed the expected answer in Python and in the description.

  • Custom User Avatar

    duplicate of this issue (the label for the Q42 fixed test is outdated)

  • Custom User Avatar

    duplicate of this issue (the label for the Q42 fixed test is outdated)

  • Custom User Avatar

    Memory size, not byte size.

    'Hello':

    Byte size (size of the string in UTF-8 encoding): 5 bytes

    Memory size (total memory occupied by the string in Python): 54 bytes

  • Loading more items...