Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
pp_options_list
(keys, width=80, _print=False)
Builds a concise listing of available options, grouped by prefix
Builds a concise listing of available options, grouped by prefix
def pp_options_list(keys, width=80, _print=False): """ Builds a concise listing of available options, grouped by prefix """ from textwrap import wrap from itertools import groupby def pp(name, ks): pfx = ('- ' + name + '.[' if name else '') ls = wrap(', '.join(ks), width, initial_inden...
[ "def", "pp_options_list", "(", "keys", ",", "width", "=", "80", ",", "_print", "=", "False", ")", ":", "from", "textwrap", "import", "wrap", "from", "itertools", "import", "groupby", "def", "pp", "(", "name", ",", "ks", ")", ":", "pfx", "=", "(", "'-...
[ 592, 0 ]
[ 619, 16 ]
python
en
['en', 'en', 'en']
True
config_prefix
(prefix)
contextmanager for multiple invocations of API with a common prefix supported API functions: (register / get / set )__option Warning: This is not thread - safe, and won't work properly if you import the API functions into your module using the "from x import y" construct. Example: import ibis.confi...
contextmanager for multiple invocations of API with a common prefix supported API functions: (register / get / set )__option Warning: This is not thread - safe, and won't work properly if you import the API functions into your module using the "from x import y" construct. Example: import ibis.confi...
def config_prefix(prefix): """contextmanager for multiple invocations of API with a common prefix supported API functions: (register / get / set )__option Warning: This is not thread - safe, and won't work properly if you import the API functions into your module using the "from x import y" construct. ...
[ "def", "config_prefix", "(", "prefix", ")", ":", "# Note: reset_option relies on set_option, and on key directly", "# it does not fit in to this monkey-patching scheme", "global", "register_option", ",", "get_option", ",", "set_option", ",", "reset_option", "def", "wrap", "(", ...
[ 627, 0 ]
[ 667, 38 ]
python
en
['en', 'en', 'en']
True
is_type_factory
(_type)
Parameters ---------- `_type` - a type to be compared against (e.g. type(x) == `_type`) Returns ------- validator - a function of a single argument x , which returns the True if type(x) is equal to `_type`
Parameters ---------- `_type` - a type to be compared against (e.g. type(x) == `_type`) Returns ------- validator - a function of a single argument x , which returns the True if type(x) is equal to `_type`
def is_type_factory(_type): """ Parameters ---------- `_type` - a type to be compared against (e.g. type(x) == `_type`) Returns ------- validator - a function of a single argument x , which returns the True if type(x) is equal to `_type` """ def inner(x): if ...
[ "def", "is_type_factory", "(", "_type", ")", ":", "def", "inner", "(", "x", ")", ":", "if", "type", "(", "x", ")", "!=", "_type", ":", "raise", "ValueError", "(", "\"Value must have type '%s'\"", "%", "str", "(", "_type", ")", ")", "return", "inner" ]
[ 673, 0 ]
[ 688, 16 ]
python
en
['en', 'error', 'th']
False
is_instance_factory
(_type)
Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which returns the True if x is an instance of `_type`
Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which returns the True if x is an instance of `_type`
def is_instance_factory(_type): """ Parameters ---------- `_type` - the type to be checked against Returns ------- validator - a function of a single argument x , which returns the True if x is an instance of `_type` """ if isinstance(_type, (tuple, list)): _t...
[ "def", "is_instance_factory", "(", "_type", ")", ":", "if", "isinstance", "(", "_type", ",", "(", "tuple", ",", "list", ")", ")", ":", "_type", "=", "tuple", "(", "_type", ")", "type_repr", "=", "\"|\"", ".", "join", "(", "map", "(", "str", ",", "_...
[ 691, 0 ]
[ 711, 16 ]
python
en
['en', 'error', 'th']
False
Get_License.getHwAddr
(self, ifname)
获取主机物理地址
获取主机物理地址
def getHwAddr(self, ifname): """ 获取主机物理地址 """ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', ifname[:15])) return ''.join(['%02x' % ord(char) for char in info[18:24]])
[ "def", "getHwAddr", "(", "self", ",", "ifname", ")", ":", "s", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_DGRAM", ")", "info", "=", "fcntl", ".", "ioctl", "(", "s", ".", "fileno", "(", ")", ",", "0x8927",...
[ 20, 4 ]
[ 26, 68 ]
python
en
['en', 'error', 'th']
False
Get_License.decrypt
(self, text)
从.lic中解密出主机地址
从.lic中解密出主机地址
def decrypt(self, text): """ 从.lic中解密出主机地址 """ try: cryptor = AES.new(self.aesKey, self.aesMode, self.aesIv) plain_text = cryptor.decrypt(a2b_hex(text)) return plain_text.rstrip('\0') except: return ""
[ "def", "decrypt", "(", "self", ",", "text", ")", ":", "try", ":", "cryptor", "=", "AES", ".", "new", "(", "self", ".", "aesKey", ",", "self", ".", "aesMode", ",", "self", ".", "aesIv", ")", "plain_text", "=", "cryptor", ".", "decrypt", "(", "a2b_he...
[ 28, 4 ]
[ 38, 21 ]
python
en
['en', 'error', 'th']
False
simple_get
(url)
Attempts to get the content at `url` by making an HTTP GET request. If the content-type of response is some kind of HTML/XML, return the text content, otherwise return None.
Attempts to get the content at `url` by making an HTTP GET request. If the content-type of response is some kind of HTML/XML, return the text content, otherwise return None.
def simple_get(url): """ Attempts to get the content at `url` by making an HTTP GET request. If the content-type of response is some kind of HTML/XML, return the text content, otherwise return None. """ try: with closing(get(url, stream=True)) as resp: if is_good_response(res...
[ "def", "simple_get", "(", "url", ")", ":", "try", ":", "with", "closing", "(", "get", "(", "url", ",", "stream", "=", "True", ")", ")", "as", "resp", ":", "if", "is_good_response", "(", "resp", ")", ":", "return", "resp", ".", "content", "else", ":...
[ 25, 0 ]
[ 40, 19 ]
python
en
['en', 'error', 'th']
False
is_good_response
(resp)
Returns True if the response seems to be HTML, False otherwise.
Returns True if the response seems to be HTML, False otherwise.
def is_good_response(resp): """ Returns True if the response seems to be HTML, False otherwise. """ content_type = resp.headers['Content-Type'].lower() return (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)
[ "def", "is_good_response", "(", "resp", ")", ":", "content_type", "=", "resp", ".", "headers", "[", "'Content-Type'", "]", ".", "lower", "(", ")", "return", "(", "resp", ".", "status_code", "==", "200", "and", "content_type", "is", "not", "None", "and", ...
[ 43, 0 ]
[ 50, 47 ]
python
en
['en', 'error', 'th']
False
create_udf_node
(name, fields)
Create a new UDF node type. Parameters ---------- name : str Then name of the UDF node fields : OrderedDict Mapping of class member name to definition Returns ------- result : type A new BigQueryUDFNode subclass
Create a new UDF node type.
def create_udf_node(name, fields): """Create a new UDF node type. Parameters ---------- name : str Then name of the UDF node fields : OrderedDict Mapping of class member name to definition Returns ------- result : type A new BigQueryUDFNode subclass """ ...
[ "def", "create_udf_node", "(", "name", ",", "fields", ")", ":", "definition", "=", "next", "(", "_udf_name_cache", "[", "name", "]", ")", "external_name", "=", "'{}_{:d}'", ".", "format", "(", "name", ",", "definition", ")", "return", "type", "(", "externa...
[ 22, 0 ]
[ 39, 58 ]
python
en
['en', 'en', 'en']
True
udf
(input_type, output_type, strict=True, libraries=None)
Define a UDF for BigQuery Parameters ---------- input_type : List[DataType] output_type : DataType strict : bool Whether or not to put a ``'use strict';`` string at the beginning of the UDF. Setting to ``False`` is probably a bad idea. libraries : List[str] A list of Goo...
Define a UDF for BigQuery
def udf(input_type, output_type, strict=True, libraries=None): '''Define a UDF for BigQuery Parameters ---------- input_type : List[DataType] output_type : DataType strict : bool Whether or not to put a ``'use strict';`` string at the beginning of the UDF. Setting to ``False`` i...
[ "def", "udf", "(", "input_type", ",", "output_type", ",", "strict", "=", "True", ",", "libraries", "=", "None", ")", ":", "if", "libraries", "is", "None", ":", "libraries", "=", "[", "]", "def", "wrapper", "(", "f", ")", ":", "if", "not", "callable",...
[ 42, 0 ]
[ 235, 18 ]
python
en
['en', 'pt', 'en']
True
test_limited_fetches
(started_cluster)
Test checks that that we utilize all available threads for fetches
Test checks that that we utilize all available threads for fetches
def test_limited_fetches(started_cluster): """ Test checks that that we utilize all available threads for fetches """ node1.query("CREATE TABLE t (key UInt64, data String) ENGINE = ReplicatedMergeTree('/clickhouse/test/t', '1') ORDER BY tuple() PARTITION BY key") node2.query("CREATE TABLE t (key...
[ "def", "test_limited_fetches", "(", "started_cluster", ")", ":", "node1", ".", "query", "(", "\"CREATE TABLE t (key UInt64, data String) ENGINE = ReplicatedMergeTree('/clickhouse/test/t', '1') ORDER BY tuple() PARTITION BY key\"", ")", "node2", ".", "query", "(", "\"CREATE TABLE t (k...
[ 32, 0 ]
[ 75, 46 ]
python
en
['en', 'error', 'th']
False
FileSock.readline
(self)
may be optimized...
may be optimized...
def readline(self): # print("readline!") """may be optimized...""" s=bytes() while True: c=self.read(1) s+=c if len(c)==0 or chr(c[0])=='\n': return s
[ "def", "readline", "(", "self", ")", ":", "# print(\"readline!\")", "s", "=", "bytes", "(", ")", "while", "True", ":", "c", "=", "self", ".", "read", "(", "1", ")", "s", "+=", "c", "if", "len", "(", "c", ")", "==", "0", "or", "chr", "(", "c", ...
[ 70, 4 ]
[ 78, 20 ]
python
en
['en', 'fil', 'en']
True
Server.one_function
(self)
Executes a single function with associated I/O. Protocol: - the arguments and results are serialized with the pickle protocol - client sends : (fname,args) fname = method name to call args = tuple of arguments - server sends result: (rid,st,ret) ...
Executes a single function with associated I/O. Protocol: - the arguments and results are serialized with the pickle protocol - client sends : (fname,args) fname = method name to call args = tuple of arguments - server sends result: (rid,st,ret) ...
def one_function(self): """ Executes a single function with associated I/O. Protocol: - the arguments and results are serialized with the pickle protocol - client sends : (fname,args) fname = method name to call args = tuple of arguments - server s...
[ "def", "one_function", "(", "self", ")", ":", "try", ":", "(", "fname", ",", "args", ")", "=", "pickle", ".", "load", "(", "self", ".", "fs", ")", "except", "EOFError", ":", "raise", "ClientExit", "(", "\"read args\"", ")", "self", ".", "log", "(", ...
[ 106, 4 ]
[ 151, 47 ]
python
en
['en', 'error', 'th']
False
Server.exec_loop
(self)
main execution loop. Loops and handles exit states
main execution loop. Loops and handles exit states
def exec_loop(self): """ main execution loop. Loops and handles exit states""" self.log("in exec_loop") try: while True: self.one_function() except ClientExit as e: self.log("ClientExit %s"%e) except socket.error as e: self.log...
[ "def", "exec_loop", "(", "self", ")", ":", "self", ".", "log", "(", "\"in exec_loop\"", ")", "try", ":", "while", "True", ":", "self", ".", "one_function", "(", ")", "except", "ClientExit", "as", "e", ":", "self", ".", "log", "(", "\"ClientExit %s\"", ...
[ 153, 4 ]
[ 173, 27 ]
python
en
['en', 'en', 'en']
True
get_env
(env_id, **kwargs)
Get environment Parameters ---------- env_id: str Environment identifier. kwargs: dict Parameters of the environment
Get environment
def get_env(env_id, **kwargs): """ Get environment Parameters ---------- env_id: str Environment identifier. kwargs: dict Parameters of the environment """ env = gym.make(env_id, **kwargs) return env
[ "def", "get_env", "(", "env_id", ",", "*", "*", "kwargs", ")", ":", "env", "=", "gym", ".", "make", "(", "env_id", ",", "*", "*", "kwargs", ")", "return", "env" ]
[ 3, 0 ]
[ 17, 14 ]
python
en
['en', 'error', 'th']
False
check_inputs
(in1, in2, flags)
Perform checking on the user provided inputs and diagnose any abnormalities
Perform checking on the user provided inputs and diagnose any abnormalities
def check_inputs(in1, in2, flags): """ Perform checking on the user provided inputs and diagnose any abnormalities """ in1_kind, in1_err = classify_input_file(in1) in2_kind, in2_err = classify_input_file(in2) output_file = find_benchmark_flag('--benchmark_out=', flags) output_type = find_ben...
[ "def", "check_inputs", "(", "in1", ",", "in2", ",", "flags", ")", ":", "in1_kind", ",", "in1_err", "=", "classify_input_file", "(", "in1", ")", "in2_kind", ",", "in2_err", "=", "classify_input_file", "(", "in2", ")", "output_file", "=", "find_benchmark_flag", ...
[ 12, 0 ]
[ 29, 19 ]
python
en
['en', 'error', 'th']
False
psql_server
(psql_client)
Return PostgreSQL container when it is healthy.
Return PostgreSQL container when it is healthy.
def psql_server(psql_client): """Return PostgreSQL container when it is healthy.""" retries = 30 for i in range(retries): info = psql_client.client.api.inspect_container(psql_client.name) if info['State']['Health']['Status'] == 'healthy': break time.sleep(1) else: ...
[ "def", "psql_server", "(", "psql_client", ")", ":", "retries", "=", "30", "for", "i", "in", "range", "(", "retries", ")", ":", "info", "=", "psql_client", ".", "client", ".", "api", ".", "inspect_container", "(", "psql_client", ".", "name", ")", "if", ...
[ 47, 0 ]
[ 59, 22 ]
python
en
['en', 'de', 'en']
True
NSGAII.__init__
(self, env, params)
NSGA-II Algorithm based on the implementation in the Pymoo library. Parameters ---------- env: BaseEnv The learning environment. params: dict All experiment params Attributes ---------- layers: tuple of ints Describe...
NSGA-II Algorithm based on the implementation in the Pymoo library.
def __init__(self, env, params): """ NSGA-II Algorithm based on the implementation in the Pymoo library. Parameters ---------- env: BaseEnv The learning environment. params: dict All experiment params Attributes ---------- ...
[ "def", "__init__", "(", "self", ",", "env", ",", "params", ")", ":", "super", "(", "NSGAII", ",", "self", ")", ".", "__init__", "(", "env", ",", "params", ")", "# Save parameters", "self", ".", "is_multi_obj", "=", "True", "# NSGA-II is a multi-obj algorithm...
[ 35, 4 ]
[ 150, 57 ]
python
en
['en', 'error', 'th']
False
NSGAII.act
(self, state, deterministic=False)
Policy that uses the learned critics. Parameters ---------- state: 1D nd.array Current state. deterministic: bool Whether the policy should be deterministic (e.g. in evaluation mode). Returns ------- action: nd.array ...
Policy that uses the learned critics.
def act(self, state, deterministic=False): """ Policy that uses the learned critics. Parameters ---------- state: 1D nd.array Current state. deterministic: bool Whether the policy should be deterministic (e.g. in evaluation mode). Returns...
[ "def", "act", "(", "self", ",", "state", ",", "deterministic", "=", "False", ")", ":", "return", "self", ".", "policy", ".", "act", "(", "state", ")", ",", "None" ]
[ 152, 4 ]
[ 168, 43 ]
python
en
['en', 'error', 'th']
False
NSGAII.learn
(self, num_train_steps)
Main training loop. Parameters ---------- num_train_steps: int Number of training steps (environment steps) Returns -------
Main training loop.
def learn(self, num_train_steps): """ Main training loop. Parameters ---------- num_train_steps: int Number of training steps (environment steps) Returns ------- """ self.res_run = minimize(problem=self.nsga_problem, ...
[ "def", "learn", "(", "self", ",", "num_train_steps", ")", ":", "self", ".", "res_run", "=", "minimize", "(", "problem", "=", "self", ".", "nsga_problem", ",", "algorithm", "=", "self", ".", "algorithm", ",", "termination", "=", "(", "'n_gen'", ",", "self...
[ 171, 4 ]
[ 195, 26 ]
python
en
['en', 'error', 'th']
False
load_courses_into_db
(apps, schema_editor)
Saves all courses in AVAIL_COURSES to the database.
Saves all courses in AVAIL_COURSES to the database.
def load_courses_into_db(apps, schema_editor): '''Saves all courses in AVAIL_COURSES to the database.''' # We can't import the Course model directly as it may be a newer # version than this migration expects. We use the historical version. Course = apps.get_model('coursetracker', 'Course') print(''...
[ "def", "load_courses_into_db", "(", "apps", ",", "schema_editor", ")", ":", "# We can't import the Course model directly as it may be a newer", "# version than this migration expects. We use the historical version.", "Course", "=", "apps", ".", "get_model", "(", "'coursetracker'", ...
[ 19, 0 ]
[ 26, 24 ]
python
en
['en', 'en', 'en']
True
load_data_files
()
Loads the data files into global variables.
Loads the data files into global variables.
def load_data_files(): '''Loads the data files into global variables.''' return (_load_json(AVAILABLE_COURSES_FN), _load_json(COURSE_INFORMATION_FN), _load_json(COURSE_STATISTICS_FN), _load_json(GRADE_DISTRIBUTIONS_FN), _load_json(PROFESSOR_INFORMATION_FN), _load_json(TEACHING_TEAM_FN))
[ "def", "load_data_files", "(", ")", ":", "return", "(", "_load_json", "(", "AVAILABLE_COURSES_FN", ")", ",", "_load_json", "(", "COURSE_INFORMATION_FN", ")", ",", "_load_json", "(", "COURSE_STATISTICS_FN", ")", ",", "_load_json", "(", "GRADE_DISTRIBUTIONS_FN", ")", ...
[ 51, 0 ]
[ 55, 79 ]
python
en
['en', 'en', 'en']
True
_load_json
(filename)
Returns the objects stored in a json file.
Returns the objects stored in a json file.
def _load_json(filename): '''Returns the objects stored in a json file.''' with open(os.path.join(DATA_DIR_PATH, filename), 'r') as json_file: return json.load(json_file)
[ "def", "_load_json", "(", "filename", ")", ":", "with", "open", "(", "os", ".", "path", ".", "join", "(", "DATA_DIR_PATH", ",", "filename", ")", ",", "'r'", ")", "as", "json_file", ":", "return", "json", ".", "load", "(", "json_file", ")" ]
[ 58, 0 ]
[ 61, 35 ]
python
en
['en', 'en', 'en']
True
save_course_instance
(Course, course_name, course_info, course_stats, grade_distrs, prof_info, teaching_team)
Creates and save a Course object to the database. Inputs: - Course (model) - course_name (str): all caps, may have a detail (i.e., APSC 496D), or not (i.e., MATH 210) - course_info, course_stats, grade_distrs, prof_info, teaching_team: read from json files; see the data repository...
Creates and save a Course object to the database.
def save_course_instance(Course, course_name, course_info, course_stats, grade_distrs, prof_info, teaching_team): '''Creates and save a Course object to the database. Inputs: - Course (model) - course_name (str): all caps, may have a detail (i.e., APSC 496D), or not (i.e., MATH 210) - c...
[ "def", "save_course_instance", "(", "Course", ",", "course_name", ",", "course_info", ",", "course_stats", ",", "grade_distrs", ",", "prof_info", ",", "teaching_team", ")", ":", "stats", "=", "course_stats", "[", "course_name", "]", "avg", "=", "stats", "[", "...
[ 64, 0 ]
[ 118, 12 ]
python
en
['en', 'en', 'en']
True
_get_grades_str
(distribution_dict)
Returns a json string of the grade distribution list. There are 11 elements, in the following order: [<50%, 50-54%, 55-59%, 60-63%, 64-67%, 68-71%, 72-75%, 76-79%, 80-84%, 85-89%, 90-100%]
Returns a json string of the grade distribution list. There are 11 elements, in the following order: [<50%, 50-54%, 55-59%, 60-63%, 64-67%, 68-71%, 72-75%, 76-79%, 80-84%, 85-89%, 90-100%]
def _get_grades_str(distribution_dict): '''Returns a json string of the grade distribution list. There are 11 elements, in the following order: [<50%, 50-54%, 55-59%, 60-63%, 64-67%, 68-71%, 72-75%, 76-79%, 80-84%, 85-89%, 90-100%] ''' grades = [] # distribution_dict.values() is already in incr...
[ "def", "_get_grades_str", "(", "distribution_dict", ")", ":", "grades", "=", "[", "]", "# distribution_dict.values() is already in increasing order, except '<50%' is at the end", "# - might be because it doesn't start with a number", "distr_dict_vals", "=", "list", "(", "distributi...
[ 121, 0 ]
[ 133, 29 ]
python
en
['en', 'en', 'en']
True
_get_prof_ratings
(sections_teaching_team, prof_info)
Returns the professor ratings list. See _append_prof_rating() for the format of each element in this list.
Returns the professor ratings list. See _append_prof_rating() for the format of each element in this list.
def _get_prof_ratings(sections_teaching_team, prof_info): '''Returns the professor ratings list. See _append_prof_rating() for the format of each element in this list. ''' teaching_team_list = _get_teaching_team_list(sections_teaching_team) prof_ratings = [] for full_name in teaching_team_list: ...
[ "def", "_get_prof_ratings", "(", "sections_teaching_team", ",", "prof_info", ")", ":", "teaching_team_list", "=", "_get_teaching_team_list", "(", "sections_teaching_team", ")", "prof_ratings", "=", "[", "]", "for", "full_name", "in", "teaching_team_list", ":", "# full_n...
[ 136, 0 ]
[ 156, 23 ]
python
en
['en', 'en', 'en']
True
_get_teaching_team_list
(sections_teaching_team)
Returns an alphabetical list of all teaching team members in sections_teaching_team. Inputs: - sections_teaching_team (dict): {section number: teaching team for that section (list)}
Returns an alphabetical list of all teaching team members in sections_teaching_team.
def _get_teaching_team_list(sections_teaching_team): '''Returns an alphabetical list of all teaching team members in sections_teaching_team. Inputs: - sections_teaching_team (dict): {section number: teaching team for that section (list)} ''' teaching_team_list = [] for _, section_teaching_t...
[ "def", "_get_teaching_team_list", "(", "sections_teaching_team", ")", ":", "teaching_team_list", "=", "[", "]", "for", "_", ",", "section_teaching_team_list", "in", "sections_teaching_team", ".", "items", "(", ")", ":", "new_teaching_team_list", "=", "list", "(", "s...
[ 159, 0 ]
[ 170, 37 ]
python
en
['en', 'en', 'en']
True
_append_prof_rating
(prof_ratings, prof_name, prof_name_info, is_same_name=False)
Appends a dictionary with the keys: name, rating, number of ratings, and link of a professor to prof_ratings. - If is_same_name == True, adds the professor's department to their name - This is required because there may be multiple prof_name_info sections for a name - Either the prof...
Appends a dictionary with the keys: name, rating, number of ratings, and link of a professor to prof_ratings. - If is_same_name == True, adds the professor's department to their name - This is required because there may be multiple prof_name_info sections for a name - Either the prof...
def _append_prof_rating(prof_ratings, prof_name, prof_name_info, is_same_name=False): '''Appends a dictionary with the keys: name, rating, number of ratings, and link of a professor to prof_ratings. - If is_same_name == True, adds the professor's department to their name - This is required becau...
[ "def", "_append_prof_rating", "(", "prof_ratings", ",", "prof_name", ",", "prof_name_info", ",", "is_same_name", "=", "False", ")", ":", "prof_key", "=", "prof_name", "if", "not", "is_same_name", "else", "f\"{prof_name} ({prof_name_info['tDept']})\"", "rmp_link", "=", ...
[ 173, 0 ]
[ 184, 96 ]
python
en
['en', 'en', 'en']
True
_create_preq_tree
(course_name, course_info)
Receives a Course module and course_info dictionary as parameters, and returns a prerequisite tree dictionary This includes not only the immediate prequisites of the paramater, but also all prerequisites for all courses connected. For example, MATH 200 requires MATH 150, and MATH 101. - Additi...
Receives a Course module and course_info dictionary as parameters, and returns a prerequisite tree dictionary This includes not only the immediate prequisites of the paramater, but also all prerequisites for all courses connected.
def _create_preq_tree(course_name, course_info): ''' Receives a Course module and course_info dictionary as parameters, and returns a prerequisite tree dictionary This includes not only the immediate prequisites of the paramater, but also all prerequisites for all courses connected. For example, MA...
[ "def", "_create_preq_tree", "(", "course_name", ",", "course_info", ")", ":", "immediate_prerequisites", "=", "course_info", "[", "course_name", "]", "[", "'preq'", "]", "if", "course_name", "in", "course_info", "and", "'preq'", "in", "course_info", "[", "course_n...
[ 187, 0 ]
[ 207, 24 ]
python
en
['en', 'error', 'th']
False
privilege_granted_directly_or_via_role
(self, table_type, node=None)
Check that user is only able to execute OPTIMIZE when they have required privilege, either directly or via role.
Check that user is only able to execute OPTIMIZE when they have required privilege, either directly or via role.
def privilege_granted_directly_or_via_role(self, table_type, node=None): """Check that user is only able to execute OPTIMIZE when they have required privilege, either directly or via role. """ role_name = f"role_{getuid()}" user_name = f"user_{getuid()}" if node is None: node = self.context...
[ "def", "privilege_granted_directly_or_via_role", "(", "self", ",", "table_type", ",", "node", "=", "None", ")", ":", "role_name", "=", "f\"role_{getuid()}\"", "user_name", "=", "f\"user_{getuid()}\"", "if", "node", "is", "None", ":", "node", "=", "self", ".", "c...
[ 5, 0 ]
[ 27, 115 ]
python
en
['en', 'en', 'en']
True
privilege_check
(grant_target_name, user_name, table_type, node=None)
Run scenarios to check the user's access with different privileges.
Run scenarios to check the user's access with different privileges.
def privilege_check(grant_target_name, user_name, table_type, node=None): """Run scenarios to check the user's access with different privileges. """ exitcode, message = errors.not_enough_privileges(name=f"{user_name}") with Scenario("user without privilege"): table_name = f"merge_tree_{getuid()...
[ "def", "privilege_check", "(", "grant_target_name", ",", "user_name", ",", "table_type", ",", "node", "=", "None", ")", ":", "exitcode", ",", "message", "=", "errors", ".", "not_enough_privileges", "(", "name", "=", "f\"{user_name}\"", ")", "with", "Scenario", ...
[ 29, 0 ]
[ 119, 92 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1", stress=None, parallel=None)
Check the RBAC functionality of OPTIMIZE.
Check the RBAC functionality of OPTIMIZE.
def feature(self, node="clickhouse1", stress=None, parallel=None): """Check the RBAC functionality of OPTIMIZE. """ self.context.node = self.context.cluster.node(node) if parallel is not None: self.context.parallel = parallel if stress is not None: self.context.stress = stress ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ",", "stress", "=", "None", ",", "parallel", "=", "None", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", ...
[ 130, 0 ]
[ 148, 77 ]
python
en
['en', 'en', 'en']
True
Question.validate_question_type
(cls, value: str)
Checks if question type in currently allowed types list.
Checks if question type in currently allowed types list.
def validate_question_type(cls, value: str) -> t.Optional[str]: """Checks if question type in currently allowed types list.""" value = value.lower() if value not in QUESTION_TYPES: raise ValueError( f"{value} is not valid question type. " f"Allowed que...
[ "def", "validate_question_type", "(", "cls", ",", "value", ":", "str", ")", "->", "t", ".", "Optional", "[", "str", "]", ":", "value", "=", "value", ".", "lower", "(", ")", "if", "value", "not", "in", "QUESTION_TYPES", ":", "raise", "ValueError", "(", ...
[ 20, 4 ]
[ 29, 20 ]
python
en
['en', 'en', 'en']
True
Question.validate_question_data
( cls, value: dict[str, t.Any] )
Check does required data exists for question type and remove other data.
Check does required data exists for question type and remove other data.
def validate_question_data( cls, value: dict[str, t.Any] ) -> t.Optional[dict[str, t.Any]]: """Check does required data exists for question type and remove other data.""" # When question type don't need data, don't add anything to keep DB clean. if value.get("type") n...
[ "def", "validate_question_data", "(", "cls", ",", "value", ":", "dict", "[", "str", ",", "t", ".", "Any", "]", ")", "->", "t", ".", "Optional", "[", "dict", "[", "str", ",", "t", ".", "Any", "]", "]", ":", "# When question type don't need data, don't add...
[ 32, 4 ]
[ 51, 20 ]
python
en
['en', 'en', 'en']
True
checkSketchlibVersion
()
Checks that sketchlib can be run, and returns version Returns: version (str) Version string
Checks that sketchlib can be run, and returns version
def checkSketchlibVersion(): """Checks that sketchlib can be run, and returns version Returns: version (str) Version string """ try: version = pp_sketchlib.version # Older versions didn't export attributes except AttributeError: p = subprocess.Popen([sketchl...
[ "def", "checkSketchlibVersion", "(", ")", ":", "try", ":", "version", "=", "pp_sketchlib", ".", "version", "# Older versions didn't export attributes", "except", "AttributeError", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "sketchlib_exe", "+", "' --versio...
[ 32, 0 ]
[ 61, 18 ]
python
en
['en', 'vi', 'en']
True
checkSketchlibLibrary
()
Gets the location of the sketchlib library Returns: lib (str) Location of sketchlib .so/.dyld
Gets the location of the sketchlib library
def checkSketchlibLibrary(): """Gets the location of the sketchlib library Returns: lib (str) Location of sketchlib .so/.dyld """ sketchlib_loc = pp_sketchlib.__file__ return(sketchlib_loc)
[ "def", "checkSketchlibLibrary", "(", ")", ":", "sketchlib_loc", "=", "pp_sketchlib", ".", "__file__", "return", "(", "sketchlib_loc", ")" ]
[ 63, 0 ]
[ 71, 25 ]
python
en
['en', 'en', 'en']
True
createDatabaseDir
(outPrefix, kmers)
Creates the directory to write sketches to, removing old files if unnecessary Args: outPrefix (str) output db prefix kmers (list) k-mer sizes in db
Creates the directory to write sketches to, removing old files if unnecessary
def createDatabaseDir(outPrefix, kmers): """Creates the directory to write sketches to, removing old files if unnecessary Args: outPrefix (str) output db prefix kmers (list) k-mer sizes in db """ # check for writing if os.path.isdir(outPrefix): # remo...
[ "def", "createDatabaseDir", "(", "outPrefix", ",", "kmers", ")", ":", "# check for writing", "if", "os", ".", "path", ".", "isdir", "(", "outPrefix", ")", ":", "# remove old database files if not needed", "db_file", "=", "outPrefix", "+", "\"/\"", "+", "os", "."...
[ 73, 0 ]
[ 107, 23 ]
python
en
['en', 'en', 'en']
True
getSketchSize
(dbPrefix)
Determine sketch size, and ensures consistent in whole database ``sys.exit(1)`` is called if DBs have different sketch sizes Args: dbprefix (str) Prefix for mash databases Returns: sketchSize (int) sketch size (64x C++ definition) codonPhased (bool) ...
Determine sketch size, and ensures consistent in whole database
def getSketchSize(dbPrefix): """Determine sketch size, and ensures consistent in whole database ``sys.exit(1)`` is called if DBs have different sketch sizes Args: dbprefix (str) Prefix for mash databases Returns: sketchSize (int) sketch size (64x C++ definition...
[ "def", "getSketchSize", "(", "dbPrefix", ")", ":", "db_file", "=", "dbPrefix", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "dbPrefix", ")", "+", "\".h5\"", "ref_db", "=", "h5py", ".", "File", "(", "db_file", ",", "'r'", ")", "try", ":...
[ 110, 0 ]
[ 143, 41 ]
python
en
['en', 'en', 'en']
True
getKmersFromReferenceDatabase
(dbPrefix)
Get kmers lengths from existing database Args: dbPrefix (str) Prefix for sketch DB files Returns: kmers (list) List of k-mer lengths used in database
Get kmers lengths from existing database
def getKmersFromReferenceDatabase(dbPrefix): """Get kmers lengths from existing database Args: dbPrefix (str) Prefix for sketch DB files Returns: kmers (list) List of k-mer lengths used in database """ db_file = dbPrefix + "/" + os.path.basename(dbPrefix) + "...
[ "def", "getKmersFromReferenceDatabase", "(", "dbPrefix", ")", ":", "db_file", "=", "dbPrefix", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "dbPrefix", ")", "+", "\".h5\"", "ref_db", "=", "h5py", ".", "File", "(", "db_file", ",", "'r'", ")...
[ 145, 0 ]
[ 169, 16 ]
python
en
['en', 'en', 'en']
True
readDBParams
(dbPrefix)
Get kmers lengths and sketch sizes from existing database Calls :func:`~getKmersFromReferenceDatabase` and :func:`~getSketchSize` Uses passed values if db missing Args: dbPrefix (str) Prefix for sketch DB files Returns: kmers (list) List of k-mer lengths used i...
Get kmers lengths and sketch sizes from existing database
def readDBParams(dbPrefix): """Get kmers lengths and sketch sizes from existing database Calls :func:`~getKmersFromReferenceDatabase` and :func:`~getSketchSize` Uses passed values if db missing Args: dbPrefix (str) Prefix for sketch DB files Returns: kmers (list) ...
[ "def", "readDBParams", "(", "dbPrefix", ")", ":", "db_kmers", "=", "getKmersFromReferenceDatabase", "(", "dbPrefix", ")", "if", "len", "(", "db_kmers", ")", "==", "0", ":", "sys", ".", "stderr", ".", "write", "(", "\"Couldn't find sketches in \"", "+", "dbPref...
[ 171, 0 ]
[ 196, 47 ]
python
en
['en', 'en', 'en']
True
getSeqsInDb
(dbname)
Return an array with the sequences in the passed database Args: dbname (str) Sketches database filename Returns: seqs (list) List of sequence names in sketch DB
Return an array with the sequences in the passed database
def getSeqsInDb(dbname): """Return an array with the sequences in the passed database Args: dbname (str) Sketches database filename Returns: seqs (list) List of sequence names in sketch DB """ seqs = [] ref = h5py.File(dbname, 'r') for sample_name in...
[ "def", "getSeqsInDb", "(", "dbname", ")", ":", "seqs", "=", "[", "]", "ref", "=", "h5py", ".", "File", "(", "dbname", ",", "'r'", ")", "for", "sample_name", "in", "list", "(", "ref", "[", "'sketches'", "]", ".", "keys", "(", ")", ")", ":", "seqs"...
[ 199, 0 ]
[ 215, 15 ]
python
en
['en', 'en', 'en']
True
joinDBs
(db1, db2, output, update_random = None)
Join two sketch databases with the low-level HDF5 copy interface Args: db1 (str) Prefix for db1 db2 (str) Prefix for db2 output (str) Prefix for joined output update_random (dict) Whether to re-calculate the random object. May contain ...
Join two sketch databases with the low-level HDF5 copy interface
def joinDBs(db1, db2, output, update_random = None): """Join two sketch databases with the low-level HDF5 copy interface Args: db1 (str) Prefix for db1 db2 (str) Prefix for db2 output (str) Prefix for joined output update_random (dict) ...
[ "def", "joinDBs", "(", "db1", ",", "db2", ",", "output", ",", "update_random", "=", "None", ")", ":", "join_prefix", "=", "output", "+", "\"/\"", "+", "os", ".", "path", ".", "basename", "(", "output", ")", "db1_name", "=", "db1", "+", "\"/\"", "+", ...
[ 217, 0 ]
[ 285, 59 ]
python
en
['en', 'en', 'en']
True
removeFromDB
(db_name, out_name, removeSeqs, full_names = False)
Remove sketches from the DB the low-level HDF5 copy interface Args: db_name (str) Prefix for hdf database out_name (str) Prefix for output (pruned) database removeSeqs (list) Names of sequences to remove from database full_names (bool) ...
Remove sketches from the DB the low-level HDF5 copy interface
def removeFromDB(db_name, out_name, removeSeqs, full_names = False): """Remove sketches from the DB the low-level HDF5 copy interface Args: db_name (str) Prefix for hdf database out_name (str) Prefix for output (pruned) database removeSeqs (list) Name...
[ "def", "removeFromDB", "(", "db_name", ",", "out_name", ",", "removeSeqs", ",", "full_names", "=", "False", ")", ":", "removeSeqs", "=", "set", "(", "removeSeqs", ")", "if", "not", "full_names", ":", "db_file", "=", "db_name", "+", "\"/\"", "+", "os", "....
[ 288, 0 ]
[ 338, 19 ]
python
en
['en', 'en', 'en']
True
constructDatabase
(assemblyList, klist, sketch_size, oPrefix, threads, overwrite, strand_preserved, min_count, use_exact, qc_dict, calc_random = True, codon_phased = False, use_gpu = False, deviceid = 0)
Sketch the input assemblies at the requested k-mer lengths A multithread wrapper around :func:`~runSketch`. Threads are used to either run multiple sketch processes for each klist value, or increase the threads used by each ``mash sketch`` process if len(klist) > threads. Also calculates random match ...
Sketch the input assemblies at the requested k-mer lengths
def constructDatabase(assemblyList, klist, sketch_size, oPrefix, threads, overwrite, strand_preserved, min_count, use_exact, qc_dict, calc_random = True, codon_phased = False, use_gpu = False, devicei...
[ "def", "constructDatabase", "(", "assemblyList", ",", "klist", ",", "sketch_size", ",", "oPrefix", ",", "threads", ",", "overwrite", ",", "strand_preserved", ",", "min_count", ",", "use_exact", ",", "qc_dict", ",", "calc_random", "=", "True", ",", "codon_phased"...
[ 340, 0 ]
[ 442, 25 ]
python
en
['en', 'en', 'en']
True
addRandom
(oPrefix, sequence_names, klist, strand_preserved = False, overwrite = False, threads = 1)
Add chance of random match to a HDF5 sketch DB Args: oPrefix (str) Sketch database prefix sequence_names (list) Names of sequences to include in calculation klist (list) List of k-mer sizes to sketch strand_preserved (bool) Set true to...
Add chance of random match to a HDF5 sketch DB
def addRandom(oPrefix, sequence_names, klist, strand_preserved = False, overwrite = False, threads = 1): """Add chance of random match to a HDF5 sketch DB Args: oPrefix (str) Sketch database prefix sequence_names (list) Names of sequences to include in calc...
[ "def", "addRandom", "(", "oPrefix", ",", "sequence_names", ",", "klist", ",", "strand_preserved", "=", "False", ",", "overwrite", "=", "False", ",", "threads", "=", "1", ")", ":", "if", "len", "(", "sequence_names", ")", "<=", "2", ":", "sys", ".", "st...
[ 445, 0 ]
[ 481, 39 ]
python
en
['en', 'cy', 'en']
True
queryDatabase
(rNames, qNames, dbPrefix, queryPrefix, klist, self = True, number_plot_fits = 0, threads = 1, use_gpu = False, deviceid = 0)
Calculate core and accessory distances between query sequences and a sketched database For a reference database, runs the query against itself to find all pairwise core and accessory distances. Uses the relation :math:`pr(a, b) = (1-a)(1-c)^k` To get the ref and query name for each row of the returne...
Calculate core and accessory distances between query sequences and a sketched database
def queryDatabase(rNames, qNames, dbPrefix, queryPrefix, klist, self = True, number_plot_fits = 0, threads = 1, use_gpu = False, deviceid = 0): """Calculate core and accessory distances between query sequences and a sketched database For a reference database, runs the query against itself to ...
[ "def", "queryDatabase", "(", "rNames", ",", "qNames", ",", "dbPrefix", ",", "queryPrefix", ",", "klist", ",", "self", "=", "True", ",", "number_plot_fits", "=", "0", ",", "threads", "=", "1", ",", "use_gpu", "=", "False", ",", "deviceid", "=", "0", ")"...
[ 483, 0 ]
[ 621, 18 ]
python
en
['en', 'en', 'en']
True
pickTypeIsolate
(prefix, names)
Selects a type isolate as that with a minimal proportion of missing data. Args: prefix (str) Prefix of output files names (list) Names of samples to QC Returns: type_isolate (str) Name of isolate selected as reference
Selects a type isolate as that with a minimal proportion of missing data.
def pickTypeIsolate(prefix, names): """Selects a type isolate as that with a minimal proportion of missing data. Args: prefix (str) Prefix of output files names (list) Names of samples to QC Returns: type_isolate (str) Name of isolate selecte...
[ "def", "pickTypeIsolate", "(", "prefix", ",", "names", ")", ":", "# open databases", "db_name", "=", "prefix", "+", "'/'", "+", "os", ".", "path", ".", "basename", "(", "prefix", ")", "+", "'.h5'", "hdf_in", "=", "h5py", ".", "File", "(", "db_name", ",...
[ 624, 0 ]
[ 662, 23 ]
python
en
['en', 'en', 'en']
True
sketchlibAssemblyQC
(prefix, names, klist, qc_dict, strand_preserved, threads)
Calculates random match probability based on means of genomes in assemblyList, and looks for length outliers. Args: prefix (str) Prefix of output files names (list) Names of samples to QC klist (list) List of k-mer sizes to sketch qc_dict (dic...
Calculates random match probability based on means of genomes in assemblyList, and looks for length outliers.
def sketchlibAssemblyQC(prefix, names, klist, qc_dict, strand_preserved, threads): """Calculates random match probability based on means of genomes in assemblyList, and looks for length outliers. Args: prefix (str) Prefix of output files names (list) Names of samples...
[ "def", "sketchlibAssemblyQC", "(", "prefix", ",", "names", ",", "klist", ",", "qc_dict", ",", "strand_preserved", ",", "threads", ")", ":", "sys", ".", "stderr", ".", "write", "(", "\"Running QC on sketches\\n\"", ")", "# open databases", "db_name", "=", "prefix...
[ 664, 0 ]
[ 804, 19 ]
python
en
['en', 'en', 'en']
True
fitKmerCurve
(pairwise, klist, jacobian)
Fit the function :math:`pr = (1-a)(1-c)^k` Supply ``jacobian = -np.hstack((np.ones((klist.shape[0], 1)), klist.reshape(-1, 1)))`` Args: pairwise (numpy.array) Proportion of shared k-mers at k-mer values in klist klist (list) k-mer sizes used jacobian (numpy.arra...
Fit the function :math:`pr = (1-a)(1-c)^k`
def fitKmerCurve(pairwise, klist, jacobian): """Fit the function :math:`pr = (1-a)(1-c)^k` Supply ``jacobian = -np.hstack((np.ones((klist.shape[0], 1)), klist.reshape(-1, 1)))`` Args: pairwise (numpy.array) Proportion of shared k-mers at k-mer values in klist klist (list) ...
[ "def", "fitKmerCurve", "(", "pairwise", ",", "klist", ",", "jacobian", ")", ":", "# curve fit pr = (1-a)(1-c)^k", "# log pr = log(1-a) + k*log(1-c)", "# a = p[0]; c = p[1] (will flip on return)", "try", ":", "distFit", "=", "optimize", ".", "least_squares", "(", "fun", "=...
[ 806, 0 ]
[ 841, 41 ]
python
en
['en', 'en', 'en']
True
TestCallbacks.test_transfer_pipe
(self)
transfer an index through a Unix pipe
transfer an index through a Unix pipe
def test_transfer_pipe(self): """ transfer an index through a Unix pipe """ d, n = 32, 1000 x = np.random.uniform(size=(n, d)).astype('float32') index = faiss.IndexFlatL2(d) index.add(x) Dref, Iref = index.search(x, 10) rf, wf = os.pipe() # start thread...
[ "def", "test_transfer_pipe", "(", "self", ")", ":", "d", ",", "n", "=", "32", ",", "1000", "x", "=", "np", ".", "random", ".", "uniform", "(", "size", "=", "(", "n", ",", "d", ")", ")", ".", "astype", "(", "'float32'", ")", "index", "=", "faiss...
[ 187, 4 ]
[ 219, 49 ]
python
en
['en', 'gd', 'en']
True
clear_events
(win)
clear all keys from psychopy I've been having issues with keys remaining in psychopy's buffer, being pulled in at a later time (thus, pressing the spacebar once gets parsed as pressing it twice, in rapid succession). This takes a brief pause, .1 seconds, to rapidly flip the window several times (sh...
clear all keys from psychopy
def clear_events(win): """clear all keys from psychopy I've been having issues with keys remaining in psychopy's buffer, being pulled in at a later time (thus, pressing the spacebar once gets parsed as pressing it twice, in rapid succession). This takes a brief pause, .1 seconds, to rapidly flip th...
[ "def", "clear_events", "(", "win", ")", ":", "for", "i", "in", "range", "(", "10", ")", ":", "win", ".", "flip", "(", ")", "core", ".", "wait", "(", ".01", ")", "event", ".", "getKeys", "(", ")" ]
[ 17, 0 ]
[ 36, 23 ]
python
en
['en', 'en', 'en']
True
calc_pct_correct
(raw_behavioral_path, idx, stim_df)
Calculate percent correct, grouped by scaling. This is only intended for use during the training sessions, to give participant a sense of how well they did. Parameters ---------- raw_behavioral_path : str The str to the hdf5 file that contains the behavioral results, as saved by th...
Calculate percent correct, grouped by scaling.
def calc_pct_correct(raw_behavioral_path, idx, stim_df): """Calculate percent correct, grouped by scaling. This is only intended for use during the training sessions, to give participant a sense of how well they did. Parameters ---------- raw_behavioral_path : str The str to the hdf5 f...
[ "def", "calc_pct_correct", "(", "raw_behavioral_path", ",", "idx", ",", "stim_df", ")", ":", "trials", "=", "analysis", ".", "summarize_trials", "(", "raw_behavioral_path", ")", "df", "=", "analysis", ".", "create_experiment_df_split", "(", "stim_df", ",", "idx", ...
[ 39, 0 ]
[ 67, 82 ]
python
en
['en', 'en', 'en']
True
_convert_str
(list_of_strs)
convert strs to hdf5-savable format python 3 strings are more complicated than python 2, see http://docs.h5py.org/en/latest/strings.html and https://github.com/h5py/h5py/issues/892
convert strs to hdf5-savable format
def _convert_str(list_of_strs): """convert strs to hdf5-savable format python 3 strings are more complicated than python 2, see http://docs.h5py.org/en/latest/strings.html and https://github.com/h5py/h5py/issues/892 """ list_of_strs = np.array(list_of_strs) saveable_list = [] for x in list_...
[ "def", "_convert_str", "(", "list_of_strs", ")", ":", "list_of_strs", "=", "np", ".", "array", "(", "list_of_strs", ")", "saveable_list", "=", "[", "]", "for", "x", "in", "list_of_strs", ":", "try", ":", "x", "=", "x", ".", "encode", "(", ")", "except"...
[ 70, 0 ]
[ 90, 24 ]
python
en
['en', 'en', 'en']
True
_insert_into_hdf5
(f, key, value)
insert value into hdf5 file with given key if you try to set a dataset that already exists, it raises an exception, so this tries to create a dataset and, if it raises that exception, pop off the corresponding key and set it anew
insert value into hdf5 file with given key
def _insert_into_hdf5(f, key, value): """insert value into hdf5 file with given key if you try to set a dataset that already exists, it raises an exception, so this tries to create a dataset and, if it raises that exception, pop off the corresponding key and set it anew """ try: f.crea...
[ "def", "_insert_into_hdf5", "(", "f", ",", "key", ",", "value", ")", ":", "try", ":", "f", ".", "create_dataset", "(", "key", ",", "data", "=", "value", ")", "except", "(", "RuntimeError", ",", "OSError", ")", ":", "# then it already exists", "f", ".", ...
[ 93, 0 ]
[ 106, 41 ]
python
en
['en', 'en', 'en']
True
_set_params
(stimuli_path, idx_path, size=[1920, 1080], monitor='CBI-prisma-projector', units='pix', fullscr=True, screen=[0], color=128, colorSpace='rgb255', allowGUI=False, downsampled=False, **monitor_kwargs)
set the various experiment parameters
set the various experiment parameters
def _set_params(stimuli_path, idx_path, size=[1920, 1080], monitor='CBI-prisma-projector', units='pix', fullscr=True, screen=[0], color=128, colorSpace='rgb255', allowGUI=False, downsampled=False, **monitor_kwargs): """set the various experiment parameters """ stimuli = np.lo...
[ "def", "_set_params", "(", "stimuli_path", ",", "idx_path", ",", "size", "=", "[", "1920", ",", "1080", "]", ",", "monitor", "=", "'CBI-prisma-projector'", ",", "units", "=", "'pix'", ",", "fullscr", "=", "True", ",", "screen", "=", "[", "0", "]", ",",...
[ 126, 0 ]
[ 167, 52 ]
python
en
['en', 'en', 'en']
True
_create_bar_mask
(bar_height, bar_width=200, fringe_proportion=.5)
Create central bar with raised-cosine edges.
Create central bar with raised-cosine edges.
def _create_bar_mask(bar_height, bar_width=200, fringe_proportion=.5): """Create central bar with raised-cosine edges. """ x = np.linspace(-bar_width//2, bar_width//2, bar_width) fringe_width = fringe_proportion * x.max() def raised_cos(x, start_x, end_x): x = (x-start_x) / (end_x - start_x...
[ "def", "_create_bar_mask", "(", "bar_height", ",", "bar_width", "=", "200", ",", "fringe_proportion", "=", ".5", ")", ":", "x", "=", "np", ".", "linspace", "(", "-", "bar_width", "//", "2", ",", "bar_width", "//", "2", ",", "bar_width", ")", "fringe_widt...
[ 194, 0 ]
[ 209, 15 ]
python
en
['en', 'ga', 'en']
True
_setup_run
(stimuli_path, idx_path, fix_deg_size=.25, screen_size_deg=73.45, take_break=True, timings=[], start_from_stim=0, ecc_mask=False, downsampled=False, **monitor_kwargs)
Setup the run. Does the thigns that are constant across different tasks.
Setup the run.
def _setup_run(stimuli_path, idx_path, fix_deg_size=.25, screen_size_deg=73.45, take_break=True, timings=[], start_from_stim=0, ecc_mask=False, downsampled=False, **monitor_kwargs): """Setup the run. Does the thigns that are constant across different tasks. """ stimuli, i...
[ "def", "_setup_run", "(", "stimuli_path", ",", "idx_path", ",", "fix_deg_size", "=", ".25", ",", "screen_size_deg", "=", "73.45", ",", "take_break", "=", "True", ",", "timings", "=", "[", "]", ",", "start_from_stim", "=", "0", ",", "ecc_mask", "=", "False"...
[ 212, 0 ]
[ 259, 48 ]
python
en
['en', 'ha', 'en']
True
_explain_task
(win, expt_clock, comparison, fixation, text_height=50, train_flag=False)
Draw some text explaining the task
Draw some text explaining the task
def _explain_task(win, expt_clock, comparison, fixation, text_height=50, train_flag=False): """Draw some text explaining the task """ if comparison == 'met': comp_text = "On this run, you'll be comparing two synthesized images." elif comparison == 'ref': comp_text = ("O...
[ "def", "_explain_task", "(", "win", ",", "expt_clock", ",", "comparison", ",", "fixation", ",", "text_height", "=", "50", ",", "train_flag", "=", "False", ")", ":", "if", "comparison", "==", "'met'", ":", "comp_text", "=", "\"On this run, you'll be comparing two...
[ 262, 0 ]
[ 311, 49 ]
python
en
['en', 'en', 'en']
True
_end_run
(win, timings, text_height, expt_clock, train_flag=False)
End the run. Do the things that are shared across task types.
End the run.
def _end_run(win, timings, text_height, expt_clock, train_flag=False): """End the run. Do the things that are shared across task types. """ if not train_flag: visual.TextStim(win, "Run over.", height=text_height, wrapWidth=2000).draw() else: visual.TextStim(...
[ "def", "_end_run", "(", "win", ",", "timings", ",", "text_height", ",", "expt_clock", ",", "train_flag", "=", "False", ")", ":", "if", "not", "train_flag", ":", "visual", ".", "TextStim", "(", "win", ",", "\"Run over.\"", ",", "height", "=", "text_height",...
[ 314, 0 ]
[ 332, 19 ]
python
en
['en', 'gd', 'en']
True
run_split
(stimuli_path, idx_path, save_path, comparison, on_msec_length=200, off_msec_length=(500, 500), fix_deg_size=.25, screen_size_deg=73.45, take_break=True, keys_pressed=[], timings=[], start_from_stim=0, text_height=50, bar_deg_size=2, train_flag=False...
r"""Run one run of the split task. stimuli_path specifies the path of the unshuffled experiment stimuli, while idx_path specifies the path of the shuffled indices to use for this run. This function will load in the stimuli at stimuli_path and rearrange them using the indices found at idx_path, then sim...
r"""Run one run of the split task.
def run_split(stimuli_path, idx_path, save_path, comparison, on_msec_length=200, off_msec_length=(500, 500), fix_deg_size=.25, screen_size_deg=73.45, take_break=True, keys_pressed=[], timings=[], start_from_stim=0, text_height=50, bar_deg_size=2, tra...
[ "def", "run_split", "(", "stimuli_path", ",", "idx_path", ",", "save_path", ",", "comparison", ",", "on_msec_length", "=", "200", ",", "off_msec_length", "=", "(", "500", ",", "500", ")", ",", "fix_deg_size", "=", ".25", ",", "screen_size_deg", "=", "73.45",...
[ 335, 0 ]
[ 566, 55 ]
python
en
['en', 'tr', 'en']
True
expt
(stimuli_path, subj_name, sess_num, run_num, comparison, output_dir="data/raw_behavioral", screen_size_pix=[3840, 2160], screen_size_deg=73.45, take_break=True, text_height=50, screen=[0], train_flag=False, ecc_mask=False, **kwargs)
run a full experiment this just sets up the various paths, calls ``run``, and then saves the output
run a full experiment
def expt(stimuli_path, subj_name, sess_num, run_num, comparison, output_dir="data/raw_behavioral", screen_size_pix=[3840, 2160], screen_size_deg=73.45, take_break=True, text_height=50, screen=[0], train_flag=False, ecc_mask=False, **kwargs): """run a full experiment this just sets up...
[ "def", "expt", "(", "stimuli_path", ",", "subj_name", ",", "sess_num", ",", "run_num", ",", "comparison", ",", "output_dir", "=", "\"data/raw_behavioral\"", ",", "screen_size_pix", "=", "[", "3840", ",", "2160", "]", ",", "screen_size_deg", "=", "73.45", ",", ...
[ 569, 0 ]
[ 661, 19 ]
python
en
['en', 'ms', 'en']
True
valid_bind_dn
(self)
Check that LDAP users can login when `bind_dn` is valid.
Check that LDAP users can login when `bind_dn` is valid.
def valid_bind_dn(self): """Check that LDAP users can login when `bind_dn` is valid. """ servers = { "openldap1": { "host": "openldap1", "port": "389", "enable_tls": "no", "bind_dn": "cn={user_name},ou=users,dc=company,dc=com" } } user = { "server": "...
[ "def", "valid_bind_dn", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"bind_dn\"", ":", "\"cn={user_name},ou=users,dc=company,d...
[ 12, 0 ]
[ 26, 37 ]
python
en
['en', 'en', 'en']
True
invalid_bind_dn
(self)
Check that LDAP users can't login when `bind_dn` is invalid.
Check that LDAP users can't login when `bind_dn` is invalid.
def invalid_bind_dn(self): """Check that LDAP users can't login when `bind_dn` is invalid. """ servers = { "openldap1": { "host": "openldap1", "port": "389", "enable_tls": "no", "bind_dn": "cn={user_name},ou=users,dc=company2,dc=com" }} user = { "server":...
[ "def", "invalid_bind_dn", "(", "self", ")", ":", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"", ":", "\"openldap1\"", ",", "\"port\"", ":", "\"389\"", ",", "\"enable_tls\"", ":", "\"no\"", ",", "\"bind_dn\"", ":", "\"cn={user_name},ou=users,dc=company...
[ 32, 0 ]
[ 47, 37 ]
python
en
['en', 'en', 'en']
True
bind_dn_conflict_with_auth_dn
(self, timeout=60)
Check that an error is returned with both `bind_dn` and `auth_dn_prefix` and `auth_dn_suffix` are specified at the same time.
Check that an error is returned with both `bind_dn` and `auth_dn_prefix` and `auth_dn_suffix` are specified at the same time.
def bind_dn_conflict_with_auth_dn(self, timeout=60): """Check that an error is returned with both `bind_dn` and `auth_dn_prefix` and `auth_dn_suffix` are specified at the same time. """ message = "DB::Exception: Deprecated 'auth_dn_prefix' and 'auth_dn_suffix' entries cannot be used with 'bind_dn' entry...
[ "def", "bind_dn_conflict_with_auth_dn", "(", "self", ",", "timeout", "=", "60", ")", ":", "message", "=", "\"DB::Exception: Deprecated 'auth_dn_prefix' and 'auth_dn_suffix' entries cannot be used with 'bind_dn' entry\"", "servers", "=", "{", "\"openldap1\"", ":", "{", "\"host\"...
[ 53, 0 ]
[ 67, 77 ]
python
en
['en', 'en', 'en']
True
feature
(self, node="clickhouse1")
Check LDAP server configuration.
Check LDAP server configuration.
def feature(self, node="clickhouse1"): """Check LDAP server configuration. """ self.context.node = self.context.cluster.node(node) for scenario in loads(current_module(), Scenario): scenario()
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "self", ".", "context", ".", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "for", "scenario", "in", "loads", "(", "current_module", "(",...
[ 72, 0 ]
[ 77, 18 ]
python
en
['en', 'pt', 'en']
True
mapd_to_ibis_dtype
(mapd_dtype)
Register MapD Data Types mapd_dtype: :return:
Register MapD Data Types
def mapd_to_ibis_dtype(mapd_dtype): """ Register MapD Data Types mapd_dtype: :return: """ return mapd_dtype.to_ibis()
[ "def", "mapd_to_ibis_dtype", "(", "mapd_dtype", ")", ":", "return", "mapd_dtype", ".", "to_ibis", "(", ")" ]
[ 788, 0 ]
[ 795, 31 ]
python
en
['en', 'error', 'th']
False
MapDTable.metadata
(self)
Return parsed results of DESCRIBE FORMATTED statement Returns ------- meta : TableMetadata
Return parsed results of DESCRIBE FORMATTED statement
def metadata(self): """ Return parsed results of DESCRIBE FORMATTED statement Returns ------- meta : TableMetadata """ return self._client.describe_formatted(self._qualified_name)
[ "def", "metadata", "(", "self", ")", ":", "return", "self", ".", "_client", ".", "describe_formatted", "(", "self", ".", "_qualified_name", ")" ]
[ 189, 4 ]
[ 197, 68 ]
python
en
['en', 'error', 'th']
False
MapDTable.drop
(self)
Drop the table from the database
Drop the table from the database
def drop(self): """ Drop the table from the database """ self._client.drop_table_or_view(self._qualified_name)
[ "def", "drop", "(", "self", ")", ":", "self", ".", "_client", ".", "drop_table_or_view", "(", "self", ".", "_qualified_name", ")" ]
[ 201, 4 ]
[ 205, 61 ]
python
en
['en', 'error', 'th']
False
MapDTable.load_data
(self, df)
Wraps the LOAD DATA DDL statement. Loads data into an MapD table from pandas.DataFrame or pyarrow.Table Parameters ---------- df: pandas.DataFrame or pyarrow.Table Returns ------- query : MapDQuery
Wraps the LOAD DATA DDL statement. Loads data into an MapD table from pandas.DataFrame or pyarrow.Table
def load_data(self, df): """ Wraps the LOAD DATA DDL statement. Loads data into an MapD table from pandas.DataFrame or pyarrow.Table Parameters ---------- df: pandas.DataFrame or pyarrow.Table Returns ------- query : MapDQuery """ ...
[ "def", "load_data", "(", "self", ",", "df", ")", ":", "stmt", "=", "ddl", ".", "LoadData", "(", "self", ".", "_qualified_name", ",", "df", ")", "return", "self", ".", "_execute", "(", "stmt", ")" ]
[ 210, 4 ]
[ 224, 34 ]
python
en
['en', 'error', 'th']
False
MapDTable.rename
(self, new_name, database=None)
Rename table inside MapD. References to the old table are no longer valid. Parameters ---------- new_name : string database : string Returns ------- renamed : MapDTable
Rename table inside MapD. References to the old table are no longer valid.
def rename(self, new_name, database=None): """ Rename table inside MapD. References to the old table are no longer valid. Parameters ---------- new_name : string database : string Returns ------- renamed : MapDTable """ m ...
[ "def", "rename", "(", "self", ",", "new_name", ",", "database", "=", "None", ")", ":", "m", "=", "ddl", ".", "fully_qualified_re", ".", "match", "(", "new_name", ")", "if", "not", "m", "and", "database", "is", "None", ":", "database", "=", "self", "....
[ 230, 4 ]
[ 255, 29 ]
python
en
['en', 'error', 'th']
False
MapDTable.alter
(self, tbl_properties=None)
Change setting and parameters of the table. Parameters ---------- tbl_properties : dict, optional Returns ------- None (for now)
Change setting and parameters of the table.
def alter(self, tbl_properties=None): """ Change setting and parameters of the table. Parameters ---------- tbl_properties : dict, optional Returns ------- None (for now) """ def _run_ddl(**kwds): stmt = ddl.AlterTable(self._q...
[ "def", "alter", "(", "self", ",", "tbl_properties", "=", "None", ")", ":", "def", "_run_ddl", "(", "*", "*", "kwds", ")", ":", "stmt", "=", "ddl", ".", "AlterTable", "(", "self", ".", "_qualified_name", ",", "*", "*", "kwds", ")", "return", "self", ...
[ 260, 4 ]
[ 278, 9 ]
python
en
['en', 'error', 'th']
False
MapDClient.__init__
(self, uri=None, user=None, password=None, host=None, port=9091, database=None, protocol='binary', execution_type=EXECUTION_TYPE_CURSOR)
Parameters ---------- uri : str user : str password : str host : str port : int database : str protocol : {'binary', 'http', 'https'} execution_type : { EXECUTION_TYPE_ICP, EXECUTION_TYPE_ICP_GPU, EXECUTION_TYPE_CURSOR }...
def __init__(self, uri=None, user=None, password=None, host=None, port=9091, database=None, protocol='binary', execution_type=EXECUTION_TYPE_CURSOR): """ Parameters ---------- uri : str user : str password : str host : str ...
[ "def", "__init__", "(", "self", ",", "uri", "=", "None", ",", "user", "=", "None", ",", "password", "=", "None", ",", "host", "=", "None", ",", "port", "=", "9091", ",", "database", "=", "None", ",", "protocol", "=", "'binary'", ",", "execution_type"...
[ 299, 4 ]
[ 338, 9 ]
python
en
['en', 'error', 'th']
False
MapDClient.close
(self)
Close MapD connection and drop any temporary objects
Close MapD connection and drop any temporary objects
def close(self): """Close MapD connection and drop any temporary objects""" self.con.close()
[ "def", "close", "(", "self", ")", ":", "self", ".", "con", ".", "close", "(", ")" ]
[ 353, 4 ]
[ 355, 24 ]
python
en
['en', 'en', 'en']
True
MapDClient._build_ast
(self, expr, context)
Required. expr: context: :return:
Required.
def _build_ast(self, expr, context): """ Required. expr: context: :return: """ result = build_ast(expr, context) return result
[ "def", "_build_ast", "(", "self", ",", "expr", ",", "context", ")", ":", "result", "=", "build_ast", "(", "expr", ",", "context", ")", "return", "result" ]
[ 357, 4 ]
[ 366, 21 ]
python
en
['en', 'error', 'th']
False
MapDClient._get_table_schema
(self, table_name, database=None)
Parameters ---------- table_name : str database : str Returns ------- schema : ibis Schema
def _get_table_schema(self, table_name, database=None): """ Parameters ---------- table_name : str database : str Returns ------- schema : ibis Schema """ table_name_ = table_name.split('.') if len(table_name_) == 2: ...
[ "def", "_get_table_schema", "(", "self", ",", "table_name", ",", "database", "=", "None", ")", ":", "table_name_", "=", "table_name", ".", "split", "(", "'.'", ")", "if", "len", "(", "table_name_", ")", "==", "2", ":", "database", ",", "table_name", "=",...
[ 372, 4 ]
[ 388, 52 ]
python
en
['en', 'error', 'th']
False
MapDClient._execute
(self, query, results=True)
query: :return:
def _execute(self, query, results=True): """ query: :return: """ if isinstance(query, (DDL, DML)): query = query.compile() if self.execution_type == EXECUTION_TYPE_ICP: execute = self.con.select_ipc elif self.execution_type == EXECUTION_T...
[ "def", "_execute", "(", "self", ",", "query", ",", "results", "=", "True", ")", ":", "if", "isinstance", "(", "query", ",", "(", "DDL", ",", "DML", ")", ")", ":", "query", "=", "query", ".", "compile", "(", ")", "if", "self", ".", "execution_type",...
[ 390, 4 ]
[ 412, 25 ]
python
en
['en', 'error', 'th']
False
MapDClient.create_database
(self, name, owner=None)
Create a new MapD database Parameters ---------- name : string Database name
Create a new MapD database
def create_database(self, name, owner=None): """ Create a new MapD database Parameters ---------- name : string Database name """ statement = ddl.CreateDatabase(name, owner=owner) self._execute(statement)
[ "def", "create_database", "(", "self", ",", "name", ",", "owner", "=", "None", ")", ":", "statement", "=", "ddl", ".", "CreateDatabase", "(", "name", ",", "owner", "=", "owner", ")", "self", ".", "_execute", "(", "statement", ")" ]
[ 414, 4 ]
[ 424, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.drop_database
(self, name, force=False)
Drop an MapD database Parameters ---------- name : string Database name force : boolean, default False If False and there are any tables in this database, raises an IntegrityError
Drop an MapD database
def drop_database(self, name, force=False): """ Drop an MapD database Parameters ---------- name : string Database name force : boolean, default False If False and there are any tables in this database, raises an IntegrityError """ ...
[ "def", "drop_database", "(", "self", ",", "name", ",", "force", "=", "False", ")", ":", "tables", "=", "[", "]", "if", "not", "force", "or", "self", ".", "database", "(", "name", ")", ":", "tables", "=", "self", ".", "list_tables", "(", "database", ...
[ 426, 4 ]
[ 449, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.create_user
(self, name, password, is_super=False)
Create a new MapD user Parameters ---------- name : string User name password : string Password is_super : bool if user is a superuser
Create a new MapD user
def create_user(self, name, password, is_super=False): """ Create a new MapD user Parameters ---------- name : string User name password : string Password is_super : bool if user is a superuser """ statement = ddl.Cre...
[ "def", "create_user", "(", "self", ",", "name", ",", "password", ",", "is_super", "=", "False", ")", ":", "statement", "=", "ddl", ".", "CreateUser", "(", "name", "=", "name", ",", "password", "=", "password", ",", "is_super", "=", "is_super", ")", "se...
[ 451, 4 ]
[ 469, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.alter_user
(self, name, password=None, is_super=None, insert_access=None)
Alter MapD user parameters Parameters ---------- name : string User name password : string Password is_super : bool If user is a superuser insert_access : string If users need to insert records to a database they do not ow...
Alter MapD user parameters
def alter_user(self, name, password=None, is_super=None, insert_access=None): """ Alter MapD user parameters Parameters ---------- name : string User name password : string Password is_super : bool If user is a sup...
[ "def", "alter_user", "(", "self", ",", "name", ",", "password", "=", "None", ",", "is_super", "=", "None", ",", "insert_access", "=", "None", ")", ":", "statement", "=", "ddl", ".", "AlterUser", "(", "name", "=", "name", ",", "password", "=", "password...
[ 471, 4 ]
[ 494, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.drop_user
(self, name)
Drop an MapD user Parameters ---------- name : string Database name
Drop an MapD user
def drop_user(self, name): """ Drop an MapD user Parameters ---------- name : string Database name """ statement = ddl.DropUser(name) self._execute(statement)
[ "def", "drop_user", "(", "self", ",", "name", ")", ":", "statement", "=", "ddl", ".", "DropUser", "(", "name", ")", "self", ".", "_execute", "(", "statement", ")" ]
[ 496, 4 ]
[ 506, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.create_view
(self, name, expr, database=None)
Create an MapD view from a table expression Parameters ---------- name : string expr : ibis TableExpr database : string, default None
Create an MapD view from a table expression
def create_view(self, name, expr, database=None): """ Create an MapD view from a table expression Parameters ---------- name : string expr : ibis TableExpr database : string, default None """ ast = self._build_ast(expr, MapDDialect.make_context())...
[ "def", "create_view", "(", "self", ",", "name", ",", "expr", ",", "database", "=", "None", ")", ":", "ast", "=", "self", ".", "_build_ast", "(", "expr", ",", "MapDDialect", ".", "make_context", "(", ")", ")", "select", "=", "ast", ".", "queries", "["...
[ 508, 4 ]
[ 521, 32 ]
python
en
['en', 'error', 'th']
False
MapDClient.drop_view
(self, name, database=None)
Drop an MapD view Parameters ---------- name : string database : string, default None
Drop an MapD view
def drop_view(self, name, database=None): """ Drop an MapD view Parameters ---------- name : string database : string, default None """ statement = ddl.DropView(name, database=database) self._execute(statement, False)
[ "def", "drop_view", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "statement", "=", "ddl", ".", "DropView", "(", "name", ",", "database", "=", "database", ")", "self", ".", "_execute", "(", "statement", ",", "False", ")" ]
[ 523, 4 ]
[ 533, 39 ]
python
en
['en', 'error', 'th']
False
MapDClient.create_table
(self, table_name, obj=None, schema=None, database=None, fragment_size=None, max_rows=None, page_size=None, partitions=None, shard_count=None)
Create a new table in MapD using an Ibis table expression. Parameters ---------- table_name : string obj : TableExpr or pandas.DataFrame, optional If passed, creates table from select statement results schema : ibis.Schema, optional Mutually exclusiv...
Create a new table in MapD using an Ibis table expression.
def create_table(self, table_name, obj=None, schema=None, database=None, fragment_size=None, max_rows=None, page_size=None, partitions=None, shard_count=None): """ Create a new table in MapD using an Ibis table expression. Parameters ---------- ...
[ "def", "create_table", "(", "self", ",", "table_name", ",", "obj", "=", "None", ",", "schema", "=", "None", ",", "database", "=", "None", ",", "fragment_size", "=", "None", ",", "max_rows", "=", "None", ",", "page_size", "=", "None", ",", "partitions", ...
[ 535, 4 ]
[ 606, 21 ]
python
en
['en', 'error', 'th']
False
MapDClient.drop_table
(self, table_name, database=None, force=False)
Drop an MapD table Parameters ---------- table_name : string database : string, default None (optional) force : boolean, default False Database may throw exception if table does not exist Examples -------- >>> table = 'my_table' ...
Drop an MapD table
def drop_table(self, table_name, database=None, force=False): """ Drop an MapD table Parameters ---------- table_name : string database : string, default None (optional) force : boolean, default False Database may throw exception if table does not exist...
[ "def", "drop_table", "(", "self", ",", "table_name", ",", "database", "=", "None", ",", "force", "=", "False", ")", ":", "_database", "=", "self", ".", "db_name", "self", ".", "set_database", "(", "database", ")", "statement", "=", "ddl", ".", "DropTable...
[ 608, 4 ]
[ 632, 36 ]
python
en
['en', 'error', 'th']
False
MapDClient.truncate_table
(self, table_name, database=None)
Delete all rows from, but do not drop, an existing table Parameters ---------- table_name : string database : string, default None (optional)
Delete all rows from, but do not drop, an existing table
def truncate_table(self, table_name, database=None): """ Delete all rows from, but do not drop, an existing table Parameters ---------- table_name : string database : string, default None (optional) """ statement = ddl.TruncateTable(table_name, database=d...
[ "def", "truncate_table", "(", "self", ",", "table_name", ",", "database", "=", "None", ")", ":", "statement", "=", "ddl", ".", "TruncateTable", "(", "table_name", ",", "database", "=", "database", ")", "self", ".", "_execute", "(", "statement", ",", "False...
[ 634, 4 ]
[ 644, 39 ]
python
en
['en', 'error', 'th']
False
MapDClient.drop_table_or_view
(self, name, database=None, force=False)
Attempt to drop a relation that may be a view or table
Attempt to drop a relation that may be a view or table
def drop_table_or_view(self, name, database=None, force=False): """ Attempt to drop a relation that may be a view or table """ try: self.drop_table(name, database=database) except Exception as e: try: self.drop_view(name, database=database)...
[ "def", "drop_table_or_view", "(", "self", ",", "name", ",", "database", "=", "None", ",", "force", "=", "False", ")", ":", "try", ":", "self", ".", "drop_table", "(", "name", ",", "database", "=", "database", ")", "except", "Exception", "as", "e", ":",...
[ 646, 4 ]
[ 656, 23 ]
python
en
['en', 'error', 'th']
False
MapDClient.database
(self, name=None)
Connect to a database called `name`. Parameters ---------- name : str, optional The name of the database to connect to. If ``None``, return the database named ``self.current_database``. Returns ------- db : Database An :class:`ibis.cl...
Connect to a database called `name`.
def database(self, name=None): """Connect to a database called `name`. Parameters ---------- name : str, optional The name of the database to connect to. If ``None``, return the database named ``self.current_database``. Returns ------- db...
[ "def", "database", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", "==", "self", ".", "current_database", "or", "name", "is", "None", ":", "return", "self", ".", "database_class", "(", "self", ".", "current_database", ",", "self", ")", "...
[ 658, 4 ]
[ 686, 56 ]
python
en
['en', 'en', 'en']
True
MapDClient.load_data
(self, table_name, obj, database=None, **kwargs)
Wraps the LOAD DATA DDL statement. Loads data into an MapD table by physically moving data files. Parameters ---------- table_name : string obj: pandas.DataFrame or pyarrow.Table database : string, default None (optional)
Wraps the LOAD DATA DDL statement. Loads data into an MapD table by physically moving data files.
def load_data(self, table_name, obj, database=None, **kwargs): """ Wraps the LOAD DATA DDL statement. Loads data into an MapD table by physically moving data files. Parameters ---------- table_name : string obj: pandas.DataFrame or pyarrow.Table database ...
[ "def", "load_data", "(", "self", ",", "table_name", ",", "obj", ",", "database", "=", "None", ",", "*", "*", "kwargs", ")", ":", "_database", "=", "self", ".", "db_name", "self", ".", "set_database", "(", "database", ")", "self", ".", "con", ".", "lo...
[ 688, 4 ]
[ 702, 36 ]
python
en
['en', 'error', 'th']
False
MapDClient.exists_table
(self, name, database=None)
Determine if the indicated table or view exists Parameters ---------- name : string database : string, default None Returns ------- if_exists : boolean
Determine if the indicated table or view exists
def exists_table(self, name, database=None): """ Determine if the indicated table or view exists Parameters ---------- name : string database : string, default None Returns ------- if_exists : boolean """ return bool(self.list_tab...
[ "def", "exists_table", "(", "self", ",", "name", ",", "database", "=", "None", ")", ":", "return", "bool", "(", "self", ".", "list_tables", "(", "like", "=", "name", ",", "database", "=", "database", ")", ")" ]
[ 724, 4 ]
[ 737, 67 ]
python
en
['en', 'error', 'th']
False
MapDClient.get_schema
(self, table_name, database=None)
Return a Schema object for the indicated table and database Parameters ---------- table_name : string May be fully qualified database : string, default None Returns ------- schema : ibis Schema
Return a Schema object for the indicated table and database
def get_schema(self, table_name, database=None): """ Return a Schema object for the indicated table and database Parameters ---------- table_name : string May be fully qualified database : string, default None Returns ------- schema : i...
[ "def", "get_schema", "(", "self", ",", "table_name", ",", "database", "=", "None", ")", ":", "col_names", "=", "[", "]", "col_types", "=", "[", "]", "for", "col", "in", "self", ".", "con", ".", "get_table_details", "(", "table_name", ")", ":", "col_nam...
[ 756, 4 ]
[ 780, 10 ]
python
en
['en', 'error', 'th']
False
fitDbScan
(X, min_samples, min_cluster_size, cache_out)
Function to fit DBSCAN model as an alternative to the Gaussian Fits the DBSCAN model to the distances using hdbscan Args: X (np.array) n x 2 array of core and accessory distances for n samples min_samples (int) Parameter for DBSCAN clustering 'conservativeness' ...
Function to fit DBSCAN model as an alternative to the Gaussian
def fitDbScan(X, min_samples, min_cluster_size, cache_out): """Function to fit DBSCAN model as an alternative to the Gaussian Fits the DBSCAN model to the distances using hdbscan Args: X (np.array) n x 2 array of core and accessory distances for n samples min_samples (int) ...
[ "def", "fitDbScan", "(", "X", ",", "min_samples", ",", "min_cluster_size", ",", "cache_out", ")", ":", "# set DBSCAN clustering parameters", "hdb", "=", "hdbscan", ".", "HDBSCAN", "(", "algorithm", "=", "'boruvka_balltree'", ",", "min_samples", "=", "min_samples", ...
[ 11, 0 ]
[ 47, 34 ]
python
en
['en', 'en', 'en']
True
evaluate_dbscan_clusters
(model)
Evaluate whether fitted dbscan model contains non-overlapping clusters Args: model (DBSCANFit) Fitted model from :func:`~PopPUNK.models.DBSCANFit.fit` Returns: indistinct (bool) Boolean indicating whether putative within- and between-strain clusters of point...
Evaluate whether fitted dbscan model contains non-overlapping clusters
def evaluate_dbscan_clusters(model): """Evaluate whether fitted dbscan model contains non-overlapping clusters Args: model (DBSCANFit) Fitted model from :func:`~PopPUNK.models.DBSCANFit.fit` Returns: indistinct (bool) Boolean indicating whether putative within- and ...
[ "def", "evaluate_dbscan_clusters", "(", "model", ")", ":", "indistinct", "=", "True", "# calculate ranges of minima and maxima", "core_minimum_of_between", "=", "model", ".", "cluster_mins", "[", "model", ".", "between_label", ",", "0", "]", "core_maximum_of_within", "=...
[ 50, 0 ]
[ 77, 21 ]
python
en
['en', 'en', 'en']
True
findBetweenLabel
(assignments, within_cluster)
Identify between-strain links from a DBSCAN model Finds the component containing the largest number of between-strain links, excluding the cluster identified as containing within-strain links. Args: assignments (numpy.array) Sample cluster assignments within_cluster (int) ...
Identify between-strain links from a DBSCAN model
def findBetweenLabel(assignments, within_cluster): """Identify between-strain links from a DBSCAN model Finds the component containing the largest number of between-strain links, excluding the cluster identified as containing within-strain links. Args: assignments (numpy.array) ...
[ "def", "findBetweenLabel", "(", "assignments", ",", "within_cluster", ")", ":", "# remove noise and within-strain distance cluster", "assignment_list", "=", "assignments", ".", "tolist", "(", ")", "assignment_list", "=", "list", "(", "filter", "(", "(", "within_cluster"...
[ 79, 0 ]
[ 104, 26 ]
python
en
['en', 'en', 'en']
True
hdfs_connect
(host='localhost', port=50070, protocol='webhdfs', use_https='default', auth_mechanism='NOSASL', verify=True, **kwds)
Connect to HDFS Parameters ---------- host : string, Host name of the HDFS NameNode port : int, NameNode's WebHDFS port (default 50070) protocol : {'webhdfs'} use_https : boolean, default 'default' Connect to WebHDFS with HTTPS, otherwise plain HTTP. For secure authenticati...
Connect to HDFS
def hdfs_connect(host='localhost', port=50070, protocol='webhdfs', use_https='default', auth_mechanism='NOSASL', verify=True, **kwds): """ Connect to HDFS Parameters ---------- host : string, Host name of the HDFS NameNode port : int, NameNode's WebHDFS port (d...
[ "def", "hdfs_connect", "(", "host", "=", "'localhost'", ",", "port", "=", "50070", ",", "protocol", "=", "'webhdfs'", ",", "use_https", "=", "'default'", ",", "auth_mechanism", "=", "'NOSASL'", ",", "verify", "=", "True", ",", "*", "*", "kwds", ")", ":",...
[ 83, 0 ]
[ 136, 31 ]
python
en
['en', 'error', 'th']
False
feature
(self, node="clickhouse1")
Check grant privilege syntax. ```sql GRANT [ON CLUSTER cluster_name] privilege {SELECT | SELECT(columns) | INSERT | ALTER | CREATE | DROP | TRUNCATE | OPTIMIZE | SHOW | KILL QUERY | ACCESS MANAGEMENT | SYSTEM | INTROSPECTION | SOURCES | dictGet | NONE |ALL [PRIVILEGES]} [, ...] ON {*.* | database.*...
Check grant privilege syntax.
def feature(self, node="clickhouse1"): """Check grant privilege syntax. ```sql GRANT [ON CLUSTER cluster_name] privilege {SELECT | SELECT(columns) | INSERT | ALTER | CREATE | DROP | TRUNCATE | OPTIMIZE | SHOW | KILL QUERY | ACCESS MANAGEMENT | SYSTEM | INTROSPECTION | SOURCES | dictGet | NONE |ALL ...
[ "def", "feature", "(", "self", ",", "node", "=", "\"clickhouse1\"", ")", ":", "node", "=", "self", ".", "context", ".", "cluster", ".", "node", "(", "node", ")", "Scenario", "(", "run", "=", "grant_privileges", ")", "# with nonexistant object name, GRANT assum...
[ 68, 0 ]
[ 133, 73 ]
python
en
['en', 'it', 'en']
True
ParseNolintSuppressions
(filename, raw_line, linenum, error)
Updates the global list of line error-suppressions. Parses any NOLINT comments on the current line, updating the global error_suppressions store. Reports an error if the NOLINT comment was malformed. Args: filename: str, the name of the input file. raw_line: str, the line of input text, with comments...
Updates the global list of line error-suppressions.
def ParseNolintSuppressions(filename, raw_line, linenum, error): """Updates the global list of line error-suppressions. Parses any NOLINT comments on the current line, updating the global error_suppressions store. Reports an error if the NOLINT comment was malformed. Args: filename: str, the name of th...
[ "def", "ParseNolintSuppressions", "(", "filename", ",", "raw_line", ",", "linenum", ",", "error", ")", ":", "matched", "=", "Search", "(", "r'\\bNOLINT(NEXTLINE)?\\b(\\([^)]+\\))?'", ",", "raw_line", ")", "if", "matched", ":", "if", "matched", ".", "group", "(",...
[ 713, 0 ]
[ 742, 63 ]
python
en
['en', 'en', 'en']
True
ProcessGlobalSuppresions
(lines)
Updates the list of global error suppressions. Parses any lint directives in the file that have global effect. Args: lines: An array of strings, each representing a line of the file, with the last element being empty if the file is terminated with a newline.
Updates the list of global error suppressions.
def ProcessGlobalSuppresions(lines): """Updates the list of global error suppressions. Parses any lint directives in the file that have global effect. Args: lines: An array of strings, each representing a line of the file, with the last element being empty if the file is terminated with a newline...
[ "def", "ProcessGlobalSuppresions", "(", "lines", ")", ":", "for", "line", "in", "lines", ":", "if", "_SEARCH_C_FILE", ".", "search", "(", "line", ")", ":", "for", "category", "in", "_DEFAULT_C_SUPPRESSED_CATEGORIES", ":", "_global_error_suppressions", "[", "catego...
[ 745, 0 ]
[ 760, 51 ]
python
en
['en', 'en', 'en']
True
ResetNolintSuppressions
()
Resets the set of NOLINT suppressions to empty.
Resets the set of NOLINT suppressions to empty.
def ResetNolintSuppressions(): """Resets the set of NOLINT suppressions to empty.""" _error_suppressions.clear() _global_error_suppressions.clear()
[ "def", "ResetNolintSuppressions", "(", ")", ":", "_error_suppressions", ".", "clear", "(", ")", "_global_error_suppressions", ".", "clear", "(", ")" ]
[ 763, 0 ]
[ 766, 36 ]
python
en
['en', 'en', 'en']
True
IsErrorSuppressedByNolint
(category, linenum)
Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions. Args: category: str, the category of the error. linenum: int, the current line number. Returns: ...
Returns true if the specified error category is suppressed on this line.
def IsErrorSuppressedByNolint(category, linenum): """Returns true if the specified error category is suppressed on this line. Consults the global error_suppressions map populated by ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions. Args: category: str, the category of the error. ...
[ "def", "IsErrorSuppressedByNolint", "(", "category", ",", "linenum", ")", ":", "return", "(", "_global_error_suppressions", ".", "get", "(", "category", ",", "False", ")", "or", "linenum", "in", "_error_suppressions", ".", "get", "(", "category", ",", "set", "...
[ 769, 0 ]
[ 784, 58 ]
python
en
['en', 'en', 'en']
True