auto_research.reimplementation.code_availability_check module

is_valid_url(url)[source]

Validate whether the provided string is a valid URL.

Parameters:

url (str) – The URL string to validate.

Returns:

True if the URL is valid (contains both a scheme and a netloc), False otherwise.

Return type:

bool

Example

>>> is_valid_url("https://github.com")
True
>>> is_valid_url("invalid-url")
False

Test if the provided response is a valid GitHub URL.

Parameters:

response (str) – The response to test. Expected to be a GitHub URL or “not available”.

Returns:

The original response if it passes the validation.

Return type:

str

Raises:

AssertionError – If the response is not a valid URL or does not contain “github.com”.

Example

>>> test_github_link("https://github.com/user/repo")
'https://github.com/user/repo'
>>> test_github_link("not available")
'not available'
base_prompt_formatted()[source]
Generate a formatted prompt string requesting information about the availability of a GitHub

link.

Returns:

A string containing the formatted prompt instructions.

Return type:

str

Example

>>> base_prompt_formatted()
'Information about the availability of a GitHub link for the code that implements the
 method. If the link is not available, your answer should be "not available". Your answer
  should only be the GitHub link or "not available" and nothing else.'