hexsha stringlengths 40 40 | repo stringlengths 7 114 | path stringlengths 4 124 | license listlengths 1 9 | language stringclasses 1
value | identifier stringlengths 1 71 | return_type stringlengths 1 749 ⌀ | original_string stringlengths 76 22.7k | original_docstring stringlengths 16 7.61k | docstring stringlengths 16 2.47k | docstring_tokens listlengths 6 477 | code stringlengths 14 10.2k | code_tokens listlengths 6 996 | short_docstring stringlengths 2 644 | short_docstring_tokens listlengths 1 116 | comment listlengths 1 89 | parameters listlengths 0 64 | docstring_params dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a3718cc629a4b5f7be65aa4d9628652d8e042e40 | varunjammula/WorldOnRails | leaderboard/leaderboard/scenarios/scenarioatomics/atomic_criteria.py | [
"MIT"
] | Python | _set_event_dict | null | def _set_event_dict(event, location):
"""
Sets the dictionary of the event
"""
event.set_dict({
'x': location.x,
'y': location.y,
'z': location.z,
}) |
Sets the dictionary of the event
| Sets the dictionary of the event | [
"Sets",
"the",
"dictionary",
"of",
"the",
"event"
] | def _set_event_dict(event, location):
event.set_dict({
'x': location.x,
'y': location.y,
'z': location.z,
}) | [
"def",
"_set_event_dict",
"(",
"event",
",",
"location",
")",
":",
"event",
".",
"set_dict",
"(",
"{",
"'x'",
":",
"location",
".",
"x",
",",
"'y'",
":",
"location",
".",
"y",
",",
"'z'",
":",
"location",
".",
"z",
",",
"}",
")"
] | Sets the dictionary of the event | [
"Sets",
"the",
"dictionary",
"of",
"the",
"event"
] | [
"\"\"\"\n Sets the dictionary of the event\n \"\"\""
] | [
{
"param": "event",
"type": null
},
{
"param": "location",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "event",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": null,
"docstring": null,
"docstring_token... |
79482c8bfa4476f757229a7a8465c7b8e0972669 | Mercy-Nekesa/sokoapp | sokoapp/gallery/parser.py | [
"MIT"
] | Python | render_inline | <not_specific> | def render_inline(inline):
"""
Replace inline markup with template markup that matches the
appropriate app and model.
"""
# Look for inline type, 'app.model'
try:
id = inline['id']
except:
if settings.DEBUG:
raise TemplateSyntaxError, "Couldn't find the attribut... |
Replace inline markup with template markup that matches the
appropriate app and model.
| Replace inline markup with template markup that matches the
appropriate app and model. | [
"Replace",
"inline",
"markup",
"with",
"template",
"markup",
"that",
"matches",
"the",
"appropriate",
"app",
"and",
"model",
"."
] | def render_inline(inline):
try:
id = inline['id']
except:
if settings.DEBUG:
raise TemplateSyntaxError, "Couldn't find the attribute 'id' in the <gallery> tag."
else:
return ''
album = Album.objects.get(pk=id)
context = { 'album': album, }
template = [... | [
"def",
"render_inline",
"(",
"inline",
")",
":",
"try",
":",
"id",
"=",
"inline",
"[",
"'id'",
"]",
"except",
":",
"if",
"settings",
".",
"DEBUG",
":",
"raise",
"TemplateSyntaxError",
",",
"\"Couldn't find the attribute 'id' in the <gallery> tag.\"",
"else",
":",
... | Replace inline markup with template markup that matches the
appropriate app and model. | [
"Replace",
"inline",
"markup",
"with",
"template",
"markup",
"that",
"matches",
"the",
"appropriate",
"app",
"and",
"model",
"."
] | [
"\"\"\"\n Replace inline markup with template markup that matches the\n appropriate app and model.\n\n \"\"\"",
"# Look for inline type, 'app.model'"
] | [
{
"param": "inline",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inline",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | retry_on | <not_specific> | def retry_on(EX:Exception, retries:int=1, on_failure:Callable=None): # TODO(florian): test that on_failure returns a boolean?
"""Decorator that retries the decorated function n (retries) times,
calling on_failure each time it fails with a given Exception EX.
EX can be one, or a tuple of Exception/s th... | Decorator that retries the decorated function n (retries) times,
calling on_failure each time it fails with a given Exception EX.
EX can be one, or a tuple of Exception/s that should be caught.
on_failure takes the Exception that caused the failure,
and returns a boolean saying whether or no... | Decorator that retries the decorated function n (retries) times,
calling on_failure each time it fails with a given Exception EX.
EX can be one, or a tuple of Exception/s that should be caught.
on_failure takes the Exception that caused the failure,
and returns a boolean saying whether or not to try again. | [
"Decorator",
"that",
"retries",
"the",
"decorated",
"function",
"n",
"(",
"retries",
")",
"times",
"calling",
"on_failure",
"each",
"time",
"it",
"fails",
"with",
"a",
"given",
"Exception",
"EX",
".",
"EX",
"can",
"be",
"one",
"or",
"a",
"tuple",
"of",
"... | def retry_on(EX:Exception, retries:int=1, on_failure:Callable=None):
assert retries >= 0, 'can\'t have negative retries'
if on_failure is None: on_failure = lambda e: True
def _retry_on(func):
def _wrapper(*args, **kwargs):
retry, _tries, _e = True, retries + 1, Exception('Something wen... | [
"def",
"retry_on",
"(",
"EX",
":",
"Exception",
",",
"retries",
":",
"int",
"=",
"1",
",",
"on_failure",
":",
"Callable",
"=",
"None",
")",
":",
"assert",
"retries",
">=",
"0",
",",
"'can\\'t have negative retries'",
"if",
"on_failure",
"is",
"None",
":",
... | Decorator that retries the decorated function n (retries) times,
calling on_failure each time it fails with a given Exception EX. | [
"Decorator",
"that",
"retries",
"the",
"decorated",
"function",
"n",
"(",
"retries",
")",
"times",
"calling",
"on_failure",
"each",
"time",
"it",
"fails",
"with",
"a",
"given",
"Exception",
"EX",
"."
] | [
"# TODO(florian): test that on_failure returns a boolean?",
"\"\"\"Decorator that retries the decorated function n (retries) times,\n calling on_failure each time it fails with a given Exception EX.\n EX can be one, or a tuple of Exception/s that should be caught.\n on_failure takes the Exceptio... | [
{
"param": "EX",
"type": "Exception"
},
{
"param": "retries",
"type": "int"
},
{
"param": "on_failure",
"type": "Callable"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "EX",
"type": "Exception",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "retries",
"type": "int",
"docstring": null,
"docstring_t... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | generate_headers | Dict | def generate_headers(requires_auth:bool) -> Dict:
""" Return Headers to be used in HTTP requests.
If requires_auth, the headers will contain a login token,
but only if a token was previously generated by calling login().
"""
headers = {'accept' : 'application/json',
'a... | Return Headers to be used in HTTP requests.
If requires_auth, the headers will contain a login token,
but only if a token was previously generated by calling login().
| Return Headers to be used in HTTP requests.
If requires_auth, the headers will contain a login token,
but only if a token was previously generated by calling login(). | [
"Return",
"Headers",
"to",
"be",
"used",
"in",
"HTTP",
"requests",
".",
"If",
"requires_auth",
"the",
"headers",
"will",
"contain",
"a",
"login",
"token",
"but",
"only",
"if",
"a",
"token",
"was",
"previously",
"generated",
"by",
"calling",
"login",
"()",
... | def generate_headers(requires_auth:bool) -> Dict:
headers = {'accept' : 'application/json',
'accept-encoding': 'gzip, deflate',
'content-type' : 'application/json',
'cache-control' : 'no-cache'}
if requires_auth:
headers['Authorization'] = Settings... | [
"def",
"generate_headers",
"(",
"requires_auth",
":",
"bool",
")",
"->",
"Dict",
":",
"headers",
"=",
"{",
"'accept'",
":",
"'application/json'",
",",
"'accept-encoding'",
":",
"'gzip, deflate'",
",",
"'content-type'",
":",
"'application/json'",
",",
"'cache-control... | Return Headers to be used in HTTP requests. | [
"Return",
"Headers",
"to",
"be",
"used",
"in",
"HTTP",
"requests",
"."
] | [
"\"\"\" Return Headers to be used in HTTP requests.\n If requires_auth, the headers will contain a login token,\n but only if a token was previously generated by calling login().\n \"\"\""
] | [
{
"param": "requires_auth",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "requires_auth",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | handle_response | Union[Dict, str] | def handle_response(query:str, response:requests.Response) -> Union[Dict, str]:
""" If the HTTPS Status Code is 200, the json response will be returned as a dictionary.
Otherwise an Exception with some information about the query is raised.
If for some reason a conversion to json is not possible, us... | If the HTTPS Status Code is 200, the json response will be returned as a dictionary.
Otherwise an Exception with some information about the query is raised.
If for some reason a conversion to json is not possible, uses the raw text representation.
| If the HTTPS Status Code is 200, the json response will be returned as a dictionary.
Otherwise an Exception with some information about the query is raised.
If for some reason a conversion to json is not possible, uses the raw text representation. | [
"If",
"the",
"HTTPS",
"Status",
"Code",
"is",
"200",
"the",
"json",
"response",
"will",
"be",
"returned",
"as",
"a",
"dictionary",
".",
"Otherwise",
"an",
"Exception",
"with",
"some",
"information",
"about",
"the",
"query",
"is",
"raised",
".",
"If",
"for"... | def handle_response(query:str, response:requests.Response) -> Union[Dict, str]:
try: text = response.json()
except: text = response.text
if response.status_code == 200: return text
info = f'\n--Status Code : {response.status_code}\n--Request to : {query}\n--Response Body : {text}'
if respons... | [
"def",
"handle_response",
"(",
"query",
":",
"str",
",",
"response",
":",
"requests",
".",
"Response",
")",
"->",
"Union",
"[",
"Dict",
",",
"str",
"]",
":",
"try",
":",
"text",
"=",
"response",
".",
"json",
"(",
")",
"except",
":",
"text",
"=",
"r... | If the HTTPS Status Code is 200, the json response will be returned as a dictionary. | [
"If",
"the",
"HTTPS",
"Status",
"Code",
"is",
"200",
"the",
"json",
"response",
"will",
"be",
"returned",
"as",
"a",
"dictionary",
"."
] | [
"\"\"\" If the HTTPS Status Code is 200, the json response will be returned as a dictionary.\n Otherwise an Exception with some information about the query is raised.\n If for some reason a conversion to json is not possible, uses the raw text representation.\n \"\"\""
] | [
{
"param": "query",
"type": "str"
},
{
"param": "response",
"type": "requests.Response"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "response",
"type": "requests.Response",
"docstring": null,
... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | _try_login | <not_specific> | def _try_login(_):
"""Callback that attempts to re-authenticate by using stored Settings"""
if Settings.username and Settings.password:
try: login(Settings.username, Settings.password)
except: return False
else: return True
else: return False | Callback that attempts to re-authenticate by using stored Settings | Callback that attempts to re-authenticate by using stored Settings | [
"Callback",
"that",
"attempts",
"to",
"re",
"-",
"authenticate",
"by",
"using",
"stored",
"Settings"
] | def _try_login(_):
if Settings.username and Settings.password:
try: login(Settings.username, Settings.password)
except: return False
else: return True
else: return False | [
"def",
"_try_login",
"(",
"_",
")",
":",
"if",
"Settings",
".",
"username",
"and",
"Settings",
".",
"password",
":",
"try",
":",
"login",
"(",
"Settings",
".",
"username",
",",
"Settings",
".",
"password",
")",
"except",
":",
"return",
"False",
"else",
... | Callback that attempts to re-authenticate by using stored Settings | [
"Callback",
"that",
"attempts",
"to",
"re",
"-",
"authenticate",
"by",
"using",
"stored",
"Settings"
] | [
"\"\"\"Callback that attempts to re-authenticate by using stored Settings\"\"\""
] | [
{
"param": "_",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "_",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | send_get | Dict | def send_get(query:str, requires_auth:bool=False) -> Dict:
""" Sends an HTTP GET request using query as URL.
"""
headers = generate_headers(requires_auth)
response = requests.get(url=query,headers=headers)
return handle_response(query, response) | Sends an HTTP GET request using query as URL.
| Sends an HTTP GET request using query as URL. | [
"Sends",
"an",
"HTTP",
"GET",
"request",
"using",
"query",
"as",
"URL",
"."
] | def send_get(query:str, requires_auth:bool=False) -> Dict:
headers = generate_headers(requires_auth)
response = requests.get(url=query,headers=headers)
return handle_response(query, response) | [
"def",
"send_get",
"(",
"query",
":",
"str",
",",
"requires_auth",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
":",
"headers",
"=",
"generate_headers",
"(",
"requires_auth",
")",
"response",
"=",
"requests",
".",
"get",
"(",
"url",
"=",
"query",
",",
... | Sends an HTTP GET request using query as URL. | [
"Sends",
"an",
"HTTP",
"GET",
"request",
"using",
"query",
"as",
"URL",
"."
] | [
"\"\"\" Sends an HTTP GET request using query as URL.\n \"\"\""
] | [
{
"param": "query",
"type": "str"
},
{
"param": "requires_auth",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "requires_auth",
"type": "bool",
"docstring": null,
"docstri... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | send_post | Dict | def send_post(query:str, body:Dict, requires_auth:bool=False) -> Dict:
""" Sends an HTTP POST request using query as URL and body as json content.
"""
headers = generate_headers(requires_auth)
response = requests.post(url=query, json=body, headers=headers)
return handle_response(query, response) | Sends an HTTP POST request using query as URL and body as json content.
| Sends an HTTP POST request using query as URL and body as json content. | [
"Sends",
"an",
"HTTP",
"POST",
"request",
"using",
"query",
"as",
"URL",
"and",
"body",
"as",
"json",
"content",
"."
] | def send_post(query:str, body:Dict, requires_auth:bool=False) -> Dict:
headers = generate_headers(requires_auth)
response = requests.post(url=query, json=body, headers=headers)
return handle_response(query, response) | [
"def",
"send_post",
"(",
"query",
":",
"str",
",",
"body",
":",
"Dict",
",",
"requires_auth",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
":",
"headers",
"=",
"generate_headers",
"(",
"requires_auth",
")",
"response",
"=",
"requests",
".",
"post",
"(",... | Sends an HTTP POST request using query as URL and body as json content. | [
"Sends",
"an",
"HTTP",
"POST",
"request",
"using",
"query",
"as",
"URL",
"and",
"body",
"as",
"json",
"content",
"."
] | [
"\"\"\" Sends an HTTP POST request using query as URL and body as json content.\n \"\"\""
] | [
{
"param": "query",
"type": "str"
},
{
"param": "body",
"type": "Dict"
},
{
"param": "requires_auth",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "body",
"type": "Dict",
"docstring": null,
"docstring_tokens... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | send_delete | Dict | def send_delete(query:str, requires_auth:bool=False) -> Dict:
""" Sends an HTTP DELETE request using query as URL.
"""
headers = generate_headers(requires_auth)
response = requests.delete(url=query, headers=headers)
return handle_response(query, response) | Sends an HTTP DELETE request using query as URL.
| Sends an HTTP DELETE request using query as URL. | [
"Sends",
"an",
"HTTP",
"DELETE",
"request",
"using",
"query",
"as",
"URL",
"."
] | def send_delete(query:str, requires_auth:bool=False) -> Dict:
headers = generate_headers(requires_auth)
response = requests.delete(url=query, headers=headers)
return handle_response(query, response) | [
"def",
"send_delete",
"(",
"query",
":",
"str",
",",
"requires_auth",
":",
"bool",
"=",
"False",
")",
"->",
"Dict",
":",
"headers",
"=",
"generate_headers",
"(",
"requires_auth",
")",
"response",
"=",
"requests",
".",
"delete",
"(",
"url",
"=",
"query",
... | Sends an HTTP DELETE request using query as URL. | [
"Sends",
"an",
"HTTP",
"DELETE",
"request",
"using",
"query",
"as",
"URL",
"."
] | [
"\"\"\" Sends an HTTP DELETE request using query as URL.\n \"\"\""
] | [
{
"param": "query",
"type": "str"
},
{
"param": "requires_auth",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "query",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "requires_auth",
"type": "bool",
"docstring": null,
"docstri... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | build_query | <not_specific> | def build_query(target:str, **kwargs):
""" Create an API query by combining all keyword arguments into one request URL.
target is what comes after the api_endpoint but before the query arguments
e.g. /units or /users/profile
"""
query = f'{Settings.api_endpoint}{"" if target.startswith("/") ... | Create an API query by combining all keyword arguments into one request URL.
target is what comes after the api_endpoint but before the query arguments
e.g. /units or /users/profile
| Create an API query by combining all keyword arguments into one request URL.
target is what comes after the api_endpoint but before the query arguments
e.g. /units or /users/profile | [
"Create",
"an",
"API",
"query",
"by",
"combining",
"all",
"keyword",
"arguments",
"into",
"one",
"request",
"URL",
".",
"target",
"is",
"what",
"comes",
"after",
"the",
"api_endpoint",
"but",
"before",
"the",
"query",
"arguments",
"e",
".",
"g",
".",
"/",
... | def build_query(target:str, **kwargs):
query = f'{Settings.api_endpoint}{"" if target.startswith("/") else "/" }{target}?'
for key, value in kwargs.items():
if value and key != 'self': query += f'{key}={value}&'
return query | [
"def",
"build_query",
"(",
"target",
":",
"str",
",",
"**",
"kwargs",
")",
":",
"query",
"=",
"f'{Settings.api_endpoint}{\"\" if target.startswith(\"/\") else \"/\" }{target}?'",
"for",
"key",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"if",
"value... | Create an API query by combining all keyword arguments into one request URL. | [
"Create",
"an",
"API",
"query",
"by",
"combining",
"all",
"keyword",
"arguments",
"into",
"one",
"request",
"URL",
"."
] | [
"\"\"\" Create an API query by combining all keyword arguments into one request URL.\n target is what comes after the api_endpoint but before the query arguments\n e.g. /units or /users/profile\n \"\"\""
] | [
{
"param": "target",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "target",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | login | str | def login(username:str, password:str) -> str:
""" HTTP: POST
Input:
- username: your opensense.network username
- password: your opensense.network username
Output:
- A login Token that can be used for 1 hour.
Note: The Token is automatically added to th... | HTTP: POST
Input:
- username: your opensense.network username
- password: your opensense.network username
Output:
- A login Token that can be used for 1 hour.
Note: The Token is automatically added to the Settings and used whenever one is needed.
N... | POST
Input:
username: your opensense.network username
password: your opensense.network username
A login Token that can be used for 1 hour.
Note: The Token is automatically added to the Settings and used whenever one is needed.
Note: username and password are also stored in the Settings. | [
"POST",
"Input",
":",
"username",
":",
"your",
"opensense",
".",
"network",
"username",
"password",
":",
"your",
"opensense",
".",
"network",
"username",
"A",
"login",
"Token",
"that",
"can",
"be",
"used",
"for",
"1",
"hour",
".",
"Note",
":",
"The",
"To... | def login(username:str, password:str) -> str:
query = build_query(target='/users/login')
body = {'username': username, 'password': password}
token = send_post(query, body)['id']
Settings.username, Settings.password = username, password
Settings.auth_token = token
return token | [
"def",
"login",
"(",
"username",
":",
"str",
",",
"password",
":",
"str",
")",
"->",
"str",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/users/login'",
")",
"body",
"=",
"{",
"'username'",
":",
"username",
",",
"'password'",
":",
"password",
... | HTTP: POST
Input:
username: your opensense.network username
password: your opensense.network username | [
"HTTP",
":",
"POST",
"Input",
":",
"username",
":",
"your",
"opensense",
".",
"network",
"username",
"password",
":",
"your",
"opensense",
".",
"network",
"username"
] | [
"\"\"\" HTTP: POST\n\n Input:\n - username: your opensense.network username\n - password: your opensense.network username\n\n Output:\n - A login Token that can be used for 1 hour.\n Note: The Token is automatically added to the Settings and used whenever one i... | [
{
"param": "username",
"type": "str"
},
{
"param": "password",
"type": "str"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "username",
"type": "str",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "password",
"type": "str",
"docstring": null,
"docstring_... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | addSensor | Sensor | def addSensor(body:Sensor) -> Sensor:
""" HTTP: POST
Note: This function requires previous authentication.
Input:
- A Dictionary describing a Sensor you want to add.
Example:
{
'measurandId': 1,
'unitId': 1,
'location':... | HTTP: POST
Note: This function requires previous authentication.
Input:
- A Dictionary describing a Sensor you want to add.
Example:
{
'measurandId': 1,
'unitId': 1,
'location': {'lat': 1.0, 'lng': 1.0},
'a... | POST
Note: This function requires previous authentication.
A Dictionary describing a Sensor you want to add. | [
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"A",
"Dictionary",
"describing",
"a",
"Sensor",
"you",
"want",
"to",
"add",
"."
] | def addSensor(body:Sensor) -> Sensor:
query = build_query(target='/sensors/addSensor')
return send_post(query, body, requires_auth=True) | [
"def",
"addSensor",
"(",
"body",
":",
"Sensor",
")",
"->",
"Sensor",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/sensors/addSensor'",
")",
"return",
"send_post",
"(",
"query",
",",
"body",
",",
"requires_auth",
"=",
"True",
")"
] | HTTP: POST
Note: This function requires previous authentication. | [
"HTTP",
":",
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: POST\n Note: This function requires previous authentication.\n\n Input:\n - A Dictionary describing a Sensor you want to add.\n Example:\n {\n 'measurandId': 1,\n 'unitId': 1,\n 'location': {'lat': 1.0, 'lng': 1.0}... | [
{
"param": "body",
"type": "Sensor"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "body",
"type": "Sensor",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": nul... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | deleteSensor | str | def deleteSensor(id:int) -> str:
""" HTTP: DELETE
Note: This function requires previous authentication.
Input:
- The id of the Sensor you want to delete.
Note: You can only delete Sensors you own (the ones you created).
Output:
- The string 'OK' if deletion ... | HTTP: DELETE
Note: This function requires previous authentication.
Input:
- The id of the Sensor you want to delete.
Note: You can only delete Sensors you own (the ones you created).
Output:
- The string 'OK' if deletion was successful, weird status codes other... | DELETE
Note: This function requires previous authentication.
The id of the Sensor you want to delete.
Note: You can only delete Sensors you own (the ones you created).
The string 'OK' if deletion was successful, weird status codes otherwise.
Note: weird status codes cause an Exception() to be thrown. | [
"DELETE",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"The",
"id",
"of",
"the",
"Sensor",
"you",
"want",
"to",
"delete",
".",
"Note",
":",
"You",
"can",
"only",
"delete",
"Sensors",
"you",
"own",
"(",
"the",
"ones",
"y... | def deleteSensor(id:int) -> str:
query = build_query(target=f'/sensors/{id}')
return send_delete(query, requires_auth=True) | [
"def",
"deleteSensor",
"(",
"id",
":",
"int",
")",
"->",
"str",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"f'/sensors/{id}'",
")",
"return",
"send_delete",
"(",
"query",
",",
"requires_auth",
"=",
"True",
")"
] | HTTP: DELETE
Note: This function requires previous authentication. | [
"HTTP",
":",
"DELETE",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: DELETE\n Note: This function requires previous authentication.\n\n Input:\n - The id of the Sensor you want to delete.\n Note: You can only delete Sensors you own (the ones you created).\n\n Output:\n - The string 'OK' if deletion was successful, weird... | [
{
"param": "id",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | mySensors | List[Sensor] | def mySensors() -> List[Sensor]:
""" HTTP: GET
Note: This function requires previous authentication.
Output:
- A List of the Sensors you've created / own.
Note: Returns a List, even if you've only created one Sensor so far.
Example:
[
{
... | HTTP: GET
Note: This function requires previous authentication.
Output:
- A List of the Sensors you've created / own.
Note: Returns a List, even if you've only created one Sensor so far.
Example:
[
{
'id': 61,
... | GET
Note: This function requires previous authentication.
A List of the Sensors you've created / own.
Note: Returns a List, even if you've only created one Sensor so far. | [
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"A",
"List",
"of",
"the",
"Sensors",
"you",
"'",
"ve",
"created",
"/",
"own",
".",
"Note",
":",
"Returns",
"a",
"List",
"even",
"if",
"you",
"'",
"ve",
"only",
"crea... | def mySensors() -> List[Sensor]:
query = build_query(target='/sensors/mysensors')
return send_get(query, requires_auth=True) | [
"def",
"mySensors",
"(",
")",
"->",
"List",
"[",
"Sensor",
"]",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/sensors/mysensors'",
")",
"return",
"send_get",
"(",
"query",
",",
"requires_auth",
"=",
"True",
")"
] | HTTP: GET
Note: This function requires previous authentication. | [
"HTTP",
":",
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: GET\n Note: This function requires previous authentication.\n\n Output:\n - A List of the Sensors you've created / own.\n Note: Returns a List, even if you've only created one Sensor so far.\n Example:\n [\n {\n 'id': ... | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": "[\n{\n'id': 61,\n'userId': 2,\n'measurandId': 1,\n'unitId': 1,\n'location': {'lat': 1.0, 'lng': 1.0},\n'altitudeAboveGround': 0.0,\n'directionVertical': 0,\n'directionHorizo... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | mySensorIds | List[int] | def mySensorIds() -> List[int]:
""" HTTP: GET
Note: This function requires previous authentication.
Output:
- A List of ids of Sensors you've created / own.
Example:
[61, 62, 63]
"""
query = build_query(target='/sensors/mysensorids')
return send_get(query... | HTTP: GET
Note: This function requires previous authentication.
Output:
- A List of ids of Sensors you've created / own.
Example:
[61, 62, 63]
| GET
Note: This function requires previous authentication.
A List of ids of Sensors you've created / own. | [
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"A",
"List",
"of",
"ids",
"of",
"Sensors",
"you",
"'",
"ve",
"created",
"/",
"own",
"."
] | def mySensorIds() -> List[int]:
query = build_query(target='/sensors/mysensorids')
return send_get(query, requires_auth=True) | [
"def",
"mySensorIds",
"(",
")",
"->",
"List",
"[",
"int",
"]",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/sensors/mysensorids'",
")",
"return",
"send_get",
"(",
"query",
",",
"requires_auth",
"=",
"True",
")"
] | HTTP: GET
Note: This function requires previous authentication. | [
"HTTP",
":",
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: GET\n Note: This function requires previous authentication.\n\n Output:\n - A List of ids of Sensors you've created / own.\n Example:\n [61, 62, 63]\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": null,
"docstring_tokens": [
"None"
]
}
]
} |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | addValue | str | def addValue(body:Value) -> str:
""" HTTP: POST
Note: This function requires previous authentication.
Input:
- A Value, including the sensorId that it should be added to.
Note: You can only add values to sensors you've created / own.
Example:
{
... | HTTP: POST
Note: This function requires previous authentication.
Input:
- A Value, including the sensorId that it should be added to.
Note: You can only add values to sensors you've created / own.
Example:
{
"sensorId": 61,
"times... | POST
Note: This function requires previous authentication.
A Value, including the sensorId that it should be added to.
Note: You can only add values to sensors you've created / own. | [
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"A",
"Value",
"including",
"the",
"sensorId",
"that",
"it",
"should",
"be",
"added",
"to",
".",
"Note",
":",
"You",
"can",
"only",
"add",
"values",
"to",
"sensors",
"yo... | def addValue(body:Value) -> str:
query = build_query(target='/sensors/addValue')
return send_post(query, body, requires_auth=True) | [
"def",
"addValue",
"(",
"body",
":",
"Value",
")",
"->",
"str",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/sensors/addValue'",
")",
"return",
"send_post",
"(",
"query",
",",
"body",
",",
"requires_auth",
"=",
"True",
")"
] | HTTP: POST
Note: This function requires previous authentication. | [
"HTTP",
":",
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: POST\n Note: This function requires previous authentication.\n\n Input:\n - A Value, including the sensorId that it should be added to.\n Note: You can only add values to sensors you've created / own.\n Example:\n {\n \"sensorId\": 61,\n... | [
{
"param": "body",
"type": "Value"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "body",
"type": "Value",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": null... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | addMultipleValues | str | def addMultipleValues(body:Dict[str, List[Value]]) -> str:
""" HTTP: POST
Note: This function requires previous authentication.
Input:
- A Dict that has the key collapsedMessages, with a list of values,
including the sensorId that each should be added to, as value.
... | HTTP: POST
Note: This function requires previous authentication.
Input:
- A Dict that has the key collapsedMessages, with a list of values,
including the sensorId that each should be added to, as value.
Note: You can only add values to sensors you've created / own.
... | POST
Note: This function requires previous authentication.
A Dict that has the key collapsedMessages, with a list of values,
including the sensorId that each should be added to, as value.
Note: You can only add values to sensors you've created / own. | [
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"A",
"Dict",
"that",
"has",
"the",
"key",
"collapsedMessages",
"with",
"a",
"list",
"of",
"values",
"including",
"the",
"sensorId",
"that",
"each",
"should",
"be",
"added",... | def addMultipleValues(body:Dict[str, List[Value]]) -> str:
query = build_query(target='/sensors/addMultipleValues')
return send_post(query, body, requires_auth=True) | [
"def",
"addMultipleValues",
"(",
"body",
":",
"Dict",
"[",
"str",
",",
"List",
"[",
"Value",
"]",
"]",
")",
"->",
"str",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/sensors/addMultipleValues'",
")",
"return",
"send_post",
"(",
"query",
",",
... | HTTP: POST
Note: This function requires previous authentication. | [
"HTTP",
":",
"POST",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: POST\n Note: This function requires previous authentication.\n\n Input:\n - A Dict that has the key collapsedMessages, with a list of values,\n including the sensorId that each should be added to, as value.\n Note: You can only add values to sensors you've ... | [
{
"param": "body",
"type": "Dict[str, List[Value]]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "body",
"type": "Dict[str, List[Value]]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": [
{
"identifier": "examples",
... |
2ceeb7267c650f723b688bebe6ac633c85cb19ae | flpeters/osnapi | osnapi/core.py | [
"Apache-2.0"
] | Python | profile | List[Dict[str, Union[str, int]]] | def profile() -> List[Dict[str, Union[str, int]]]:
""" HTTP: GET
Note: This function requires previous authentication.
Output:
- Profile information for the user who is currently logged in.
Example:
[{'username': 'yourname', 'id': 123}]
"""
query = build_quer... | HTTP: GET
Note: This function requires previous authentication.
Output:
- Profile information for the user who is currently logged in.
Example:
[{'username': 'yourname', 'id': 123}]
| GET
Note: This function requires previous authentication.
Profile information for the user who is currently logged in. | [
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
".",
"Profile",
"information",
"for",
"the",
"user",
"who",
"is",
"currently",
"logged",
"in",
"."
] | def profile() -> List[Dict[str, Union[str, int]]]:
query = build_query(target='/users/profile')
return send_get(query, requires_auth=True) | [
"def",
"profile",
"(",
")",
"->",
"List",
"[",
"Dict",
"[",
"str",
",",
"Union",
"[",
"str",
",",
"int",
"]",
"]",
"]",
":",
"query",
"=",
"build_query",
"(",
"target",
"=",
"'/users/profile'",
")",
"return",
"send_get",
"(",
"query",
",",
"requires_... | HTTP: GET
Note: This function requires previous authentication. | [
"HTTP",
":",
"GET",
"Note",
":",
"This",
"function",
"requires",
"previous",
"authentication",
"."
] | [
"\"\"\" HTTP: GET\n Note: This function requires previous authentication.\n\n Output:\n - Profile information for the user who is currently logged in.\n Example:\n [{'username': 'yourname', 'id': 123}]\n \"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": [
{
"identifier": "examples",
"docstring": null,
"docstring_tokens": [
"None"
]
}
]
} |
d633118d62ba5209b01604b107da956d95cdb91b | LiYuzhu12138/3D-DART-server | 3d-dart/cgi/DARTcustombuild.py | [
"Apache-2.0"
] | Python | __checkDictKeys | null | def __checkDictKeys(self, keys, default=''):
"""Checks the dictionary if it has the keys. If not add them with value None"""
for n in keys:
if not self.python_dict.has_key(n):
self.python_dict[n] = default | Checks the dictionary if it has the keys. If not add them with value None | Checks the dictionary if it has the keys. If not add them with value None | [
"Checks",
"the",
"dictionary",
"if",
"it",
"has",
"the",
"keys",
".",
"If",
"not",
"add",
"them",
"with",
"value",
"None"
] | def __checkDictKeys(self, keys, default=''):
for n in keys:
if not self.python_dict.has_key(n):
self.python_dict[n] = default | [
"def",
"__checkDictKeys",
"(",
"self",
",",
"keys",
",",
"default",
"=",
"''",
")",
":",
"for",
"n",
"in",
"keys",
":",
"if",
"not",
"self",
".",
"python_dict",
".",
"has_key",
"(",
"n",
")",
":",
"self",
".",
"python_dict",
"[",
"n",
"]",
"=",
"... | Checks the dictionary if it has the keys. | [
"Checks",
"the",
"dictionary",
"if",
"it",
"has",
"the",
"keys",
"."
] | [
"\"\"\"Checks the dictionary if it has the keys. If not add them with value None\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "keys",
"type": null
},
{
"param": "default",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "keys",
"type": null,
"docstring": null,
"docstring_tokens": [... |
d633118d62ba5209b01604b107da956d95cdb91b | LiYuzhu12138/3D-DART-server | 3d-dart/cgi/DARTcustombuild.py | [
"Apache-2.0"
] | Python | __cgiToPythonDict | null | def __cgiToPythonDict(self):
"""Retrieve all keys and value pairs from the CGI FieldStorage class. This makes
postprocessing easier as the FieldStorage class does not allow keys to be added.
"""
for keys in self.webform:
try:
# For single value entries for one parameter
self.python_dict[keys] = (s... | Retrieve all keys and value pairs from the CGI FieldStorage class. This makes
postprocessing easier as the FieldStorage class does not allow keys to be added.
| Retrieve all keys and value pairs from the CGI FieldStorage class. This makes
postprocessing easier as the FieldStorage class does not allow keys to be added. | [
"Retrieve",
"all",
"keys",
"and",
"value",
"pairs",
"from",
"the",
"CGI",
"FieldStorage",
"class",
".",
"This",
"makes",
"postprocessing",
"easier",
"as",
"the",
"FieldStorage",
"class",
"does",
"not",
"allow",
"keys",
"to",
"be",
"added",
"."
] | def __cgiToPythonDict(self):
for keys in self.webform:
try:
self.python_dict[keys] = (self.webform[keys].value).strip()
except:
self.python_dict[keys] = (",".join(self.webform.getvalue(keys, ""))) | [
"def",
"__cgiToPythonDict",
"(",
"self",
")",
":",
"for",
"keys",
"in",
"self",
".",
"webform",
":",
"try",
":",
"self",
".",
"python_dict",
"[",
"keys",
"]",
"=",
"(",
"self",
".",
"webform",
"[",
"keys",
"]",
".",
"value",
")",
".",
"strip",
"(",... | Retrieve all keys and value pairs from the CGI FieldStorage class. | [
"Retrieve",
"all",
"keys",
"and",
"value",
"pairs",
"from",
"the",
"CGI",
"FieldStorage",
"class",
"."
] | [
"\"\"\"Retrieve all keys and value pairs from the CGI FieldStorage class. This makes\n\t\t postprocessing easier as the FieldStorage class does not allow keys to be added.\n\t\t\"\"\"",
"# For single value entries for one parameter",
"# For multiple value entries for one parameters"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d633118d62ba5209b01604b107da956d95cdb91b | LiYuzhu12138/3D-DART-server | 3d-dart/cgi/DARTcustombuild.py | [
"Apache-2.0"
] | Python | __checkFilePath | <not_specific> | def __checkFilePath(self,path):
"""Check to see if file path contains backslashes. This can happen if user uploads file from Internet Explore.
What a suprise, MS always does it in a different way. If backslahes are found, convert them to forewards
slashes and feed the string to os.path.basename and return ... | Check to see if file path contains backslashes. This can happen if user uploads file from Internet Explore.
What a suprise, MS always does it in a different way. If backslahes are found, convert them to forewards
slashes and feed the string to os.path.basename and return result
| Check to see if file path contains backslashes. This can happen if user uploads file from Internet Explore.
What a suprise, MS always does it in a different way. If backslahes are found, convert them to forewards
slashes and feed the string to os.path.basename and return result | [
"Check",
"to",
"see",
"if",
"file",
"path",
"contains",
"backslashes",
".",
"This",
"can",
"happen",
"if",
"user",
"uploads",
"file",
"from",
"Internet",
"Explore",
".",
"What",
"a",
"suprise",
"MS",
"always",
"does",
"it",
"in",
"a",
"different",
"way",
... | def __checkFilePath(self,path):
tmp = path.replace('\\','/')
if tmp:
return os.path.basename(tmp)
else:
return path | [
"def",
"__checkFilePath",
"(",
"self",
",",
"path",
")",
":",
"tmp",
"=",
"path",
".",
"replace",
"(",
"'\\\\'",
",",
"'/'",
")",
"if",
"tmp",
":",
"return",
"os",
".",
"path",
".",
"basename",
"(",
"tmp",
")",
"else",
":",
"return",
"path"
] | Check to see if file path contains backslashes. | [
"Check",
"to",
"see",
"if",
"file",
"path",
"contains",
"backslashes",
"."
] | [
"\"\"\"Check to see if file path contains backslashes. This can happen if user uploads file from Internet Explore.\n\t\t What a suprise, MS always does it in a different way. If backslahes are found, convert them to forewards \n\t\t slashes and feed the string to os.path.basename and return result\n \t\t\"\"\""... | [
{
"param": "self",
"type": null
},
{
"param": "path",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_tokens": [... |
d633118d62ba5209b01604b107da956d95cdb91b | LiYuzhu12138/3D-DART-server | 3d-dart/cgi/DARTcustombuild.py | [
"Apache-2.0"
] | Python | __processWebform | null | def __processWebform(self):
"""Make some custom build specific checks for the variables past to the workflow.xml file"""
# If a parameter or pdb file is uploaded, build from this one and blank the sequence entry field.
# If a sequence is provided check its base-pair count. More than 200 base-pairs are not
# a... | Make some custom build specific checks for the variables past to the workflow.xml file | Make some custom build specific checks for the variables past to the workflow.xml file | [
"Make",
"some",
"custom",
"build",
"specific",
"checks",
"for",
"the",
"variables",
"past",
"to",
"the",
"workflow",
".",
"xml",
"file"
] | def __processWebform(self):
seq = False
self.__checkDictKeys(['1.upload'])
if len(self.python_dict['2.sequence']):
if (len(self.python_dict['2.sequence']) * int(self.python_dict['2.repeat'])) > 1000:
self.__returnError("Too many base-pairs (%s): A nucleic acid sequence of more than 1000 base-pairs... | [
"def",
"__processWebform",
"(",
"self",
")",
":",
"seq",
"=",
"False",
"self",
".",
"__checkDictKeys",
"(",
"[",
"'1.upload'",
"]",
")",
"if",
"len",
"(",
"self",
".",
"python_dict",
"[",
"'2.sequence'",
"]",
")",
":",
"if",
"(",
"len",
"(",
"self",
... | Make some custom build specific checks for the variables past to the workflow.xml file | [
"Make",
"some",
"custom",
"build",
"specific",
"checks",
"for",
"the",
"variables",
"past",
"to",
"the",
"workflow",
".",
"xml",
"file"
] | [
"\"\"\"Make some custom build specific checks for the variables past to the workflow.xml file\"\"\"",
"# If a parameter or pdb file is uploaded, build from this one and blank the sequence entry field. ",
"# If a sequence is provided check its base-pair count. More than 200 base-pairs are not ",
"# allowed to ... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0c36a199a00a4fb43032a2cf17f5a5f85fdd6a70 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/NArestraint.py | [
"Apache-2.0"
] | Python | readpdb | null | def readpdb(self,pdb):
"""Run 3DNA find_pair on pdb file. Only generate .inp file and pass to 'importinp'"""
os.system("find_pair -t %s output.inp" % pdb)
if os.path.isfile('output.inp'): self.importinp('output.inp')
else:
print "--> No 3DNA input file to import, stopping"
sys.exit(0)
clean = [... | Run 3DNA find_pair on pdb file. Only generate .inp file and pass to 'importinp | Run 3DNA find_pair on pdb file. Only generate .inp file and pass to 'importinp | [
"Run",
"3DNA",
"find_pair",
"on",
"pdb",
"file",
".",
"Only",
"generate",
".",
"inp",
"file",
"and",
"pass",
"to",
"'",
"importinp"
] | def readpdb(self,pdb):
os.system("find_pair -t %s output.inp" % pdb)
if os.path.isfile('output.inp'): self.importinp('output.inp')
else:
print "--> No 3DNA input file to import, stopping"
sys.exit(0)
clean = ['output.inp','col_helices.scr','hel_regions.pdb','col_chains.scr','bp_order.dat','bestpairs.pdb',... | [
"def",
"readpdb",
"(",
"self",
",",
"pdb",
")",
":",
"os",
".",
"system",
"(",
"\"find_pair -t %s output.inp\"",
"%",
"pdb",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"'output.inp'",
")",
":",
"self",
".",
"importinp",
"(",
"'output.inp'",
")",
... | Run 3DNA find_pair on pdb file. | [
"Run",
"3DNA",
"find_pair",
"on",
"pdb",
"file",
"."
] | [
"\"\"\"Run 3DNA find_pair on pdb file. Only generate .inp file and pass to 'importinp'\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pdb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pdb",
"type": null,
"docstring": null,
"docstring_tokens": []... |
916a9f9c1c36070a1ebef39f40389e4505d3fbb0 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/QueryPDB.py | [
"Apache-2.0"
] | Python | GetSequence | null | def GetSequence(self,pdbxml=None):
"""Append sequence and resid nr of all chains in pdb to seqlib"""
query = Xpath(pdbxml)
query.Evaluate(query={1:{'element':'chain','attr':None}})
for chain in query.nodeselection[1]:
query.getAttr(node=chain,selection='ID',export='string')
chains = query.result
... | Append sequence and resid nr of all chains in pdb to seqlib | Append sequence and resid nr of all chains in pdb to seqlib | [
"Append",
"sequence",
"and",
"resid",
"nr",
"of",
"all",
"chains",
"in",
"pdb",
"to",
"seqlib"
] | def GetSequence(self,pdbxml=None):
query = Xpath(pdbxml)
query.Evaluate(query={1:{'element':'chain','attr':None}})
for chain in query.nodeselection[1]:
query.getAttr(node=chain,selection='ID',export='string')
chains = query.result
query.ClearResult()
for chain in chains:
query.Evaluate(query={1:{'elem... | [
"def",
"GetSequence",
"(",
"self",
",",
"pdbxml",
"=",
"None",
")",
":",
"query",
"=",
"Xpath",
"(",
"pdbxml",
")",
"query",
".",
"Evaluate",
"(",
"query",
"=",
"{",
"1",
":",
"{",
"'element'",
":",
"'chain'",
",",
"'attr'",
":",
"None",
"}",
"}",
... | Append sequence and resid nr of all chains in pdb to seqlib | [
"Append",
"sequence",
"and",
"resid",
"nr",
"of",
"all",
"chains",
"in",
"pdb",
"to",
"seqlib"
] | [
"\"\"\"Append sequence and resid nr of all chains in pdb to seqlib\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "pdbxml",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pdbxml",
"type": null,
"docstring": null,
"docstring_tokens":... |
916a9f9c1c36070a1ebef39f40389e4505d3fbb0 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/QueryPDB.py | [
"Apache-2.0"
] | Python | Evaluate | null | def Evaluate(self):
"""First indentify type of chain in sequence"""
chains = self.sequence.keys()
if len(chains) == 0:
print " * ERROR: No chains found in structure, stopping"
sys.exit(0)
else:
print(" * Found %i chains in structure" % len(chains))
self._EvalMolType(chains)
"""Find ... | First indentify type of chain in sequence | First indentify type of chain in sequence | [
"First",
"indentify",
"type",
"of",
"chain",
"in",
"sequence"
] | def Evaluate(self):
chains = self.sequence.keys()
if len(chains) == 0:
print " * ERROR: No chains found in structure, stopping"
sys.exit(0)
else:
print(" * Found %i chains in structure" % len(chains))
self._EvalMolType(chains)
for chain in self.moltype.keys():
if self.moltype[chain] == 'D... | [
"def",
"Evaluate",
"(",
"self",
")",
":",
"chains",
"=",
"self",
".",
"sequence",
".",
"keys",
"(",
")",
"if",
"len",
"(",
"chains",
")",
"==",
"0",
":",
"print",
"\" * ERROR: No chains found in structure, stopping\"",
"sys",
".",
"exit",
"(",
"0",
")",... | First indentify type of chain in sequence | [
"First",
"indentify",
"type",
"of",
"chain",
"in",
"sequence"
] | [
"\"\"\"First indentify type of chain in sequence\"\"\"",
"\"\"\"Find segments (if any) in chains\"\"\"",
"\"\"\"Extract paired chains/segments\"\"\"",
"\"\"\"TEMPORARY HACK TO MAKE X3DNAANALYZE WORK\"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
916a9f9c1c36070a1ebef39f40389e4505d3fbb0 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/QueryPDB.py | [
"Apache-2.0"
] | Python | _BackboneTrace | null | def _BackboneTrace(self,chainid):
"""Calculate same-strand C5' to C5' distance"""
print(" * Indentify segments for chain %s" % chainid)
print " * Calculating same-strand C5' to C5' distance to extract segments from structure. Segment indentified"
print " when C5'-C5' distance is larger than... | Calculate same-strand C5' to C5' distance | Calculate same-strand C5' to C5' distance | [
"Calculate",
"same",
"-",
"strand",
"C5",
"'",
"to",
"C5",
"'",
"distance"
] | def _BackboneTrace(self,chainid):
print(" * Indentify segments for chain %s" % chainid)
print " * Calculating same-strand C5' to C5' distance to extract segments from structure. Segment indentified"
print " when C5'-C5' distance is larger than dynamic average + standard deviation + 1 = cutoff"
print ... | [
"def",
"_BackboneTrace",
"(",
"self",
",",
"chainid",
")",
":",
"print",
"(",
"\" * Indentify segments for chain %s\"",
"%",
"chainid",
")",
"print",
"\" * Calculating same-strand C5' to C5' distance to extract segments from structure. Segment indentified\"",
"print",
"\" ... | Calculate same-strand C5' to C5' distance | [
"Calculate",
"same",
"-",
"strand",
"C5",
"'",
"to",
"C5",
"'",
"distance"
] | [
"\"\"\"Calculate same-strand C5' to C5' distance\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "chainid",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "chainid",
"type": null,
"docstring": null,
"docstring_tokens"... |
cf98db7039ba6139996d3eaf8f89df6c52f3df12 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/FileSelector.py | [
"Apache-2.0"
] | Python | PluginCore | null | def PluginCore(paramdict, inputlist):
"""FileSelector does not need any input so inputlist is not used"""
if len(inputlist) > 0:
print "--> Selecting a file(s) for the batch sequence"
jobdir = os.getcwd()
for files in inputlist:
if os.path.isfile(files):
print(" * Found: %s" % files)
fname =... | FileSelector does not need any input so inputlist is not used | FileSelector does not need any input so inputlist is not used | [
"FileSelector",
"does",
"not",
"need",
"any",
"input",
"so",
"inputlist",
"is",
"not",
"used"
] | def PluginCore(paramdict, inputlist):
if len(inputlist) > 0:
print "--> Selecting a file(s) for the batch sequence"
jobdir = os.getcwd()
for files in inputlist:
if os.path.isfile(files):
print(" * Found: %s" % files)
fname = os.path.basename(files)
destination = os.path.join(jobdir,fname)
... | [
"def",
"PluginCore",
"(",
"paramdict",
",",
"inputlist",
")",
":",
"if",
"len",
"(",
"inputlist",
")",
">",
"0",
":",
"print",
"\"--> Selecting a file(s) for the batch sequence\"",
"jobdir",
"=",
"os",
".",
"getcwd",
"(",
")",
"for",
"files",
"in",
"inputlist"... | FileSelector does not need any input so inputlist is not used | [
"FileSelector",
"does",
"not",
"need",
"any",
"input",
"so",
"inputlist",
"is",
"not",
"used"
] | [
"\"\"\"FileSelector does not need any input so inputlist is not used\"\"\""
] | [
{
"param": "paramdict",
"type": null
},
{
"param": "inputlist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "paramdict",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inputlist",
"type": null,
"docstring": null,
"docstring_... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _MakeDecisions | <not_specific> | def _MakeDecisions(self, minp=None, maxp=None, pstep=None, def1=None, def2=None):
"""Checks validitie and sets defaults for angle and orient parameters"""
orgminp = self._FormatParams(self.paramdict[minp], minp)
orgmaxp = self._FormatParams(self.paramdict[maxp], maxp)
orgpstep = self._FormatParams(self.par... | Checks validitie and sets defaults for angle and orient parameters | Checks validitie and sets defaults for angle and orient parameters | [
"Checks",
"validitie",
"and",
"sets",
"defaults",
"for",
"angle",
"and",
"orient",
"parameters"
] | def _MakeDecisions(self, minp=None, maxp=None, pstep=None, def1=None, def2=None):
orgminp = self._FormatParams(self.paramdict[minp], minp)
orgmaxp = self._FormatParams(self.paramdict[maxp], maxp)
orgpstep = self._FormatParams(self.paramdict[pstep], pstep)
tmpminp = []
tmpmaxp = []
tmppstep = []
if orgminp... | [
"def",
"_MakeDecisions",
"(",
"self",
",",
"minp",
"=",
"None",
",",
"maxp",
"=",
"None",
",",
"pstep",
"=",
"None",
",",
"def1",
"=",
"None",
",",
"def2",
"=",
"None",
")",
":",
"orgminp",
"=",
"self",
".",
"_FormatParams",
"(",
"self",
".",
"para... | Checks validitie and sets defaults for angle and orient parameters | [
"Checks",
"validitie",
"and",
"sets",
"defaults",
"for",
"angle",
"and",
"orient",
"parameters"
] | [
"\"\"\"Checks validitie and sets defaults for angle and orient parameters\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "minp",
"type": null
},
{
"param": "maxp",
"type": null
},
{
"param": "pstep",
"type": null
},
{
"param": "def1",
"type": null
},
{
"param": "def2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "minp",
"type": null,
"docstring": null,
"docstring_tokens": [... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _MakeBaseparDatabase | null | def _MakeBaseparDatabase(self,lib):
"""Create the actual database with baseparameter values"""
self.baseparameter = DatabaseDeamon()
self.baseparameter.Load('sequence',lib[0])
self.baseparameter.Load('shear',lib[1])
self.baseparameter.Load('stretch',lib[2])
self.baseparameter.Load('stagger',lib[3])
s... | Create the actual database with baseparameter values | Create the actual database with baseparameter values | [
"Create",
"the",
"actual",
"database",
"with",
"baseparameter",
"values"
] | def _MakeBaseparDatabase(self,lib):
self.baseparameter = DatabaseDeamon()
self.baseparameter.Load('sequence',lib[0])
self.baseparameter.Load('shear',lib[1])
self.baseparameter.Load('stretch',lib[2])
self.baseparameter.Load('stagger',lib[3])
self.baseparameter.Load('buckle',lib[4])
self.baseparameter.Load(... | [
"def",
"_MakeBaseparDatabase",
"(",
"self",
",",
"lib",
")",
":",
"self",
".",
"baseparameter",
"=",
"DatabaseDeamon",
"(",
")",
"self",
".",
"baseparameter",
".",
"Load",
"(",
"'sequence'",
",",
"lib",
"[",
"0",
"]",
")",
"self",
".",
"baseparameter",
"... | Create the actual database with baseparameter values | [
"Create",
"the",
"actual",
"database",
"with",
"baseparameter",
"values"
] | [
"\"\"\"Create the actual database with baseparameter values\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "lib",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "lib",
"type": null,
"docstring": null,
"docstring_tokens": []... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _GlobalVariation | <not_specific> | def _GlobalVariation(self,base,value,sd,variance,scale,smooth=None):
"""Apply variance to the parameter in a weighted manner. More conserved values (measured as amound of variation based on sd) will be introduced
with a larger frequency then less conserved parameters. The smoothing factor determines the final... | Apply variance to the parameter in a weighted manner. More conserved values (measured as amound of variation based on sd) will be introduced
with a larger frequency then less conserved parameters. The smoothing factor determines the final value | Apply variance to the parameter in a weighted manner. More conserved values (measured as amound of variation based on sd) will be introduced
with a larger frequency then less conserved parameters. The smoothing factor determines the final value | [
"Apply",
"variance",
"to",
"the",
"parameter",
"in",
"a",
"weighted",
"manner",
".",
"More",
"conserved",
"values",
"(",
"measured",
"as",
"amound",
"of",
"variation",
"based",
"on",
"sd",
")",
"will",
"be",
"introduced",
"with",
"a",
"larger",
"frequency",
... | def _GlobalVariation(self,base,value,sd,variance,scale,smooth=None):
value = array(value)
sd = array(sd)
base = array(base)
tsd = array([std(value[1:len(value)])]*len(value))
weight = (2-pow((sqrt(sd/tsd)),scale))*value
if not smooth == None:
tmp = []
maxp = max(weight[1:len(weight)])*smooth
minp ... | [
"def",
"_GlobalVariation",
"(",
"self",
",",
"base",
",",
"value",
",",
"sd",
",",
"variance",
",",
"scale",
",",
"smooth",
"=",
"None",
")",
":",
"value",
"=",
"array",
"(",
"value",
")",
"sd",
"=",
"array",
"(",
"sd",
")",
"base",
"=",
"array",
... | Apply variance to the parameter in a weighted manner. | [
"Apply",
"variance",
"to",
"the",
"parameter",
"in",
"a",
"weighted",
"manner",
"."
] | [
"\"\"\"Apply variance to the parameter in a weighted manner. More conserved values (measured as amound of variation based on sd) will be introduced\n\t\t with a larger frequency then less conserved parameters. The smoothing factor determines the final value\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "base",
"type": null
},
{
"param": "value",
"type": null
},
{
"param": "sd",
"type": null
},
{
"param": "variance",
"type": null
},
{
"param": "scale",
"type": null
},
{
"param": "smooth",
"... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "base",
"type": null,
"docstring": null,
"docstring_tokens": [... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _ZeroFill | <not_specific> | def _ZeroFill(self,partlist):
"""Fill array shorter than length of sequence with zero's untill the match the length of the sequence"""
begin = [0]*(self.paramdict['startbp']-1)
end = [0]*(len(self.baseparameter['sequence'])-self.paramdict['endbp'])
return begin+partlist+end | Fill array shorter than length of sequence with zero's untill the match the length of the sequence | Fill array shorter than length of sequence with zero's untill the match the length of the sequence | [
"Fill",
"array",
"shorter",
"than",
"length",
"of",
"sequence",
"with",
"zero",
"'",
"s",
"untill",
"the",
"match",
"the",
"length",
"of",
"the",
"sequence"
] | def _ZeroFill(self,partlist):
begin = [0]*(self.paramdict['startbp']-1)
end = [0]*(len(self.baseparameter['sequence'])-self.paramdict['endbp'])
return begin+partlist+end | [
"def",
"_ZeroFill",
"(",
"self",
",",
"partlist",
")",
":",
"begin",
"=",
"[",
"0",
"]",
"*",
"(",
"self",
".",
"paramdict",
"[",
"'startbp'",
"]",
"-",
"1",
")",
"end",
"=",
"[",
"0",
"]",
"*",
"(",
"len",
"(",
"self",
".",
"baseparameter",
"[... | Fill array shorter than length of sequence with zero's untill the match the length of the sequence | [
"Fill",
"array",
"shorter",
"than",
"length",
"of",
"sequence",
"with",
"zero",
"'",
"s",
"untill",
"the",
"match",
"the",
"length",
"of",
"the",
"sequence"
] | [
"\"\"\"Fill array shorter than length of sequence with zero's untill the match the length of the sequence\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "partlist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "partlist",
"type": null,
"docstring": null,
"docstring_tokens... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _AdjustParams | <not_specific> | def _AdjustParams(self, newparam=None, oldparam=None):
"""Replace zero's outside of the calculation zone (startbp-endbp) with the original values in input .par file"""
olddw = oldparam[0:(self.paramdict['startbp']-1)]
oldup = oldparam[self.paramdict['endbp']:len(oldparam)+1]
return olddw+newparam[self.p... | Replace zero's outside of the calculation zone (startbp-endbp) with the original values in input .par file | Replace zero's outside of the calculation zone (startbp-endbp) with the original values in input .par file | [
"Replace",
"zero",
"'",
"s",
"outside",
"of",
"the",
"calculation",
"zone",
"(",
"startbp",
"-",
"endbp",
")",
"with",
"the",
"original",
"values",
"in",
"input",
".",
"par",
"file"
] | def _AdjustParams(self, newparam=None, oldparam=None):
olddw = oldparam[0:(self.paramdict['startbp']-1)]
oldup = oldparam[self.paramdict['endbp']:len(oldparam)+1]
return olddw+newparam[self.paramdict['startbp']-1:self.paramdict['endbp']]+oldup | [
"def",
"_AdjustParams",
"(",
"self",
",",
"newparam",
"=",
"None",
",",
"oldparam",
"=",
"None",
")",
":",
"olddw",
"=",
"oldparam",
"[",
"0",
":",
"(",
"self",
".",
"paramdict",
"[",
"'startbp'",
"]",
"-",
"1",
")",
"]",
"oldup",
"=",
"oldparam",
... | Replace zero's outside of the calculation zone (startbp-endbp) with the original values in input .par file | [
"Replace",
"zero",
"'",
"s",
"outside",
"of",
"the",
"calculation",
"zone",
"(",
"startbp",
"-",
"endbp",
")",
"with",
"the",
"original",
"values",
"in",
"input",
".",
"par",
"file"
] | [
"\"\"\"Replace zero's outside of the calculation zone (startbp-endbp) with the original values in input .par file\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "newparam",
"type": null
},
{
"param": "oldparam",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newparam",
"type": null,
"docstring": null,
"docstring_tokens... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | _AdjustGroove | <not_specific> | def _AdjustGroove(self,slide,roll,slidefactor):
"""Adjust the slide to accomondate the user defined major groove width. Set over complete sequence or a user
defined zone."""
rollmax = max(roll)
newslide = []
for n in roll:
try: # Try to correct for roll. If roll is 0.00 then appen... | Adjust the slide to accomondate the user defined major groove width. Set over complete sequence or a user
defined zone. | Adjust the slide to accomondate the user defined major groove width. Set over complete sequence or a user
defined zone. | [
"Adjust",
"the",
"slide",
"to",
"accomondate",
"the",
"user",
"defined",
"major",
"groove",
"width",
".",
"Set",
"over",
"complete",
"sequence",
"or",
"a",
"user",
"defined",
"zone",
"."
] | def _AdjustGroove(self,slide,roll,slidefactor):
rollmax = max(roll)
newslide = []
for n in roll:
try:
newslide.append((0.0-((n*1.0)/rollmax)+slidefactor))
except:
newslide.append(slidefactor)
olddw = slide[0:self.paramdict['groovestart']-1]
oldup = slide[self.paramdict['grooveend'... | [
"def",
"_AdjustGroove",
"(",
"self",
",",
"slide",
",",
"roll",
",",
"slidefactor",
")",
":",
"rollmax",
"=",
"max",
"(",
"roll",
")",
"newslide",
"=",
"[",
"]",
"for",
"n",
"in",
"roll",
":",
"try",
":",
"newslide",
".",
"append",
"(",
"(",
"0.0",... | Adjust the slide to accomondate the user defined major groove width. | [
"Adjust",
"the",
"slide",
"to",
"accomondate",
"the",
"user",
"defined",
"major",
"groove",
"width",
"."
] | [
"\"\"\"Adjust the slide to accomondate the user defined major groove width. Set over complete sequence or a user\n\t\t defined zone.\"\"\"",
"# Try to correct for roll. If roll is 0.00 then append slidefactor"
] | [
{
"param": "self",
"type": null
},
{
"param": "slide",
"type": null
},
{
"param": "roll",
"type": null
},
{
"param": "slidefactor",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "slide",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | ReadPar | null | def ReadPar(self,files):
"""Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to baseparameter database"""
readfile = file(files, 'r')
lines = readfile.readlines()
lib = {}
for n in range(13):
lib[n] = []
for line in lines[3:]:
params = []
for n in ... | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to baseparameter database | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to baseparameter database | [
"Read",
"3DNA",
"generated",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameter",
"file",
"(",
"*",
".",
"par",
")",
"and",
"append",
"to",
"baseparameter",
"database"
] | def ReadPar(self,files):
readfile = file(files, 'r')
lines = readfile.readlines()
lib = {}
for n in range(13):
lib[n] = []
for line in lines[3:]:
params = []
for n in range(0,13):
params.append(line.split()[n])
lib[0].append(str(params[0]))
for value in range(1,13):
lib[value].append... | [
"def",
"ReadPar",
"(",
"self",
",",
"files",
")",
":",
"readfile",
"=",
"file",
"(",
"files",
",",
"'r'",
")",
"lines",
"=",
"readfile",
".",
"readlines",
"(",
")",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"13",
")",
":",
"lib",
"[... | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to baseparameter database | [
"Read",
"3DNA",
"generated",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameter",
"file",
"(",
"*",
".",
"par",
")",
"and",
"append",
"to",
"baseparameter",
"database"
] | [
"\"\"\"Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append\n\t\t to baseparameter database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | ReadOut | null | def ReadOut(self,files):
"""Read 3DNA generated analysis file (*.out) and append to baseparameter database, Extract
with self._ReadTable"""
lib = {}
for n in range(13):
lib[n] = []
bp = re.compile("bp Shear Stretch Stagger Buckle Propeller Opening")
bpstep = re.compile("step... | Read 3DNA generated analysis file (*.out) and append to baseparameter database, Extract
with self._ReadTable | Read 3DNA generated analysis file (*.out) and append to baseparameter database, Extract
with self._ReadTable | [
"Read",
"3DNA",
"generated",
"analysis",
"file",
"(",
"*",
".",
"out",
")",
"and",
"append",
"to",
"baseparameter",
"database",
"Extract",
"with",
"self",
".",
"_ReadTable"
] | def ReadOut(self,files):
lib = {}
for n in range(13):
lib[n] = []
bp = re.compile("bp Shear Stretch Stagger Buckle Propeller Opening")
bpstep = re.compile("step Shift Slide Rise Tilt Roll Twist")
readfile = file(files, 'r')
lines = readfile.readlines()
line... | [
"def",
"ReadOut",
"(",
"self",
",",
"files",
")",
":",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"13",
")",
":",
"lib",
"[",
"n",
"]",
"=",
"[",
"]",
"bp",
"=",
"re",
".",
"compile",
"(",
"\"bp Shear Stretch Stagger Buckle ... | Read 3DNA generated analysis file (*.out) and append to baseparameter database, Extract
with self._ReadTable | [
"Read",
"3DNA",
"generated",
"analysis",
"file",
"(",
"*",
".",
"out",
")",
"and",
"append",
"to",
"baseparameter",
"database",
"Extract",
"with",
"self",
".",
"_ReadTable"
] | [
"\"\"\"Read 3DNA generated analysis file (*.out) and append to baseparameter database, Extract \n\t\t with self._ReadTable\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | ReadMultibend | null | def ReadMultibend(self,files):
"""Read multibend file and append parameters to database"""
ref = re.compile("Reference base-pair:")
start = re.compile("index bp-step")
readfile = file(files, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
for line in lines:
line = line.strip()
... | Read multibend file and append parameters to database | Read multibend file and append parameters to database | [
"Read",
"multibend",
"file",
"and",
"append",
"parameters",
"to",
"database"
] | def ReadMultibend(self,files):
ref = re.compile("Reference base-pair:")
start = re.compile("index bp-step")
readfile = file(files, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
for line in lines:
line = line.strip()
result1 = ref.match(line)
result2 = start.match(line)
if re... | [
"def",
"ReadMultibend",
"(",
"self",
",",
"files",
")",
":",
"ref",
"=",
"re",
".",
"compile",
"(",
"\"Reference base-pair:\"",
")",
"start",
"=",
"re",
".",
"compile",
"(",
"\"index bp-step\"",
")",
"readfile",
"=",
"file",
"(",
"files",
",",
"'r'",
")... | Read multibend file and append parameters to database | [
"Read",
"multibend",
"file",
"and",
"append",
"parameters",
"to",
"database"
] | [
"\"\"\"Read multibend file and append parameters to database\"\"\"",
"#bendlines.insert(0,([0.00001]*17))"
] | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | ReadMultiout | null | def ReadMultiout(self, files):
"""Read statistics for base-pair and base-pair step parameters from multiout file and
append to database"""
lib = {}
for n in range(26):
lib[n] = []
bp = re.compile("nr bp freq. shear stretch")
bpstep = re.compile("nr bpstep freq. ... | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | [
"Read",
"statistics",
"for",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameters",
"from",
"multiout",
"file",
"and",
"append",
"to",
"database"
] | def ReadMultiout(self, files):
lib = {}
for n in range(26):
lib[n] = []
bp = re.compile("nr bp freq. shear stretch")
bpstep = re.compile("nr bpstep freq. shift slide")
readfile = file(files, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
... | [
"def",
"ReadMultiout",
"(",
"self",
",",
"files",
")",
":",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"26",
")",
":",
"lib",
"[",
"n",
"]",
"=",
"[",
"]",
"bp",
"=",
"re",
".",
"compile",
"(",
"\"nr bp freq. shear ... | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | [
"Read",
"statistics",
"for",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameters",
"from",
"multiout",
"file",
"and",
"append",
"to",
"database"
] | [
"\"\"\"Read statistics for base-pair and base-pair step parameters from multiout file and \n\t\t append to database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "files",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "files",
"type": null,
"docstring": null,
"docstring_tokens": ... |
8458a873831443e56574c431076f767c1ab1aced | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/ModelNucleicAcids.py | [
"Apache-2.0"
] | Python | Manualmodel | null | def Manualmodel(self):
"""Manual modeling module. Modeling process is devided into three parts: using the validated input parameters a list or arrays is made
for angles and the orientation of the bend in space for all models that need to be made based on the parameters "anglestep" and/or
"orientstep". Se... | Manual modeling module. Modeling process is devided into three parts: using the validated input parameters a list or arrays is made
for angles and the orientation of the bend in space for all models that need to be made based on the parameters "anglestep" and/or
"orientstep". Second a swapdatabase is made al... | Manual modeling module. Modeling process is devided into three parts: using the validated input parameters a list or arrays is made
for angles and the orientation of the bend in space for all models that need to be made based on the parameters "anglestep" and/or
"orientstep". Second a swapdatabase is made all calculati... | [
"Manual",
"modeling",
"module",
".",
"Modeling",
"process",
"is",
"devided",
"into",
"three",
"parts",
":",
"using",
"the",
"validated",
"input",
"parameters",
"a",
"list",
"or",
"arrays",
"is",
"made",
"for",
"angles",
"and",
"the",
"orientation",
"of",
"th... | def Manualmodel(self):
if self.paramdict['name'] == None:
self.paramdict['name'] = (os.path.splitext(os.path.basename(self.paramdict['base']))[0])
if self.paramdict['minangle'][0] == None and self.paramdict['maxangle'][0] == None:
anglematrix = [self.paramdict['minangle']]
else:
anglematrix = self._Make... | [
"def",
"Manualmodel",
"(",
"self",
")",
":",
"if",
"self",
".",
"paramdict",
"[",
"'name'",
"]",
"==",
"None",
":",
"self",
".",
"paramdict",
"[",
"'name'",
"]",
"=",
"(",
"os",
".",
"path",
".",
"splitext",
"(",
"os",
".",
"path",
".",
"basename",... | Manual modeling module. | [
"Manual",
"modeling",
"module",
"."
] | [
"\"\"\"Manual modeling module. Modeling process is devided into three parts: using the validated input parameters a list or arrays is made\n\t\t for angles and the orientation of the bend in space for all models that need to be made based on the parameters \"anglestep\" and/or \n\t\t \"orientstep\". Second a sw... | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | _ReadTable | <not_specific> | def _ReadTable(self, linenr=None, outfile=None):
"""Reading all table lines of seleted table. Readstart = linenr stop reading at first
instance of *, newline or ~. Store data in tablelines and return"""
tablelines = []
count = linenr+1
while count < len(outfile):
if outfile[count][0] == "*":
br... | Reading all table lines of seleted table. Readstart = linenr stop reading at first
instance of *, newline or ~. Store data in tablelines and return | Reading all table lines of seleted table. Readstart = linenr stop reading at first
instance of *, newline or ~. Store data in tablelines and return | [
"Reading",
"all",
"table",
"lines",
"of",
"seleted",
"table",
".",
"Readstart",
"=",
"linenr",
"stop",
"reading",
"at",
"first",
"instance",
"of",
"*",
"newline",
"or",
"~",
".",
"Store",
"data",
"in",
"tablelines",
"and",
"return"
] | def _ReadTable(self, linenr=None, outfile=None):
tablelines = []
count = linenr+1
while count < len(outfile):
if outfile[count][0] == "*":
break
elif outfile[count][0] == "\n":
break
elif outfile[count][10] == "~":
break
else:
tablelines.append(outfile[count].split())
count = cou... | [
"def",
"_ReadTable",
"(",
"self",
",",
"linenr",
"=",
"None",
",",
"outfile",
"=",
"None",
")",
":",
"tablelines",
"=",
"[",
"]",
"count",
"=",
"linenr",
"+",
"1",
"while",
"count",
"<",
"len",
"(",
"outfile",
")",
":",
"if",
"outfile",
"[",
"count... | Reading all table lines of seleted table. | [
"Reading",
"all",
"table",
"lines",
"of",
"seleted",
"table",
"."
] | [
"\"\"\"Reading all table lines of seleted table. Readstart = linenr stop reading at first \n\t\t instance of *, newline or ~. Store data in tablelines and return\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "linenr",
"type": null
},
{
"param": "outfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "linenr",
"type": null,
"docstring": null,
"docstring_tokens":... |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | TransformDash | <not_specific> | def TransformDash(self,n):
"""Transform dashes often found in 3DNA tables to floats"""
if n == '---' or n == '----':
return float(0)
else:
return float(n) | Transform dashes often found in 3DNA tables to floats | Transform dashes often found in 3DNA tables to floats | [
"Transform",
"dashes",
"often",
"found",
"in",
"3DNA",
"tables",
"to",
"floats"
] | def TransformDash(self,n):
if n == '---' or n == '----':
return float(0)
else:
return float(n) | [
"def",
"TransformDash",
"(",
"self",
",",
"n",
")",
":",
"if",
"n",
"==",
"'---'",
"or",
"n",
"==",
"'----'",
":",
"return",
"float",
"(",
"0",
")",
"else",
":",
"return",
"float",
"(",
"n",
")"
] | Transform dashes often found in 3DNA tables to floats | [
"Transform",
"dashes",
"often",
"found",
"in",
"3DNA",
"tables",
"to",
"floats"
] | [
"\"\"\"Transform dashes often found in 3DNA tables to floats\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "n",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | ReadPar | null | def ReadPar(self,infile):
"""Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to bpparr database"""
readfile = file(infile, 'r')
lines = readfile.readlines()
lib = {}
for n in range(13):
lib[n] = []
for line in lines[3:]:
params = []
for n in range(0,13): ... | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to bpparr database | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to bpparr database | [
"Read",
"3DNA",
"generated",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameter",
"file",
"(",
"*",
".",
"par",
")",
"and",
"append",
"to",
"bpparr",
"database"
] | def ReadPar(self,infile):
readfile = file(infile, 'r')
lines = readfile.readlines()
lib = {}
for n in range(13):
lib[n] = []
for line in lines[3:]:
params = []
for n in range(0,13):
params.append(line.split()[n])
lib[0].append(str(params[0]))
for value in range(1,13):
lib[value].appe... | [
"def",
"ReadPar",
"(",
"self",
",",
"infile",
")",
":",
"readfile",
"=",
"file",
"(",
"infile",
",",
"'r'",
")",
"lines",
"=",
"readfile",
".",
"readlines",
"(",
")",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"13",
")",
":",
"lib",
... | Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append
to bpparr database | [
"Read",
"3DNA",
"generated",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameter",
"file",
"(",
"*",
".",
"par",
")",
"and",
"append",
"to",
"bpparr",
"database"
] | [
"\"\"\"Read 3DNA generated base-pair and base-pair step parameter file (*.par) and append\n\t\t to bpparr database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens":... |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | ReadBend | null | def ReadBend(self,infile):
"""Read nucleic acid bend analysis file (*.bend) and append to bendref database"""
readfile = file(infile, 'r')
lines = readfile.readlines()
lib = {}
for n in range(9):
lib[n] = []
for line in lines[18:]:
params = line.split()
try:
lib[0].append(str(params[1]))
... | Read nucleic acid bend analysis file (*.bend) and append to bendref database | Read nucleic acid bend analysis file (*.bend) and append to bendref database | [
"Read",
"nucleic",
"acid",
"bend",
"analysis",
"file",
"(",
"*",
".",
"bend",
")",
"and",
"append",
"to",
"bendref",
"database"
] | def ReadBend(self,infile):
readfile = file(infile, 'r')
lines = readfile.readlines()
lib = {}
for n in range(9):
lib[n] = []
for line in lines[18:]:
params = line.split()
try:
lib[0].append(str(params[1]))
for value in range(2,9):
lib[value].append(float(params[value]))
except:
br... | [
"def",
"ReadBend",
"(",
"self",
",",
"infile",
")",
":",
"readfile",
"=",
"file",
"(",
"infile",
",",
"'r'",
")",
"lines",
"=",
"readfile",
".",
"readlines",
"(",
")",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"9",
")",
":",
"lib",
... | Read nucleic acid bend analysis file (*.bend) and append to bendref database | [
"Read",
"nucleic",
"acid",
"bend",
"analysis",
"file",
"(",
"*",
".",
"bend",
")",
"and",
"append",
"to",
"bendref",
"database"
] | [
"\"\"\"Read nucleic acid bend analysis file (*.bend) and append to bendref database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens":... |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | ReadMultiout | null | def ReadMultiout(self, infile):
"""Read statistics for base-pair and base-pair step parameters from multiout file and
append to database"""
lib = {}
for n in range(26):
lib[n] = []
bp = re.compile("nr bp freq. shear stretch")
bpstep = re.compile("nr bpstep freq. ... | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | [
"Read",
"statistics",
"for",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameters",
"from",
"multiout",
"file",
"and",
"append",
"to",
"database"
] | def ReadMultiout(self, infile):
lib = {}
for n in range(26):
lib[n] = []
bp = re.compile("nr bp freq. shear stretch")
bpstep = re.compile("nr bpstep freq. shift slide")
readfile = file(infile, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
... | [
"def",
"ReadMultiout",
"(",
"self",
",",
"infile",
")",
":",
"lib",
"=",
"{",
"}",
"for",
"n",
"in",
"range",
"(",
"26",
")",
":",
"lib",
"[",
"n",
"]",
"=",
"[",
"]",
"bp",
"=",
"re",
".",
"compile",
"(",
"\"nr bp freq. shear ... | Read statistics for base-pair and base-pair step parameters from multiout file and
append to database | [
"Read",
"statistics",
"for",
"base",
"-",
"pair",
"and",
"base",
"-",
"pair",
"step",
"parameters",
"from",
"multiout",
"file",
"and",
"append",
"to",
"database"
] | [
"\"\"\"Read statistics for base-pair and base-pair step parameters from multiout file and \n\t\t append to database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens":... |
0d3dd79e80cd87787ff661fa54dc410caf982327 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/PlotData.py | [
"Apache-2.0"
] | Python | ReadMultibend | null | def ReadMultibend(self,infile):
"""Read multibend file and append parameters to database"""
ref = re.compile("Reference base-pair:")
start = re.compile("index bp-step")
readfile = file(infile, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
for line in lines:
line = line.strip()
... | Read multibend file and append parameters to database | Read multibend file and append parameters to database | [
"Read",
"multibend",
"file",
"and",
"append",
"parameters",
"to",
"database"
] | def ReadMultibend(self,infile):
ref = re.compile("Reference base-pair:")
start = re.compile("index bp-step")
readfile = file(infile, 'r')
lines = readfile.readlines()
linecount = 1
countstart = []
for line in lines:
line = line.strip()
result1 = ref.match(line)
result2 = start.match(line)
if ... | [
"def",
"ReadMultibend",
"(",
"self",
",",
"infile",
")",
":",
"ref",
"=",
"re",
".",
"compile",
"(",
"\"Reference base-pair:\"",
")",
"start",
"=",
"re",
".",
"compile",
"(",
"\"index bp-step\"",
")",
"readfile",
"=",
"file",
"(",
"infile",
",",
"'r'",
... | Read multibend file and append parameters to database | [
"Read",
"multibend",
"file",
"and",
"append",
"parameters",
"to",
"database"
] | [
"\"\"\"Read multibend file and append parameters to database\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "infile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens":... |
87ca3e0f5dc5615164c7fdf7fe2c67f6751a5b49 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/XMLwriter.py | [
"Apache-2.0"
] | Python | delAttribute | null | def delAttribute(self, name):
"""
Remove XML attribute with this name.
"""
del self.attributes[name] |
Remove XML attribute with this name.
| Remove XML attribute with this name. | [
"Remove",
"XML",
"attribute",
"with",
"this",
"name",
"."
] | def delAttribute(self, name):
del self.attributes[name] | [
"def",
"delAttribute",
"(",
"self",
",",
"name",
")",
":",
"del",
"self",
".",
"attributes",
"[",
"name",
"]"
] | Remove XML attribute with this name. | [
"Remove",
"XML",
"attribute",
"with",
"this",
"name",
"."
] | [
"\"\"\"\n Remove XML attribute with this name.\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": null,
"docstring": null,
"docstring_tokens": [... |
87ca3e0f5dc5615164c7fdf7fe2c67f6751a5b49 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/XMLwriter.py | [
"Apache-2.0"
] | Python | node | <not_specific> | def node(self, tag):
"""
Recursively find the first subnode with this tag.
"""
if self.tag == tag:
return self
for child in self.children:
result = child.node(tag)
if result:
return result
return False |
Recursively find the first subnode with this tag.
| Recursively find the first subnode with this tag. | [
"Recursively",
"find",
"the",
"first",
"subnode",
"with",
"this",
"tag",
"."
] | def node(self, tag):
if self.tag == tag:
return self
for child in self.children:
result = child.node(tag)
if result:
return result
return False | [
"def",
"node",
"(",
"self",
",",
"tag",
")",
":",
"if",
"self",
".",
"tag",
"==",
"tag",
":",
"return",
"self",
"for",
"child",
"in",
"self",
".",
"children",
":",
"result",
"=",
"child",
".",
"node",
"(",
"tag",
")",
"if",
"result",
":",
"return... | Recursively find the first subnode with this tag. | [
"Recursively",
"find",
"the",
"first",
"subnode",
"with",
"this",
"tag",
"."
] | [
"\"\"\" \n Recursively find the first subnode with this tag. \n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "tag",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": null,
"docstring": null,
"docstring_tokens": []... |
87ca3e0f5dc5615164c7fdf7fe2c67f6751a5b49 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/XMLwriter.py | [
"Apache-2.0"
] | Python | nodeList | <not_specific> | def nodeList(self, tag):
"""
Produce a list of subnodes with the same tag.
Note:
It only makes sense to do this for the immediate
children of a node. If you went another level down,
the results would be ambiguous, so the user must
choose the node to iterate o... |
Produce a list of subnodes with the same tag.
Note:
It only makes sense to do this for the immediate
children of a node. If you went another level down,
the results would be ambiguous, so the user must
choose the node to iterate over.
| Produce a list of subnodes with the same tag.
Note:
It only makes sense to do this for the immediate
children of a node. If you went another level down,
the results would be ambiguous, so the user must
choose the node to iterate over. | [
"Produce",
"a",
"list",
"of",
"subnodes",
"with",
"the",
"same",
"tag",
".",
"Note",
":",
"It",
"only",
"makes",
"sense",
"to",
"do",
"this",
"for",
"the",
"immediate",
"children",
"of",
"a",
"node",
".",
"If",
"you",
"went",
"another",
"level",
"down"... | def nodeList(self, tag):
return [n for n in self.children if n.tag == tag] | [
"def",
"nodeList",
"(",
"self",
",",
"tag",
")",
":",
"return",
"[",
"n",
"for",
"n",
"in",
"self",
".",
"children",
"if",
"n",
".",
"tag",
"==",
"tag",
"]"
] | Produce a list of subnodes with the same tag. | [
"Produce",
"a",
"list",
"of",
"subnodes",
"with",
"the",
"same",
"tag",
"."
] | [
"\"\"\" \n Produce a list of subnodes with the same tag. \n Note:\n It only makes sense to do this for the immediate \n children of a node. If you went another level down, \n the results would be ambiguous, so the user must \n choose the node to iterate over.\n \"\"\... | [
{
"param": "self",
"type": null
},
{
"param": "tag",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tag",
"type": null,
"docstring": null,
"docstring_tokens": []... |
87ca3e0f5dc5615164c7fdf7fe2c67f6751a5b49 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/XMLwriter.py | [
"Apache-2.0"
] | Python | dom | <not_specific> | def dom(self):
"""
Lazily create a minidom from the information stored
in this Node object.
"""
element = Node.doc.createElement(self.tag)
for key, val in self.attributes.items():
element.setAttribute(key, val)
if self.value:
assert not sel... |
Lazily create a minidom from the information stored
in this Node object.
| Lazily create a minidom from the information stored
in this Node object. | [
"Lazily",
"create",
"a",
"minidom",
"from",
"the",
"information",
"stored",
"in",
"this",
"Node",
"object",
"."
] | def dom(self):
element = Node.doc.createElement(self.tag)
for key, val in self.attributes.items():
element.setAttribute(key, val)
if self.value:
assert not self.children, "cannot have value and children: " + str(self)
element.appendChild(Node.doc.createTextNod... | [
"def",
"dom",
"(",
"self",
")",
":",
"element",
"=",
"Node",
".",
"doc",
".",
"createElement",
"(",
"self",
".",
"tag",
")",
"for",
"key",
",",
"val",
"in",
"self",
".",
"attributes",
".",
"items",
"(",
")",
":",
"element",
".",
"setAttribute",
"("... | Lazily create a minidom from the information stored
in this Node object. | [
"Lazily",
"create",
"a",
"minidom",
"from",
"the",
"information",
"stored",
"in",
"this",
"Node",
"object",
"."
] | [
"\"\"\"\n Lazily create a minidom from the information stored\n in this Node object.\n \"\"\"",
"# Generate children as well"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
87ca3e0f5dc5615164c7fdf7fe2c67f6751a5b49 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/XMLwriter.py | [
"Apache-2.0"
] | Python | create | <not_specific> | def create(dom):
"""
Create a Node representation, given either
a string representation of an XML doc, or a dom.
"""
if isinstance(dom, str):
# Strip all extraneous whitespace so that
# text input is handled consistently:
dom = re.sub("\s+", " ... |
Create a Node representation, given either
a string representation of an XML doc, or a dom.
| Create a Node representation, given either
a string representation of an XML doc, or a dom. | [
"Create",
"a",
"Node",
"representation",
"given",
"either",
"a",
"string",
"representation",
"of",
"an",
"XML",
"doc",
"or",
"a",
"dom",
"."
] | def create(dom):
if isinstance(dom, str):
dom = re.sub("\s+", " ", dom)
dom = dom.replace("> ", ">")
dom = dom.replace(" <", "<")
return Node.create(parseString(dom))
if dom.nodeType == dom.DOCUMENT_NODE:
return Node.create(dom.childNodes[0])
... | [
"def",
"create",
"(",
"dom",
")",
":",
"if",
"isinstance",
"(",
"dom",
",",
"str",
")",
":",
"dom",
"=",
"re",
".",
"sub",
"(",
"\"\\s+\"",
",",
"\" \"",
",",
"dom",
")",
"dom",
"=",
"dom",
".",
"replace",
"(",
"\"> \"",
",",
"\">\"",
")",
"dom... | Create a Node representation, given either
a string representation of an XML doc, or a dom. | [
"Create",
"a",
"Node",
"representation",
"given",
"either",
"a",
"string",
"representation",
"of",
"an",
"XML",
"doc",
"or",
"a",
"dom",
"."
] | [
"\"\"\"\n Create a Node representation, given either\n a string representation of an XML doc, or a dom.\n \"\"\"",
"# Strip all extraneous whitespace so that",
"# text input is handled consistently:"
] | [
{
"param": "dom",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dom",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d41c5003b303ab7af4acafb1e32c30ec5cd6262 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/Utils.py | [
"Apache-2.0"
] | Python | MakeBackup | <not_specific> | def MakeBackup(infile,report=False):
"""Make backup of files or directories by checking if file (or backup as _*) is there and rename"""
if os.path.isfile(infile) or os.path.isdir(infile):
i = 1
while i < 100:
if os.path.isfile(infile+'_'+str(i)) or os.path.isdir(infile+'_'+str(i)):
i = i+1
else:
... | Make backup of files or directories by checking if file (or backup as _*) is there and rename | Make backup of files or directories by checking if file (or backup as _*) is there and rename | [
"Make",
"backup",
"of",
"files",
"or",
"directories",
"by",
"checking",
"if",
"file",
"(",
"or",
"backup",
"as",
"_",
"*",
")",
"is",
"there",
"and",
"rename"
] | def MakeBackup(infile,report=False):
if os.path.isfile(infile) or os.path.isdir(infile):
i = 1
while i < 100:
if os.path.isfile(infile+'_'+str(i)) or os.path.isdir(infile+'_'+str(i)):
i = i+1
else:
os.rename(infile, infile+'_'+str(i))
break
if report == True:
return infile | [
"def",
"MakeBackup",
"(",
"infile",
",",
"report",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"infile",
")",
"or",
"os",
".",
"path",
".",
"isdir",
"(",
"infile",
")",
":",
"i",
"=",
"1",
"while",
"i",
"<",
"100",
":",... | Make backup of files or directories by checking if file (or backup as _*) is there and rename | [
"Make",
"backup",
"of",
"files",
"or",
"directories",
"by",
"checking",
"if",
"file",
"(",
"or",
"backup",
"as",
"_",
"*",
")",
"is",
"there",
"and",
"rename"
] | [
"\"\"\"Make backup of files or directories by checking if file (or backup as _*) is there and rename\"\"\""
] | [
{
"param": "infile",
"type": null
},
{
"param": "report",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "report",
"type": null,
"docstring": null,
"docstring_tokens... |
7d41c5003b303ab7af4acafb1e32c30ec5cd6262 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/Utils.py | [
"Apache-2.0"
] | Python | FileRootRename | null | def FileRootRename(infile,extension,basename):
"""Rename a file but preserve extension"""
outfile = basename+extension
os.rename(infile,outfile) | Rename a file but preserve extension | Rename a file but preserve extension | [
"Rename",
"a",
"file",
"but",
"preserve",
"extension"
] | def FileRootRename(infile,extension,basename):
outfile = basename+extension
os.rename(infile,outfile) | [
"def",
"FileRootRename",
"(",
"infile",
",",
"extension",
",",
"basename",
")",
":",
"outfile",
"=",
"basename",
"+",
"extension",
"os",
".",
"rename",
"(",
"infile",
",",
"outfile",
")"
] | Rename a file but preserve extension | [
"Rename",
"a",
"file",
"but",
"preserve",
"extension"
] | [
"\"\"\"Rename a file but preserve extension\"\"\""
] | [
{
"param": "infile",
"type": null
},
{
"param": "extension",
"type": null
},
{
"param": "basename",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "infile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "extension",
"type": null,
"docstring": null,
"docstring_tok... |
7d41c5003b303ab7af4acafb1e32c30ec5cd6262 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/Utils.py | [
"Apache-2.0"
] | Python | TransformDash | <not_specific> | def TransformDash(n):
"""Transform dashes often found in 3DNA tables to floats"""
if n == '---' or n == '----':
return float(0)
else:
return float(n) | Transform dashes often found in 3DNA tables to floats | Transform dashes often found in 3DNA tables to floats | [
"Transform",
"dashes",
"often",
"found",
"in",
"3DNA",
"tables",
"to",
"floats"
] | def TransformDash(n):
if n == '---' or n == '----':
return float(0)
else:
return float(n) | [
"def",
"TransformDash",
"(",
"n",
")",
":",
"if",
"n",
"==",
"'---'",
"or",
"n",
"==",
"'----'",
":",
"return",
"float",
"(",
"0",
")",
"else",
":",
"return",
"float",
"(",
"n",
")"
] | Transform dashes often found in 3DNA tables to floats | [
"Transform",
"dashes",
"often",
"found",
"in",
"3DNA",
"tables",
"to",
"floats"
] | [
"\"\"\"Transform dashes often found in 3DNA tables to floats\"\"\""
] | [
{
"param": "n",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "n",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d41c5003b303ab7af4acafb1e32c30ec5cd6262 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/Utils.py | [
"Apache-2.0"
] | Python | GetFullPath | <not_specific> | def GetFullPath(inputfile):
"""Return the full path of the file(s)"""
try:
filelist = []
for files in inputfile:
filelist.append(os.path.abspath(files))
return filelist
except:
return os.path.abspath(files) | Return the full path of the file(s) | Return the full path of the file(s) | [
"Return",
"the",
"full",
"path",
"of",
"the",
"file",
"(",
"s",
")"
] | def GetFullPath(inputfile):
try:
filelist = []
for files in inputfile:
filelist.append(os.path.abspath(files))
return filelist
except:
return os.path.abspath(files) | [
"def",
"GetFullPath",
"(",
"inputfile",
")",
":",
"try",
":",
"filelist",
"=",
"[",
"]",
"for",
"files",
"in",
"inputfile",
":",
"filelist",
".",
"append",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"files",
")",
")",
"return",
"filelist",
"except",
... | Return the full path of the file(s) | [
"Return",
"the",
"full",
"path",
"of",
"the",
"file",
"(",
"s",
")"
] | [
"\"\"\"Return the full path of the file(s)\"\"\""
] | [
{
"param": "inputfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inputfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7d41c5003b303ab7af4acafb1e32c30ec5cd6262 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/Utils.py | [
"Apache-2.0"
] | Python | RenameFilepath | <not_specific> | def RenameFilepath(inputfile,path=None,basename=None,extension=None):
"""Rename a filepath in several ways: path, basename and/or extension"""
orpath = os.path.dirname(inputfile)
orbasename = os.path.splitext(os.path.basename(inputfile))[0]
orextension = os.path.splitext(os.path.basename(inputfile))[1]
newf... | Rename a filepath in several ways: path, basename and/or extension | Rename a filepath in several ways: path, basename and/or extension | [
"Rename",
"a",
"filepath",
"in",
"several",
"ways",
":",
"path",
"basename",
"and",
"/",
"or",
"extension"
] | def RenameFilepath(inputfile,path=None,basename=None,extension=None):
orpath = os.path.dirname(inputfile)
orbasename = os.path.splitext(os.path.basename(inputfile))[0]
orextension = os.path.splitext(os.path.basename(inputfile))[1]
newfile = ""
if path == None:
newfile = orpath+"/"
else:
newfile = path+"/"
... | [
"def",
"RenameFilepath",
"(",
"inputfile",
",",
"path",
"=",
"None",
",",
"basename",
"=",
"None",
",",
"extension",
"=",
"None",
")",
":",
"orpath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"inputfile",
")",
"orbasename",
"=",
"os",
".",
"path",
... | Rename a filepath in several ways: path, basename and/or extension | [
"Rename",
"a",
"filepath",
"in",
"several",
"ways",
":",
"path",
"basename",
"and",
"/",
"or",
"extension"
] | [
"\"\"\"Rename a filepath in several ways: path, basename and/or extension\"\"\"",
"# Set path",
"# Set file basename",
"# Set file extension"
] | [
{
"param": "inputfile",
"type": null
},
{
"param": "path",
"type": null
},
{
"param": "basename",
"type": null
},
{
"param": "extension",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inputfile",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "path",
"type": null,
"docstring": null,
"docstring_token... |
2b59bd693dedaf0d42715e2680d8da8dd4cd8ec4 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/BuildNucleicAcids.py | [
"Apache-2.0"
] | Python | ListFiber | null | def ListFiber():
"""Print list to screen of all 55 available fiber structures"""
cmd = "fiber -l"
os.system(cmd) | Print list to screen of all 55 available fiber structures | Print list to screen of all 55 available fiber structures | [
"Print",
"list",
"to",
"screen",
"of",
"all",
"55",
"available",
"fiber",
"structures"
] | def ListFiber():
cmd = "fiber -l"
os.system(cmd) | [
"def",
"ListFiber",
"(",
")",
":",
"cmd",
"=",
"\"fiber -l\"",
"os",
".",
"system",
"(",
"cmd",
")"
] | Print list to screen of all 55 available fiber structures | [
"Print",
"list",
"to",
"screen",
"of",
"all",
"55",
"available",
"fiber",
"structures"
] | [
"\"\"\"Print list to screen of all 55 available fiber structures\"\"\""
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
2b59bd693dedaf0d42715e2680d8da8dd4cd8ec4 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/BuildNucleicAcids.py | [
"Apache-2.0"
] | Python | FiberModule | null | def FiberModule(sequence, repeat, natype, name):
"""Make nucleic acid structures from using on of the 55 available fiber structures"""
try:
x = int(natype)
if x in range(1,56): option = "-"+str(x)
else:
print " * WARNING:", natype, "is no valid nucleic acid option, set to default BDNA"
option = -4
... | Make nucleic acid structures from using on of the 55 available fiber structures | Make nucleic acid structures from using on of the 55 available fiber structures | [
"Make",
"nucleic",
"acid",
"structures",
"from",
"using",
"on",
"of",
"the",
"55",
"available",
"fiber",
"structures"
] | def FiberModule(sequence, repeat, natype, name):
try:
x = int(natype)
if x in range(1,56): option = "-"+str(x)
else:
print " * WARNING:", natype, "is no valid nucleic acid option, set to default BDNA"
option = -4
except:
if natype == 'ADNA': option = -1
elif natype == 'BDNA': option = -4
elif nat... | [
"def",
"FiberModule",
"(",
"sequence",
",",
"repeat",
",",
"natype",
",",
"name",
")",
":",
"try",
":",
"x",
"=",
"int",
"(",
"natype",
")",
"if",
"x",
"in",
"range",
"(",
"1",
",",
"56",
")",
":",
"option",
"=",
"\"-\"",
"+",
"str",
"(",
"x",
... | Make nucleic acid structures from using on of the 55 available fiber structures | [
"Make",
"nucleic",
"acid",
"structures",
"from",
"using",
"on",
"of",
"the",
"55",
"available",
"fiber",
"structures"
] | [
"\"\"\"Make nucleic acid structures from using on of the 55 available fiber structures\"\"\""
] | [
{
"param": "sequence",
"type": null
},
{
"param": "repeat",
"type": null
},
{
"param": "natype",
"type": null
},
{
"param": "name",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "repeat",
"type": null,
"docstring": null,
"docstring_toke... |
2b59bd693dedaf0d42715e2680d8da8dd4cd8ec4 | LiYuzhu12138/3D-DART-server | 3d-dart/server/plugins/BuildNucleicAcids.py | [
"Apache-2.0"
] | Python | RebuildNA | null | def RebuildNA(option, inputfile, outputfile):
"""Make nucleic acid structure using the "rebuild" module of 3DNA"""
cmd = "rebuild " + str(option)+" " + (inputfile)+" " + (outputfile)
output = commands.getoutput(cmd) | Make nucleic acid structure using the "rebuild" module of 3DNA | Make nucleic acid structure using the "rebuild" module of 3DNA | [
"Make",
"nucleic",
"acid",
"structure",
"using",
"the",
"\"",
"rebuild",
"\"",
"module",
"of",
"3DNA"
] | def RebuildNA(option, inputfile, outputfile):
cmd = "rebuild " + str(option)+" " + (inputfile)+" " + (outputfile)
output = commands.getoutput(cmd) | [
"def",
"RebuildNA",
"(",
"option",
",",
"inputfile",
",",
"outputfile",
")",
":",
"cmd",
"=",
"\"rebuild \"",
"+",
"str",
"(",
"option",
")",
"+",
"\" \"",
"+",
"(",
"inputfile",
")",
"+",
"\" \"",
"+",
"(",
"outputfile",
")",
"output",
"=",
"commands"... | Make nucleic acid structure using the "rebuild" module of 3DNA | [
"Make",
"nucleic",
"acid",
"structure",
"using",
"the",
"\"",
"rebuild",
"\"",
"module",
"of",
"3DNA"
] | [
"\"\"\"Make nucleic acid structure using the \"rebuild\" module of 3DNA\"\"\""
] | [
{
"param": "option",
"type": null
},
{
"param": "inputfile",
"type": null
},
{
"param": "outputfile",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "option",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inputfile",
"type": null,
"docstring": null,
"docstring_tok... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | length | <not_specific> | def length(u):
"""Calculates the length of u."""
return math.sqrt(numpy.dot(u, u)) | Calculates the length of u. | Calculates the length of u. | [
"Calculates",
"the",
"length",
"of",
"u",
"."
] | def length(u):
return math.sqrt(numpy.dot(u, u)) | [
"def",
"length",
"(",
"u",
")",
":",
"return",
"math",
".",
"sqrt",
"(",
"numpy",
".",
"dot",
"(",
"u",
",",
"u",
")",
")"
] | Calculates the length of u. | [
"Calculates",
"the",
"length",
"of",
"u",
"."
] | [
"\"\"\"Calculates the length of u.\"\"\""
] | [
{
"param": "u",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | rmatrix | <not_specific> | def rmatrix(alpha, beta, gamma):
"""Return a rotation matrix based on the Euler angles alpha,beta, and gamma in radians."""
cosA = math.cos(alpha)
cosB = math.cos(beta)
cosG = math.cos(gamma)
sinA = math.sin(alpha)
sinB = math.sin(beta)
sinG = math.sin(gamma)
R = array(
[[cosB*cosG, cosG*sin... | Return a rotation matrix based on the Euler angles alpha,beta, and gamma in radians. | Return a rotation matrix based on the Euler angles alpha,beta, and gamma in radians. | [
"Return",
"a",
"rotation",
"matrix",
"based",
"on",
"the",
"Euler",
"angles",
"alpha",
"beta",
"and",
"gamma",
"in",
"radians",
"."
] | def rmatrix(alpha, beta, gamma):
cosA = math.cos(alpha)
cosB = math.cos(beta)
cosG = math.cos(gamma)
sinA = math.sin(alpha)
sinB = math.sin(beta)
sinG = math.sin(gamma)
R = array(
[[cosB*cosG, cosG*sinA*sinB-cosA*sinG, cosA*cosG*sinB+sinA*sinG],
[cosB*sinG, cosA*cosG+sinA*sinB*sinG, cosA... | [
"def",
"rmatrix",
"(",
"alpha",
",",
"beta",
",",
"gamma",
")",
":",
"cosA",
"=",
"math",
".",
"cos",
"(",
"alpha",
")",
"cosB",
"=",
"math",
".",
"cos",
"(",
"beta",
")",
"cosG",
"=",
"math",
".",
"cos",
"(",
"gamma",
")",
"sinA",
"=",
"math",... | Return a rotation matrix based on the Euler angles alpha,beta, and gamma in radians. | [
"Return",
"a",
"rotation",
"matrix",
"based",
"on",
"the",
"Euler",
"angles",
"alpha",
"beta",
"and",
"gamma",
"in",
"radians",
"."
] | [
"\"\"\"Return a rotation matrix based on the Euler angles alpha,beta, and gamma in radians.\"\"\""
] | [
{
"param": "alpha",
"type": null
},
{
"param": "beta",
"type": null
},
{
"param": "gamma",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "alpha",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | rmatrixu | <not_specific> | def rmatrixu(u, theta):
"""Return a rotation matrix caused by a right hand rotation of theta radians around vector u."""
if numpy.allclose(theta, 0.0) or numpy.allclose(numpy.dot(u,u), 0.0):
return numpy.identity(3, float)
x, y, z = normalize(u)
sa = math.sin(theta)
ca = math.cos(theta)
R = arra... | Return a rotation matrix caused by a right hand rotation of theta radians around vector u. | Return a rotation matrix caused by a right hand rotation of theta radians around vector u. | [
"Return",
"a",
"rotation",
"matrix",
"caused",
"by",
"a",
"right",
"hand",
"rotation",
"of",
"theta",
"radians",
"around",
"vector",
"u",
"."
] | def rmatrixu(u, theta):
if numpy.allclose(theta, 0.0) or numpy.allclose(numpy.dot(u,u), 0.0):
return numpy.identity(3, float)
x, y, z = normalize(u)
sa = math.sin(theta)
ca = math.cos(theta)
R = array(
[[1.0+(1.0-ca)*(x*x-1.0), -z*sa+(1.0-ca)*x*y, y*sa+(1.0-ca)*x*z],
[z*sa+... | [
"def",
"rmatrixu",
"(",
"u",
",",
"theta",
")",
":",
"if",
"numpy",
".",
"allclose",
"(",
"theta",
",",
"0.0",
")",
"or",
"numpy",
".",
"allclose",
"(",
"numpy",
".",
"dot",
"(",
"u",
",",
"u",
")",
",",
"0.0",
")",
":",
"return",
"numpy",
".",... | Return a rotation matrix caused by a right hand rotation of theta radians around vector u. | [
"Return",
"a",
"rotation",
"matrix",
"caused",
"by",
"a",
"right",
"hand",
"rotation",
"of",
"theta",
"radians",
"around",
"vector",
"u",
"."
] | [
"\"\"\"Return a rotation matrix caused by a right hand rotation of theta radians around vector u.\"\"\""
] | [
{
"param": "u",
"type": null
},
{
"param": "theta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "theta",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | dmatrix | <not_specific> | def dmatrix(alpha, beta, gamma):
"""Returns the displacement matrix based on rotation about Euler angles alpha, beta, and gamma."""
return rmatrix(alpha, beta, gamma) - numpy.identity(3, float) | Returns the displacement matrix based on rotation about Euler angles alpha, beta, and gamma. | Returns the displacement matrix based on rotation about Euler angles alpha, beta, and gamma. | [
"Returns",
"the",
"displacement",
"matrix",
"based",
"on",
"rotation",
"about",
"Euler",
"angles",
"alpha",
"beta",
"and",
"gamma",
"."
] | def dmatrix(alpha, beta, gamma):
return rmatrix(alpha, beta, gamma) - numpy.identity(3, float) | [
"def",
"dmatrix",
"(",
"alpha",
",",
"beta",
",",
"gamma",
")",
":",
"return",
"rmatrix",
"(",
"alpha",
",",
"beta",
",",
"gamma",
")",
"-",
"numpy",
".",
"identity",
"(",
"3",
",",
"float",
")"
] | Returns the displacement matrix based on rotation about Euler angles alpha, beta, and gamma. | [
"Returns",
"the",
"displacement",
"matrix",
"based",
"on",
"rotation",
"about",
"Euler",
"angles",
"alpha",
"beta",
"and",
"gamma",
"."
] | [
"\"\"\"Returns the displacement matrix based on rotation about Euler angles alpha, beta, and gamma.\"\"\""
] | [
{
"param": "alpha",
"type": null
},
{
"param": "beta",
"type": null
},
{
"param": "gamma",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "alpha",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "beta",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | dmatrixu | <not_specific> | def dmatrixu(u, theta):
"""Return a displacement matrix caused by a right hand rotation of theta radians around vector u."""
return rmatrixu(u, theta) - numpy.identity(3, float) | Return a displacement matrix caused by a right hand rotation of theta radians around vector u. | Return a displacement matrix caused by a right hand rotation of theta radians around vector u. | [
"Return",
"a",
"displacement",
"matrix",
"caused",
"by",
"a",
"right",
"hand",
"rotation",
"of",
"theta",
"radians",
"around",
"vector",
"u",
"."
] | def dmatrixu(u, theta):
return rmatrixu(u, theta) - numpy.identity(3, float) | [
"def",
"dmatrixu",
"(",
"u",
",",
"theta",
")",
":",
"return",
"rmatrixu",
"(",
"u",
",",
"theta",
")",
"-",
"numpy",
".",
"identity",
"(",
"3",
",",
"float",
")"
] | Return a displacement matrix caused by a right hand rotation of theta radians around vector u. | [
"Return",
"a",
"displacement",
"matrix",
"caused",
"by",
"a",
"right",
"hand",
"rotation",
"of",
"theta",
"radians",
"around",
"vector",
"u",
"."
] | [
"\"\"\"Return a displacement matrix caused by a right hand rotation of theta radians around vector u.\"\"\""
] | [
{
"param": "u",
"type": null
},
{
"param": "theta",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "u",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "theta",
"type": null,
"docstring": null,
"docstring_tokens": [],... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | rmatrixz | <not_specific> | def rmatrixz(vec):
"""Return a rotation matrix which transforms the coordinate system such that the vector vec is aligned along the z axis."""
u, v, w = normalize(vec)
d = math.sqrt(u*u + v*v)
if d != 0.0:
Rxz = array([ [ u/d, v/d, 0.0 ],
[ -v/d, u/d, 0.0 ],
... | Return a rotation matrix which transforms the coordinate system such that the vector vec is aligned along the z axis. | Return a rotation matrix which transforms the coordinate system such that the vector vec is aligned along the z axis. | [
"Return",
"a",
"rotation",
"matrix",
"which",
"transforms",
"the",
"coordinate",
"system",
"such",
"that",
"the",
"vector",
"vec",
"is",
"aligned",
"along",
"the",
"z",
"axis",
"."
] | def rmatrixz(vec):
u, v, w = normalize(vec)
d = math.sqrt(u*u + v*v)
if d != 0.0:
Rxz = array([ [ u/d, v/d, 0.0 ],
[ -v/d, u/d, 0.0 ],
[ 0.0, 0.0, 1.0 ] ], float)
else:
Rxz = numpy.identity(3, float)
Rxz2z = array([ [ w, 0.0, -d],
... | [
"def",
"rmatrixz",
"(",
"vec",
")",
":",
"u",
",",
"v",
",",
"w",
"=",
"normalize",
"(",
"vec",
")",
"d",
"=",
"math",
".",
"sqrt",
"(",
"u",
"*",
"u",
"+",
"v",
"*",
"v",
")",
"if",
"d",
"!=",
"0.0",
":",
"Rxz",
"=",
"array",
"(",
"[",
... | Return a rotation matrix which transforms the coordinate system such that the vector vec is aligned along the z axis. | [
"Return",
"a",
"rotation",
"matrix",
"which",
"transforms",
"the",
"coordinate",
"system",
"such",
"that",
"the",
"vector",
"vec",
"is",
"aligned",
"along",
"the",
"z",
"axis",
"."
] | [
"\"\"\"Return a rotation matrix which transforms the coordinate system such that the vector vec is aligned along the z axis.\"\"\""
] | [
{
"param": "vec",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vec",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | calc_angle | <not_specific> | def calc_angle(a1, a2, a3):
"""Return the angle between the three argument atoms."""
if a1 == None or a2 == None or a3 == None:
return None
a21 = a1.position - a2.position
a21 = a21 / (length(a21))
a23 = a3.position - a2.position
a23 = a23 / (length(a23))
return math.acos(numpy.dot(a21, a23)) | Return the angle between the three argument atoms. | Return the angle between the three argument atoms. | [
"Return",
"the",
"angle",
"between",
"the",
"three",
"argument",
"atoms",
"."
] | def calc_angle(a1, a2, a3):
if a1 == None or a2 == None or a3 == None:
return None
a21 = a1.position - a2.position
a21 = a21 / (length(a21))
a23 = a3.position - a2.position
a23 = a23 / (length(a23))
return math.acos(numpy.dot(a21, a23)) | [
"def",
"calc_angle",
"(",
"a1",
",",
"a2",
",",
"a3",
")",
":",
"if",
"a1",
"==",
"None",
"or",
"a2",
"==",
"None",
"or",
"a3",
"==",
"None",
":",
"return",
"None",
"a21",
"=",
"a1",
".",
"position",
"-",
"a2",
".",
"position",
"a21",
"=",
"a21... | Return the angle between the three argument atoms. | [
"Return",
"the",
"angle",
"between",
"the",
"three",
"argument",
"atoms",
"."
] | [
"\"\"\"Return the angle between the three argument atoms.\"\"\""
] | [
{
"param": "a1",
"type": null
},
{
"param": "a2",
"type": null
},
{
"param": "a3",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | calc_torsion_angle | <not_specific> | def calc_torsion_angle(a1, a2, a3, a4):
"""Calculates the torsion angle between the four argument atoms."""
if a1 == None or a2 == None or a3 == None or a4 == None:
return None
a12 = a2.position - a1.position
a23 = a3.position - a2.position
a34 = a4.position - a3.position
n12 = cross(a12, a... | Calculates the torsion angle between the four argument atoms. | Calculates the torsion angle between the four argument atoms. | [
"Calculates",
"the",
"torsion",
"angle",
"between",
"the",
"four",
"argument",
"atoms",
"."
] | def calc_torsion_angle(a1, a2, a3, a4):
if a1 == None or a2 == None or a3 == None or a4 == None:
return None
a12 = a2.position - a1.position
a23 = a3.position - a2.position
a34 = a4.position - a3.position
n12 = cross(a12, a23)
n34 = cross(a23, a34)
n12 = n12 / length(n12)
n34 = n34 / length(n34)
cross... | [
"def",
"calc_torsion_angle",
"(",
"a1",
",",
"a2",
",",
"a3",
",",
"a4",
")",
":",
"if",
"a1",
"==",
"None",
"or",
"a2",
"==",
"None",
"or",
"a3",
"==",
"None",
"or",
"a4",
"==",
"None",
":",
"return",
"None",
"a12",
"=",
"a2",
".",
"position",
... | Calculates the torsion angle between the four argument atoms. | [
"Calculates",
"the",
"torsion",
"angle",
"between",
"the",
"four",
"argument",
"atoms",
"."
] | [
"\"\"\"Calculates the torsion angle between the four argument atoms.\"\"\""
] | [
{
"param": "a1",
"type": null
},
{
"param": "a2",
"type": null
},
{
"param": "a3",
"type": null
},
{
"param": "a4",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "a2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | UnitvecToDegree | <not_specific> | def UnitvecToDegree(gltilt,glroll,glangle):
"""Calculate orientation of global angle in Euler angle space"""
ftilt = cmp(gltilt,0)
froll = cmp(glroll,0)
orient1 = math.degrees(math.acos(pow((gltilt/glangle),2)*ftilt))
orient2 = math.degrees(math.acos(pow((glroll/glangle),2)*froll))
if ftilt == 1 and froll... | Calculate orientation of global angle in Euler angle space | Calculate orientation of global angle in Euler angle space | [
"Calculate",
"orientation",
"of",
"global",
"angle",
"in",
"Euler",
"angle",
"space"
] | def UnitvecToDegree(gltilt,glroll,glangle):
ftilt = cmp(gltilt,0)
froll = cmp(glroll,0)
orient1 = math.degrees(math.acos(pow((gltilt/glangle),2)*ftilt))
orient2 = math.degrees(math.acos(pow((glroll/glangle),2)*froll))
if ftilt == 1 and froll == 1:
return orient1
elif ftilt == -1 and froll == 1:
return orient1... | [
"def",
"UnitvecToDegree",
"(",
"gltilt",
",",
"glroll",
",",
"glangle",
")",
":",
"ftilt",
"=",
"cmp",
"(",
"gltilt",
",",
"0",
")",
"froll",
"=",
"cmp",
"(",
"glroll",
",",
"0",
")",
"orient1",
"=",
"math",
".",
"degrees",
"(",
"math",
".",
"acos"... | Calculate orientation of global angle in Euler angle space | [
"Calculate",
"orientation",
"of",
"global",
"angle",
"in",
"Euler",
"angle",
"space"
] | [
"\"\"\"Calculate orientation of global angle in Euler angle space\"\"\""
] | [
{
"param": "gltilt",
"type": null
},
{
"param": "glroll",
"type": null
},
{
"param": "glangle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gltilt",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "glroll",
"type": null,
"docstring": null,
"docstring_tokens... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | DegreeToUnitvec | <not_specific> | def DegreeToUnitvec(angle):
"""Extract the contribution of global roll and tilt to the global angle by solving the unit cirkel equation"""
unitcirkel = []
unitcirkel.append(math.cos(math.radians(angle)))
unitcirkel.append(math.sin(math.radians(angle)))
return unitcirkel | Extract the contribution of global roll and tilt to the global angle by solving the unit cirkel equation | Extract the contribution of global roll and tilt to the global angle by solving the unit cirkel equation | [
"Extract",
"the",
"contribution",
"of",
"global",
"roll",
"and",
"tilt",
"to",
"the",
"global",
"angle",
"by",
"solving",
"the",
"unit",
"cirkel",
"equation"
] | def DegreeToUnitvec(angle):
unitcirkel = []
unitcirkel.append(math.cos(math.radians(angle)))
unitcirkel.append(math.sin(math.radians(angle)))
return unitcirkel | [
"def",
"DegreeToUnitvec",
"(",
"angle",
")",
":",
"unitcirkel",
"=",
"[",
"]",
"unitcirkel",
".",
"append",
"(",
"math",
".",
"cos",
"(",
"math",
".",
"radians",
"(",
"angle",
")",
")",
")",
"unitcirkel",
".",
"append",
"(",
"math",
".",
"sin",
"(",
... | Extract the contribution of global roll and tilt to the global angle by solving the unit cirkel equation | [
"Extract",
"the",
"contribution",
"of",
"global",
"roll",
"and",
"tilt",
"to",
"the",
"global",
"angle",
"by",
"solving",
"the",
"unit",
"cirkel",
"equation"
] | [
"\"\"\"Extract the contribution of global roll and tilt to the global angle by solving the unit cirkel equation\"\"\""
] | [
{
"param": "angle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "angle",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | AngleVector | <not_specific> | def AngleVector(angle,rcont,tcont):
"""Construct vector of global roll and tilt from global angle and contribution of roll and tilt to this angle"""
vector = []
vector.append((sqrt((pow(angle,2))*abs(rcont)))*cmp(rcont,0))
vector.append((sqrt((pow(angle,2))*abs(tcont)))*cmp(tcont,0))
return vector | Construct vector of global roll and tilt from global angle and contribution of roll and tilt to this angle | Construct vector of global roll and tilt from global angle and contribution of roll and tilt to this angle | [
"Construct",
"vector",
"of",
"global",
"roll",
"and",
"tilt",
"from",
"global",
"angle",
"and",
"contribution",
"of",
"roll",
"and",
"tilt",
"to",
"this",
"angle"
] | def AngleVector(angle,rcont,tcont):
vector = []
vector.append((sqrt((pow(angle,2))*abs(rcont)))*cmp(rcont,0))
vector.append((sqrt((pow(angle,2))*abs(tcont)))*cmp(tcont,0))
return vector | [
"def",
"AngleVector",
"(",
"angle",
",",
"rcont",
",",
"tcont",
")",
":",
"vector",
"=",
"[",
"]",
"vector",
".",
"append",
"(",
"(",
"sqrt",
"(",
"(",
"pow",
"(",
"angle",
",",
"2",
")",
")",
"*",
"abs",
"(",
"rcont",
")",
")",
")",
"*",
"cm... | Construct vector of global roll and tilt from global angle and contribution of roll and tilt to this angle | [
"Construct",
"vector",
"of",
"global",
"roll",
"and",
"tilt",
"from",
"global",
"angle",
"and",
"contribution",
"of",
"roll",
"and",
"tilt",
"to",
"this",
"angle"
] | [
"\"\"\"Construct vector of global roll and tilt from global angle and contribution of roll and tilt to this angle\"\"\""
] | [
{
"param": "angle",
"type": null
},
{
"param": "rcont",
"type": null
},
{
"param": "tcont",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "angle",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "rcont",
"type": null,
"docstring": null,
"docstring_tokens":... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | AccTwist | <not_specific> | def AccTwist(refbp,twist):
"""Caclculates the accumulated twist relative to the reference base-pair.
The calculation procedure is different depending if the reference plane
lies on a base-pair or between two base-pairs
* If between base-pairs the basepair at "basenumber" of the reference... | Caclculates the accumulated twist relative to the reference base-pair.
The calculation procedure is different depending if the reference plane
lies on a base-pair or between two base-pairs
* If between base-pairs the basepair at "basenumber" of the reference
base-pair is duplicated and inserted at the... | Caclculates the accumulated twist relative to the reference base-pair. | [
"Caclculates",
"the",
"accumulated",
"twist",
"relative",
"to",
"the",
"reference",
"base",
"-",
"pair",
"."
] | def AccTwist(refbp,twist):
base = int(refbp)
frup = refbp-base
frdw = 1-frup
if frup == 0:
v1up = twist[0:base]
v1dw = twist[base:len(twist)]
v1dw[0] = 0.0
v1up.reverse()
v1arrup = array(v1up)
accup = add.accumulate(v1arrup)
v1arrdw = array(v1dw)
accdw = subtract.accumul... | [
"def",
"AccTwist",
"(",
"refbp",
",",
"twist",
")",
":",
"base",
"=",
"int",
"(",
"refbp",
")",
"frup",
"=",
"refbp",
"-",
"base",
"frdw",
"=",
"1",
"-",
"frup",
"if",
"frup",
"==",
"0",
":",
"v1up",
"=",
"twist",
"[",
"0",
":",
"base",
"]",
... | Caclculates the accumulated twist relative to the reference base-pair. | [
"Caclculates",
"the",
"accumulated",
"twist",
"relative",
"to",
"the",
"reference",
"base",
"-",
"pair",
"."
] | [
"\"\"\"Caclculates the accumulated twist relative to the reference base-pair.\n\t The calculation procedure is different depending if the reference plane\n\t lies on a base-pair or between two base-pairs\n\t * If between base-pairs the basepair at \"basenumber\" of the reference\n\t base-pair is duplicate... | [
{
"param": "refbp",
"type": null
},
{
"param": "twist",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "refbp",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "twist",
"type": null,
"docstring": null,
"docstring_tokens":... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | TwistCorrect | <not_specific> | def TwistCorrect(acctwist,glangles):
"""TwistCorrect corrects the global direction of the bend angle at each base-pair step for
the twist angle by adding/substracting values for accumulated twist from the reference
base-pair"""
corrected = []
for angle in range(len(glangles)):
corrected.append(glangl... | TwistCorrect corrects the global direction of the bend angle at each base-pair step for
the twist angle by adding/substracting values for accumulated twist from the reference
base-pair | TwistCorrect corrects the global direction of the bend angle at each base-pair step for
the twist angle by adding/substracting values for accumulated twist from the reference
base-pair | [
"TwistCorrect",
"corrects",
"the",
"global",
"direction",
"of",
"the",
"bend",
"angle",
"at",
"each",
"base",
"-",
"pair",
"step",
"for",
"the",
"twist",
"angle",
"by",
"adding",
"/",
"substracting",
"values",
"for",
"accumulated",
"twist",
"from",
"the",
"r... | def TwistCorrect(acctwist,glangles):
corrected = []
for angle in range(len(glangles)):
corrected.append(glangles[angle]+acctwist[angle])
return corrected | [
"def",
"TwistCorrect",
"(",
"acctwist",
",",
"glangles",
")",
":",
"corrected",
"=",
"[",
"]",
"for",
"angle",
"in",
"range",
"(",
"len",
"(",
"glangles",
")",
")",
":",
"corrected",
".",
"append",
"(",
"glangles",
"[",
"angle",
"]",
"+",
"acctwist",
... | TwistCorrect corrects the global direction of the bend angle at each base-pair step for
the twist angle by adding/substracting values for accumulated twist from the reference
base-pair | [
"TwistCorrect",
"corrects",
"the",
"global",
"direction",
"of",
"the",
"bend",
"angle",
"at",
"each",
"base",
"-",
"pair",
"step",
"for",
"the",
"twist",
"angle",
"by",
"adding",
"/",
"substracting",
"values",
"for",
"accumulated",
"twist",
"from",
"the",
"r... | [
"\"\"\"TwistCorrect corrects the global direction of the bend angle at each base-pair step for\n\t the twist angle by adding/substracting values for accumulated twist from the reference \n\t base-pair\"\"\""
] | [
{
"param": "acctwist",
"type": null
},
{
"param": "glangles",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "acctwist",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "glangles",
"type": null,
"docstring": null,
"docstring_to... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | CalculateDistance | <not_specific> | def CalculateDistance(vector1,vector2):
"""Calculate the distance between two vectors"""
d= float(0)
if len(vector1) == len(vector2):
for i in range(len(vector1)):
d=d+(vector1[i]-vector2[i])**2
d=math.sqrt(d)
return d
else:
return None | Calculate the distance between two vectors | Calculate the distance between two vectors | [
"Calculate",
"the",
"distance",
"between",
"two",
"vectors"
] | def CalculateDistance(vector1,vector2):
d= float(0)
if len(vector1) == len(vector2):
for i in range(len(vector1)):
d=d+(vector1[i]-vector2[i])**2
d=math.sqrt(d)
return d
else:
return None | [
"def",
"CalculateDistance",
"(",
"vector1",
",",
"vector2",
")",
":",
"d",
"=",
"float",
"(",
"0",
")",
"if",
"len",
"(",
"vector1",
")",
"==",
"len",
"(",
"vector2",
")",
":",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"vector1",
")",
")",
":",... | Calculate the distance between two vectors | [
"Calculate",
"the",
"distance",
"between",
"two",
"vectors"
] | [
"\"\"\"Calculate the distance between two vectors\"\"\""
] | [
{
"param": "vector1",
"type": null
},
{
"param": "vector2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "vector1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "vector2",
"type": null,
"docstring": null,
"docstring_toke... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | Angle | <not_specific> | def Angle(v1, v2):
"""Calculate angle of vector from two vectors"""
a = array(v1)
b = array(v2)
return sqrt((power(a,2))+(power(b,2))) | Calculate angle of vector from two vectors | Calculate angle of vector from two vectors | [
"Calculate",
"angle",
"of",
"vector",
"from",
"two",
"vectors"
] | def Angle(v1, v2):
a = array(v1)
b = array(v2)
return sqrt((power(a,2))+(power(b,2))) | [
"def",
"Angle",
"(",
"v1",
",",
"v2",
")",
":",
"a",
"=",
"array",
"(",
"v1",
")",
"b",
"=",
"array",
"(",
"v2",
")",
"return",
"sqrt",
"(",
"(",
"power",
"(",
"a",
",",
"2",
")",
")",
"+",
"(",
"power",
"(",
"b",
",",
"2",
")",
")",
")... | Calculate angle of vector from two vectors | [
"Calculate",
"angle",
"of",
"vector",
"from",
"two",
"vectors"
] | [
"\"\"\"Calculate angle of vector from two vectors\"\"\""
] | [
{
"param": "v1",
"type": null
},
{
"param": "v2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "v1",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "v2",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _MakeCapital | <not_specific> | def _MakeCapital(self,seq):
"""Capitalise letters of sequence input, string or list"""
capital = []
if type(seq) == type(''):
for n in seq:
capital.append(n.upper())
elif type(seq) == type([]):
for seq in seq:
capital.append(seq.upper())
else:
pass
return capital | Capitalise letters of sequence input, string or list | Capitalise letters of sequence input, string or list | [
"Capitalise",
"letters",
"of",
"sequence",
"input",
"string",
"or",
"list"
] | def _MakeCapital(self,seq):
capital = []
if type(seq) == type(''):
for n in seq:
capital.append(n.upper())
elif type(seq) == type([]):
for seq in seq:
capital.append(seq.upper())
else:
pass
return capital | [
"def",
"_MakeCapital",
"(",
"self",
",",
"seq",
")",
":",
"capital",
"=",
"[",
"]",
"if",
"type",
"(",
"seq",
")",
"==",
"type",
"(",
"''",
")",
":",
"for",
"n",
"in",
"seq",
":",
"capital",
".",
"append",
"(",
"n",
".",
"upper",
"(",
")",
")... | Capitalise letters of sequence input, string or list | [
"Capitalise",
"letters",
"of",
"sequence",
"input",
"string",
"or",
"list"
] | [
"\"\"\"Capitalise letters of sequence input, string or list\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "seq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq",
"type": null,
"docstring": null,
"docstring_tokens": []... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _TypeCheck | null | def _TypeCheck(self,seq1,seq2):
"""Check if supplied sequence is base, basepair or basepair step"""
sequence = []
if not seq1 == None:
sequence.append(self._MakeCapital(seq1))
if not seq2 == None:
sequence.append(self._MakeCapital(seq2))
for na in sequence[0]:
tmp = []
for n in na:
... | Check if supplied sequence is base, basepair or basepair step | Check if supplied sequence is base, basepair or basepair step | [
"Check",
"if",
"supplied",
"sequence",
"is",
"base",
"basepair",
"or",
"basepair",
"step"
] | def _TypeCheck(self,seq1,seq2):
sequence = []
if not seq1 == None:
sequence.append(self._MakeCapital(seq1))
if not seq2 == None:
sequence.append(self._MakeCapital(seq2))
for na in sequence[0]:
tmp = []
for n in na:
tmp.append(n)
if '-' in tmp or '/' in tmp:
if len(tmp) == 3 or len(tmp) =... | [
"def",
"_TypeCheck",
"(",
"self",
",",
"seq1",
",",
"seq2",
")",
":",
"sequence",
"=",
"[",
"]",
"if",
"not",
"seq1",
"==",
"None",
":",
"sequence",
".",
"append",
"(",
"self",
".",
"_MakeCapital",
"(",
"seq1",
")",
")",
"if",
"not",
"seq2",
"==",
... | Check if supplied sequence is base, basepair or basepair step | [
"Check",
"if",
"supplied",
"sequence",
"is",
"base",
"basepair",
"or",
"basepair",
"step"
] | [
"\"\"\"Check if supplied sequence is base, basepair or basepair step\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "seq1",
"type": null
},
{
"param": "seq2",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "seq1",
"type": null,
"docstring": null,
"docstring_tokens": [... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _ToBaseOne | null | def _ToBaseOne(self,sequence):
"""Convert everything to two strands of one-letter code bases"""
template = []
complement = []
if self.type == 'base': #Convert three to one, make complementary strand
for resid in sequence[0]:
if resid in BASELIST3_T:
template.append(BASELIST1_T[BASELIST3_T... | Convert everything to two strands of one-letter code bases | Convert everything to two strands of one-letter code bases | [
"Convert",
"everything",
"to",
"two",
"strands",
"of",
"one",
"-",
"letter",
"code",
"bases"
] | def _ToBaseOne(self,sequence):
template = []
complement = []
if self.type == 'base':
for resid in sequence[0]:
if resid in BASELIST3_T:
template.append(BASELIST1_T[BASELIST3_T.index(resid)])
elif resid in BASELIST1_T:
template.append(resid)
if sequence[1]:
for resid in sequence[1]:
... | [
"def",
"_ToBaseOne",
"(",
"self",
",",
"sequence",
")",
":",
"template",
"=",
"[",
"]",
"complement",
"=",
"[",
"]",
"if",
"self",
".",
"type",
"==",
"'base'",
":",
"for",
"resid",
"in",
"sequence",
"[",
"0",
"]",
":",
"if",
"resid",
"in",
"BASELIS... | Convert everything to two strands of one-letter code bases | [
"Convert",
"everything",
"to",
"two",
"strands",
"of",
"one",
"-",
"letter",
"code",
"bases"
] | [
"\"\"\"Convert everything to two strands of one-letter code bases\"\"\"",
"#Convert three to one, make complementary strand",
"#Convert base-pair three to one. Conserve template and complement"
] | [
{
"param": "self",
"type": null
},
{
"param": "sequence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "sequence",
"type": null,
"docstring": null,
"docstring_tokens... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _ToBaseThree | <not_specific> | def _ToBaseThree(self,inseq):
"""Convert nucleic acid one letter to three letter code. Input base"""
template = []
complement = []
for resid in inseq[0]:
if resid in BASELIST1_T:
template.append(BASELIST3_T[BASELIST1_T.index(resid)])
for resid in inseq[1]:
if resid in BASELIST1_T:
compl... | Convert nucleic acid one letter to three letter code. Input base | Convert nucleic acid one letter to three letter code. Input base | [
"Convert",
"nucleic",
"acid",
"one",
"letter",
"to",
"three",
"letter",
"code",
".",
"Input",
"base"
] | def _ToBaseThree(self,inseq):
template = []
complement = []
for resid in inseq[0]:
if resid in BASELIST1_T:
template.append(BASELIST3_T[BASELIST1_T.index(resid)])
for resid in inseq[1]:
if resid in BASELIST1_T:
complement.append(BASELIST3_T[BASELIST1_T.index(resid)])
return template,complement | [
"def",
"_ToBaseThree",
"(",
"self",
",",
"inseq",
")",
":",
"template",
"=",
"[",
"]",
"complement",
"=",
"[",
"]",
"for",
"resid",
"in",
"inseq",
"[",
"0",
"]",
":",
"if",
"resid",
"in",
"BASELIST1_T",
":",
"template",
".",
"append",
"(",
"BASELIST3... | Convert nucleic acid one letter to three letter code. | [
"Convert",
"nucleic",
"acid",
"one",
"letter",
"to",
"three",
"letter",
"code",
"."
] | [
"\"\"\"Convert nucleic acid one letter to three letter code. Input base\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "inseq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inseq",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _ToBasepair | <not_specific> | def _ToBasepair(self,inseq):
"""Convert nucleic acid base to base-pair. Input list of bases"""
convert = []
for na in range(len(inseq[0])):
pair = []
pair.append(inseq[0][na])
pair.append('-')
pair.append(inseq[1][na])
pair = ''.join(pair)
convert.append(pair)
return convert | Convert nucleic acid base to base-pair. Input list of bases | Convert nucleic acid base to base-pair. Input list of bases | [
"Convert",
"nucleic",
"acid",
"base",
"to",
"base",
"-",
"pair",
".",
"Input",
"list",
"of",
"bases"
] | def _ToBasepair(self,inseq):
convert = []
for na in range(len(inseq[0])):
pair = []
pair.append(inseq[0][na])
pair.append('-')
pair.append(inseq[1][na])
pair = ''.join(pair)
convert.append(pair)
return convert | [
"def",
"_ToBasepair",
"(",
"self",
",",
"inseq",
")",
":",
"convert",
"=",
"[",
"]",
"for",
"na",
"in",
"range",
"(",
"len",
"(",
"inseq",
"[",
"0",
"]",
")",
")",
":",
"pair",
"=",
"[",
"]",
"pair",
".",
"append",
"(",
"inseq",
"[",
"0",
"]"... | Convert nucleic acid base to base-pair. | [
"Convert",
"nucleic",
"acid",
"base",
"to",
"base",
"-",
"pair",
"."
] | [
"\"\"\"Convert nucleic acid base to base-pair. Input list of bases\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "inseq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inseq",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | _ToBasepairstep | <not_specific> | def _ToBasepairstep(self,inseq):
"""Convert nucleic acid base to basepairstep. Input list of bases"""
convert = []
for na in range(len(inseq[0])):
try:
pair = []
pair.append(inseq[0][na])
pair.append(inseq[0][na+1])
pair.append('/')
pair.append(inseq[1][na+1])
pair.append(inseq... | Convert nucleic acid base to basepairstep. Input list of bases | Convert nucleic acid base to basepairstep. Input list of bases | [
"Convert",
"nucleic",
"acid",
"base",
"to",
"basepairstep",
".",
"Input",
"list",
"of",
"bases"
] | def _ToBasepairstep(self,inseq):
convert = []
for na in range(len(inseq[0])):
try:
pair = []
pair.append(inseq[0][na])
pair.append(inseq[0][na+1])
pair.append('/')
pair.append(inseq[1][na+1])
pair.append(inseq[1][na])
if len(pair) > 0:
pair = ''.join(pair)
convert.append(... | [
"def",
"_ToBasepairstep",
"(",
"self",
",",
"inseq",
")",
":",
"convert",
"=",
"[",
"]",
"for",
"na",
"in",
"range",
"(",
"len",
"(",
"inseq",
"[",
"0",
"]",
")",
")",
":",
"try",
":",
"pair",
"=",
"[",
"]",
"pair",
".",
"append",
"(",
"inseq",... | Convert nucleic acid base to basepairstep. | [
"Convert",
"nucleic",
"acid",
"base",
"to",
"basepairstep",
"."
] | [
"\"\"\"Convert nucleic acid base to basepairstep. Input list of bases\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "inseq",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inseq",
"type": null,
"docstring": null,
"docstring_tokens": ... |
dc7b122ded3c566edcc3f46278810d1828cea702 | LiYuzhu12138/3D-DART-server | 3d-dart/server/system/NAfunctionLib.py | [
"Apache-2.0"
] | Python | Export | <not_specific> | def Export(self,exptype):
"""Export control module, export options are base1,base3,pair1,pair3,step1,step3"""
if exptype == 'base1':
return self.input
elif exptype == 'base3':
return self._ToBaseThree(self.input)
elif exptype == 'pair1':
return self._ToBasepair(self.input)
elif exptype == 'pair3'... | Export control module, export options are base1,base3,pair1,pair3,step1,step3 | Export control module, export options are base1,base3,pair1,pair3,step1,step3 | [
"Export",
"control",
"module",
"export",
"options",
"are",
"base1",
"base3",
"pair1",
"pair3",
"step1",
"step3"
] | def Export(self,exptype):
if exptype == 'base1':
return self.input
elif exptype == 'base3':
return self._ToBaseThree(self.input)
elif exptype == 'pair1':
return self._ToBasepair(self.input)
elif exptype == 'pair3':
return self._ToBasepair(self._ToBaseThree(self.input))
elif exptype == 'step1':
... | [
"def",
"Export",
"(",
"self",
",",
"exptype",
")",
":",
"if",
"exptype",
"==",
"'base1'",
":",
"return",
"self",
".",
"input",
"elif",
"exptype",
"==",
"'base3'",
":",
"return",
"self",
".",
"_ToBaseThree",
"(",
"self",
".",
"input",
")",
"elif",
"expt... | Export control module, export options are base1,base3,pair1,pair3,step1,step3 | [
"Export",
"control",
"module",
"export",
"options",
"are",
"base1",
"base3",
"pair1",
"pair3",
"step1",
"step3"
] | [
"\"\"\"Export control module, export options are base1,base3,pair1,pair3,step1,step3\"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "exptype",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "exptype",
"type": null,
"docstring": null,
"docstring_tokens"... |
6e0163db657a4acf8df43c0074a940c40a0f8544 | ahmednader10/TravelBuddy-Rest-Bot | bot.py | [
"MIT"
] | Python | check_for_greeting | <not_specific> | def check_for_greeting(sentence):
"""If any of the words in the user's input was a greeting, return a greeting response"""
for word in sentence.words:
if word.lower() in greetings:
return True | If any of the words in the user's input was a greeting, return a greeting response | If any of the words in the user's input was a greeting, return a greeting response | [
"If",
"any",
"of",
"the",
"words",
"in",
"the",
"user",
"'",
"s",
"input",
"was",
"a",
"greeting",
"return",
"a",
"greeting",
"response"
] | def check_for_greeting(sentence):
for word in sentence.words:
if word.lower() in greetings:
return True | [
"def",
"check_for_greeting",
"(",
"sentence",
")",
":",
"for",
"word",
"in",
"sentence",
".",
"words",
":",
"if",
"word",
".",
"lower",
"(",
")",
"in",
"greetings",
":",
"return",
"True"
] | If any of the words in the user's input was a greeting, return a greeting response | [
"If",
"any",
"of",
"the",
"words",
"in",
"the",
"user",
"'",
"s",
"input",
"was",
"a",
"greeting",
"return",
"a",
"greeting",
"response"
] | [
"\"\"\"If any of the words in the user's input was a greeting, return a greeting response\"\"\""
] | [
{
"param": "sentence",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sentence",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6101efd0595a70f66a1dd4fb70a08fe58dd61b42 | samitshah1/daterecognition | daterecognition/parser.py | [
"MIT"
] | Python | find_repeat_matches | <not_specific> | def find_repeat_matches(self, query_string, sub_string, pattern):
"Find duplicate dates in same string"
qs = copy.deepcopy(query_string)
ret_list = []
while True:
orig_string = copy.deepcopy(qs)
flag = False
if sub_string in orig_string:
... | Find duplicate dates in same string | Find duplicate dates in same string | [
"Find",
"duplicate",
"dates",
"in",
"same",
"string"
] | def find_repeat_matches(self, query_string, sub_string, pattern):
qs = copy.deepcopy(query_string)
ret_list = []
while True:
orig_string = copy.deepcopy(qs)
flag = False
if sub_string in orig_string:
ret_list.append((sub_string, orig_string.ind... | [
"def",
"find_repeat_matches",
"(",
"self",
",",
"query_string",
",",
"sub_string",
",",
"pattern",
")",
":",
"qs",
"=",
"copy",
".",
"deepcopy",
"(",
"query_string",
")",
"ret_list",
"=",
"[",
"]",
"while",
"True",
":",
"orig_string",
"=",
"copy",
".",
"... | Find duplicate dates in same string | [
"Find",
"duplicate",
"dates",
"in",
"same",
"string"
] | [
"\"Find duplicate dates in same string\""
] | [
{
"param": "self",
"type": null
},
{
"param": "query_string",
"type": null
},
{
"param": "sub_string",
"type": null
},
{
"param": "pattern",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "query_string",
"type": null,
"docstring": null,
"docstring_to... |
6101efd0595a70f66a1dd4fb70a08fe58dd61b42 | samitshah1/daterecognition | daterecognition/parser.py | [
"MIT"
] | Python | parse_string | <not_specific> | def parse_string(self, query_string):
"""
Method to parse string and extract dates
"""
query_string = query_string.lower()
matches = {}
for k in self.patterns:
for v in self.patterns[k]:
if v in query_string:
if k not in... |
Method to parse string and extract dates
| Method to parse string and extract dates | [
"Method",
"to",
"parse",
"string",
"and",
"extract",
"dates"
] | def parse_string(self, query_string):
query_string = query_string.lower()
matches = {}
for k in self.patterns:
for v in self.patterns[k]:
if v in query_string:
if k not in matches:
matches[k] = []
matches... | [
"def",
"parse_string",
"(",
"self",
",",
"query_string",
")",
":",
"query_string",
"=",
"query_string",
".",
"lower",
"(",
")",
"matches",
"=",
"{",
"}",
"for",
"k",
"in",
"self",
".",
"patterns",
":",
"for",
"v",
"in",
"self",
".",
"patterns",
"[",
... | Method to parse string and extract dates | [
"Method",
"to",
"parse",
"string",
"and",
"extract",
"dates"
] | [
"\"\"\"\n Method to parse string and extract dates\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "query_string",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "query_string",
"type": null,
"docstring": null,
"docstring_to... |
6101efd0595a70f66a1dd4fb70a08fe58dd61b42 | samitshah1/daterecognition | daterecognition/parser.py | [
"MIT"
] | Python | priority_matches | <not_specific> | def priority_matches(self, matches):
"Find longer format substring matches if a substring matches multiple formats"
unique_found_formats = []
found_formats = matches.keys()
found_formats = sorted(
found_formats, key=lambda x: len(x), reverse=True)
for f in found_forma... | Find longer format substring matches if a substring matches multiple formats | Find longer format substring matches if a substring matches multiple formats | [
"Find",
"longer",
"format",
"substring",
"matches",
"if",
"a",
"substring",
"matches",
"multiple",
"formats"
] | def priority_matches(self, matches):
unique_found_formats = []
found_formats = matches.keys()
found_formats = sorted(
found_formats, key=lambda x: len(x), reverse=True)
for f in found_formats:
flag = False
for uf in unique_found_formats:
... | [
"def",
"priority_matches",
"(",
"self",
",",
"matches",
")",
":",
"unique_found_formats",
"=",
"[",
"]",
"found_formats",
"=",
"matches",
".",
"keys",
"(",
")",
"found_formats",
"=",
"sorted",
"(",
"found_formats",
",",
"key",
"=",
"lambda",
"x",
":",
"len... | Find longer format substring matches if a substring matches multiple formats | [
"Find",
"longer",
"format",
"substring",
"matches",
"if",
"a",
"substring",
"matches",
"multiple",
"formats"
] | [
"\"Find longer format substring matches if a substring matches multiple formats\""
] | [
{
"param": "self",
"type": null
},
{
"param": "matches",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "matches",
"type": null,
"docstring": null,
"docstring_tokens"... |
7e24a40d3a34fa9610810b7c254c984939348a45 | sbrugman/PhiK | setup.py | [
"Apache-2.0"
] | Python | write_version_py | None | def write_version_py(filename: str = 'python/phik/version.py') -> None:
"""Write package version to version.py.
This will ensure that the version in version.py is in sync with us.
:param filename: The version.py to write too.
:type filename: str
:return:
:rtype: None
"""
# Do not modif... | Write package version to version.py.
This will ensure that the version in version.py is in sync with us.
:param filename: The version.py to write too.
:type filename: str
:return:
:rtype: None
| Write package version to version.py.
This will ensure that the version in version.py is in sync with us. | [
"Write",
"package",
"version",
"to",
"version",
".",
"py",
".",
"This",
"will",
"ensure",
"that",
"the",
"version",
"in",
"version",
".",
"py",
"is",
"in",
"sync",
"with",
"us",
"."
] | def write_version_py(filename: str = 'python/phik/version.py') -> None:
version_str = """\"\"\"THIS FILE IS AUTO-GENERATED BY PHIK SETUP.PY.\"\"\"
name = '{name!s}'
version = '{version!s}'
full_version = '{full_version!s}'
release = {is_release!s}
"""
with open(filename, 'w') as version_file:
version_fi... | [
"def",
"write_version_py",
"(",
"filename",
":",
"str",
"=",
"'python/phik/version.py'",
")",
"->",
"None",
":",
"version_str",
"=",
"\"\"\"\\\"\\\"\\\"THIS FILE IS AUTO-GENERATED BY PHIK SETUP.PY.\\\"\\\"\\\"\n\nname = '{name!s}'\nversion = '{version!s}'\nfull_version = '{full_version!s... | Write package version to version.py. | [
"Write",
"package",
"version",
"to",
"version",
".",
"py",
"."
] | [
"\"\"\"Write package version to version.py.\n\n This will ensure that the version in version.py is in sync with us.\n\n :param filename: The version.py to write too.\n :type filename: str\n :return:\n :rtype: None\n \"\"\"",
"# Do not modify the indentation of version_str!"
] | [
{
"param": "filename",
"type": "str"
}
] | {
"returns": [
{
"docstring": null,
"docstring_tokens": [
"None"
],
"type": "None"
}
],
"raises": [],
"params": [
{
"identifier": "filename",
"type": "str",
"docstring": "The version.py to write too.",
"docstring_tokens": [
"The",
... |
ff0fbb2b38ad9f67a89ec08a3c34102358ac9f14 | andenixa/pyengine | engine.py | [
"MIT"
] | Python | on_quit | null | def on_quit(self, f_cb):
""" set on quit callback
Note: return False to postpone quitting
"""
self._on_quit_cb = types.MethodType(f_cb, self) | set on quit callback
Note: return False to postpone quitting
| set on quit callback
Note: return False to postpone quitting | [
"set",
"on",
"quit",
"callback",
"Note",
":",
"return",
"False",
"to",
"postpone",
"quitting"
] | def on_quit(self, f_cb):
self._on_quit_cb = types.MethodType(f_cb, self) | [
"def",
"on_quit",
"(",
"self",
",",
"f_cb",
")",
":",
"self",
".",
"_on_quit_cb",
"=",
"types",
".",
"MethodType",
"(",
"f_cb",
",",
"self",
")"
] | set on quit callback
Note: return False to postpone quitting | [
"set",
"on",
"quit",
"callback",
"Note",
":",
"return",
"False",
"to",
"postpone",
"quitting"
] | [
"\"\"\" set on quit callback\r\n Note: return False to postpone quitting\r\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f_cb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f_cb",
"type": null,
"docstring": null,
"docstring_tokens": [... |
ff0fbb2b38ad9f67a89ec08a3c34102358ac9f14 | andenixa/pyengine | engine.py | [
"MIT"
] | Python | pause_event | null | def pause_event(self, event_id):
""" pause user event timer from firing """
if not event_id in self._events:
raise ValueError('only user events can be paused')
event = self._events[event_id]
pygame.time.set_timer(event_id, 0) | pause user event timer from firing | pause user event timer from firing | [
"pause",
"user",
"event",
"timer",
"from",
"firing"
] | def pause_event(self, event_id):
if not event_id in self._events:
raise ValueError('only user events can be paused')
event = self._events[event_id]
pygame.time.set_timer(event_id, 0) | [
"def",
"pause_event",
"(",
"self",
",",
"event_id",
")",
":",
"if",
"not",
"event_id",
"in",
"self",
".",
"_events",
":",
"raise",
"ValueError",
"(",
"'only user events can be paused'",
")",
"event",
"=",
"self",
".",
"_events",
"[",
"event_id",
"]",
"pygame... | pause user event timer from firing | [
"pause",
"user",
"event",
"timer",
"from",
"firing"
] | [
"\"\"\" pause user event timer from firing \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "event_id",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "event_id",
"type": null,
"docstring": null,
"docstring_tokens... |
ff0fbb2b38ad9f67a89ec08a3c34102358ac9f14 | andenixa/pyengine | engine.py | [
"MIT"
] | Python | _dispatch_events | null | def _dispatch_events(self):
""" default engine's event dispatched that would also call
a cutsom event handler cb here
"""
for event in pygame.event.get():
if event.type == pygame.QUIT:
if self._on_quit_cb is None or self._on_quit_cb(): ... | default engine's event dispatched that would also call
a cutsom event handler cb here
| default engine's event dispatched that would also call
a cutsom event handler cb here | [
"default",
"engine",
"'",
"s",
"event",
"dispatched",
"that",
"would",
"also",
"call",
"a",
"cutsom",
"event",
"handler",
"cb",
"here"
] | def _dispatch_events(self):
for event in pygame.event.get():
if event.type == pygame.QUIT:
if self._on_quit_cb is None or self._on_quit_cb():
self.quit()
if event.type==self.EVENT_ANIM_HEARTBEAT:
self._anim_timer += 1
... | [
"def",
"_dispatch_events",
"(",
"self",
")",
":",
"for",
"event",
"in",
"pygame",
".",
"event",
".",
"get",
"(",
")",
":",
"if",
"event",
".",
"type",
"==",
"pygame",
".",
"QUIT",
":",
"if",
"self",
".",
"_on_quit_cb",
"is",
"None",
"or",
"self",
"... | default engine's event dispatched that would also call
a cutsom event handler cb here | [
"default",
"engine",
"'",
"s",
"event",
"dispatched",
"that",
"would",
"also",
"call",
"a",
"cutsom",
"event",
"handler",
"cb",
"here"
] | [
"\"\"\" default engine's event dispatched that would also call\r\n a cutsom event handler cb here\r\n \"\"\"",
"#self._selected_control_old = self._selected_control\r",
"# if event.type==self._EVENT_CAPTURE_FRAME:\r",
"# pass\r"
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | project25d | <not_specific> | def project25d(wx, wy, wz, win_width, win_height, fov=90.0, viewer_distance=0):
""" Transforms this 3D point to 2D using a perspective projection. """
factor = fov / (viewer_distance + wz)
x = wx * factor + win_width / 2
y = wy * factor + win_height / 2
return int(x), int(y) | Transforms this 3D point to 2D using a perspective projection. | Transforms this 3D point to 2D using a perspective projection. | [
"Transforms",
"this",
"3D",
"point",
"to",
"2D",
"using",
"a",
"perspective",
"projection",
"."
] | def project25d(wx, wy, wz, win_width, win_height, fov=90.0, viewer_distance=0):
factor = fov / (viewer_distance + wz)
x = wx * factor + win_width / 2
y = wy * factor + win_height / 2
return int(x), int(y) | [
"def",
"project25d",
"(",
"wx",
",",
"wy",
",",
"wz",
",",
"win_width",
",",
"win_height",
",",
"fov",
"=",
"90.0",
",",
"viewer_distance",
"=",
"0",
")",
":",
"factor",
"=",
"fov",
"/",
"(",
"viewer_distance",
"+",
"wz",
")",
"x",
"=",
"wx",
"*",
... | Transforms this 3D point to 2D using a perspective projection. | [
"Transforms",
"this",
"3D",
"point",
"to",
"2D",
"using",
"a",
"perspective",
"projection",
"."
] | [
"\"\"\" Transforms this 3D point to 2D using a perspective projection. \"\"\""
] | [
{
"param": "wx",
"type": null
},
{
"param": "wy",
"type": null
},
{
"param": "wz",
"type": null
},
{
"param": "win_width",
"type": null
},
{
"param": "win_height",
"type": null
},
{
"param": "fov",
"type": null
},
{
"param": "viewer_distanc... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wy",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | project25dAlt | <not_specific> | def project25dAlt(wx, wy, wz, win_width, win_height, worldScale = 1.0):
""" Project 3d coords into 2d plane (screen)
"""
## I used the idea and the algorythm at:
## http://www.inversereality.org/tutorials/graphics%20programming/3dprojection.html
if wz == 0:
OneOverZ = 0
... | Project 3d coords into 2d plane (screen)
| Project 3d coords into 2d plane (screen) | [
"Project",
"3d",
"coords",
"into",
"2d",
"plane",
"(",
"screen",
")"
] | def project25dAlt(wx, wy, wz, win_width, win_height, worldScale = 1.0):
if wz == 0:
OneOverZ = 0
else:
OneOverZ = 1.0 / float(wz)
sx = (wx * worldScale * OneOverZ) + win_width / 2
sy = (wy * worldScale * OneOverZ) + win_height / 2
return int(sx), int(sy) | [
"def",
"project25dAlt",
"(",
"wx",
",",
"wy",
",",
"wz",
",",
"win_width",
",",
"win_height",
",",
"worldScale",
"=",
"1.0",
")",
":",
"if",
"wz",
"==",
"0",
":",
"OneOverZ",
"=",
"0",
"else",
":",
"OneOverZ",
"=",
"1.0",
"/",
"float",
"(",
"wz",
... | Project 3d coords into 2d plane (screen) | [
"Project",
"3d",
"coords",
"into",
"2d",
"plane",
"(",
"screen",
")"
] | [
"\"\"\" Project 3d coords into 2d plane (screen)\r\n \"\"\"",
"## I used the idea and the algorythm at: \r",
"## http://www.inversereality.org/tutorials/graphics%20programming/3dprojection.html \r"
] | [
{
"param": "wx",
"type": null
},
{
"param": "wy",
"type": null
},
{
"param": "wz",
"type": null
},
{
"param": "win_width",
"type": null
},
{
"param": "win_height",
"type": null
},
{
"param": "worldScale",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wx",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wy",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | pivot_rotation | <not_specific> | def pivot_rotation(surf, pivot_x, pivot_y, angle):
""" rotate pygame surface surf along specified pivot
"""
sprite_w, sprite_h = surf.get_size()
centerx = 0
centery = 0
pivot_c_x = pivot_x - sprite_w // 2
pivot_c_y = pivot_y - sprite_h // 2
new_center_x = centerx + pi... | rotate pygame surface surf along specified pivot
| rotate pygame surface surf along specified pivot | [
"rotate",
"pygame",
"surface",
"surf",
"along",
"specified",
"pivot"
] | def pivot_rotation(surf, pivot_x, pivot_y, angle):
sprite_w, sprite_h = surf.get_size()
centerx = 0
centery = 0
pivot_c_x = pivot_x - sprite_w // 2
pivot_c_y = pivot_y - sprite_h // 2
new_center_x = centerx + pivot_c_x
new_center_y = centery + pivot_c_y
c_off_x, c_off_y = rotate(pivo... | [
"def",
"pivot_rotation",
"(",
"surf",
",",
"pivot_x",
",",
"pivot_y",
",",
"angle",
")",
":",
"sprite_w",
",",
"sprite_h",
"=",
"surf",
".",
"get_size",
"(",
")",
"centerx",
"=",
"0",
"centery",
"=",
"0",
"pivot_c_x",
"=",
"pivot_x",
"-",
"sprite_w",
"... | rotate pygame surface surf along specified pivot | [
"rotate",
"pygame",
"surface",
"surf",
"along",
"specified",
"pivot"
] | [
"\"\"\" rotate pygame surface surf along specified pivot\r\n \"\"\""
] | [
{
"param": "surf",
"type": null
},
{
"param": "pivot_x",
"type": null
},
{
"param": "pivot_y",
"type": null
},
{
"param": "angle",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "surf",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pivot_x",
"type": null,
"docstring": null,
"docstring_tokens"... |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | blur | <not_specific> | def blur(a):
""" experimental, blurs an numpy array a """
kernel = np.array([[1.0,2.0,1.0], [2.0,4.0,2.0], [1.0,2.0,1.0]])
kernel = kernel / np.sum(kernel)
arraylist = []
for y in range(3):
temparray = np.copy(a)
temparray = np.roll(temparray, y - 1, axis=0)
for x in ... | experimental, blurs an numpy array a | experimental, blurs an numpy array a | [
"experimental",
"blurs",
"an",
"numpy",
"array",
"a"
] | def blur(a):
kernel = np.array([[1.0,2.0,1.0], [2.0,4.0,2.0], [1.0,2.0,1.0]])
kernel = kernel / np.sum(kernel)
arraylist = []
for y in range(3):
temparray = np.copy(a)
temparray = np.roll(temparray, y - 1, axis=0)
for x in range(3):
temparray_X = np.copy(temparray)
... | [
"def",
"blur",
"(",
"a",
")",
":",
"kernel",
"=",
"np",
".",
"array",
"(",
"[",
"[",
"1.0",
",",
"2.0",
",",
"1.0",
"]",
",",
"[",
"2.0",
",",
"4.0",
",",
"2.0",
"]",
",",
"[",
"1.0",
",",
"2.0",
",",
"1.0",
"]",
"]",
")",
"kernel",
"=",
... | experimental, blurs an numpy array a | [
"experimental",
"blurs",
"an",
"numpy",
"array",
"a"
] | [
"\"\"\" experimental, blurs an numpy array a \"\"\""
] | [
{
"param": "a",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | draw_shaded_frame | null | def draw_shaded_frame(surf, x, y, width, height, shade_color=None, light_color=None, mode=0):
""" draw a shaded frame (no middle)
used to draw many controls
"""
if shade_color is None:
shade_color = COLOR_FOREGROUND_DARK
if light_color is None:
light_color = COLOR_FOREGROU... | draw a shaded frame (no middle)
used to draw many controls
| draw a shaded frame (no middle)
used to draw many controls | [
"draw",
"a",
"shaded",
"frame",
"(",
"no",
"middle",
")",
"used",
"to",
"draw",
"many",
"controls"
] | def draw_shaded_frame(surf, x, y, width, height, shade_color=None, light_color=None, mode=0):
if shade_color is None:
shade_color = COLOR_FOREGROUND_DARK
if light_color is None:
light_color = COLOR_FOREGROUND_LIGHT
right = width + x
bottom = height + y
if mode & 1:
shade_col... | [
"def",
"draw_shaded_frame",
"(",
"surf",
",",
"x",
",",
"y",
",",
"width",
",",
"height",
",",
"shade_color",
"=",
"None",
",",
"light_color",
"=",
"None",
",",
"mode",
"=",
"0",
")",
":",
"if",
"shade_color",
"is",
"None",
":",
"shade_color",
"=",
"... | draw a shaded frame (no middle)
used to draw many controls | [
"draw",
"a",
"shaded",
"frame",
"(",
"no",
"middle",
")",
"used",
"to",
"draw",
"many",
"controls"
] | [
"\"\"\" draw a shaded frame (no middle)\r\n used to draw many controls\r\n \"\"\""
] | [
{
"param": "surf",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "width",
"type": null
},
{
"param": "height",
"type": null
},
{
"param": "shade_color",
"type": null
},
{
"param": "light_color",
... | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "surf",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
401d6e8fd65ab98228eec2234f74abca4ced40af | andenixa/pyengine | draw_utils.py | [
"MIT"
] | Python | flood_fill | null | def flood_fill(surf, f_x, f_y, color):
""" fill surface surf with specified color at f_x, f_y
"""
pixels = pygame.PixelArray(surf)
width, height = surf.get_size()
test_color = pixels[f_x, f_y]
color = pygame.Color(color)
color = (color.r, color.g, color.b)
stack = [... | fill surface surf with specified color at f_x, f_y
| fill surface surf with specified color at f_x, f_y | [
"fill",
"surface",
"surf",
"with",
"specified",
"color",
"at",
"f_x",
"f_y"
] | def flood_fill(surf, f_x, f_y, color):
pixels = pygame.PixelArray(surf)
width, height = surf.get_size()
test_color = pixels[f_x, f_y]
color = pygame.Color(color)
color = (color.r, color.g, color.b)
stack = []
stack.append((f_x, f_y))
while len(stack):
x, y = s... | [
"def",
"flood_fill",
"(",
"surf",
",",
"f_x",
",",
"f_y",
",",
"color",
")",
":",
"pixels",
"=",
"pygame",
".",
"PixelArray",
"(",
"surf",
")",
"width",
",",
"height",
"=",
"surf",
".",
"get_size",
"(",
")",
"test_color",
"=",
"pixels",
"[",
"f_x",
... | fill surface surf with specified color at f_x, f_y | [
"fill",
"surface",
"surf",
"with",
"specified",
"color",
"at",
"f_x",
"f_y"
] | [
"\"\"\" fill surface surf with specified color at f_x, f_y\r\n \"\"\"",
"# right\r",
"# left\r",
"# down\r"
] | [
{
"param": "surf",
"type": null
},
{
"param": "f_x",
"type": null
},
{
"param": "f_y",
"type": null
},
{
"param": "color",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "surf",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f_x",
"type": null,
"docstring": null,
"docstring_tokens": []... |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | pick_point | <not_specific> | def pick_point(px, py, x, y, size=2):
""" test if a vertex define by px, py, and size
can be clicked or dragged at x, y (commonly mouse position)
"""
return abs(x-px)<=size and abs(y-py)<=size | test if a vertex define by px, py, and size
can be clicked or dragged at x, y (commonly mouse position)
| test if a vertex define by px, py, and size
can be clicked or dragged at x, y (commonly mouse position) | [
"test",
"if",
"a",
"vertex",
"define",
"by",
"px",
"py",
"and",
"size",
"can",
"be",
"clicked",
"or",
"dragged",
"at",
"x",
"y",
"(",
"commonly",
"mouse",
"position",
")"
] | def pick_point(px, py, x, y, size=2):
return abs(x-px)<=size and abs(y-py)<=size | [
"def",
"pick_point",
"(",
"px",
",",
"py",
",",
"x",
",",
"y",
",",
"size",
"=",
"2",
")",
":",
"return",
"abs",
"(",
"x",
"-",
"px",
")",
"<=",
"size",
"and",
"abs",
"(",
"y",
"-",
"py",
")",
"<=",
"size"
] | test if a vertex define by px, py, and size
can be clicked or dragged at x, y (commonly mouse position) | [
"test",
"if",
"a",
"vertex",
"define",
"by",
"px",
"py",
"and",
"size",
"can",
"be",
"clicked",
"or",
"dragged",
"at",
"x",
"y",
"(",
"commonly",
"mouse",
"position",
")"
] | [
"\"\"\" test if a vertex define by px, py, and size\r\n can be clicked or dragged at x, y (commonly mouse position)\r\n \"\"\""
] | [
{
"param": "px",
"type": null
},
{
"param": "py",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "size",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "px",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "py",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | _make_iter | null | def _make_iter(self):
""" iterating over a layout only yields controls
"""
if not self._is_sorted:
self._items = sorted(self._items, key=lambda item: item._layer)
self._is_sorted = True
for item in self._items:
if isinstance(item, Base... | iterating over a layout only yields controls
| iterating over a layout only yields controls | [
"iterating",
"over",
"a",
"layout",
"only",
"yields",
"controls"
] | def _make_iter(self):
if not self._is_sorted:
self._items = sorted(self._items, key=lambda item: item._layer)
self._is_sorted = True
for item in self._items:
if isinstance(item, BaseControl):
if hasattr(item, "_controls"):
yield ite... | [
"def",
"_make_iter",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_is_sorted",
":",
"self",
".",
"_items",
"=",
"sorted",
"(",
"self",
".",
"_items",
",",
"key",
"=",
"lambda",
"item",
":",
"item",
".",
"_layer",
")",
"self",
".",
"_is_sorted",
... | iterating over a layout only yields controls | [
"iterating",
"over",
"a",
"layout",
"only",
"yields",
"controls"
] | [
"\"\"\" iterating over a layout only yields controls\r\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | cell_at_pos | <not_specific> | def cell_at_pos(self, x, y, boundry_checks=True):
""" get col, row and specified position x, y
"""
cell_col = (x - self._x) // self.cell_width
cell_row = (y - self._y) // self.cell_height
if boundry_checks and (cell_col<0 or cell_row<0 or cell_col>(self._cols-1) or cell_row>... | get col, row and specified position x, y
| get col, row and specified position x, y | [
"get",
"col",
"row",
"and",
"specified",
"position",
"x",
"y"
] | def cell_at_pos(self, x, y, boundry_checks=True):
cell_col = (x - self._x) // self.cell_width
cell_row = (y - self._y) // self.cell_height
if boundry_checks and (cell_col<0 or cell_row<0 or cell_col>(self._cols-1) or cell_row>(self._rows-1)):
return None
return cell_col, cell... | [
"def",
"cell_at_pos",
"(",
"self",
",",
"x",
",",
"y",
",",
"boundry_checks",
"=",
"True",
")",
":",
"cell_col",
"=",
"(",
"x",
"-",
"self",
".",
"_x",
")",
"//",
"self",
".",
"cell_width",
"cell_row",
"=",
"(",
"y",
"-",
"self",
".",
"_y",
")",
... | get col, row and specified position x, y | [
"get",
"col",
"row",
"and",
"specified",
"position",
"x",
"y"
] | [
"\"\"\" get col, row and specified position x, y\r\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "x",
"type": null
},
{
"param": "y",
"type": null
},
{
"param": "boundry_checks",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": null,
"docstring": null,
"docstring_tokens": [],
... |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | on_menu_item | null | def on_menu_item(self, f_cb):
""" property to assign on when menu item is clicked or
pushed by keyboard callback
"""
self._on_menu_item_cb = types.MethodType(f_cb, self) | property to assign on when menu item is clicked or
pushed by keyboard callback
| property to assign on when menu item is clicked or
pushed by keyboard callback | [
"property",
"to",
"assign",
"on",
"when",
"menu",
"item",
"is",
"clicked",
"or",
"pushed",
"by",
"keyboard",
"callback"
] | def on_menu_item(self, f_cb):
self._on_menu_item_cb = types.MethodType(f_cb, self) | [
"def",
"on_menu_item",
"(",
"self",
",",
"f_cb",
")",
":",
"self",
".",
"_on_menu_item_cb",
"=",
"types",
".",
"MethodType",
"(",
"f_cb",
",",
"self",
")"
] | property to assign on when menu item is clicked or
pushed by keyboard callback | [
"property",
"to",
"assign",
"on",
"when",
"menu",
"item",
"is",
"clicked",
"or",
"pushed",
"by",
"keyboard",
"callback"
] | [
"\"\"\" property to assign on when menu item is clicked or\r\n pushed by keyboard callback \r\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "f_cb",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "f_cb",
"type": null,
"docstring": null,
"docstring_tokens": [... |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | pushed | null | def pushed(self):
""" executes when the button is pushed
"""
if self._pushed_cb is not None:
self._pushed_cb() | executes when the button is pushed
| executes when the button is pushed | [
"executes",
"when",
"the",
"button",
"is",
"pushed"
] | def pushed(self):
if self._pushed_cb is not None:
self._pushed_cb() | [
"def",
"pushed",
"(",
"self",
")",
":",
"if",
"self",
".",
"_pushed_cb",
"is",
"not",
"None",
":",
"self",
".",
"_pushed_cb",
"(",
")"
] | executes when the button is pushed | [
"executes",
"when",
"the",
"button",
"is",
"pushed"
] | [
"\"\"\" executes when the button is pushed \r\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | value | <not_specific> | def value(self):
""" get control calculated value
note that you should probably use this one in your program
"""
v_range = self._max - self._min
value = ((v_range * self.pos) / (self.width-self._slider_rect()[2])) + self._min
return value | get control calculated value
note that you should probably use this one in your program
| get control calculated value
note that you should probably use this one in your program | [
"get",
"control",
"calculated",
"value",
"note",
"that",
"you",
"should",
"probably",
"use",
"this",
"one",
"in",
"your",
"program"
] | def value(self):
v_range = self._max - self._min
value = ((v_range * self.pos) / (self.width-self._slider_rect()[2])) + self._min
return value | [
"def",
"value",
"(",
"self",
")",
":",
"v_range",
"=",
"self",
".",
"_max",
"-",
"self",
".",
"_min",
"value",
"=",
"(",
"(",
"v_range",
"*",
"self",
".",
"pos",
")",
"/",
"(",
"self",
".",
"width",
"-",
"self",
".",
"_slider_rect",
"(",
")",
"... | get control calculated value
note that you should probably use this one in your program | [
"get",
"control",
"calculated",
"value",
"note",
"that",
"you",
"should",
"probably",
"use",
"this",
"one",
"in",
"your",
"program"
] | [
"\"\"\" get control calculated value\r\n note that you should probably use this one in your program\r\n \"\"\""
] | [
{
"param": "self",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
66349ed82861ca8e3cab54e5f3b3c939b6d360b3 | andenixa/pyengine | ui_controls.py | [
"MIT"
] | Python | _unscaled_text_width | <not_specific> | def _unscaled_text_width(self, text):
""" get not-scaled text width
"""
len_s = len(text)
return self._sprite_size[0]*len_s + self._text_spacing*len_s | get not-scaled text width
| get not-scaled text width | [
"get",
"not",
"-",
"scaled",
"text",
"width"
] | def _unscaled_text_width(self, text):
len_s = len(text)
return self._sprite_size[0]*len_s + self._text_spacing*len_s | [
"def",
"_unscaled_text_width",
"(",
"self",
",",
"text",
")",
":",
"len_s",
"=",
"len",
"(",
"text",
")",
"return",
"self",
".",
"_sprite_size",
"[",
"0",
"]",
"*",
"len_s",
"+",
"self",
".",
"_text_spacing",
"*",
"len_s"
] | get not-scaled text width | [
"get",
"not",
"-",
"scaled",
"text",
"width"
] | [
"\"\"\" get not-scaled text width\r\n \"\"\""
] | [
{
"param": "self",
"type": null
},
{
"param": "text",
"type": null
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "self",
"type": null,
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": null,
"docstring": null,
"docstring_tokens": [... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.