Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
test_no_depre_without_epoch_end
(tmpdir)
Tests that only training_step can be used
Tests that only training_step can be used
def test_no_depre_without_epoch_end(tmpdir): """ Tests that only training_step can be used """ model = TestModel() model.validation_epoch_end = None trainer = Trainer( default_root_dir=tmpdir, limit_train_batches=2, limit_val_batches=2, max_epochs=2, log...
[ "def", "test_no_depre_without_epoch_end", "(", "tmpdir", ")", ":", "model", "=", "TestModel", "(", ")", "model", ".", "validation_epoch_end", "=", "None", "trainer", "=", "Trainer", "(", "default_root_dir", "=", "tmpdir", ",", "limit_train_batches", "=", "2", ",...
[ 29, 0 ]
[ 50, 64 ]
python
en
['en', 'error', 'th']
False
HpModels.__init__
(self)
Create an instance of the HpModels class.
Create an instance of the HpModels class.
def __init__(self): """Create an instance of the HpModels class.""" self.best_models = dict() self.threads_dict = dict()
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "best_models", "=", "dict", "(", ")", "self", ".", "threads_dict", "=", "dict", "(", ")" ]
[ 39, 4 ]
[ 42, 34 ]
python
en
['en', 'en', 'en']
True
HpModels.timed
(func)
Print the execution time for the decorated function.
Print the execution time for the decorated function.
def timed(func): """Print the execution time for the decorated function.""" @wraps(func) def wrapper(*args, **kwargs): start = time.time() result = func(*args, **kwargs) end = time.time() logger.debug( "{} for {} ran in {}s".format...
[ "def", "timed", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start", "=", "time", ".", "time", "(", ")", "result", "=", "func", "(", "*", "args", ",", "*", "*",...
[ 44, 4 ]
[ 59, 22 ]
python
en
['en', 'en', 'en']
True
HpModels.select_models
( LR: bool = True, LDA: bool = True, KNN: bool = True, SVC: bool = True )
Create a list which contains the tags of the models that are going to be tested for the best. :param LR: If True, appends the Logistic Regression model tag, defaults to True :type LR: bool, optional :param LDA: If True, appends the Linear Discriminant Analysis model tag, defaults to True ...
Create a list which contains the tags of the models that are going to be tested for the best.
def select_models( LR: bool = True, LDA: bool = True, KNN: bool = True, SVC: bool = True ) -> list: """Create a list which contains the tags of the models that are going to be tested for the best. :param LR: If True, appends the Logistic Regression model tag, defaults to True :type ...
[ "def", "select_models", "(", "LR", ":", "bool", "=", "True", ",", "LDA", ":", "bool", "=", "True", ",", "KNN", ":", "bool", "=", "True", ",", "SVC", ":", "bool", "=", "True", ")", "->", "list", ":", "models", "=", "[", "]", "if", "LR", ":", "...
[ 62, 4 ]
[ 89, 21 ]
python
en
['en', 'en', 'en']
True
HpModels.create_random_LR
( penalty: tuple = ("none", "l1", "l2", "elasticnet"), solver: tuple = ("liblinear", "sag", "saga", "newton-cg", "lbfgs"), max_iter: tuple = (100, 1000), C: tuple = (1e-5, 10), )
Create a Logistic Regression model using random hyperparameters. :param penalty: Tuple with the penalty hyperparameters, defaults to ("none", "l1", "l2", "elasticnet") :type penalty: tuple, optional :param solver: Tuple with the solver hyperparameters, defaults to ("liblinear", "sag", "saga", "...
Create a Logistic Regression model using random hyperparameters.
def create_random_LR( penalty: tuple = ("none", "l1", "l2", "elasticnet"), solver: tuple = ("liblinear", "sag", "saga", "newton-cg", "lbfgs"), max_iter: tuple = (100, 1000), C: tuple = (1e-5, 10), ) -> LogisticRegression: """Create a Logistic Regression model using random hyp...
[ "def", "create_random_LR", "(", "penalty", ":", "tuple", "=", "(", "\"none\"", ",", "\"l1\"", ",", "\"l2\"", ",", "\"elasticnet\"", ")", ",", "solver", ":", "tuple", "=", "(", "\"liblinear\"", ",", "\"sag\"", ",", "\"saga\"", ",", "\"newton-cg\"", ",", "\"...
[ 92, 4 ]
[ 117, 20 ]
python
en
['en', 'en', 'en']
True
HpModels.create_random_LDA
( solver: tuple = ("svd", "lsqr", "eigen"), shrinkage: tuple = ("auto", round(random.uniform(1e-5, 1), 5), "none"), tol: tuple = (1e-5, 1e-3), )
Create a Linear Discriminant model using random hyperparameters. :param solver: Tuple with the solver hyperparameters, defaults to ("svd", "lsqr", "eigen") :type solver: tuple, optional :param shrinkage: Tuple with the shrinkage hyperparameters, defaults to ("auto", round(random.uniform(1e-5, 1...
Create a Linear Discriminant model using random hyperparameters.
def create_random_LDA( solver: tuple = ("svd", "lsqr", "eigen"), shrinkage: tuple = ("auto", round(random.uniform(1e-5, 1), 5), "none"), tol: tuple = (1e-5, 1e-3), ) -> LinearDiscriminantAnalysis: """Create a Linear Discriminant model using random hyperparameters. :param sol...
[ "def", "create_random_LDA", "(", "solver", ":", "tuple", "=", "(", "\"svd\"", ",", "\"lsqr\"", ",", "\"eigen\"", ")", ",", "shrinkage", ":", "tuple", "=", "(", "\"auto\"", ",", "round", "(", "random", ".", "uniform", "(", "1e-5", ",", "1", ")", ",", ...
[ 120, 4 ]
[ 143, 20 ]
python
en
['en', 'en', 'en']
True
HpModels.create_random_KNN
( n_neighbors: tuple = (5, 200), weights: tuple = ("uniform", "distance"), algorithm: tuple = ("auto", "ball_tree", "kd_tree", "brute"), leaf_size: tuple = (15, 150), )
Create a K-nearest neighbors model using random hyperparameters. :param n_neighbors: Tuple with the number of neighbors hyperparameters, defaults to (5, 200) :type n_neighbors: tuple, optional :param weights: Tuple with the weights hyperparameters, defaults to ("uniform", "distance") :t...
Create a K-nearest neighbors model using random hyperparameters.
def create_random_KNN( n_neighbors: tuple = (5, 200), weights: tuple = ("uniform", "distance"), algorithm: tuple = ("auto", "ball_tree", "kd_tree", "brute"), leaf_size: tuple = (15, 150), ) -> KNeighborsClassifier: """Create a K-nearest neighbors model using random hyperparam...
[ "def", "create_random_KNN", "(", "n_neighbors", ":", "tuple", "=", "(", "5", ",", "200", ")", ",", "weights", ":", "tuple", "=", "(", "\"uniform\"", ",", "\"distance\"", ")", ",", "algorithm", ":", "tuple", "=", "(", "\"auto\"", ",", "\"ball_tree\"", ","...
[ 146, 4 ]
[ 171, 20 ]
python
en
['en', 'no', 'en']
True
HpModels.create_random_SVC
( kernel: tuple = ("linear", "poly", "rbf", "sigmoid", "precomputed"), gamma: tuple = ("scale", "auto"), C: tuple = (1e-5, 10), decision_function_shape: tuple = ("ovo", "ovr"), probability: bool = True, )
Create a Support Vector Machine model using random hyperparameters. :param kernel: Tuple with the kernel hyperparameters, defaults to ("linear", "poly", "rbf", "sigmoid", "precomputed") :type kernel: tuple, optional :param gamma: Tuple with the gamma hyperparameters, defaults to ("scale", "auto...
Create a Support Vector Machine model using random hyperparameters.
def create_random_SVC( kernel: tuple = ("linear", "poly", "rbf", "sigmoid", "precomputed"), gamma: tuple = ("scale", "auto"), C: tuple = (1e-5, 10), decision_function_shape: tuple = ("ovo", "ovr"), probability: bool = True, ) -> SVC: """Create a Support Vector Machine...
[ "def", "create_random_SVC", "(", "kernel", ":", "tuple", "=", "(", "\"linear\"", ",", "\"poly\"", ",", "\"rbf\"", ",", "\"sigmoid\"", ",", "\"precomputed\"", ")", ",", "gamma", ":", "tuple", "=", "(", "\"scale\"", ",", "\"auto\"", ")", ",", "C", ":", "tu...
[ 174, 4 ]
[ 203, 20 ]
python
en
['en', 'en', 'en']
True
HpModels.get_hyperparameters
(model: BaseEstimator, tag: str)
Return a pandas DataFrame with the hyperparameters of the given model. :param model: Model to get hyperparameters :type model: BaseEstimator :param tag: Name of the model to get hyperparameters :type tag: str :return: A pandas DataFrame with the hyperparameters used in the given...
Return a pandas DataFrame with the hyperparameters of the given model.
def get_hyperparameters(model: BaseEstimator, tag: str) -> pd.DataFrame: """Return a pandas DataFrame with the hyperparameters of the given model. :param model: Model to get hyperparameters :type model: BaseEstimator :param tag: Name of the model to get hyperparameters :type tag...
[ "def", "get_hyperparameters", "(", "model", ":", "BaseEstimator", ",", "tag", ":", "str", ")", "->", "pd", ".", "DataFrame", ":", "hp", "=", "dict", "(", ")", "all_hp", "=", "model", ".", "get_params", "(", ")", "if", "tag", "==", "\"LR\"", ":", "for...
[ 206, 4 ]
[ 241, 69 ]
python
en
['en', 'en', 'en']
True
HpModels.build_macro_model
( model: BaseEstimator, scaler: TransformerMixin = StandardScaler() )
Create a macro model pipeline using the given scaler. :param model: A model to use in the macro model pipeline :type model: BaseEstimator :param scaler: An scaler to preprocess de model, defaults to StandardScaler() :type scaler: TransformerMixin, optional :return: A macro model...
Create a macro model pipeline using the given scaler.
def build_macro_model( model: BaseEstimator, scaler: TransformerMixin = StandardScaler() ) -> Pipeline: """Create a macro model pipeline using the given scaler. :param model: A model to use in the macro model pipeline :type model: BaseEstimator :param scaler: An scaler to pr...
[ "def", "build_macro_model", "(", "model", ":", "BaseEstimator", ",", "scaler", ":", "TransformerMixin", "=", "StandardScaler", "(", ")", ")", "->", "Pipeline", ":", "macro_model", "=", "make_pipeline", "(", "scaler", ",", "model", ")", "return", "macro_model" ]
[ 244, 4 ]
[ 257, 26 ]
python
en
['en', 'en', 'en']
True
HpModels.random_model
(tag: str)
Wrapp the functions of create_random model. :param tag: String tag with the choosen model to be created :type tag: str :return: The selected model with random hyperparameters. :rtype: BaseEstimator
Wrapp the functions of create_random model.
def random_model(tag: str) -> BaseEstimator: """Wrapp the functions of create_random model. :param tag: String tag with the choosen model to be created :type tag: str :return: The selected model with random hyperparameters. :rtype: BaseEstimator """ if tag == "LR...
[ "def", "random_model", "(", "tag", ":", "str", ")", "->", "BaseEstimator", ":", "if", "tag", "==", "\"LR\"", ":", "model", "=", "HpModels", ".", "create_random_LR", "(", ")", "if", "tag", "==", "\"LDA\"", ":", "model", "=", "HpModels", ".", "create_rando...
[ 260, 4 ]
[ 276, 20 ]
python
en
['en', 'en', 'en']
True
HpModels.perform_optimizing_model
( self, tag, X: np.ndarray, t: np.ndarray, train_size: float = 0.85, scoring: dict = { "accuracy": "accuracy", "recall": "recall", "specificity": make_scorer(recall_score, pos_label=0), "precision": "precision", ...
Optimize hyperparameters of the given model and returns the best of them using cross validation. :param tag: model to be evaluated. :type tag: str :param X: Characteristic matrix numpy array of the dataset which will be evaluated :type X: np.ndarray :param t: Vector labels nump...
Optimize hyperparameters of the given model and returns the best of them using cross validation.
def perform_optimizing_model( self, tag, X: np.ndarray, t: np.ndarray, train_size: float = 0.85, scoring: dict = { "accuracy": "accuracy", "recall": "recall", "specificity": make_scorer(recall_score, pos_label=0), "precision...
[ "def", "perform_optimizing_model", "(", "self", ",", "tag", ",", "X", ":", "np", ".", "ndarray", ",", "t", ":", "np", ".", "ndarray", ",", "train_size", ":", "float", "=", "0.85", ",", "scoring", ":", "dict", "=", "{", "\"accuracy\"", ":", "\"accuracy\...
[ 279, 4 ]
[ 344, 9 ]
python
en
['en', 'en', 'en']
True
HpModels.optimizing_models
(self, models: list, *args, **kwargs)
Log the time of the perform_optimizing_model method. :param models: List containing the tags to identify each model. :type models: list :return: A tuple containing the return of the called function and its time log. :rtype: tuple
Log the time of the perform_optimizing_model method.
def optimizing_models(self, models: list, *args, **kwargs) -> tuple: """Log the time of the perform_optimizing_model method. :param models: List containing the tags to identify each model. :type models: list :return: A tuple containing the return of the called function and its time log....
[ "def", "optimizing_models", "(", "self", ",", "models", ":", "list", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "tuple", ":", "time_models", "=", "dict", "(", ")", "for", "tag", "in", "models", ":", "time_models", "[", "tag", "]", "=", "...
[ 346, 4 ]
[ 361, 9 ]
python
en
['en', 'en', 'en']
True
HpModels.perform_optimizing_models_multithread
( self, tag:str, X: np.ndarray, t: np.ndarray, train_size: float = 0.85, scoring: dict = { "accuracy": "accuracy", "recall": "recall", "specificity": make_scorer(recall_score, pos_label=0), "precision": "precision", ...
Optimize hyperparameters of the given model and returns the best of them using cross validation and multithreading. :param tag: model to be evaluated. :type tag: str :param X: Characteristic matrix numpy array of the dataset which will be evaluated :type X: np.ndarray :param t: ...
Optimize hyperparameters of the given model and returns the best of them using cross validation and multithreading.
def perform_optimizing_models_multithread( self, tag:str, X: np.ndarray, t: np.ndarray, train_size: float = 0.85, scoring: dict = { "accuracy": "accuracy", "recall": "recall", "specificity": make_scorer(recall_score, pos_label=0), ...
[ "def", "perform_optimizing_models_multithread", "(", "self", ",", "tag", ":", "str", ",", "X", ":", "np", ".", "ndarray", ",", "t", ":", "np", ".", "ndarray", ",", "train_size", ":", "float", "=", "0.85", ",", "scoring", ":", "dict", "=", "{", "\"accur...
[ 364, 4 ]
[ 440, 13 ]
python
en
['en', 'en', 'en']
True
HpModels.optimizing_models_multithread
(self, models: list, *args, **kwargs)
Log the time of the perform_optimizing_models_multithread method. :param models: List containing the tags to identify each model. :type models: list :return: A tuple containing the return of the called function and its time log. :rtype: tuple
Log the time of the perform_optimizing_models_multithread method.
def optimizing_models_multithread(self, models: list, *args, **kwargs) -> tuple: """Log the time of the perform_optimizing_models_multithread method. :param models: List containing the tags to identify each model. :type models: list :return: A tuple containing the return of the called f...
[ "def", "optimizing_models_multithread", "(", "self", ",", "models", ":", "list", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "tuple", ":", "time_models", "=", "dict", "(", ")", "for", "tag", "in", "models", ":", "time_models", "[", "tag", "]"...
[ 442, 4 ]
[ 458, 9 ]
python
en
['en', 'en', 'en']
True
run_test_from_config
(trainer_options, on_gpu, check_size=True)
Trains the default model with the given config.
Trains the default model with the given config.
def run_test_from_config(trainer_options, on_gpu, check_size=True): """Trains the default model with the given config.""" set_random_master_port() reset_seed() ckpt_path = trainer_options['weights_save_path'] trainer_options.update(callbacks=[ModelCheckpoint(dirpath=ckpt_path)]) model = Boring...
[ "def", "run_test_from_config", "(", "trainer_options", ",", "on_gpu", ",", "check_size", "=", "True", ")", ":", "set_random_master_port", "(", ")", "reset_seed", "(", ")", "ckpt_path", "=", "trainer_options", "[", "'weights_save_path'", "]", "trainer_options", ".", ...
[ 46, 0 ]
[ 88, 51 ]
python
en
['en', 'en', 'en']
True
load_checkpoint
(model, filename, map_location='cpu', strict=False, logger=None)
Load checkpoint from a file or URI. Args: model (Module): Module to load checkpoint. filename (str): Accept local filepath, URL, ``torchvision://xxx``, ``open-mmlab://xxx``. map_location (str): Same as :func:`torch.load`. strict (bool): Whether to allow different params ...
Load checkpoint from a file or URI.
def load_checkpoint(model, filename, map_location='cpu', strict=False, logger=None): """Load checkpoint from a file or URI. Args: model (Module): Module to load checkpoint. filename (str): Accept local filepath, URL...
[ "def", "load_checkpoint", "(", "model", ",", "filename", ",", "map_location", "=", "'cpu'", ",", "strict", "=", "False", ",", "logger", "=", "None", ")", ":", "checkpoint", "=", "_load_checkpoint", "(", "filename", ",", "map_location", ")", "# OrderedDict is a...
[ 5, 0 ]
[ 48, 21 ]
python
en
['en', 'en', 'en']
True
get_state_dict
(filename, map_location='cpu')
Get state_dict from a file or URI. Args: filename (str): Accept local filepath, URL, ``torchvision://xxx``, ``open-mmlab://xxx``. map_location (str): Same as :func:`torch.load`. Returns: OrderedDict: The state_dict.
Get state_dict from a file or URI.
def get_state_dict(filename, map_location='cpu'): """Get state_dict from a file or URI. Args: filename (str): Accept local filepath, URL, ``torchvision://xxx``, ``open-mmlab://xxx``. map_location (str): Same as :func:`torch.load`. Returns: OrderedDict: The state_dict. ...
[ "def", "get_state_dict", "(", "filename", ",", "map_location", "=", "'cpu'", ")", ":", "checkpoint", "=", "_load_checkpoint", "(", "filename", ",", "map_location", ")", "# OrderedDict is a subclass of dict", "if", "not", "isinstance", "(", "checkpoint", ",", "dict",...
[ 51, 0 ]
[ 85, 21 ]
python
en
['en', 'en', 'en']
True
check_auth
(email, api_token)
Decodes the auth token for api request :param email: :param api_token: :return: integer
Decodes the auth token for api request :param email: :param api_token: :return: integer
def check_auth(email, api_token): """ Decodes the auth token for api request :param email: :param api_token: :return: integer """ res = users.User.decode_api_auth_token(api_token) if isinstance(res, str): return 0 else: return res.email == email
[ "def", "check_auth", "(", "email", ",", "api_token", ")", ":", "res", "=", "users", ".", "User", ".", "decode_api_auth_token", "(", "api_token", ")", "if", "isinstance", "(", "res", ",", "str", ")", ":", "return", "0", "else", ":", "return", "res", "."...
[ 6, 0 ]
[ 17, 33 ]
python
en
['en', 'error', 'th']
False
requires_auth
(f)
auth for api request :return: function object
auth for api request :return: function object
def requires_auth(f): """ auth for api request :return: function object """ @wraps(f) def decorated(*args, **kwargs): auth = request.authorization if not auth or not check_auth(auth.username, auth.password): abort(401) return f(*args, **kwargs) return dec...
[ "def", "requires_auth", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "decorated", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "auth", "=", "request", ".", "authorization", "if", "not", "auth", "or", "not", "check_auth", "(", "au...
[ 20, 0 ]
[ 31, 20 ]
python
en
['en', 'error', 'th']
False
NoValue.__repr__
(self)
Ensure __repr__ is a consistent value in case NoValue is used to fill another cache key.
Ensure __repr__ is a consistent value in case NoValue is used to fill another cache key.
def __repr__(self): """Ensure __repr__ is a consistent value in case NoValue is used to fill another cache key. """ return '<dogpile.cache.api.NoValue object>'
[ "def", "__repr__", "(", "self", ")", ":", "return", "'<dogpile.cache.api.NoValue object>'" ]
[ 15, 4 ]
[ 20, 51 ]
python
en
['en', 'en', 'en']
True
CacheBackend.__init__
(self, arguments)
Construct a new :class:`.CacheBackend`. Subclasses should override this to handle the given arguments. :param arguments: The ``arguments`` parameter passed to :func:`.make_registry`.
Construct a new :class:`.CacheBackend`.
def __init__(self, arguments): # pragma NO COVERAGE """Construct a new :class:`.CacheBackend`. Subclasses should override this to handle the given arguments. :param arguments: The ``arguments`` parameter passed to :func:`.make_registry`. """ raise NotImplemen...
[ "def", "__init__", "(", "self", ",", "arguments", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 70, 4 ]
[ 80, 35 ]
python
en
['en', 'lb', 'en']
True
CacheBackend.get_mutex
(self, key)
Return an optional mutexing object for the given key. This object need only provide an ``acquire()`` and ``release()`` method. May return ``None``, in which case the dogpile lock will use a regular ``threading.Lock`` object to mutex concurrent threads for value creation...
Return an optional mutexing object for the given key.
def get_mutex(self, key): """Return an optional mutexing object for the given key. This object need only provide an ``acquire()`` and ``release()`` method. May return ``None``, in which case the dogpile lock will use a regular ``threading.Lock`` object to mutex concurre...
[ "def", "get_mutex", "(", "self", ",", "key", ")", ":", "return", "None" ]
[ 96, 4 ]
[ 127, 19 ]
python
en
['en', 'en', 'en']
True
CacheBackend.get
(self, key)
Retrieve a value from the cache. The returned value should be an instance of :class:`.CachedValue`, or ``NO_VALUE`` if not present.
Retrieve a value from the cache.
def get(self, key): # pragma NO COVERAGE """Retrieve a value from the cache. The returned value should be an instance of :class:`.CachedValue`, or ``NO_VALUE`` if not present. """ raise NotImplementedError()
[ "def", "get", "(", "self", ",", "key", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 129, 4 ]
[ 137, 35 ]
python
en
['en', 'en', 'en']
True
CacheBackend.get_multi
(self, keys)
Retrieve multiple values from the cache. The returned value should be a list, corresponding to the list of keys given. .. versionadded:: 0.5.0
Retrieve multiple values from the cache.
def get_multi(self, keys): # pragma NO COVERAGE """Retrieve multiple values from the cache. The returned value should be a list, corresponding to the list of keys given. .. versionadded:: 0.5.0 """ raise NotImplementedError()
[ "def", "get_multi", "(", "self", ",", "keys", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 139, 4 ]
[ 148, 35 ]
python
en
['en', 'en', 'en']
True
CacheBackend.set
(self, key, value)
Set a value in the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of :class:`.CachedValue`.
Set a value in the cache.
def set(self, key, value): # pragma NO COVERAGE """Set a value in the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of :class:`.CachedValue`. """ raise ...
[ "def", "set", "(", "self", ",", "key", ",", "value", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 150, 4 ]
[ 160, 35 ]
python
en
['en', 'en', 'en']
True
CacheBackend.set_multi
(self, mapping)
Set multiple values in the cache. ``mapping`` is a dict in which the key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of :class:`.CachedValue`. When implementing a new :class:...
Set multiple values in the cache.
def set_multi(self, mapping): # pragma NO COVERAGE """Set multiple values in the cache. ``mapping`` is a dict in which the key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of ...
[ "def", "set_multi", "(", "self", ",", "mapping", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 162, 4 ]
[ 183, 35 ]
python
en
['en', 'en', 'en']
True
CacheBackend.delete
(self, key)
Delete a value from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists. ...
Delete a value from the cache.
def delete(self, key): # pragma NO COVERAGE """Delete a value from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number of times ...
[ "def", "delete", "(", "self", ",", "key", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 185, 4 ]
[ 197, 35 ]
python
en
['en', 'en', 'en']
True
CacheBackend.delete_multi
(self, keys)
Delete multiple values from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key ...
Delete multiple values from the cache.
def delete_multi(self, keys): # pragma NO COVERAGE """Delete multiple values from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number...
[ "def", "delete_multi", "(", "self", ",", "keys", ")", ":", "# pragma NO COVERAGE", "raise", "NotImplementedError", "(", ")" ]
[ 199, 4 ]
[ 214, 35 ]
python
en
['en', 'en', 'en']
True
recursive_detach
(in_dict: dict, to_cpu: bool = False)
Detach all tensors in `in_dict`. May operate recursively if some of the values in `in_dict` are dictionaries which contain instances of `torch.Tensor`. Other types in `in_dict` are not affected by this utility function. Args: in_dict: Dictionary with tensors to detach to_cpu: Whether t...
Detach all tensors in `in_dict`.
def recursive_detach(in_dict: dict, to_cpu: bool = False) -> dict: """Detach all tensors in `in_dict`. May operate recursively if some of the values in `in_dict` are dictionaries which contain instances of `torch.Tensor`. Other types in `in_dict` are not affected by this utility function. Args: ...
[ "def", "recursive_detach", "(", "in_dict", ":", "dict", ",", "to_cpu", ":", "bool", "=", "False", ")", "->", "dict", ":", "out_dict", "=", "{", "}", "for", "k", ",", "v", "in", "in_dict", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ...
[ 19, 0 ]
[ 42, 19 ]
python
en
['en', 'nl', 'it']
False
garbage_collection_cuda
()
Garbage collection Torch (CUDA) memory.
Garbage collection Torch (CUDA) memory.
def garbage_collection_cuda(): """Garbage collection Torch (CUDA) memory.""" gc.collect() if torch.cuda.is_available(): torch.cuda.empty_cache()
[ "def", "garbage_collection_cuda", "(", ")", ":", "gc", ".", "collect", "(", ")", "if", "torch", ".", "cuda", ".", "is_available", "(", ")", ":", "torch", ".", "cuda", ".", "empty_cache", "(", ")" ]
[ 74, 0 ]
[ 78, 32 ]
python
en
['en', 'en', 'en']
True
JsmRestClient.get_agent
(self, username='.', start_at=0, max_results=1000, include_active=True, include_inactive=False)
Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "." - search for all users. :param start_at: the index of the first user to return (0-based). :param max_r...
Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "." - search for all users. :param start_at: the index of the first user to return (0-based). :param max_r...
def get_agent(self, username='.', start_at=0, max_results=1000, include_active=True, include_inactive=False): """ Returns a list of users that match the search string. This resource cannot be accessed anonymously. :param username: A query string used to search username, name or e-mail address. "...
[ "def", "get_agent", "(", "self", ",", "username", "=", "'.'", ",", "start_at", "=", "0", ",", "max_results", "=", "1000", ",", "include_active", "=", "True", ",", "include_inactive", "=", "False", ")", ":", "loop_count", "=", "max_results", "//", "BATCH_SI...
[ 7, 4 ]
[ 37, 25 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.create_customer
(self, email=None, full_name=None)
Creates a customer that is not associated with a service desk project. :param email :param full_name
Creates a customer that is not associated with a service desk project. :param email :param full_name
def create_customer(self, email=None, full_name=None): """ Creates a customer that is not associated with a service desk project. :param email :param full_name """ api_url = self.host + "/rest/servicedeskapi/customer" payload = { "email": email, ...
[ "def", "create_customer", "(", "self", ",", "email", "=", "None", ",", "full_name", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+", "\"/rest/servicedeskapi/customer\"", "payload", "=", "{", "\"email\"", ":", "email", ",", "\"fullName\"", ":"...
[ 39, 4 ]
[ 53, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.create_request
(self, service_desk_id: int, request_type_id: int, request_fields_values: dict, request_participants: list, raise_on_behalf_of: str)
Creates a customer request in a service desk. :param service_desk_id: :param request_type_id: :param request_fields_values: :param request_participants: :param raise_on_behalf_of: :return:
Creates a customer request in a service desk. :param service_desk_id: :param request_type_id: :param request_fields_values: :param request_participants: :param raise_on_behalf_of: :return:
def create_request(self, service_desk_id: int, request_type_id: int, request_fields_values: dict, request_participants: list, raise_on_behalf_of: str): """ Creates a customer request in a service desk. :param service_desk_id: :param request_type_id: :param ...
[ "def", "create_request", "(", "self", ",", "service_desk_id", ":", "int", ",", "request_type_id", ":", "int", ",", "request_fields_values", ":", "dict", ",", "request_participants", ":", "list", ",", "raise_on_behalf_of", ":", "str", ")", ":", "api_url", "=", ...
[ 55, 4 ]
[ 77, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_request
(self, start_at: int = 0, max_results: int = 100, auth: tuple = None, issue_id_or_key: str = '')
Returns the customer request for a given request Id/key. :param issue_id_or_key: :param auth: :param start_at: :param max_results: :return:
Returns the customer request for a given request Id/key. :param issue_id_or_key: :param auth: :param start_at: :param max_results: :return:
def get_request(self, start_at: int = 0, max_results: int = 100, auth: tuple = None, issue_id_or_key: str = ''): """ Returns the customer request for a given request Id/key. :param issue_id_or_key: :param auth: :param start_at: :param max_results: :return: ...
[ "def", "get_request", "(", "self", ",", "start_at", ":", "int", "=", "0", ",", "max_results", ":", "int", "=", "100", ",", "auth", ":", "tuple", "=", "None", ",", "issue_id_or_key", ":", "str", "=", "''", ")", ":", "BATCH_REQUEST_SIZE", "=", "100", "...
[ 79, 4 ]
[ 117, 23 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_queue
(self, service_desk_id: int, start: int = 0)
Returns the customer request for a given request Id/key. :param service_desk_id: :param start: the index of the first user to return (0-based). :return:
Returns the customer request for a given request Id/key. :param service_desk_id: :param start: the index of the first user to return (0-based). :return:
def get_queue(self, service_desk_id: int, start: int = 0): """ Returns the customer request for a given request Id/key. :param service_desk_id: :param start: the index of the first user to return (0-based). :return: """ api_url = self.host + f"/rest/servicedeskapi...
[ "def", "get_queue", "(", "self", ",", "service_desk_id", ":", "int", ",", "start", ":", "int", "=", "0", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/servicedesk/{service_desk_id}/queue?start={start}\"", "response", "=", "self", "."...
[ 119, 4 ]
[ 128, 40 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_request_types
(self, service_desk_id)
Returns all request types from a service desk, for a given service desk Id. :param service_desk_id: :return:
Returns all request types from a service desk, for a given service desk Id. :param service_desk_id: :return:
def get_request_types(self, service_desk_id): """ Returns all request types from a service desk, for a given service desk Id. :param service_desk_id: :return: """ api_url = self.host + f"/rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype" response = se...
[ "def", "get_request_types", "(", "self", ",", "service_desk_id", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype\"", "response", "=", "self", ".", "get", "(", "api_url", ",", "f\"Could not get reques...
[ 130, 4 ]
[ 138, 40 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_request_type_fields
(self, service_desk_id, request_type_id)
Returns the fields for a request type, for a given request type Id and service desk Id. These are the fields that are required to create a customer request of that particular request type. :param service_desk_id: :param request_type_id: :return:
Returns the fields for a request type, for a given request type Id and service desk Id. These are the fields that are required to create a customer request of that particular request type. :param service_desk_id: :param request_type_id: :return:
def get_request_type_fields(self, service_desk_id, request_type_id): """ Returns the fields for a request type, for a given request type Id and service desk Id. These are the fields that are required to create a customer request of that particular request type. :param service_desk_id: ...
[ "def", "get_request_type_fields", "(", "self", ",", "service_desk_id", ",", "request_type_id", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/servicedesk/{service_desk_id}/requesttype/{request_type_id}/field\"", "response", "=", "self", ".", "g...
[ 140, 4 ]
[ 151, 51 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_all_service_desks
(self)
Returns all service desks in the Jira Service Desk application. :return:
Returns all service desks in the Jira Service Desk application. :return:
def get_all_service_desks(self): """ Returns all service desks in the Jira Service Desk application. :return: """ start = 0 limit = 100 finished = False results = [] while not finished: api_url = self.host + f"/rest/servicedeskapi/servi...
[ "def", "get_all_service_desks", "(", "self", ")", ":", "start", "=", "0", "limit", "=", "100", "finished", "=", "False", "results", "=", "[", "]", "while", "not", "finished", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/servicedesk...
[ 153, 4 ]
[ 170, 22 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_servicedesk_info
(self)
This resource represents the Jira Service Desk application. :return:
This resource represents the Jira Service Desk application. :return:
def get_servicedesk_info(self): """ This resource represents the Jira Service Desk application. :return: """ api_url = self.host + "/rest/servicedeskapi/info" response = self.get(api_url, "Could not get request Service desk info.") return response
[ "def", "get_servicedesk_info", "(", "self", ")", ":", "api_url", "=", "self", ".", "host", "+", "\"/rest/servicedeskapi/info\"", "response", "=", "self", ".", "get", "(", "api_url", ",", "\"Could not get request Service desk info.\"", ")", "return", "response" ]
[ 172, 4 ]
[ 179, 23 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.attach_temp_files
(self, service_desk_id, file_paths: dict, auth: tuple = None)
Create one or more temporary attachments, which can later be converted into permanent attachments on Create attachment. :param service_desk_id: :param file_paths: :param auth: :return:
Create one or more temporary attachments, which can later be converted into permanent attachments on Create attachment. :param service_desk_id: :param file_paths: :param auth: :return:
def attach_temp_files(self, service_desk_id, file_paths: dict, auth: tuple = None): """ Create one or more temporary attachments, which can later be converted into permanent attachments on Create attachment. :param service_desk_id: :param file_paths: :param auth: ...
[ "def", "attach_temp_files", "(", "self", ",", "service_desk_id", ",", "file_paths", ":", "dict", ",", "auth", ":", "tuple", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/servicedesk/{service_desk_id}/attachTemporaryFile\"", ...
[ 196, 4 ]
[ 209, 54 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.create_attachments
(self, issue_id_or_key: str, temporary_attachment_ids: list, public: bool = True, additional_comment: str = "", auth: tuple = None)
Adds one or more temporary attachments that were created using Attach temporary file to a customer request. The attachment visibility is set by the public field. :param issue_id_or_key :param temporary_attachment_ids: :param public: :param additional_comment: :pa...
Adds one or more temporary attachments that were created using Attach temporary file to a customer request. The attachment visibility is set by the public field. :param issue_id_or_key :param temporary_attachment_ids: :param public: :param additional_comment: :pa...
def create_attachments(self, issue_id_or_key: str, temporary_attachment_ids: list, public: bool = True, additional_comment: str = "", auth: tuple = None): """ Adds one or more temporary attachments that were created using Attach temporary file to a customer request. Th...
[ "def", "create_attachments", "(", "self", ",", "issue_id_or_key", ":", "str", ",", "temporary_attachment_ids", ":", "list", ",", "public", ":", "bool", "=", "True", ",", "additional_comment", ":", "str", "=", "\"\"", ",", "auth", ":", "tuple", "=", "None", ...
[ 211, 4 ]
[ 232, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.create_comment
(self, issue_id_or_key: str, public: bool = True, text: str = "", auth: tuple = None)
This resource represents the comments on a customer request. :param issue_id_or_key: :param public: :param text: :param auth: :return:
This resource represents the comments on a customer request. :param issue_id_or_key: :param public: :param text: :param auth: :return:
def create_comment(self, issue_id_or_key: str, public: bool = True, text: str = "", auth: tuple = None): """ This resource represents the comments on a customer request. :param issue_id_or_key: :param public: :param text: :param auth: :return: """ ...
[ "def", "create_comment", "(", "self", ",", "issue_id_or_key", ":", "str", ",", "public", ":", "bool", "=", "True", ",", "text", ":", "str", "=", "\"\"", ",", "auth", ":", "tuple", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\...
[ 234, 4 ]
[ 251, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_request_transactions
(self, issue_id_or_key: str, auth: tuple = None)
Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return:
Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return:
def get_request_transactions(self, issue_id_or_key: str, auth: tuple = None): """ Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return: """ api_url = self.host + f"/rest/servicedeskapi/request/{issue...
[ "def", "get_request_transactions", "(", "self", ",", "issue_id_or_key", ":", "str", ",", "auth", ":", "tuple", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/request/{issue_id_or_key}/transition\"", "jsm_headers", "=", "JSM...
[ 253, 4 ]
[ 265, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.request_transition
(self, issue_id_or_key: str, transition_id: str, additional_comment: str = None, auth: tuple = None)
Perform a customer transition for a given request and transition ID. An optional comment can be included to provide a reason for the transition. :param issue_id_or_key: :param transition_id: :param additional_comment: :param auth: :return:
Perform a customer transition for a given request and transition ID. An optional comment can be included to provide a reason for the transition. :param issue_id_or_key: :param transition_id: :param additional_comment: :param auth: :return:
def request_transition(self, issue_id_or_key: str, transition_id: str, additional_comment: str = None, auth: tuple = None): """ Perform a customer transition for a given request and transition ID. An optional comment can be included to provide a reason for the transiti...
[ "def", "request_transition", "(", "self", ",", "issue_id_or_key", ":", "str", ",", "transition_id", ":", "str", ",", "additional_comment", ":", "str", "=", "None", ",", "auth", ":", "tuple", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+"...
[ 267, 4 ]
[ 288, 23 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_request_status
(self, issue_id_or_key: str, auth: tuple = None)
Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return:
Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return:
def get_request_status(self, issue_id_or_key: str, auth: tuple = None): """ Returns a list of transitions that customers can perform on the request. :param issue_id_or_key: :param auth: :return: """ api_url = self.host + f"/rest/servicedeskapi/request/{issue_id_or...
[ "def", "get_request_status", "(", "self", ",", "issue_id_or_key", ":", "str", ",", "auth", ":", "tuple", "=", "None", ")", ":", "api_url", "=", "self", ".", "host", "+", "f\"/rest/servicedeskapi/request/{issue_id_or_key}/status\"", "jsm_headers", "=", "JSM_EXPERIMEN...
[ 290, 4 ]
[ 302, 30 ]
python
en
['en', 'error', 'th']
False
JsmRestClient.get_all_organizations
(self, max_count: int = None, auth: tuple = None)
Get all organizations :param max_count: :param auth: :return:
Get all organizations :param max_count: :param auth: :return:
def get_all_organizations(self, max_count: int = None, auth: tuple = None): """ Get all organizations :param max_count: :param auth: :return: """ jsm_headers = JSM_EXPERIMENTAL_HEADERS start = 0 limit = 50 finished = False results ...
[ "def", "get_all_organizations", "(", "self", ",", "max_count", ":", "int", "=", "None", ",", "auth", ":", "tuple", "=", "None", ")", ":", "jsm_headers", "=", "JSM_EXPERIMENTAL_HEADERS", "start", "=", "0", "limit", "=", "50", "finished", "=", "False", "resu...
[ 304, 4 ]
[ 328, 22 ]
python
en
['en', 'error', 'th']
False
bitname
(obj)
Return a bit-width name for a given type object
Return a bit-width name for a given type object
def bitname(obj): """Return a bit-width name for a given type object""" bits = _bits_of(obj) dt = dtype(obj) char = dt.kind base = _kind_name(dt) if base == 'object': bits = 0 if bits != 0: char = "%s%d" % (char, bits // 8) return base, bits, char
[ "def", "bitname", "(", "obj", ")", ":", "bits", "=", "_bits_of", "(", "obj", ")", "dt", "=", "dtype", "(", "obj", ")", "char", "=", "dt", ".", "kind", "base", "=", "_kind_name", "(", "dt", ")", "if", "base", "==", "'object'", ":", "bits", "=", ...
[ 78, 0 ]
[ 91, 27 ]
python
en
['en', 'en', 'en']
True
_cmd
(cmd, show_cmd=False, quiet=False)
Executes a subprocess running a shell command and returns the output.
Executes a subprocess running a shell command and returns the output.
def _cmd(cmd, show_cmd=False, quiet=False): """Executes a subprocess running a shell command and returns the output.""" if show_cmd: print() print("$", cmd) if quiet: proc = subprocess.Popen( cmd, stdout=subprocess.PIPE, stderr=subprocess.STDO...
[ "def", "_cmd", "(", "cmd", ",", "show_cmd", "=", "False", ",", "quiet", "=", "False", ")", ":", "if", "show_cmd", ":", "print", "(", ")", "print", "(", "\"$\"", ",", "cmd", ")", "if", "quiet", ":", "proc", "=", "subprocess", ".", "Popen", "(", "c...
[ 192, 0 ]
[ 218, 14 ]
python
en
['en', 'en', 'en']
True
_precompute_representation
( features: sp.csr_matrix, feature_embeddings: np.ndarray, feature_biases: np.ndarray)
:param: features csr_matrix [n_objects, n_features] :param: feature_embeddings np.ndarray(float) [n_features, no_component] :param: feature_biases np.ndarray(float) [n_features] :return: TODO: tuple of - representation np.ndarray(float) [n_objects, no_component+...
:param: features csr_matrix [n_objects, n_features] :param: feature_embeddings np.ndarray(float) [n_features, no_component] :param: feature_biases np.ndarray(float) [n_features]
def _precompute_representation( features: sp.csr_matrix, feature_embeddings: np.ndarray, feature_biases: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: """ :param: features csr_matrix [n_objects, n_features] :param: feature_embeddings np.ndarray(float) [n_features, ...
[ "def", "_precompute_representation", "(", "features", ":", "sp", ".", "csr_matrix", ",", "feature_embeddings", ":", "np", ".", "ndarray", ",", "feature_biases", ":", "np", ".", "ndarray", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndar...
[ 68, 0 ]
[ 86, 46 ]
python
en
['en', 'error', 'th']
False
_get_top_k_scores
(scores: np.ndarray, k: int, item_ids: np.ndarray)
:return: indices of items, top_k scores. All in score decreasing order.
:return: indices of items, top_k scores. All in score decreasing order.
def _get_top_k_scores(scores: np.ndarray, k: int, item_ids: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: """ :return: indices of items, top_k scores. All in score decreasing order. """ if k: top_indices = np.argpartition(scores, -k)[-k:] scores = scores[top_indices] sorted_top_...
[ "def", "_get_top_k_scores", "(", "scores", ":", "np", ".", "ndarray", ",", "k", ":", "int", ",", "item_ids", ":", "np", ".", "ndarray", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", "]", ":", "if", "k", ":", "top_indices...
[ 89, 0 ]
[ 106, 30 ]
python
en
['en', 'error', 'th']
False
_batch_predict_for_user
(user_id: int, top_k: int=50, chunk_id: int=None, item_ids=None)
:return: indices of items, top_k scores. All in score decreasing order.
:return: indices of items, top_k scores. All in score decreasing order.
def _batch_predict_for_user(user_id: int, top_k: int=50, chunk_id: int=None, item_ids=None) -> Tuple[np.ndarray, np.ndarray]: """ :return: indices of items, top_k scores. All in score decreasing order. """ # exclude biases from repr (last column of user_repr and last row of transposed item repr) use...
[ "def", "_batch_predict_for_user", "(", "user_id", ":", "int", ",", "top_k", ":", "int", "=", "50", ",", "chunk_id", ":", "int", "=", "None", ",", "item_ids", "=", "None", ")", "->", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", "]", ...
[ 109, 0 ]
[ 131, 64 ]
python
en
['en', 'error', 'th']
False
_use_unicode
(*args)
Helper function for determining the output type of some string operations. For an operation on two ndarrays, if at least one is unicode, the result should be unicode.
Helper function for determining the output type of some string operations.
def _use_unicode(*args): """ Helper function for determining the output type of some string operations. For an operation on two ndarrays, if at least one is unicode, the result should be unicode. """ for x in args: if (isinstance(x, _unicode) or issubclass(numpy.asar...
[ "def", "_use_unicode", "(", "*", "args", ")", ":", "for", "x", "in", "args", ":", "if", "(", "isinstance", "(", "x", ",", "_unicode", ")", "or", "issubclass", "(", "numpy", ".", "asarray", "(", "x", ")", ".", "dtype", ".", "type", ",", "unicode_", ...
[ 56, 0 ]
[ 68, 18 ]
python
en
['en', 'error', 'th']
False
_to_string_or_unicode_array
(result)
Helper function to cast a result back into a string or unicode array if an object array must be used as an intermediary.
Helper function to cast a result back into a string or unicode array if an object array must be used as an intermediary.
def _to_string_or_unicode_array(result): """ Helper function to cast a result back into a string or unicode array if an object array must be used as an intermediary. """ return numpy.asarray(result.tolist())
[ "def", "_to_string_or_unicode_array", "(", "result", ")", ":", "return", "numpy", ".", "asarray", "(", "result", ".", "tolist", "(", ")", ")" ]
[ 70, 0 ]
[ 75, 41 ]
python
en
['en', 'error', 'th']
False
_clean_args
(*args)
Helper function for delegating arguments to Python string functions. Many of the Python string operations that have optional arguments do not use 'None' to indicate a default value. In these cases, we need to remove all `None` arguments, and those following them.
Helper function for delegating arguments to Python string functions.
def _clean_args(*args): """ Helper function for delegating arguments to Python string functions. Many of the Python string operations that have optional arguments do not use 'None' to indicate a default value. In these cases, we need to remove all `None` arguments, and those following them. ...
[ "def", "_clean_args", "(", "*", "args", ")", ":", "newargs", "=", "[", "]", "for", "chk", "in", "args", ":", "if", "chk", "is", "None", ":", "break", "newargs", ".", "append", "(", "chk", ")", "return", "newargs" ]
[ 77, 0 ]
[ 91, 18 ]
python
en
['en', 'error', 'th']
False
_get_num_chars
(a)
Helper function that returns the number of characters per field in a string or unicode array. This is to abstract out the fact that for a unicode array this is itemsize / 4.
Helper function that returns the number of characters per field in a string or unicode array. This is to abstract out the fact that for a unicode array this is itemsize / 4.
def _get_num_chars(a): """ Helper function that returns the number of characters per field in a string or unicode array. This is to abstract out the fact that for a unicode array this is itemsize / 4. """ if issubclass(a.dtype.type, unicode_): return a.itemsize // 4 return a.itemsiz...
[ "def", "_get_num_chars", "(", "a", ")", ":", "if", "issubclass", "(", "a", ".", "dtype", ".", "type", ",", "unicode_", ")", ":", "return", "a", ".", "itemsize", "//", "4", "return", "a", ".", "itemsize" ]
[ 93, 0 ]
[ 101, 21 ]
python
en
['en', 'error', 'th']
False
equal
(x1, x2)
Return (x1 == x2) element-wise. Unlike `numpy.equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode ...
Return (x1 == x2) element-wise.
def equal(x1, x2): """ Return (x1 == x2) element-wise. Unlike `numpy.equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like ...
[ "def", "equal", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'=='", ",", "True", ")" ]
[ 109, 0 ]
[ 131, 49 ]
python
en
['en', 'error', 'th']
False
not_equal
(x1, x2)
Return (x1 != x2) element-wise. Unlike `numpy.not_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode ...
Return (x1 != x2) element-wise.
def not_equal(x1, x2): """ Return (x1 != x2) element-wise. Unlike `numpy.not_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : arr...
[ "def", "not_equal", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'!='", ",", "True", ")" ]
[ 135, 0 ]
[ 157, 49 ]
python
en
['en', 'error', 'th']
False
greater_equal
(x1, x2)
Return (x1 >= x2) element-wise. Unlike `numpy.greater_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unico...
Return (x1 >= x2) element-wise.
def greater_equal(x1, x2): """ Return (x1 >= x2) element-wise. Unlike `numpy.greater_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x...
[ "def", "greater_equal", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'>='", ",", "True", ")" ]
[ 161, 0 ]
[ 184, 49 ]
python
en
['en', 'error', 'th']
False
less_equal
(x1, x2)
Return (x1 <= x2) element-wise. Unlike `numpy.less_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode ...
Return (x1 <= x2) element-wise.
def less_equal(x1, x2): """ Return (x1 <= x2) element-wise. Unlike `numpy.less_equal`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : a...
[ "def", "less_equal", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'<='", ",", "True", ")" ]
[ 188, 0 ]
[ 210, 49 ]
python
en
['en', 'error', 'th']
False
greater
(x1, x2)
Return (x1 > x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode ...
Return (x1 > x2) element-wise.
def greater(x1, x2): """ Return (x1 > x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_li...
[ "def", "greater", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'>'", ",", "True", ")" ]
[ 214, 0 ]
[ 236, 48 ]
python
en
['en', 'error', 'th']
False
less
(x1, x2)
Return (x1 < x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like of str or unicode ...
Return (x1 < x2) element-wise.
def less(x1, x2): """ Return (x1 < x2) element-wise. Unlike `numpy.greater`, this comparison is performed by first stripping whitespace characters from the end of the string. This behavior is provided for backward-compatibility with numarray. Parameters ---------- x1, x2 : array_like ...
[ "def", "less", "(", "x1", ",", "x2", ")", ":", "return", "compare_chararrays", "(", "x1", ",", "x2", ",", "'<'", ",", "True", ")" ]
[ 240, 0 ]
[ 262, 48 ]
python
en
['en', 'error', 'th']
False
str_len
(a)
Return len(a) element-wise. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of integers See also -------- __builtin__.len
Return len(a) element-wise.
def str_len(a): """ Return len(a) element-wise. Parameters ---------- a : array_like of str or unicode Returns ------- out : ndarray Output array of integers See also -------- __builtin__.len """ return _vec_string(a, integer, '__len__')
[ "def", "str_len", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'__len__'", ")" ]
[ 270, 0 ]
[ 287, 45 ]
python
en
['en', 'error', 'th']
False
add
(x1, x2)
Return element-wise string concatenation for two arrays of str or unicode. Arrays `x1` and `x2` must have the same shape. Parameters ---------- x1 : array_like of str or unicode Input array. x2 : array_like of str or unicode Input array. Returns ------- add : ndar...
Return element-wise string concatenation for two arrays of str or unicode.
def add(x1, x2): """ Return element-wise string concatenation for two arrays of str or unicode. Arrays `x1` and `x2` must have the same shape. Parameters ---------- x1 : array_like of str or unicode Input array. x2 : array_like of str or unicode Input array. Returns ...
[ "def", "add", "(", "x1", ",", "x2", ")", ":", "arr1", "=", "numpy", ".", "asarray", "(", "x1", ")", "arr2", "=", "numpy", ".", "asarray", "(", "x2", ")", "out_size", "=", "_get_num_chars", "(", "arr1", ")", "+", "_get_num_chars", "(", "arr2", ")", ...
[ 291, 0 ]
[ 315, 67 ]
python
en
['en', 'error', 'th']
False
multiply
(a, i)
Return (a * i), that is string multiple concatenation, element-wise. Values in `i` of less than 0 are treated as 0 (which yields an empty string). Parameters ---------- a : array_like of str or unicode i : array_like of ints Returns ------- out : ndarray Output a...
Return (a * i), that is string multiple concatenation, element-wise.
def multiply(a, i): """ Return (a * i), that is string multiple concatenation, element-wise. Values in `i` of less than 0 are treated as 0 (which yields an empty string). Parameters ---------- a : array_like of str or unicode i : array_like of ints Returns ------- out...
[ "def", "multiply", "(", "a", ",", "i", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "i_arr", "=", "numpy", ".", "asarray", "(", "i", ")", "if", "not", "issubclass", "(", "i_arr", ".", "dtype", ".", "type", ",", "integer", ")", ...
[ 323, 0 ]
[ 349, 65 ]
python
en
['en', 'error', 'th']
False
mod
(a, values)
Return (a % i), that is pre-Python 2.6 string formatting (iterpolation), element-wise for a pair of array_likes of str or unicode. Parameters ---------- a : array_like of str or unicode values : array_like of values These values will be element-wise interpolated into the string. ...
Return (a % i), that is pre-Python 2.6 string formatting (iterpolation), element-wise for a pair of array_likes of str or unicode.
def mod(a, values): """ Return (a % i), that is pre-Python 2.6 string formatting (iterpolation), element-wise for a pair of array_likes of str or unicode. Parameters ---------- a : array_like of str or unicode values : array_like of values These values will be element-wise inter...
[ "def", "mod", "(", "a", ",", "values", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'__mod__'", ",", "(", "values", ",", ")", ")", ")" ]
[ 357, 0 ]
[ 381, 54 ]
python
en
['en', 'error', 'th']
False
capitalize
(a)
Return a copy of `a` with only the first character of each element capitalized. Calls `str.capitalize` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Input array of strings to capitalize. Returns -...
Return a copy of `a` with only the first character of each element capitalized.
def capitalize(a): """ Return a copy of `a` with only the first character of each element capitalized. Calls `str.capitalize` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Input array of strings to capi...
[ "def", "capitalize", "(", "a", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'capitalize'", ")" ]
[ 385, 0 ]
[ 420, 56 ]
python
en
['en', 'error', 'th']
False
center
(a, width, fillchar=' ')
Return a copy of `a` with its elements centered in a string of length `width`. Calls `str.center` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optional The padding chara...
Return a copy of `a` with its elements centered in a string of length `width`.
def center(a, width, fillchar=' '): """ Return a copy of `a` with its elements centered in a string of length `width`. Calls `str.center` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or ...
[ "def", "center", "(", "a", ",", "width", ",", "fillchar", "=", "' '", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "width_arr", "=", "numpy", ".", "asarray", "(", "width", ")", "size", "=", "long", "(", "numpy", ".", "max", "("...
[ 428, 0 ]
[ 461, 73 ]
python
en
['en', 'error', 'th']
False
count
(a, sub, start=0, end=None)
Returns an array with the number of non-overlapping occurrences of substring `sub` in the range [`start`, `end`]. Calls `str.count` element-wise. Parameters ---------- a : array_like of str or unicode sub : str or unicode The substring to search for. start, end : int, optiona...
Returns an array with the number of non-overlapping occurrences of substring `sub` in the range [`start`, `end`].
def count(a, sub, start=0, end=None): """ Returns an array with the number of non-overlapping occurrences of substring `sub` in the range [`start`, `end`]. Calls `str.count` element-wise. Parameters ---------- a : array_like of str or unicode sub : str or unicode The substring ...
[ "def", "count", "(", "a", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'count'", ",", "[", "sub", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ")" ]
[ 469, 0 ]
[ 511, 76 ]
python
en
['en', 'error', 'th']
False
decode
(a, encoding=None, errors=None)
Calls `str.decode` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the :mod:`codecs` module. Parameters ---------- a : array_like of str or unicode encoding : str, optional The name of...
Calls `str.decode` element-wise.
def decode(a, encoding=None, errors=None): """ Calls `str.decode` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the :mod:`codecs` module. Parameters ---------- a : array_like of str or unicod...
[ "def", "decode", "(", "a", ",", "encoding", "=", "None", ",", "errors", "=", "None", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'decode'", ",", "_clean_args", "(", "encoding", ",", "errors", ")", ...
[ 519, 0 ]
[ 561, 73 ]
python
en
['en', 'error', 'th']
False
encode
(a, encoding=None, errors=None)
Calls `str.encode` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the codecs module. Parameters ---------- a : array_like of str or unicode encoding : str, optional The name of an enco...
Calls `str.encode` element-wise.
def encode(a, encoding=None, errors=None): """ Calls `str.encode` element-wise. The set of available codecs comes from the Python standard library, and may be extended at runtime. For more information, see the codecs module. Parameters ---------- a : array_like of str or unicode e...
[ "def", "encode", "(", "a", ",", "encoding", "=", "None", ",", "errors", "=", "None", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'encode'", ",", "_clean_args", "(", "encoding", ",", "errors", ")", ...
[ 565, 0 ]
[ 597, 73 ]
python
en
['en', 'error', 'th']
False
endswith
(a, suffix, start=0, end=None)
Returns a boolean array which is `True` where the string element in `a` ends with `suffix`, otherwise `False`. Calls `str.endswith` element-wise. Parameters ---------- a : array_like of str or unicode suffix : str start, end : int, optional With optional `start`, test beginn...
Returns a boolean array which is `True` where the string element in `a` ends with `suffix`, otherwise `False`.
def endswith(a, suffix, start=0, end=None): """ Returns a boolean array which is `True` where the string element in `a` ends with `suffix`, otherwise `False`. Calls `str.endswith` element-wise. Parameters ---------- a : array_like of str or unicode suffix : str start, end : int, ...
[ "def", "endswith", "(", "a", ",", "suffix", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'endswith'", ",", "[", "suffix", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ...
[ 605, 0 ]
[ 645, 65 ]
python
en
['en', 'error', 'th']
False
expandtabs
(a, tabsize=8)
Return a copy of each string element where all tab characters are replaced by one or more spaces. Calls `str.expandtabs` element-wise. Return a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current column and the given `tabsize`. The...
Return a copy of each string element where all tab characters are replaced by one or more spaces.
def expandtabs(a, tabsize=8): """ Return a copy of each string element where all tab characters are replaced by one or more spaces. Calls `str.expandtabs` element-wise. Return a copy of each string element where all tab characters are replaced by one or more spaces, depending on the current co...
[ "def", "expandtabs", "(", "a", ",", "tabsize", "=", "8", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'expandtabs'", ",", "(", "tabsize", ",", ")", ")", ")" ]
[ 653, 0 ]
[ 685, 58 ]
python
en
['en', 'error', 'th']
False
find
(a, sub, start=0, end=None)
For each element, return the lowest index in the string where substring `sub` is found. Calls `str.find` element-wise. For each element, return the lowest index in the string where substring `sub` is found, such that `sub` is contained in the range [`start`, `end`]. Parameters ------...
For each element, return the lowest index in the string where substring `sub` is found.
def find(a, sub, start=0, end=None): """ For each element, return the lowest index in the string where substring `sub` is found. Calls `str.find` element-wise. For each element, return the lowest index in the string where substring `sub` is found, such that `sub` is contained in the range ...
[ "def", "find", "(", "a", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'find'", ",", "[", "sub", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ")" ]
[ 689, 0 ]
[ 721, 60 ]
python
en
['en', 'error', 'th']
False
index
(a, sub, start=0, end=None)
Like `find`, but raises `ValueError` when the substring is not found. Calls `str.index` element-wise. Parameters ---------- a : array_like of str or unicode sub : str or unicode start, end : int, optional Returns ------- out : ndarray Output array of ints. Returns ...
Like `find`, but raises `ValueError` when the substring is not found.
def index(a, sub, start=0, end=None): """ Like `find`, but raises `ValueError` when the substring is not found. Calls `str.index` element-wise. Parameters ---------- a : array_like of str or unicode sub : str or unicode start, end : int, optional Returns ------- out : nd...
[ "def", "index", "(", "a", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'index'", ",", "[", "sub", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ")" ]
[ 725, 0 ]
[ 750, 61 ]
python
en
['en', 'error', 'th']
False
isalnum
(a)
Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise. Calls `str.isalnum` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ...
Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise.
def isalnum(a): """ Returns true for each element if all characters in the string are alphanumeric and there is at least one character, false otherwise. Calls `str.isalnum` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or...
[ "def", "isalnum", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'isalnum'", ")" ]
[ 754, 0 ]
[ 776, 43 ]
python
en
['en', 'error', 'th']
False
isalpha
(a)
Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise. Calls `str.isalpha` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ...
Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise.
def isalpha(a): """ Returns true for each element if all characters in the string are alphabetic and there is at least one character, false otherwise. Calls `str.isalpha` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or u...
[ "def", "isalpha", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'isalpha'", ")" ]
[ 780, 0 ]
[ 802, 43 ]
python
en
['en', 'error', 'th']
False
isdigit
(a)
Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. Calls `str.isdigit` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ---...
Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise.
def isdigit(a): """ Returns true for each element if all characters in the string are digits and there is at least one character, false otherwise. Calls `str.isdigit` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unico...
[ "def", "isdigit", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'isdigit'", ")" ]
[ 806, 0 ]
[ 828, 43 ]
python
en
['en', 'error', 'th']
False
islower
(a)
Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. Calls `str.islower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode ...
Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise.
def islower(a): """ Returns true for each element if all cased characters in the string are lowercase and there is at least one cased character, false otherwise. Calls `str.islower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_l...
[ "def", "islower", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'islower'", ")" ]
[ 832, 0 ]
[ 855, 43 ]
python
en
['en', 'error', 'th']
False
isspace
(a)
Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise. Calls `str.isspace` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode ...
Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise.
def isspace(a): """ Returns true for each element if there are only whitespace characters in the string and there is at least one character, false otherwise. Calls `str.isspace` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like ...
[ "def", "isspace", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'isspace'", ")" ]
[ 859, 0 ]
[ 882, 43 ]
python
en
['en', 'error', 'th']
False
istitle
(a)
Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. Call `str.istitle` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Returns ------- ...
Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise.
def istitle(a): """ Returns true for each element if the element is a titlecased string and there is at least one character, false otherwise. Call `str.istitle` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode ...
[ "def", "istitle", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'istitle'", ")" ]
[ 886, 0 ]
[ 908, 43 ]
python
en
['en', 'error', 'th']
False
isupper
(a)
Returns true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise. Call `str.isupper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of str or unicode Ret...
Returns true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise.
def isupper(a): """ Returns true for each element if all cased characters in the string are uppercase and there is at least one character, false otherwise. Call `str.isupper` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like of ...
[ "def", "isupper", "(", "a", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'isupper'", ")" ]
[ 912, 0 ]
[ 935, 43 ]
python
en
['en', 'error', 'th']
False
join
(sep, seq)
Return a string which is the concatenation of the strings in the sequence `seq`. Calls `str.join` element-wise. Parameters ---------- sep : array_like of str or unicode seq : array_like of str or unicode Returns ------- out : ndarray Output array of str or unicode, de...
Return a string which is the concatenation of the strings in the sequence `seq`.
def join(sep, seq): """ Return a string which is the concatenation of the strings in the sequence `seq`. Calls `str.join` element-wise. Parameters ---------- sep : array_like of str or unicode seq : array_like of str or unicode Returns ------- out : ndarray Output ...
[ "def", "join", "(", "sep", ",", "seq", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "sep", ",", "object_", ",", "'join'", ",", "(", "seq", ",", ")", ")", ")" ]
[ 943, 0 ]
[ 965, 50 ]
python
en
['en', 'error', 'th']
False
ljust
(a, width, fillchar=' ')
Return an array with the elements of `a` left-justified in a string of length `width`. Calls `str.ljust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optional The charac...
Return an array with the elements of `a` left-justified in a string of length `width`.
def ljust(a, width, fillchar=' '): """ Return an array with the elements of `a` left-justified in a string of length `width`. Calls `str.ljust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : s...
[ "def", "ljust", "(", "a", ",", "width", ",", "fillchar", "=", "' '", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "width_arr", "=", "numpy", ".", "asarray", "(", "width", ")", "size", "=", "long", "(", "numpy", ".", "max", "(",...
[ 974, 0 ]
[ 1006, 72 ]
python
en
['en', 'error', 'th']
False
lower
(a)
Return an array with the elements converted to lowercase. Call `str.lower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray, {str, unicode} Output arr...
Return an array with the elements converted to lowercase.
def lower(a): """ Return an array with the elements converted to lowercase. Call `str.lower` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ------- out : ndarray, {str, unicod...
[ "def", "lower", "(", "a", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'lower'", ")" ]
[ 1010, 0 ]
[ 1041, 51 ]
python
en
['en', 'error', 'th']
False
lstrip
(a, chars=None)
For each element in `a`, return a copy with the leading characters removed. Calls `str.lstrip` element-wise. Parameters ---------- a : array-like, {str, unicode} Input array. chars : {str, unicode}, optional The `chars` argument is a string specifying the set of c...
For each element in `a`, return a copy with the leading characters removed.
def lstrip(a, chars=None): """ For each element in `a`, return a copy with the leading characters removed. Calls `str.lstrip` element-wise. Parameters ---------- a : array-like, {str, unicode} Input array. chars : {str, unicode}, optional The `chars` argument is a stri...
[ "def", "lstrip", "(", "a", ",", "chars", "=", "None", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'lstrip'", ",", "(", "chars", ",", ")", ")" ]
[ 1049, 0 ]
[ 1100, 62 ]
python
en
['en', 'error', 'th']
False
partition
(a, sep)
Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separator. If the separator ...
Partition each element in `a` around `sep`.
def partition(a, sep): """ Partition each element in `a` around `sep`. Calls `str.partition` element-wise. For each element in `a`, split the element as the first occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after th...
[ "def", "partition", "(", "a", ",", "sep", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'partition'", ",", "(", "sep", ",", ")", ")", ")" ]
[ 1108, 0 ]
[ 1140, 53 ]
python
en
['en', 'error', 'th']
False
replace
(a, old, new, count=None)
For each element in `a`, return a copy of the string with all occurrences of substring `old` replaced by `new`. Calls `str.replace` element-wise. Parameters ---------- a : array-like of str or unicode old, new : str or unicode count : int, optional If the optional argument `...
For each element in `a`, return a copy of the string with all occurrences of substring `old` replaced by `new`.
def replace(a, old, new, count=None): """ For each element in `a`, return a copy of the string with all occurrences of substring `old` replaced by `new`. Calls `str.replace` element-wise. Parameters ---------- a : array-like of str or unicode old, new : str or unicode count : int...
[ "def", "replace", "(", "a", ",", "old", ",", "new", ",", "count", "=", "None", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'replace'", ",", "[", "old", ",", "new", "]", "+", "_clean_args", "(",...
[ 1148, 0 ]
[ 1177, 68 ]
python
en
['en', 'error', 'th']
False
rfind
(a, sub, start=0, end=None)
For each element in `a`, return the highest index in the string where substring `sub` is found, such that `sub` is contained within [`start`, `end`]. Calls `str.rfind` element-wise. Parameters ---------- a : array-like of str or unicode sub : str or unicode start, end : int, opt...
For each element in `a`, return the highest index in the string where substring `sub` is found, such that `sub` is contained within [`start`, `end`].
def rfind(a, sub, start=0, end=None): """ For each element in `a`, return the highest index in the string where substring `sub` is found, such that `sub` is contained within [`start`, `end`]. Calls `str.rfind` element-wise. Parameters ---------- a : array-like of str or unicode su...
[ "def", "rfind", "(", "a", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'rfind'", ",", "[", "sub", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ")" ]
[ 1181, 0 ]
[ 1210, 61 ]
python
en
['en', 'error', 'th']
False
rindex
(a, sub, start=0, end=None)
Like `rfind`, but raises `ValueError` when the substring `sub` is not found. Calls `str.rindex` element-wise. Parameters ---------- a : array-like of str or unicode sub : str or unicode start, end : int, optional Returns ------- out : ndarray Output array of ints...
Like `rfind`, but raises `ValueError` when the substring `sub` is not found.
def rindex(a, sub, start=0, end=None): """ Like `rfind`, but raises `ValueError` when the substring `sub` is not found. Calls `str.rindex` element-wise. Parameters ---------- a : array-like of str or unicode sub : str or unicode start, end : int, optional Returns -------...
[ "def", "rindex", "(", "a", ",", "sub", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "integer", ",", "'rindex'", ",", "[", "sub", ",", "start", "]", "+", "_clean_args", "(", "end", ")", ")" ]
[ 1214, 0 ]
[ 1240, 62 ]
python
en
['en', 'error', 'th']
False
rjust
(a, width, fillchar=' ')
Return an array with the elements of `a` right-justified in a string of length `width`. Calls `str.rjust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : str or unicode, optional The chara...
Return an array with the elements of `a` right-justified in a string of length `width`.
def rjust(a, width, fillchar=' '): """ Return an array with the elements of `a` right-justified in a string of length `width`. Calls `str.rjust` element-wise. Parameters ---------- a : array_like of str or unicode width : int The length of the resulting strings fillchar : ...
[ "def", "rjust", "(", "a", ",", "width", ",", "fillchar", "=", "' '", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "width_arr", "=", "numpy", ".", "asarray", "(", "width", ")", "size", "=", "long", "(", "numpy", ".", "max", "(",...
[ 1244, 0 ]
[ 1276, 72 ]
python
en
['en', 'error', 'th']
False
rpartition
(a, sep)
Partition (split) each element around the right-most separator. Calls `str.rpartition` element-wise. For each element in `a`, split the element as the last occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and the part after the separato...
Partition (split) each element around the right-most separator.
def rpartition(a, sep): """ Partition (split) each element around the right-most separator. Calls `str.rpartition` element-wise. For each element in `a`, split the element as the last occurrence of `sep`, and return 3 strings containing the part before the separator, the separator itself, and ...
[ "def", "rpartition", "(", "a", ",", "sep", ")", ":", "return", "_to_string_or_unicode_array", "(", "_vec_string", "(", "a", ",", "object_", ",", "'rpartition'", ",", "(", "sep", ",", ")", ")", ")" ]
[ 1280, 0 ]
[ 1312, 54 ]
python
en
['en', 'error', 'th']
False
rsplit
(a, sep=None, maxsplit=None)
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.rsplit` element-wise. Except for splitting from the right, `rsplit` behaves like `split`. Parameters ---------- a : array_like of str or unicode sep : str or unicod...
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string.
def rsplit(a, sep=None, maxsplit=None): """ For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.rsplit` element-wise. Except for splitting from the right, `rsplit` behaves like `split`. Parameters ---------- a : array_...
[ "def", "rsplit", "(", "a", ",", "sep", "=", "None", ",", "maxsplit", "=", "None", ")", ":", "# This will return an array of lists of different sizes, so we", "# leave it as an object array", "return", "_vec_string", "(", "a", ",", "object_", ",", "'rsplit'", ",", "[...
[ 1320, 0 ]
[ 1354, 60 ]
python
en
['en', 'error', 'th']
False
rstrip
(a, chars=None)
For each element in `a`, return a copy with the trailing characters removed. Calls `str.rstrip` element-wise. Parameters ---------- a : array-like of str or unicode chars : str or unicode, optional The `chars` argument is a string specifying the set of characters to be remo...
For each element in `a`, return a copy with the trailing characters removed.
def rstrip(a, chars=None): """ For each element in `a`, return a copy with the trailing characters removed. Calls `str.rstrip` element-wise. Parameters ---------- a : array-like of str or unicode chars : str or unicode, optional The `chars` argument is a string specifying the s...
[ "def", "rstrip", "(", "a", ",", "chars", "=", "None", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'rstrip'", ",", "(", "chars", ",", ")", ")" ]
[ 1362, 0 ]
[ 1403, 62 ]
python
en
['en', 'error', 'th']
False
split
(a, sep=None, maxsplit=None)
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.split` element-wise. Parameters ---------- a : array_like of str or unicode sep : str or unicode, optional If `sep` is not specified or `None`, any whitespace string ...
For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string.
def split(a, sep=None, maxsplit=None): """ For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.split` element-wise. Parameters ---------- a : array_like of str or unicode sep : str or unicode, optional If `sep` is n...
[ "def", "split", "(", "a", ",", "sep", "=", "None", ",", "maxsplit", "=", "None", ")", ":", "# This will return an array of lists of different sizes, so we", "# leave it as an object array", "return", "_vec_string", "(", "a", ",", "object_", ",", "'split'", ",", "[",...
[ 1407, 0 ]
[ 1438, 59 ]
python
en
['en', 'error', 'th']
False
splitlines
(a, keepends=None)
For each element in `a`, return a list of the lines in the element, breaking at line boundaries. Calls `str.splitlines` element-wise. Parameters ---------- a : array_like of str or unicode keepends : bool, optional Line breaks are not included in the resulting list unless ...
For each element in `a`, return a list of the lines in the element, breaking at line boundaries.
def splitlines(a, keepends=None): """ For each element in `a`, return a list of the lines in the element, breaking at line boundaries. Calls `str.splitlines` element-wise. Parameters ---------- a : array_like of str or unicode keepends : bool, optional Line breaks are not incl...
[ "def", "splitlines", "(", "a", ",", "keepends", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "object_", ",", "'splitlines'", ",", "_clean_args", "(", "keepends", ")", ")" ]
[ 1446, 0 ]
[ 1472, 56 ]
python
en
['en', 'error', 'th']
False
startswith
(a, prefix, start=0, end=None)
Returns a boolean array which is `True` where the string element in `a` starts with `prefix`, otherwise `False`. Calls `str.startswith` element-wise. Parameters ---------- a : array_like of str or unicode prefix : str start, end : int, optional With optional `start`, test be...
Returns a boolean array which is `True` where the string element in `a` starts with `prefix`, otherwise `False`.
def startswith(a, prefix, start=0, end=None): """ Returns a boolean array which is `True` where the string element in `a` starts with `prefix`, otherwise `False`. Calls `str.startswith` element-wise. Parameters ---------- a : array_like of str or unicode prefix : str start, end :...
[ "def", "startswith", "(", "a", ",", "prefix", ",", "start", "=", "0", ",", "end", "=", "None", ")", ":", "return", "_vec_string", "(", "a", ",", "bool_", ",", "'startswith'", ",", "[", "prefix", ",", "start", "]", "+", "_clean_args", "(", "end", ")...
[ 1480, 0 ]
[ 1508, 67 ]
python
en
['en', 'error', 'th']
False
strip
(a, chars=None)
For each element in `a`, return a copy with the leading and trailing characters removed. Calls `str.strip` element-wise. Parameters ---------- a : array-like of str or unicode chars : str or unicode, optional The `chars` argument is a string specifying the set of characters...
For each element in `a`, return a copy with the leading and trailing characters removed.
def strip(a, chars=None): """ For each element in `a`, return a copy with the leading and trailing characters removed. Calls `str.strip` element-wise. Parameters ---------- a : array-like of str or unicode chars : str or unicode, optional The `chars` argument is a string specif...
[ "def", "strip", "(", "a", ",", "chars", "=", "None", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'strip'", ",", "_clean_args", "(", "chars", ")", ")" ]
[ 1512, 0 ]
[ 1553, 71 ]
python
en
['en', 'error', 'th']
False
swapcase
(a)
Return element-wise a copy of the string with uppercase characters converted to lowercase and vice versa. Calls `str.swapcase` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input array. Returns ----...
Return element-wise a copy of the string with uppercase characters converted to lowercase and vice versa.
def swapcase(a): """ Return element-wise a copy of the string with uppercase characters converted to lowercase and vice versa. Calls `str.swapcase` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {str, unicode} Input arra...
[ "def", "swapcase", "(", "a", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'swapcase'", ")" ]
[ 1557, 0 ]
[ 1591, 54 ]
python
en
['en', 'error', 'th']
False
title
(a)
Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls `str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- a : array_like, {st...
Return element-wise title cased version of string or unicode.
def title(a): """ Return element-wise title cased version of string or unicode. Title case words start with uppercase characters, all remaining cased characters are lowercase. Calls `str.title` element-wise. For 8-bit strings, this method is locale-dependent. Parameters ---------- ...
[ "def", "title", "(", "a", ")", ":", "a_arr", "=", "numpy", ".", "asarray", "(", "a", ")", "return", "_vec_string", "(", "a_arr", ",", "a_arr", ".", "dtype", ",", "'title'", ")" ]
[ 1595, 0 ]
[ 1631, 51 ]
python
en
['en', 'error', 'th']
False