code
string
signature
string
docstring
string
loss_without_docstring
float64
loss_with_docstring
float64
factor
float64
# type: (Text) -> Text try: value = int(str_in, base=10) return str(value) except ValueError as e: msg = "Invalid integer. Read '{}'.".format(str_in) e_new = InvalidEntryError(msg) e_new.field_spec = self raise_from...
def _format_regular_value(self, str_in)
we need to reformat integer strings, as there can be different strings for the same integer. The strategy of unification here is to first parse the integer string to an Integer type. Thus all of '+13', ' 13', '13' will be parsed to 13. We then convert the integer ...
4.406235
5.299477
0.831447
# type: (...) -> DateSpec # noinspection PyCompatibility result = cast(DateSpec, # For Mypy. super().from_json_dict(json_dict)) format_ = json_dict['format'] result.format = format_['format'] return result
def from_json_dict(cls, json_dict # type: Dict[str, Any] )
Make a DateSpec object from a dictionary containing its properties. :param dict json_dict: This dictionary must contain a `'format'` key. In addition, it must contain a `'hashing'` key, whose contents are passed to :class:`FieldHashingProperties`....
6.676689
7.687057
0.868563
# type: (Text) -> None if self.is_missing_value(str_in): return # noinspection PyCompatibility super().validate(str_in) try: datetime.strptime(str_in, self.format) except ValueError as e: msg = "Validation error for date type: ...
def validate(self, str_in)
Validates an entry in the field. Raises `InvalidEntryError` iff the entry is invalid. An entry is invalid iff (1) the string does not represent a date in the correct format; or (2) the date it represents is invalid (such as 30 February). :param str str_in: ...
4.460228
4.935762
0.903655
# type: (Text) -> Text try: dt = datetime.strptime(str_in, self.format) return strftime(dt, DateSpec.OUTPUT_FORMAT) except ValueError as e: msg = "Unable to format date value '{}'. Reason: {}".format(str_in, ...
def _format_regular_value(self, str_in)
we overwrite default behaviour as we want to hash the numbers only, no fillers like '-', or '/' :param str str_in: date string :return: str date string with format DateSpec.OUTPUT_FORMAT
5.085321
4.828963
1.053088
# type: (...) -> EnumSpec # noinspection PyCompatibility result = cast(EnumSpec, # Appease the gods of Mypy. super().from_json_dict(json_dict)) format_ = json_dict['format'] result.values = set(format_['values']) return result
def from_json_dict(cls, json_dict # type: Dict[str, Any] )
Make a EnumSpec object from a dictionary containing its properties. :param dict json_dict: This dictionary must contain an `'enum'` key specifying the permitted values. In addition, it must contain a `'hashing'` key, whose contents are passed to :...
7.78179
9.937788
0.783051
# type: (Text) -> None if self.is_missing_value(str_in): return # noinspection PyCompatibility super().validate(str_in) if str_in not in self.values: msg = ("Expected enum value to be one of {}. Read '{}'." .format(list(self.va...
def validate(self, str_in)
Validates an entry in the field. Raises `InvalidEntryError` iff the entry is invalid. An entry is invalid iff it is not one of the permitted values. :param str str_in: String to validate. :raises InvalidEntryError: When entry is invalid.
4.838468
5.460495
0.886086
length = len(iterable) for batch_start in range(0, length, size): yield iterable[batch_start:batch_start+size]
def batched(iterable, size)
Split an iterable into constant sized chunks Recipe from http://stackoverflow.com/a/8290514
2.716128
2.748899
0.988079
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 ] return data
def standardize_input_data(data)
Ensure utf-8 encoded strings are passed to the indico API
2.795033
2.492039
1.121585
url_params = url_params or {} input_data = standardize_input_data(input_data) cloud = cloud or config.cloud host = "%s.indico.domains" % cloud if cloud else config.host # LOCAL DEPLOYMENTS if not (host.endswith('indico.domains') or host.endswith('indico.io')): url_protocol = "http...
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.
4.153761
4.33146
0.958975
if batch_size: results = [] for batch in batched(input_data, size=batch_size): try: result = send_request(batch, api, url, headers, kwargs) if isinstance(result, list): results.extend(result) else: ...
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
2.56859
2.509528
1.023535
data = {} if input_data != None: data['data'] = input_data # request that the API respond with a msgpack encoded result serializer = kwargs.pop("serializer", config.serializer) data['serializer'] = serializer data.update(**kwargs) json_data = json.dumps(data) response = ...
def send_request(input_data, api, url, headers, kwargs)
Use the requests library to send of an HTTP call to the indico servers
3.634454
3.524965
1.031061
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('method', None) host_url_seg = url_protocol + "://%s" % host api_url_seg = "/%s" % api batch_url_seg = "/batch" if...
def create_url(url_protocol, host, api, url_params)
Generate the proper url for sending off data for analysis
2.230572
2.223147
1.00334
if kwargs.get("language", "english") != "english": version = 1 url_params = {"batch": batch, "api_key": api_key, "version": version} return api_handler(text, cloud=cloud, api="keywords", url_params=url_params, batch_size=batch_size, **kwargs)
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 with mostly sunny skies. Highs in the low 70s.' >>> keywords = indicoio.keywords(text, top_n=3) ...
2.920081
3.778457
0.772824
url_params = {"batch": batch, "api_key": api_key, "version": version} kwargs['persona'] = True return api_handler(text, cloud=cloud, api="personality", url_params=url_params, **kwargs)
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 = indicoio.personas(text) {'architect': 0.2191890478134155, 'logician': 0.0158474326133...
3.529241
5.249205
0.672338
pdf = pdf_preprocess(pdf, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version} results = api_handler(pdf, cloud=cloud, api="pdfextraction", url_params=url_params, **kwargs) if batch: for result in results: result["images"] = postprocess_images(resu...
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 `images=True` or `tables=True`. Example usage: .. code-block:: python >>> from ind...
2.777736
3.585398
0.774736
# type: (...) -> Callable[[Text, Optional[Text]], Iterable[Text]] def dummy(word, ignore=None): # type: (Text, Optional[Text]) -> Iterable[Text] return ('' for i in range(0)) if not fhp: return dummy n = fhp.ngram if n < 0: raise ValueError('`n` in `n...
def get_tokenizer(fhp # type: Optional[field_formats.FieldHashingProperties] )
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.
2.947288
3.107345
0.948491
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()) else: # assume pdf is already b64 encoded return pdf
def pdf_preprocess(pdf, batch=False)
Load pdfs from local filepath if not already b64 encoded
3.714974
2.998013
1.239146
def people(text, cloud=None, batch=None, api_key=None, version=2, **kwargs): url_params = {"batch": batch, "api_key": api_key, "version": version} return api_handler(text, cloud=cloud, api="people", url_params=url_params, **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 ..." >>> entities = indicoio.people(text) [ { u'text': "Mike Brown", ...
null
null
null
# type: (...) -> None if any(math.isnan(float(i)) or math.isinf(float(i)) for i in x): raise ValueError('input contains non-finite numbers like "nan" or "+/- inf"') t = sum(x) m = float(len(x)) norm_t = t / m S = sum((xi - norm_t) ** 2 for xi in x) ...
def update(self, x # type: Sequence[Union[int, float]] )
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...
3.358613
3.58447
0.93699
# type: (...) -> Tuple[List[str], Sequence[int]] clk_data = [] clk_popcounts = [] for clk in stream_bloom_filters(chunk_pii_data, keys, schema): clk_data.append(serialize_bitarray(clk[0]).strip()) clk_popcounts.append(clk[2]) return clk_data, clk_popcounts
def hash_and_serialize_chunk(chunk_pii_data, # type: Sequence[Sequence[str]] keys, # type: Sequence[Sequence[bytes]] schema # type: Schema )
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...
5.00724
4.812597
1.040445
# type: (...) -> List[str] if header not in {False, True, 'ignore'}: raise ValueError("header must be False, True or 'ignore' but is {}." .format(header)) log.info("Hashing data") # Read from CSV file reader = unicode_reader(input_f) if header: co...
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...
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 ...
3.216675
3.338753
0.963436
# type: (Sequence[T], int) -> Iterable[Sequence[T]] return (seq[i:i + chunk_size] for i in range(0, len(seq), chunk_size))
def chunks(seq, chunk_size)
Split seq into chunk_size-sized chunks. :param seq: A sequence to chunk. :param chunk_size: The size of chunk.
2.240183
4.123056
0.543331
# type: (str) -> List[str] data_bytes = pkgutil.get_data('clkhash', 'data/{}'.format(resource_name)) if data_bytes is None: raise ValueError("No data resource found with name {}".format(resource_name)) else: data = data_bytes.decode('utf8') reader = csv.reader(data.splitline...
def load_csv_data(resource_name)
Loads first column of specified CSV file from package data.
2.772527
2.942175
0.942339
# type: (...) -> None print(','.join(headers), file=file) writer = csv.writer(file) writer.writerows(data)
def save_csv(data, # type: Iterable[Tuple[Union[str, int], ...]] headers, # type: Iterable[str] file # type: TextIO )
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
3.776265
7.641569
0.494174
# type: (datetime, datetime) -> datetime delta = end - start int_delta = (delta.days * 24 * 60 * 60) + delta.seconds random_second = random.randrange(int_delta) return start + timedelta(seconds=random_second)
def random_date(start, end)
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
1.636971
2.264439
0.722904
# 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 self.all_last_names is not None for i in range(n): sex = 'M' if random.random() > 0.5 else 'F' ...
def generate_random_person(self, n)
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') )
2.126292
2.068701
1.027839
# 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.all_last_names = load_csv_data('CSV_Database_of_Last_Names.csv')
def load_names(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/
3.489715
3.675903
0.949349
# type: (int, float, int) -> Tuple[List, ...] overlap_sz = int(math.floor(overlap * sz)) unique_sz = sz - overlap_sz # Unique names per subset total_unique_sz = unique_sz * subsets # Uniques in all subsets total_sz = overlap_sz + total_unique_sz if total_sz > ...
def generate_subsets(self, sz, overlap=0.8, subsets=2)
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...
3.47775
3.593493
0.967791
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 as a list of `[data, target]` pairs." )
def _unpack_list(example)
Input data format standardization
5.895008
5.411963
1.089255
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 data is " "formatted as a list of dicts with `data` and `target` ...
def _unpack_dict(example)
Input data format standardization
4.011131
3.924289
1.022129
xs = [None] * len(data) ys = [None] * len(data) metadata = [None] * len(data) for idx, example in enumerate(data): if isinstance(example, (list, tuple)): xs[idx], ys[idx], metadata[idx] = _unpack_list(example) if isinstance(example, dict): xs[idx], ys[idx], m...
def _unpack_data(data)
Break Xs, Ys, and metadata out into separate lists for data preprocessing. Run basic data validation.
2.091332
1.786388
1.170704
if not any(metadata): # legacy list of list format is acceptable return list(zip(X, Y)) else: # newer dictionary-based format is required in order to save metadata return [ { 'data': x, 'target': y, ...
def _pack_data(X, Y, metadata)
After modifying / preprocessing inputs, reformat the data in preparation for JSON serialization
5.625584
5.367195
1.048142
if not sys.version_info[:2] >= (3, 5): raise IndicoError("Python >= 3.5+ is required for explanation visualization") try: from colr import Colr as C except ImportError: raise IndicoError("Package colr >= 0.8.1 is required for explanation visualization.") cursor = 0 text = ex...
def visualize_explanation(explanation, label=None)
Given the output of the explain() endpoint, produces a terminal visual that plots response strength over a sequence
3.300783
3.240472
1.018612
url_params = {"batch": False, "api_key": api_key, "version": version, "method": "collections"} return api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs)
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 the key has not been declared elsewhere. This allows the API to recogniz...
4.818651
6.270159
0.768505
batch = detect_batch(data) data = data_preprocess(data, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version, "method": "vectorize"} return api_handler(data, cloud=cloud, api="custom", url_params=url_params, **kwargs)
def vectorize(data, cloud=None, api_key=None, version=None, **kwargs)
Support for raw features from the custom collections API
4.297557
4.081891
1.052835
keyword_arguments = {} keyword_arguments.update(self.keywords) keyword_arguments.update(kwargs) return api_handler(*args, **keyword_arguments)
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
3.458182
2.593167
1.333575
if not len(data): raise IndicoError("No input data provided.") batch = isinstance(data[0], (list, tuple, dict)) # standarize format for preprocessing batch of examples if not batch: data = [data] X, Y, metadata = _unpack_data(data) X = 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 data - List: The text and collection/score associated with it. The length of the text (string) should ide...
4.958646
4.91011
1.009885
url_params = {"batch": batch, "api_key": api_key, "version": version, 'method': "train"} return self._api_handler(self.keywords['collection'], cloud=cloud, api="custom", url_params=url_params, **kwargs)
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 elsewhere. This allows the API to recognize a request as yours and automatically route it ...
5.257373
6.929143
0.758733
url_params = {"batch": False, "api_key": api_key, "version": version, "method": "info"} return self._api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs)
def info(self, cloud=None, api_key=None, version=None, **kwargs)
Return the current state of the model associated with a given collection
4.584229
4.544927
1.008648
batch = detect_batch(data) data = data_preprocess(data, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version, 'method': 'remove_example'} return self._api_handler(data, cloud=cloud, api="custom", url_params=url_params, **kwargs)
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 example, if a piece of content has been retagged. Inputs data - String: The exact text you wish to...
4.049308
4.535125
0.892877
while True: status = self.info(**kwargs).get('status') if status == "ready": break if status != "training": raise IndicoError("Collection status failed with: {0}".format(status)) time.sleep(interval)
def wait(self, interval=1, **kwargs)
Block until the collection's model is completed training
6.321005
4.813241
1.313253
kwargs['make_public'] = make_public url_params = {"batch": False, "api_key": api_key, "version": version, "method": "register"} return self._api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs)
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, required only if the key has not been declared elsewhere. This allows the API to recognize a request a...
4.278381
5.568219
0.768357
kwargs['permission_type'] = permission_type kwargs['email'] = email url_params = {"batch": False, "api_key": api_key, "version": version, "method": "authorize"} return self._api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs)
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. Inputs: email - String: The email of the user you would like to share access with. permission_type ...
3.944014
4.629831
0.85187
kwargs['email'] = email url_params = {"batch": False, "api_key": api_key, "version": version, "method": "deauthorize"} return self._api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs)
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: Your API key, required only if the key has not been declared elsewhere. This allows the API ...
4.618535
5.962903
0.774545
kwargs['name'] = name url_params = {"batch": False, "api_key": api_key, "version": version, "method": "rename"} result = self._api_handler(None, cloud=cloud, api="custom", url_params=url_params, **kwargs) self.keywords['collection'] = name return result
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: name - String: The new name used to access your model. api_key (optional) - St...
5.581359
5.971298
0.934698
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)
Raise specific exceptions for ease of error handling
3.922422
3.623048
1.08263
image = data_preprocess(image, batch=batch) url_params = {"batch": batch, "api_key": api_key, "version": version} return api_handler(image, cloud=cloud, api="faciallocalization", url_params=url_params, **kwargs)
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 in the dictionary. Input should be in a numpy ndarray or a filename. Example usage: .. code-b...
3.498914
4.976123
0.703141
def summarization(text, cloud=None, batch=False, api_key=None, version=1, **kwargs): url_params = {"batch": batch, "api_key": api_key, "version": version} return api_handler(text, cloud=cloud, api="summarization", url_params=url_params, **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.org/wiki/Yahoo!_data_breach") >>> summary ["This information was disclosed two years...
null
null
null
# type: (...) -> Tuple[bytes, ...] try: hash_function = _HASH_FUNCTIONS[hash_algo] except KeyError: msg = "unsupported hash function '{}'".format(hash_algo) raise_from(ValueError(msg), None) hkdf = HKDF(algorithm=hash_function(), length=num_keys * key_size, ...
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 )
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...
2.571034
2.743701
0.937068
# type: (...) -> Tuple[Tuple[bytes, ...], ...] keys = [] try: for key in master_secrets: if isinstance(key, bytes): keys.append(key) else: keys.append(key.encode('UTF-8')) except AttributeError: raise TypeError("provided 'maste...
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] ...
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...
2.787964
2.906366
0.959261
# type: (...) -> None for i, row in enumerate(data): if len(fields) != len(row): msg = 'Row {} has {} entries when {} are expected.'.format( i, len(row), len(fields)) raise FormatError(msg)
def validate_row_lengths(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] )
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.
2.997349
3.515021
0.852726
# type: (...) -> None validators = [f.validate for f in fields] for i, row in enumerate(data): for entry, v in zip(row, validators): try: v(entry) except InvalidEntryError as e: msg = ( 'Invalid entry in row {row_index...
def validate_entries(fields, # type: Sequence[FieldSpec] data # type: Sequence[Sequence[str]] )
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`.
2.900347
2.979198
0.973533
# type: (...) -> None if len(fields) != len(column_names): msg = 'Header has {} columns when {} are expected.'.format( len(column_names), len(fields)) raise FormatError(msg) for f, column in zip(fields, column_names): if f.identifier != column: msg = "Co...
def validate_header(fields, # type: Sequence[FieldSpec] column_names # type: Sequence[str] )
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...
2.645509
3.002654
0.881057
conf = {} s = os.environ.get(env, default) if s: conf = parse(s) return conf
def config(env=DEFAULT_ENV, default=None)
Returns a dictionary with EMAIL_* settings from EMAIL_URL.
5.028405
4.540723
1.107402
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, 'EMAIL_HOST_USER': unquote(url.username...
def parse(url)
Parses an email URL.
2.411053
2.364278
1.019784
tuples = [(index, gene) for index, gene in enumerate(gene_names) if gene in tf_names] tf_indices = [t[0] for t in tuples] tf_matrix_names = [t[1] for t in tuples] return expression_matrix[:, tf_indices], tf_matrix_names
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_names: a list of transcription factor names. Should be a subset of gene_names. :return: tuple of: ...
2.770435
3.218242
0.860853
regressor_type = regressor_type.upper() assert tf_matrix.shape[0] == len(target_gene_expression) def do_sklearn_regression(): regressor = SKLEARN_REGRESSOR_FACTORY[regressor_type](random_state=seed, **regressor_kwargs) with_early_stopping = is_oob_heuristic_supported(regressor_type, ...
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 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...
2.349272
2.515368
0.933968
if is_oob_heuristic_supported(regressor_type, regressor_kwargs): n_estimators = len(trained_regressor.estimators_) denormalized_importances = trained_regressor.feature_importances_ * n_estimators return denormalized_importances else: return trained_regressor.feature_impor...
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 multiplying again by the number of trees used. This enables prioritizing links that were inferred in a regression where lots of :param regre...
3.351507
3.024292
1.108196
n_estimators = len(trained_regressor.estimators_) return pd.DataFrame({'target': [target_gene_name], 'n_estimators': [n_estimators]})
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.
3.343868
4.52655
0.738723
def pythonic(): # feature_importances = trained_regressor.feature_importances_ feature_importances = to_feature_importances(regressor_type, regressor_kwargs, trained_regressor) links_df = pd.DataFrame({'TF': tf_matrix_gene_names, 'importance': feature_importances}) links_df['t...
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. :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...
2.269525
2.172609
1.044608
if target_gene_name not in tf_matrix_gene_names: clean_tf_matrix = tf_matrix else: clean_tf_matrix = np.delete(tf_matrix, tf_matrix_gene_names.index(target_gene_name), 1) clean_tf_names = [tf for tf in tf_matrix_gene_names if tf != target_gene_name] assert clean_tf_matrix.shape[1...
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 gene to remove from the tf_matrix and tf_names. :return: a tuple of (matrix, names) equal...
1.822677
1.724851
1.056716
nr_retries = 0 result = fallback_result for attempt in range(max_retries): try: result = fn() except Exception as cause: nr_retries += 1 msg_head = '' if warning_msg is None else repr(warning_msg) + ' ' msg_tail = "Retry ({1}/{2}). Fail...
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 :param fn: the function to retry. :param max_retries: the maximum number o...
3.547641
3.969011
0.893835
def fn(): (clean_tf_matrix, clean_tf_matrix_gene_names) = clean(tf_matrix, tf_matrix_gene_names, target_gene_name) try: trained_regressor = fit_model(regressor_type, regressor_kwargs, clean_tf_matrix, target_gene_expression, early_stop_wind...
def infer_partial_network(regressor_type, regressor_kwargs, tf_matrix, tf_matrix_gene_names, target_gene_name, target_gene_expression, include_meta=False, ...
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 ...
2.632258
2.542814
1.035175
if isinstance(target_genes, list) and len(target_genes) == 0: return [] if isinstance(target_genes, str) and target_genes.upper() == 'ALL': return list(range(len(gene_names))) elif isinstance(target_genes, int): top_n = target_genes assert top_n > 0 return li...
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.
2.102197
2.043532
1.028708
lo = max(0, current_round - self.window_length + 1) hi = current_round + 1 return lo, hi
def window_boundaries(self, current_round)
:param current_round: :return: the low and high boundaries of the estimators window to consider.
3.969916
3.501379
1.133815
'''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)
Generates an encrypted URL with the specified options
9.805695
6.884148
1.424388
desc = { "name": "TokenReslut", "desc": "getToken 返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常.如果您正在使用开发环境的 AppKey,您的应用只能注册 100 名用户,达到上限后,将返回错误码 2007.如果您需要更多的测试账户数量,您需要在应用...
def getToken(self, userId, name, portraitUri)
获取 Token 方法 方法 @param userId:用户 Id,最大长度 64 字节.是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @param name:用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称.用户名称,最大长度 128 字节.用来在 Push 推送时显示用户的名称。(必传) @param portraitUri:用户头像 URI,最大长度 1024 字节.用来在 Push 推送时显示用户的头像。(必传) @return code:返回码,200...
3.990341
1.708059
2.336185
desc = { "name": "CheckOnlineReslut", "desc": "checkOnlineUser返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "status", "type": "St...
def checkOnline(self, userId)
检查用户在线状态 方法 方法 @param userId:用户 Id,最大长度 64 字节。是用户在 App 中的唯一标识码,必须保证在同一个 App 内不重复,重复的用户 Id 将被当作是同一用户。(必传) @return code:返回码,200 为正常。 @return status:在线状态,1为在线,0为不在线。 @return errorMessage:错误信息。
3.048005
2.584319
1.179423
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def block(self, userId, minute)
封禁用户方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param minute:封禁时长,单位为分钟,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
4.143106
3.376498
1.227043
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def addBlacklist(self, userId, blackUserId)
添加用户到黑名单方法(每秒钟限 100 次) 方法 @param userId:用户 Id。(必传) @param blackUserId:被加到黑名单的用户Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
3.686876
3.233943
1.140056
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def publishPrivate(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, count=None, verifyBlacklist=None, ...
发送单聊消息方法(一个用户向另外一个用户发送消息,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人,如:一次发送 1000 人时,示为 1000 条消息。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toUserId:接收用户 Id,可以实现向多人发送消息,每次上限为 1000 人。(必传) @param voiceMessage:消息。 @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收到 P...
2.295916
2.172341
1.056886
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def publishTemplate(self, templateMessage)
发送单聊模板消息方法(一个用户向多个用户发送不同消息内容,单条消息最大 128k。每分钟最多发送 6000 条信息,每次发送用户上限为 1000 人。) 方法 @param templateMessage:单聊模版消息。 @return code:返回码,200 为正常。 @return errorMessage:错误信息。
4.838704
4.016121
1.20482
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def PublishSystem(self, fromUserId, toUserId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None)
发送系统消息方法(一个用户向一个或多个用户发送系统消息,单条消息最大 128k,会话类型为 SYSTEM。每秒钟最多发送 100 条消息,每次最多同时向 100 人发送,如:一次发送 100 人时,示为 100 条消息。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toUserId:接收用户 Id,提供多个本参数可以实现向多人发送消息,上限为 1000 人。(必传) @param txtMessage:发送消息内容(必传) @param pushContent:如果为自定义消息,定义显示的 Push 内容,内容中定义标识...
2.634159
2.433172
1.082603
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def publishGroup(self, fromUserId, toGroupId, objectName, content, pushContent=None, pushData=None, isPersisted=None, isCounted=None, ...
发送群组消息方法(以一个用户身份向群组发送消息,单条消息最大 128k.每秒钟最多发送 20 条消息,每次最多向 3 个群组发送,如:一次向 3 个群组发送消息,示为 3 条消息。) 方法 @param fromUserId:发送人用户 Id 。(必传) @param toGroupId:接收群Id,提供多个本参数可以实现向多群发送消息,最多不超过 3 个群组。(必传) @param txtMessage:发送消息内容(必传) @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收...
2.408241
2.269139
1.061302
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def publishChatroom(self, fromUserId, toChatroomId, objectName, content)
发送聊天室消息方法(一个用户向聊天室发送消息,单条消息最大 128k。每秒钟限 100 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param toChatroomId:接收聊天室Id,提供多个本参数可以实现向多个聊天室发送消息。(必传) @param txtMessage:发送消息内容(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
3.264899
2.826109
1.155263
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def broadcast(self, fromUserId, objectName, content, pushContent=None, pushData=None, os=None)
发送广播消息方法(发送消息给一个应用下的所有注册用户,如用户未在线会对满足条件(绑定手机终端)的用户发送 Push 信息,单条消息最大 128k,会话类型为 SYSTEM。每小时只能发送 1 次,每天最多发送 3 次。) 方法 @param fromUserId:发送人用户 Id。(必传) @param txtMessage:文本消息。 @param pushContent:定义显示的 Push 内容,如果 objectName 为融云内置消息类型时,则发送后用户一定会收到 Push 信息. 如果为自定义消息,则 pushContent 为自定义消息显示的 Push 内容,如果不...
2.852286
2.643413
1.079017
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def deleteMessage(self, date)
消息历史记录删除方法(删除 APP 内指定某天某小时内的所有会话消息记录。调用该接口返回成功后,date参数指定的某小时的消息记录文件将在随后的5-10分钟内被永久删除。) 方法 @param date:指定北京时间某天某小时,格式为2014010101,表示:2014年1月1日凌晨1点。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
4.519868
3.531256
1.279961
if isinstance(x, basestring): return x.encode('utf-8') if isinstance(x, unicode) else x try: l = iter(x) except TypeError: return x return [to_utf8(i) for i in l]
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.
2.347237
2.255365
1.040735
sig = ( escape(request.method), escape(OAuthHook.get_normalized_url(request.url)), escape(OAuthHook.get_normalized_parameters(request)), ) key = '%s&' % escape(consumer.secret) if token is not None: key += escape(token.secret) ...
def signing_base(self, request, consumer, token)
This method generates the OAuth signature. It's defined here to avoid circular imports.
4.544607
3.941899
1.152898
parameters = parse_qs(to_utf8(query_string), keep_blank_values=True) for k, v in parameters.iteritems(): parameters[k] = urllib.unquote(v[0]) return parameters
def _split_url_string(query_string)
Turns a `query_string` into a Python dictionary with unquoted values
2.913772
2.593883
1.123325
# See issues #10 and #12 if ('Content-Type' not in request.headers or \ request.headers.get('Content-Type').startswith('application/x-www-form-urlencoded')) \ and not isinstance(request.data, basestring): data_and_params = dict(request.data.items() + request....
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
3.473493
3.422057
1.015031
scheme, netloc, path, params, query, fragment = urlparse(url) # Exclude default port numbers. if scheme == 'http' and netloc[-3:] == ':80': netloc = netloc[:-3] elif scheme == 'https' and netloc[-4:] == ':443': netloc = netloc[:-4] if scheme not ...
def get_normalized_url(url)
Returns a normalized url, without params
2.50369
2.451677
1.021215
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 = urllib.urlencode(query, True) return urlunsplit((scheme, ne...
def to_url(request)
Serialize as a URL for a GET request.
2.891419
2.722427
1.062074
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)
Return Authorization header
3.29696
3.097569
1.06437
return diy(expression_data=expression_data, regressor_type='GBM', regressor_kwargs=SGBM_KWARGS, gene_names=gene_names, tf_names=tf_names, client_or_address=client_or_address, early_stop_window_length=early_stop_window_length, limit=limit, seed=seed, verbose=verbose)
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 [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...
2.675176
2.996941
0.892636
return diy(expression_data=expression_data, regressor_type='RF', regressor_kwargs=RF_KWARGS, gene_names=gene_names, tf_names=tf_names, client_or_address=client_or_address, limit=limit, seed=seed, verbose=verbose)
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=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...
3.068345
3.640249
0.842894
if verbose: print('preparing dask client') client, shutdown_callback = _prepare_client(client_or_address) try: if verbose: print('parsing input') expression_matrix, gene_names, tf_names = _prepare_input(expression_data, gene_names, tf_names) if verbose: ...
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 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...
2.446816
2.547292
0.960556
if client_or_address is None or str(client_or_address).lower() == 'local': local_cluster = LocalCluster(diagnostics_port=None) client = Client(local_cluster) def close_client_and_local_cluster(verbose=False): if verbose: print('shutting down client and loca...
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 provided.
2.304414
2.181644
1.056274
if isinstance(expression_data, pd.DataFrame): expression_matrix = expression_data.as_matrix() gene_names = list(expression_data.columns) else: expression_matrix = expression_data assert expression_matrix.shape[1] == len(gene_names) if tf_names is None: tf_names...
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 numpy.ndarray * a sparse scipy.sparse.csc_matrix :param gene_names: optional list...
1.997778
1.88868
1.057764
nonce = str(random.random()) timestamp = str(int(time.time()) * 1000) signature = hashlib.sha1((self._app_secret + nonce + timestamp).encode( 'utf-8')).hexdigest() return { "rc-app-key": self._app_key, "rc-nonce": nonce, "rc-times...
def _make_common_signature(self)
生成通用签名, 一般情况下,您不需要调用该方法 文档详见 http://docs.rongcloud.cn/server.html#_API_调用签名规则 :return: {'app-key':'xxx','nonce':'xxx','timestamp':'xxx','signature':'xxx'}
2.556696
2.337038
1.09399
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(kwargs['data'])) response = requests.request(method, url, verify=False, **kwargs) ...
def _http_call(self, url, method, **kwargs)
Makes a http call. Logs response information.
2.491228
2.410669
1.033418
urltype, methodname, content_type = method if urltype == 'SMS': url = self.sms_host else: url = self.api_host if content_type == 'application/json': data = json.dumps(params) else: data = self._filter_params(params) ...
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. :param timeout: (optional) Float describing the timeout of the request. :return:
2.746247
3.316746
0.827994
'''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: width = width * -1 if flop: height ...
def calculate_width_and_height(url_parts, options)
Appends width and height information to url
2.542941
2.437326
1.043332
'''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)
Returns the url for the specified options
4.961088
4.359052
1.138112
kwargs['notifierFactory'] = GrowlNotifier gntp.notifier.mini(description, **kwargs)
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
19.433245
25.160583
0.772369
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def create(self, chatRoomInfo)
创建聊天室方法 方法 @param chatRoomInfo:id:要创建的聊天室的id;name:要创建的聊天室的name。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
4.304917
3.82058
1.126771
desc = { "name": "ChatroomUserQueryReslut", "desc": " chatroomUserQuery 返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "total", "t...
def queryUser(self, chatroomId, count, order)
查询聊天室内用户方法 方法 @param chatroomId:要查询的聊天室 ID。(必传) @param count:要获取的聊天室成员数,上限为 500 ,超过 500 时最多返回 500 个成员。(必传) @param order:加入聊天室的先后顺序, 1 为加入时间正序, 2 为加入时间倒序。(必传) @return code:返回码,200 为正常。 @return total:聊天室中用户数。 @return users:聊天室成员列表。 @return errorMessage:错误信息。
2.620434
2.096291
1.250033
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def stopDistributionMessage(self, chatroomId)
聊天室消息停止分发方法(可实现控制对聊天室中消息是否进行分发,停止分发后聊天室中用户发送的消息,融云服务端不会再将消息发送给聊天室中其他用户。) 方法 @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
4.23459
3.334952
1.26976
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def addGagUser(self, userId, chatroomId, minute)
添加禁言聊天室成员方法(在 App 中如果不想让某一用户在聊天室中发言时,可将此用户在聊天室中禁言,被禁言用户可以接收查看聊天室中用户聊天信息,但不能发送消息.) 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @param minute:禁言时长,以分钟为单位,最大值为43200分钟。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
3.511684
2.928518
1.199133
desc = { "name": "CodeSuccessReslut", "desc": " http 成功返回结果", "fields": [{ "name": "code", "type": "Integer", "desc": "返回码,200 为正常。" }, { "name": "errorMessage", "type": "Str...
def rollbackBlockUser(self, userId, chatroomId)
移除封禁聊天室成员方法 方法 @param userId:用户 Id。(必传) @param chatroomId:聊天室 Id。(必传) @return code:返回码,200 为正常。 @return errorMessage:错误信息。
3.688819
3.167882
1.164443