repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper.DownloadAccount | def DownloadAccount(self, next_page_token=None, max_results=None):
"""Downloads multiple accounts from Gitkit server.
Args:
next_page_token: string, pagination token.
max_results: pagination size.
Returns:
An array of accounts.
"""
param = {}
if next_page_token:
param['... | python | def DownloadAccount(self, next_page_token=None, max_results=None):
"""Downloads multiple accounts from Gitkit server.
Args:
next_page_token: string, pagination token.
max_results: pagination size.
Returns:
An array of accounts.
"""
param = {}
if next_page_token:
param['... | [
"def",
"DownloadAccount",
"(",
"self",
",",
"next_page_token",
"=",
"None",
",",
"max_results",
"=",
"None",
")",
":",
"param",
"=",
"{",
"}",
"if",
"next_page_token",
":",
"param",
"[",
"'nextPageToken'",
"]",
"=",
"next_page_token",
"if",
"max_results",
":... | Downloads multiple accounts from Gitkit server.
Args:
next_page_token: string, pagination token.
max_results: pagination size.
Returns:
An array of accounts. | [
"Downloads",
"multiple",
"accounts",
"from",
"Gitkit",
"server",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L109-L127 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper.UploadAccount | def UploadAccount(self, hash_algorithm, hash_key, accounts):
"""Uploads multiple accounts to Gitkit server.
Args:
hash_algorithm: string, algorithm to hash password.
hash_key: string, base64-encoded key of the algorithm.
accounts: array of accounts to be uploaded.
Returns:
Response... | python | def UploadAccount(self, hash_algorithm, hash_key, accounts):
"""Uploads multiple accounts to Gitkit server.
Args:
hash_algorithm: string, algorithm to hash password.
hash_key: string, base64-encoded key of the algorithm.
accounts: array of accounts to be uploaded.
Returns:
Response... | [
"def",
"UploadAccount",
"(",
"self",
",",
"hash_algorithm",
",",
"hash_key",
",",
"accounts",
")",
":",
"param",
"=",
"{",
"'hashAlgorithm'",
":",
"hash_algorithm",
",",
"'signerKey'",
":",
"hash_key",
",",
"'users'",
":",
"accounts",
"}",
"# pylint does not rec... | Uploads multiple accounts to Gitkit server.
Args:
hash_algorithm: string, algorithm to hash password.
hash_key: string, base64-encoded key of the algorithm.
accounts: array of accounts to be uploaded.
Returns:
Response of the API. | [
"Uploads",
"multiple",
"accounts",
"to",
"Gitkit",
"server",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L129-L147 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper.GetPublicCert | def GetPublicCert(self):
"""Download Gitkit public cert.
Returns:
dict of public certs.
"""
cert_url = self.google_api_url + 'publicKeys'
resp, content = self.http.request(cert_url)
if resp.status == 200:
return simplejson.loads(content)
else:
raise errors.GitkitServerEr... | python | def GetPublicCert(self):
"""Download Gitkit public cert.
Returns:
dict of public certs.
"""
cert_url = self.google_api_url + 'publicKeys'
resp, content = self.http.request(cert_url)
if resp.status == 200:
return simplejson.loads(content)
else:
raise errors.GitkitServerEr... | [
"def",
"GetPublicCert",
"(",
"self",
")",
":",
"cert_url",
"=",
"self",
".",
"google_api_url",
"+",
"'publicKeys'",
"resp",
",",
"content",
"=",
"self",
".",
"http",
".",
"request",
"(",
"cert_url",
")",
"if",
"resp",
".",
"status",
"==",
"200",
":",
"... | Download Gitkit public cert.
Returns:
dict of public certs. | [
"Download",
"Gitkit",
"public",
"cert",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L172-L186 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper._InvokeGitkitApi | def _InvokeGitkitApi(self, method, params=None, need_service_account=True):
"""Invokes Gitkit API, with optional access token for service account.
Args:
method: string, the api method name.
params: dict of optional parameters for the API.
need_service_account: false if service account is not ... | python | def _InvokeGitkitApi(self, method, params=None, need_service_account=True):
"""Invokes Gitkit API, with optional access token for service account.
Args:
method: string, the api method name.
params: dict of optional parameters for the API.
need_service_account: false if service account is not ... | [
"def",
"_InvokeGitkitApi",
"(",
"self",
",",
"method",
",",
"params",
"=",
"None",
",",
"need_service_account",
"=",
"True",
")",
":",
"body",
"=",
"simplejson",
".",
"dumps",
"(",
"params",
")",
"if",
"params",
"else",
"None",
"req",
"=",
"urllib_request"... | Invokes Gitkit API, with optional access token for service account.
Args:
method: string, the api method name.
params: dict of optional parameters for the API.
need_service_account: false if service account is not needed.
Raises:
GitkitClientError: if the request is bad.
GitkitSe... | [
"Invokes",
"Gitkit",
"API",
"with",
"optional",
"access",
"token",
"for",
"service",
"account",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L188-L222 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper._GetAccessToken | def _GetAccessToken(self):
"""Gets oauth2 access token for Gitkit API using service account.
Returns:
string, oauth2 access token.
"""
d = {
'assertion': self._GenerateAssertion(),
'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
}
try:
body = parse.url... | python | def _GetAccessToken(self):
"""Gets oauth2 access token for Gitkit API using service account.
Returns:
string, oauth2 access token.
"""
d = {
'assertion': self._GenerateAssertion(),
'grant_type': 'urn:ietf:params:oauth:grant-type:jwt-bearer',
}
try:
body = parse.url... | [
"def",
"_GetAccessToken",
"(",
"self",
")",
":",
"d",
"=",
"{",
"'assertion'",
":",
"self",
".",
"_GenerateAssertion",
"(",
")",
",",
"'grant_type'",
":",
"'urn:ietf:params:oauth:grant-type:jwt-bearer'",
",",
"}",
"try",
":",
"body",
"=",
"parse",
".",
"urlenc... | Gets oauth2 access token for Gitkit API using service account.
Returns:
string, oauth2 access token. | [
"Gets",
"oauth2",
"access",
"token",
"for",
"Gitkit",
"API",
"using",
"service",
"account",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L224-L242 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper._GenerateAssertion | def _GenerateAssertion(self):
"""Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion.
"""
now = int(time.time())
payload = {
'aud': RpcHelper.TOKEN_ENDPOINT,
'scope': 'https://www.googleapis.com/auth/identityt... | python | def _GenerateAssertion(self):
"""Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion.
"""
now = int(time.time())
payload = {
'aud': RpcHelper.TOKEN_ENDPOINT,
'scope': 'https://www.googleapis.com/auth/identityt... | [
"def",
"_GenerateAssertion",
"(",
"self",
")",
":",
"now",
"=",
"int",
"(",
"time",
".",
"time",
"(",
")",
")",
"payload",
"=",
"{",
"'aud'",
":",
"RpcHelper",
".",
"TOKEN_ENDPOINT",
",",
"'scope'",
":",
"'https://www.googleapis.com/auth/identitytoolkit'",
","... | Generates the signed assertion that will be used in the request.
Returns:
string, signed Json Web Token (JWT) assertion. | [
"Generates",
"the",
"signed",
"assertion",
"that",
"will",
"be",
"used",
"in",
"the",
"request",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L244-L260 |
google/identity-toolkit-python-client | identitytoolkit/rpchelper.py | RpcHelper._CheckGitkitError | def _CheckGitkitError(self, raw_response):
"""Raises error if API invocation failed.
Args:
raw_response: string, the http response.
Raises:
GitkitClientError: if the error code is 4xx.
GitkitServerError: if the response if malformed.
Returns:
Successful response as dict.
"... | python | def _CheckGitkitError(self, raw_response):
"""Raises error if API invocation failed.
Args:
raw_response: string, the http response.
Raises:
GitkitClientError: if the error code is 4xx.
GitkitServerError: if the response if malformed.
Returns:
Successful response as dict.
"... | [
"def",
"_CheckGitkitError",
"(",
"self",
",",
"raw_response",
")",
":",
"try",
":",
"response",
"=",
"simplejson",
".",
"loads",
"(",
"raw_response",
")",
"if",
"'error'",
"not",
"in",
"response",
":",
"return",
"response",
"else",
":",
"error",
"=",
"resp... | Raises error if API invocation failed.
Args:
raw_response: string, the http response.
Raises:
GitkitClientError: if the error code is 4xx.
GitkitServerError: if the response if malformed.
Returns:
Successful response as dict. | [
"Raises",
"error",
"if",
"API",
"invocation",
"failed",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/rpchelper.py#L262-L289 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitUser.FromDictionary | def FromDictionary(cls, dictionary):
"""Initializes from user specified dictionary.
Args:
dictionary: dict of user specified attributes
Returns:
GitkitUser object
"""
if 'user_id' in dictionary:
raise errors.GitkitClientError('use localId instead')
if 'localId' not in dictiona... | python | def FromDictionary(cls, dictionary):
"""Initializes from user specified dictionary.
Args:
dictionary: dict of user specified attributes
Returns:
GitkitUser object
"""
if 'user_id' in dictionary:
raise errors.GitkitClientError('use localId instead')
if 'localId' not in dictiona... | [
"def",
"FromDictionary",
"(",
"cls",
",",
"dictionary",
")",
":",
"if",
"'user_id'",
"in",
"dictionary",
":",
"raise",
"errors",
".",
"GitkitClientError",
"(",
"'use localId instead'",
")",
"if",
"'localId'",
"not",
"in",
"dictionary",
":",
"raise",
"errors",
... | Initializes from user specified dictionary.
Args:
dictionary: dict of user specified attributes
Returns:
GitkitUser object | [
"Initializes",
"from",
"user",
"specified",
"dictionary",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L118-L133 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitUser.ToRequest | def ToRequest(self):
"""Converts to gitkit api request parameter dict.
Returns:
Dict, containing non-empty user attributes.
"""
param = {}
if self.email:
param['email'] = self.email
if self.user_id:
param['localId'] = self.user_id
if self.name:
param['displayName'] =... | python | def ToRequest(self):
"""Converts to gitkit api request parameter dict.
Returns:
Dict, containing non-empty user attributes.
"""
param = {}
if self.email:
param['email'] = self.email
if self.user_id:
param['localId'] = self.user_id
if self.name:
param['displayName'] =... | [
"def",
"ToRequest",
"(",
"self",
")",
":",
"param",
"=",
"{",
"}",
"if",
"self",
".",
"email",
":",
"param",
"[",
"'email'",
"]",
"=",
"self",
".",
"email",
"if",
"self",
".",
"user_id",
":",
"param",
"[",
"'localId'",
"]",
"=",
"self",
".",
"use... | Converts to gitkit api request parameter dict.
Returns:
Dict, containing non-empty user attributes. | [
"Converts",
"to",
"gitkit",
"api",
"request",
"parameter",
"dict",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L135-L158 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.VerifyGitkitToken | def VerifyGitkitToken(self, jwt):
"""Verifies a Gitkit token string.
Args:
jwt: string, the token to be checked
Returns:
GitkitUser, if the token is valid. None otherwise.
"""
certs = self.rpc_helper.GetPublicCert()
crypt.MAX_TOKEN_LIFETIME_SECS = 30 * 86400 # 30 days
parsed =... | python | def VerifyGitkitToken(self, jwt):
"""Verifies a Gitkit token string.
Args:
jwt: string, the token to be checked
Returns:
GitkitUser, if the token is valid. None otherwise.
"""
certs = self.rpc_helper.GetPublicCert()
crypt.MAX_TOKEN_LIFETIME_SECS = 30 * 86400 # 30 days
parsed =... | [
"def",
"VerifyGitkitToken",
"(",
"self",
",",
"jwt",
")",
":",
"certs",
"=",
"self",
".",
"rpc_helper",
".",
"GetPublicCert",
"(",
")",
"crypt",
".",
"MAX_TOKEN_LIFETIME_SECS",
"=",
"30",
"*",
"86400",
"# 30 days",
"parsed",
"=",
"None",
"for",
"aud",
"in"... | Verifies a Gitkit token string.
Args:
jwt: string, the token to be checked
Returns:
GitkitUser, if the token is valid. None otherwise. | [
"Verifies",
"a",
"Gitkit",
"token",
"string",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L252-L272 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.GetUserByEmail | def GetUserByEmail(self, email):
"""Gets user info by email.
Args:
email: string, the user email.
Returns:
GitkitUser, containing the user info.
"""
user = self.rpc_helper.GetAccountInfoByEmail(email)
return GitkitUser.FromApiResponse(user) | python | def GetUserByEmail(self, email):
"""Gets user info by email.
Args:
email: string, the user email.
Returns:
GitkitUser, containing the user info.
"""
user = self.rpc_helper.GetAccountInfoByEmail(email)
return GitkitUser.FromApiResponse(user) | [
"def",
"GetUserByEmail",
"(",
"self",
",",
"email",
")",
":",
"user",
"=",
"self",
".",
"rpc_helper",
".",
"GetAccountInfoByEmail",
"(",
"email",
")",
"return",
"GitkitUser",
".",
"FromApiResponse",
"(",
"user",
")"
] | Gets user info by email.
Args:
email: string, the user email.
Returns:
GitkitUser, containing the user info. | [
"Gets",
"user",
"info",
"by",
"email",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L274-L284 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.GetUserById | def GetUserById(self, local_id):
"""Gets user info by id.
Args:
local_id: string, the user id at Gitkit server.
Returns:
GitkitUser, containing the user info.
"""
user = self.rpc_helper.GetAccountInfoById(local_id)
return GitkitUser.FromApiResponse(user) | python | def GetUserById(self, local_id):
"""Gets user info by id.
Args:
local_id: string, the user id at Gitkit server.
Returns:
GitkitUser, containing the user info.
"""
user = self.rpc_helper.GetAccountInfoById(local_id)
return GitkitUser.FromApiResponse(user) | [
"def",
"GetUserById",
"(",
"self",
",",
"local_id",
")",
":",
"user",
"=",
"self",
".",
"rpc_helper",
".",
"GetAccountInfoById",
"(",
"local_id",
")",
"return",
"GitkitUser",
".",
"FromApiResponse",
"(",
"user",
")"
] | Gets user info by id.
Args:
local_id: string, the user id at Gitkit server.
Returns:
GitkitUser, containing the user info. | [
"Gets",
"user",
"info",
"by",
"id",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L286-L296 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.UploadUsers | def UploadUsers(self, hash_algorithm, hash_key, accounts):
"""Uploads multiple users to Gitkit server.
Args:
hash_algorithm: string, the hash algorithm.
hash_key: array, raw key of the hash algorithm.
accounts: list of GitkitUser.
Returns:
A dict of failed accounts. The key is the ... | python | def UploadUsers(self, hash_algorithm, hash_key, accounts):
"""Uploads multiple users to Gitkit server.
Args:
hash_algorithm: string, the hash algorithm.
hash_key: array, raw key of the hash algorithm.
accounts: list of GitkitUser.
Returns:
A dict of failed accounts. The key is the ... | [
"def",
"UploadUsers",
"(",
"self",
",",
"hash_algorithm",
",",
"hash_key",
",",
"accounts",
")",
":",
"return",
"self",
".",
"rpc_helper",
".",
"UploadAccount",
"(",
"hash_algorithm",
",",
"base64",
".",
"urlsafe_b64encode",
"(",
"hash_key",
")",
",",
"[",
"... | Uploads multiple users to Gitkit server.
Args:
hash_algorithm: string, the hash algorithm.
hash_key: array, raw key of the hash algorithm.
accounts: list of GitkitUser.
Returns:
A dict of failed accounts. The key is the index of the 'accounts' list,
starting from 0. | [
"Uploads",
"multiple",
"users",
"to",
"Gitkit",
"server",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L298-L312 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.GetAllUsers | def GetAllUsers(self, pagination_size=10):
"""Gets all user info from Gitkit server.
Args:
pagination_size: int, how many users should be returned per request.
The account info are retrieved in pagination.
Yields:
A generator to iterate all users.
"""
next_page_token, account... | python | def GetAllUsers(self, pagination_size=10):
"""Gets all user info from Gitkit server.
Args:
pagination_size: int, how many users should be returned per request.
The account info are retrieved in pagination.
Yields:
A generator to iterate all users.
"""
next_page_token, account... | [
"def",
"GetAllUsers",
"(",
"self",
",",
"pagination_size",
"=",
"10",
")",
":",
"next_page_token",
",",
"accounts",
"=",
"self",
".",
"rpc_helper",
".",
"DownloadAccount",
"(",
"None",
",",
"pagination_size",
")",
"while",
"accounts",
":",
"for",
"account",
... | Gets all user info from Gitkit server.
Args:
pagination_size: int, how many users should be returned per request.
The account info are retrieved in pagination.
Yields:
A generator to iterate all users. | [
"Gets",
"all",
"user",
"info",
"from",
"Gitkit",
"server",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L314-L330 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient.GetOobResult | def GetOobResult(self, param, user_ip, gitkit_token=None):
"""Gets out-of-band code for ResetPassword/ChangeEmail request.
Args:
param: dict of HTTP POST params
user_ip: string, end user's IP address
gitkit_token: string, the gitkit token if user logged in
Returns:
A dict of {
... | python | def GetOobResult(self, param, user_ip, gitkit_token=None):
"""Gets out-of-band code for ResetPassword/ChangeEmail request.
Args:
param: dict of HTTP POST params
user_ip: string, end user's IP address
gitkit_token: string, the gitkit token if user logged in
Returns:
A dict of {
... | [
"def",
"GetOobResult",
"(",
"self",
",",
"param",
",",
"user_ip",
",",
"gitkit_token",
"=",
"None",
")",
":",
"if",
"'action'",
"in",
"param",
":",
"try",
":",
"if",
"param",
"[",
"'action'",
"]",
"==",
"GitkitClient",
".",
"RESET_PASSWORD_ACTION",
":",
... | Gets out-of-band code for ResetPassword/ChangeEmail request.
Args:
param: dict of HTTP POST params
user_ip: string, end user's IP address
gitkit_token: string, the gitkit token if user logged in
Returns:
A dict of {
email: user email who initializes the request
new_emai... | [
"Gets",
"out",
"-",
"of",
"-",
"band",
"code",
"for",
"ResetPassword",
"/",
"ChangeEmail",
"request",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L343-L390 |
google/identity-toolkit-python-client | identitytoolkit/gitkitclient.py | GitkitClient._BuildOobLink | def _BuildOobLink(self, param, mode):
"""Builds out-of-band URL.
Gitkit API GetOobCode() is called and the returning code is combined
with Gitkit widget URL to building the out-of-band url.
Args:
param: dict of request.
mode: string, Gitkit widget mode to handle the oob action after user
... | python | def _BuildOobLink(self, param, mode):
"""Builds out-of-band URL.
Gitkit API GetOobCode() is called and the returning code is combined
with Gitkit widget URL to building the out-of-band url.
Args:
param: dict of request.
mode: string, Gitkit widget mode to handle the oob action after user
... | [
"def",
"_BuildOobLink",
"(",
"self",
",",
"param",
",",
"mode",
")",
":",
"code",
"=",
"self",
".",
"rpc_helper",
".",
"GetOobCode",
"(",
"param",
")",
"if",
"code",
":",
"parsed",
"=",
"list",
"(",
"parse",
".",
"urlparse",
"(",
"self",
".",
"widget... | Builds out-of-band URL.
Gitkit API GetOobCode() is called and the returning code is combined
with Gitkit widget URL to building the out-of-band url.
Args:
param: dict of request.
mode: string, Gitkit widget mode to handle the oob action after user
clicks the oob url in the email.
... | [
"Builds",
"out",
"-",
"of",
"-",
"band",
"URL",
"."
] | train | https://github.com/google/identity-toolkit-python-client/blob/4cfe3013569c21576daa5d22ad21f9f4f8b30c4d/identitytoolkit/gitkitclient.py#L418-L448 |
OLC-Bioinformatics/ConFindr | confindr_src/wrappers/mash.py | run_subprocess | def run_subprocess(command):
"""
command is the command to run, as a string.
runs a subprocess, returns stdout and stderr from the subprocess as strings.
"""
x = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
out, err = x.communicate()
out = out.decode('utf-8')
err = err.decode('ut... | python | def run_subprocess(command):
"""
command is the command to run, as a string.
runs a subprocess, returns stdout and stderr from the subprocess as strings.
"""
x = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)
out, err = x.communicate()
out = out.decode('utf-8')
err = err.decode('ut... | [
"def",
"run_subprocess",
"(",
"command",
")",
":",
"x",
"=",
"Popen",
"(",
"command",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"PIPE",
",",
"stderr",
"=",
"PIPE",
")",
"out",
",",
"err",
"=",
"x",
".",
"communicate",
"(",
")",
"out",
"=",
"... | command is the command to run, as a string.
runs a subprocess, returns stdout and stderr from the subprocess as strings. | [
"command",
"is",
"the",
"command",
"to",
"run",
"as",
"a",
"string",
".",
"runs",
"a",
"subprocess",
"returns",
"stdout",
"and",
"stderr",
"from",
"the",
"subprocess",
"as",
"strings",
"."
] | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/mash.py#L5-L14 |
OLC-Bioinformatics/ConFindr | confindr_src/wrappers/mash.py | kwargs_to_string | def kwargs_to_string(kwargs):
"""
Given a set of kwargs, turns them into a string which can then be passed to a command.
:param kwargs: kwargs from a function call.
:return: outstr: A string, which is '' if no kwargs were given, and the kwargs in string format otherwise.
"""
outstr = ''
for ... | python | def kwargs_to_string(kwargs):
"""
Given a set of kwargs, turns them into a string which can then be passed to a command.
:param kwargs: kwargs from a function call.
:return: outstr: A string, which is '' if no kwargs were given, and the kwargs in string format otherwise.
"""
outstr = ''
for ... | [
"def",
"kwargs_to_string",
"(",
"kwargs",
")",
":",
"outstr",
"=",
"''",
"for",
"arg",
"in",
"kwargs",
":",
"outstr",
"+=",
"' -{} {}'",
".",
"format",
"(",
"arg",
",",
"kwargs",
"[",
"arg",
"]",
")",
"return",
"outstr"
] | Given a set of kwargs, turns them into a string which can then be passed to a command.
:param kwargs: kwargs from a function call.
:return: outstr: A string, which is '' if no kwargs were given, and the kwargs in string format otherwise. | [
"Given",
"a",
"set",
"of",
"kwargs",
"turns",
"them",
"into",
"a",
"string",
"which",
"can",
"then",
"be",
"passed",
"to",
"a",
"command",
".",
":",
"param",
"kwargs",
":",
"kwargs",
"from",
"a",
"function",
"call",
".",
":",
"return",
":",
"outstr",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/mash.py#L37-L46 |
OLC-Bioinformatics/ConFindr | confindr_src/wrappers/mash.py | read_mash_output | def read_mash_output(result_file):
"""
:param result_file: Tab-delimited result file generated by mash dist.
:return: mash_results: A list with each entry in the result file as an entry, with attributes reference, query,
distance, pvalue, and matching_hash
"""
with open(result_file) as handle:
... | python | def read_mash_output(result_file):
"""
:param result_file: Tab-delimited result file generated by mash dist.
:return: mash_results: A list with each entry in the result file as an entry, with attributes reference, query,
distance, pvalue, and matching_hash
"""
with open(result_file) as handle:
... | [
"def",
"read_mash_output",
"(",
"result_file",
")",
":",
"with",
"open",
"(",
"result_file",
")",
"as",
"handle",
":",
"lines",
"=",
"handle",
".",
"readlines",
"(",
")",
"mash_results",
"=",
"list",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"result",... | :param result_file: Tab-delimited result file generated by mash dist.
:return: mash_results: A list with each entry in the result file as an entry, with attributes reference, query,
distance, pvalue, and matching_hash | [
":",
"param",
"result_file",
":",
"Tab",
"-",
"delimited",
"result",
"file",
"generated",
"by",
"mash",
"dist",
".",
":",
"return",
":",
"mash_results",
":",
"A",
"list",
"with",
"each",
"entry",
"in",
"the",
"result",
"file",
"as",
"an",
"entry",
"with"... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/mash.py#L119-L131 |
OLC-Bioinformatics/ConFindr | confindr_src/wrappers/mash.py | read_mash_screen | def read_mash_screen(screen_result):
"""
:param screen_result: Tab-delimited result file generated by mash screen.
:return: results: A list with each line in the result file as an entry, with attributes identity, shared_hashes,
median_multiplicity, pvalue, and query_id
"""
with open(screen_resul... | python | def read_mash_screen(screen_result):
"""
:param screen_result: Tab-delimited result file generated by mash screen.
:return: results: A list with each line in the result file as an entry, with attributes identity, shared_hashes,
median_multiplicity, pvalue, and query_id
"""
with open(screen_resul... | [
"def",
"read_mash_screen",
"(",
"screen_result",
")",
":",
"with",
"open",
"(",
"screen_result",
")",
"as",
"handle",
":",
"lines",
"=",
"handle",
".",
"readlines",
"(",
")",
"results",
"=",
"list",
"(",
")",
"for",
"line",
"in",
"lines",
":",
"result",
... | :param screen_result: Tab-delimited result file generated by mash screen.
:return: results: A list with each line in the result file as an entry, with attributes identity, shared_hashes,
median_multiplicity, pvalue, and query_id | [
":",
"param",
"screen_result",
":",
"Tab",
"-",
"delimited",
"result",
"file",
"generated",
"by",
"mash",
"screen",
".",
":",
"return",
":",
"results",
":",
"A",
"list",
"with",
"each",
"line",
"in",
"the",
"result",
"file",
"as",
"an",
"entry",
"with",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/wrappers/mash.py#L134-L146 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | run_cmd | def run_cmd(cmd):
"""
Runs a command using subprocess, and returns both the stdout and stderr from that command
If exit code from command is non-zero, raises subproess.CalledProcessError
:param cmd: command to run as a string, as it would be called on the command line
:return: out, err: Strings that... | python | def run_cmd(cmd):
"""
Runs a command using subprocess, and returns both the stdout and stderr from that command
If exit code from command is non-zero, raises subproess.CalledProcessError
:param cmd: command to run as a string, as it would be called on the command line
:return: out, err: Strings that... | [
"def",
"run_cmd",
"(",
"cmd",
")",
":",
"p",
"=",
"subprocess",
".",
"Popen",
"(",
"cmd",
",",
"shell",
"=",
"True",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
",",
"stderr",
"=",
"subprocess",
".",
"PIPE",
")",
"out",
",",
"err",
"=",
"p",
"... | Runs a command using subprocess, and returns both the stdout and stderr from that command
If exit code from command is non-zero, raises subproess.CalledProcessError
:param cmd: command to run as a string, as it would be called on the command line
:return: out, err: Strings that are the stdout and stderr fro... | [
"Runs",
"a",
"command",
"using",
"subprocess",
"and",
"returns",
"both",
"the",
"stdout",
"and",
"stderr",
"from",
"that",
"command",
"If",
"exit",
"code",
"from",
"command",
"is",
"non",
"-",
"zero",
"raises",
"subproess",
".",
"CalledProcessError",
":",
"p... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L21-L34 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | write_to_logfile | def write_to_logfile(logfile, out, err, cmd):
"""
Writes stdout, stderr, and a command to a logfile
:param logfile: Path to file to write output to.
:param out: Stdout of program called, as a string
:param err: Stderr of program called, as a string
:param cmd: command that was used
"""
w... | python | def write_to_logfile(logfile, out, err, cmd):
"""
Writes stdout, stderr, and a command to a logfile
:param logfile: Path to file to write output to.
:param out: Stdout of program called, as a string
:param err: Stderr of program called, as a string
:param cmd: command that was used
"""
w... | [
"def",
"write_to_logfile",
"(",
"logfile",
",",
"out",
",",
"err",
",",
"cmd",
")",
":",
"with",
"open",
"(",
"logfile",
",",
"'a+'",
")",
"as",
"outfile",
":",
"outfile",
".",
"write",
"(",
"'Command used: {}\\n\\n'",
".",
"format",
"(",
"cmd",
")",
"... | Writes stdout, stderr, and a command to a logfile
:param logfile: Path to file to write output to.
:param out: Stdout of program called, as a string
:param err: Stderr of program called, as a string
:param cmd: command that was used | [
"Writes",
"stdout",
"stderr",
"and",
"a",
"command",
"to",
"a",
"logfile",
":",
"param",
"logfile",
":",
"Path",
"to",
"file",
"to",
"write",
"output",
"to",
".",
":",
"param",
"out",
":",
"Stdout",
"of",
"program",
"called",
"as",
"a",
"string",
":",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L37-L48 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_paired_reads | def find_paired_reads(fastq_directory, forward_id='_R1', reverse_id='_R2'):
"""
Looks at a directory to try to find paired fastq files. Should be able to find anything fastq.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Defau... | python | def find_paired_reads(fastq_directory, forward_id='_R1', reverse_id='_R2'):
"""
Looks at a directory to try to find paired fastq files. Should be able to find anything fastq.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Defau... | [
"def",
"find_paired_reads",
"(",
"fastq_directory",
",",
"forward_id",
"=",
"'_R1'",
",",
"reverse_id",
"=",
"'_R2'",
")",
":",
"pair_list",
"=",
"list",
"(",
")",
"fastq_files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"fastq_... | Looks at a directory to try to find paired fastq files. Should be able to find anything fastq.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Default R1.
:param reverse_id: Identifier for reverse reads. Default R2.
:return: Lis... | [
"Looks",
"at",
"a",
"directory",
"to",
"try",
"to",
"find",
"paired",
"fastq",
"files",
".",
"Should",
"be",
"able",
"to",
"find",
"anything",
"fastq",
".",
":",
"param",
"fastq_directory",
":",
"Complete",
"path",
"to",
"directory",
"containing",
"fastq",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L63-L77 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_unpaired_reads | def find_unpaired_reads(fastq_directory, forward_id='_R1', reverse_id='_R2', find_fasta=False):
"""
Looks at a directory to find unpaired fastq files.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Default _R1.
:param rever... | python | def find_unpaired_reads(fastq_directory, forward_id='_R1', reverse_id='_R2', find_fasta=False):
"""
Looks at a directory to find unpaired fastq files.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Default _R1.
:param rever... | [
"def",
"find_unpaired_reads",
"(",
"fastq_directory",
",",
"forward_id",
"=",
"'_R1'",
",",
"reverse_id",
"=",
"'_R2'",
",",
"find_fasta",
"=",
"False",
")",
":",
"read_list",
"=",
"list",
"(",
")",
"if",
"find_fasta",
"is",
"False",
":",
"fastq_files",
"=",... | Looks at a directory to find unpaired fastq files.
:param fastq_directory: Complete path to directory containing fastq files.
:param forward_id: Identifier for forward reads. Default _R1.
:param reverse_id: Identifier for forward reads. Default _R2.
:param find_fasta: If False, will look for fastq files... | [
"Looks",
"at",
"a",
"directory",
"to",
"find",
"unpaired",
"fastq",
"files",
".",
":",
"param",
"fastq_directory",
":",
"Complete",
"path",
"to",
"directory",
"containing",
"fastq",
"files",
".",
":",
"param",
"forward_id",
":",
"Identifier",
"for",
"forward",... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L80-L106 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_genusspecific_allele_list | def find_genusspecific_allele_list(profiles_file, target_genus):
"""
A new way of making our specific databases: Make our profiles file have lists of every gene/allele present for
each genus instead of just excluding a few genes for each. This way, should have much smaller databases
while managing to ma... | python | def find_genusspecific_allele_list(profiles_file, target_genus):
"""
A new way of making our specific databases: Make our profiles file have lists of every gene/allele present for
each genus instead of just excluding a few genes for each. This way, should have much smaller databases
while managing to ma... | [
"def",
"find_genusspecific_allele_list",
"(",
"profiles_file",
",",
"target_genus",
")",
":",
"alleles",
"=",
"list",
"(",
")",
"with",
"open",
"(",
"profiles_file",
")",
"as",
"f",
":",
"lines",
"=",
"f",
".",
"readlines",
"(",
")",
"for",
"line",
"in",
... | A new way of making our specific databases: Make our profiles file have lists of every gene/allele present for
each genus instead of just excluding a few genes for each. This way, should have much smaller databases
while managing to make ConFindr a decent bit faster (maybe)
:param profiles_file: Path to pro... | [
"A",
"new",
"way",
"of",
"making",
"our",
"specific",
"databases",
":",
"Make",
"our",
"profiles",
"file",
"have",
"lists",
"of",
"every",
"gene",
"/",
"allele",
"present",
"for",
"each",
"genus",
"instead",
"of",
"just",
"excluding",
"a",
"few",
"genes",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L109-L126 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | setup_allelespecific_database | def setup_allelespecific_database(fasta_file, database_folder, allele_list):
"""
Since some genera have some rMLST genes missing, or two copies of some genes, genus-specific databases are needed.
This will take only the alleles known to be part of each genus and write them to a genus-specific file.
:par... | python | def setup_allelespecific_database(fasta_file, database_folder, allele_list):
"""
Since some genera have some rMLST genes missing, or two copies of some genes, genus-specific databases are needed.
This will take only the alleles known to be part of each genus and write them to a genus-specific file.
:par... | [
"def",
"setup_allelespecific_database",
"(",
"fasta_file",
",",
"database_folder",
",",
"allele_list",
")",
":",
"index",
"=",
"SeqIO",
".",
"index",
"(",
"os",
".",
"path",
".",
"join",
"(",
"database_folder",
",",
"'rMLST_combined.fasta'",
")",
",",
"'fasta'",... | Since some genera have some rMLST genes missing, or two copies of some genes, genus-specific databases are needed.
This will take only the alleles known to be part of each genus and write them to a genus-specific file.
:param database_folder: Path to folder where rMLST_combined is stored.
:param fasta_file:... | [
"Since",
"some",
"genera",
"have",
"some",
"rMLST",
"genes",
"missing",
"or",
"two",
"copies",
"of",
"some",
"genes",
"genus",
"-",
"specific",
"databases",
"are",
"needed",
".",
"This",
"will",
"take",
"only",
"the",
"alleles",
"known",
"to",
"be",
"part"... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L129-L144 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | extract_rmlst_genes | def extract_rmlst_genes(pair, database, forward_out, reverse_out, threads=12, logfile=None):
"""
Given a pair of reads and an rMLST database, will extract reads that contain sequence from the database.
:param pair: List containing path to forward reads at index 0 and path to reverse reads at index 1.
:p... | python | def extract_rmlst_genes(pair, database, forward_out, reverse_out, threads=12, logfile=None):
"""
Given a pair of reads and an rMLST database, will extract reads that contain sequence from the database.
:param pair: List containing path to forward reads at index 0 and path to reverse reads at index 1.
:p... | [
"def",
"extract_rmlst_genes",
"(",
"pair",
",",
"database",
",",
"forward_out",
",",
"reverse_out",
",",
"threads",
"=",
"12",
",",
"logfile",
"=",
"None",
")",
":",
"out",
",",
"err",
",",
"cmd",
"=",
"bbtools",
".",
"bbduk_bait",
"(",
"database",
",",
... | Given a pair of reads and an rMLST database, will extract reads that contain sequence from the database.
:param pair: List containing path to forward reads at index 0 and path to reverse reads at index 1.
:param database: Path to rMLST database, in FASTA format.
:param forward_out:
:param reverse_out:
... | [
"Given",
"a",
"pair",
"of",
"reads",
"and",
"an",
"rMLST",
"database",
"will",
"extract",
"reads",
"that",
"contain",
"sequence",
"from",
"the",
"database",
".",
":",
"param",
"pair",
":",
"List",
"containing",
"path",
"to",
"forward",
"reads",
"at",
"inde... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L147-L159 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_cross_contamination | def find_cross_contamination(databases, pair, tmpdir='tmp', log='log.txt', threads=1):
"""
Usese mash to find out whether or not a sample has more than one genus present, indicating cross-contamination.
:param databases: A databases folder, which must contain refseq.msh, a mash sketch that has one represent... | python | def find_cross_contamination(databases, pair, tmpdir='tmp', log='log.txt', threads=1):
"""
Usese mash to find out whether or not a sample has more than one genus present, indicating cross-contamination.
:param databases: A databases folder, which must contain refseq.msh, a mash sketch that has one represent... | [
"def",
"find_cross_contamination",
"(",
"databases",
",",
"pair",
",",
"tmpdir",
"=",
"'tmp'",
",",
"log",
"=",
"'log.txt'",
",",
"threads",
"=",
"1",
")",
":",
"genera_present",
"=",
"list",
"(",
")",
"out",
",",
"err",
",",
"cmd",
"=",
"mash",
".",
... | Usese mash to find out whether or not a sample has more than one genus present, indicating cross-contamination.
:param databases: A databases folder, which must contain refseq.msh, a mash sketch that has one representative
per genus from refseq.
:param tmpdir: Temporary directory to store mash result files ... | [
"Usese",
"mash",
"to",
"find",
"out",
"whether",
"or",
"not",
"a",
"sample",
"has",
"more",
"than",
"one",
"genus",
"present",
"indicating",
"cross",
"-",
"contamination",
".",
":",
"param",
"databases",
":",
"A",
"databases",
"folder",
"which",
"must",
"c... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L162-L197 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | number_of_bases_above_threshold | def number_of_bases_above_threshold(high_quality_base_count, base_count_cutoff=2, base_fraction_cutoff=None):
"""
Finds if a site has at least two bases of high quality, enough that it can be considered
fairly safe to say that base is actually there.
:param high_quality_base_count: Dictionary of count ... | python | def number_of_bases_above_threshold(high_quality_base_count, base_count_cutoff=2, base_fraction_cutoff=None):
"""
Finds if a site has at least two bases of high quality, enough that it can be considered
fairly safe to say that base is actually there.
:param high_quality_base_count: Dictionary of count ... | [
"def",
"number_of_bases_above_threshold",
"(",
"high_quality_base_count",
",",
"base_count_cutoff",
"=",
"2",
",",
"base_fraction_cutoff",
"=",
"None",
")",
":",
"# make a dict by dictionary comprehension where values are True or False for each base depending on whether the count meets t... | Finds if a site has at least two bases of high quality, enough that it can be considered
fairly safe to say that base is actually there.
:param high_quality_base_count: Dictionary of count of HQ bases at a position where key is base and values is the count of that base.
:param base_count_cutoff: Number of ... | [
"Finds",
"if",
"a",
"site",
"has",
"at",
"least",
"two",
"bases",
"of",
"high",
"quality",
"enough",
"that",
"it",
"can",
"be",
"considered",
"fairly",
"safe",
"to",
"say",
"that",
"base",
"is",
"actually",
"there",
".",
":",
"param",
"high_quality_base_co... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L237-L256 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_if_multibase | def find_if_multibase(column, quality_cutoff, base_cutoff, base_fraction_cutoff):
"""
Finds if a position in a pileup has more than one base present.
:param column: A pileupColumn generated by pysam
:param quality_cutoff: Desired minimum phred quality for a base in order to be counted towards a multi-al... | python | def find_if_multibase(column, quality_cutoff, base_cutoff, base_fraction_cutoff):
"""
Finds if a position in a pileup has more than one base present.
:param column: A pileupColumn generated by pysam
:param quality_cutoff: Desired minimum phred quality for a base in order to be counted towards a multi-al... | [
"def",
"find_if_multibase",
"(",
"column",
",",
"quality_cutoff",
",",
"base_cutoff",
",",
"base_fraction_cutoff",
")",
":",
"# Sometimes the qualities come out to ridiculously high (>70) values. Looks to be because sometimes reads",
"# are overlapping and the qualities get summed for over... | Finds if a position in a pileup has more than one base present.
:param column: A pileupColumn generated by pysam
:param quality_cutoff: Desired minimum phred quality for a base in order to be counted towards a multi-allelic column
:param base_cutoff: Minimum number of bases needed to support presence of a b... | [
"Finds",
"if",
"a",
"position",
"in",
"a",
"pileup",
"has",
"more",
"than",
"one",
"base",
"present",
".",
":",
"param",
"column",
":",
"A",
"pileupColumn",
"generated",
"by",
"pysam",
":",
"param",
"quality_cutoff",
":",
"Desired",
"minimum",
"phred",
"qu... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L259-L320 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | get_contig_names | def get_contig_names(fasta_file):
"""
Gets contig names from a fasta file using SeqIO.
:param fasta_file: Full path to uncompressed, fasta-formatted file
:return: List of contig names.
"""
contig_names = list()
for contig in SeqIO.parse(fasta_file, 'fasta'):
contig_names.append(conti... | python | def get_contig_names(fasta_file):
"""
Gets contig names from a fasta file using SeqIO.
:param fasta_file: Full path to uncompressed, fasta-formatted file
:return: List of contig names.
"""
contig_names = list()
for contig in SeqIO.parse(fasta_file, 'fasta'):
contig_names.append(conti... | [
"def",
"get_contig_names",
"(",
"fasta_file",
")",
":",
"contig_names",
"=",
"list",
"(",
")",
"for",
"contig",
"in",
"SeqIO",
".",
"parse",
"(",
"fasta_file",
",",
"'fasta'",
")",
":",
"contig_names",
".",
"append",
"(",
"contig",
".",
"id",
")",
"retur... | Gets contig names from a fasta file using SeqIO.
:param fasta_file: Full path to uncompressed, fasta-formatted file
:return: List of contig names. | [
"Gets",
"contig",
"names",
"from",
"a",
"fasta",
"file",
"using",
"SeqIO",
".",
":",
"param",
"fasta_file",
":",
"Full",
"path",
"to",
"uncompressed",
"fasta",
"-",
"formatted",
"file",
":",
"return",
":",
"List",
"of",
"contig",
"names",
"."
] | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L323-L332 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | read_contig | def read_contig(contig_name, bamfile_name, reference_fasta, quality_cutoff=20, base_cutoff=2, base_fraction_cutoff=None):
"""
Examines a contig to find if there are positions where more than one base is present.
:param contig_name: Name of contig as a string.
:param bamfile_name: Full path to bamfile. M... | python | def read_contig(contig_name, bamfile_name, reference_fasta, quality_cutoff=20, base_cutoff=2, base_fraction_cutoff=None):
"""
Examines a contig to find if there are positions where more than one base is present.
:param contig_name: Name of contig as a string.
:param bamfile_name: Full path to bamfile. M... | [
"def",
"read_contig",
"(",
"contig_name",
",",
"bamfile_name",
",",
"reference_fasta",
",",
"quality_cutoff",
"=",
"20",
",",
"base_cutoff",
"=",
"2",
",",
"base_fraction_cutoff",
"=",
"None",
")",
":",
"bamfile",
"=",
"pysam",
".",
"AlignmentFile",
"(",
"bamf... | Examines a contig to find if there are positions where more than one base is present.
:param contig_name: Name of contig as a string.
:param bamfile_name: Full path to bamfile. Must be sorted/indexed
:param reference_fasta: Full path to fasta file that was used to generate the bamfile.
:param report_fil... | [
"Examines",
"a",
"contig",
"to",
"find",
"if",
"there",
"are",
"positions",
"where",
"more",
"than",
"one",
"base",
"is",
"present",
".",
":",
"param",
"contig_name",
":",
"Name",
"of",
"contig",
"as",
"a",
"string",
".",
":",
"param",
"bamfile_name",
":... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L335-L367 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_rmlst_type | def find_rmlst_type(kma_report, rmlst_report):
"""
Uses a report generated by KMA to determine what allele is present for each rMLST gene.
:param kma_report: The .res report generated by KMA.
:param rmlst_report: rMLST report file to write information to.
:return: a sorted list of loci present, in f... | python | def find_rmlst_type(kma_report, rmlst_report):
"""
Uses a report generated by KMA to determine what allele is present for each rMLST gene.
:param kma_report: The .res report generated by KMA.
:param rmlst_report: rMLST report file to write information to.
:return: a sorted list of loci present, in f... | [
"def",
"find_rmlst_type",
"(",
"kma_report",
",",
"rmlst_report",
")",
":",
"genes_to_use",
"=",
"dict",
"(",
")",
"score_dict",
"=",
"dict",
"(",
")",
"gene_alleles",
"=",
"list",
"(",
")",
"with",
"open",
"(",
"kma_report",
")",
"as",
"tsvfile",
":",
"... | Uses a report generated by KMA to determine what allele is present for each rMLST gene.
:param kma_report: The .res report generated by KMA.
:param rmlst_report: rMLST report file to write information to.
:return: a sorted list of loci present, in format gene_allele | [
"Uses",
"a",
"report",
"generated",
"by",
"KMA",
"to",
"determine",
"what",
"allele",
"is",
"present",
"for",
"each",
"rMLST",
"gene",
".",
":",
"param",
"kma_report",
":",
"The",
".",
"res",
"report",
"generated",
"by",
"KMA",
".",
":",
"param",
"rmlst_... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L370-L403 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | base_dict_to_string | def base_dict_to_string(base_dict):
"""
Converts a dictionary to a string. {'C': 12, 'A':4} gets converted to C:12;A:4
:param base_dict: Dictionary of bases and counts created by find_if_multibase
:return: String representing that dictionary.
"""
outstr = ''
# First, sort base_dict so that m... | python | def base_dict_to_string(base_dict):
"""
Converts a dictionary to a string. {'C': 12, 'A':4} gets converted to C:12;A:4
:param base_dict: Dictionary of bases and counts created by find_if_multibase
:return: String representing that dictionary.
"""
outstr = ''
# First, sort base_dict so that m... | [
"def",
"base_dict_to_string",
"(",
"base_dict",
")",
":",
"outstr",
"=",
"''",
"# First, sort base_dict so that major allele always comes first - makes output report nicer to look at.",
"base_list",
"=",
"sorted",
"(",
"base_dict",
".",
"items",
"(",
")",
",",
"key",
"=",
... | Converts a dictionary to a string. {'C': 12, 'A':4} gets converted to C:12;A:4
:param base_dict: Dictionary of bases and counts created by find_if_multibase
:return: String representing that dictionary. | [
"Converts",
"a",
"dictionary",
"to",
"a",
"string",
".",
"{",
"C",
":",
"12",
"A",
":",
"4",
"}",
"gets",
"converted",
"to",
"C",
":",
"12",
";",
"A",
":",
"4",
":",
"param",
"base_dict",
":",
"Dictionary",
"of",
"bases",
"and",
"counts",
"created"... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L406-L417 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_total_sequence_length | def find_total_sequence_length(fasta_file):
"""
Totals up number of bases in a fasta file.
:param fasta_file: Path to an uncompressed, fasta-formatted file.
:return: Number of total bases in file, as an int.
"""
total_length = 0
for sequence in SeqIO.parse(fasta_file, 'fasta'):
total... | python | def find_total_sequence_length(fasta_file):
"""
Totals up number of bases in a fasta file.
:param fasta_file: Path to an uncompressed, fasta-formatted file.
:return: Number of total bases in file, as an int.
"""
total_length = 0
for sequence in SeqIO.parse(fasta_file, 'fasta'):
total... | [
"def",
"find_total_sequence_length",
"(",
"fasta_file",
")",
":",
"total_length",
"=",
"0",
"for",
"sequence",
"in",
"SeqIO",
".",
"parse",
"(",
"fasta_file",
",",
"'fasta'",
")",
":",
"total_length",
"+=",
"len",
"(",
"sequence",
".",
"seq",
")",
"return",
... | Totals up number of bases in a fasta file.
:param fasta_file: Path to an uncompressed, fasta-formatted file.
:return: Number of total bases in file, as an int. | [
"Totals",
"up",
"number",
"of",
"bases",
"in",
"a",
"fasta",
"file",
".",
":",
"param",
"fasta_file",
":",
"Path",
"to",
"an",
"uncompressed",
"fasta",
"-",
"formatted",
"file",
".",
":",
"return",
":",
"Number",
"of",
"total",
"bases",
"in",
"file",
"... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L420-L429 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | estimate_percent_contamination | def estimate_percent_contamination(contamination_report_file):
"""
Estimates the percent contamination of a sample (and standard deviation).
:param contamination_report_file: File created by read_contig,
:return: Estimated percent contamination and standard deviation.
"""
contam_levels = list()
... | python | def estimate_percent_contamination(contamination_report_file):
"""
Estimates the percent contamination of a sample (and standard deviation).
:param contamination_report_file: File created by read_contig,
:return: Estimated percent contamination and standard deviation.
"""
contam_levels = list()
... | [
"def",
"estimate_percent_contamination",
"(",
"contamination_report_file",
")",
":",
"contam_levels",
"=",
"list",
"(",
")",
"with",
"open",
"(",
"contamination_report_file",
")",
"as",
"csvfile",
":",
"reader",
"=",
"csv",
".",
"DictReader",
"(",
"csvfile",
")",
... | Estimates the percent contamination of a sample (and standard deviation).
:param contamination_report_file: File created by read_contig,
:return: Estimated percent contamination and standard deviation. | [
"Estimates",
"the",
"percent",
"contamination",
"of",
"a",
"sample",
"(",
"and",
"standard",
"deviation",
")",
".",
":",
"param",
"contamination_report_file",
":",
"File",
"created",
"by",
"read_contig",
":",
"return",
":",
"Estimated",
"percent",
"contamination",... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L432-L450 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | find_contamination | def find_contamination(pair, output_folder, databases_folder, forward_id='_R1', threads=1, keep_files=False,
quality_cutoff=20, base_cutoff=2, base_fraction_cutoff=0.05, cgmlst_db=None, Xmx=None, tmpdir=None,
data_type='Illumina', use_rmlst=False):
"""
This needs so... | python | def find_contamination(pair, output_folder, databases_folder, forward_id='_R1', threads=1, keep_files=False,
quality_cutoff=20, base_cutoff=2, base_fraction_cutoff=0.05, cgmlst_db=None, Xmx=None, tmpdir=None,
data_type='Illumina', use_rmlst=False):
"""
This needs so... | [
"def",
"find_contamination",
"(",
"pair",
",",
"output_folder",
",",
"databases_folder",
",",
"forward_id",
"=",
"'_R1'",
",",
"threads",
"=",
"1",
",",
"keep_files",
"=",
"False",
",",
"quality_cutoff",
"=",
"20",
",",
"base_cutoff",
"=",
"2",
",",
"base_fr... | This needs some documentation fairly badly, so here we go.
:param pair: This has become a misnomer. If the input reads are actually paired, needs to be a list
with the full filepath to forward reads at index 0 and full path to reverse reads at index 1.
If reads are unpaired, should be a list of length 1 wit... | [
"This",
"needs",
"some",
"documentation",
"fairly",
"badly",
"so",
"here",
"we",
"go",
".",
":",
"param",
"pair",
":",
"This",
"has",
"become",
"a",
"misnomer",
".",
"If",
"the",
"input",
"reads",
"are",
"actually",
"paired",
"needs",
"to",
"be",
"a",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L453-L802 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | write_output | def write_output(output_report, sample_name, multi_positions, genus, percent_contam, contam_stddev, total_gene_length,
database_download_date, snp_cutoff=3, cgmlst=None):
"""
Function that writes the output generated by ConFindr to a report file. Appends to a file that already exists,
or cr... | python | def write_output(output_report, sample_name, multi_positions, genus, percent_contam, contam_stddev, total_gene_length,
database_download_date, snp_cutoff=3, cgmlst=None):
"""
Function that writes the output generated by ConFindr to a report file. Appends to a file that already exists,
or cr... | [
"def",
"write_output",
"(",
"output_report",
",",
"sample_name",
",",
"multi_positions",
",",
"genus",
",",
"percent_contam",
",",
"contam_stddev",
",",
"total_gene_length",
",",
"database_download_date",
",",
"snp_cutoff",
"=",
"3",
",",
"cgmlst",
"=",
"None",
")... | Function that writes the output generated by ConFindr to a report file. Appends to a file that already exists,
or creates the file if it doesn't already exist.
:param output_report: Path to CSV output report file. Should have headers SampleName,Genus,NumContamSNVs,
ContamStatus,PercentContam, and PercentCon... | [
"Function",
"that",
"writes",
"the",
"output",
"generated",
"by",
"ConFindr",
"to",
"a",
"report",
"file",
".",
"Appends",
"to",
"a",
"file",
"that",
"already",
"exists",
"or",
"creates",
"the",
"file",
"if",
"it",
"doesn",
"t",
"already",
"exist",
".",
... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L805-L840 |
OLC-Bioinformatics/ConFindr | confindr_src/confindr.py | check_acceptable_xmx | def check_acceptable_xmx(xmx_string):
"""
BBTools can have their memory set manually. This will check that the memory setting is actually valid
:param xmx_string: The users requested XMX, as a string.
:return: True if the Xmx string will be accepted by BBTools, otherwise false.
"""
acceptable_xm... | python | def check_acceptable_xmx(xmx_string):
"""
BBTools can have their memory set manually. This will check that the memory setting is actually valid
:param xmx_string: The users requested XMX, as a string.
:return: True if the Xmx string will be accepted by BBTools, otherwise false.
"""
acceptable_xm... | [
"def",
"check_acceptable_xmx",
"(",
"xmx_string",
")",
":",
"acceptable_xmx",
"=",
"True",
"acceptable_suffixes",
"=",
"[",
"'K'",
",",
"'M'",
",",
"'G'",
"]",
"if",
"xmx_string",
"[",
"-",
"1",
"]",
".",
"upper",
"(",
")",
"not",
"in",
"acceptable_suffixe... | BBTools can have their memory set manually. This will check that the memory setting is actually valid
:param xmx_string: The users requested XMX, as a string.
:return: True if the Xmx string will be accepted by BBTools, otherwise false. | [
"BBTools",
"can",
"have",
"their",
"memory",
"set",
"manually",
".",
"This",
"will",
"check",
"that",
"the",
"memory",
"setting",
"is",
"actually",
"valid",
":",
"param",
"xmx_string",
":",
"The",
"users",
"requested",
"XMX",
"as",
"a",
"string",
".",
":",... | train | https://github.com/OLC-Bioinformatics/ConFindr/blob/4c292617c3f270ebd5ff138cbc5a107f6d01200d/confindr_src/confindr.py#L884-L902 |
weso/CWR-DataApi | cwr/grammar/field/table.py | char_code | def char_code(columns, name=None):
"""
Character set code field.
:param name: name for the field
:return: an instance of the Character set code field rules
"""
if name is None:
name = 'Char Code Field (' + str(columns) + ' columns)'
if columns <= 0:
raise BaseException()
... | python | def char_code(columns, name=None):
"""
Character set code field.
:param name: name for the field
:return: an instance of the Character set code field rules
"""
if name is None:
name = 'Char Code Field (' + str(columns) + ' columns)'
if columns <= 0:
raise BaseException()
... | [
"def",
"char_code",
"(",
"columns",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Char Code Field ('",
"+",
"str",
"(",
"columns",
")",
"+",
"' columns)'",
"if",
"columns",
"<=",
"0",
":",
"raise",
"BaseException",
... | Character set code field.
:param name: name for the field
:return: an instance of the Character set code field rules | [
"Character",
"set",
"code",
"field",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/table.py#L41-L76 |
calmjs/calmjs | src/calmjs/ui.py | make_choice_validator | def make_choice_validator(
choices, default_key=None, normalizer=None):
"""
Returns a callable that accepts the choices provided.
Choices should be provided as a list of 2-tuples, where the first
element is a string that should match user input (the key); the
second being the value associat... | python | def make_choice_validator(
choices, default_key=None, normalizer=None):
"""
Returns a callable that accepts the choices provided.
Choices should be provided as a list of 2-tuples, where the first
element is a string that should match user input (the key); the
second being the value associat... | [
"def",
"make_choice_validator",
"(",
"choices",
",",
"default_key",
"=",
"None",
",",
"normalizer",
"=",
"None",
")",
":",
"def",
"normalize_all",
"(",
"_choices",
")",
":",
"# normalize all the keys for easier comparison",
"if",
"normalizer",
":",
"_choices",
"=",
... | Returns a callable that accepts the choices provided.
Choices should be provided as a list of 2-tuples, where the first
element is a string that should match user input (the key); the
second being the value associated with the key.
The callable by default will match, upon complete match the first
... | [
"Returns",
"a",
"callable",
"that",
"accepts",
"the",
"choices",
"provided",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/ui.py#L47-L97 |
calmjs/calmjs | src/calmjs/ui.py | prompt | def prompt(question, validator=None,
choices=None, default_key=NotImplemented,
normalizer=str.lower,
_stdin=None, _stdout=None):
"""
Prompt user for question, maybe choices, and get answer.
Arguments:
question
The question to prompt. It will only be prompted o... | python | def prompt(question, validator=None,
choices=None, default_key=NotImplemented,
normalizer=str.lower,
_stdin=None, _stdout=None):
"""
Prompt user for question, maybe choices, and get answer.
Arguments:
question
The question to prompt. It will only be prompted o... | [
"def",
"prompt",
"(",
"question",
",",
"validator",
"=",
"None",
",",
"choices",
"=",
"None",
",",
"default_key",
"=",
"NotImplemented",
",",
"normalizer",
"=",
"str",
".",
"lower",
",",
"_stdin",
"=",
"None",
",",
"_stdout",
"=",
"None",
")",
":",
"de... | Prompt user for question, maybe choices, and get answer.
Arguments:
question
The question to prompt. It will only be prompted once.
validator
Defaults to None. Must be a callable that takes in a value.
The callable should raise ValueError when the value leads to an
error,... | [
"Prompt",
"user",
"for",
"question",
"maybe",
"choices",
"and",
"get",
"answer",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/ui.py#L104-L190 |
calmjs/calmjs | src/calmjs/ui.py | prompt_overwrite_json | def prompt_overwrite_json(original, new, target_path, dumps=json_dumps):
"""
Prompt end user with a diff of original and new json that may
overwrite the file at the target_path. This function only displays
a confirmation prompt and it is up to the caller to implement the
actual functionality. Opti... | python | def prompt_overwrite_json(original, new, target_path, dumps=json_dumps):
"""
Prompt end user with a diff of original and new json that may
overwrite the file at the target_path. This function only displays
a confirmation prompt and it is up to the caller to implement the
actual functionality. Opti... | [
"def",
"prompt_overwrite_json",
"(",
"original",
",",
"new",
",",
"target_path",
",",
"dumps",
"=",
"json_dumps",
")",
":",
"# generate compacted ndiff output.",
"diff",
"=",
"'\\n'",
".",
"join",
"(",
"l",
"for",
"l",
"in",
"(",
"line",
".",
"rstrip",
"(",
... | Prompt end user with a diff of original and new json that may
overwrite the file at the target_path. This function only displays
a confirmation prompt and it is up to the caller to implement the
actual functionality. Optionally, a custom json.dumps method can
also be passed in for output generation. | [
"Prompt",
"end",
"user",
"with",
"a",
"diff",
"of",
"original",
"and",
"new",
"json",
"that",
"may",
"overwrite",
"the",
"file",
"at",
"the",
"target_path",
".",
"This",
"function",
"only",
"displays",
"a",
"confirmation",
"prompt",
"and",
"it",
"is",
"up"... | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/ui.py#L193-L220 |
calmjs/calmjs | src/calmjs/npm.py | locate_package_entry_file | def locate_package_entry_file(working_dir, package_name):
"""
Locate a single npm package to return its browser or main entry.
"""
basedir = join(working_dir, 'node_modules', package_name)
package_json = join(basedir, 'package.json')
if not exists(package_json):
logger.debug(
... | python | def locate_package_entry_file(working_dir, package_name):
"""
Locate a single npm package to return its browser or main entry.
"""
basedir = join(working_dir, 'node_modules', package_name)
package_json = join(basedir, 'package.json')
if not exists(package_json):
logger.debug(
... | [
"def",
"locate_package_entry_file",
"(",
"working_dir",
",",
"package_name",
")",
":",
"basedir",
"=",
"join",
"(",
"working_dir",
",",
"'node_modules'",
",",
"package_name",
")",
"package_json",
"=",
"join",
"(",
"basedir",
",",
"'package.json'",
")",
"if",
"no... | Locate a single npm package to return its browser or main entry. | [
"Locate",
"a",
"single",
"npm",
"package",
"to",
"return",
"its",
"browser",
"or",
"main",
"entry",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/npm.py#L52-L86 |
bitlabstudio/cmsplugin-image-gallery | image_gallery/templatetags/image_gallery_tags.py | render_pictures | def render_pictures(context, selection='recent', amount=3):
"""Template tag to render a list of pictures."""
pictures = Image.objects.filter(
folder__id__in=Gallery.objects.filter(is_published=True).values_list(
'folder__pk', flat=True))
if selection == 'recent':
context.update({... | python | def render_pictures(context, selection='recent', amount=3):
"""Template tag to render a list of pictures."""
pictures = Image.objects.filter(
folder__id__in=Gallery.objects.filter(is_published=True).values_list(
'folder__pk', flat=True))
if selection == 'recent':
context.update({... | [
"def",
"render_pictures",
"(",
"context",
",",
"selection",
"=",
"'recent'",
",",
"amount",
"=",
"3",
")",
":",
"pictures",
"=",
"Image",
".",
"objects",
".",
"filter",
"(",
"folder__id__in",
"=",
"Gallery",
".",
"objects",
".",
"filter",
"(",
"is_publishe... | Template tag to render a list of pictures. | [
"Template",
"tag",
"to",
"render",
"a",
"list",
"of",
"pictures",
"."
] | train | https://github.com/bitlabstudio/cmsplugin-image-gallery/blob/f16a2d5d0a6fde469bc07436ff0cd84af2c78e5c/image_gallery/templatetags/image_gallery_tags.py#L12-L27 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFFile.add_header | def add_header(self, entry):
"""Parses the VCF Header field and returns the number of samples in the VCF file"""
info = entry.split('\t')
self.n_individuals = len(info)-9
for i,v in enumerate(info[9:]):
self.individuals[v] = i
return self.n_individuals > 0 | python | def add_header(self, entry):
"""Parses the VCF Header field and returns the number of samples in the VCF file"""
info = entry.split('\t')
self.n_individuals = len(info)-9
for i,v in enumerate(info[9:]):
self.individuals[v] = i
return self.n_individuals > 0 | [
"def",
"add_header",
"(",
"self",
",",
"entry",
")",
":",
"info",
"=",
"entry",
".",
"split",
"(",
"'\\t'",
")",
"self",
".",
"n_individuals",
"=",
"len",
"(",
"info",
")",
"-",
"9",
"for",
"i",
",",
"v",
"in",
"enumerate",
"(",
"info",
"[",
"9",... | Parses the VCF Header field and returns the number of samples in the VCF file | [
"Parses",
"the",
"VCF",
"Header",
"field",
"and",
"returns",
"the",
"number",
"of",
"samples",
"in",
"the",
"VCF",
"file"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L47-L53 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFFile.parse_entry | def parse_entry(self, row):
"""Parse an individual VCF entry and return a VCFEntry which contains information about
the call (such as alternative allele, zygosity, etc.)
"""
var_call = VCFEntry(self.individuals)
var_call.parse_entry(row)
return var_call | python | def parse_entry(self, row):
"""Parse an individual VCF entry and return a VCFEntry which contains information about
the call (such as alternative allele, zygosity, etc.)
"""
var_call = VCFEntry(self.individuals)
var_call.parse_entry(row)
return var_call | [
"def",
"parse_entry",
"(",
"self",
",",
"row",
")",
":",
"var_call",
"=",
"VCFEntry",
"(",
"self",
".",
"individuals",
")",
"var_call",
".",
"parse_entry",
"(",
"row",
")",
"return",
"var_call"
] | Parse an individual VCF entry and return a VCFEntry which contains information about
the call (such as alternative allele, zygosity, etc.) | [
"Parse",
"an",
"individual",
"VCF",
"entry",
"and",
"return",
"a",
"VCFEntry",
"which",
"contains",
"information",
"about",
"the",
"call",
"(",
"such",
"as",
"alternative",
"allele",
"zygosity",
"etc",
".",
")"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L63-L70 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFFile.add_entry | def add_entry(self, row):
"""This will parse the VCF entry and also store it within the VCFFile. It will also
return the VCFEntry as well.
"""
var_call = VCFEntry(self.individuals)
var_call.parse_entry( row )
self.entries[(var_call.chrom, var_call.pos)] = var_call
... | python | def add_entry(self, row):
"""This will parse the VCF entry and also store it within the VCFFile. It will also
return the VCFEntry as well.
"""
var_call = VCFEntry(self.individuals)
var_call.parse_entry( row )
self.entries[(var_call.chrom, var_call.pos)] = var_call
... | [
"def",
"add_entry",
"(",
"self",
",",
"row",
")",
":",
"var_call",
"=",
"VCFEntry",
"(",
"self",
".",
"individuals",
")",
"var_call",
".",
"parse_entry",
"(",
"row",
")",
"self",
".",
"entries",
"[",
"(",
"var_call",
".",
"chrom",
",",
"var_call",
".",... | This will parse the VCF entry and also store it within the VCFFile. It will also
return the VCFEntry as well. | [
"This",
"will",
"parse",
"the",
"VCF",
"entry",
"and",
"also",
"store",
"it",
"within",
"the",
"VCFFile",
".",
"It",
"will",
"also",
"return",
"the",
"VCFEntry",
"as",
"well",
"."
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L72-L80 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFFile.get_header | def get_header(self, individual=-1):
"""Returns the vcf header
"""
type_map = dict([(val,key) for key,val in self.meta.type_map.iteritems()])
extra = '\n'.join(['##{0}'.format(i) for i in self.meta.extra])
info = '\n'.join(['##INFO=<ID={0},Number={1},Type={2},Description={3}>'.f... | python | def get_header(self, individual=-1):
"""Returns the vcf header
"""
type_map = dict([(val,key) for key,val in self.meta.type_map.iteritems()])
extra = '\n'.join(['##{0}'.format(i) for i in self.meta.extra])
info = '\n'.join(['##INFO=<ID={0},Number={1},Type={2},Description={3}>'.f... | [
"def",
"get_header",
"(",
"self",
",",
"individual",
"=",
"-",
"1",
")",
":",
"type_map",
"=",
"dict",
"(",
"[",
"(",
"val",
",",
"key",
")",
"for",
"key",
",",
"val",
"in",
"self",
".",
"meta",
".",
"type_map",
".",
"iteritems",
"(",
")",
"]",
... | Returns the vcf header | [
"Returns",
"the",
"vcf",
"header"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L82-L103 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFMeta.add_info | def add_info(self, entry):
"""Parse and store the info field"""
entry = entry[8:-1]
info = entry.split(',')
if len(info) < 4:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.info[value] = {}
... | python | def add_info(self, entry):
"""Parse and store the info field"""
entry = entry[8:-1]
info = entry.split(',')
if len(info) < 4:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.info[value] = {}
... | [
"def",
"add_info",
"(",
"self",
",",
"entry",
")",
":",
"entry",
"=",
"entry",
"[",
"8",
":",
"-",
"1",
"]",
"info",
"=",
"entry",
".",
"split",
"(",
"','",
")",
"if",
"len",
"(",
"info",
")",
"<",
"4",
":",
"return",
"False",
"for",
"v",
"in... | Parse and store the info field | [
"Parse",
"and",
"store",
"the",
"info",
"field"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L133-L155 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFMeta.add_filter | def add_filter(self, entry):
"""Parse and store the filter field"""
entry = entry[10:-1]
info = entry.split(',')
if len(info) < 2:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.filter[value] = {}
... | python | def add_filter(self, entry):
"""Parse and store the filter field"""
entry = entry[10:-1]
info = entry.split(',')
if len(info) < 2:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.filter[value] = {}
... | [
"def",
"add_filter",
"(",
"self",
",",
"entry",
")",
":",
"entry",
"=",
"entry",
"[",
"10",
":",
"-",
"1",
"]",
"info",
"=",
"entry",
".",
"split",
"(",
"','",
")",
"if",
"len",
"(",
"info",
")",
"<",
"2",
":",
"return",
"False",
"for",
"v",
... | Parse and store the filter field | [
"Parse",
"and",
"store",
"the",
"filter",
"field"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L157-L172 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFMeta.add_alt | def add_alt(self, entry):
"""Parse and store the alternative allele field"""
entry = entry[7:-1]
info = entry.split(',')
if len(info) < 2:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.alt[value] ... | python | def add_alt(self, entry):
"""Parse and store the alternative allele field"""
entry = entry[7:-1]
info = entry.split(',')
if len(info) < 2:
return False
for v in info:
key, value = v.split('=', 1)
if key == 'ID':
self.alt[value] ... | [
"def",
"add_alt",
"(",
"self",
",",
"entry",
")",
":",
"entry",
"=",
"entry",
"[",
"7",
":",
"-",
"1",
"]",
"info",
"=",
"entry",
".",
"split",
"(",
"','",
")",
"if",
"len",
"(",
"info",
")",
"<",
"2",
":",
"return",
"False",
"for",
"v",
"in"... | Parse and store the alternative allele field | [
"Parse",
"and",
"store",
"the",
"alternative",
"allele",
"field"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L198-L214 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.sample_string | def sample_string(self, individual=-1):
"""Returns the VCF entry as it appears in the vcf file"""
base = str(self)
extra = self.get_sample_info(individual=individual)
extra = [':'.join([str(j) for j in i]) for i in zip(*extra.values())]
return '\t'.join([base, '\t'.join(extra)]) | python | def sample_string(self, individual=-1):
"""Returns the VCF entry as it appears in the vcf file"""
base = str(self)
extra = self.get_sample_info(individual=individual)
extra = [':'.join([str(j) for j in i]) for i in zip(*extra.values())]
return '\t'.join([base, '\t'.join(extra)]) | [
"def",
"sample_string",
"(",
"self",
",",
"individual",
"=",
"-",
"1",
")",
":",
"base",
"=",
"str",
"(",
"self",
")",
"extra",
"=",
"self",
".",
"get_sample_info",
"(",
"individual",
"=",
"individual",
")",
"extra",
"=",
"[",
"':'",
".",
"join",
"("... | Returns the VCF entry as it appears in the vcf file | [
"Returns",
"the",
"VCF",
"entry",
"as",
"it",
"appears",
"in",
"the",
"vcf",
"file"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L245-L250 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.get_sample_info | def get_sample_info(self, individual=-1):
"""Returns the sample info of a given sample or all by default
"""
if isinstance(individual, str):
individual = self.individuals[individual]
extra = OrderedDict()
for format_ in self.format:
index = getattr(self, ... | python | def get_sample_info(self, individual=-1):
"""Returns the sample info of a given sample or all by default
"""
if isinstance(individual, str):
individual = self.individuals[individual]
extra = OrderedDict()
for format_ in self.format:
index = getattr(self, ... | [
"def",
"get_sample_info",
"(",
"self",
",",
"individual",
"=",
"-",
"1",
")",
":",
"if",
"isinstance",
"(",
"individual",
",",
"str",
")",
":",
"individual",
"=",
"self",
".",
"individuals",
"[",
"individual",
"]",
"extra",
"=",
"OrderedDict",
"(",
")",
... | Returns the sample info of a given sample or all by default | [
"Returns",
"the",
"sample",
"info",
"of",
"a",
"given",
"sample",
"or",
"all",
"by",
"default"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L252-L276 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.is_homozygous | def is_homozygous(self, individual=None):
"""This will give a boolean list corresponding to whether each individual
is homozygous for the alternative allele.
"""
if individual is not None:
if isinstance(individual, str):
individual = self.individuals[individu... | python | def is_homozygous(self, individual=None):
"""This will give a boolean list corresponding to whether each individual
is homozygous for the alternative allele.
"""
if individual is not None:
if isinstance(individual, str):
individual = self.individuals[individu... | [
"def",
"is_homozygous",
"(",
"self",
",",
"individual",
"=",
"None",
")",
":",
"if",
"individual",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"individual",
",",
"str",
")",
":",
"individual",
"=",
"self",
".",
"individuals",
"[",
"individual",
"]... | This will give a boolean list corresponding to whether each individual
is homozygous for the alternative allele. | [
"This",
"will",
"give",
"a",
"boolean",
"list",
"corresponding",
"to",
"whether",
"each",
"individual",
"is",
"homozygous",
"for",
"the",
"alternative",
"allele",
"."
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L278-L289 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.get_alt | def get_alt(self, individual=0, nucleotides_only=True):
"""Returns the alternative alleles of the individual as a list"""
#not i.startswith(',') is put in to handle cases like <DEL:ME:ALU> where we have no alternate allele
#but some reference
if isinstance(individual, str):
i... | python | def get_alt(self, individual=0, nucleotides_only=True):
"""Returns the alternative alleles of the individual as a list"""
#not i.startswith(',') is put in to handle cases like <DEL:ME:ALU> where we have no alternate allele
#but some reference
if isinstance(individual, str):
i... | [
"def",
"get_alt",
"(",
"self",
",",
"individual",
"=",
"0",
",",
"nucleotides_only",
"=",
"True",
")",
":",
"#not i.startswith(',') is put in to handle cases like <DEL:ME:ALU> where we have no alternate allele",
"#but some reference",
"if",
"isinstance",
"(",
"individual",
",... | Returns the alternative alleles of the individual as a list | [
"Returns",
"the",
"alternative",
"alleles",
"of",
"the",
"individual",
"as",
"a",
"list"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L305-L314 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.get_alt_length | def get_alt_length(self, individual=0):
"""Returns the number of basepairs of each alternative allele"""
if isinstance(individual, str):
individual = self.individuals[individual]
return [len(self.alt[i-1].replace('.','')) for i in self.genotype[individual] if i > 0 and not self.alt[i... | python | def get_alt_length(self, individual=0):
"""Returns the number of basepairs of each alternative allele"""
if isinstance(individual, str):
individual = self.individuals[individual]
return [len(self.alt[i-1].replace('.','')) for i in self.genotype[individual] if i > 0 and not self.alt[i... | [
"def",
"get_alt_length",
"(",
"self",
",",
"individual",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"individual",
",",
"str",
")",
":",
"individual",
"=",
"self",
".",
"individuals",
"[",
"individual",
"]",
"return",
"[",
"len",
"(",
"self",
".",
"al... | Returns the number of basepairs of each alternative allele | [
"Returns",
"the",
"number",
"of",
"basepairs",
"of",
"each",
"alternative",
"allele"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L316-L320 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.get_alt_lengths | def get_alt_lengths(self):
"""Returns the longest length of the variant. For deletions, return is negative,
SNPs return 0, and insertions are +. None return corresponds to no variant in interval
for specified individual
"""
#this is a hack to store the # of individuals without h... | python | def get_alt_lengths(self):
"""Returns the longest length of the variant. For deletions, return is negative,
SNPs return 0, and insertions are +. None return corresponds to no variant in interval
for specified individual
"""
#this is a hack to store the # of individuals without h... | [
"def",
"get_alt_lengths",
"(",
"self",
")",
":",
"#this is a hack to store the # of individuals without having to actually store it",
"out",
"=",
"[",
"]",
"for",
"i",
"in",
"six",
".",
"moves",
".",
"range",
"(",
"len",
"(",
"self",
".",
"genotype",
")",
")",
"... | Returns the longest length of the variant. For deletions, return is negative,
SNPs return 0, and insertions are +. None return corresponds to no variant in interval
for specified individual | [
"Returns",
"the",
"longest",
"length",
"of",
"the",
"variant",
".",
"For",
"deletions",
"return",
"is",
"negative",
"SNPs",
"return",
"0",
"and",
"insertions",
"are",
"+",
".",
"None",
"return",
"corresponds",
"to",
"no",
"variant",
"in",
"interval",
"for",
... | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L322-L336 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.has_snp | def has_snp(self, individual=0):
"""Returns a boolean list of SNP status, ordered by samples"""
if isinstance(individual, str):
individual = self.individuals[individual]
alts = self.get_alt(individual=individual)
if alts:
return [i != self.ref and len(i) == len(se... | python | def has_snp(self, individual=0):
"""Returns a boolean list of SNP status, ordered by samples"""
if isinstance(individual, str):
individual = self.individuals[individual]
alts = self.get_alt(individual=individual)
if alts:
return [i != self.ref and len(i) == len(se... | [
"def",
"has_snp",
"(",
"self",
",",
"individual",
"=",
"0",
")",
":",
"if",
"isinstance",
"(",
"individual",
",",
"str",
")",
":",
"individual",
"=",
"self",
".",
"individuals",
"[",
"individual",
"]",
"alts",
"=",
"self",
".",
"get_alt",
"(",
"individ... | Returns a boolean list of SNP status, ordered by samples | [
"Returns",
"a",
"boolean",
"list",
"of",
"SNP",
"status",
"ordered",
"by",
"samples"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L338-L345 |
pandeylab/pythomics | pythomics/genomics/structures.py | VCFEntry.parse_entry | def parse_entry(self, entry):
"""This parses a VCF row and stores the relevant information"""
entry = entry.split('\t')
self.chrom, self.pos, self.id, self.ref, alt_, self.qual, filter_, info, self.format = entry[:9]
self.samples = entry[9:]
self.alt = alt_.split(',')
if ... | python | def parse_entry(self, entry):
"""This parses a VCF row and stores the relevant information"""
entry = entry.split('\t')
self.chrom, self.pos, self.id, self.ref, alt_, self.qual, filter_, info, self.format = entry[:9]
self.samples = entry[9:]
self.alt = alt_.split(',')
if ... | [
"def",
"parse_entry",
"(",
"self",
",",
"entry",
")",
":",
"entry",
"=",
"entry",
".",
"split",
"(",
"'\\t'",
")",
"self",
".",
"chrom",
",",
"self",
".",
"pos",
",",
"self",
".",
"id",
",",
"self",
".",
"ref",
",",
"alt_",
",",
"self",
".",
"q... | This parses a VCF row and stores the relevant information | [
"This",
"parses",
"a",
"VCF",
"row",
"and",
"stores",
"the",
"relevant",
"information"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L373-L396 |
pandeylab/pythomics | pythomics/genomics/structures.py | GFFFeature.add_child | def add_child(self, child):
"""Children are GFFFeatures and are defined when added. This is done to avoid memory overheads
that may be incurred by GFF files that have millions of rows.
"""
child_id = getattr(child, 'id', None)
if child_id:
if not hasattr(self, 'child... | python | def add_child(self, child):
"""Children are GFFFeatures and are defined when added. This is done to avoid memory overheads
that may be incurred by GFF files that have millions of rows.
"""
child_id = getattr(child, 'id', None)
if child_id:
if not hasattr(self, 'child... | [
"def",
"add_child",
"(",
"self",
",",
"child",
")",
":",
"child_id",
"=",
"getattr",
"(",
"child",
",",
"'id'",
",",
"None",
")",
"if",
"child_id",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'children'",
")",
":",
"self",
".",
"children",
"=",
... | Children are GFFFeatures and are defined when added. This is done to avoid memory overheads
that may be incurred by GFF files that have millions of rows. | [
"Children",
"are",
"GFFFeatures",
"and",
"are",
"defined",
"when",
"added",
".",
"This",
"is",
"done",
"to",
"avoid",
"memory",
"overheads",
"that",
"may",
"be",
"incurred",
"by",
"GFF",
"files",
"that",
"have",
"millions",
"of",
"rows",
"."
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/structures.py#L495-L505 |
weso/CWR-DataApi | cwr/parser/encoder/standart/record.py | _iso_handler | def _iso_handler(obj):
"""
Transforms an object into it's ISO format, if possible.
If the object can't be transformed, then an error is raised for the JSON
parser.
This is meant to be used on datetime instances, but will work with any
object having a method called isoformat.
:param obj: o... | python | def _iso_handler(obj):
"""
Transforms an object into it's ISO format, if possible.
If the object can't be transformed, then an error is raised for the JSON
parser.
This is meant to be used on datetime instances, but will work with any
object having a method called isoformat.
:param obj: o... | [
"def",
"_iso_handler",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'isoformat'",
")",
":",
"result",
"=",
"obj",
".",
"isoformat",
"(",
")",
"else",
":",
"raise",
"TypeError",
"(",
"\"Unserializable object {} of type {}\"",
".",
"format",
"(",
... | Transforms an object into it's ISO format, if possible.
If the object can't be transformed, then an error is raised for the JSON
parser.
This is meant to be used on datetime instances, but will work with any
object having a method called isoformat.
:param obj: object to transform into it's ISO fo... | [
"Transforms",
"an",
"object",
"into",
"it",
"s",
"ISO",
"format",
"if",
"possible",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/standart/record.py#L17-L36 |
weso/CWR-DataApi | cwr/parser/encoder/standart/record.py | CwrRecordEncoder.try_encode | def try_encode(field_encoders, entity_dict):
"""
Inner encoding and try return string from entity dictionary
:param field_encoders:
:param entity_dict:
:return:
"""
result = ''
for field_encoder in field_encoders:
try:
result +=... | python | def try_encode(field_encoders, entity_dict):
"""
Inner encoding and try return string from entity dictionary
:param field_encoders:
:param entity_dict:
:return:
"""
result = ''
for field_encoder in field_encoders:
try:
result +=... | [
"def",
"try_encode",
"(",
"field_encoders",
",",
"entity_dict",
")",
":",
"result",
"=",
"''",
"for",
"field_encoder",
"in",
"field_encoders",
":",
"try",
":",
"result",
"+=",
"field_encoder",
".",
"encode",
"(",
"entity_dict",
")",
"except",
"KeyError",
"as",... | Inner encoding and try return string from entity dictionary
:param field_encoders:
:param entity_dict:
:return: | [
"Inner",
"encoding",
"and",
"try",
"return",
"string",
"from",
"entity",
"dictionary",
":",
"param",
"field_encoders",
":",
":",
"param",
"entity_dict",
":",
":",
"return",
":"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/standart/record.py#L108-L121 |
weso/CWR-DataApi | cwr/parser/encoder/standart/record.py | CwrRecordEncoder.encode | def encode(self, entity):
"""
Generate string of cwr format for all possible combinations of fields,
accumulate and then elect the best. The best string it is who used most of all fields
:param entity:
:return:
"""
possible_results = []
entity_dict = self.... | python | def encode(self, entity):
"""
Generate string of cwr format for all possible combinations of fields,
accumulate and then elect the best. The best string it is who used most of all fields
:param entity:
:return:
"""
possible_results = []
entity_dict = self.... | [
"def",
"encode",
"(",
"self",
",",
"entity",
")",
":",
"possible_results",
"=",
"[",
"]",
"entity_dict",
"=",
"self",
".",
"get_entity_dict",
"(",
"entity",
")",
"record_field_encoders",
"=",
"self",
".",
"get_record_fields_encoders",
"(",
")",
"for",
"field_e... | Generate string of cwr format for all possible combinations of fields,
accumulate and then elect the best. The best string it is who used most of all fields
:param entity:
:return: | [
"Generate",
"string",
"of",
"cwr",
"format",
"for",
"all",
"possible",
"combinations",
"of",
"fields",
"accumulate",
"and",
"then",
"elect",
"the",
"best",
".",
"The",
"best",
"string",
"it",
"is",
"who",
"used",
"most",
"of",
"all",
"fields",
":",
"param"... | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/parser/encoder/standart/record.py#L127-L142 |
calmjs/calmjs | src/calmjs/runtime.py | BootstrapRuntime.argparser | def argparser(self):
"""
For setting up the argparser for this instance.
"""
if self.__argparser is None:
self.__argparser = self.argparser_factory()
self.init_argparser(self.__argparser)
return self.__argparser | python | def argparser(self):
"""
For setting up the argparser for this instance.
"""
if self.__argparser is None:
self.__argparser = self.argparser_factory()
self.init_argparser(self.__argparser)
return self.__argparser | [
"def",
"argparser",
"(",
"self",
")",
":",
"if",
"self",
".",
"__argparser",
"is",
"None",
":",
"self",
".",
"__argparser",
"=",
"self",
".",
"argparser_factory",
"(",
")",
"self",
".",
"init_argparser",
"(",
"self",
".",
"__argparser",
")",
"return",
"s... | For setting up the argparser for this instance. | [
"For",
"setting",
"up",
"the",
"argparser",
"for",
"this",
"instance",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L135-L143 |
calmjs/calmjs | src/calmjs/runtime.py | BootstrapRuntime.argparser_factory | def argparser_factory(self):
"""
Produces argparser for this type of Runtime.
"""
return ArgumentParser(
prog=self.prog, description=self.__doc__, add_help=False,
) | python | def argparser_factory(self):
"""
Produces argparser for this type of Runtime.
"""
return ArgumentParser(
prog=self.prog, description=self.__doc__, add_help=False,
) | [
"def",
"argparser_factory",
"(",
"self",
")",
":",
"return",
"ArgumentParser",
"(",
"prog",
"=",
"self",
".",
"prog",
",",
"description",
"=",
"self",
".",
"__doc__",
",",
"add_help",
"=",
"False",
",",
")"
] | Produces argparser for this type of Runtime. | [
"Produces",
"argparser",
"for",
"this",
"type",
"of",
"Runtime",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L145-L152 |
calmjs/calmjs | src/calmjs/runtime.py | Runtime.init_argparser | def init_argparser(self, argparser):
"""
This should not be called with an external argparser as it will
corrupt tracking data if forced.
"""
def prepare_argparser():
if argparser in self.argparser_details:
return False
result = self.argpa... | python | def init_argparser(self, argparser):
"""
This should not be called with an external argparser as it will
corrupt tracking data if forced.
"""
def prepare_argparser():
if argparser in self.argparser_details:
return False
result = self.argpa... | [
"def",
"init_argparser",
"(",
"self",
",",
"argparser",
")",
":",
"def",
"prepare_argparser",
"(",
")",
":",
"if",
"argparser",
"in",
"self",
".",
"argparser_details",
":",
"return",
"False",
"result",
"=",
"self",
".",
"argparser_details",
"[",
"argparser",
... | This should not be called with an external argparser as it will
corrupt tracking data if forced. | [
"This",
"should",
"not",
"be",
"called",
"with",
"an",
"external",
"argparser",
"as",
"it",
"will",
"corrupt",
"tracking",
"data",
"if",
"forced",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L421-L608 |
calmjs/calmjs | src/calmjs/runtime.py | Runtime.unrecognized_arguments_error | def unrecognized_arguments_error(self, args, parsed, extras):
"""
This exists because argparser is dumb and naive and doesn't
fail unrecognized arguments early.
"""
# loop variants
kwargs = vars(parsed)
failed = list(extras)
# initial values
runti... | python | def unrecognized_arguments_error(self, args, parsed, extras):
"""
This exists because argparser is dumb and naive and doesn't
fail unrecognized arguments early.
"""
# loop variants
kwargs = vars(parsed)
failed = list(extras)
# initial values
runti... | [
"def",
"unrecognized_arguments_error",
"(",
"self",
",",
"args",
",",
"parsed",
",",
"extras",
")",
":",
"# loop variants",
"kwargs",
"=",
"vars",
"(",
"parsed",
")",
"failed",
"=",
"list",
"(",
"extras",
")",
"# initial values",
"runtime",
",",
"subparser",
... | This exists because argparser is dumb and naive and doesn't
fail unrecognized arguments early. | [
"This",
"exists",
"because",
"argparser",
"is",
"dumb",
"and",
"naive",
"and",
"doesn",
"t",
"fail",
"unrecognized",
"arguments",
"early",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L619-L672 |
calmjs/calmjs | src/calmjs/runtime.py | Runtime.error | def error(self, argparser, target, message):
"""
This was used as part of the original non-recursive lookup for
the target parser.
"""
warnings.warn(
'Runtime.error is deprecated and will be removed by calmjs-4.0.0',
DeprecationWarning)
details = ... | python | def error(self, argparser, target, message):
"""
This was used as part of the original non-recursive lookup for
the target parser.
"""
warnings.warn(
'Runtime.error is deprecated and will be removed by calmjs-4.0.0',
DeprecationWarning)
details = ... | [
"def",
"error",
"(",
"self",
",",
"argparser",
",",
"target",
",",
"message",
")",
":",
"warnings",
".",
"warn",
"(",
"'Runtime.error is deprecated and will be removed by calmjs-4.0.0'",
",",
"DeprecationWarning",
")",
"details",
"=",
"self",
".",
"get_argparser_detai... | This was used as part of the original non-recursive lookup for
the target parser. | [
"This",
"was",
"used",
"as",
"part",
"of",
"the",
"original",
"non",
"-",
"recursive",
"lookup",
"for",
"the",
"target",
"parser",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L674-L685 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.init_argparser_export_target | def init_argparser_export_target(
self, argparser,
default=None,
help='the export target',
):
"""
Subclass could override this by providing alternative keyword
arguments and call this as its super. It should not reimplement
this completely... | python | def init_argparser_export_target(
self, argparser,
default=None,
help='the export target',
):
"""
Subclass could override this by providing alternative keyword
arguments and call this as its super. It should not reimplement
this completely... | [
"def",
"init_argparser_export_target",
"(",
"self",
",",
"argparser",
",",
"default",
"=",
"None",
",",
"help",
"=",
"'the export target'",
",",
")",
":",
"argparser",
".",
"add_argument",
"(",
"'-w'",
",",
"'--overwrite'",
",",
"dest",
"=",
"EXPORT_TARGET_OVERW... | Subclass could override this by providing alternative keyword
arguments and call this as its super. It should not reimplement
this completely. Example:
def init_argparser_export_target(self, argparser):
super(MyToolchainRuntime, self).init_argparser_export_target(
... | [
"Subclass",
"could",
"override",
"this",
"by",
"providing",
"alternative",
"keyword",
"arguments",
"and",
"call",
"this",
"as",
"its",
"super",
".",
"It",
"should",
"not",
"reimplement",
"this",
"completely",
".",
"Example",
":"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L750-L790 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.init_argparser_working_dir | def init_argparser_working_dir(
self, argparser,
explanation='',
help_template=(
'the working directory; %(explanation)s'
'default is current working directory (%(cwd)s)'),
):
"""
Subclass could an extra expanation on how th... | python | def init_argparser_working_dir(
self, argparser,
explanation='',
help_template=(
'the working directory; %(explanation)s'
'default is current working directory (%(cwd)s)'),
):
"""
Subclass could an extra expanation on how th... | [
"def",
"init_argparser_working_dir",
"(",
"self",
",",
"argparser",
",",
"explanation",
"=",
"''",
",",
"help_template",
"=",
"(",
"'the working directory; %(explanation)s'",
"'default is current working directory (%(cwd)s)'",
")",
",",
")",
":",
"cwd",
"=",
"self",
"."... | Subclass could an extra expanation on how this is used.
Arguments
explanation
Explanation text for the default help template
help_template
A standard help message for this option. | [
"Subclass",
"could",
"an",
"extra",
"expanation",
"on",
"how",
"this",
"is",
"used",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L792-L816 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.init_argparser_build_dir | def init_argparser_build_dir(
self, argparser, help=(
'the build directory, where all sources will be copied to '
'as part of the build process; if left unspecified, the '
'default behavior is to create a new temporary directory '
'that will be... | python | def init_argparser_build_dir(
self, argparser, help=(
'the build directory, where all sources will be copied to '
'as part of the build process; if left unspecified, the '
'default behavior is to create a new temporary directory '
'that will be... | [
"def",
"init_argparser_build_dir",
"(",
"self",
",",
"argparser",
",",
"help",
"=",
"(",
"'the build directory, where all sources will be copied to '",
"'as part of the build process; if left unspecified, the '",
"'default behavior is to create a new temporary directory '",
"'that will be ... | For setting up build directory | [
"For",
"setting",
"up",
"build",
"directory"
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L818-L835 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.init_argparser_optional_advice | def init_argparser_optional_advice(
self, argparser, default=[], help=(
'a comma separated list of packages to retrieve optional '
'advice from; the provided packages should have registered '
'the appropriate entry points for setting up the advices for '
... | python | def init_argparser_optional_advice(
self, argparser, default=[], help=(
'a comma separated list of packages to retrieve optional '
'advice from; the provided packages should have registered '
'the appropriate entry points for setting up the advices for '
... | [
"def",
"init_argparser_optional_advice",
"(",
"self",
",",
"argparser",
",",
"default",
"=",
"[",
"]",
",",
"help",
"=",
"(",
"'a comma separated list of packages to retrieve optional '",
"'advice from; the provided packages should have registered '",
"'the appropriate entry points... | For setting up optional advice. | [
"For",
"setting",
"up",
"optional",
"advice",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L837-L854 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.init_argparser | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(ToolchainRuntime, self).init_argparser(argparser)
# it is possible for subclasses to... | python | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(ToolchainRuntime, self).init_argparser(argparser)
# it is possible for subclasses to... | [
"def",
"init_argparser",
"(",
"self",
",",
"argparser",
")",
":",
"super",
"(",
"ToolchainRuntime",
",",
"self",
")",
".",
"init_argparser",
"(",
"argparser",
")",
"# it is possible for subclasses to fully override this, but if",
"# they are using this as the runtime to drive... | Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand. | [
"Other",
"runtimes",
"(",
"or",
"users",
"of",
"ArgumentParser",
")",
"can",
"pass",
"their",
"subparser",
"into",
"here",
"to",
"collect",
"the",
"arguments",
"here",
"for",
"a",
"subcommand",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L856-L872 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.prepare_spec | def prepare_spec(self, spec, **kwargs):
"""
Prepare a spec for usage with the generic ToolchainRuntime.
Subclasses should avoid overriding this; override create_spec
instead.
"""
self.prepare_spec_debug_flag(spec, **kwargs)
self.prepare_spec_export_target_checks... | python | def prepare_spec(self, spec, **kwargs):
"""
Prepare a spec for usage with the generic ToolchainRuntime.
Subclasses should avoid overriding this; override create_spec
instead.
"""
self.prepare_spec_debug_flag(spec, **kwargs)
self.prepare_spec_export_target_checks... | [
"def",
"prepare_spec",
"(",
"self",
",",
"spec",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"prepare_spec_debug_flag",
"(",
"spec",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"prepare_spec_export_target_checks",
"(",
"spec",
",",
"*",
"*",
"kwargs",
... | Prepare a spec for usage with the generic ToolchainRuntime.
Subclasses should avoid overriding this; override create_spec
instead. | [
"Prepare",
"a",
"spec",
"for",
"usage",
"with",
"the",
"generic",
"ToolchainRuntime",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L926-L937 |
calmjs/calmjs | src/calmjs/runtime.py | ToolchainRuntime.kwargs_to_spec | def kwargs_to_spec(self, **kwargs):
"""
Turn the provided kwargs into arguments ready for toolchain.
"""
spec = self.create_spec(**kwargs)
self.prepare_spec(spec, **kwargs)
return spec | python | def kwargs_to_spec(self, **kwargs):
"""
Turn the provided kwargs into arguments ready for toolchain.
"""
spec = self.create_spec(**kwargs)
self.prepare_spec(spec, **kwargs)
return spec | [
"def",
"kwargs_to_spec",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"spec",
"=",
"self",
".",
"create_spec",
"(",
"*",
"*",
"kwargs",
")",
"self",
".",
"prepare_spec",
"(",
"spec",
",",
"*",
"*",
"kwargs",
")",
"return",
"spec"
] | Turn the provided kwargs into arguments ready for toolchain. | [
"Turn",
"the",
"provided",
"kwargs",
"into",
"arguments",
"ready",
"for",
"toolchain",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L947-L954 |
calmjs/calmjs | src/calmjs/runtime.py | BaseArtifactRegistryRuntime.init_argparser_package_names | def init_argparser_package_names(self, argparser, help=(
'names of the python package to generate artifacts for; '
'note that the metadata directory for the specified '
'packages must be writable')):
"""
Default helper for setting up the package_names opti... | python | def init_argparser_package_names(self, argparser, help=(
'names of the python package to generate artifacts for; '
'note that the metadata directory for the specified '
'packages must be writable')):
"""
Default helper for setting up the package_names opti... | [
"def",
"init_argparser_package_names",
"(",
"self",
",",
"argparser",
",",
"help",
"=",
"(",
"'names of the python package to generate artifacts for; '",
"'note that the metadata directory for the specified '",
"'packages must be writable'",
")",
")",
":",
"argparser",
".",
"add_... | Default helper for setting up the package_names option.
This is separate so that subclasses are not assumed for the
purposes of artifact creation; they should consider modifying
the default help message to reflect the fact. | [
"Default",
"helper",
"for",
"setting",
"up",
"the",
"package_names",
"option",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L995-L1008 |
calmjs/calmjs | src/calmjs/runtime.py | SourcePackageToolchainRuntime.init_argparser_source_registry | def init_argparser_source_registry(
self, argparser, default=None, help=(
'comma separated list of registries to use for gathering '
'JavaScript sources from the given Python packages'
)):
"""
For setting up the source registry flag.
"""
... | python | def init_argparser_source_registry(
self, argparser, default=None, help=(
'comma separated list of registries to use for gathering '
'JavaScript sources from the given Python packages'
)):
"""
For setting up the source registry flag.
"""
... | [
"def",
"init_argparser_source_registry",
"(",
"self",
",",
"argparser",
",",
"default",
"=",
"None",
",",
"help",
"=",
"(",
"'comma separated list of registries to use for gathering '",
"'JavaScript sources from the given Python packages'",
")",
")",
":",
"argparser",
".",
... | For setting up the source registry flag. | [
"For",
"setting",
"up",
"the",
"source",
"registry",
"flag",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L1027-L1047 |
calmjs/calmjs | src/calmjs/runtime.py | SourcePackageToolchainRuntime.init_argparser_loaderplugin_registry | def init_argparser_loaderplugin_registry(
self, argparser, default=None, help=(
'the name of the registry to use for the handling of loader '
'plugins that may be loaded from the given Python packages'
)):
"""
Default helper for setting up the load... | python | def init_argparser_loaderplugin_registry(
self, argparser, default=None, help=(
'the name of the registry to use for the handling of loader '
'plugins that may be loaded from the given Python packages'
)):
"""
Default helper for setting up the load... | [
"def",
"init_argparser_loaderplugin_registry",
"(",
"self",
",",
"argparser",
",",
"default",
"=",
"None",
",",
"help",
"=",
"(",
"'the name of the registry to use for the handling of loader '",
"'plugins that may be loaded from the given Python packages'",
")",
")",
":",
"argp... | Default helper for setting up the loaderplugin registries flags.
Note that this is NOT part of the init_argparser due to
implementation specific requirements. Subclasses should
consider modifying the default value help message to cater to the
toolchain it encapsulates. | [
"Default",
"helper",
"for",
"setting",
"up",
"the",
"loaderplugin",
"registries",
"flags",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L1049-L1068 |
calmjs/calmjs | src/calmjs/runtime.py | SourcePackageToolchainRuntime.init_argparser | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(SourcePackageToolchainRuntime, self).init_argparser(argparser)
self.init_argparser_s... | python | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(SourcePackageToolchainRuntime, self).init_argparser(argparser)
self.init_argparser_s... | [
"def",
"init_argparser",
"(",
"self",
",",
"argparser",
")",
":",
"super",
"(",
"SourcePackageToolchainRuntime",
",",
"self",
")",
".",
"init_argparser",
"(",
"argparser",
")",
"self",
".",
"init_argparser_source_registry",
"(",
"argparser",
")",
"self",
".",
"i... | Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand. | [
"Other",
"runtimes",
"(",
"or",
"users",
"of",
"ArgumentParser",
")",
"can",
"pass",
"their",
"subparser",
"into",
"here",
"to",
"collect",
"the",
"arguments",
"here",
"for",
"a",
"subcommand",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L1081-L1091 |
calmjs/calmjs | src/calmjs/runtime.py | PackageManagerRuntime.init_argparser | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(PackageManagerRuntime, self).init_argparser(argparser)
# Ideally, we could use more ... | python | def init_argparser(self, argparser):
"""
Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand.
"""
super(PackageManagerRuntime, self).init_argparser(argparser)
# Ideally, we could use more ... | [
"def",
"init_argparser",
"(",
"self",
",",
"argparser",
")",
":",
"super",
"(",
"PackageManagerRuntime",
",",
"self",
")",
".",
"init_argparser",
"(",
"argparser",
")",
"# Ideally, we could use more subparsers for each action (i.e.",
"# init and install). However, this is co... | Other runtimes (or users of ArgumentParser) can pass their
subparser into here to collect the arguments here for a
subcommand. | [
"Other",
"runtimes",
"(",
"or",
"users",
"of",
"ArgumentParser",
")",
"can",
"pass",
"their",
"subparser",
"into",
"here",
"to",
"collect",
"the",
"arguments",
"here",
"for",
"a",
"subcommand",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/runtime.py#L1172-L1220 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | alphanum | def alphanum(columns, name=None, extended=False, isLast=False):
"""
Creates the grammar for an Alphanumeric (A) field, accepting only the
specified number of characters.
By default Alphanumeric fields accept only ASCII characters, excluding
lowercases. If the extended flag is set to True, then non-... | python | def alphanum(columns, name=None, extended=False, isLast=False):
"""
Creates the grammar for an Alphanumeric (A) field, accepting only the
specified number of characters.
By default Alphanumeric fields accept only ASCII characters, excluding
lowercases. If the extended flag is set to True, then non-... | [
"def",
"alphanum",
"(",
"columns",
",",
"name",
"=",
"None",
",",
"extended",
"=",
"False",
",",
"isLast",
"=",
"False",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Alphanumeric Field'",
"if",
"columns",
"<",
"0",
":",
"# Can't be empty or ... | Creates the grammar for an Alphanumeric (A) field, accepting only the
specified number of characters.
By default Alphanumeric fields accept only ASCII characters, excluding
lowercases. If the extended flag is set to True, then non-ASCII characters
are allowed, but the no ASCII lowercase constraint is k... | [
"Creates",
"the",
"grammar",
"for",
"an",
"Alphanumeric",
"(",
"A",
")",
"field",
"accepting",
"only",
"the",
"specified",
"number",
"of",
"characters",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L51-L105 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | _check_not_empty | def _check_not_empty(string):
"""
Checks that the string is not empty.
If it is empty an exception is raised, stopping the validation.
This is used for compulsory alphanumeric fields.
:param string: the field value
"""
string = string.strip()
if len(string) == 0:
message = 'T... | python | def _check_not_empty(string):
"""
Checks that the string is not empty.
If it is empty an exception is raised, stopping the validation.
This is used for compulsory alphanumeric fields.
:param string: the field value
"""
string = string.strip()
if len(string) == 0:
message = 'T... | [
"def",
"_check_not_empty",
"(",
"string",
")",
":",
"string",
"=",
"string",
".",
"strip",
"(",
")",
"if",
"len",
"(",
"string",
")",
"==",
"0",
":",
"message",
"=",
"'The string should not be empty'",
"raise",
"pp",
".",
"ParseException",
"(",
"message",
... | Checks that the string is not empty.
If it is empty an exception is raised, stopping the validation.
This is used for compulsory alphanumeric fields.
:param string: the field value | [
"Checks",
"that",
"the",
"string",
"is",
"not",
"empty",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L108-L122 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | numeric | def numeric(columns, name=None):
"""
Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows integers.
:param columns: number of columns for this field
:param name: name for the field
:return: grammar for the integer numeric ... | python | def numeric(columns, name=None):
"""
Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows integers.
:param columns: number of columns for this field
:param name: name for the field
:return: grammar for the integer numeric ... | [
"def",
"numeric",
"(",
"columns",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Numeric Field'",
"if",
"columns",
"<=",
"0",
":",
"# Can't be empty or have negative size",
"raise",
"BaseException",
"(",
")",
"# Only number... | Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows integers.
:param columns: number of columns for this field
:param name: name for the field
:return: grammar for the integer numeric field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Numeric",
"(",
"N",
")",
"field",
"accepting",
"only",
"the",
"specified",
"number",
"of",
"characters",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L135-L164 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | numeric_float | def numeric_float(columns, nums_int, name=None):
"""
Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows floats.
As nothing in the string itself indicates how many of the characters are
for the integer and the decimal section... | python | def numeric_float(columns, nums_int, name=None):
"""
Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows floats.
As nothing in the string itself indicates how many of the characters are
for the integer and the decimal section... | [
"def",
"numeric_float",
"(",
"columns",
",",
"nums_int",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Numeric Field'",
"if",
"columns",
"<=",
"0",
":",
"# Can't be empty or have negative size",
"raise",
"BaseException",
"... | Creates the grammar for a Numeric (N) field, accepting only the specified
number of characters.
This version only allows floats.
As nothing in the string itself indicates how many of the characters are
for the integer and the decimal sections, this should be specified with
the nums_int parameter.
... | [
"Creates",
"the",
"grammar",
"for",
"a",
"Numeric",
"(",
"N",
")",
"field",
"accepting",
"only",
"the",
"specified",
"number",
"of",
"characters",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L190-L242 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | _to_numeric_float | def _to_numeric_float(number, nums_int):
"""
Transforms a string into a float.
The nums_int parameter indicates the number of characters, starting from
the left, to be used for the integer value. All the remaining ones will be
used for the decimal value.
:param number: string with the number
... | python | def _to_numeric_float(number, nums_int):
"""
Transforms a string into a float.
The nums_int parameter indicates the number of characters, starting from
the left, to be used for the integer value. All the remaining ones will be
used for the decimal value.
:param number: string with the number
... | [
"def",
"_to_numeric_float",
"(",
"number",
",",
"nums_int",
")",
":",
"index_end",
"=",
"len",
"(",
"number",
")",
"-",
"nums_int",
"return",
"float",
"(",
"number",
"[",
":",
"nums_int",
"]",
"+",
"'.'",
"+",
"number",
"[",
"-",
"index_end",
":",
"]",... | Transforms a string into a float.
The nums_int parameter indicates the number of characters, starting from
the left, to be used for the integer value. All the remaining ones will be
used for the decimal value.
:param number: string with the number
:param nums_int: characters, counting from the lef... | [
"Transforms",
"a",
"string",
"into",
"a",
"float",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L245-L258 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | _check_above_value_float | def _check_above_value_float(string, minimum):
"""
Checks that the number parsed from the string is above a minimum.
This is used on compulsory numeric fields.
If the value is not above the minimum an exception is thrown.
:param string: the field value
:param minimum: minimum value
"""
... | python | def _check_above_value_float(string, minimum):
"""
Checks that the number parsed from the string is above a minimum.
This is used on compulsory numeric fields.
If the value is not above the minimum an exception is thrown.
:param string: the field value
:param minimum: minimum value
"""
... | [
"def",
"_check_above_value_float",
"(",
"string",
",",
"minimum",
")",
":",
"value",
"=",
"float",
"(",
"string",
")",
"if",
"value",
"<",
"minimum",
":",
"message",
"=",
"'The Numeric Field value should be above %s'",
"%",
"minimum",
"raise",
"pp",
".",
"ParseE... | Checks that the number parsed from the string is above a minimum.
This is used on compulsory numeric fields.
If the value is not above the minimum an exception is thrown.
:param string: the field value
:param minimum: minimum value | [
"Checks",
"that",
"the",
"number",
"parsed",
"from",
"the",
"string",
"is",
"above",
"a",
"minimum",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L261-L276 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | boolean | def boolean(name=None):
"""
Creates the grammar for a Boolean (B) field, accepting only 'Y' or 'N'
:param name: name for the field
:return: grammar for the flag field
"""
if name is None:
name = 'Boolean Field'
# Basic field
field = pp.Regex('[YN]')
# Parse action
fie... | python | def boolean(name=None):
"""
Creates the grammar for a Boolean (B) field, accepting only 'Y' or 'N'
:param name: name for the field
:return: grammar for the flag field
"""
if name is None:
name = 'Boolean Field'
# Basic field
field = pp.Regex('[YN]')
# Parse action
fie... | [
"def",
"boolean",
"(",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Boolean Field'",
"# Basic field",
"field",
"=",
"pp",
".",
"Regex",
"(",
"'[YN]'",
")",
"# Parse action",
"field",
".",
"setParseAction",
"(",
"lambda",
... | Creates the grammar for a Boolean (B) field, accepting only 'Y' or 'N'
:param name: name for the field
:return: grammar for the flag field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Boolean",
"(",
"B",
")",
"field",
"accepting",
"only",
"Y",
"or",
"N"
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L288-L308 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | _to_boolean | def _to_boolean(string):
"""
Transforms a string into a boolean value.
If a value which is not 'Y' or 'N' is received, a ParseException is thrown.
:param: string: the string to transform
:return: True if the string is 'Y', False if it is 'N'
"""
if string == 'Y':
result = True
... | python | def _to_boolean(string):
"""
Transforms a string into a boolean value.
If a value which is not 'Y' or 'N' is received, a ParseException is thrown.
:param: string: the string to transform
:return: True if the string is 'Y', False if it is 'N'
"""
if string == 'Y':
result = True
... | [
"def",
"_to_boolean",
"(",
"string",
")",
":",
"if",
"string",
"==",
"'Y'",
":",
"result",
"=",
"True",
"elif",
"string",
"==",
"'N'",
":",
"result",
"=",
"False",
"else",
":",
"raise",
"pp",
".",
"ParseException",
"(",
"string",
",",
"msg",
"=",
"'I... | Transforms a string into a boolean value.
If a value which is not 'Y' or 'N' is received, a ParseException is thrown.
:param: string: the string to transform
:return: True if the string is 'Y', False if it is 'N' | [
"Transforms",
"a",
"string",
"into",
"a",
"boolean",
"value",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L311-L328 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | flag | def flag(name=None):
"""
Creates the grammar for a Flag (F) field, accepting only 'Y', 'N' or 'U'.
:param name: name for the field
:return: grammar for the flag field
"""
if name is None:
name = 'Flag Field'
# Basic field
field = pp.Regex('[YNU]')
# Name
field.setName... | python | def flag(name=None):
"""
Creates the grammar for a Flag (F) field, accepting only 'Y', 'N' or 'U'.
:param name: name for the field
:return: grammar for the flag field
"""
if name is None:
name = 'Flag Field'
# Basic field
field = pp.Regex('[YNU]')
# Name
field.setName... | [
"def",
"flag",
"(",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Flag Field'",
"# Basic field",
"field",
"=",
"pp",
".",
"Regex",
"(",
"'[YNU]'",
")",
"# Name",
"field",
".",
"setName",
"(",
"name",
")",
"field",
"."... | Creates the grammar for a Flag (F) field, accepting only 'Y', 'N' or 'U'.
:param name: name for the field
:return: grammar for the flag field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Flag",
"(",
"F",
")",
"field",
"accepting",
"only",
"Y",
"N",
"or",
"U",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L340-L359 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | date | def date(name=None):
"""
Creates the grammar for a Date (D) field, accepting only numbers in a
certain pattern.
:param name: name for the field
:return: grammar for the date field
"""
if name is None:
name = 'Date Field'
# Basic field
# This regex allows values from 000001... | python | def date(name=None):
"""
Creates the grammar for a Date (D) field, accepting only numbers in a
certain pattern.
:param name: name for the field
:return: grammar for the date field
"""
if name is None:
name = 'Date Field'
# Basic field
# This regex allows values from 000001... | [
"def",
"date",
"(",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Date Field'",
"# Basic field",
"# This regex allows values from 00000101 to 99991231",
"field",
"=",
"pp",
".",
"Regex",
"(",
"'[0-9][0-9][0-9][0-9](0[1-9]|1[0-2])'",
... | Creates the grammar for a Date (D) field, accepting only numbers in a
certain pattern.
:param name: name for the field
:return: grammar for the date field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Date",
"(",
"D",
")",
"field",
"accepting",
"only",
"numbers",
"in",
"a",
"certain",
"pattern",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L374-L401 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | time | def time(name=None):
"""
Creates the grammar for a Time or Duration (T) field, accepting only
numbers in a certain pattern.
:param name: name for the field
:return: grammar for the date field
"""
if name is None:
name = 'Time Field'
# Basic field
# This regex allows values... | python | def time(name=None):
"""
Creates the grammar for a Time or Duration (T) field, accepting only
numbers in a certain pattern.
:param name: name for the field
:return: grammar for the date field
"""
if name is None:
name = 'Time Field'
# Basic field
# This regex allows values... | [
"def",
"time",
"(",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Time Field'",
"# Basic field",
"# This regex allows values from 000000 to 235959",
"field",
"=",
"pp",
".",
"Regex",
"(",
"'(0[0-9]|1[0-9]|2[0-3])[0-5][0-9][0-5][0-9]'",... | Creates the grammar for a Time or Duration (T) field, accepting only
numbers in a certain pattern.
:param name: name for the field
:return: grammar for the date field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Time",
"or",
"Duration",
"(",
"T",
")",
"field",
"accepting",
"only",
"numbers",
"in",
"a",
"certain",
"pattern",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L416-L442 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | lookup | def lookup(values, name=None):
"""
Creates the grammar for a Lookup (L) field, accepting only values from a
list.
Like in the Alphanumeric field, the result will be stripped of all heading
and trailing whitespaces.
:param values: values allowed
:param name: name for the field
:return: ... | python | def lookup(values, name=None):
"""
Creates the grammar for a Lookup (L) field, accepting only values from a
list.
Like in the Alphanumeric field, the result will be stripped of all heading
and trailing whitespaces.
:param values: values allowed
:param name: name for the field
:return: ... | [
"def",
"lookup",
"(",
"values",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Lookup Field'",
"if",
"values",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"'The values can no be None'",
")",
"# TODO: This should not be n... | Creates the grammar for a Lookup (L) field, accepting only values from a
list.
Like in the Alphanumeric field, the result will be stripped of all heading
and trailing whitespaces.
:param values: values allowed
:param name: name for the field
:return: grammar for the lookup field | [
"Creates",
"the",
"grammar",
"for",
"a",
"Lookup",
"(",
"L",
")",
"field",
"accepting",
"only",
"values",
"from",
"a",
"list",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L452-L486 |
weso/CWR-DataApi | cwr/grammar/field/basic.py | blank | def blank(columns=1, name=None):
"""
Creates the grammar for a blank field.
These are for constant empty strings which should be ignored, as they are
used just as fillers.
:param columns: number of columns, which is the required number of
whitespaces
:param name: name for the field
:re... | python | def blank(columns=1, name=None):
"""
Creates the grammar for a blank field.
These are for constant empty strings which should be ignored, as they are
used just as fillers.
:param columns: number of columns, which is the required number of
whitespaces
:param name: name for the field
:re... | [
"def",
"blank",
"(",
"columns",
"=",
"1",
",",
"name",
"=",
"None",
")",
":",
"if",
"name",
"is",
"None",
":",
"name",
"=",
"'Blank Field'",
"field",
"=",
"pp",
".",
"Regex",
"(",
"'[ ]{'",
"+",
"str",
"(",
"columns",
")",
"+",
"'}'",
")",
"field... | Creates the grammar for a blank field.
These are for constant empty strings which should be ignored, as they are
used just as fillers.
:param columns: number of columns, which is the required number of
whitespaces
:param name: name for the field
:return: grammar for the blank field | [
"Creates",
"the",
"grammar",
"for",
"a",
"blank",
"field",
"."
] | train | https://github.com/weso/CWR-DataApi/blob/f3b6ba8308c901b6ab87073c155c08e30692333c/cwr/grammar/field/basic.py#L496-L517 |
pandeylab/pythomics | pythomics/genomics/parsers.py | GFFReader.get_attribute | def get_attribute(self, attribute, value=None, features=False):
"""This returns a list of GFF objects (or GFF Features) with the given attribute and if supplied, those
attributes with the specified value
:param attribute: The 'info' field attribute we are querying
:param value: Optional... | python | def get_attribute(self, attribute, value=None, features=False):
"""This returns a list of GFF objects (or GFF Features) with the given attribute and if supplied, those
attributes with the specified value
:param attribute: The 'info' field attribute we are querying
:param value: Optional... | [
"def",
"get_attribute",
"(",
"self",
",",
"attribute",
",",
"value",
"=",
"None",
",",
"features",
"=",
"False",
")",
":",
"if",
"attribute",
"in",
"self",
".",
"filters",
":",
"valid_gff_objects",
"=",
"self",
".",
"fast_attributes",
"[",
"attribute",
"]"... | This returns a list of GFF objects (or GFF Features) with the given attribute and if supplied, those
attributes with the specified value
:param attribute: The 'info' field attribute we are querying
:param value: Optional keyword, only return attributes equal to this value
:param feature... | [
"This",
"returns",
"a",
"list",
"of",
"GFF",
"objects",
"(",
"or",
"GFF",
"Features",
")",
"with",
"the",
"given",
"attribute",
"and",
"if",
"supplied",
"those",
"attributes",
"with",
"the",
"specified",
"value"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/parsers.py#L203-L230 |
pandeylab/pythomics | pythomics/genomics/parsers.py | GFFReader.contains | def contains(self, seqid, start, end, overlap=True):
"""This returns a list of GFF objects which cover a specified location.
:param seqid: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-based ... | python | def contains(self, seqid, start, end, overlap=True):
"""This returns a list of GFF objects which cover a specified location.
:param seqid: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-based ... | [
"def",
"contains",
"(",
"self",
",",
"seqid",
",",
"start",
",",
"end",
",",
"overlap",
"=",
"True",
")",
":",
"d",
"=",
"self",
".",
"positions",
".",
"get",
"(",
"seqid",
",",
"[",
"]",
")",
"if",
"overlap",
":",
"return",
"[",
"gff_object",
"f... | This returns a list of GFF objects which cover a specified location.
:param seqid: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-based position of the end of the range we are querying
:param ... | [
"This",
"returns",
"a",
"list",
"of",
"GFF",
"objects",
"which",
"cover",
"a",
"specified",
"location",
"."
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/parsers.py#L232-L251 |
pandeylab/pythomics | pythomics/genomics/parsers.py | VCFReader.contains | def contains(self, chrom, start, end, overlap=True):
"""This returns a list of VCFEntry objects which cover a specified location.
:param chrom: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-b... | python | def contains(self, chrom, start, end, overlap=True):
"""This returns a list of VCFEntry objects which cover a specified location.
:param chrom: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-b... | [
"def",
"contains",
"(",
"self",
",",
"chrom",
",",
"start",
",",
"end",
",",
"overlap",
"=",
"True",
")",
":",
"d",
"=",
"self",
".",
"positions",
".",
"get",
"(",
"chrom",
",",
"[",
"]",
")",
"if",
"overlap",
":",
"return",
"[",
"vcf_entry",
"fo... | This returns a list of VCFEntry objects which cover a specified location.
:param chrom: The landmark identifier (usually a chromosome)
:param start: The 1-based position of the start of the range we are querying
:param end: The 1-based position of the end of the range we are querying
:p... | [
"This",
"returns",
"a",
"list",
"of",
"VCFEntry",
"objects",
"which",
"cover",
"a",
"specified",
"location",
"."
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/parsers.py#L305-L324 |
pandeylab/pythomics | pythomics/genomics/parsers.py | VCFReader.remove_variants | def remove_variants(self, variants):
"""Remove a list of variants from the positions we are scanning"""
chroms = set([i.chrom for i in variants])
for chrom in chroms:
if self.append_chromosome:
chrom = 'chr%s' % chrom
to_delete = [pos for pos in self.posit... | python | def remove_variants(self, variants):
"""Remove a list of variants from the positions we are scanning"""
chroms = set([i.chrom for i in variants])
for chrom in chroms:
if self.append_chromosome:
chrom = 'chr%s' % chrom
to_delete = [pos for pos in self.posit... | [
"def",
"remove_variants",
"(",
"self",
",",
"variants",
")",
":",
"chroms",
"=",
"set",
"(",
"[",
"i",
".",
"chrom",
"for",
"i",
"in",
"variants",
"]",
")",
"for",
"chrom",
"in",
"chroms",
":",
"if",
"self",
".",
"append_chromosome",
":",
"chrom",
"=... | Remove a list of variants from the positions we are scanning | [
"Remove",
"a",
"list",
"of",
"variants",
"from",
"the",
"positions",
"we",
"are",
"scanning"
] | train | https://github.com/pandeylab/pythomics/blob/ab0a5651a2e02a25def4d277b35fa09d1631bfcb/pythomics/genomics/parsers.py#L326-L334 |
calmjs/calmjs | src/calmjs/loaderplugin.py | LoaderPluginHandler.generate_handler_sourcepath | def generate_handler_sourcepath(
self, toolchain, spec, loaderplugin_sourcepath):
"""
The default implementation is a recursive lookup method, which
subclasses may make use of.
Subclasses must implement this to return a mapping of modnames
the the absolute path of th... | python | def generate_handler_sourcepath(
self, toolchain, spec, loaderplugin_sourcepath):
"""
The default implementation is a recursive lookup method, which
subclasses may make use of.
Subclasses must implement this to return a mapping of modnames
the the absolute path of th... | [
"def",
"generate_handler_sourcepath",
"(",
"self",
",",
"toolchain",
",",
"spec",
",",
"loaderplugin_sourcepath",
")",
":",
"# since the loaderplugin_sourcepath values is the complete",
"# modpath with the loader plugin, the values must be stripped",
"# before making use of the filtering... | The default implementation is a recursive lookup method, which
subclasses may make use of.
Subclasses must implement this to return a mapping of modnames
the the absolute path of the desired sourcefiles. Example:
return {
'text': '/tmp/src/example_module/text/index.js',
... | [
"The",
"default",
"implementation",
"is",
"a",
"recursive",
"lookup",
"method",
"which",
"subclasses",
"may",
"make",
"use",
"of",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/loaderplugin.py#L49-L104 |
calmjs/calmjs | src/calmjs/loaderplugin.py | NPMLoaderPluginHandler.generate_handler_sourcepath | def generate_handler_sourcepath(
self, toolchain, spec, loaderplugin_sourcepath):
"""
Attempt to locate the plugin source; returns a mapping of
modnames to the absolute path of the located sources.
"""
# TODO calmjs-4.0.0 consider formalizing to the method instead
... | python | def generate_handler_sourcepath(
self, toolchain, spec, loaderplugin_sourcepath):
"""
Attempt to locate the plugin source; returns a mapping of
modnames to the absolute path of the located sources.
"""
# TODO calmjs-4.0.0 consider formalizing to the method instead
... | [
"def",
"generate_handler_sourcepath",
"(",
"self",
",",
"toolchain",
",",
"spec",
",",
"loaderplugin_sourcepath",
")",
":",
"# TODO calmjs-4.0.0 consider formalizing to the method instead",
"npm_pkg_name",
"=",
"(",
"self",
".",
"node_module_pkg_name",
"if",
"self",
".",
... | Attempt to locate the plugin source; returns a mapping of
modnames to the absolute path of the located sources. | [
"Attempt",
"to",
"locate",
"the",
"plugin",
"source",
";",
"returns",
"a",
"mapping",
"of",
"modnames",
"to",
"the",
"absolute",
"path",
"of",
"the",
"located",
"sources",
"."
] | train | https://github.com/calmjs/calmjs/blob/b9b407c2b6a7662da64bccba93bb8d92e7a5fafd/src/calmjs/loaderplugin.py#L126-L205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.