partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
HyperbandSearchManager.should_reduce_configs
Return a boolean to indicate if we need to reschedule another bracket iteration.
polyaxon/hpsearch/search_managers/hyperband.py
def should_reduce_configs(self, iteration, bracket_iteration): """Return a boolean to indicate if we need to reschedule another bracket iteration.""" n_configs_to_keep = self.get_n_config_to_keep_for_iteration( iteration=iteration, bracket_iteration=bracket_iteration) return n_config...
def should_reduce_configs(self, iteration, bracket_iteration): """Return a boolean to indicate if we need to reschedule another bracket iteration.""" n_configs_to_keep = self.get_n_config_to_keep_for_iteration( iteration=iteration, bracket_iteration=bracket_iteration) return n_config...
[ "Return", "a", "boolean", "to", "indicate", "if", "we", "need", "to", "reschedule", "another", "bracket", "iteration", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/search_managers/hyperband.py#L143-L147
[ "def", "should_reduce_configs", "(", "self", ",", "iteration", ",", "bracket_iteration", ")", ":", "n_configs_to_keep", "=", "self", ".", "get_n_config_to_keep_for_iteration", "(", "iteration", "=", "iteration", ",", "bracket_iteration", "=", "bracket_iteration", ")", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
validate_resource
Validates a resource
polyaxon/libs/resource_validation.py
def validate_resource(resource) -> None: """Validates a resource""" if resource is not None and not isinstance(resource, dict): raise ValidationError('The resource is not valid.') if isinstance(resource, dict) and set(resource.keys()) <= {'requests', 'limits'}: raise ValidationError( ...
def validate_resource(resource) -> None: """Validates a resource""" if resource is not None and not isinstance(resource, dict): raise ValidationError('The resource is not valid.') if isinstance(resource, dict) and set(resource.keys()) <= {'requests', 'limits'}: raise ValidationError( ...
[ "Validates", "a", "resource" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/libs/resource_validation.py#L4-L11
[ "def", "validate_resource", "(", "resource", ")", "->", "None", ":", "if", "resource", "is", "not", "None", "and", "not", "isinstance", "(", "resource", ",", "dict", ")", ":", "raise", "ValidationError", "(", "'The resource is not valid.'", ")", "if", "isinsta...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ResourceManager.get_init_container
Pod init container for setting outputs path.
polyaxon/scheduler/spawners/templates/experiment_jobs/manager.py
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/experiment_jobs/manager.py#L169-L210
[ "def", "get_init_container", "(", "self", ",", "init_command", ",", "init_args", ",", "env_vars", ",", "context_mounts", ",", "persistence_outputs", ",", "persistence_data", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RepoMixin.path
We need to nest the git path inside the project path to make it easier to create docker images.
polyaxon/db/models/repos.py
def path(self) -> str: """We need to nest the git path inside the project path to make it easier to create docker images.""" return os.path.join(self.project_path, self.project.name)
def path(self) -> str: """We need to nest the git path inside the project path to make it easier to create docker images.""" return os.path.join(self.project_path, self.project.name)
[ "We", "need", "to", "nest", "the", "git", "path", "inside", "the", "project", "path", "to", "make", "it", "easier", "to", "create", "docker", "images", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/repos.py#L23-L26
[ "def", "path", "(", "self", ")", "->", "str", ":", "return", "os", ".", "path", ".", "join", "(", "self", ".", "project_path", ",", "self", ".", "project", ".", "name", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RepoMixin.last_commit
Returns a tuple (hash, and commit object)
polyaxon/db/models/repos.py
def last_commit(self) -> Tuple: """Returns a tuple (hash, and commit object)""" from libs.repos import git return git.get_last_commit(repo_path=self.path)
def last_commit(self) -> Tuple: """Returns a tuple (hash, and commit object)""" from libs.repos import git return git.get_last_commit(repo_path=self.path)
[ "Returns", "a", "tuple", "(", "hash", "and", "commit", "object", ")" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/repos.py#L35-L39
[ "def", "last_commit", "(", "self", ")", "->", "Tuple", ":", "from", "libs", ".", "repos", "import", "git", "return", "git", ".", "get_last_commit", "(", "repo_path", "=", "self", ".", "path", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
TensorboardSpawner.validate_stores_secrets_keys
Validates that we can only authenticate to one S3 and one GCS.
polyaxon/scheduler/spawners/tensorboard_spawner.py
def validate_stores_secrets_keys(stores_secrets): """Validates that we can only authenticate to one S3 and one GCS.""" stores = set([]) for store_secret in stores_secrets: if store_secret['store'] in stores: raise TensorboardValidation('Received an invalid store confi...
def validate_stores_secrets_keys(stores_secrets): """Validates that we can only authenticate to one S3 and one GCS.""" stores = set([]) for store_secret in stores_secrets: if store_secret['store'] in stores: raise TensorboardValidation('Received an invalid store confi...
[ "Validates", "that", "we", "can", "only", "authenticate", "to", "one", "S3", "and", "one", "GCS", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/tensorboard_spawner.py#L92-L100
[ "def", "validate_stores_secrets_keys", "(", "stores_secrets", ")", ":", "stores", "=", "set", "(", "[", "]", ")", "for", "store_secret", "in", "stores_secrets", ":", "if", "store_secret", "[", "'store'", "]", "in", "stores", ":", "raise", "TensorboardValidation"...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
TensorboardSpawner.get_stores_secrets_volumes
Handles the case of GCS and S3 and create a volume with secret file.
polyaxon/scheduler/spawners/tensorboard_spawner.py
def get_stores_secrets_volumes(cls, stores_secrets): """Handles the case of GCS and S3 and create a volume with secret file.""" volumes = [] volume_mounts = [] for store_secret in stores_secrets: store = store_secret['store'] if store in {GCS, S3}: ...
def get_stores_secrets_volumes(cls, stores_secrets): """Handles the case of GCS and S3 and create a volume with secret file.""" volumes = [] volume_mounts = [] for store_secret in stores_secrets: store = store_secret['store'] if store in {GCS, S3}: ...
[ "Handles", "the", "case", "of", "GCS", "and", "S3", "and", "create", "a", "volume", "with", "secret", "file", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/tensorboard_spawner.py#L103-L118
[ "def", "get_stores_secrets_volumes", "(", "cls", ",", "stores_secrets", ")", ":", "volumes", "=", "[", "]", "volume_mounts", "=", "[", "]", "for", "store_secret", "in", "stores_secrets", ":", "store", "=", "store_secret", "[", "'store'", "]", "if", "store", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
TensorboardSpawner.get_stores_secrets_command_args
Create an auth command for S3 and GCS.
polyaxon/scheduler/spawners/tensorboard_spawner.py
def get_stores_secrets_command_args(cls, stores_secrets): """Create an auth command for S3 and GCS.""" commands = [] for store_secret in stores_secrets: store = store_secret['store'] if store == GCS: commands.append('export GOOGLE_APPLICATION_CREDENTIALS={...
def get_stores_secrets_command_args(cls, stores_secrets): """Create an auth command for S3 and GCS.""" commands = [] for store_secret in stores_secrets: store = store_secret['store'] if store == GCS: commands.append('export GOOGLE_APPLICATION_CREDENTIALS={...
[ "Create", "an", "auth", "command", "for", "S3", "and", "GCS", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/tensorboard_spawner.py#L121-L141
[ "def", "get_stores_secrets_command_args", "(", "cls", ",", "stores_secrets", ")", ":", "commands", "=", "[", "]", "for", "store_secret", "in", "stores_secrets", ":", "store", "=", "store_secret", "[", "'store'", "]", "if", "store", "==", "GCS", ":", "commands"...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RedisEphemeralTokens.make_token
Returns a token to be used x number of times to allow a user account to access certain resource.
polyaxon/db/redis/ephemeral_tokens.py
def make_token(cls, ephemeral_token: 'RedisEphemeralTokens') -> str: """ Returns a token to be used x number of times to allow a user account to access certain resource. """ value = ephemeral_token.key if ephemeral_token.scope: value += ''.join(ephemeral_token...
def make_token(cls, ephemeral_token: 'RedisEphemeralTokens') -> str: """ Returns a token to be used x number of times to allow a user account to access certain resource. """ value = ephemeral_token.key if ephemeral_token.scope: value += ''.join(ephemeral_token...
[ "Returns", "a", "token", "to", "be", "used", "x", "number", "of", "times", "to", "allow", "a", "user", "account", "to", "access", "certain", "resource", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/redis/ephemeral_tokens.py#L82-L91
[ "def", "make_token", "(", "cls", ",", "ephemeral_token", ":", "'RedisEphemeralTokens'", ")", "->", "str", ":", "value", "=", "ephemeral_token", ".", "key", "if", "ephemeral_token", ".", "scope", ":", "value", "+=", "''", ".", "join", "(", "ephemeral_token", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RedisEphemeralTokens.check_token
Check that a token is correct for a given scope token.
polyaxon/db/redis/ephemeral_tokens.py
def check_token(self, token: 'RedisEphemeralTokens') -> bool: """ Check that a token is correct for a given scope token. """ if self.get_state() is None: # Token expired return False correct_token = self.make_token(self) self.clear() return constant_...
def check_token(self, token: 'RedisEphemeralTokens') -> bool: """ Check that a token is correct for a given scope token. """ if self.get_state() is None: # Token expired return False correct_token = self.make_token(self) self.clear() return constant_...
[ "Check", "that", "a", "token", "is", "correct", "for", "a", "given", "scope", "token", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/redis/ephemeral_tokens.py#L99-L108
[ "def", "check_token", "(", "self", ",", "token", ":", "'RedisEphemeralTokens'", ")", "->", "bool", ":", "if", "self", ".", "get_state", "(", ")", "is", "None", ":", "# Token expired", "return", "False", "correct_token", "=", "self", ".", "make_token", "(", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
UtilityFunction.max_compute
A function to find the maximum of the acquisition function It uses a combination of random sampling (cheap) and the 'L-BFGS-B' optimization method. First by sampling `n_warmup` (1e5) points at random, and then running L-BFGS-B from `n_iter` (250) random starting points. Params: ...
polyaxon/hpsearch/search_managers/bayesian_optimization/acquisition_function.py
def max_compute(self, y_max, bounds, n_warmup=100000, n_iter=250): """A function to find the maximum of the acquisition function It uses a combination of random sampling (cheap) and the 'L-BFGS-B' optimization method. First by sampling `n_warmup` (1e5) points at random, and then runnin...
def max_compute(self, y_max, bounds, n_warmup=100000, n_iter=250): """A function to find the maximum of the acquisition function It uses a combination of random sampling (cheap) and the 'L-BFGS-B' optimization method. First by sampling `n_warmup` (1e5) points at random, and then runnin...
[ "A", "function", "to", "find", "the", "maximum", "of", "the", "acquisition", "function" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/search_managers/bayesian_optimization/acquisition_function.py#L70-L115
[ "def", "max_compute", "(", "self", ",", "y_max", ",", "bounds", ",", "n_warmup", "=", "100000", ",", "n_iter", "=", "250", ")", ":", "# Warm up with random points", "x_tries", "=", "self", ".", "random_generator", ".", "uniform", "(", "bounds", "[", ":", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
OrderingFilter.get_ordering
Ordering is set by a comma delimited ?ordering=... query parameter. The `ordering` query parameter can be overridden by setting the `ordering_param` value on the OrderingFilter or by specifying an `ORDERING_PARAM` value in the API settings.
polyaxon/api/filters.py
def get_ordering(self, request, queryset, view): """ Ordering is set by a comma delimited ?ordering=... query parameter. The `ordering` query parameter can be overridden by setting the `ordering_param` value on the OrderingFilter or by specifying an `ORDERING_PARAM` value in the...
def get_ordering(self, request, queryset, view): """ Ordering is set by a comma delimited ?ordering=... query parameter. The `ordering` query parameter can be overridden by setting the `ordering_param` value on the OrderingFilter or by specifying an `ORDERING_PARAM` value in the...
[ "Ordering", "is", "set", "by", "a", "comma", "delimited", "?ordering", "=", "...", "query", "parameter", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/filters.py#L74-L90
[ "def", "get_ordering", "(", "self", ",", "request", ",", "queryset", ",", "view", ")", ":", "params", "=", "request", ".", "query_params", ".", "get", "(", "self", ".", "ordering_param", ")", "if", "params", ":", "fields", "=", "strip_spaces", "(", "valu...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ResourceManager.get_init_container
Pod init container for setting outputs path.
polyaxon/scheduler/spawners/templates/notebooks/manager.py
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/notebooks/manager.py#L126-L145
[ "def", "get_init_container", "(", "self", ",", "init_command", ",", "init_args", ",", "env_vars", ",", "context_mounts", ",", "persistence_outputs", ",", "persistence_data", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RegistrationView.get_activation_key
Generate the activation key which will be emailed to the user.
polyaxon/api/users/views.py
def get_activation_key(self, user): """ Generate the activation key which will be emailed to the user. """ return signing.dumps( obj=getattr(user, user.USERNAME_FIELD), salt=self.key_salt )
def get_activation_key(self, user): """ Generate the activation key which will be emailed to the user. """ return signing.dumps( obj=getattr(user, user.USERNAME_FIELD), salt=self.key_salt )
[ "Generate", "the", "activation", "key", "which", "will", "be", "emailed", "to", "the", "user", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L183-L191
[ "def", "get_activation_key", "(", "self", ",", "user", ")", ":", "return", "signing", ".", "dumps", "(", "obj", "=", "getattr", "(", "user", ",", "user", ".", "USERNAME_FIELD", ")", ",", "salt", "=", "self", ".", "key_salt", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RegistrationView.send_activation_email
Send the activation email. The activation key is the username, signed using TimestampSigner.
polyaxon/api/users/views.py
def send_activation_email(self, user): """ Send the activation email. The activation key is the username, signed using TimestampSigner. """ activation_key = self.get_activation_key(user) context = self.get_email_context(activation_key) context.update({ ...
def send_activation_email(self, user): """ Send the activation email. The activation key is the username, signed using TimestampSigner. """ activation_key = self.get_activation_key(user) context = self.get_email_context(activation_key) context.update({ ...
[ "Send", "the", "activation", "email", ".", "The", "activation", "key", "is", "the", "username", "signed", "using", "TimestampSigner", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L204-L222
[ "def", "send_activation_email", "(", "self", ",", "user", ")", ":", "activation_key", "=", "self", ".", "get_activation_key", "(", "user", ")", "context", "=", "self", ".", "get_email_context", "(", "activation_key", ")", "context", ".", "update", "(", "{", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
SimpleRegistrationView.create_inactive_user
Create the inactive user account and wait for validation from superuser
polyaxon/api/users/views.py
def create_inactive_user(self, form): """Create the inactive user account and wait for validation from superuser""" new_user = form.save(commit=False) new_user.is_active = False new_user.save() return new_user
def create_inactive_user(self, form): """Create the inactive user account and wait for validation from superuser""" new_user = form.save(commit=False) new_user.is_active = False new_user.save() return new_user
[ "Create", "the", "inactive", "user", "account", "and", "wait", "for", "validation", "from", "superuser" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L230-L235
[ "def", "create_inactive_user", "(", "self", ",", "form", ")", ":", "new_user", "=", "form", ".", "save", "(", "commit", "=", "False", ")", "new_user", ".", "is_active", "=", "False", "new_user", ".", "save", "(", ")", "return", "new_user" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ActivationView.validate_key
Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or ``None`` if not.
polyaxon/api/users/views.py
def validate_key(self, activation_key): """ Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or ``None`` if not. """ try: username = signing.loads( activation_key, ...
def validate_key(self, activation_key): """ Verify that the activation key is valid and within the permitted activation time window, returning the username if valid or ``None`` if not. """ try: username = signing.loads( activation_key, ...
[ "Verify", "that", "the", "activation", "key", "is", "valid", "and", "within", "the", "permitted", "activation", "time", "window", "returning", "the", "username", "if", "valid", "or", "None", "if", "not", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L267-L284
[ "def", "validate_key", "(", "self", ",", "activation_key", ")", ":", "try", ":", "username", "=", "signing", ".", "loads", "(", "activation_key", ",", "salt", "=", "self", ".", "key_salt", ",", "max_age", "=", "conf", ".", "get", "(", "'ACCOUNT_ACTIVATION_...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ActivationView.get_user
Given the verified username, look up and return the corresponding user account if it exists, or ``None`` if it doesn't.
polyaxon/api/users/views.py
def get_user(self, username): """ Given the verified username, look up and return the corresponding user account if it exists, or ``None`` if it doesn't. """ User = get_user_model() # noqa try: user = User.objects.get(**{ User.USERNAM...
def get_user(self, username): """ Given the verified username, look up and return the corresponding user account if it exists, or ``None`` if it doesn't. """ User = get_user_model() # noqa try: user = User.objects.get(**{ User.USERNAM...
[ "Given", "the", "verified", "username", "look", "up", "and", "return", "the", "corresponding", "user", "account", "if", "it", "exists", "or", "None", "if", "it", "doesn", "t", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L286-L301
[ "def", "get_user", "(", "self", ",", "username", ")", ":", "User", "=", "get_user_model", "(", ")", "# noqa", "try", ":", "user", "=", "User", ".", "objects", ".", "get", "(", "*", "*", "{", "User", ".", "USERNAME_FIELD", ":", "username", ",", "'is_a...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ActivationView.get
The base activation logic; subclasses should leave this method alone and implement activate(), which is called from this method.
polyaxon/api/users/views.py
def get(self, request, *args, **kwargs): """The base activation logic; subclasses should leave this method alone and implement activate(), which is called from this method. """ activated_user = self.activate(*args, **kwargs) if activated_user: users_signals.user_activ...
def get(self, request, *args, **kwargs): """The base activation logic; subclasses should leave this method alone and implement activate(), which is called from this method. """ activated_user = self.activate(*args, **kwargs) if activated_user: users_signals.user_activ...
[ "The", "base", "activation", "logic", ";", "subclasses", "should", "leave", "this", "method", "alone", "and", "implement", "activate", "()", "which", "is", "called", "from", "this", "method", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/users/views.py#L303-L315
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "activated_user", "=", "self", ".", "activate", "(", "*", "args", ",", "*", "*", "kwargs", ")", "if", "activated_user", ":", "users_signals", ".", "user_a...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseResourceManager.get_pod_container
Pod job container for task.
polyaxon/scheduler/spawners/templates/resource_manager.py
def get_pod_container(self, volume_mounts, persistence_outputs=None, persistence_data=None, outputs_refs_jobs=None, outputs_refs_experiments=None, secret_refs=None,...
def get_pod_container(self, volume_mounts, persistence_outputs=None, persistence_data=None, outputs_refs_jobs=None, outputs_refs_experiments=None, secret_refs=None,...
[ "Pod", "job", "container", "for", "task", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/resource_manager.py#L100-L143
[ "def", "get_pod_container", "(", "self", ",", "volume_mounts", ",", "persistence_outputs", "=", "None", ",", "persistence_data", "=", "None", ",", "outputs_refs_jobs", "=", "None", ",", "outputs_refs_experiments", "=", "None", ",", "secret_refs", "=", "None", ",",...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseResourceManager.get_sidecar_container
Pod sidecar container for task logs.
polyaxon/scheduler/spawners/templates/resource_manager.py
def get_sidecar_container(self, volume_mounts): """Pod sidecar container for task logs.""" return get_sidecar_container( job_container_name=self.job_container_name, sidecar_container_name=self.sidecar_container_name, sidecar_docker_image=self.sidecar_docker_image, ...
def get_sidecar_container(self, volume_mounts): """Pod sidecar container for task logs.""" return get_sidecar_container( job_container_name=self.job_container_name, sidecar_container_name=self.sidecar_container_name, sidecar_docker_image=self.sidecar_docker_image, ...
[ "Pod", "sidecar", "container", "for", "task", "logs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/resource_manager.py#L148-L160
[ "def", "get_sidecar_container", "(", "self", ",", "volume_mounts", ")", ":", "return", "get_sidecar_container", "(", "job_container_name", "=", "self", ".", "job_container_name", ",", "sidecar_container_name", "=", "self", ".", "sidecar_container_name", ",", "sidecar_do...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseResourceManager.get_task_pod_spec
Pod spec to be used to create pods for tasks: master, worker, ps.
polyaxon/scheduler/spawners/templates/resource_manager.py
def get_task_pod_spec(self, volume_mounts, volumes, resource_name, persistence_outputs=None, persistence_data=None, outputs_refs_jobs=None, ...
def get_task_pod_spec(self, volume_mounts, volumes, resource_name, persistence_outputs=None, persistence_data=None, outputs_refs_jobs=None, ...
[ "Pod", "spec", "to", "be", "used", "to", "create", "pods", "for", "tasks", ":", "master", "worker", "ps", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/resource_manager.py#L172-L251
[ "def", "get_task_pod_spec", "(", "self", ",", "volume_mounts", ",", "volumes", ",", "resource_name", ",", "persistence_outputs", "=", "None", ",", "persistence_data", "=", "None", ",", "outputs_refs_jobs", "=", "None", ",", "outputs_refs_experiments", "=", "None", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
IdentityWizard.validate_username
This validation step is done when we are sure the user does not exit on the systems and we need to create a new user.
polyaxon/sso/wizard.py
def validate_username(username): """ This validation step is done when we are sure the user does not exit on the systems and we need to create a new user. """ try: validate_slug(username) except ValidationError: username = slugify(username) ...
def validate_username(username): """ This validation step is done when we are sure the user does not exit on the systems and we need to create a new user. """ try: validate_slug(username) except ValidationError: username = slugify(username) ...
[ "This", "validation", "step", "is", "done", "when", "we", "are", "sure", "the", "user", "does", "not", "exit", "on", "the", "systems", "and", "we", "need", "to", "create", "a", "new", "user", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/sso/wizard.py#L42-L57
[ "def", "validate_username", "(", "username", ")", ":", "try", ":", "validate_slug", "(", "username", ")", "except", "ValidationError", ":", "username", "=", "slugify", "(", "username", ")", "user_model_cls", "=", "get_user_model", "(", ")", "_username", "=", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Action._prepare
This is where you should alter the context to fit the action. Default behaviour will leave the context as it is.
polyaxon/action_manager/action.py
def _prepare(cls, context: Dict) -> Dict: """This is where you should alter the context to fit the action. Default behaviour will leave the context as it is. """ if not context and cls.raise_empty_context: raise PolyaxonActionException('{} received invalid payload context.'....
def _prepare(cls, context: Dict) -> Dict: """This is where you should alter the context to fit the action. Default behaviour will leave the context as it is. """ if not context and cls.raise_empty_context: raise PolyaxonActionException('{} received invalid payload context.'....
[ "This", "is", "where", "you", "should", "alter", "the", "context", "to", "fit", "the", "action", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/action_manager/action.py#L44-L52
[ "def", "_prepare", "(", "cls", ",", "context", ":", "Dict", ")", "->", "Dict", ":", "if", "not", "context", "and", "cls", ".", "raise_empty_context", ":", "raise", "PolyaxonActionException", "(", "'{} received invalid payload context.'", ".", "format", "(", "cls...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
copy_experiment
If experiment is a restart, we should resume from last check point
polyaxon/scheduler/tasks/experiments.py
def copy_experiment(experiment): """If experiment is a restart, we should resume from last check point""" try: publisher.publish_experiment_job_log( log_lines='Copying outputs from experiment `{}` into experiment `{}`'.format( experiment.original_experiment.unique_name, exper...
def copy_experiment(experiment): """If experiment is a restart, we should resume from last check point""" try: publisher.publish_experiment_job_log( log_lines='Copying outputs from experiment `{}` into experiment `{}`'.format( experiment.original_experiment.unique_name, exper...
[ "If", "experiment", "is", "a", "restart", "we", "should", "resume", "from", "last", "check", "point" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/tasks/experiments.py#L24-L52
[ "def", "copy_experiment", "(", "experiment", ")", ":", "try", ":", "publisher", ".", "publish_experiment_job_log", "(", "log_lines", "=", "'Copying outputs from experiment `{}` into experiment `{}`'", ".", "format", "(", "experiment", ".", "original_experiment", ".", "uni...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
EventService.record
Validate and record an event. >>> record('event.action', object_instance)
polyaxon/event_manager/event_service.py
def record(self, event_type: str, event_data: Mapping = None, instance: Any = None, **kwargs) -> 'Event': """ Validate and record an event. >>> record('event.action', object_instance) """ if not self.is_setup: retur...
def record(self, event_type: str, event_data: Mapping = None, instance: Any = None, **kwargs) -> 'Event': """ Validate and record an event. >>> record('event.action', object_instance) """ if not self.is_setup: retur...
[ "Validate", "and", "record", "an", "event", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/event_manager/event_service.py#L27-L46
[ "def", "record", "(", "self", ",", "event_type", ":", "str", ",", "event_data", ":", "Mapping", "=", "None", ",", "instance", ":", "Any", "=", "None", ",", "*", "*", "kwargs", ")", "->", "'Event'", ":", "if", "not", "self", ".", "is_setup", ":", "r...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
generate
Build necessary code for a job to run
polyaxon/dockerizer/dockerizer/initializer/generate.py
def generate(job, build_path: str, from_image: str, build_steps: Optional[List[str]] = None, env_vars: Optional[List[Tuple[str, str]]] = None, nvidia_bin: str = None, set_lang_env: bool = True, uid: int = None, gid: ...
def generate(job, build_path: str, from_image: str, build_steps: Optional[List[str]] = None, env_vars: Optional[List[Tuple[str, str]]] = None, nvidia_bin: str = None, set_lang_env: bool = True, uid: int = None, gid: ...
[ "Build", "necessary", "code", "for", "a", "job", "to", "run" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/dockerizer/dockerizer/initializer/generate.py#L10-L31
[ "def", "generate", "(", "job", ",", "build_path", ":", "str", ",", "from_image", ":", "str", ",", "build_steps", ":", "Optional", "[", "List", "[", "str", "]", "]", "=", "None", ",", "env_vars", ":", "Optional", "[", "List", "[", "Tuple", "[", "str",...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
RandomSearchManager.get_suggestions
Return a list of suggestions based on random search. Params: matrix: `dict` representing the {hyperparam: hyperparam matrix config}. n_suggestions: number of suggestions to make.
polyaxon/hpsearch/search_managers/random.py
def get_suggestions(self, iteration_config=None): """Return a list of suggestions based on random search. Params: matrix: `dict` representing the {hyperparam: hyperparam matrix config}. n_suggestions: number of suggestions to make. """ matrix = self.hptuning_conf...
def get_suggestions(self, iteration_config=None): """Return a list of suggestions based on random search. Params: matrix: `dict` representing the {hyperparam: hyperparam matrix config}. n_suggestions: number of suggestions to make. """ matrix = self.hptuning_conf...
[ "Return", "a", "list", "of", "suggestions", "based", "on", "random", "search", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/search_managers/random.py#L11-L21
[ "def", "get_suggestions", "(", "self", ",", "iteration_config", "=", "None", ")", ":", "matrix", "=", "self", ".", "hptuning_config", ".", "matrix", "n_suggestions", "=", "self", ".", "hptuning_config", ".", "random_search", ".", "n_experiments", "seed", "=", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ExperimentMetricListView.get_serializer
if an array is passed, set serializer to many
polyaxon/api/experiments/views.py
def get_serializer(self, *args, **kwargs): """ if an array is passed, set serializer to many """ if isinstance(kwargs.get('data', {}), list): kwargs['many'] = True return super().get_serializer(*args, **kwargs)
def get_serializer(self, *args, **kwargs): """ if an array is passed, set serializer to many """ if isinstance(kwargs.get('data', {}), list): kwargs['many'] = True return super().get_serializer(*args, **kwargs)
[ "if", "an", "array", "is", "passed", "set", "serializer", "to", "many" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/experiments/views.py#L516-L520
[ "def", "get_serializer", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "kwargs", ".", "get", "(", "'data'", ",", "{", "}", ")", ",", "list", ")", ":", "kwargs", "[", "'many'", "]", "=", "True", "return...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
logs_handle_experiment_job
Task handling for sidecars logs.
polyaxon/logs_handlers/tasks/log_handlers.py
def logs_handle_experiment_job(experiment_name: str, experiment_uuid: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_experiment_job_log(exp...
def logs_handle_experiment_job(experiment_name: str, experiment_uuid: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_experiment_job_log(exp...
[ "Task", "handling", "for", "sidecars", "logs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/logs_handlers/tasks/log_handlers.py#L9-L17
[ "def", "logs_handle_experiment_job", "(", "experiment_name", ":", "str", ",", "experiment_uuid", ":", "str", ",", "log_lines", ":", "Optional", "[", "Union", "[", "str", ",", "Iterable", "[", "str", "]", "]", "]", ",", "temp", ":", "bool", "=", "True", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
logs_handle_job
Task handling for sidecars logs.
polyaxon/logs_handlers/tasks/log_handlers.py
def logs_handle_job(job_uuid: str, job_name: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_job_logs(job_uuid=job_uuid, job_name=job_name, ...
def logs_handle_job(job_uuid: str, job_name: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_job_logs(job_uuid=job_uuid, job_name=job_name, ...
[ "Task", "handling", "for", "sidecars", "logs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/logs_handlers/tasks/log_handlers.py#L21-L29
[ "def", "logs_handle_job", "(", "job_uuid", ":", "str", ",", "job_name", ":", "str", ",", "log_lines", ":", "Optional", "[", "Union", "[", "str", ",", "Iterable", "[", "str", "]", "]", "]", ",", "temp", ":", "bool", "=", "True", ")", "->", "None", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
logs_handle_build_job
Task handling for sidecars logs.
polyaxon/logs_handlers/tasks/log_handlers.py
def logs_handle_build_job(job_uuid: str, job_name: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_build_job_logs(job_uuid=job_uuid, ...
def logs_handle_build_job(job_uuid: str, job_name: str, log_lines: Optional[Union[str, Iterable[str]]], temp: bool = True) -> None: """Task handling for sidecars logs.""" handle_build_job_logs(job_uuid=job_uuid, ...
[ "Task", "handling", "for", "sidecars", "logs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/logs_handlers/tasks/log_handlers.py#L33-L41
[ "def", "logs_handle_build_job", "(", "job_uuid", ":", "str", ",", "job_name", ":", "str", ",", "log_lines", ":", "Optional", "[", "Union", "[", "str", ",", "Iterable", "[", "str", "]", "]", "]", ",", "temp", ":", "bool", "=", "True", ")", "->", "None...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
HyperbandIterationManager.create_iteration
Create an iteration for the experiment group.
polyaxon/hpsearch/iteration_managers/hyperband.py
def create_iteration(self, num_suggestions=0): """Create an iteration for the experiment group.""" from db.models.experiment_groups import ExperimentGroupIteration search_manager = self.experiment_group.search_manager iteration_config = self.experiment_group.iteration_config if...
def create_iteration(self, num_suggestions=0): """Create an iteration for the experiment group.""" from db.models.experiment_groups import ExperimentGroupIteration search_manager = self.experiment_group.search_manager iteration_config = self.experiment_group.iteration_config if...
[ "Create", "an", "iteration", "for", "the", "experiment", "group", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/hyperband.py#L12-L48
[ "def", "create_iteration", "(", "self", ",", "num_suggestions", "=", "0", ")", ":", "from", "db", ".", "models", ".", "experiment_groups", "import", "ExperimentGroupIteration", "search_manager", "=", "self", ".", "experiment_group", ".", "search_manager", "iteration...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
HyperbandIterationManager.get_reduced_configs
Reduce the experiments to restart.
polyaxon/hpsearch/iteration_managers/hyperband.py
def get_reduced_configs(self): """Reduce the experiments to restart.""" iteration_config = self.experiment_group.iteration_config if iteration_config is None: logger.error( 'Experiment group `%s` attempt to update iteration, but has no iteration', self...
def get_reduced_configs(self): """Reduce the experiments to restart.""" iteration_config = self.experiment_group.iteration_config if iteration_config is None: logger.error( 'Experiment group `%s` attempt to update iteration, but has no iteration', self...
[ "Reduce", "the", "experiments", "to", "restart", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/hyperband.py#L50-L77
[ "def", "get_reduced_configs", "(", "self", ")", ":", "iteration_config", "=", "self", ".", "experiment_group", ".", "iteration_config", "if", "iteration_config", "is", "None", ":", "logger", ".", "error", "(", "'Experiment group `%s` attempt to update iteration, but has n...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
HyperbandIterationManager.reduce_configs
Reduce the experiments to restart.
polyaxon/hpsearch/iteration_managers/hyperband.py
def reduce_configs(self): """Reduce the experiments to restart.""" experiment_ids = self.get_reduced_configs() experiments = self.experiment_group.experiments.filter(id__in=experiment_ids) self.create_iteration() iteration_config = self.experiment_group.iteration_config h...
def reduce_configs(self): """Reduce the experiments to restart.""" experiment_ids = self.get_reduced_configs() experiments = self.experiment_group.experiments.filter(id__in=experiment_ids) self.create_iteration() iteration_config = self.experiment_group.iteration_config h...
[ "Reduce", "the", "experiments", "to", "restart", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/hyperband.py#L79-L113
[ "def", "reduce_configs", "(", "self", ")", ":", "experiment_ids", "=", "self", ".", "get_reduced_configs", "(", ")", "experiments", "=", "self", ".", "experiment_group", ".", "experiments", ".", "filter", "(", "id__in", "=", "experiment_ids", ")", "self", ".",...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Project.all_experiment_groups
Similar to experiment_groups, but uses the default manager to return archived experiments as well.
polyaxon/db/models/projects.py
def all_experiment_groups(self): """ Similar to experiment_groups, but uses the default manager to return archived experiments as well. """ from db.models.experiment_groups import ExperimentGroup return ExperimentGroup.all.filter(project=self)
def all_experiment_groups(self): """ Similar to experiment_groups, but uses the default manager to return archived experiments as well. """ from db.models.experiment_groups import ExperimentGroup return ExperimentGroup.all.filter(project=self)
[ "Similar", "to", "experiment_groups", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/projects.py#L113-L120
[ "def", "all_experiment_groups", "(", "self", ")", ":", "from", "db", ".", "models", ".", "experiment_groups", "import", "ExperimentGroup", "return", "ExperimentGroup", ".", "all", ".", "filter", "(", "project", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Project.all_jobs
Similar to jobs, but uses the default manager to return archived experiments as well.
polyaxon/db/models/projects.py
def all_jobs(self): """ Similar to jobs, but uses the default manager to return archived experiments as well. """ from db.models.jobs import Job return Job.all.filter(project=self)
def all_jobs(self): """ Similar to jobs, but uses the default manager to return archived experiments as well. """ from db.models.jobs import Job return Job.all.filter(project=self)
[ "Similar", "to", "jobs", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/projects.py#L123-L130
[ "def", "all_jobs", "(", "self", ")", ":", "from", "db", ".", "models", ".", "jobs", "import", "Job", "return", "Job", ".", "all", ".", "filter", "(", "project", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Project.all_build_jobs
Similar to build_jobs, but uses the default manager to return archived experiments as well.
polyaxon/db/models/projects.py
def all_build_jobs(self): """ Similar to build_jobs, but uses the default manager to return archived experiments as well. """ from db.models.build_jobs import BuildJob return BuildJob.all.filter(project=self)
def all_build_jobs(self): """ Similar to build_jobs, but uses the default manager to return archived experiments as well. """ from db.models.build_jobs import BuildJob return BuildJob.all.filter(project=self)
[ "Similar", "to", "build_jobs", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/projects.py#L133-L140
[ "def", "all_build_jobs", "(", "self", ")", ":", "from", "db", ".", "models", ".", "build_jobs", "import", "BuildJob", "return", "BuildJob", ".", "all", ".", "filter", "(", "project", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Project.all_notebook_jobs
Similar to notebook_jobs, but uses the default manager to return archived experiments as well.
polyaxon/db/models/projects.py
def all_notebook_jobs(self): """ Similar to notebook_jobs, but uses the default manager to return archived experiments as well. """ from db.models.notebooks import NotebookJob return NotebookJob.all.filter(project=self)
def all_notebook_jobs(self): """ Similar to notebook_jobs, but uses the default manager to return archived experiments as well. """ from db.models.notebooks import NotebookJob return NotebookJob.all.filter(project=self)
[ "Similar", "to", "notebook_jobs", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/projects.py#L143-L150
[ "def", "all_notebook_jobs", "(", "self", ")", ":", "from", "db", ".", "models", ".", "notebooks", "import", "NotebookJob", "return", "NotebookJob", ".", "all", ".", "filter", "(", "project", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Project.all_tensorboard_jobs
Similar to tensorboard_jobs, but uses the default manager to return archived experiments as well.
polyaxon/db/models/projects.py
def all_tensorboard_jobs(self): """ Similar to tensorboard_jobs, but uses the default manager to return archived experiments as well. """ from db.models.tensorboards import TensorboardJob return TensorboardJob.all.filter(project=self)
def all_tensorboard_jobs(self): """ Similar to tensorboard_jobs, but uses the default manager to return archived experiments as well. """ from db.models.tensorboards import TensorboardJob return TensorboardJob.all.filter(project=self)
[ "Similar", "to", "tensorboard_jobs", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/projects.py#L153-L160
[ "def", "all_tensorboard_jobs", "(", "self", ")", ":", "from", "db", ".", "models", ".", "tensorboards", "import", "TensorboardJob", "return", "TensorboardJob", ".", "all", ".", "filter", "(", "project", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ExperimentGroup.all_experiments
Similar to experiments, but uses the default manager to return archived experiments as well.
polyaxon/db/models/experiment_groups.py
def all_experiments(self): """ Similar to experiments, but uses the default manager to return archived experiments as well. """ from db.models.experiments import Experiment return Experiment.all.filter(experiment_group=self)
def all_experiments(self): """ Similar to experiments, but uses the default manager to return archived experiments as well. """ from db.models.experiments import Experiment return Experiment.all.filter(experiment_group=self)
[ "Similar", "to", "experiments", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/experiment_groups.py#L234-L241
[ "def", "all_experiments", "(", "self", ")", ":", "from", "db", ".", "models", ".", "experiments", "import", "Experiment", "return", "Experiment", ".", "all", ".", "filter", "(", "experiment_group", "=", "self", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ExperimentGroup.all_group_experiments
Similar to group_experiments, but uses the default manager to return archived experiments as well.
polyaxon/db/models/experiment_groups.py
def all_group_experiments(self): """ Similar to group_experiments, but uses the default manager to return archived experiments as well. """ from db.models.experiments import Experiment if self.is_selection: return Experiment.all.filter(selections=self) ...
def all_group_experiments(self): """ Similar to group_experiments, but uses the default manager to return archived experiments as well. """ from db.models.experiments import Experiment if self.is_selection: return Experiment.all.filter(selections=self) ...
[ "Similar", "to", "group_experiments", "but", "uses", "the", "default", "manager", "to", "return", "archived", "experiments", "as", "well", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/db/models/experiment_groups.py#L244-L253
[ "def", "all_group_experiments", "(", "self", ")", ":", "from", "db", ".", "models", ".", "experiments", "import", "Experiment", "if", "self", ".", "is_selection", ":", "return", "Experiment", ".", "all", ".", "filter", "(", "selections", "=", "self", ")", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_dag
Return a dag representation of the nodes passed. This is equally used for pipelines and pipeline runs. Params: nodes: an instance of `Operation` | `OperationRun` the nodes to represent en dag. downstream_fn: a function that returns the downstream nodes of the a node. Returns: tup...
polyaxon/pipelines/dags.py
def get_dag(nodes, downstream_fn) -> Tuple[Dict, Dict]: """Return a dag representation of the nodes passed. This is equally used for pipelines and pipeline runs. Params: nodes: an instance of `Operation` | `OperationRun` the nodes to represent en dag. downstream_fn: a function that returns...
def get_dag(nodes, downstream_fn) -> Tuple[Dict, Dict]: """Return a dag representation of the nodes passed. This is equally used for pipelines and pipeline runs. Params: nodes: an instance of `Operation` | `OperationRun` the nodes to represent en dag. downstream_fn: a function that returns...
[ "Return", "a", "dag", "representation", "of", "the", "nodes", "passed", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/dags.py#L7-L26
[ "def", "get_dag", "(", "nodes", ",", "downstream_fn", ")", "->", "Tuple", "[", "Dict", ",", "Dict", "]", ":", "dag", "=", "{", "}", "node_by_ids", "=", "{", "}", "for", "node", "in", "nodes", ":", "downstream_ops", "=", "downstream_fn", "(", "node", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_independent_nodes
Get a list of all node in the graph with no dependencies.
polyaxon/pipelines/dags.py
def get_independent_nodes(dag): """Get a list of all node in the graph with no dependencies.""" nodes = set(dag.keys()) dependent_nodes = set([node for downstream_nodes in dag.values() for node in downstream_nodes]) return set(nodes - dependent_nodes)
def get_independent_nodes(dag): """Get a list of all node in the graph with no dependencies.""" nodes = set(dag.keys()) dependent_nodes = set([node for downstream_nodes in dag.values() for node in downstream_nodes]) return set(nodes - dependent_nodes)
[ "Get", "a", "list", "of", "all", "node", "in", "the", "graph", "with", "no", "dependencies", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/dags.py#L29-L33
[ "def", "get_independent_nodes", "(", "dag", ")", ":", "nodes", "=", "set", "(", "dag", ".", "keys", "(", ")", ")", "dependent_nodes", "=", "set", "(", "[", "node", "for", "downstream_nodes", "in", "dag", ".", "values", "(", ")", "for", "node", "in", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_orphan_nodes
Get orphan nodes for given dag.
polyaxon/pipelines/dags.py
def get_orphan_nodes(dag): """Get orphan nodes for given dag.""" independent_nodes = get_independent_nodes(dag) return set([node for node in independent_nodes if not dag[node]])
def get_orphan_nodes(dag): """Get orphan nodes for given dag.""" independent_nodes = get_independent_nodes(dag) return set([node for node in independent_nodes if not dag[node]])
[ "Get", "orphan", "nodes", "for", "given", "dag", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/dags.py#L36-L39
[ "def", "get_orphan_nodes", "(", "dag", ")", ":", "independent_nodes", "=", "get_independent_nodes", "(", "dag", ")", "return", "set", "(", "[", "node", "for", "node", "in", "independent_nodes", "if", "not", "dag", "[", "node", "]", "]", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
has_dependencies
Checks if the node has dependencies.
polyaxon/pipelines/dags.py
def has_dependencies(node, dag): """Checks if the node has dependencies.""" for downstream_nodes in dag.values(): if node in downstream_nodes: return True return False
def has_dependencies(node, dag): """Checks if the node has dependencies.""" for downstream_nodes in dag.values(): if node in downstream_nodes: return True return False
[ "Checks", "if", "the", "node", "has", "dependencies", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/dags.py#L42-L47
[ "def", "has_dependencies", "(", "node", ",", "dag", ")", ":", "for", "downstream_nodes", "in", "dag", ".", "values", "(", ")", ":", "if", "node", "in", "downstream_nodes", ":", "return", "True", "return", "False" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
sort_topologically
Sort the dag breath first topologically. Only the nodes inside the dag are returned, i.e. the nodes that are also keys. Returns: a topological ordering of the DAG. Raises: an error if this is not possible (graph is not valid).
polyaxon/pipelines/dags.py
def sort_topologically(dag): """Sort the dag breath first topologically. Only the nodes inside the dag are returned, i.e. the nodes that are also keys. Returns: a topological ordering of the DAG. Raises: an error if this is not possible (graph is not valid). """ dag = copy.de...
def sort_topologically(dag): """Sort the dag breath first topologically. Only the nodes inside the dag are returned, i.e. the nodes that are also keys. Returns: a topological ordering of the DAG. Raises: an error if this is not possible (graph is not valid). """ dag = copy.de...
[ "Sort", "the", "dag", "breath", "first", "topologically", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/dags.py#L50-L77
[ "def", "sort_topologically", "(", "dag", ")", ":", "dag", "=", "copy", ".", "deepcopy", "(", "dag", ")", "sorted_nodes", "=", "[", "]", "independent_nodes", "=", "deque", "(", "get_independent_nodes", "(", "dag", ")", ")", "while", "independent_nodes", ":", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_negation_operation
Parse the negation modifier in an operation.
polyaxon/query/parser.py
def parse_negation_operation(operation: str) -> Tuple[bool, str]: """Parse the negation modifier in an operation.""" _operation = operation.strip() if not _operation: raise QueryParserException('Operation is not valid: {}'.format(operation)) negation = False if _operation[0] == '~': ...
def parse_negation_operation(operation: str) -> Tuple[bool, str]: """Parse the negation modifier in an operation.""" _operation = operation.strip() if not _operation: raise QueryParserException('Operation is not valid: {}'.format(operation)) negation = False if _operation[0] == '~': ...
[ "Parse", "the", "negation", "modifier", "in", "an", "operation", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L13-L23
[ "def", "parse_negation_operation", "(", "operation", ":", "str", ")", "->", "Tuple", "[", "bool", ",", "str", "]", ":", "_operation", "=", "operation", ".", "strip", "(", ")", "if", "not", "_operation", ":", "raise", "QueryParserException", "(", "'Operation ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_comparison_operation
Parse the comparision operator in an operation.
polyaxon/query/parser.py
def parse_comparison_operation(operation: str) -> Tuple[Optional[str], str]: """Parse the comparision operator in an operation.""" _operation = operation.strip() if not _operation: raise QueryParserException('Operation is not valid: {}'.format(operation)) # Check inclusion comparison if _ope...
def parse_comparison_operation(operation: str) -> Tuple[Optional[str], str]: """Parse the comparision operator in an operation.""" _operation = operation.strip() if not _operation: raise QueryParserException('Operation is not valid: {}'.format(operation)) # Check inclusion comparison if _ope...
[ "Parse", "the", "comparision", "operator", "in", "an", "operation", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L26-L42
[ "def", "parse_comparison_operation", "(", "operation", ":", "str", ")", "->", "Tuple", "[", "Optional", "[", "str", "]", ",", "str", "]", ":", "_operation", "=", "operation", ".", "strip", "(", ")", "if", "not", "_operation", ":", "raise", "QueryParserExce...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_datetime_operation
Parse datetime operations. A datetime operation can one of the following: * single value: start_date:2014-10-10, start_date:>2014-10-10, start_date:>=2014-10-10 * negation single value: start_date:~2014-10-10 * interval: start_date:2010-10-10 10:10 .. 2012-10-10 * negation interval: start_date...
polyaxon/query/parser.py
def parse_datetime_operation(operation: str) -> 'QueryOpSpec': """Parse datetime operations. A datetime operation can one of the following: * single value: start_date:2014-10-10, start_date:>2014-10-10, start_date:>=2014-10-10 * negation single value: start_date:~2014-10-10 * interval: start_da...
def parse_datetime_operation(operation: str) -> 'QueryOpSpec': """Parse datetime operations. A datetime operation can one of the following: * single value: start_date:2014-10-10, start_date:>2014-10-10, start_date:>=2014-10-10 * negation single value: start_date:~2014-10-10 * interval: start_da...
[ "Parse", "datetime", "operations", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L45-L88
[ "def", "parse_datetime_operation", "(", "operation", ":", "str", ")", "->", "'QueryOpSpec'", ":", "_operation", "=", "operation", ".", "strip", "(", ")", "if", "not", "_operation", ":", "raise", "QueryParserException", "(", "'Operation is not valid: {}'", ".", "fo...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_scalar_operation
Parse scalar operations. A scalar operation can one of the following: * single value: start_date:12, metric1:>0.9, metric1:>=-0.12 * negation single value: metric1:~1112, metric1:~<1112 equivalent to metric1:>=1112 This parser does not allow `|` and `..`.
polyaxon/query/parser.py
def parse_scalar_operation(operation: str) -> 'QueryOpSpec': """Parse scalar operations. A scalar operation can one of the following: * single value: start_date:12, metric1:>0.9, metric1:>=-0.12 * negation single value: metric1:~1112, metric1:~<1112 equivalent to metric1:>=1112 This parser does...
def parse_scalar_operation(operation: str) -> 'QueryOpSpec': """Parse scalar operations. A scalar operation can one of the following: * single value: start_date:12, metric1:>0.9, metric1:>=-0.12 * negation single value: metric1:~1112, metric1:~<1112 equivalent to metric1:>=1112 This parser does...
[ "Parse", "scalar", "operations", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L91-L130
[ "def", "parse_scalar_operation", "(", "operation", ":", "str", ")", "->", "'QueryOpSpec'", ":", "_operation", "=", "operation", ".", "strip", "(", ")", "if", "not", "_operation", ":", "raise", "QueryParserException", "(", "'Operation is not valid: {}'", ".", "form...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_expression
Base parsing for expressions. Every expression must follow a basic format: `name:[modifier|operator]operation[*[operator]operation]` So this parser just split the expression into: field name, operation.
polyaxon/query/parser.py
def parse_expression(expression: str) -> Tuple[str, str]: """Base parsing for expressions. Every expression must follow a basic format: `name:[modifier|operator]operation[*[operator]operation]` So this parser just split the expression into: field name, operation. """ try: _expressi...
def parse_expression(expression: str) -> Tuple[str, str]: """Base parsing for expressions. Every expression must follow a basic format: `name:[modifier|operator]operation[*[operator]operation]` So this parser just split the expression into: field name, operation. """ try: _expressi...
[ "Base", "parsing", "for", "expressions", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L180-L199
[ "def", "parse_expression", "(", "expression", ":", "str", ")", "->", "Tuple", "[", "str", ",", "str", "]", ":", "try", ":", "_expression", "=", "expression", ".", "strip", "(", ")", "name", ",", "operation", "=", "_expression", ".", "split", "(", "':'"...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
split_query
Split a query into different expressions. Example: name:bla, foo:<=1
polyaxon/query/parser.py
def split_query(query: str) -> List[str]: """Split a query into different expressions. Example: name:bla, foo:<=1 """ try: _query = query.strip() except (ValueError, AttributeError): raise QueryParserException('query is not valid, received instead {}'.format(query)) exp...
def split_query(query: str) -> List[str]: """Split a query into different expressions. Example: name:bla, foo:<=1 """ try: _query = query.strip() except (ValueError, AttributeError): raise QueryParserException('query is not valid, received instead {}'.format(query)) exp...
[ "Split", "a", "query", "into", "different", "expressions", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L202-L218
[ "def", "split_query", "(", "query", ":", "str", ")", "->", "List", "[", "str", "]", ":", "try", ":", "_query", "=", "query", ".", "strip", "(", ")", "except", "(", "ValueError", ",", "AttributeError", ")", ":", "raise", "QueryParserException", "(", "'q...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
tokenize_query
Tokenizes a standard search query in name: operations mapping. Example: moo:bla, foo:~<=1, foo:ll..ff { 'moo': ['bla'], 'foo': ['~<=1', 'll..ff'] }
polyaxon/query/parser.py
def tokenize_query(query: str) -> Dict[str, Iterable]: """Tokenizes a standard search query in name: operations mapping. Example: moo:bla, foo:~<=1, foo:ll..ff { 'moo': ['bla'], 'foo': ['~<=1', 'll..ff'] } """ expressions = split_query(query) name_operat...
def tokenize_query(query: str) -> Dict[str, Iterable]: """Tokenizes a standard search query in name: operations mapping. Example: moo:bla, foo:~<=1, foo:ll..ff { 'moo': ['bla'], 'foo': ['~<=1', 'll..ff'] } """ expressions = split_query(query) name_operat...
[ "Tokenizes", "a", "standard", "search", "query", "in", "name", ":", "operations", "mapping", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L221-L237
[ "def", "tokenize_query", "(", "query", ":", "str", ")", "->", "Dict", "[", "str", ",", "Iterable", "]", ":", "expressions", "=", "split_query", "(", "query", ")", "name_operation_tuples", "=", "[", "parse_expression", "(", "expression", ")", "for", "expressi...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
parse_field
Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo
polyaxon/query/parser.py
def parse_field(field: str) -> Tuple[str, Optional[str]]: """Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo """ _field = field.split('.') _field = [f.strip() for f in _field] if len(_field) == 1 and _field[0]: ...
def parse_field(field: str) -> Tuple[str, Optional[str]]: """Parses fields with underscores, and return field and suffix. Example: foo => foo, None metric.foo => metric, foo """ _field = field.split('.') _field = [f.strip() for f in _field] if len(_field) == 1 and _field[0]: ...
[ "Parses", "fields", "with", "underscores", "and", "return", "field", "and", "suffix", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/query/parser.py#L240-L256
[ "def", "parse_field", "(", "field", ":", "str", ")", "->", "Tuple", "[", "str", ",", "Optional", "[", "str", "]", "]", ":", "_field", "=", "field", ".", "split", "(", "'.'", ")", "_field", "=", "[", "f", ".", "strip", "(", ")", "for", "f", "in"...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
set_op_upstreams
Set the upstream operations for operation run.
polyaxon/pipelines/utils.py
def set_op_upstreams(op_run, op): """Set the upstream operations for operation run.""" # We get a list of all upstream ops or the current op upstream_ops = op.upstream_operations.values_list('id', flat=True) # We get latest op runs for the upstream_ops latest_op_runs = OperationRun.objects.filter(id...
def set_op_upstreams(op_run, op): """Set the upstream operations for operation run.""" # We get a list of all upstream ops or the current op upstream_ops = op.upstream_operations.values_list('id', flat=True) # We get latest op runs for the upstream_ops latest_op_runs = OperationRun.objects.filter(id...
[ "Set", "the", "upstream", "operations", "for", "operation", "run", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/utils.py#L7-L16
[ "def", "set_op_upstreams", "(", "op_run", ",", "op", ")", ":", "# We get a list of all upstream ops or the current op", "upstream_ops", "=", "op", ".", "upstream_operations", ".", "values_list", "(", "'id'", ",", "flat", "=", "True", ")", "# We get latest op runs for th...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
set_topological_dag_upstreams
Set the upstream runs for the operation runs in the dag following the topological sort.
polyaxon/pipelines/utils.py
def set_topological_dag_upstreams(dag, ops, op_runs, runs_by_ops): """Set the upstream runs for the operation runs in the dag following the topological sort.""" sorted_ops = dags.sort_topologically(dag=dag) for op_id in sorted_ops: op_run_id = runs_by_ops[op_id] op_run = op_runs[op_run_id] ...
def set_topological_dag_upstreams(dag, ops, op_runs, runs_by_ops): """Set the upstream runs for the operation runs in the dag following the topological sort.""" sorted_ops = dags.sort_topologically(dag=dag) for op_id in sorted_ops: op_run_id = runs_by_ops[op_id] op_run = op_runs[op_run_id] ...
[ "Set", "the", "upstream", "runs", "for", "the", "operation", "runs", "in", "the", "dag", "following", "the", "topological", "sort", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/utils.py#L19-L25
[ "def", "set_topological_dag_upstreams", "(", "dag", ",", "ops", ",", "op_runs", ",", "runs_by_ops", ")", ":", "sorted_ops", "=", "dags", ".", "sort_topologically", "(", "dag", "=", "dag", ")", "for", "op_id", "in", "sorted_ops", ":", "op_run_id", "=", "runs_...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
create_pipeline_run
Create a pipeline run/instance.
polyaxon/pipelines/utils.py
def create_pipeline_run(pipeline, context_by_op): """Create a pipeline run/instance.""" pipeline_run = PipelineRun.objects.create(pipeline=pipeline) dag, ops = pipeline.dag # Go trough the operation and create operation runs and the upstreams op_runs = {} runs_by_ops = {} for op_id in dag.ke...
def create_pipeline_run(pipeline, context_by_op): """Create a pipeline run/instance.""" pipeline_run = PipelineRun.objects.create(pipeline=pipeline) dag, ops = pipeline.dag # Go trough the operation and create operation runs and the upstreams op_runs = {} runs_by_ops = {} for op_id in dag.ke...
[ "Create", "a", "pipeline", "run", "/", "instance", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/pipelines/utils.py#L28-L46
[ "def", "create_pipeline_run", "(", "pipeline", ",", "context_by_op", ")", ":", "pipeline_run", "=", "PipelineRun", ".", "objects", ".", "create", "(", "pipeline", "=", "pipeline", ")", "dag", ",", "ops", "=", "pipeline", ".", "dag", "# Go trough the operation an...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
k8s_events_handle_experiment_job_statuses
Experiment jobs statuses
polyaxon/k8s_events_handlers/tasks/statuses.py
def k8s_events_handle_experiment_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Experiment jobs statuses""" details = payload['details'] job_uuid = details['labels']['job_uuid'] logger.debug('handling events status for job_uuid: %s, status: %s', job_uuid, payload['stat...
def k8s_events_handle_experiment_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Experiment jobs statuses""" details = payload['details'] job_uuid = details['labels']['job_uuid'] logger.debug('handling events status for job_uuid: %s, status: %s', job_uuid, payload['stat...
[ "Experiment", "jobs", "statuses" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/k8s_events_handlers/tasks/statuses.py#L30-L64
[ "def", "k8s_events_handle_experiment_job_statuses", "(", "self", ":", "'celery_app.task'", ",", "payload", ":", "Dict", ")", "->", "None", ":", "details", "=", "payload", "[", "'details'", "]", "job_uuid", "=", "details", "[", "'labels'", "]", "[", "'job_uuid'",...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
k8s_events_handle_job_statuses
Project jobs statuses
polyaxon/k8s_events_handlers/tasks/statuses.py
def k8s_events_handle_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project jobs statuses""" details = payload['details'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['labels'].get('project_name') logger.debug('handli...
def k8s_events_handle_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project jobs statuses""" details = payload['details'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['labels'].get('project_name') logger.debug('handli...
[ "Project", "jobs", "statuses" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/k8s_events_handlers/tasks/statuses.py#L71-L100
[ "def", "k8s_events_handle_job_statuses", "(", "self", ":", "'celery_app.task'", ",", "payload", ":", "Dict", ")", "->", "None", ":", "details", "=", "payload", "[", "'details'", "]", "job_uuid", "=", "details", "[", "'labels'", "]", "[", "'job_uuid'", "]", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
k8s_events_handle_plugin_job_statuses
Project Plugin jobs statuses
polyaxon/k8s_events_handlers/tasks/statuses.py
def k8s_events_handle_plugin_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project Plugin jobs statuses""" details = payload['details'] app = details['labels']['app'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['labe...
def k8s_events_handle_plugin_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project Plugin jobs statuses""" details = payload['details'] app = details['labels']['app'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['labe...
[ "Project", "Plugin", "jobs", "statuses" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/k8s_events_handlers/tasks/statuses.py#L107-L142
[ "def", "k8s_events_handle_plugin_job_statuses", "(", "self", ":", "'celery_app.task'", ",", "payload", ":", "Dict", ")", "->", "None", ":", "details", "=", "payload", "[", "'details'", "]", "app", "=", "details", "[", "'labels'", "]", "[", "'app'", "]", "job...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
k8s_events_handle_build_job_statuses
Project Plugin jobs statuses
polyaxon/k8s_events_handlers/tasks/statuses.py
def k8s_events_handle_build_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project Plugin jobs statuses""" details = payload['details'] app = details['labels']['app'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['label...
def k8s_events_handle_build_job_statuses(self: 'celery_app.task', payload: Dict) -> None: """Project Plugin jobs statuses""" details = payload['details'] app = details['labels']['app'] job_uuid = details['labels']['job_uuid'] job_name = details['labels']['job_name'] project_name = details['label...
[ "Project", "Plugin", "jobs", "statuses" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/k8s_events_handlers/tasks/statuses.py#L149-L178
[ "def", "k8s_events_handle_build_job_statuses", "(", "self", ":", "'celery_app.task'", ",", "payload", ":", "Dict", ")", "->", "None", ":", "details", "=", "payload", "[", "'details'", "]", "app", "=", "details", "[", "'labels'", "]", "[", "'app'", "]", "job_...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_sidecar_container
Return a pod sidecar container.
polyaxon/scheduler/spawners/templates/sidecars.py
def get_sidecar_container(job_container_name, sidecar_container_name, sidecar_docker_image, sidecar_docker_image_pull_policy, namespace, sidecar_config, sidecar_arg...
def get_sidecar_container(job_container_name, sidecar_container_name, sidecar_docker_image, sidecar_docker_image_pull_policy, namespace, sidecar_config, sidecar_arg...
[ "Return", "a", "pod", "sidecar", "container", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/sidecars.py#L38-L61
[ "def", "get_sidecar_container", "(", "job_container_name", ",", "sidecar_container_name", ",", "sidecar_docker_image", ",", "sidecar_docker_image_pull_policy", ",", "namespace", ",", "sidecar_config", ",", "sidecar_args", ",", "internal_health_check_url", ",", "volume_mounts", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ProtectedView.handle_exception
Use custom exception handler for errors.
polyaxon/api/utils/views/protected.py
def handle_exception(self, exc): """Use custom exception handler for errors.""" if isinstance( exc, (rest_exceptions.NotAuthenticated, rest_exceptions.AuthenticationFailed)) and self.HANDLE_UNAUTHENTICATED: return HttpResponseRedirect('{}?next={}'.format( ...
def handle_exception(self, exc): """Use custom exception handler for errors.""" if isinstance( exc, (rest_exceptions.NotAuthenticated, rest_exceptions.AuthenticationFailed)) and self.HANDLE_UNAUTHENTICATED: return HttpResponseRedirect('{}?next={}'.format( ...
[ "Use", "custom", "exception", "handler", "for", "errors", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/utils/views/protected.py#L21-L36
[ "def", "handle_exception", "(", "self", ",", "exc", ")", ":", "if", "isinstance", "(", "exc", ",", "(", "rest_exceptions", ".", "NotAuthenticated", ",", "rest_exceptions", ".", "AuthenticationFailed", ")", ")", "and", "self", ".", "HANDLE_UNAUTHENTICATED", ":", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_resources
Create resources requirements. Args: resources: `PodResourcesConfig` Return: `V1ResourceRequirements`
polyaxon/scheduler/spawners/templates/resources.py
def get_resources(resources): # pylint:disable=too-many-branches """Create resources requirements. Args: resources: `PodResourcesConfig` Return: `V1ResourceRequirements` """ limits = {} requests = {} if resources is None: return None if resources.cpu: i...
def get_resources(resources): # pylint:disable=too-many-branches """Create resources requirements. Args: resources: `PodResourcesConfig` Return: `V1ResourceRequirements` """ limits = {} requests = {} if resources is None: return None if resources.cpu: i...
[ "Create", "resources", "requirements", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/resources.py#L6-L42
[ "def", "get_resources", "(", "resources", ")", ":", "# pylint:disable=too-many-branches", "limits", "=", "{", "}", "requests", "=", "{", "}", "if", "resources", "is", "None", ":", "return", "None", "if", "resources", ".", "cpu", ":", "if", "resources", ".", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
has_project_permissions
This logic is extracted here to be used also with Sanic api.
polyaxon/scopes/permissions/projects.py
def has_project_permissions(user: 'User', project: 'Project', request_method: str) -> bool: """This logic is extracted here to be used also with Sanic api.""" # Superusers and the creator is allowed to do everything if user.is_staff or user.is_superuser or project.user == user: return True # Ot...
def has_project_permissions(user: 'User', project: 'Project', request_method: str) -> bool: """This logic is extracted here to be used also with Sanic api.""" # Superusers and the creator is allowed to do everything if user.is_staff or user.is_superuser or project.user == user: return True # Ot...
[ "This", "logic", "is", "extracted", "here", "to", "be", "used", "also", "with", "Sanic", "api", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scopes/permissions/projects.py#L19-L26
[ "def", "has_project_permissions", "(", "user", ":", "'User'", ",", "project", ":", "'Project'", ",", "request_method", ":", "str", ")", "->", "bool", ":", "# Superusers and the creator is allowed to do everything", "if", "user", ".", "is_staff", "or", "user", ".", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
experiment_group_pre_delete
Delete all group outputs.
polyaxon/signals/deletion.py
def experiment_group_pre_delete(sender, **kwargs): """Delete all group outputs.""" instance = kwargs['instance'] if instance.is_selection: return # Delete outputs and logs celery_app.send_task( SchedulerCeleryTasks.STORES_SCHEDULE_OUTPUTS_DELETION, kwargs={ 'per...
def experiment_group_pre_delete(sender, **kwargs): """Delete all group outputs.""" instance = kwargs['instance'] if instance.is_selection: return # Delete outputs and logs celery_app.send_task( SchedulerCeleryTasks.STORES_SCHEDULE_OUTPUTS_DELETION, kwargs={ 'per...
[ "Delete", "all", "group", "outputs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/signals/deletion.py#L56-L77
[ "def", "experiment_group_pre_delete", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "if", "instance", ".", "is_selection", ":", "return", "# Delete outputs and logs", "celery_app", ".", "send_task", "(", "Sc...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
experiment_group_post_delete
Delete all group outputs.
polyaxon/signals/deletion.py
def experiment_group_post_delete(sender, **kwargs): """Delete all group outputs.""" instance = kwargs['instance'] auditor.record(event_type=EXPERIMENT_GROUP_DELETED, instance=instance) remove_bookmarks(object_id=instance.id, content_type='experimentgroup')
def experiment_group_post_delete(sender, **kwargs): """Delete all group outputs.""" instance = kwargs['instance'] auditor.record(event_type=EXPERIMENT_GROUP_DELETED, instance=instance) remove_bookmarks(object_id=instance.id, content_type='experimentgroup')
[ "Delete", "all", "group", "outputs", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/signals/deletion.py#L82-L86
[ "def", "experiment_group_post_delete", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "auditor", ".", "record", "(", "event_type", "=", "EXPERIMENT_GROUP_DELETED", ",", "instance", "=", "instance", ")", "re...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
get_asset_url
Return a static asset URL (located within Polyaxon's static files). Example: ```python >>> get_asset_url('polyaxon', 'dist/global.css') ... "/_static/74d127b78dc7daf2c51f/polyaxon/dist/global.css" ```
polyaxon/libs/statics.py
def get_asset_url(module: str, path: str) -> str: """Return a static asset URL (located within Polyaxon's static files). Example: ```python >>> get_asset_url('polyaxon', 'dist/global.css') ... "/_static/74d127b78dc7daf2c51f/polyaxon/dist/global.css" ``` """ return '{}/{}...
def get_asset_url(module: str, path: str) -> str: """Return a static asset URL (located within Polyaxon's static files). Example: ```python >>> get_asset_url('polyaxon', 'dist/global.css') ... "/_static/74d127b78dc7daf2c51f/polyaxon/dist/global.css" ``` """ return '{}/{}...
[ "Return", "a", "static", "asset", "URL", "(", "located", "within", "Polyaxon", "s", "static", "files", ")", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/libs/statics.py#L4-L17
[ "def", "get_asset_url", "(", "module", ":", "str", ",", "path", ":", "str", ")", "->", "str", ":", "return", "'{}/{}/{}'", ".", "format", "(", "settings", ".", "STATIC_URL", ".", "rstrip", "(", "'/'", ")", ",", "module", ",", "path", ".", "lstrip", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ResourceManager.get_init_container
Pod init container for setting outputs path.
polyaxon/scheduler/spawners/templates/jobs/manager.py
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/jobs/manager.py#L131-L158
[ "def", "get_init_container", "(", "self", ",", "init_command", ",", "init_args", ",", "env_vars", ",", "context_mounts", ",", "persistence_outputs", ",", "persistence_data", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ResourceManager.get_init_container
Pod init container for setting outputs path.
polyaxon/scheduler/spawners/templates/dockerizers/manager.py
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/dockerizers/manager.py#L111-L131
[ "def", "get_init_container", "(", "self", ",", "init_command", ",", "init_args", ",", "env_vars", ",", "context_mounts", ",", "persistence_outputs", ",", "persistence_data", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseIterationManager.create_iteration
Create an iteration for the experiment group (works for grid and random).
polyaxon/hpsearch/iteration_managers/base.py
def create_iteration(self, num_suggestions): """Create an iteration for the experiment group (works for grid and random).""" from db.models.experiment_groups import ExperimentGroupIteration iteration_config = BaseIterationConfig(iteration=0, num_su...
def create_iteration(self, num_suggestions): """Create an iteration for the experiment group (works for grid and random).""" from db.models.experiment_groups import ExperimentGroupIteration iteration_config = BaseIterationConfig(iteration=0, num_su...
[ "Create", "an", "iteration", "for", "the", "experiment", "group", "(", "works", "for", "grid", "and", "random", ")", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L9-L19
[ "def", "create_iteration", "(", "self", ",", "num_suggestions", ")", ":", "from", "db", ".", "models", ".", "experiment_groups", "import", "ExperimentGroupIteration", "iteration_config", "=", "BaseIterationConfig", "(", "iteration", "=", "0", ",", "num_suggestions", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseIterationManager.update_iteration
Update the last experiment group's iteration with experiment performance.
polyaxon/hpsearch/iteration_managers/base.py
def update_iteration(self): """Update the last experiment group's iteration with experiment performance.""" iteration_config = self.get_iteration_config() if not iteration_config: return experiments_metrics = self.experiment_group.get_experiments_metrics( experime...
def update_iteration(self): """Update the last experiment group's iteration with experiment performance.""" iteration_config = self.get_iteration_config() if not iteration_config: return experiments_metrics = self.experiment_group.get_experiments_metrics( experime...
[ "Update", "the", "last", "experiment", "group", "s", "iteration", "with", "experiment", "performance", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L38-L48
[ "def", "update_iteration", "(", "self", ")", ":", "iteration_config", "=", "self", ".", "get_iteration_config", "(", ")", "if", "not", "iteration_config", ":", "return", "experiments_metrics", "=", "self", ".", "experiment_group", ".", "get_experiments_metrics", "("...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
BaseIterationManager.update_iteration_num_suggestions
Update iteration's num_suggestions.
polyaxon/hpsearch/iteration_managers/base.py
def update_iteration_num_suggestions(self, num_suggestions): """Update iteration's num_suggestions.""" iteration_config = self.experiment_group.iteration_config iteration_config.num_suggestions = num_suggestions self._update_config(iteration_config)
def update_iteration_num_suggestions(self, num_suggestions): """Update iteration's num_suggestions.""" iteration_config = self.experiment_group.iteration_config iteration_config.num_suggestions = num_suggestions self._update_config(iteration_config)
[ "Update", "iteration", "s", "num_suggestions", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L50-L55
[ "def", "update_iteration_num_suggestions", "(", "self", ",", "num_suggestions", ")", ":", "iteration_config", "=", "self", ".", "experiment_group", ".", "iteration_config", "iteration_config", ".", "num_suggestions", "=", "num_suggestions", "self", ".", "_update_config", ...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
ExperimentCreateSerializer.validate_config
We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment.
polyaxon/api/experiments/serializers.py
def validate_config(self, config): """We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment. """ # config is optional if not config: return config spec = validate_experime...
def validate_config(self, config): """We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment. """ # config is optional if not config: return config spec = validate_experime...
[ "We", "only", "validate", "the", "config", "if", "passed", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/experiments/serializers.py#L269-L288
[ "def", "validate_config", "(", "self", ",", "config", ")", ":", "# config is optional", "if", "not", "config", ":", "return", "config", "spec", "=", "validate_experiment_spec_config", "(", "config", ")", "if", "spec", ".", "is_experiment", ":", "# Resume normal cr...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
Event.get_event_action
Return the second part of the event_type e.g. >>> Event.event_type = 'experiment.deleted' >>> Event.get_event_action() == 'deleted'
polyaxon/event_manager/event.py
def get_event_action(cls) -> Optional[str]: """Return the second part of the event_type e.g. >>> Event.event_type = 'experiment.deleted' >>> Event.get_event_action() == 'deleted' """ if not cls.actor: return None return event_context.get_event_action...
def get_event_action(cls) -> Optional[str]: """Return the second part of the event_type e.g. >>> Event.event_type = 'experiment.deleted' >>> Event.get_event_action() == 'deleted' """ if not cls.actor: return None return event_context.get_event_action...
[ "Return", "the", "second", "part", "of", "the", "event_type" ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/event_manager/event.py#L136-L146
[ "def", "get_event_action", "(", "cls", ")", "->", "Optional", "[", "str", "]", ":", "if", "not", "cls", ".", "actor", ":", "return", "None", "return", "event_context", ".", "get_event_action", "(", "cls", ".", "event_type", ")" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
create_build_job
Get or Create a build job based on the params. If a build job already exists, then we check if the build has already an image created. If the image does not exists, and the job is already done we force create a new job. Returns: tuple: (build_job, image_exists[bool], build_status[bool])
polyaxon/scheduler/dockerizer_scheduler.py
def create_build_job(user, project, config, code_reference, configmap_refs=None, secret_refs=None): """Get or Create a build job based on the params. If a build job already exists, then we check if the build has already an image created. If the image does not exists, and the job is already done we force cr...
def create_build_job(user, project, config, code_reference, configmap_refs=None, secret_refs=None): """Get or Create a build job based on the params. If a build job already exists, then we check if the build has already an image created. If the image does not exists, and the job is already done we force cr...
[ "Get", "or", "Create", "a", "build", "job", "based", "on", "the", "params", "." ]
polyaxon/polyaxon
python
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/dockerizer_scheduler.py#L22-L62
[ "def", "create_build_job", "(", "user", ",", "project", ",", "config", ",", "code_reference", ",", "configmap_refs", "=", "None", ",", "secret_refs", "=", "None", ")", ":", "build_job", ",", "rebuild", "=", "BuildJob", ".", "create", "(", "user", "=", "use...
e1724f0756b1a42f9e7aa08a976584a84ef7f016
train
scan
Scan a YAML stream and produce scanning tokens.
lib/yaml/__init__.py
def scan(stream, Loader=Loader): """ Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) try: while loader.check_token(): yield loader.get_token() finally: loader.dispose()
def scan(stream, Loader=Loader): """ Scan a YAML stream and produce scanning tokens. """ loader = Loader(stream) try: while loader.check_token(): yield loader.get_token() finally: loader.dispose()
[ "Scan", "a", "YAML", "stream", "and", "produce", "scanning", "tokens", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L58-L67
[ "def", "scan", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_token", "(", ")", ":", "yield", "loader", ".", "get_token", "(", ")", "finally", ":", "loade...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
parse
Parse a YAML stream and produce parsing events.
lib/yaml/__init__.py
def parse(stream, Loader=Loader): """ Parse a YAML stream and produce parsing events. """ loader = Loader(stream) try: while loader.check_event(): yield loader.get_event() finally: loader.dispose()
def parse(stream, Loader=Loader): """ Parse a YAML stream and produce parsing events. """ loader = Loader(stream) try: while loader.check_event(): yield loader.get_event() finally: loader.dispose()
[ "Parse", "a", "YAML", "stream", "and", "produce", "parsing", "events", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L69-L78
[ "def", "parse", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_event", "(", ")", ":", "yield", "loader", ".", "get_event", "(", ")", "finally", ":", "load...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
compose
Parse the first YAML document in a stream and produce the corresponding representation tree.
lib/yaml/__init__.py
def compose(stream, Loader=Loader): """ Parse the first YAML document in a stream and produce the corresponding representation tree. """ loader = Loader(stream) try: return loader.get_single_node() finally: loader.dispose()
def compose(stream, Loader=Loader): """ Parse the first YAML document in a stream and produce the corresponding representation tree. """ loader = Loader(stream) try: return loader.get_single_node() finally: loader.dispose()
[ "Parse", "the", "first", "YAML", "document", "in", "a", "stream", "and", "produce", "the", "corresponding", "representation", "tree", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L80-L89
[ "def", "compose", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "return", "loader", ".", "get_single_node", "(", ")", "finally", ":", "loader", ".", "dispose", "(", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
compose_all
Parse all YAML documents in a stream and produce corresponding representation trees.
lib/yaml/__init__.py
def compose_all(stream, Loader=Loader): """ Parse all YAML documents in a stream and produce corresponding representation trees. """ loader = Loader(stream) try: while loader.check_node(): yield loader.get_node() finally: loader.dispose()
def compose_all(stream, Loader=Loader): """ Parse all YAML documents in a stream and produce corresponding representation trees. """ loader = Loader(stream) try: while loader.check_node(): yield loader.get_node() finally: loader.dispose()
[ "Parse", "all", "YAML", "documents", "in", "a", "stream", "and", "produce", "corresponding", "representation", "trees", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L91-L101
[ "def", "compose_all", "(", "stream", ",", "Loader", "=", "Loader", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_node", "(", ")", ":", "yield", "loader", ".", "get_node", "(", ")", "finally", ":", "...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
load
Parse the first YAML document in a stream and produce the corresponding Python object.
lib/yaml/__init__.py
def load(stream, Loader=None): """ Parse the first YAML document in a stream and produce the corresponding Python object. """ if Loader is None: load_warning('load') Loader = FullLoader loader = Loader(stream) try: return loader.get_single_data() finally: ...
def load(stream, Loader=None): """ Parse the first YAML document in a stream and produce the corresponding Python object. """ if Loader is None: load_warning('load') Loader = FullLoader loader = Loader(stream) try: return loader.get_single_data() finally: ...
[ "Parse", "the", "first", "YAML", "document", "in", "a", "stream", "and", "produce", "the", "corresponding", "Python", "object", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L103-L116
[ "def", "load", "(", "stream", ",", "Loader", "=", "None", ")", ":", "if", "Loader", "is", "None", ":", "load_warning", "(", "'load'", ")", "Loader", "=", "FullLoader", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "return", "loader", ".", ...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
load_all
Parse all YAML documents in a stream and produce corresponding Python objects.
lib/yaml/__init__.py
def load_all(stream, Loader=None): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ if Loader is None: load_warning('load_all') Loader = FullLoader loader = Loader(stream) try: while loader.check_data(): yield loader....
def load_all(stream, Loader=None): """ Parse all YAML documents in a stream and produce corresponding Python objects. """ if Loader is None: load_warning('load_all') Loader = FullLoader loader = Loader(stream) try: while loader.check_data(): yield loader....
[ "Parse", "all", "YAML", "documents", "in", "a", "stream", "and", "produce", "corresponding", "Python", "objects", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L118-L132
[ "def", "load_all", "(", "stream", ",", "Loader", "=", "None", ")", ":", "if", "Loader", "is", "None", ":", "load_warning", "(", "'load_all'", ")", "Loader", "=", "FullLoader", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
emit
Emit YAML parsing events into a stream. If stream is None, return the produced string instead.
lib/yaml/__init__.py
def emit(events, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None): """ Emit YAML parsing events into a stream. If stream is None, return the produced string instead. """ getvalue = None if stream is None: from Strin...
def emit(events, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None): """ Emit YAML parsing events into a stream. If stream is None, return the produced string instead. """ getvalue = None if stream is None: from Strin...
[ "Emit", "YAML", "parsing", "events", "into", "a", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L194-L214
[ "def", "emit", "(", "events", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "canonical", "=", "None", ",", "indent", "=", "None", ",", "width", "=", "None", ",", "allow_unicode", "=", "None", ",", "line_break", "=", "None", ")", ":",...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
serialize
Serialize a representation tree into a YAML stream. If stream is None, return the produced string instead.
lib/yaml/__init__.py
def serialize(node, stream=None, Dumper=Dumper, **kwds): """ Serialize a representation tree into a YAML stream. If stream is None, return the produced string instead. """ return serialize_all([node], stream, Dumper=Dumper, **kwds)
def serialize(node, stream=None, Dumper=Dumper, **kwds): """ Serialize a representation tree into a YAML stream. If stream is None, return the produced string instead. """ return serialize_all([node], stream, Dumper=Dumper, **kwds)
[ "Serialize", "a", "representation", "tree", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L247-L252
[ "def", "serialize", "(", "node", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")", ":", "return", "serialize_all", "(", "[", "node", "]", ",", "stream", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
dump
Serialize a Python object into a YAML stream. If stream is None, return the produced string instead.
lib/yaml/__init__.py
def dump(data, stream=None, Dumper=Dumper, **kwds): """ Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=Dumper, **kwds)
def dump(data, stream=None, Dumper=Dumper, **kwds): """ Serialize a Python object into a YAML stream. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=Dumper, **kwds)
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L288-L293
[ "def", "dump", "(", "data", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "[", "data", "]", ",", "stream", ",", "Dumper", "=", "Dumper", ",", "*", "*", "kwds", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
safe_dump_all
Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
lib/yaml/__init__.py
def safe_dump_all(documents, stream=None, **kwds): """ Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
def safe_dump_all(documents, stream=None, **kwds): """ Serialize a sequence of Python objects into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all(documents, stream, Dumper=SafeDumper, **kwds)
[ "Serialize", "a", "sequence", "of", "Python", "objects", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L295-L301
[ "def", "safe_dump_all", "(", "documents", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "documents", ",", "stream", ",", "Dumper", "=", "SafeDumper", ",", "*", "*", "kwds", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
safe_dump
Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead.
lib/yaml/__init__.py
def safe_dump(data, stream=None, **kwds): """ Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=SafeDumper, **kwds)
def safe_dump(data, stream=None, **kwds): """ Serialize a Python object into a YAML stream. Produce only basic YAML tags. If stream is None, return the produced string instead. """ return dump_all([data], stream, Dumper=SafeDumper, **kwds)
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L303-L309
[ "def", "safe_dump", "(", "data", ",", "stream", "=", "None", ",", "*", "*", "kwds", ")", ":", "return", "dump_all", "(", "[", "data", "]", ",", "stream", ",", "Dumper", "=", "SafeDumper", ",", "*", "*", "kwds", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
add_implicit_resolver
Add an implicit scalar detector. If an implicit scalar value matches the given regexp, the corresponding tag is assigned to the scalar. first is a sequence of possible initial characters or None.
lib/yaml/__init__.py
def add_implicit_resolver(tag, regexp, first=None, Loader=Loader, Dumper=Dumper): """ Add an implicit scalar detector. If an implicit scalar value matches the given regexp, the corresponding tag is assigned to the scalar. first is a sequence of possible initial characters or None. """ ...
def add_implicit_resolver(tag, regexp, first=None, Loader=Loader, Dumper=Dumper): """ Add an implicit scalar detector. If an implicit scalar value matches the given regexp, the corresponding tag is assigned to the scalar. first is a sequence of possible initial characters or None. """ ...
[ "Add", "an", "implicit", "scalar", "detector", ".", "If", "an", "implicit", "scalar", "value", "matches", "the", "given", "regexp", "the", "corresponding", "tag", "is", "assigned", "to", "the", "scalar", ".", "first", "is", "a", "sequence", "of", "possible",...
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L311-L320
[ "def", "add_implicit_resolver", "(", "tag", ",", "regexp", ",", "first", "=", "None", ",", "Loader", "=", "Loader", ",", "Dumper", "=", "Dumper", ")", ":", "Loader", ".", "add_implicit_resolver", "(", "tag", ",", "regexp", ",", "first", ")", "Dumper", "....
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
add_path_resolver
Add a path based resolver for the given tag. A path is a list of keys that forms a path to a node in the representation tree. Keys can be string values, integers, or None.
lib/yaml/__init__.py
def add_path_resolver(tag, path, kind=None, Loader=Loader, Dumper=Dumper): """ Add a path based resolver for the given tag. A path is a list of keys that forms a path to a node in the representation tree. Keys can be string values, integers, or None. """ Loader.add_path_resolver(tag, path, k...
def add_path_resolver(tag, path, kind=None, Loader=Loader, Dumper=Dumper): """ Add a path based resolver for the given tag. A path is a list of keys that forms a path to a node in the representation tree. Keys can be string values, integers, or None. """ Loader.add_path_resolver(tag, path, k...
[ "Add", "a", "path", "based", "resolver", "for", "the", "given", "tag", ".", "A", "path", "is", "a", "list", "of", "keys", "that", "forms", "a", "path", "to", "a", "node", "in", "the", "representation", "tree", ".", "Keys", "can", "be", "string", "val...
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L322-L330
[ "def", "add_path_resolver", "(", "tag", ",", "path", ",", "kind", "=", "None", ",", "Loader", "=", "Loader", ",", "Dumper", "=", "Dumper", ")", ":", "Loader", ".", "add_path_resolver", "(", "tag", ",", "path", ",", "kind", ")", "Dumper", ".", "add_path...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
YAMLObject.to_yaml
Convert a Python object to a representation node.
lib/yaml/__init__.py
def to_yaml(cls, dumper, data): """ Convert a Python object to a representation node. """ return dumper.represent_yaml_object(cls.yaml_tag, data, cls, flow_style=cls.yaml_flow_style)
def to_yaml(cls, dumper, data): """ Convert a Python object to a representation node. """ return dumper.represent_yaml_object(cls.yaml_tag, data, cls, flow_style=cls.yaml_flow_style)
[ "Convert", "a", "Python", "object", "to", "a", "representation", "node", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L399-L404
[ "def", "to_yaml", "(", "cls", ",", "dumper", ",", "data", ")", ":", "return", "dumper", ".", "represent_yaml_object", "(", "cls", ".", "yaml_tag", ",", "data", ",", "cls", ",", "flow_style", "=", "cls", ".", "yaml_flow_style", ")" ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
serialize_all
Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead.
lib3/yaml/__init__.py
def serialize_all(nodes, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None): """ Serialize a sequence of representation trees into a YAML stream....
def serialize_all(nodes, stream=None, Dumper=Dumper, canonical=None, indent=None, width=None, allow_unicode=None, line_break=None, encoding=None, explicit_start=None, explicit_end=None, version=None, tags=None): """ Serialize a sequence of representation trees into a YAML stream....
[ "Serialize", "a", "sequence", "of", "representation", "trees", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib3/yaml/__init__.py#L215-L243
[ "def", "serialize_all", "(", "nodes", ",", "stream", "=", "None", ",", "Dumper", "=", "Dumper", ",", "canonical", "=", "None", ",", "indent", "=", "None", ",", "width", "=", "None", ",", "allow_unicode", "=", "None", ",", "line_break", "=", "None", ","...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
something
Do not produce empty tokens.
examples/pygments-lexer/yaml.py
def something(TokenClass): """Do not produce empty tokens.""" def callback(lexer, match, context): text = match.group() if not text: return yield match.start(), TokenClass, text context.pos = match.end() return callback
def something(TokenClass): """Do not produce empty tokens.""" def callback(lexer, match, context): text = match.group() if not text: return yield match.start(), TokenClass, text context.pos = match.end() return callback
[ "Do", "not", "produce", "empty", "tokens", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L32-L40
[ "def", "something", "(", "TokenClass", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "not", "text", ":", "return", "yield", "match", ".", "start", "(", ")", ",...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
set_indent
Set the previously saved indentation level.
examples/pygments-lexer/yaml.py
def set_indent(TokenClass, implicit=False): """Set the previously saved indentation level.""" def callback(lexer, match, context): text = match.group() if context.indent < context.next_indent: context.indent_stack.append(context.indent) context.indent = context.next_inden...
def set_indent(TokenClass, implicit=False): """Set the previously saved indentation level.""" def callback(lexer, match, context): text = match.group() if context.indent < context.next_indent: context.indent_stack.append(context.indent) context.indent = context.next_inden...
[ "Set", "the", "previously", "saved", "indentation", "level", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L76-L87
[ "def", "set_indent", "(", "TokenClass", ",", "implicit", "=", "False", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "context", ".", "indent", "<", "context", "....
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
parse_block_scalar_empty_line
Process an empty line in a block scalar.
examples/pygments-lexer/yaml.py
def parse_block_scalar_empty_line(IndentTokenClass, ContentTokenClass): """Process an empty line in a block scalar.""" def callback(lexer, match, context): text = match.group() if (context.block_scalar_indent is None or len(text) <= context.block_scalar_indent): if te...
def parse_block_scalar_empty_line(IndentTokenClass, ContentTokenClass): """Process an empty line in a block scalar.""" def callback(lexer, match, context): text = match.group() if (context.block_scalar_indent is None or len(text) <= context.block_scalar_indent): if te...
[ "Process", "an", "empty", "line", "in", "a", "block", "scalar", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L106-L121
[ "def", "parse_block_scalar_empty_line", "(", "IndentTokenClass", ",", "ContentTokenClass", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "(", "context", ".", "block_scal...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
parse_plain_scalar_indent
Process indentation spaces in a plain scalar.
examples/pygments-lexer/yaml.py
def parse_plain_scalar_indent(TokenClass): """Process indentation spaces in a plain scalar.""" def callback(lexer, match, context): text = match.group() if len(text) <= context.indent: context.stack.pop() context.stack.pop() return if text: ...
def parse_plain_scalar_indent(TokenClass): """Process indentation spaces in a plain scalar.""" def callback(lexer, match, context): text = match.group() if len(text) <= context.indent: context.stack.pop() context.stack.pop() return if text: ...
[ "Process", "indentation", "spaces", "in", "a", "plain", "scalar", "." ]
yaml/pyyaml
python
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L143-L154
[ "def", "parse_plain_scalar_indent", "(", "TokenClass", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "len", "(", "text", ")", "<=", "context", ".", "indent", ":", ...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
train
score
Collocation score
wordcloud/tokenization.py
def score(count_bigram, count1, count2, n_words): """Collocation score""" if n_words <= count1 or n_words <= count2: # only one words appears in the whole document return 0 N = n_words c12 = count_bigram c1 = count1 c2 = count2 p = c2 / N p1 = c12 / c1 p2 = (c2 - c12)...
def score(count_bigram, count1, count2, n_words): """Collocation score""" if n_words <= count1 or n_words <= count2: # only one words appears in the whole document return 0 N = n_words c12 = count_bigram c1 = count1 c2 = count2 p = c2 / N p1 = c12 / c1 p2 = (c2 - c12)...
[ "Collocation", "score" ]
amueller/word_cloud
python
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/tokenization.py#L14-L28
[ "def", "score", "(", "count_bigram", ",", "count1", ",", "count2", ",", "n_words", ")", ":", "if", "n_words", "<=", "count1", "or", "n_words", "<=", "count2", ":", "# only one words appears in the whole document", "return", "0", "N", "=", "n_words", "c12", "="...
d36f526e3d8346e6d7a2656631f05f68e402517d
train
process_tokens
Normalize cases and remove plurals. Each word is represented by the most common case. If a word appears with an "s" on the end and without an "s" on the end, the version with "s" is assumed to be a plural and merged with the version without "s" (except if the word ends with "ss"). Parameters -...
wordcloud/tokenization.py
def process_tokens(words, normalize_plurals=True): """Normalize cases and remove plurals. Each word is represented by the most common case. If a word appears with an "s" on the end and without an "s" on the end, the version with "s" is assumed to be a plural and merged with the version without "s" ...
def process_tokens(words, normalize_plurals=True): """Normalize cases and remove plurals. Each word is represented by the most common case. If a word appears with an "s" on the end and without an "s" on the end, the version with "s" is assumed to be a plural and merged with the version without "s" ...
[ "Normalize", "cases", "and", "remove", "plurals", "." ]
amueller/word_cloud
python
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/tokenization.py#L74-L137
[ "def", "process_tokens", "(", "words", ",", "normalize_plurals", "=", "True", ")", ":", "# words can be either a list of unigrams or bigrams", "# d is a dict of dicts.", "# Keys of d are word.lower(). Values are dicts", "# counting frequency of each capitalization", "d", "=", "defaul...
d36f526e3d8346e6d7a2656631f05f68e402517d
train
GroupedColorFunc.get_color_func
Returns a single_color_func associated with the word
examples/colored_by_group.py
def get_color_func(self, word): """Returns a single_color_func associated with the word""" try: color_func = next( color_func for (color_func, words) in self.color_func_to_words if word in words) except StopIteration: color_func = self.defa...
def get_color_func(self, word): """Returns a single_color_func associated with the word""" try: color_func = next( color_func for (color_func, words) in self.color_func_to_words if word in words) except StopIteration: color_func = self.defa...
[ "Returns", "a", "single_color_func", "associated", "with", "the", "word" ]
amueller/word_cloud
python
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/examples/colored_by_group.py#L62-L71
[ "def", "get_color_func", "(", "self", ",", "word", ")", ":", "try", ":", "color_func", "=", "next", "(", "color_func", "for", "(", "color_func", ",", "words", ")", "in", "self", ".", "color_func_to_words", "if", "word", "in", "words", ")", "except", "Sto...
d36f526e3d8346e6d7a2656631f05f68e402517d
train
random_color_func
Random hue color generation. Default coloring method. This just picks a random hue with value 80% and lumination 50%. Parameters ---------- word, font_size, position, orientation : ignored. random_state : random.Random object or None, (default=None) If a random object is given, this ...
wordcloud/wordcloud.py
def random_color_func(word=None, font_size=None, position=None, orientation=None, font_path=None, random_state=None): """Random hue color generation. Default coloring method. This just picks a random hue with value 80% and lumination 50%. Parameters ---------- word, font_...
def random_color_func(word=None, font_size=None, position=None, orientation=None, font_path=None, random_state=None): """Random hue color generation. Default coloring method. This just picks a random hue with value 80% and lumination 50%. Parameters ---------- word, font_...
[ "Random", "hue", "color", "generation", "." ]
amueller/word_cloud
python
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L66-L84
[ "def", "random_color_func", "(", "word", "=", "None", ",", "font_size", "=", "None", ",", "position", "=", "None", ",", "orientation", "=", "None", ",", "font_path", "=", "None", ",", "random_state", "=", "None", ")", ":", "if", "random_state", "is", "No...
d36f526e3d8346e6d7a2656631f05f68e402517d