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
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
batched
def batched(iterable, size): """ Split an iterable into constant sized chunks Recipe from http://stackoverflow.com/a/8290514 """ length = len(iterable) for batch_start in range(0, length, size): yield iterable[batch_start:batch_start+size]
python
def batched(iterable, size): """ Split an iterable into constant sized chunks Recipe from http://stackoverflow.com/a/8290514 """ length = len(iterable) for batch_start in range(0, length, size): yield iterable[batch_start:batch_start+size]
[ "def", "batched", "(", "iterable", ",", "size", ")", ":", "length", "=", "len", "(", "iterable", ")", "for", "batch_start", "in", "range", "(", "0", ",", "length", ",", "size", ")", ":", "yield", "iterable", "[", "batch_start", ":", "batch_start", "+",...
Split an iterable into constant sized chunks Recipe from http://stackoverflow.com/a/8290514
[ "Split", "an", "iterable", "into", "constant", "sized", "chunks", "Recipe", "from", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "8290514" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L39-L46
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
standardize_input_data
def standardize_input_data(data): """ Ensure utf-8 encoded strings are passed to the indico API """ if type(data) == bytes: data = data.decode('utf-8') if type(data) == list: data = [ el.decode('utf-8') if type(data) == bytes else el for el in data ] ...
python
def standardize_input_data(data): """ Ensure utf-8 encoded strings are passed to the indico API """ if type(data) == bytes: data = data.decode('utf-8') if type(data) == list: data = [ el.decode('utf-8') if type(data) == bytes else el for el in data ] ...
[ "def", "standardize_input_data", "(", "data", ")", ":", "if", "type", "(", "data", ")", "==", "bytes", ":", "data", "=", "data", ".", "decode", "(", "'utf-8'", ")", "if", "type", "(", "data", ")", "==", "list", ":", "data", "=", "[", "el", ".", "...
Ensure utf-8 encoded strings are passed to the indico API
[ "Ensure", "utf", "-", "8", "encoded", "strings", "are", "passed", "to", "the", "indico", "API" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L49-L60
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
api_handler
def api_handler(input_data, cloud, api, url_params=None, batch_size=None, **kwargs): """ Sends finalized request data to ML server and receives response. If a batch_size is specified, breaks down a request into smaller component requests and aggregates the results. """ url_params = url_params or...
python
def api_handler(input_data, cloud, api, url_params=None, batch_size=None, **kwargs): """ Sends finalized request data to ML server and receives response. If a batch_size is specified, breaks down a request into smaller component requests and aggregates the results. """ url_params = url_params or...
[ "def", "api_handler", "(", "input_data", ",", "cloud", ",", "api", ",", "url_params", "=", "None", ",", "batch_size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "url_params", "or", "{", "}", "input_data", "=", "standardize_input_dat...
Sends finalized request data to ML server and receives response. If a batch_size is specified, breaks down a request into smaller component requests and aggregates the results.
[ "Sends", "finalized", "request", "data", "to", "ML", "server", "and", "receives", "response", ".", "If", "a", "batch_size", "is", "specified", "breaks", "down", "a", "request", "into", "smaller", "component", "requests", "and", "aggregates", "the", "results", ...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L63-L84
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
collect_api_results
def collect_api_results(input_data, url, headers, api, batch_size, kwargs): """ Optionally split up a single request into a series of requests to ensure timely HTTP responses. Could eventually speed up the time required to receive a response by sending batches to the indico API concurrently """...
python
def collect_api_results(input_data, url, headers, api, batch_size, kwargs): """ Optionally split up a single request into a series of requests to ensure timely HTTP responses. Could eventually speed up the time required to receive a response by sending batches to the indico API concurrently """...
[ "def", "collect_api_results", "(", "input_data", ",", "url", ",", "headers", ",", "api", ",", "batch_size", ",", "kwargs", ")", ":", "if", "batch_size", ":", "results", "=", "[", "]", "for", "batch", "in", "batched", "(", "input_data", ",", "size", "=", ...
Optionally split up a single request into a series of requests to ensure timely HTTP responses. Could eventually speed up the time required to receive a response by sending batches to the indico API concurrently
[ "Optionally", "split", "up", "a", "single", "request", "into", "a", "series", "of", "requests", "to", "ensure", "timely", "HTTP", "responses", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L87-L124
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
send_request
def send_request(input_data, api, url, headers, kwargs): """ Use the requests library to send of an HTTP call to the indico servers """ data = {} if input_data != None: data['data'] = input_data # request that the API respond with a msgpack encoded result serializer = kwargs.pop("se...
python
def send_request(input_data, api, url, headers, kwargs): """ Use the requests library to send of an HTTP call to the indico servers """ data = {} if input_data != None: data['data'] = input_data # request that the API respond with a msgpack encoded result serializer = kwargs.pop("se...
[ "def", "send_request", "(", "input_data", ",", "api", ",", "url", ",", "headers", ",", "kwargs", ")", ":", "data", "=", "{", "}", "if", "input_data", "!=", "None", ":", "data", "[", "'data'", "]", "=", "input_data", "# request that the API respond with a msg...
Use the requests library to send of an HTTP call to the indico servers
[ "Use", "the", "requests", "library", "to", "send", "of", "an", "HTTP", "call", "to", "the", "indico", "servers" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L127-L172
IndicoDataSolutions/IndicoIo-python
indicoio/utils/api.py
create_url
def create_url(url_protocol, host, api, url_params): """ Generate the proper url for sending off data for analysis """ is_batch = url_params.pop("batch", None) apis = url_params.pop("apis", None) version = url_params.pop("version", None) or url_params.pop("v", None) method = url_params.pop('...
python
def create_url(url_protocol, host, api, url_params): """ Generate the proper url for sending off data for analysis """ is_batch = url_params.pop("batch", None) apis = url_params.pop("apis", None) version = url_params.pop("version", None) or url_params.pop("v", None) method = url_params.pop('...
[ "def", "create_url", "(", "url_protocol", ",", "host", ",", "api", ",", "url_params", ")", ":", "is_batch", "=", "url_params", ".", "pop", "(", "\"batch\"", ",", "None", ")", "apis", "=", "url_params", ".", "pop", "(", "\"apis\"", ",", "None", ")", "ve...
Generate the proper url for sending off data for analysis
[ "Generate", "the", "proper", "url", "for", "sending", "off", "data", "for", "analysis" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/api.py#L175-L199
IndicoDataSolutions/IndicoIo-python
indicoio/text/keywords.py
keywords
def keywords(text, cloud=None, batch=False, api_key=None, version=2, batch_size=None, **kwargs): """ Given input text, returns series of keywords and associated scores Example usage: .. code-block:: python >>> import indicoio >>> import numpy as np >>> text = 'Monday: Delightful ...
python
def keywords(text, cloud=None, batch=False, api_key=None, version=2, batch_size=None, **kwargs): """ Given input text, returns series of keywords and associated scores Example usage: .. code-block:: python >>> import indicoio >>> import numpy as np >>> text = 'Monday: Delightful ...
[ "def", "keywords", "(", "text", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "2", ",", "batch_size", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "kwargs", ".", "get", "(", "\"l...
Given input text, returns series of keywords and associated scores Example usage: .. code-block:: python >>> import indicoio >>> import numpy as np >>> text = 'Monday: Delightful with mostly sunny skies. Highs in the low 70s.' >>> keywords = indicoio.keywords(text, top_n=3) ...
[ "Given", "input", "text", "returns", "series", "of", "keywords", "and", "associated", "scores" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/text/keywords.py#L6-L28
IndicoDataSolutions/IndicoIo-python
indicoio/text/personas.py
personas
def personas(text, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given input text, returns the authors likelihood of being 16 different personality types in a dict. Example usage: .. code-block:: python >>> text = "I love going out with my friends" >>> entities...
python
def personas(text, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given input text, returns the authors likelihood of being 16 different personality types in a dict. Example usage: .. code-block:: python >>> text = "I love going out with my friends" >>> entities...
[ "def", "personas", "(", "text", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "batch", ",", "\"api_key\"",...
Given input text, returns the authors likelihood of being 16 different personality types in a dict. Example usage: .. code-block:: python >>> text = "I love going out with my friends" >>> entities = indicoio.personas(text) {'architect': 0.2191890478134155, 'logician': 0.0158474326133...
[ "Given", "input", "text", "returns", "the", "authors", "likelihood", "of", "being", "16", "different", "personality", "types", "in", "a", "dict", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/text/personas.py#L6-L27
IndicoDataSolutions/IndicoIo-python
indicoio/pdf/pdf_extraction.py
pdf_extraction
def pdf_extraction(pdf, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given a pdf, returns the text and metadata associated with the given pdf. PDFs may be provided as base64 encoded data or as a filepath. Base64 image data and formatted table is optionally returned by setting ...
python
def pdf_extraction(pdf, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given a pdf, returns the text and metadata associated with the given pdf. PDFs may be provided as base64 encoded data or as a filepath. Base64 image data and formatted table is optionally returned by setting ...
[ "def", "pdf_extraction", "(", "pdf", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "pdf", "=", "pdf_preprocess", "(", "pdf", ",", "batch", "=", "b...
Given a pdf, returns the text and metadata associated with the given pdf. PDFs may be provided as base64 encoded data or as a filepath. Base64 image data and formatted table is optionally returned by setting `images=True` or `tables=True`. Example usage: .. code-block:: python >>> from ind...
[ "Given", "a", "pdf", "returns", "the", "text", "and", "metadata", "associated", "with", "the", "given", "pdf", ".", "PDFs", "may", "be", "provided", "as", "base64", "encoded", "data", "or", "as", "a", "filepath", ".", "Base64", "image", "data", "and", "f...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/pdf/pdf_extraction.py#L6-L35
data61/clkhash
clkhash/tokenizer.py
get_tokenizer
def get_tokenizer(fhp # type: Optional[field_formats.FieldHashingProperties] ): # type: (...) -> Callable[[Text, Optional[Text]], Iterable[Text]] """ Get tokeniser function from the hash settings. This function takes a FieldHashingProperties object. It returns a function that...
python
def get_tokenizer(fhp # type: Optional[field_formats.FieldHashingProperties] ): # type: (...) -> Callable[[Text, Optional[Text]], Iterable[Text]] """ Get tokeniser function from the hash settings. This function takes a FieldHashingProperties object. It returns a function that...
[ "def", "get_tokenizer", "(", "fhp", "# type: Optional[field_formats.FieldHashingProperties]", ")", ":", "# type: (...) -> Callable[[Text, Optional[Text]], Iterable[Text]]", "def", "dummy", "(", "word", ",", "ignore", "=", "None", ")", ":", "# type: (Text, Optional[Text]) -> Itera...
Get tokeniser function from the hash settings. This function takes a FieldHashingProperties object. It returns a function that takes a string and tokenises based on those properties.
[ "Get", "tokeniser", "function", "from", "the", "hash", "settings", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/tokenizer.py#L15-L69
IndicoDataSolutions/IndicoIo-python
indicoio/utils/pdf.py
pdf_preprocess
def pdf_preprocess(pdf, batch=False): """ Load pdfs from local filepath if not already b64 encoded """ if batch: return [pdf_preprocess(doc, batch=False) for doc in pdf] if os.path.isfile(pdf): # a filepath is provided, read and encode return b64encode(open(pdf, 'rb').read()...
python
def pdf_preprocess(pdf, batch=False): """ Load pdfs from local filepath if not already b64 encoded """ if batch: return [pdf_preprocess(doc, batch=False) for doc in pdf] if os.path.isfile(pdf): # a filepath is provided, read and encode return b64encode(open(pdf, 'rb').read()...
[ "def", "pdf_preprocess", "(", "pdf", ",", "batch", "=", "False", ")", ":", "if", "batch", ":", "return", "[", "pdf_preprocess", "(", "doc", ",", "batch", "=", "False", ")", "for", "doc", "in", "pdf", "]", "if", "os", ".", "path", ".", "isfile", "("...
Load pdfs from local filepath if not already b64 encoded
[ "Load", "pdfs", "from", "local", "filepath", "if", "not", "already", "b64", "encoded" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/pdf.py#L16-L28
IndicoDataSolutions/IndicoIo-python
indicoio/text/people.py
people
def people(text, cloud=None, batch=None, api_key=None, version=2, **kwargs): """ Given input text, returns references to specific persons found in the text Example usage: .. code-block:: python >>> text = "London Underground's boss Mike Brown warned that the strike ..." >>> ent...
python
def people(text, cloud=None, batch=None, api_key=None, version=2, **kwargs): """ Given input text, returns references to specific persons found in the text Example usage: .. code-block:: python >>> text = "London Underground's boss Mike Brown warned that the strike ..." >>> ent...
[ "def", "people", "(", "text", ",", "cloud", "=", "None", ",", "batch", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "2", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "batch", ",", "\"api_key\"", ":"...
Given input text, returns references to specific persons found in the text Example usage: .. code-block:: python >>> text = "London Underground's boss Mike Brown warned that the strike ..." >>> entities = indicoio.people(text) [ { u'text': "Mike Brown", ...
[ "Given", "input", "text", "returns", "references", "to", "specific", "persons", "found", "in", "the", "text", "Example", "usage", ":", "..", "code", "-", "block", "::", "python", ">>>", "text", "=", "London", "Underground", "s", "boss", "Mike", "Brown", "w...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/text/people.py#L6-L30
data61/clkhash
clkhash/stats.py
OnlineMeanVariance.update
def update(self, x # type: Sequence[Union[int, float]] ): # type: (...) -> None """ updates the statistics with the given list of numbers It uses an online algorithm which uses compensated summation to reduce numerical errors. See https://angelacor...
python
def update(self, x # type: Sequence[Union[int, float]] ): # type: (...) -> None """ updates the statistics with the given list of numbers It uses an online algorithm which uses compensated summation to reduce numerical errors. See https://angelacor...
[ "def", "update", "(", "self", ",", "x", "# type: Sequence[Union[int, float]]", ")", ":", "# type: (...) -> None", "if", "any", "(", "math", ".", "isnan", "(", "float", "(", "i", ")", ")", "or", "math", ".", "isinf", "(", "float", "(", "i", ")", ")", "f...
updates the statistics with the given list of numbers It uses an online algorithm which uses compensated summation to reduce numerical errors. See https://angelacorasaniti.wordpress.com/2015/05/06/hw2-mean-and-variance-of-data-stream/ for details. :param x: list of numbers :return: not...
[ "updates", "the", "statistics", "with", "the", "given", "list", "of", "numbers" ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/stats.py#L13-L37
data61/clkhash
clkhash/clk.py
hash_and_serialize_chunk
def hash_and_serialize_chunk(chunk_pii_data, # type: Sequence[Sequence[str]] keys, # type: Sequence[Sequence[bytes]] schema # type: Schema ): # type: (...) -> Tuple[List[str], Sequence[int]] """ Generate Bloom filters ...
python
def hash_and_serialize_chunk(chunk_pii_data, # type: Sequence[Sequence[str]] keys, # type: Sequence[Sequence[bytes]] schema # type: Schema ): # type: (...) -> Tuple[List[str], Sequence[int]] """ Generate Bloom filters ...
[ "def", "hash_and_serialize_chunk", "(", "chunk_pii_data", ",", "# type: Sequence[Sequence[str]]", "keys", ",", "# type: Sequence[Sequence[bytes]]", "schema", "# type: Schema", ")", ":", "# type: (...) -> Tuple[List[str], Sequence[int]]", "clk_data", "=", "[", "]", "clk_popcounts"...
Generate Bloom filters (ie hash) from chunks of PII then serialize the generated Bloom filters. It also computes and outputs the Hamming weight (or popcount) -- the number of bits set to one -- of the generated Bloom filters. :param chunk_pii_data: An iterable of indexable records. :param keys: A tuple...
[ "Generate", "Bloom", "filters", "(", "ie", "hash", ")", "from", "chunks", "of", "PII", "then", "serialize", "the", "generated", "Bloom", "filters", ".", "It", "also", "computes", "and", "outputs", "the", "Hamming", "weight", "(", "or", "popcount", ")", "--...
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/clk.py#L27-L48
data61/clkhash
clkhash/clk.py
generate_clk_from_csv
def generate_clk_from_csv(input_f, # type: TextIO keys, # type: Tuple[AnyStr, AnyStr] schema, # type: Schema validate=True, # type: bool header=True, # type: Union[bool, AnyStr] progres...
python
def generate_clk_from_csv(input_f, # type: TextIO keys, # type: Tuple[AnyStr, AnyStr] schema, # type: Schema validate=True, # type: bool header=True, # type: Union[bool, AnyStr] progres...
[ "def", "generate_clk_from_csv", "(", "input_f", ",", "# type: TextIO", "keys", ",", "# type: Tuple[AnyStr, AnyStr]", "schema", ",", "# type: Schema", "validate", "=", "True", ",", "# type: bool", "header", "=", "True", ",", "# type: Union[bool, AnyStr]", "progress_bar", ...
Generate Bloom filters from CSV file, then serialise them. This function also computes and outputs the Hamming weight (a.k.a popcount -- the number of bits set to high) of the generated Bloom filters. :param input_f: A file-like object of csv data to hash. :param keys: A tuple ...
[ "Generate", "Bloom", "filters", "from", "CSV", "file", "then", "serialise", "them", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/clk.py#L51-L125
data61/clkhash
clkhash/clk.py
chunks
def chunks(seq, chunk_size): # type: (Sequence[T], int) -> Iterable[Sequence[T]] """ Split seq into chunk_size-sized chunks. :param seq: A sequence to chunk. :param chunk_size: The size of chunk. """ return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size))
python
def chunks(seq, chunk_size): # type: (Sequence[T], int) -> Iterable[Sequence[T]] """ Split seq into chunk_size-sized chunks. :param seq: A sequence to chunk. :param chunk_size: The size of chunk. """ return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size))
[ "def", "chunks", "(", "seq", ",", "chunk_size", ")", ":", "# type: (Sequence[T], int) -> Iterable[Sequence[T]]", "return", "(", "seq", "[", "i", ":", "i", "+", "chunk_size", "]", "for", "i", "in", "range", "(", "0", ",", "len", "(", "seq", ")", ",", "chu...
Split seq into chunk_size-sized chunks. :param seq: A sequence to chunk. :param chunk_size: The size of chunk.
[ "Split", "seq", "into", "chunk_size", "-", "sized", "chunks", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/clk.py#L179-L186
data61/clkhash
clkhash/randomnames.py
load_csv_data
def load_csv_data(resource_name): # type: (str) -> List[str] """ Loads first column of specified CSV file from package data. """ data_bytes = pkgutil.get_data('clkhash', 'data/{}'.format(resource_name)) if data_bytes is None: raise ValueError("No data resource found with name {}".format(reso...
python
def load_csv_data(resource_name): # type: (str) -> List[str] """ Loads first column of specified CSV file from package data. """ data_bytes = pkgutil.get_data('clkhash', 'data/{}'.format(resource_name)) if data_bytes is None: raise ValueError("No data resource found with name {}".format(reso...
[ "def", "load_csv_data", "(", "resource_name", ")", ":", "# type: (str) -> List[str]", "data_bytes", "=", "pkgutil", ".", "get_data", "(", "'clkhash'", ",", "'data/{}'", ".", "format", "(", "resource_name", ")", ")", "if", "data_bytes", "is", "None", ":", "raise"...
Loads first column of specified CSV file from package data.
[ "Loads", "first", "column", "of", "specified", "CSV", "file", "from", "package", "data", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L32-L43
data61/clkhash
clkhash/randomnames.py
save_csv
def save_csv(data, # type: Iterable[Tuple[Union[str, int], ...]] headers, # type: Iterable[str] file # type: TextIO ): # type: (...) -> None """ Output generated data to file as CSV with header. :param data: An iterable of tuples containing raw data. :param...
python
def save_csv(data, # type: Iterable[Tuple[Union[str, int], ...]] headers, # type: Iterable[str] file # type: TextIO ): # type: (...) -> None """ Output generated data to file as CSV with header. :param data: An iterable of tuples containing raw data. :param...
[ "def", "save_csv", "(", "data", ",", "# type: Iterable[Tuple[Union[str, int], ...]]", "headers", ",", "# type: Iterable[str]", "file", "# type: TextIO", ")", ":", "# type: (...) -> None", "print", "(", "','", ".", "join", "(", "headers", ")", ",", "file", "=", "file...
Output generated data to file as CSV with header. :param data: An iterable of tuples containing raw data. :param headers: Iterable of feature names :param file: A writeable stream in which to write the CSV
[ "Output", "generated", "data", "to", "file", "as", "CSV", "with", "header", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L46-L61
data61/clkhash
clkhash/randomnames.py
random_date
def random_date(start, end): # type: (datetime, datetime) -> datetime """ Generate a random datetime between two datetime objects. :param start: datetime of start :param end: datetime of end :return: random datetime between start and end """ delta = end - start int_delta = (delta.days *...
python
def random_date(start, end): # type: (datetime, datetime) -> datetime """ Generate a random datetime between two datetime objects. :param start: datetime of start :param end: datetime of end :return: random datetime between start and end """ delta = end - start int_delta = (delta.days *...
[ "def", "random_date", "(", "start", ",", "end", ")", ":", "# type: (datetime, datetime) -> datetime", "delta", "=", "end", "-", "start", "int_delta", "=", "(", "delta", ".", "days", "*", "24", "*", "60", "*", "60", ")", "+", "delta", ".", "seconds", "ran...
Generate a random datetime between two datetime objects. :param start: datetime of start :param end: datetime of end :return: random datetime between start and end
[ "Generate", "a", "random", "datetime", "between", "two", "datetime", "objects", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L64-L75
data61/clkhash
clkhash/randomnames.py
NameList.generate_random_person
def generate_random_person(self, n): # type: (int) -> Iterable[Tuple[str, str, str, str]] """ Generator that yields details on a person with plausible name, sex and age. :yields: Generated data for one person tuple - (id: int, name: str('First Last'), birthdate: str('DD/MM/Y...
python
def generate_random_person(self, n): # type: (int) -> Iterable[Tuple[str, str, str, str]] """ Generator that yields details on a person with plausible name, sex and age. :yields: Generated data for one person tuple - (id: int, name: str('First Last'), birthdate: str('DD/MM/Y...
[ "def", "generate_random_person", "(", "self", ",", "n", ")", ":", "# type: (int) -> Iterable[Tuple[str, str, str, str]]", "assert", "self", ".", "all_male_first_names", "is", "not", "None", "assert", "self", ".", "all_female_first_names", "is", "not", "None", "assert", ...
Generator that yields details on a person with plausible name, sex and age. :yields: Generated data for one person tuple - (id: int, name: str('First Last'), birthdate: str('DD/MM/YYYY'), sex: str('M' | 'F') )
[ "Generator", "that", "yields", "details", "on", "a", "person", "with", "plausible", "name", "sex", "and", "age", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L106-L129
data61/clkhash
clkhash/randomnames.py
NameList.load_names
def load_names(self): # type: () -> None """ Loads a name database from package data Uses data files sourced from http://www.quietaffiliate.com/free-first-name-and-last-name-databases-csv-and-sql/ """ self.all_male_first_names = load_csv_data('male-first-names.csv') ...
python
def load_names(self): # type: () -> None """ Loads a name database from package data Uses data files sourced from http://www.quietaffiliate.com/free-first-name-and-last-name-databases-csv-and-sql/ """ self.all_male_first_names = load_csv_data('male-first-names.csv') ...
[ "def", "load_names", "(", "self", ")", ":", "# type: () -> None", "self", ".", "all_male_first_names", "=", "load_csv_data", "(", "'male-first-names.csv'", ")", "self", ".", "all_female_first_names", "=", "load_csv_data", "(", "'female-first-names.csv'", ")", "self", ...
Loads a name database from package data Uses data files sourced from http://www.quietaffiliate.com/free-first-name-and-last-name-databases-csv-and-sql/
[ "Loads", "a", "name", "database", "from", "package", "data" ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L131-L141
data61/clkhash
clkhash/randomnames.py
NameList.generate_subsets
def generate_subsets(self, sz, overlap=0.8, subsets=2): # type: (int, float, int) -> Tuple[List, ...] """ Return random subsets with nonempty intersection. The random subsets are of specified size. If an element is common to two subsets, then it is common to all subsets. ...
python
def generate_subsets(self, sz, overlap=0.8, subsets=2): # type: (int, float, int) -> Tuple[List, ...] """ Return random subsets with nonempty intersection. The random subsets are of specified size. If an element is common to two subsets, then it is common to all subsets. ...
[ "def", "generate_subsets", "(", "self", ",", "sz", ",", "overlap", "=", "0.8", ",", "subsets", "=", "2", ")", ":", "# type: (int, float, int) -> Tuple[List, ...]", "overlap_sz", "=", "int", "(", "math", ".", "floor", "(", "overlap", "*", "sz", ")", ")", "u...
Return random subsets with nonempty intersection. The random subsets are of specified size. If an element is common to two subsets, then it is common to all subsets. This overlap is controlled by a parameter. :param sz: size of subsets to generate :param ove...
[ "Return", "random", "subsets", "with", "nonempty", "intersection", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/randomnames.py#L143-L182
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
_unpack_list
def _unpack_list(example): """ Input data format standardization """ try: x = example[0] y = example[1] meta = None return x, y, meta except IndexError: raise IndicoError( "Invalid input data. Please ensure input data is " "formatted a...
python
def _unpack_list(example): """ Input data format standardization """ try: x = example[0] y = example[1] meta = None return x, y, meta except IndexError: raise IndicoError( "Invalid input data. Please ensure input data is " "formatted a...
[ "def", "_unpack_list", "(", "example", ")", ":", "try", ":", "x", "=", "example", "[", "0", "]", "y", "=", "example", "[", "1", "]", "meta", "=", "None", "return", "x", ",", "y", ",", "meta", "except", "IndexError", ":", "raise", "IndicoError", "("...
Input data format standardization
[ "Input", "data", "format", "standardization" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L10-L23
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
_unpack_dict
def _unpack_dict(example): """ Input data format standardization """ try: x = example['data'] y = example['target'] meta = example.get('metadata', {}) return x, y, meta except KeyError: raise IndicoError( "Invalid input data. Please ensure input d...
python
def _unpack_dict(example): """ Input data format standardization """ try: x = example['data'] y = example['target'] meta = example.get('metadata', {}) return x, y, meta except KeyError: raise IndicoError( "Invalid input data. Please ensure input d...
[ "def", "_unpack_dict", "(", "example", ")", ":", "try", ":", "x", "=", "example", "[", "'data'", "]", "y", "=", "example", "[", "'target'", "]", "meta", "=", "example", ".", "get", "(", "'metadata'", ",", "{", "}", ")", "return", "x", ",", "y", "...
Input data format standardization
[ "Input", "data", "format", "standardization" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L26-L40
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
_unpack_data
def _unpack_data(data): """ Break Xs, Ys, and metadata out into separate lists for data preprocessing. Run basic data validation. """ xs = [None] * len(data) ys = [None] * len(data) metadata = [None] * len(data) for idx, example in enumerate(data): if isinstance(example, (list, t...
python
def _unpack_data(data): """ Break Xs, Ys, and metadata out into separate lists for data preprocessing. Run basic data validation. """ xs = [None] * len(data) ys = [None] * len(data) metadata = [None] * len(data) for idx, example in enumerate(data): if isinstance(example, (list, t...
[ "def", "_unpack_data", "(", "data", ")", ":", "xs", "=", "[", "None", "]", "*", "len", "(", "data", ")", "ys", "=", "[", "None", "]", "*", "len", "(", "data", ")", "metadata", "=", "[", "None", "]", "*", "len", "(", "data", ")", "for", "idx",...
Break Xs, Ys, and metadata out into separate lists for data preprocessing. Run basic data validation.
[ "Break", "Xs", "Ys", "and", "metadata", "out", "into", "separate", "lists", "for", "data", "preprocessing", ".", "Run", "basic", "data", "validation", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L43-L57
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
_pack_data
def _pack_data(X, Y, metadata): """ After modifying / preprocessing inputs, reformat the data in preparation for JSON serialization """ if not any(metadata): # legacy list of list format is acceptable return list(zip(X, Y)) else: # newer dictionary-based format is requir...
python
def _pack_data(X, Y, metadata): """ After modifying / preprocessing inputs, reformat the data in preparation for JSON serialization """ if not any(metadata): # legacy list of list format is acceptable return list(zip(X, Y)) else: # newer dictionary-based format is requir...
[ "def", "_pack_data", "(", "X", ",", "Y", ",", "metadata", ")", ":", "if", "not", "any", "(", "metadata", ")", ":", "# legacy list of list format is acceptable", "return", "list", "(", "zip", "(", "X", ",", "Y", ")", ")", "else", ":", "# newer dictionary-ba...
After modifying / preprocessing inputs, reformat the data in preparation for JSON serialization
[ "After", "modifying", "/", "preprocessing", "inputs", "reformat", "the", "data", "in", "preparation", "for", "JSON", "serialization" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L60-L78
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
visualize_explanation
def visualize_explanation(explanation, label=None): """ Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence """ if not sys.version_info[:2] >= (3, 5): raise IndicoError("Python >= 3.5+ is required for explanation visualization") ...
python
def visualize_explanation(explanation, label=None): """ Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence """ if not sys.version_info[:2] >= (3, 5): raise IndicoError("Python >= 3.5+ is required for explanation visualization") ...
[ "def", "visualize_explanation", "(", "explanation", ",", "label", "=", "None", ")", ":", "if", "not", "sys", ".", "version_info", "[", ":", "2", "]", ">=", "(", "3", ",", "5", ")", ":", "raise", "IndicoError", "(", "\"Python >= 3.5+ is required for explanati...
Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence
[ "Given", "the", "output", "of", "the", "explain", "()", "endpoint", "produces", "a", "terminal", "visual", "that", "plots", "response", "strength", "over", "a", "sequence" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L81-L117
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
collections
def collections(cloud=None, api_key=None, version=None, **kwargs): """ This is a status report endpoint. It is used to get the status on all of the collections currently trained, as well as some basic statistics on their accuracies. Inputs api_key (optional) - String: Your API key, required only if...
python
def collections(cloud=None, api_key=None, version=None, **kwargs): """ This is a status report endpoint. It is used to get the status on all of the collections currently trained, as well as some basic statistics on their accuracies. Inputs api_key (optional) - String: Your API key, required only if...
[ "def", "collections", "(", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "False", ",", "\"api_key\"", ":", "api_key", ",", "\"version\"", ":"...
This is a status report endpoint. It is used to get the status on all of the collections currently trained, as well as some basic statistics on their accuracies. Inputs api_key (optional) - String: Your API key, required only if the key has not been declared elsewhere. This allows the API to recogniz...
[ "This", "is", "a", "status", "report", "endpoint", ".", "It", "is", "used", "to", "get", "the", "status", "on", "all", "of", "the", "collections", "currently", "trained", "as", "well", "as", "some", "basic", "statistics", "on", "their", "accuracies", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L396-L430
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
vectorize
def vectorize(data, cloud=None, api_key=None, version=None, **kwargs): """ Support for raw features from the custom collections API """ batch = detect_batch(data) data = data_preprocess(data, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version, "method": "vectorize"...
python
def vectorize(data, cloud=None, api_key=None, version=None, **kwargs): """ Support for raw features from the custom collections API """ batch = detect_batch(data) data = data_preprocess(data, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version, "method": "vectorize"...
[ "def", "vectorize", "(", "data", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "batch", "=", "detect_batch", "(", "data", ")", "data", "=", "data_preprocess", "(", "data", ",",...
Support for raw features from the custom collections API
[ "Support", "for", "raw", "features", "from", "the", "custom", "collections", "API" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L433-L440
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection._api_handler
def _api_handler(self, *args, **kwargs): """ Thin wrapper around api_handler from `indicoio.utils.api` to add in stored keyword argument to the JSON body """ keyword_arguments = {} keyword_arguments.update(self.keywords) keyword_arguments.update(kwargs) return api...
python
def _api_handler(self, *args, **kwargs): """ Thin wrapper around api_handler from `indicoio.utils.api` to add in stored keyword argument to the JSON body """ keyword_arguments = {} keyword_arguments.update(self.keywords) keyword_arguments.update(kwargs) return api...
[ "def", "_api_handler", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "keyword_arguments", "=", "{", "}", "keyword_arguments", ".", "update", "(", "self", ".", "keywords", ")", "keyword_arguments", ".", "update", "(", "kwargs", ")", "r...
Thin wrapper around api_handler from `indicoio.utils.api` to add in stored keyword argument to the JSON body
[ "Thin", "wrapper", "around", "api_handler", "from", "indicoio", ".", "utils", ".", "api", "to", "add", "in", "stored", "keyword", "argument", "to", "the", "JSON", "body" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L129-L136
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.add_data
def add_data(self, data, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is the basic training endpoint. Given a piece of text and a score, either categorical or numeric, this endpoint will train a new model given the additional piece of information. Inputs ...
python
def add_data(self, data, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is the basic training endpoint. Given a piece of text and a score, either categorical or numeric, this endpoint will train a new model given the additional piece of information. Inputs ...
[ "def", "add_data", "(", "self", ",", "data", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "not", "len", "(", "data", ")", ":", "raise", ...
This is the basic training endpoint. Given a piece of text and a score, either categorical or numeric, this endpoint will train a new model given the additional piece of information. Inputs data - List: The text and collection/score associated with it. The length of the text (string) should ide...
[ "This", "is", "the", "basic", "training", "endpoint", ".", "Given", "a", "piece", "of", "text", "and", "a", "score", "either", "categorical", "or", "numeric", "this", "endpoint", "will", "train", "a", "new", "model", "given", "the", "additional", "piece", ...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L138-L177
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.train
def train(self, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is the basic training endpoint. Given an existing dataset this endpoint will train a model. Inputs api_key (optional) - String: Your API key, required only if the key has not been declared ...
python
def train(self, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is the basic training endpoint. Given an existing dataset this endpoint will train a model. Inputs api_key (optional) - String: Your API key, required only if the key has not been declared ...
[ "def", "train", "(", "self", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "batch", ",", "\"api_key\"", ...
This is the basic training endpoint. Given an existing dataset this endpoint will train a model. Inputs api_key (optional) - String: Your API key, required only if the key has not been declared elsewhere. This allows the API to recognize a request as yours and automatically route it ...
[ "This", "is", "the", "basic", "training", "endpoint", ".", "Given", "an", "existing", "dataset", "this", "endpoint", "will", "train", "a", "model", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L179-L192
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.info
def info(self, cloud=None, api_key=None, version=None, **kwargs): """ Return the current state of the model associated with a given collection """ url_params = {"batch": False, "api_key": api_key, "version": version, "method": "info"} return self._api_handler(None, cloud=cloud, a...
python
def info(self, cloud=None, api_key=None, version=None, **kwargs): """ Return the current state of the model associated with a given collection """ url_params = {"batch": False, "api_key": api_key, "version": version, "method": "info"} return self._api_handler(None, cloud=cloud, a...
[ "def", "info", "(", "self", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "False", ",", "\"api_key\"", ":", "api_key", ",", "\"version...
Return the current state of the model associated with a given collection
[ "Return", "the", "current", "state", "of", "the", "model", "associated", "with", "a", "given", "collection" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L262-L267
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.remove_example
def remove_example(self, data, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is an API made to remove a single instance of training data. This is useful in cases where a single instance of content has been modified, but the remaining examples remain valid. For ...
python
def remove_example(self, data, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ This is an API made to remove a single instance of training data. This is useful in cases where a single instance of content has been modified, but the remaining examples remain valid. For ...
[ "def", "remove_example", "(", "self", ",", "data", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "batch", "=", "detect_batch", "(", "data", ")", "...
This is an API made to remove a single instance of training data. This is useful in cases where a single instance of content has been modified, but the remaining examples remain valid. For example, if a piece of content has been retagged. Inputs data - String: The exact text you wish to...
[ "This", "is", "an", "API", "made", "to", "remove", "a", "single", "instance", "of", "training", "data", ".", "This", "is", "useful", "in", "cases", "where", "a", "single", "instance", "of", "content", "has", "been", "modified", "but", "the", "remaining", ...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L269-L289
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.wait
def wait(self, interval=1, **kwargs): """ Block until the collection's model is completed training """ while True: status = self.info(**kwargs).get('status') if status == "ready": break if status != "training": raise Ind...
python
def wait(self, interval=1, **kwargs): """ Block until the collection's model is completed training """ while True: status = self.info(**kwargs).get('status') if status == "ready": break if status != "training": raise Ind...
[ "def", "wait", "(", "self", ",", "interval", "=", "1", ",", "*", "*", "kwargs", ")", ":", "while", "True", ":", "status", "=", "self", ".", "info", "(", "*", "*", "kwargs", ")", ".", "get", "(", "'status'", ")", "if", "status", "==", "\"ready\"",...
Block until the collection's model is completed training
[ "Block", "until", "the", "collection", "s", "model", "is", "completed", "training" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L291-L301
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.register
def register(self, make_public=False, cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to register you collection in order to share read or write access to the collection with another user. Inputs: api_key (optional) - String: Your API key, req...
python
def register(self, make_public=False, cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to register you collection in order to share read or write access to the collection with another user. Inputs: api_key (optional) - String: Your API key, req...
[ "def", "register", "(", "self", ",", "make_public", "=", "False", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'make_public'", "]", "=", "make_public", "url_para...
This API endpoint allows you to register you collection in order to share read or write access to the collection with another user. Inputs: api_key (optional) - String: Your API key, required only if the key has not been declared elsewhere. This allows the API to recognize a request a...
[ "This", "API", "endpoint", "allows", "you", "to", "register", "you", "collection", "in", "order", "to", "share", "read", "or", "write", "access", "to", "the", "collection", "with", "another", "user", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L303-L319
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.authorize
def authorize(self, email, permission_type='read', cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to authorize another user to access your model in a read or write capacity. Before calling authorize, you must first make sure your model has been registered. ...
python
def authorize(self, email, permission_type='read', cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to authorize another user to access your model in a read or write capacity. Before calling authorize, you must first make sure your model has been registered. ...
[ "def", "authorize", "(", "self", ",", "email", ",", "permission_type", "=", "'read'", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'permission_type'", "]", "=", ...
This API endpoint allows you to authorize another user to access your model in a read or write capacity. Before calling authorize, you must first make sure your model has been registered. Inputs: email - String: The email of the user you would like to share access with. permission_type ...
[ "This", "API", "endpoint", "allows", "you", "to", "authorize", "another", "user", "to", "access", "your", "model", "in", "a", "read", "or", "write", "capacity", ".", "Before", "calling", "authorize", "you", "must", "first", "make", "sure", "your", "model", ...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L337-L356
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.deauthorize
def deauthorize(self, email, cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to remove another user's access to your collection. Inputs: email - String: The email of the user you would like to share access with. api_key (optional) - String: Yo...
python
def deauthorize(self, email, cloud=None, api_key=None, version=None, **kwargs): """ This API endpoint allows you to remove another user's access to your collection. Inputs: email - String: The email of the user you would like to share access with. api_key (optional) - String: Yo...
[ "def", "deauthorize", "(", "self", ",", "email", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'email'", "]", "=", "email", "url_params", "=", "{", "\"batch\"",...
This API endpoint allows you to remove another user's access to your collection. Inputs: email - String: The email of the user you would like to share access with. api_key (optional) - String: Your API key, required only if the key has not been declared elsewhere. This allows the API ...
[ "This", "API", "endpoint", "allows", "you", "to", "remove", "another", "user", "s", "access", "to", "your", "collection", "." ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L358-L373
IndicoDataSolutions/IndicoIo-python
indicoio/custom/custom.py
Collection.rename
def rename(self, name, cloud=None, api_key=None, version=None, **kwargs): """ If you'd like to change the name you use to access a given collection, you can call the rename endpoint. This is especially useful if the name you use for your model is not available for registration. Inputs: ...
python
def rename(self, name, cloud=None, api_key=None, version=None, **kwargs): """ If you'd like to change the name you use to access a given collection, you can call the rename endpoint. This is especially useful if the name you use for your model is not available for registration. Inputs: ...
[ "def", "rename", "(", "self", ",", "name", ",", "cloud", "=", "None", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'name'", "]", "=", "name", "url_params", "=", "{", "\"batch\"", ":", ...
If you'd like to change the name you use to access a given collection, you can call the rename endpoint. This is especially useful if the name you use for your model is not available for registration. Inputs: name - String: The new name used to access your model. api_key (optional) - St...
[ "If", "you", "d", "like", "to", "change", "the", "name", "you", "use", "to", "access", "a", "given", "collection", "you", "can", "call", "the", "rename", "endpoint", ".", "This", "is", "especially", "useful", "if", "the", "name", "you", "use", "for", "...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/custom/custom.py#L375-L393
IndicoDataSolutions/IndicoIo-python
indicoio/utils/errors.py
convert_to_py_error
def convert_to_py_error(error_message): """ Raise specific exceptions for ease of error handling """ message = error_message.lower() for err_msg, err_type in ERR_MSGS: if err_msg in message: return err_type(error_message) else: return IndicoError(error_message)
python
def convert_to_py_error(error_message): """ Raise specific exceptions for ease of error handling """ message = error_message.lower() for err_msg, err_type in ERR_MSGS: if err_msg in message: return err_type(error_message) else: return IndicoError(error_message)
[ "def", "convert_to_py_error", "(", "error_message", ")", ":", "message", "=", "error_message", ".", "lower", "(", ")", "for", "err_msg", ",", "err_type", "in", "ERR_MSGS", ":", "if", "err_msg", "in", "message", ":", "return", "err_type", "(", "error_message", ...
Raise specific exceptions for ease of error handling
[ "Raise", "specific", "exceptions", "for", "ease", "of", "error", "handling" ]
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/utils/errors.py#L54-L63
IndicoDataSolutions/IndicoIo-python
indicoio/image/facial_localization.py
facial_localization
def facial_localization(image, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given an image, returns a list of faces found within the image. For each face, we return a dictionary containing the upper left corner and lower right corner. If crop is True, the cropped face is included ...
python
def facial_localization(image, cloud=None, batch=False, api_key=None, version=None, **kwargs): """ Given an image, returns a list of faces found within the image. For each face, we return a dictionary containing the upper left corner and lower right corner. If crop is True, the cropped face is included ...
[ "def", "facial_localization", "(", "image", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "None", ",", "*", "*", "kwargs", ")", ":", "image", "=", "data_preprocess", "(", "image", ",", "batch",...
Given an image, returns a list of faces found within the image. For each face, we return a dictionary containing the upper left corner and lower right corner. If crop is True, the cropped face is included in the dictionary. Input should be in a numpy ndarray or a filename. Example usage: .. code-b...
[ "Given", "an", "image", "returns", "a", "list", "of", "faces", "found", "within", "the", "image", ".", "For", "each", "face", "we", "return", "a", "dictionary", "containing", "the", "upper", "left", "corner", "and", "lower", "right", "corner", ".", "If", ...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/image/facial_localization.py#L7-L31
IndicoDataSolutions/IndicoIo-python
indicoio/text/summarization.py
summarization
def summarization(text, cloud=None, batch=False, api_key=None, version=1, **kwargs): """ Given input text, returns a `top_n` length sentence summary. Example usage: .. code-block:: python >>> from indicoio import summarization >>> summary = summarization("https://en.wikipedia.o...
python
def summarization(text, cloud=None, batch=False, api_key=None, version=1, **kwargs): """ Given input text, returns a `top_n` length sentence summary. Example usage: .. code-block:: python >>> from indicoio import summarization >>> summary = summarization("https://en.wikipedia.o...
[ "def", "summarization", "(", "text", ",", "cloud", "=", "None", ",", "batch", "=", "False", ",", "api_key", "=", "None", ",", "version", "=", "1", ",", "*", "*", "kwargs", ")", ":", "url_params", "=", "{", "\"batch\"", ":", "batch", ",", "\"api_key\"...
Given input text, returns a `top_n` length sentence summary. Example usage: .. code-block:: python >>> from indicoio import summarization >>> summary = summarization("https://en.wikipedia.org/wiki/Yahoo!_data_breach") >>> summary ["This information was disclosed two years...
[ "Given", "input", "text", "returns", "a", "top_n", "length", "sentence", "summary", ".", "Example", "usage", ":", "..", "code", "-", "block", "::", "python", ">>>", "from", "indicoio", "import", "summarization", ">>>", "summary", "=", "summarization", "(", "...
train
https://github.com/IndicoDataSolutions/IndicoIo-python/blob/6f262a23f09d76fede63d1ccb87f9f7cf2cfc8aa/indicoio/text/summarization.py#L6-L24
data61/clkhash
clkhash/key_derivation.py
hkdf
def hkdf(master_secret, # type: bytes num_keys, # type: int hash_algo='SHA256', # type: str salt=None, # type: Optional[bytes] info=None, # type: Optional[bytes] key_size=DEFAULT_KEY_SIZE # type: int ): # type: (...) -> Tuple[bytes, ...] """ Execut...
python
def hkdf(master_secret, # type: bytes num_keys, # type: int hash_algo='SHA256', # type: str salt=None, # type: Optional[bytes] info=None, # type: Optional[bytes] key_size=DEFAULT_KEY_SIZE # type: int ): # type: (...) -> Tuple[bytes, ...] """ Execut...
[ "def", "hkdf", "(", "master_secret", ",", "# type: bytes", "num_keys", ",", "# type: int", "hash_algo", "=", "'SHA256'", ",", "# type: str", "salt", "=", "None", ",", "# type: Optional[bytes]", "info", "=", "None", ",", "# type: Optional[bytes]", "key_size", "=", ...
Executes the HKDF key derivation function as described in rfc5869 to derive `num_keys` keys of size `key_size` from the master_secret. :param master_secret: input keying material :param num_keys: the number of keys the kdf should produce :param hash_algo: The hash function used by HKDF for the internal...
[ "Executes", "the", "HKDF", "key", "derivation", "function", "as", "described", "in", "rfc5869", "to", "derive", "num_keys", "keys", "of", "size", "key_size", "from", "the", "master_secret", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/key_derivation.py#L20-L83
data61/clkhash
clkhash/key_derivation.py
generate_key_lists
def generate_key_lists(master_secrets, # type: Sequence[Union[bytes, str]] num_identifier, # type: int key_size=DEFAULT_KEY_SIZE, # type: int salt=None, # type: Optional[bytes] info=None, # type: Optional[bytes] ...
python
def generate_key_lists(master_secrets, # type: Sequence[Union[bytes, str]] num_identifier, # type: int key_size=DEFAULT_KEY_SIZE, # type: int salt=None, # type: Optional[bytes] info=None, # type: Optional[bytes] ...
[ "def", "generate_key_lists", "(", "master_secrets", ",", "# type: Sequence[Union[bytes, str]]", "num_identifier", ",", "# type: int", "key_size", "=", "DEFAULT_KEY_SIZE", ",", "# type: int", "salt", "=", "None", ",", "# type: Optional[bytes]", "info", "=", "None", ",", ...
Generates a derived key for each identifier for each master secret using a key derivation function (KDF). The only supported key derivation function for now is 'HKDF'. The previous key usage can be reproduced by setting kdf to 'legacy'. This is highly discouraged, as this strategy will map the same n-gram...
[ "Generates", "a", "derived", "key", "for", "each", "identifier", "for", "each", "master", "secret", "using", "a", "key", "derivation", "function", "(", "KDF", ")", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/key_derivation.py#L86-L133
data61/clkhash
clkhash/validate_data.py
validate_row_lengths
def validate_row_lengths(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] ): # type: (...) -> None """ Validate the `data` row lengths according to the specification in `fields`. :param fields: The `FieldSpec` objects f...
python
def validate_row_lengths(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] ): # type: (...) -> None """ Validate the `data` row lengths according to the specification in `fields`. :param fields: The `FieldSpec` objects f...
[ "def", "validate_row_lengths", "(", "fields", ",", "# type: Sequence[FieldSpec]", "data", "# type: Sequence[Sequence[str]]", ")", ":", "# type: (...) -> None", "for", "i", ",", "row", "in", "enumerate", "(", "data", ")", ":", "if", "len", "(", "fields", ")", "!=",...
Validate the `data` row lengths according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the specification. :param data: The rows to check. :raises FormatError: When the number of entries in a row does not match expectation.
[ "Validate", "the", "data", "row", "lengths", "according", "to", "the", "specification", "in", "fields", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/validate_data.py#L30-L47
data61/clkhash
clkhash/validate_data.py
validate_entries
def validate_entries(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] ): # type: (...) -> None """ Validate the `data` entries according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the ...
python
def validate_entries(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] ): # type: (...) -> None """ Validate the `data` entries according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the ...
[ "def", "validate_entries", "(", "fields", ",", "# type: Sequence[FieldSpec]", "data", "# type: Sequence[Sequence[str]]", ")", ":", "# type: (...) -> None", "validators", "=", "[", "f", ".", "validate", "for", "f", "in", "fields", "]", "for", "i", ",", "row", "in",...
Validate the `data` entries according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the specification. :param data: The data to validate. :raises EntryError: When an entry is not valid according to its :class:`FieldSpec`.
[ "Validate", "the", "data", "entries", "according", "to", "the", "specification", "in", "fields", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/validate_data.py#L50-L80
data61/clkhash
clkhash/validate_data.py
validate_header
def validate_header(fields, # type: Sequence[FieldSpec] column_names # type: Sequence[str] ): # type: (...) -> None """ Validate the `column_names` according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the ...
python
def validate_header(fields, # type: Sequence[FieldSpec] column_names # type: Sequence[str] ): # type: (...) -> None """ Validate the `column_names` according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the ...
[ "def", "validate_header", "(", "fields", ",", "# type: Sequence[FieldSpec]", "column_names", "# type: Sequence[str]", ")", ":", "# type: (...) -> None", "if", "len", "(", "fields", ")", "!=", "len", "(", "column_names", ")", ":", "msg", "=", "'Header has {} columns wh...
Validate the `column_names` according to the specification in `fields`. :param fields: The `FieldSpec` objects forming the specification. :param column_names: A sequence of column identifier. :raises FormatError: When the number of columns or the column identifie...
[ "Validate", "the", "column_names", "according", "to", "the", "specification", "in", "fields", "." ]
train
https://github.com/data61/clkhash/blob/ec6398d6708a063de83f7c3d6286587bff8e7121/clkhash/validate_data.py#L83-L105
migonzalvar/dj-email-url
dj_email_url.py
config
def config(env=DEFAULT_ENV, default=None): """Returns a dictionary with EMAIL_* settings from EMAIL_URL.""" conf = {} s = os.environ.get(env, default) if s: conf = parse(s) return conf
python
def config(env=DEFAULT_ENV, default=None): """Returns a dictionary with EMAIL_* settings from EMAIL_URL.""" conf = {} s = os.environ.get(env, default) if s: conf = parse(s) return conf
[ "def", "config", "(", "env", "=", "DEFAULT_ENV", ",", "default", "=", "None", ")", ":", "conf", "=", "{", "}", "s", "=", "os", ".", "environ", ".", "get", "(", "env", ",", "default", ")", "if", "s", ":", "conf", "=", "parse", "(", "s", ")", "...
Returns a dictionary with EMAIL_* settings from EMAIL_URL.
[ "Returns", "a", "dictionary", "with", "EMAIL_", "*", "settings", "from", "EMAIL_URL", "." ]
train
https://github.com/migonzalvar/dj-email-url/blob/5727ca02f4f1ad8d3158ca702e084ba639c86fbe/dj_email_url.py#L47-L57
migonzalvar/dj-email-url
dj_email_url.py
parse
def parse(url): """Parses an email URL.""" conf = {} url = urlparse.urlparse(url) qs = urlparse.parse_qs(url.query) # Remove query strings path = url.path[1:] path = path.split('?', 2)[0] # Update with environment configuration conf.update({ 'EMAIL_FILE_PATH': path, ...
python
def parse(url): """Parses an email URL.""" conf = {} url = urlparse.urlparse(url) qs = urlparse.parse_qs(url.query) # Remove query strings path = url.path[1:] path = path.split('?', 2)[0] # Update with environment configuration conf.update({ 'EMAIL_FILE_PATH': path, ...
[ "def", "parse", "(", "url", ")", ":", "conf", "=", "{", "}", "url", "=", "urlparse", ".", "urlparse", "(", "url", ")", "qs", "=", "urlparse", ".", "parse_qs", "(", "url", ".", "query", ")", "# Remove query strings", "path", "=", "url", ".", "path", ...
Parses an email URL.
[ "Parses", "an", "email", "URL", "." ]
train
https://github.com/migonzalvar/dj-email-url/blob/5727ca02f4f1ad8d3158ca702e084ba639c86fbe/dj_email_url.py#L60-L124
tmoerman/arboreto
arboreto/core.py
to_tf_matrix
def to_tf_matrix(expression_matrix, gene_names, tf_names): """ :param expression_matrix: numpy matrix. Rows are observations and columns are genes. :param gene_names: a list of gene names. Each entry corresponds to the expression_matrix column with same index. :param tf...
python
def to_tf_matrix(expression_matrix, gene_names, tf_names): """ :param expression_matrix: numpy matrix. Rows are observations and columns are genes. :param gene_names: a list of gene names. Each entry corresponds to the expression_matrix column with same index. :param tf...
[ "def", "to_tf_matrix", "(", "expression_matrix", ",", "gene_names", ",", "tf_names", ")", ":", "tuples", "=", "[", "(", "index", ",", "gene", ")", "for", "index", ",", "gene", "in", "enumerate", "(", "gene_names", ")", "if", "gene", "in", "tf_names", "]"...
:param expression_matrix: numpy matrix. Rows are observations and columns are genes. :param gene_names: a list of gene names. Each entry corresponds to the expression_matrix column with same index. :param tf_names: a list of transcription factor names. Should be a subset of gene_names. :return: tuple of: ...
[ ":", "param", "expression_matrix", ":", "numpy", "matrix", ".", "Rows", "are", "observations", "and", "columns", "are", "genes", ".", ":", "param", "gene_names", ":", "a", "list", "of", "gene", "names", ".", "Each", "entry", "corresponds", "to", "the", "ex...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L85-L102
tmoerman/arboreto
arboreto/core.py
fit_model
def fit_model(regressor_type, regressor_kwargs, tf_matrix, target_gene_expression, early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, seed=DEMON_SEED): """ :param regressor_type: string. Case insensitive. :param regressor_kwargs: a dictio...
python
def fit_model(regressor_type, regressor_kwargs, tf_matrix, target_gene_expression, early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, seed=DEMON_SEED): """ :param regressor_type: string. Case insensitive. :param regressor_kwargs: a dictio...
[ "def", "fit_model", "(", "regressor_type", ",", "regressor_kwargs", ",", "tf_matrix", ",", "target_gene_expression", ",", "early_stop_window_length", "=", "EARLY_STOP_WINDOW_LENGTH", ",", "seed", "=", "DEMON_SEED", ")", ":", "regressor_type", "=", "regressor_type", ".",...
:param regressor_type: string. Case insensitive. :param regressor_kwargs: a dictionary of key-value pairs that configures the regressor. :param tf_matrix: the predictor matrix (transcription factor matrix) as a numpy array. :param target_gene_expression: the target (y) gene expression to predict in function...
[ ":", "param", "regressor_type", ":", "string", ".", "Case", "insensitive", ".", ":", "param", "regressor_kwargs", ":", "a", "dictionary", "of", "key", "-", "value", "pairs", "that", "configures", "the", "regressor", ".", ":", "param", "tf_matrix", ":", "the"...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L105-L141
tmoerman/arboreto
arboreto/core.py
to_feature_importances
def to_feature_importances(regressor_type, regressor_kwargs, trained_regressor): """ Motivation: when the out-of-bag improvement heuristic is used, we cancel the effect of normalization by dividing by the number of trees in the regression ensemble by mul...
python
def to_feature_importances(regressor_type, regressor_kwargs, trained_regressor): """ Motivation: when the out-of-bag improvement heuristic is used, we cancel the effect of normalization by dividing by the number of trees in the regression ensemble by mul...
[ "def", "to_feature_importances", "(", "regressor_type", ",", "regressor_kwargs", ",", "trained_regressor", ")", ":", "if", "is_oob_heuristic_supported", "(", "regressor_type", ",", "regressor_kwargs", ")", ":", "n_estimators", "=", "len", "(", "trained_regressor", ".", ...
Motivation: when the out-of-bag improvement heuristic is used, we cancel the effect of normalization by dividing by the number of trees in the regression ensemble by multiplying again by the number of trees used. This enables prioritizing links that were inferred in a regression where lots of :param regre...
[ "Motivation", ":", "when", "the", "out", "-", "of", "-", "bag", "improvement", "heuristic", "is", "used", "we", "cancel", "the", "effect", "of", "normalization", "by", "dividing", "by", "the", "number", "of", "trees", "in", "the", "regression", "ensemble", ...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L144-L166
tmoerman/arboreto
arboreto/core.py
to_meta_df
def to_meta_df(trained_regressor, target_gene_name): """ :param trained_regressor: the trained model from which to extract the meta information. :param target_gene_name: the name of the target gene. :return: a Pandas DataFrame containing side information about the regression. """ ...
python
def to_meta_df(trained_regressor, target_gene_name): """ :param trained_regressor: the trained model from which to extract the meta information. :param target_gene_name: the name of the target gene. :return: a Pandas DataFrame containing side information about the regression. """ ...
[ "def", "to_meta_df", "(", "trained_regressor", ",", "target_gene_name", ")", ":", "n_estimators", "=", "len", "(", "trained_regressor", ".", "estimators_", ")", "return", "pd", ".", "DataFrame", "(", "{", "'target'", ":", "[", "target_gene_name", "]", ",", "'n...
:param trained_regressor: the trained model from which to extract the meta information. :param target_gene_name: the name of the target gene. :return: a Pandas DataFrame containing side information about the regression.
[ ":", "param", "trained_regressor", ":", "the", "trained", "model", "from", "which", "to", "extract", "the", "meta", "information", ".", ":", "param", "target_gene_name", ":", "the", "name", "of", "the", "target", "gene", ".", ":", "return", ":", "a", "Pand...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L169-L178
tmoerman/arboreto
arboreto/core.py
to_links_df
def to_links_df(regressor_type, regressor_kwargs, trained_regressor, tf_matrix_gene_names, target_gene_name): """ :param regressor_type: string. Case insensitive. :param regressor_kwargs: dict of key-value pairs that configures the regressor. ...
python
def to_links_df(regressor_type, regressor_kwargs, trained_regressor, tf_matrix_gene_names, target_gene_name): """ :param regressor_type: string. Case insensitive. :param regressor_kwargs: dict of key-value pairs that configures the regressor. ...
[ "def", "to_links_df", "(", "regressor_type", ",", "regressor_kwargs", ",", "trained_regressor", ",", "tf_matrix_gene_names", ",", "target_gene_name", ")", ":", "def", "pythonic", "(", ")", ":", "# feature_importances = trained_regressor.feature_importances_", "feature_importa...
:param regressor_type: string. Case insensitive. :param regressor_kwargs: dict of key-value pairs that configures the regressor. :param trained_regressor: the trained model from which to extract the feature importances. :param tf_matrix_gene_names: the list of names corresponding to the columns of the tf_ma...
[ ":", "param", "regressor_type", ":", "string", ".", "Case", "insensitive", ".", ":", "param", "regressor_kwargs", ":", "dict", "of", "key", "-", "value", "pairs", "that", "configures", "the", "regressor", ".", ":", "param", "trained_regressor", ":", "the", "...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L181-L212
tmoerman/arboreto
arboreto/core.py
clean
def clean(tf_matrix, tf_matrix_gene_names, target_gene_name): """ :param tf_matrix: numpy array. The full transcription factor matrix. :param tf_matrix_gene_names: the full list of transcription factor names, corresponding to the tf_matrix columns. :param target_gene_name: the target...
python
def clean(tf_matrix, tf_matrix_gene_names, target_gene_name): """ :param tf_matrix: numpy array. The full transcription factor matrix. :param tf_matrix_gene_names: the full list of transcription factor names, corresponding to the tf_matrix columns. :param target_gene_name: the target...
[ "def", "clean", "(", "tf_matrix", ",", "tf_matrix_gene_names", ",", "target_gene_name", ")", ":", "if", "target_gene_name", "not", "in", "tf_matrix_gene_names", ":", "clean_tf_matrix", "=", "tf_matrix", "else", ":", "clean_tf_matrix", "=", "np", ".", "delete", "("...
:param tf_matrix: numpy array. The full transcription factor matrix. :param tf_matrix_gene_names: the full list of transcription factor names, corresponding to the tf_matrix columns. :param target_gene_name: the target gene to remove from the tf_matrix and tf_names. :return: a tuple of (matrix, names) equal...
[ ":", "param", "tf_matrix", ":", "numpy", "array", ".", "The", "full", "transcription", "factor", "matrix", ".", ":", "param", "tf_matrix_gene_names", ":", "the", "full", "list", "of", "transcription", "factor", "names", "corresponding", "to", "the", "tf_matrix",...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L215-L235
tmoerman/arboreto
arboreto/core.py
retry
def retry(fn, max_retries=10, warning_msg=None, fallback_result=None): """ Minimalistic retry strategy to compensate for failures probably caused by a thread-safety bug in scikit-learn: * https://github.com/scikit-learn/scikit-learn/issues/2755 * https://github.com/scikit-learn/scikit-learn/issues/7346 ...
python
def retry(fn, max_retries=10, warning_msg=None, fallback_result=None): """ Minimalistic retry strategy to compensate for failures probably caused by a thread-safety bug in scikit-learn: * https://github.com/scikit-learn/scikit-learn/issues/2755 * https://github.com/scikit-learn/scikit-learn/issues/7346 ...
[ "def", "retry", "(", "fn", ",", "max_retries", "=", "10", ",", "warning_msg", "=", "None", ",", "fallback_result", "=", "None", ")", ":", "nr_retries", "=", "0", "result", "=", "fallback_result", "for", "attempt", "in", "range", "(", "max_retries", ")", ...
Minimalistic retry strategy to compensate for failures probably caused by a thread-safety bug in scikit-learn: * https://github.com/scikit-learn/scikit-learn/issues/2755 * https://github.com/scikit-learn/scikit-learn/issues/7346 :param fn: the function to retry. :param max_retries: the maximum number o...
[ "Minimalistic", "retry", "strategy", "to", "compensate", "for", "failures", "probably", "caused", "by", "a", "thread", "-", "safety", "bug", "in", "scikit", "-", "learn", ":", "*", "https", ":", "//", "github", ".", "com", "/", "scikit", "-", "learn", "/...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L238-L267
tmoerman/arboreto
arboreto/core.py
infer_partial_network
def infer_partial_network(regressor_type, regressor_kwargs, tf_matrix, tf_matrix_gene_names, target_gene_name, target_gene_expression, include_meta=False, ...
python
def infer_partial_network(regressor_type, regressor_kwargs, tf_matrix, tf_matrix_gene_names, target_gene_name, target_gene_expression, include_meta=False, ...
[ "def", "infer_partial_network", "(", "regressor_type", ",", "regressor_kwargs", ",", "tf_matrix", ",", "tf_matrix_gene_names", ",", "target_gene_name", ",", "target_gene_expression", ",", "include_meta", "=", "False", ",", "early_stop_window_length", "=", "EARLY_STOP_WINDOW...
Ties together regressor model training with regulatory links and meta data extraction. :param regressor_type: string. Case insensitive. :param regressor_kwargs: dict of key-value pairs that configures the regressor. :param tf_matrix: numpy matrix. The feature matrix X to use for the regression. :param ...
[ "Ties", "together", "regressor", "model", "training", "with", "regulatory", "links", "and", "meta", "data", "extraction", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L270-L323
tmoerman/arboreto
arboreto/core.py
target_gene_indices
def target_gene_indices(gene_names, target_genes): """ :param gene_names: list of gene names. :param target_genes: either int (the top n), 'all', or a collection (subset of gene_names). :return: the (column) indices of the target genes in the expression_matrix. """ if is...
python
def target_gene_indices(gene_names, target_genes): """ :param gene_names: list of gene names. :param target_genes: either int (the top n), 'all', or a collection (subset of gene_names). :return: the (column) indices of the target genes in the expression_matrix. """ if is...
[ "def", "target_gene_indices", "(", "gene_names", ",", "target_genes", ")", ":", "if", "isinstance", "(", "target_genes", ",", "list", ")", "and", "len", "(", "target_genes", ")", "==", "0", ":", "return", "[", "]", "if", "isinstance", "(", "target_genes", ...
:param gene_names: list of gene names. :param target_genes: either int (the top n), 'all', or a collection (subset of gene_names). :return: the (column) indices of the target genes in the expression_matrix.
[ ":", "param", "gene_names", ":", "list", "of", "gene", "names", ".", ":", "param", "target_genes", ":", "either", "int", "(", "the", "top", "n", ")", "all", "or", "a", "collection", "(", "subset", "of", "gene_names", ")", ".", ":", "return", ":", "th...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L326-L357
tmoerman/arboreto
arboreto/core.py
create_graph
def create_graph(expression_matrix, gene_names, tf_names, regressor_type, regressor_kwargs, client, target_genes='all', limit=None, include_meta=False, early_stop_wind...
python
def create_graph(expression_matrix, gene_names, tf_names, regressor_type, regressor_kwargs, client, target_genes='all', limit=None, include_meta=False, early_stop_wind...
[ "def", "create_graph", "(", "expression_matrix", ",", "gene_names", ",", "tf_names", ",", "regressor_type", ",", "regressor_kwargs", ",", "client", ",", "target_genes", "=", "'all'", ",", "limit", "=", "None", ",", "include_meta", "=", "False", ",", "early_stop_...
Main API function. Create a Dask computation graph. Note: fixing the GC problems was fixed by 2 changes: [1] and [2] !!! :param expression_matrix: numpy matrix. Rows are observations and columns are genes. :param gene_names: list of gene names. Each entry corresponds to the expression_matrix column with s...
[ "Main", "API", "function", ".", "Create", "a", "Dask", "computation", "graph", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L364-L450
tmoerman/arboreto
arboreto/core.py
EarlyStopMonitor.window_boundaries
def window_boundaries(self, current_round): """ :param current_round: :return: the low and high boundaries of the estimators window to consider. """ lo = max(0, current_round - self.window_length + 1) hi = current_round + 1 return lo, hi
python
def window_boundaries(self, current_round): """ :param current_round: :return: the low and high boundaries of the estimators window to consider. """ lo = max(0, current_round - self.window_length + 1) hi = current_round + 1 return lo, hi
[ "def", "window_boundaries", "(", "self", ",", "current_round", ")", ":", "lo", "=", "max", "(", "0", ",", "current_round", "-", "self", ".", "window_length", "+", "1", ")", "hi", "=", "current_round", "+", "1", "return", "lo", ",", "hi" ]
:param current_round: :return: the low and high boundaries of the estimators window to consider.
[ ":", "param", "current_round", ":", ":", "return", ":", "the", "low", "and", "high", "boundaries", "of", "the", "estimators", "window", "to", "consider", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/core.py#L462-L471
thumbor/libthumbor
libthumbor/crypto.py
CryptoURL.generate
def generate(self, **options): '''Generates an encrypted URL with the specified options''' if options.get('unsafe', False): return unsafe_url(**options) else: return self.generate_new(options)
python
def generate(self, **options): '''Generates an encrypted URL with the specified options''' if options.get('unsafe', False): return unsafe_url(**options) else: return self.generate_new(options)
[ "def", "generate", "(", "self", ",", "*", "*", "options", ")", ":", "if", "options", ".", "get", "(", "'unsafe'", ",", "False", ")", ":", "return", "unsafe_url", "(", "*", "*", "options", ")", "else", ":", "return", "self", ".", "generate_new", "(", ...
Generates an encrypted URL with the specified options
[ "Generates", "an", "encrypted", "URL", "with", "the", "specified", "options" ]
train
https://github.com/thumbor/libthumbor/blob/8114928102ff07166ce32e6d894f30124b5e169a/libthumbor/crypto.py#L52-L58
rongcloud/server-sdk-python
rongcloud/user.py
User.getToken
def getToken(self, userId, name, portraitUri): """ 获取 Token 方法 方法 @param userId:用户 Id,最大长度 64 字节.是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @param name:用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称.用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称。(必传) @param portraitUri:用户头像 URI,最大...
python
def getToken(self, userId, name, portraitUri): """ 获取 Token 方法 方法 @param userId:用户 Id,最大长度 64 字节.是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @param name:用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称.用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称。(必传) @param portraitUri:用户头像 URI,最大...
[ "def", "getToken", "(", "self", ",", "userId", ",", "name", ",", "portraitUri", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"TokenReslut\"", ",", "\"desc\"", ":", "\"getToken 返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", ...
获取 Token 方法 方法 @param userId:用户 Id,最大长度 64 字节.是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @param name:用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称.用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称。(必传) @param portraitUri:用户头像 URI,最大长度 1024 字节.用来在 Push 推送时显示用户的头像。(必传) @return code:返回码,200...
[ "获取", "Token", "方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/user.py#L9-L53
rongcloud/server-sdk-python
rongcloud/user.py
User.checkOnline
def checkOnline(self, userId): """ 检查用户在线状态 方法 方法 @param userId:用户 Id,最大长度 64 字节。是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @return code:返回码,200 为正常。 @return status:在线状态,1为在线,0为不在线。 @return errorMessage:错误信息。 """ desc = { "nam...
python
def checkOnline(self, userId): """ 检查用户在线状态 方法 方法 @param userId:用户 Id,最大长度 64 字节。是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @return code:返回码,200 为正常。 @return status:在线状态,1为在线,0为不在线。 @return errorMessage:错误信息。 """ desc = { "nam...
[ "def", "checkOnline", "(", "self", ",", "userId", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CheckOnlineReslut\"", ",", "\"desc\"", ":", "\"checkOnlineUser返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"I...
检查用户在线状态 方法 方法 @param userId:用户 Id,最大长度 64 字节。是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @return code:返回码,200 为正常。 @return status:在线状态,1为在线,0为不在线。 @return errorMessage:错误信息。
[ "检查用户在线状态", "方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/user.py#L89-L120
rongcloud/server-sdk-python
rongcloud/user.py
User.block
def block(self, userId, minute): """ 封禁用户方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param minute:封禁时长,单位为分钟,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": ...
python
def block(self, userId, minute): """ 封禁用户方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param minute:封禁时长,单位为分钟,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": ...
[ "def", "block", "(", "self", ",", "userId", ",", "minute", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", ...
封禁用户方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param minute:封禁时长,单位为分钟,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "封禁用户方法(每秒钟限", "100", "次)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/user.py#L122-L150
rongcloud/server-sdk-python
rongcloud/user.py
User.addBlacklist
def addBlacklist(self, userId, blackUserId): """ 添加用户到黑名单方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param blackUserId:被加到黑名单的用户Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", ...
python
def addBlacklist(self, userId, blackUserId): """ 添加用户到黑名单方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param blackUserId:被加到黑名单的用户Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", ...
[ "def", "addBlacklist", "(", "self", ",", "userId", ",", "blackUserId", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type...
添加用户到黑名单方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param blackUserId:被加到黑名单的用户Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "添加用户到黑名单方法(每秒钟限", "100", "次)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/user.py#L212-L240
rongcloud/server-sdk-python
rongcloud/message.py
Message.publishPrivate
def publishPrivate(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, count=None, verifyBlacklist=None, ...
python
def publishPrivate(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, count=None, verifyBlacklist=None, ...
[ "def", "publishPrivate", "(", "self", ",", "fromUserId", ",", "toUserId", ",", "objectName", ",", "content", ",", "pushContent", "=", "None", ",", "pushData", "=", "None", ",", "count", "=", "None", ",", "verifyBlacklist", "=", "None", ",", "isPersisted", ...
发送单聊消息方法(一个用户向另外一个用户发送消息,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人,如:一次发送 1000 人时,示为 1000 条消息。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toUserId:接收用户 Id,可以实现向多人发送消息,每次上限为 1000 人。(必传) @param voiceMessage:消息。 @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收到 P...
[ "发送单聊消息方法(一个用户向另外一个用户发送消息,单条消息最大", "128k。每分钟最多发送", "6000", "条信息,每次发送用户上限为", "1000", "人,如:一次发送", "1000", "人时,示为", "1000", "条消息。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L9-L67
rongcloud/server-sdk-python
rongcloud/message.py
Message.publishTemplate
def publishTemplate(self, templateMessage): """ 发送单聊模板消息方法(一个用户向多个用户发送不同消息内容,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人。) 方法 @param templateMessage:单聊模版消息。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslu...
python
def publishTemplate(self, templateMessage): """ 发送单聊模板消息方法(一个用户向多个用户发送不同消息内容,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人。) 方法 @param templateMessage:单聊模版消息。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslu...
[ "def", "publishTemplate", "(", "self", ",", "templateMessage", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", ...
发送单聊模板消息方法(一个用户向多个用户发送不同消息内容,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人。) 方法 @param templateMessage:单聊模版消息。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "发送单聊模板消息方法(一个用户向多个用户发送不同消息内容,单条消息最大", "128k。每分钟最多发送", "6000", "条信息,每次发送用户上限为", "1000", "人。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L69-L95
rongcloud/server-sdk-python
rongcloud/message.py
Message.PublishSystem
def PublishSystem(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None): "...
python
def PublishSystem(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None): "...
[ "def", "PublishSystem", "(", "self", ",", "fromUserId", ",", "toUserId", ",", "objectName", ",", "content", ",", "pushContent", "=", "None", ",", "pushData", "=", "None", ",", "isPersisted", "=", "None", ",", "isCounted", "=", "None", ")", ":", "desc", "...
发送系统消息方法(一个用户向一个或多个用户发送系统消息,单条消息最大 128k,会话类型为 SYSTEM。每秒钟最多发送 100 条消息,每次最多同时向 100 人发送,如:一次发送 100 人时,示为 100 条消息。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toUserId:接收用户 Id,提供多个本参数可以实现向多人发送消息,上限为 1000 人。(必传) @param txtMessage:发送消息内容(必传) @param pushContent:如果为自定义消息,定义显示的 Push 内容,内容中定义标识...
[ "发送系统消息方法(一个用户向一个或多个用户发送系统消息,单条消息最大", "128k,会话类型为", "SYSTEM。每秒钟最多发送", "100", "条消息,每次最多同时向", "100", "人发送,如:一次发送", "100", "人时,示为", "100", "条消息。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L97-L146
rongcloud/server-sdk-python
rongcloud/message.py
Message.publishGroup
def publishGroup(self, fromUserId, toGroupId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None, ...
python
def publishGroup(self, fromUserId, toGroupId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None, ...
[ "def", "publishGroup", "(", "self", ",", "fromUserId", ",", "toGroupId", ",", "objectName", ",", "content", ",", "pushContent", "=", "None", ",", "pushData", "=", "None", ",", "isPersisted", "=", "None", ",", "isCounted", "=", "None", ",", "isIncludeSender",...
发送群组消息方法(以一个用户身份向群组发送消息,单条消息最大 128k.每秒钟最多发送 20 条消息,每次最多向 3 个群组发送,如:一次向 3 个群组发送消息,示为 3 条消息。) 方法 @param fromUserId:发送人用户 Id 。(必传) @param toGroupId:接收群Id,提供多个本参数可以实现向多群发送消息,最多不超过 3 个群组。(必传) @param txtMessage:发送消息内容(必传) @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收...
[ "发送群组消息方法(以一个用户身份向群组发送消息,单条消息最大", "128k", ".", "每秒钟最多发送", "20", "条消息,每次最多向", "3", "个群组发送,如:一次向", "3", "个群组发送消息,示为", "3", "条消息。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L176-L228
rongcloud/server-sdk-python
rongcloud/message.py
Message.publishChatroom
def publishChatroom(self, fromUserId, toChatroomId, objectName, content): """ 发送聊天室消息方法(一个用户向聊天室发送消息,单条消息最大 128k。每秒钟限 100 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toChatroomId:接收聊天室Id,提供多个本参数可以实现向多个聊天室发送消息。(必传) @param txtMessage:发送消息内容(必传) @return code:返回码,200 ...
python
def publishChatroom(self, fromUserId, toChatroomId, objectName, content): """ 发送聊天室消息方法(一个用户向聊天室发送消息,单条消息最大 128k。每秒钟限 100 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toChatroomId:接收聊天室Id,提供多个本参数可以实现向多个聊天室发送消息。(必传) @param txtMessage:发送消息内容(必传) @return code:返回码,200 ...
[ "def", "publishChatroom", "(", "self", ",", "fromUserId", ",", "toChatroomId", ",", "objectName", ",", "content", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", ...
发送聊天室消息方法(一个用户向聊天室发送消息,单条消息最大 128k。每秒钟限 100 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toChatroomId:接收聊天室Id,提供多个本参数可以实现向多个聊天室发送消息。(必传) @param txtMessage:发送消息内容(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "发送聊天室消息方法(一个用户向聊天室发送消息,单条消息最大", "128k。每秒钟限", "100", "次。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L284-L317
rongcloud/server-sdk-python
rongcloud/message.py
Message.broadcast
def broadcast(self, fromUserId, objectName, content, pushContent=None, pushData=None, os=None): """ 发送广播消息方法(发送消息给一个应用下的所有注册用户,如用户未在线会对满足条件(绑定手机终端)的用户发送 Push 信息,单条消息最大 128k,会话类型为 SYSTEM。每小时只能发送 1 ...
python
def broadcast(self, fromUserId, objectName, content, pushContent=None, pushData=None, os=None): """ 发送广播消息方法(发送消息给一个应用下的所有注册用户,如用户未在线会对满足条件(绑定手机终端)的用户发送 Push 信息,单条消息最大 128k,会话类型为 SYSTEM。每小时只能发送 1 ...
[ "def", "broadcast", "(", "self", ",", "fromUserId", ",", "objectName", ",", "content", ",", "pushContent", "=", "None", ",", "pushData", "=", "None", ",", "os", "=", "None", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"de...
发送广播消息方法(发送消息给一个应用下的所有注册用户,如用户未在线会对满足条件(绑定手机终端)的用户发送 Push 信息,单条消息最大 128k,会话类型为 SYSTEM。每小时只能发送 1 次,每天最多发送 3 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param txtMessage:文本消息。 @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收到 Push 信息. 如果为自定义消息,则 pushContent 为自定义消息显示的 Push 内容,如果不...
[ "发送广播消息方法(发送消息给一个应用下的所有注册用户,如用户未在线会对满足条件(绑定手机终端)的用户发送", "Push", "信息,单条消息最大", "128k,会话类型为", "SYSTEM。每小时只能发送", "1", "次,每天最多发送", "3", "次。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L319-L362
rongcloud/server-sdk-python
rongcloud/message.py
Message.deleteMessage
def deleteMessage(self, date): """ 消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { ...
python
def deleteMessage(self, date): """ 消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { ...
[ "def", "deleteMessage", "(", "self", ",", "date", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"Integer\...
消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "消息历史记录删除方法(删除", "APP", "内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5", "-", "10分钟内被永久删除。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/message.py#L402-L428
maraujop/requests-oauth
oauth_hook/auth.py
to_utf8
def to_utf8(x): """ Tries to utf-8 encode x when possible If x is a string returns it encoded, otherwise tries to iter x and encode utf-8 all strings it contains, returning a list. """ if isinstance(x, basestring): return x.encode('utf-8') if isinstance(x, unicode) else x try: ...
python
def to_utf8(x): """ Tries to utf-8 encode x when possible If x is a string returns it encoded, otherwise tries to iter x and encode utf-8 all strings it contains, returning a list. """ if isinstance(x, basestring): return x.encode('utf-8') if isinstance(x, unicode) else x try: ...
[ "def", "to_utf8", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "basestring", ")", ":", "return", "x", ".", "encode", "(", "'utf-8'", ")", "if", "isinstance", "(", "x", ",", "unicode", ")", "else", "x", "try", ":", "l", "=", "iter", "(",...
Tries to utf-8 encode x when possible If x is a string returns it encoded, otherwise tries to iter x and encode utf-8 all strings it contains, returning a list.
[ "Tries", "to", "utf", "-", "8", "encode", "x", "when", "possible" ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/auth.py#L16-L29
maraujop/requests-oauth
oauth_hook/hook.py
CustomSignatureMethod_HMAC_SHA1.signing_base
def signing_base(self, request, consumer, token): """ This method generates the OAuth signature. It's defined here to avoid circular imports. """ sig = ( escape(request.method), escape(OAuthHook.get_normalized_url(request.url)), escape(OAuthHook.get_no...
python
def signing_base(self, request, consumer, token): """ This method generates the OAuth signature. It's defined here to avoid circular imports. """ sig = ( escape(request.method), escape(OAuthHook.get_normalized_url(request.url)), escape(OAuthHook.get_no...
[ "def", "signing_base", "(", "self", ",", "request", ",", "consumer", ",", "token", ")", ":", "sig", "=", "(", "escape", "(", "request", ".", "method", ")", ",", "escape", "(", "OAuthHook", ".", "get_normalized_url", "(", "request", ".", "url", ")", ")"...
This method generates the OAuth signature. It's defined here to avoid circular imports.
[ "This", "method", "generates", "the", "OAuth", "signature", ".", "It", "s", "defined", "here", "to", "avoid", "circular", "imports", "." ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L14-L28
maraujop/requests-oauth
oauth_hook/hook.py
OAuthHook._split_url_string
def _split_url_string(query_string): """ Turns a `query_string` into a Python dictionary with unquoted values """ parameters = parse_qs(to_utf8(query_string), keep_blank_values=True) for k, v in parameters.iteritems(): parameters[k] = urllib.unquote(v[0]) retu...
python
def _split_url_string(query_string): """ Turns a `query_string` into a Python dictionary with unquoted values """ parameters = parse_qs(to_utf8(query_string), keep_blank_values=True) for k, v in parameters.iteritems(): parameters[k] = urllib.unquote(v[0]) retu...
[ "def", "_split_url_string", "(", "query_string", ")", ":", "parameters", "=", "parse_qs", "(", "to_utf8", "(", "query_string", ")", ",", "keep_blank_values", "=", "True", ")", "for", "k", ",", "v", "in", "parameters", ".", "iteritems", "(", ")", ":", "para...
Turns a `query_string` into a Python dictionary with unquoted values
[ "Turns", "a", "query_string", "into", "a", "Python", "dictionary", "with", "unquoted", "values" ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L57-L64
maraujop/requests-oauth
oauth_hook/hook.py
OAuthHook.get_normalized_parameters
def get_normalized_parameters(request): """ Returns a string that contains the parameters that must be signed. This function is called by SignatureMethod subclass CustomSignatureMethod_HMAC_SHA1 """ # See issues #10 and #12 if ('Content-Type' not in request.headers or \ ...
python
def get_normalized_parameters(request): """ Returns a string that contains the parameters that must be signed. This function is called by SignatureMethod subclass CustomSignatureMethod_HMAC_SHA1 """ # See issues #10 and #12 if ('Content-Type' not in request.headers or \ ...
[ "def", "get_normalized_parameters", "(", "request", ")", ":", "# See issues #10 and #12", "if", "(", "'Content-Type'", "not", "in", "request", ".", "headers", "or", "request", ".", "headers", ".", "get", "(", "'Content-Type'", ")", ".", "startswith", "(", "'appl...
Returns a string that contains the parameters that must be signed. This function is called by SignatureMethod subclass CustomSignatureMethod_HMAC_SHA1
[ "Returns", "a", "string", "that", "contains", "the", "parameters", "that", "must", "be", "signed", ".", "This", "function", "is", "called", "by", "SignatureMethod", "subclass", "CustomSignatureMethod_HMAC_SHA1" ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L67-L104
maraujop/requests-oauth
oauth_hook/hook.py
OAuthHook.get_normalized_url
def get_normalized_url(url): """ Returns a normalized url, without params """ scheme, netloc, path, params, query, fragment = urlparse(url) # Exclude default port numbers. if scheme == 'http' and netloc[-3:] == ':80': netloc = netloc[:-3] elif scheme ...
python
def get_normalized_url(url): """ Returns a normalized url, without params """ scheme, netloc, path, params, query, fragment = urlparse(url) # Exclude default port numbers. if scheme == 'http' and netloc[-3:] == ':80': netloc = netloc[:-3] elif scheme ...
[ "def", "get_normalized_url", "(", "url", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "params", ",", "query", ",", "fragment", "=", "urlparse", "(", "url", ")", "# Exclude default port numbers.", "if", "scheme", "==", "'http'", "and", "netloc", "[", ...
Returns a normalized url, without params
[ "Returns", "a", "normalized", "url", "without", "params" ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L107-L122
maraujop/requests-oauth
oauth_hook/hook.py
OAuthHook.to_url
def to_url(request): """Serialize as a URL for a GET request.""" scheme, netloc, path, query, fragment = urlsplit(to_utf8(request.url)) query = parse_qs(query) for key, value in request.data_and_params.iteritems(): query.setdefault(key, []).append(value) query = url...
python
def to_url(request): """Serialize as a URL for a GET request.""" scheme, netloc, path, query, fragment = urlsplit(to_utf8(request.url)) query = parse_qs(query) for key, value in request.data_and_params.iteritems(): query.setdefault(key, []).append(value) query = url...
[ "def", "to_url", "(", "request", ")", ":", "scheme", ",", "netloc", ",", "path", ",", "query", ",", "fragment", "=", "urlsplit", "(", "to_utf8", "(", "request", ".", "url", ")", ")", "query", "=", "parse_qs", "(", "query", ")", "for", "key", ",", "...
Serialize as a URL for a GET request.
[ "Serialize", "as", "a", "URL", "for", "a", "GET", "request", "." ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L125-L134
maraujop/requests-oauth
oauth_hook/hook.py
OAuthHook.authorization_header
def authorization_header(oauth_params): """Return Authorization header""" authorization_headers = 'OAuth realm="",' authorization_headers += ','.join(['{0}="{1}"'.format(k, urllib.quote(str(v))) for k, v in oauth_params.items()]) return authorization_headers
python
def authorization_header(oauth_params): """Return Authorization header""" authorization_headers = 'OAuth realm="",' authorization_headers += ','.join(['{0}="{1}"'.format(k, urllib.quote(str(v))) for k, v in oauth_params.items()]) return authorization_headers
[ "def", "authorization_header", "(", "oauth_params", ")", ":", "authorization_headers", "=", "'OAuth realm=\"\",'", "authorization_headers", "+=", "','", ".", "join", "(", "[", "'{0}=\"{1}\"'", ".", "format", "(", "k", ",", "urllib", ".", "quote", "(", "str", "("...
Return Authorization header
[ "Return", "Authorization", "header" ]
train
https://github.com/maraujop/requests-oauth/blob/51bdf115a259ce326e7894d1a68470387ecd5f22/oauth_hook/hook.py#L143-L148
tmoerman/arboreto
arboreto/algo.py
grnboost2
def grnboost2(expression_data, gene_names=None, tf_names='all', client_or_address='local', early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, limit=None, seed=None, verbose=False): """ Launch arboreto with [GRNBoos...
python
def grnboost2(expression_data, gene_names=None, tf_names='all', client_or_address='local', early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, limit=None, seed=None, verbose=False): """ Launch arboreto with [GRNBoos...
[ "def", "grnboost2", "(", "expression_data", ",", "gene_names", "=", "None", ",", "tf_names", "=", "'all'", ",", "client_or_address", "=", "'local'", ",", "early_stop_window_length", "=", "EARLY_STOP_WINDOW_LENGTH", ",", "limit", "=", "None", ",", "seed", "=", "N...
Launch arboreto with [GRNBoost2] profile. :param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D numpy.ndarray * a sparse scipy.sparse.csc_matrix :param gene_names: optional list of gene names (strings). Required when a (dense or sp...
[ "Launch", "arboreto", "with", "[", "GRNBoost2", "]", "profile", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/algo.py#L10-L41
tmoerman/arboreto
arboreto/algo.py
genie3
def genie3(expression_data, gene_names=None, tf_names='all', client_or_address='local', limit=None, seed=None, verbose=False): """ Launch arboreto with [GENIE3] profile. :param expression_data: one of: * a pandas DataFrame (rows=o...
python
def genie3(expression_data, gene_names=None, tf_names='all', client_or_address='local', limit=None, seed=None, verbose=False): """ Launch arboreto with [GENIE3] profile. :param expression_data: one of: * a pandas DataFrame (rows=o...
[ "def", "genie3", "(", "expression_data", ",", "gene_names", "=", "None", ",", "tf_names", "=", "'all'", ",", "client_or_address", "=", "'local'", ",", "limit", "=", "None", ",", "seed", "=", "None", ",", "verbose", "=", "False", ")", ":", "return", "diy"...
Launch arboreto with [GENIE3] profile. :param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D numpy.ndarray * a sparse scipy.sparse.csc_matrix :param gene_names: optional list of gene names (strings). Required when a (dense or spars...
[ "Launch", "arboreto", "with", "[", "GENIE3", "]", "profile", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/algo.py#L44-L73
tmoerman/arboreto
arboreto/algo.py
diy
def diy(expression_data, regressor_type, regressor_kwargs, gene_names=None, tf_names='all', client_or_address='local', early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, limit=None, seed=None, verbose=False): """ :param expression_data: one...
python
def diy(expression_data, regressor_type, regressor_kwargs, gene_names=None, tf_names='all', client_or_address='local', early_stop_window_length=EARLY_STOP_WINDOW_LENGTH, limit=None, seed=None, verbose=False): """ :param expression_data: one...
[ "def", "diy", "(", "expression_data", ",", "regressor_type", ",", "regressor_kwargs", ",", "gene_names", "=", "None", ",", "tf_names", "=", "'all'", ",", "client_or_address", "=", "'local'", ",", "early_stop_window_length", "=", "EARLY_STOP_WINDOW_LENGTH", ",", "lim...
:param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D numpy.ndarray * a sparse scipy.sparse.csc_matrix :param regressor_type: string. One of: 'RF', 'GBM', 'ET'. Case insensitive. :param regressor_kwargs: a dictionary of key-value pa...
[ ":", "param", "expression_data", ":", "one", "of", ":", "*", "a", "pandas", "DataFrame", "(", "rows", "=", "observations", "columns", "=", "genes", ")", "*", "a", "dense", "2D", "numpy", ".", "ndarray", "*", "a", "sparse", "scipy", ".", "sparse", ".", ...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/algo.py#L76-L142
tmoerman/arboreto
arboreto/algo.py
_prepare_client
def _prepare_client(client_or_address): """ :param client_or_address: one of: * None * verbatim: 'local' * string address * a Client instance :return: a tuple: (Client instance, shutdown callback function). :raises: ValueError if no valid client input was prov...
python
def _prepare_client(client_or_address): """ :param client_or_address: one of: * None * verbatim: 'local' * string address * a Client instance :return: a tuple: (Client instance, shutdown callback function). :raises: ValueError if no valid client input was prov...
[ "def", "_prepare_client", "(", "client_or_address", ")", ":", "if", "client_or_address", "is", "None", "or", "str", "(", "client_or_address", ")", ".", "lower", "(", ")", "==", "'local'", ":", "local_cluster", "=", "LocalCluster", "(", "diagnostics_port", "=", ...
:param client_or_address: one of: * None * verbatim: 'local' * string address * a Client instance :return: a tuple: (Client instance, shutdown callback function). :raises: ValueError if no valid client input was provided.
[ ":", "param", "client_or_address", ":", "one", "of", ":", "*", "None", "*", "verbatim", ":", "local", "*", "string", "address", "*", "a", "Client", "instance", ":", "return", ":", "a", "tuple", ":", "(", "Client", "instance", "shutdown", "callback", "fun...
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/algo.py#L145-L191
tmoerman/arboreto
arboreto/algo.py
_prepare_input
def _prepare_input(expression_data, gene_names, tf_names): """ Wrangle the inputs into the correct formats. :param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D nump...
python
def _prepare_input(expression_data, gene_names, tf_names): """ Wrangle the inputs into the correct formats. :param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D nump...
[ "def", "_prepare_input", "(", "expression_data", ",", "gene_names", ",", "tf_names", ")", ":", "if", "isinstance", "(", "expression_data", ",", "pd", ".", "DataFrame", ")", ":", "expression_matrix", "=", "expression_data", ".", "as_matrix", "(", ")", "gene_names...
Wrangle the inputs into the correct formats. :param expression_data: one of: * a pandas DataFrame (rows=observations, columns=genes) * a dense 2D numpy.ndarray * a sparse scipy.sparse.csc_matrix :param gene_names: optional list...
[ "Wrangle", "the", "inputs", "into", "the", "correct", "formats", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/algo.py#L194-L231
rongcloud/server-sdk-python
rongcloud/base.py
RongCloudBase._make_common_signature
def _make_common_signature(self): """生成通用签名, 一般情况下,您不需要调用该方法 文档详见 http://docs.rongcloud.cn/server.html#_API_调用签名规则 :return: {'app-key':'xxx','nonce':'xxx','timestamp':'xxx','signature':'xxx'} """ nonce = str(random.random()) timestamp = str(int(time.time()) * 1000) signat...
python
def _make_common_signature(self): """生成通用签名, 一般情况下,您不需要调用该方法 文档详见 http://docs.rongcloud.cn/server.html#_API_调用签名规则 :return: {'app-key':'xxx','nonce':'xxx','timestamp':'xxx','signature':'xxx'} """ nonce = str(random.random()) timestamp = str(int(time.time()) * 1000) signat...
[ "def", "_make_common_signature", "(", "self", ")", ":", "nonce", "=", "str", "(", "random", ".", "random", "(", ")", ")", "timestamp", "=", "str", "(", "int", "(", "time", ".", "time", "(", ")", ")", "*", "1000", ")", "signature", "=", "hashlib", "...
生成通用签名, 一般情况下,您不需要调用该方法 文档详见 http://docs.rongcloud.cn/server.html#_API_调用签名规则 :return: {'app-key':'xxx','nonce':'xxx','timestamp':'xxx','signature':'xxx'}
[ "生成通用签名", "一般情况下,您不需要调用该方法", "文档详见", "http", ":", "//", "docs", ".", "rongcloud", ".", "cn", "/", "server", ".", "html#_API_调用签名规则", ":", "return", ":", "{", "app", "-", "key", ":", "xxx", "nonce", ":", "xxx", "timestamp", ":", "xxx", "signature", ":", ...
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/base.py#L29-L43
rongcloud/server-sdk-python
rongcloud/base.py
RongCloudBase._http_call
def _http_call(self, url, method, **kwargs): """Makes a http call. Logs response information.""" logging.debug("Request[{0}]: {1}".format(method, url)) start_time = datetime.datetime.now() logging.debug("Header: {0}".format(kwargs['headers'])) logging.debug("Params: {0}".format(...
python
def _http_call(self, url, method, **kwargs): """Makes a http call. Logs response information.""" logging.debug("Request[{0}]: {1}".format(method, url)) start_time = datetime.datetime.now() logging.debug("Header: {0}".format(kwargs['headers'])) logging.debug("Params: {0}".format(...
[ "def", "_http_call", "(", "self", ",", "url", ",", "method", ",", "*", "*", "kwargs", ")", ":", "logging", ".", "debug", "(", "\"Request[{0}]: {1}\"", ".", "format", "(", "method", ",", "url", ")", ")", "start_time", "=", "datetime", ".", "datetime", "...
Makes a http call. Logs response information.
[ "Makes", "a", "http", "call", ".", "Logs", "response", "information", "." ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/base.py#L50-L63
rongcloud/server-sdk-python
rongcloud/base.py
RongCloudBase.call_api
def call_api(self, action, params=None, method=('API', 'POST', 'application/x-www-form-urlencoded'), **kwargs): """ :param method: methodName :param action: MethodUrl, :param params: Dictionary,form params for api. ...
python
def call_api(self, action, params=None, method=('API', 'POST', 'application/x-www-form-urlencoded'), **kwargs): """ :param method: methodName :param action: MethodUrl, :param params: Dictionary,form params for api. ...
[ "def", "call_api", "(", "self", ",", "action", ",", "params", "=", "None", ",", "method", "=", "(", "'API'", ",", "'POST'", ",", "'application/x-www-form-urlencoded'", ")", ",", "*", "*", "kwargs", ")", ":", "urltype", ",", "methodname", ",", "content_type...
:param method: methodName :param action: MethodUrl, :param params: Dictionary,form params for api. :param timeout: (optional) Float describing the timeout of the request. :return:
[ ":", "param", "method", ":", "methodName", ":", "param", "action", ":", "MethodUrl,", ":", "param", "params", ":", "Dictionary", "form", "params", "for", "api", ".", ":", "param", "timeout", ":", "(", "optional", ")", "Float", "describing", "the", "timeout...
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/base.py#L68-L94
thumbor/libthumbor
libthumbor/url.py
calculate_width_and_height
def calculate_width_and_height(url_parts, options): '''Appends width and height information to url''' width = options.get('width', 0) has_width = width height = options.get('height', 0) has_height = height flip = options.get('flip', False) flop = options.get('flop', False) if flip: ...
python
def calculate_width_and_height(url_parts, options): '''Appends width and height information to url''' width = options.get('width', 0) has_width = width height = options.get('height', 0) has_height = height flip = options.get('flip', False) flop = options.get('flop', False) if flip: ...
[ "def", "calculate_width_and_height", "(", "url_parts", ",", "options", ")", ":", "width", "=", "options", ".", "get", "(", "'width'", ",", "0", ")", "has_width", "=", "width", "height", "=", "options", ".", "get", "(", "'height'", ",", "0", ")", "has_hei...
Appends width and height information to url
[ "Appends", "width", "and", "height", "information", "to", "url" ]
train
https://github.com/thumbor/libthumbor/blob/8114928102ff07166ce32e6d894f30124b5e169a/libthumbor/url.py#L22-L44
thumbor/libthumbor
libthumbor/url.py
url_for
def url_for(**options): '''Returns the url for the specified options''' url_parts = get_url_parts(**options) image_hash = hashlib.md5(b(options['image_url'])).hexdigest() url_parts.append(image_hash) return "/".join(url_parts)
python
def url_for(**options): '''Returns the url for the specified options''' url_parts = get_url_parts(**options) image_hash = hashlib.md5(b(options['image_url'])).hexdigest() url_parts.append(image_hash) return "/".join(url_parts)
[ "def", "url_for", "(", "*", "*", "options", ")", ":", "url_parts", "=", "get_url_parts", "(", "*", "*", "options", ")", "image_hash", "=", "hashlib", ".", "md5", "(", "b", "(", "options", "[", "'image_url'", "]", ")", ")", ".", "hexdigest", "(", ")",...
Returns the url for the specified options
[ "Returns", "the", "url", "for", "the", "specified", "options" ]
train
https://github.com/thumbor/libthumbor/blob/8114928102ff07166ce32e6d894f30124b5e169a/libthumbor/url.py#L47-L54
kfdm/gntp
gntp/config.py
mini
def mini(description, **kwargs): """Single notification function Simple notification function in one line. Has only one required parameter and attempts to use reasonable defaults for everything else :param string description: Notification message """ kwargs['notifierFactory'] = GrowlNotifier gntp.notifier.mini(...
python
def mini(description, **kwargs): """Single notification function Simple notification function in one line. Has only one required parameter and attempts to use reasonable defaults for everything else :param string description: Notification message """ kwargs['notifierFactory'] = GrowlNotifier gntp.notifier.mini(...
[ "def", "mini", "(", "description", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'notifierFactory'", "]", "=", "GrowlNotifier", "gntp", ".", "notifier", ".", "mini", "(", "description", ",", "*", "*", "kwargs", ")" ]
Single notification function Simple notification function in one line. Has only one required parameter and attempts to use reasonable defaults for everything else :param string description: Notification message
[ "Single", "notification", "function" ]
train
https://github.com/kfdm/gntp/blob/772a5f4db3707ea0253691d930bf648d1344913a/gntp/config.py#L62-L70
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.create
def create(self, chatRoomInfo): """ 创建聊天室方法 方法 @param chatRoomInfo:id:要创建的聊天室的id;name:要创建的聊天室的name。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fi...
python
def create(self, chatRoomInfo): """ 创建聊天室方法 方法 @param chatRoomInfo:id:要创建的聊天室的id;name:要创建的聊天室的name。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fi...
[ "def", "create", "(", "self", ",", "chatRoomInfo", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"Integer...
创建聊天室方法 方法 @param chatRoomInfo:id:要创建的聊天室的id;name:要创建的聊天室的name。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "创建聊天室方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L9-L39
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.queryUser
def queryUser(self, chatroomId, count, order): """ 查询聊天室内用户方法 方法 @param chatroomId:要查询的聊天室 ID。(必传) @param count:要获取的聊天室成员数,上限为 500 ,超过 500 时最多返回 500 个成员。(必传) @param order:加入聊天室的先后顺序, 1 为加入时间正序, 2 为加入时间倒序。(必传) @return code:返回码,200 为正常。 @return total:聊天室中用户数。 ...
python
def queryUser(self, chatroomId, count, order): """ 查询聊天室内用户方法 方法 @param chatroomId:要查询的聊天室 ID。(必传) @param count:要获取的聊天室成员数,上限为 500 ,超过 500 时最多返回 500 个成员。(必传) @param order:加入聊天室的先后顺序, 1 为加入时间正序, 2 为加入时间倒序。(必传) @return code:返回码,200 为正常。 @return total:聊天室中用户数。 ...
[ "def", "queryUser", "(", "self", ",", "chatroomId", ",", "count", ",", "order", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"ChatroomUserQueryReslut\"", ",", "\"desc\"", ":", "\" chatroomUserQuery 返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", ...
查询聊天室内用户方法 方法 @param chatroomId:要查询的聊天室 ID。(必传) @param count:要获取的聊天室成员数,上限为 500 ,超过 500 时最多返回 500 个成员。(必传) @param order:加入聊天室的先后顺序, 1 为加入时间正序, 2 为加入时间倒序。(必传) @return code:返回码,200 为正常。 @return total:聊天室中用户数。 @return users:聊天室成员列表。 @return errorMessage:错误信息。
[ "查询聊天室内用户方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L104-L144
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.stopDistributionMessage
def stopDistributionMessage(self, chatroomId): """ 聊天室消息停止分发方法(可实现控制对聊天室中消息是否进行分发,停止分发后聊天室中用户发送的消息,融云服务端不会再将消息发送给聊天室中其他用户。) 方法 @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut"...
python
def stopDistributionMessage(self, chatroomId): """ 聊天室消息停止分发方法(可实现控制对聊天室中消息是否进行分发,停止分发后聊天室中用户发送的消息,融云服务端不会再将消息发送给聊天室中其他用户。) 方法 @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut"...
[ "def", "stopDistributionMessage", "(", "self", ",", "chatroomId", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":...
聊天室消息停止分发方法(可实现控制对聊天室中消息是否进行分发,停止分发后聊天室中用户发送的消息,融云服务端不会再将消息发送给聊天室中其他用户。) 方法 @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "聊天室消息停止分发方法(可实现控制对聊天室中消息是否进行分发,停止分发后聊天室中用户发送的消息,融云服务端不会再将消息发送给聊天室中其他用户。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L146-L172
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.addGagUser
def addGagUser(self, userId, chatroomId, minute): """ 添加禁言聊天室成员方法(在 App 中如果不想让某一用户在聊天室中发言时,可将此用户在聊天室中禁言,被禁言用户可以接收查看聊天室中用户聊天信息,但不能发送消息.) 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @param minute:禁言时长,以分钟为单位,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 ...
python
def addGagUser(self, userId, chatroomId, minute): """ 添加禁言聊天室成员方法(在 App 中如果不想让某一用户在聊天室中发言时,可将此用户在聊天室中禁言,被禁言用户可以接收查看聊天室中用户聊天信息,但不能发送消息.) 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @param minute:禁言时长,以分钟为单位,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 ...
[ "def", "addGagUser", "(", "self", ",", "userId", ",", "chatroomId", ",", "minute", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ...
添加禁言聊天室成员方法(在 App 中如果不想让某一用户在聊天室中发言时,可将此用户在聊天室中禁言,被禁言用户可以接收查看聊天室中用户聊天信息,但不能发送消息.) 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @param minute:禁言时长,以分钟为单位,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "添加禁言聊天室成员方法(在", "App", "中如果不想让某一用户在聊天室中发言时,可将此用户在聊天室中禁言,被禁言用户可以接收查看聊天室中用户聊天信息,但不能发送消息", ".", ")", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L202-L234
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.rollbackBlockUser
def rollbackBlockUser(self, userId, chatroomId): """ 移除封禁聊天室成员方法 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " h...
python
def rollbackBlockUser(self, userId, chatroomId): """ 移除封禁聊天室成员方法 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " h...
[ "def", "rollbackBlockUser", "(", "self", ",", "userId", ",", "chatroomId", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"...
移除封禁聊天室成员方法 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "移除封禁聊天室成员方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L366-L394
rongcloud/server-sdk-python
rongcloud/chatroom.py
Chatroom.addPriority
def addPriority(self, objectName): """ 添加聊天室消息优先级方法 方法 @param objectName:低优先级的消息类型,每次最多提交 5 个,设置的消息类型最多不超过 20 个。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", ...
python
def addPriority(self, objectName): """ 添加聊天室消息优先级方法 方法 @param objectName:低优先级的消息类型,每次最多提交 5 个,设置的消息类型最多不超过 20 个。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", ...
[ "def", "addPriority", "(", "self", ",", "objectName", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"Inte...
添加聊天室消息优先级方法 方法 @param objectName:低优先级的消息类型,每次最多提交 5 个,设置的消息类型最多不超过 20 个。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "添加聊天室消息优先级方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/chatroom.py#L396-L422
rongcloud/server-sdk-python
rongcloud/push.py
Push.setUserPushTag
def setUserPushTag(self, userTag): """ 添加 Push 标签方法 方法 @param userTag:用户标签。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "n...
python
def setUserPushTag(self, userTag): """ 添加 Push 标签方法 方法 @param userTag:用户标签。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "n...
[ "def", "setUserPushTag", "(", "self", ",", "userTag", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"Inte...
添加 Push 标签方法 方法 @param userTag:用户标签。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "添加", "Push", "标签方法", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/push.py#L9-L35
rongcloud/server-sdk-python
rongcloud/push.py
Push.broadcastPush
def broadcastPush(self, pushMessage): """ 广播消息方法(fromuserid 和 message为null即为不落地的push) 方法 @param pushMessage:json数据 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", ...
python
def broadcastPush(self, pushMessage): """ 广播消息方法(fromuserid 和 message为null即为不落地的push) 方法 @param pushMessage:json数据 @return code:返回码,200 为正常。 @return errorMessage:错误信息。 """ desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", ...
[ "def", "broadcastPush", "(", "self", ",", "pushMessage", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":", "\"I...
广播消息方法(fromuserid 和 message为null即为不落地的push) 方法 @param pushMessage:json数据 @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "广播消息方法(fromuserid", "和", "message为null即为不落地的push)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/push.py#L37-L63
tmoerman/arboreto
arboreto/utils.py
load_tf_names
def load_tf_names(path): """ :param path: the path of the transcription factor list file. :return: a list of transcription factor names read from the file. """ with open(path) as file: tfs_in_file = [line.strip() for line in file.readlines()] return tfs_in_file
python
def load_tf_names(path): """ :param path: the path of the transcription factor list file. :return: a list of transcription factor names read from the file. """ with open(path) as file: tfs_in_file = [line.strip() for line in file.readlines()] return tfs_in_file
[ "def", "load_tf_names", "(", "path", ")", ":", "with", "open", "(", "path", ")", "as", "file", ":", "tfs_in_file", "=", "[", "line", ".", "strip", "(", ")", "for", "line", "in", "file", ".", "readlines", "(", ")", "]", "return", "tfs_in_file" ]
:param path: the path of the transcription factor list file. :return: a list of transcription factor names read from the file.
[ ":", "param", "path", ":", "the", "path", "of", "the", "transcription", "factor", "list", "file", ".", ":", "return", ":", "a", "list", "of", "transcription", "factor", "names", "read", "from", "the", "file", "." ]
train
https://github.com/tmoerman/arboreto/blob/3ff7b6f987b32e5774771751dea646fa6feaaa52/arboreto/utils.py#L6-L15
rongcloud/server-sdk-python
rongcloud/group.py
Group.sync
def sync(self, userId, groupInfo): """ 同步用户所属群组方法(当第一次连接融云服务器时,需要向融云服务器提交 userId 对应的用户当前所加入的所有群组,此接口主要为防止应用中用户群信息同融云已知的用户所属群信息不同步。) 方法 @param userId:被同步群信息的用户 Id。(必传) @param groupInfo:该用户的群信息,如群 Id 已经存在,则不会刷新对应群组名称,如果想刷新群组名称请调用刷新群组信息方法。 @return code:返回码,200 为正常。 @ret...
python
def sync(self, userId, groupInfo): """ 同步用户所属群组方法(当第一次连接融云服务器时,需要向融云服务器提交 userId 对应的用户当前所加入的所有群组,此接口主要为防止应用中用户群信息同融云已知的用户所属群信息不同步。) 方法 @param userId:被同步群信息的用户 Id。(必传) @param groupInfo:该用户的群信息,如群 Id 已经存在,则不会刷新对应群组名称,如果想刷新群组名称请调用刷新群组信息方法。 @return code:返回码,200 为正常。 @ret...
[ "def", "sync", "(", "self", ",", "userId", ",", "groupInfo", ")", ":", "desc", "=", "{", "\"name\"", ":", "\"CodeSuccessReslut\"", ",", "\"desc\"", ":", "\" http 成功返回结果\",", "", "\"fields\"", ":", "[", "{", "\"name\"", ":", "\"code\"", ",", "\"type\"", ":"...
同步用户所属群组方法(当第一次连接融云服务器时,需要向融云服务器提交 userId 对应的用户当前所加入的所有群组,此接口主要为防止应用中用户群信息同融云已知的用户所属群信息不同步。) 方法 @param userId:被同步群信息的用户 Id。(必传) @param groupInfo:该用户的群信息,如群 Id 已经存在,则不会刷新对应群组名称,如果想刷新群组名称请调用刷新群组信息方法。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。
[ "同步用户所属群组方法(当第一次连接融云服务器时,需要向融云服务器提交", "userId", "对应的用户当前所加入的所有群组,此接口主要为防止应用中用户群信息同融云已知的用户所属群信息不同步。)", "方法" ]
train
https://github.com/rongcloud/server-sdk-python/blob/3daadd8b67c84cc5d2a9419e8d45fd69c9baf976/rongcloud/group.py#L43-L72