repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
polyaxon/polyaxon
polyaxon/api/utils/views/protected.py
ProtectedView.handle_exception
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( ...
python
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", ")", ":", "if", "isinstance", "(", "exc", ",", "(", "rest_exceptions", ".", "NotAuthenticated", ",", "rest_exceptions", ".", "AuthenticationFailed", ")", ")", "and", "self", ".", "HANDLE_UNAUTHENTICATED", ":", ...
Use custom exception handler for errors.
[ "Use", "custom", "exception", "handler", "for", "errors", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/utils/views/protected.py#L21-L36
train
Use custom exception handler for errors.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/scheduler/spawners/templates/resources.py
get_resources
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...
python
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", "limits", "=", "{", "}", "requests", "=", "{", "}", "if", "resources", "is", "None", ":", "return", "None", "if", "resources", ".", "cpu", ":", "if", "resources", ".", ...
Create resources requirements. Args: resources: `PodResourcesConfig` Return: `V1ResourceRequirements`
[ "Create", "resources", "requirements", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/resources.py#L6-L42
train
Create resources requirements.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/scopes/permissions/projects.py
has_project_permissions
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...
python
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", ":", "# Superusers and the creator is allowed to do everything", "if", "user", ".", "is_staff", "or", "user", ".", ...
This logic is extracted here to be used also with Sanic api.
[ "This", "logic", "is", "extracted", "here", "to", "be", "used", "also", "with", "Sanic", "api", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scopes/permissions/projects.py#L19-L26
train
Returns True if the user has permission to do project.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/signals/deletion.py
experiment_group_pre_delete
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...
python
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", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "if", "instance", ".", "is_selection", ":", "return", "# Delete outputs and logs", "celery_app", ".", "send_task", "(", "Sc...
Delete all group outputs.
[ "Delete", "all", "group", "outputs", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/signals/deletion.py#L56-L77
train
Delete all group outputs and logs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/signals/deletion.py
experiment_group_post_delete
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')
python
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", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "auditor", ".", "record", "(", "event_type", "=", "EXPERIMENT_GROUP_DELETED", ",", "instance", "=", "instance", ")", "re...
Delete all group outputs.
[ "Delete", "all", "group", "outputs", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/signals/deletion.py#L82-L86
train
Delete all group outputs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/libs/statics.py
get_asset_url
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 '{}/{}...
python
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", "'{}/{}/{}'", ".", "format", "(", "settings", ".", "STATIC_URL", ".", "rstrip", "(", "'/'", ")", ",", "module", ",", "path", ".", "lstrip", "...
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", "a", "static", "asset", "URL", "(", "located", "within", "Polyaxon", "s", "static", "files", ")", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/libs/statics.py#L4-L17
train
Return a static asset URL located within Polyaxon s static files.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/scheduler/spawners/templates/jobs/manager.py
ResourceManager.get_init_container
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
python
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", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
Pod init container for setting outputs path.
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/jobs/manager.py#L131-L158
train
Get the init container for setting outputs path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/scheduler/spawners/templates/dockerizers/manager.py
ResourceManager.get_init_container
def get_init_container(self, init_command, init_args, env_vars, context_mounts, persistence_outputs, persistence_data): """Pod init container for sett...
python
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", ")", ":", "env_vars", "=", "to_list", "(", "env_vars", ",", "check_none", "=", "True", "...
Pod init container for setting outputs path.
[ "Pod", "init", "container", "for", "setting", "outputs", "path", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/spawners/templates/dockerizers/manager.py#L111-L131
train
Get the init container for setting outputs path.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/hpsearch/iteration_managers/base.py
BaseIterationManager.create_iteration
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...
python
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", ")", ":", "from", "db", ".", "models", ".", "experiment_groups", "import", "ExperimentGroupIteration", "iteration_config", "=", "BaseIterationConfig", "(", "iteration", "=", "0", ",", "num_suggestions", ...
Create an iteration for the experiment group (works for grid and random).
[ "Create", "an", "iteration", "for", "the", "experiment", "group", "(", "works", "for", "grid", "and", "random", ")", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L9-L19
train
Create an iteration for the experiment group.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/hpsearch/iteration_managers/base.py
BaseIterationManager.update_iteration
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...
python
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", ")", ":", "iteration_config", "=", "self", ".", "get_iteration_config", "(", ")", "if", "not", "iteration_config", ":", "return", "experiments_metrics", "=", "self", ".", "experiment_group", ".", "get_experiments_metrics", "("...
Update the last experiment group's iteration with experiment performance.
[ "Update", "the", "last", "experiment", "group", "s", "iteration", "with", "experiment", "performance", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L38-L48
train
Update the last experiment group s iteration with experiment performance.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/hpsearch/iteration_managers/base.py
BaseIterationManager.update_iteration_num_suggestions
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)
python
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", ")", ":", "iteration_config", "=", "self", ".", "experiment_group", ".", "iteration_config", "iteration_config", ".", "num_suggestions", "=", "num_suggestions", "self", ".", "_update_config", ...
Update iteration's num_suggestions.
[ "Update", "iteration", "s", "num_suggestions", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/hpsearch/iteration_managers/base.py#L50-L55
train
Update iteration s num_suggestions.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/api/experiments/serializers.py
ExperimentCreateSerializer.validate_config
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...
python
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", ")", ":", "# config is optional", "if", "not", "config", ":", "return", "config", "spec", "=", "validate_experiment_spec_config", "(", "config", ")", "if", "spec", ".", "is_experiment", ":", "# Resume normal cr...
We only validate the config if passed. Also we use the ExperimentSpecification to check if this config was intended as an experiment.
[ "We", "only", "validate", "the", "config", "if", "passed", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/api/experiments/serializers.py#L269-L288
train
Validate the config and return the config if it is valid.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/event_manager/event.py
Event.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...
python
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", "]", ":", "if", "not", "cls", ".", "actor", ":", "return", "None", "return", "event_context", ".", "get_event_action", "(", "cls", ".", "event_type", ")" ]
Return the second part of the event_type e.g. >>> Event.event_type = 'experiment.deleted' >>> Event.get_event_action() == 'deleted'
[ "Return", "the", "second", "part", "of", "the", "event_type" ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/event_manager/event.py#L136-L146
train
Return the second part of the event_type e. g. event. deleted
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
polyaxon/polyaxon
polyaxon/scheduler/dockerizer_scheduler.py
create_build_job
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...
python
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", ")", ":", "build_job", ",", "rebuild", "=", "BuildJob", ".", "create", "(", "user", "=", "use...
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])
[ "Get", "or", "Create", "a", "build", "job", "based", "on", "the", "params", "." ]
e1724f0756b1a42f9e7aa08a976584a84ef7f016
https://github.com/polyaxon/polyaxon/blob/e1724f0756b1a42f9e7aa08a976584a84ef7f016/polyaxon/scheduler/dockerizer_scheduler.py#L22-L62
train
Create a build job based on the params.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
scan
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()
python
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", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_token", "(", ")", ":", "yield", "loader", ".", "get_token", "(", ")", "finally", ":", "loade...
Scan a YAML stream and produce scanning tokens.
[ "Scan", "a", "YAML", "stream", "and", "produce", "scanning", "tokens", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L58-L67
train
Scan a YAML stream and produce scanning tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
parse
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()
python
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", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_event", "(", ")", ":", "yield", "loader", ".", "get_event", "(", ")", "finally", ":", "load...
Parse a YAML stream and produce parsing events.
[ "Parse", "a", "YAML", "stream", "and", "produce", "parsing", "events", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L69-L78
train
Parse a YAML stream and produce parsing events.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
compose
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()
python
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", ")", ":", "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.
[ "Parse", "the", "first", "YAML", "document", "in", "a", "stream", "and", "produce", "the", "corresponding", "representation", "tree", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L80-L89
train
Parse the first YAML document in a stream and produce a representation tree.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
compose_all
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()
python
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", ")", ":", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ".", "check_node", "(", ")", ":", "yield", "loader", ".", "get_node", "(", ")", "finally", ":", "...
Parse all YAML documents in a stream and produce corresponding representation trees.
[ "Parse", "all", "YAML", "documents", "in", "a", "stream", "and", "produce", "corresponding", "representation", "trees", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L91-L101
train
Parse all YAML documents in a stream and produce corresponding representation trees.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
load
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: ...
python
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", ")", ":", "if", "Loader", "is", "None", ":", "load_warning", "(", "'load'", ")", "Loader", "=", "FullLoader", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "return", "loader", ".", ...
Parse the first YAML document in a stream and produce the corresponding Python object.
[ "Parse", "the", "first", "YAML", "document", "in", "a", "stream", "and", "produce", "the", "corresponding", "Python", "object", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L103-L116
train
Parse the first YAML document in a stream and produce a Python object.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
load_all
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....
python
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", ")", ":", "if", "Loader", "is", "None", ":", "load_warning", "(", "'load_all'", ")", "Loader", "=", "FullLoader", "loader", "=", "Loader", "(", "stream", ")", "try", ":", "while", "loader", ...
Parse all YAML documents in a stream and produce corresponding Python objects.
[ "Parse", "all", "YAML", "documents", "in", "a", "stream", "and", "produce", "corresponding", "Python", "objects", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L118-L132
train
Parse all YAML documents in a stream and produce corresponding Python objects.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
emit
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...
python
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.
[ "Emit", "YAML", "parsing", "events", "into", "a", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L194-L214
train
Emits YAML parsing events into a stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
serialize
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)
python
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", ")", ":", "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.
[ "Serialize", "a", "representation", "tree", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L247-L252
train
Serialize a representation tree into a YAML stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
dump
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)
python
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", ")", ":", "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.
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L288-L293
train
Serialize a Python object into a YAML stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
safe_dump_all
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)
python
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", ")", ":", "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.
[ "Serialize", "a", "sequence", "of", "Python", "objects", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L295-L301
train
Serialize a sequence of Python objects into a YAML stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
safe_dump
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)
python
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", ")", ":", "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.
[ "Serialize", "a", "Python", "object", "into", "a", "YAML", "stream", ".", "Produce", "only", "basic", "YAML", "tags", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L303-L309
train
Serialize a Python object into a YAML stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
add_implicit_resolver
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. """ ...
python
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", ")", ":", "Loader", ".", "add_implicit_resolver", "(", "tag", ",", "regexp", ",", "first", ")", "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",...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L311-L320
train
Add an implicit scalar detector.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
add_path_resolver
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...
python
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", ")", ":", "Loader", ".", "add_path_resolver", "(", "tag", ",", "path", ",", "kind", ")", "Dumper", ".", "add_path...
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.
[ "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...
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L322-L330
train
Add a path based resolver for the given tag.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib/yaml/__init__.py
YAMLObject.to_yaml
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)
python
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", ")", ":", "return", "dumper", ".", "represent_yaml_object", "(", "cls", ".", "yaml_tag", ",", "data", ",", "cls", ",", "flow_style", "=", "cls", ".", "yaml_flow_style", ")" ]
Convert a Python object to a representation node.
[ "Convert", "a", "Python", "object", "to", "a", "representation", "node", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib/yaml/__init__.py#L399-L404
train
Convert a Python object to a representation node.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
lib3/yaml/__init__.py
serialize_all
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....
python
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", ","...
Serialize a sequence of representation trees into a YAML stream. If stream is None, return the produced string instead.
[ "Serialize", "a", "sequence", "of", "representation", "trees", "into", "a", "YAML", "stream", ".", "If", "stream", "is", "None", "return", "the", "produced", "string", "instead", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/lib3/yaml/__init__.py#L215-L243
train
Serialize a sequence of representation trees into a YAML stream.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
examples/pygments-lexer/yaml.py
something
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
python
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", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "not", "text", ":", "return", "yield", "match", ".", "start", "(", ")", ",...
Do not produce empty tokens.
[ "Do", "not", "produce", "empty", "tokens", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L32-L40
train
Return a callback that returns a list of tokens.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
examples/pygments-lexer/yaml.py
set_indent
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...
python
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", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "context", ".", "indent", "<", "context", "....
Set the previously saved indentation level.
[ "Set", "the", "previously", "saved", "indentation", "level", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L76-L87
train
Set the previously saved indentation level.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
examples/pygments-lexer/yaml.py
parse_block_scalar_empty_line
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...
python
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", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "(", "context", ".", "block_scal...
Process an empty line in a block scalar.
[ "Process", "an", "empty", "line", "in", "a", "block", "scalar", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L106-L121
train
Return a callback that yields a match for an empty line in a block scalar.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
yaml/pyyaml
examples/pygments-lexer/yaml.py
parse_plain_scalar_indent
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: ...
python
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", ")", ":", "def", "callback", "(", "lexer", ",", "match", ",", "context", ")", ":", "text", "=", "match", ".", "group", "(", ")", "if", "len", "(", "text", ")", "<=", "context", ".", "indent", ":", ...
Process indentation spaces in a plain scalar.
[ "Process", "indentation", "spaces", "in", "a", "plain", "scalar", "." ]
e471e86bf6dabdad45a1438c20a4a5c033eb9034
https://github.com/yaml/pyyaml/blob/e471e86bf6dabdad45a1438c20a4a5c033eb9034/examples/pygments-lexer/yaml.py#L143-L154
train
Process indentation spaces in a plain scalar.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/tokenization.py
score
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)...
python
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", ")", ":", "if", "n_words", "<=", "count1", "or", "n_words", "<=", "count2", ":", "# only one words appears in the whole document", "return", "0", "N", "=", "n_words", "c12", "="...
Collocation score
[ "Collocation", "score" ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/tokenization.py#L14-L28
train
Collocation score
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/tokenization.py
process_tokens
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" ...
python
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", ")", ":", "# 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...
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 -...
[ "Normalize", "cases", "and", "remove", "plurals", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/tokenization.py#L74-L137
train
Given a list of words and a list of words return a new version of the most common case.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
examples/colored_by_group.py
GroupedColorFunc.get_color_func
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...
python
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", ")", ":", "try", ":", "color_func", "=", "next", "(", "color_func", "for", "(", "color_func", ",", "words", ")", "in", "self", ".", "color_func_to_words", "if", "word", "in", "words", ")", "except", "Sto...
Returns a single_color_func associated with the word
[ "Returns", "a", "single_color_func", "associated", "with", "the", "word" ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/examples/colored_by_group.py#L62-L71
train
Returns a single_color_func associated with the word
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
random_color_func
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_...
python
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", ")", ":", "if", "random_state", "is", "No...
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 ...
[ "Random", "hue", "color", "generation", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L66-L84
train
Default coloring method.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
get_single_color_func
def get_single_color_func(color): """Create a color function which returns a single hue and saturation with. different values (HSV). Accepted values are color strings as usable by PIL/Pillow. >>> color_func1 = get_single_color_func('deepskyblue') >>> color_func2 = get_single_color_func('#00b4d2') ...
python
def get_single_color_func(color): """Create a color function which returns a single hue and saturation with. different values (HSV). Accepted values are color strings as usable by PIL/Pillow. >>> color_func1 = get_single_color_func('deepskyblue') >>> color_func2 = get_single_color_func('#00b4d2') ...
[ "def", "get_single_color_func", "(", "color", ")", ":", "old_r", ",", "old_g", ",", "old_b", "=", "ImageColor", ".", "getrgb", "(", "color", ")", "rgb_max", "=", "255.", "h", ",", "s", ",", "v", "=", "colorsys", ".", "rgb_to_hsv", "(", "old_r", "/", ...
Create a color function which returns a single hue and saturation with. different values (HSV). Accepted values are color strings as usable by PIL/Pillow. >>> color_func1 = get_single_color_func('deepskyblue') >>> color_func2 = get_single_color_func('#00b4d2')
[ "Create", "a", "color", "function", "which", "returns", "a", "single", "hue", "and", "saturation", "with", ".", "different", "values", "(", "HSV", ")", ".", "Accepted", "values", "are", "color", "strings", "as", "usable", "by", "PIL", "/", "Pillow", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L113-L147
train
Create a color function which returns a single hue and saturation with.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud.generate_from_frequencies
def generate_from_frequencies(self, frequencies, max_font_size=None): # noqa: C901 """Create a word_cloud from words and frequencies. Parameters ---------- frequencies : dict from string to float A contains words and associated frequency. max_font_size : int ...
python
def generate_from_frequencies(self, frequencies, max_font_size=None): # noqa: C901 """Create a word_cloud from words and frequencies. Parameters ---------- frequencies : dict from string to float A contains words and associated frequency. max_font_size : int ...
[ "def", "generate_from_frequencies", "(", "self", ",", "frequencies", ",", "max_font_size", "=", "None", ")", ":", "# noqa: C901", "# make sure frequencies are sorted and normalized", "frequencies", "=", "sorted", "(", "frequencies", ".", "items", "(", ")", ",", "key",...
Create a word_cloud from words and frequencies. Parameters ---------- frequencies : dict from string to float A contains words and associated frequency. max_font_size : int Use this font-size instead of self.max_font_size Returns ------- ...
[ "Create", "a", "word_cloud", "from", "words", "and", "frequencies", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L371-L531
train
Generate a word cloud from words and associated frequencies.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud.process_text
def process_text(self, text): """Splits a long text into words, eliminates the stopwords. Parameters ---------- text : string The text to be processed. Returns ------- words : dict (string, int) Word tokens with associated frequency. ...
python
def process_text(self, text): """Splits a long text into words, eliminates the stopwords. Parameters ---------- text : string The text to be processed. Returns ------- words : dict (string, int) Word tokens with associated frequency. ...
[ "def", "process_text", "(", "self", ",", "text", ")", ":", "stopwords", "=", "set", "(", "[", "i", ".", "lower", "(", ")", "for", "i", "in", "self", ".", "stopwords", "]", ")", "flags", "=", "(", "re", ".", "UNICODE", "if", "sys", ".", "version",...
Splits a long text into words, eliminates the stopwords. Parameters ---------- text : string The text to be processed. Returns ------- words : dict (string, int) Word tokens with associated frequency. ..versionchanged:: 1.2.2 ...
[ "Splits", "a", "long", "text", "into", "words", "eliminates", "the", "stopwords", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L533-L579
train
Splits a long text into words eliminates the stopwords and returns a list of lists of word counts.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud.generate_from_text
def generate_from_text(self, text): """Generate wordcloud from text. The input "text" is expected to be a natural text. If you pass a sorted list of words, words will appear in your output twice. To remove this duplication, set ``collocations=False``. Calls process_text and gen...
python
def generate_from_text(self, text): """Generate wordcloud from text. The input "text" is expected to be a natural text. If you pass a sorted list of words, words will appear in your output twice. To remove this duplication, set ``collocations=False``. Calls process_text and gen...
[ "def", "generate_from_text", "(", "self", ",", "text", ")", ":", "words", "=", "self", ".", "process_text", "(", "text", ")", "self", ".", "generate_from_frequencies", "(", "words", ")", "return", "self" ]
Generate wordcloud from text. The input "text" is expected to be a natural text. If you pass a sorted list of words, words will appear in your output twice. To remove this duplication, set ``collocations=False``. Calls process_text and generate_from_frequencies. ..versionchang...
[ "Generate", "wordcloud", "from", "text", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L581-L600
train
Generate wordcloud from text.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud.recolor
def recolor(self, random_state=None, color_func=None, colormap=None): """Recolor existing layout. Applying a new coloring is much faster than generating the whole wordcloud. Parameters ---------- random_state : RandomState, int, or None, default=None If not ...
python
def recolor(self, random_state=None, color_func=None, colormap=None): """Recolor existing layout. Applying a new coloring is much faster than generating the whole wordcloud. Parameters ---------- random_state : RandomState, int, or None, default=None If not ...
[ "def", "recolor", "(", "self", ",", "random_state", "=", "None", ",", "color_func", "=", "None", ",", "colormap", "=", "None", ")", ":", "if", "isinstance", "(", "random_state", ",", "int", ")", ":", "random_state", "=", "Random", "(", "random_state", ")...
Recolor existing layout. Applying a new coloring is much faster than generating the whole wordcloud. Parameters ---------- random_state : RandomState, int, or None, default=None If not None, a fixed random state is used. If an int is given, this is used ...
[ "Recolor", "existing", "layout", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L648-L688
train
Recolor existing layout.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud.to_file
def to_file(self, filename): """Export to image file. Parameters ---------- filename : string Location to write to. Returns ------- self """ img = self.to_image() img.save(filename, optimize=True) return self
python
def to_file(self, filename): """Export to image file. Parameters ---------- filename : string Location to write to. Returns ------- self """ img = self.to_image() img.save(filename, optimize=True) return self
[ "def", "to_file", "(", "self", ",", "filename", ")", ":", "img", "=", "self", ".", "to_image", "(", ")", "img", ".", "save", "(", "filename", ",", "optimize", "=", "True", ")", "return", "self" ]
Export to image file. Parameters ---------- filename : string Location to write to. Returns ------- self
[ "Export", "to", "image", "file", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L690-L705
train
Export to image file.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud._get_bolean_mask
def _get_bolean_mask(self, mask): """Cast to two dimensional boolean mask.""" if mask.dtype.kind == 'f': warnings.warn("mask image should be unsigned byte between 0" " and 255. Got a float array") if mask.ndim == 2: boolean_mask = mask == 255 ...
python
def _get_bolean_mask(self, mask): """Cast to two dimensional boolean mask.""" if mask.dtype.kind == 'f': warnings.warn("mask image should be unsigned byte between 0" " and 255. Got a float array") if mask.ndim == 2: boolean_mask = mask == 255 ...
[ "def", "_get_bolean_mask", "(", "self", ",", "mask", ")", ":", "if", "mask", ".", "dtype", ".", "kind", "==", "'f'", ":", "warnings", ".", "warn", "(", "\"mask image should be unsigned byte between 0\"", "\" and 255. Got a float array\"", ")", "if", "mask", ".", ...
Cast to two dimensional boolean mask.
[ "Cast", "to", "two", "dimensional", "boolean", "mask", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L730-L742
train
Cast to two dimensional boolean mask.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
amueller/word_cloud
wordcloud/wordcloud.py
WordCloud._draw_contour
def _draw_contour(self, img): """Draw mask contour on a pillow image.""" if self.mask is None or self.contour_width == 0: return img mask = self._get_bolean_mask(self.mask) * 255 contour = Image.fromarray(mask.astype(np.uint8)) contour = contour.resize(img.size) ...
python
def _draw_contour(self, img): """Draw mask contour on a pillow image.""" if self.mask is None or self.contour_width == 0: return img mask = self._get_bolean_mask(self.mask) * 255 contour = Image.fromarray(mask.astype(np.uint8)) contour = contour.resize(img.size) ...
[ "def", "_draw_contour", "(", "self", ",", "img", ")", ":", "if", "self", ".", "mask", "is", "None", "or", "self", ".", "contour_width", "==", "0", ":", "return", "img", "mask", "=", "self", ".", "_get_bolean_mask", "(", "self", ".", "mask", ")", "*",...
Draw mask contour on a pillow image.
[ "Draw", "mask", "contour", "on", "a", "pillow", "image", "." ]
d36f526e3d8346e6d7a2656631f05f68e402517d
https://github.com/amueller/word_cloud/blob/d36f526e3d8346e6d7a2656631f05f68e402517d/wordcloud/wordcloud.py#L744-L772
train
Draw a contour on a pillow image.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/checks/kube_leader/mixins.py
KubeLeaderElectionMixin.check_election_status
def check_election_status(self, config): """ Retrieves the leader-election annotation from a given object, and submits metrics and a service check. An integration warning is sent if the object is not retrievable, or no record is found. Monitors on the service-check should have ...
python
def check_election_status(self, config): """ Retrieves the leader-election annotation from a given object, and submits metrics and a service check. An integration warning is sent if the object is not retrievable, or no record is found. Monitors on the service-check should have ...
[ "def", "check_election_status", "(", "self", ",", "config", ")", ":", "try", ":", "record", "=", "self", ".", "_get_record", "(", "config", ".", "get", "(", "\"record_kind\"", ",", "\"\"", ")", ",", "config", ".", "get", "(", "\"record_name\"", ",", "\"\...
Retrieves the leader-election annotation from a given object, and submits metrics and a service check. An integration warning is sent if the object is not retrievable, or no record is found. Monitors on the service-check should have no-data alerts enabled to account for this. T...
[ "Retrieves", "the", "leader", "-", "election", "annotation", "from", "a", "given", "object", "and", "submits", "metrics", "and", "a", "service", "check", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/checks/kube_leader/mixins.py#L26-L51
train
Checks the status of a given object and stores it in the service check.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
_partition
def _partition(entity, sep): """Python2.4 doesn't have a partition method so we provide our own that mimics str.partition from later releases. Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the...
python
def _partition(entity, sep): """Python2.4 doesn't have a partition method so we provide our own that mimics str.partition from later releases. Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the...
[ "def", "_partition", "(", "entity", ",", "sep", ")", ":", "parts", "=", "entity", ".", "split", "(", "sep", ",", "1", ")", "if", "len", "(", "parts", ")", "==", "2", ":", "return", "parts", "[", "0", "]", ",", "sep", ",", "parts", "[", "1", "...
Python2.4 doesn't have a partition method so we provide our own that mimics str.partition from later releases. Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not ...
[ "Python2", ".", "4", "doesn", "t", "have", "a", "partition", "method", "so", "we", "provide", "our", "own", "that", "mimics", "str", ".", "partition", "from", "later", "releases", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L36-L50
train
Python 2. 4 doesn t have a partition method so we have to use str. partition.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
_rpartition
def _rpartition(entity, sep): """Python2.4 doesn't have an rpartition method so we provide our own that mimics str.rpartition from later releases. Split the string at the last occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after ...
python
def _rpartition(entity, sep): """Python2.4 doesn't have an rpartition method so we provide our own that mimics str.rpartition from later releases. Split the string at the last occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after ...
[ "def", "_rpartition", "(", "entity", ",", "sep", ")", ":", "idx", "=", "entity", ".", "rfind", "(", "sep", ")", "if", "idx", "==", "-", "1", ":", "return", "''", ",", "''", ",", "entity", "return", "entity", "[", ":", "idx", "]", ",", "sep", ",...
Python2.4 doesn't have an rpartition method so we provide our own that mimics str.rpartition from later releases. Split the string at the last occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is no...
[ "Python2", ".", "4", "doesn", "t", "have", "an", "rpartition", "method", "so", "we", "provide", "our", "own", "that", "mimics", "str", ".", "rpartition", "from", "later", "releases", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L53-L66
train
Python 2. 4 doesn t have an rpartition method so we provide it here.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
parse_userinfo
def parse_userinfo(userinfo): """Validates the format of user information in a MongoDB URI. Reserved characters like ':', '/', '+' and '@' must be escaped following RFC 3986. Returns a 2-tuple containing the unescaped username followed by the unescaped password. :Paramaters: - `userinf...
python
def parse_userinfo(userinfo): """Validates the format of user information in a MongoDB URI. Reserved characters like ':', '/', '+' and '@' must be escaped following RFC 3986. Returns a 2-tuple containing the unescaped username followed by the unescaped password. :Paramaters: - `userinf...
[ "def", "parse_userinfo", "(", "userinfo", ")", ":", "if", "'@'", "in", "userinfo", "or", "userinfo", ".", "count", "(", "':'", ")", ">", "1", ":", "if", "PY3", ":", "quote_fn", "=", "\"urllib.parse.quote_plus\"", "else", ":", "quote_fn", "=", "\"urllib.quo...
Validates the format of user information in a MongoDB URI. Reserved characters like ':', '/', '+' and '@' must be escaped following RFC 3986. Returns a 2-tuple containing the unescaped username followed by the unescaped password. :Paramaters: - `userinfo`: A string of the form <username>:<...
[ "Validates", "the", "format", "of", "user", "information", "in", "a", "MongoDB", "URI", ".", "Reserved", "characters", "like", ":", "/", "+", "and", "@", "must", "be", "escaped", "following", "RFC", "3986", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L69-L94
train
Validates the format of user information in a MongoDB URI.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
parse_ipv6_literal_host
def parse_ipv6_literal_host(entity, default_port): """Validates an IPv6 literal host:port string. Returns a 2-tuple of IPv6 literal followed by port where port is default_port if it wasn't specified in entity. :Parameters: - `entity`: A string that represents an IPv6 literal enclosed ...
python
def parse_ipv6_literal_host(entity, default_port): """Validates an IPv6 literal host:port string. Returns a 2-tuple of IPv6 literal followed by port where port is default_port if it wasn't specified in entity. :Parameters: - `entity`: A string that represents an IPv6 literal enclosed ...
[ "def", "parse_ipv6_literal_host", "(", "entity", ",", "default_port", ")", ":", "if", "entity", ".", "find", "(", "']'", ")", "==", "-", "1", ":", "raise", "ValueError", "(", "\"an IPv6 address literal must be \"", "\"enclosed in '[' and ']' according \"", "\"to RFC 2...
Validates an IPv6 literal host:port string. Returns a 2-tuple of IPv6 literal followed by port where port is default_port if it wasn't specified in entity. :Parameters: - `entity`: A string that represents an IPv6 literal enclosed in braces (e.g. '[::1]' or '[::1]:27017'). ...
[ "Validates", "an", "IPv6", "literal", "host", ":", "port", "string", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L97-L116
train
Validates an IPv6 literal host string. Returns a 2 - tuple of IPv6 literal followed by port where the port is default_port.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
parse_host
def parse_host(entity, default_port=DEFAULT_PORT): """Validates a host string Returns a 2-tuple of host followed by port where port is default_port if it wasn't specified in the string. :Parameters: - `entity`: A host or host:port string where host could be a hostname or IP...
python
def parse_host(entity, default_port=DEFAULT_PORT): """Validates a host string Returns a 2-tuple of host followed by port where port is default_port if it wasn't specified in the string. :Parameters: - `entity`: A host or host:port string where host could be a hostname or IP...
[ "def", "parse_host", "(", "entity", ",", "default_port", "=", "DEFAULT_PORT", ")", ":", "host", "=", "entity", "port", "=", "default_port", "if", "entity", "[", "0", "]", "==", "'['", ":", "host", ",", "port", "=", "parse_ipv6_literal_host", "(", "entity",...
Validates a host string Returns a 2-tuple of host followed by port where port is default_port if it wasn't specified in the string. :Parameters: - `entity`: A host or host:port string where host could be a hostname or IP address. - `default_port`: The port number to use...
[ "Validates", "a", "host", "string" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L119-L154
train
Validates a string containing a host and port and returns a 2 - tuple of host followed by port where port is default_port.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
_parse_options
def _parse_options(opts, delim): """Helper method for split_options which creates the options dict. Also handles the creation of a list for the URI tag_sets/ readpreferencetags portion.""" options = {} for opt in opts.split(delim): key, val = opt.split("=") if key.lower() == 'readpre...
python
def _parse_options(opts, delim): """Helper method for split_options which creates the options dict. Also handles the creation of a list for the URI tag_sets/ readpreferencetags portion.""" options = {} for opt in opts.split(delim): key, val = opt.split("=") if key.lower() == 'readpre...
[ "def", "_parse_options", "(", "opts", ",", "delim", ")", ":", "options", "=", "{", "}", "for", "opt", "in", "opts", ".", "split", "(", "delim", ")", ":", "key", ",", "val", "=", "opt", ".", "split", "(", "\"=\"", ")", "if", "key", ".", "lower", ...
Helper method for split_options which creates the options dict. Also handles the creation of a list for the URI tag_sets/ readpreferencetags portion.
[ "Helper", "method", "for", "split_options", "which", "creates", "the", "options", "dict", ".", "Also", "handles", "the", "creation", "of", "a", "list", "for", "the", "URI", "tag_sets", "/", "readpreferencetags", "portion", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L173-L197
train
Helper method for split_options which creates the options dict.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
split_hosts
def split_hosts(hosts, default_port=DEFAULT_PORT): """Takes a string of the form host1[:port],host2[:port]... and splits it into (host, port) tuples. If [:port] isn't present the default_port is used. Returns a set of 2-tuples containing the host name (or IP) followed by port number. :Paramete...
python
def split_hosts(hosts, default_port=DEFAULT_PORT): """Takes a string of the form host1[:port],host2[:port]... and splits it into (host, port) tuples. If [:port] isn't present the default_port is used. Returns a set of 2-tuples containing the host name (or IP) followed by port number. :Paramete...
[ "def", "split_hosts", "(", "hosts", ",", "default_port", "=", "DEFAULT_PORT", ")", ":", "nodes", "=", "[", "]", "for", "entity", "in", "hosts", ".", "split", "(", "','", ")", ":", "if", "not", "entity", ":", "raise", "ConfigurationError", "(", "\"Empty h...
Takes a string of the form host1[:port],host2[:port]... and splits it into (host, port) tuples. If [:port] isn't present the default_port is used. Returns a set of 2-tuples containing the host name (or IP) followed by port number. :Parameters: - `hosts`: A string of the form host1[:port],h...
[ "Takes", "a", "string", "of", "the", "form", "host1", "[", ":", "port", "]", "host2", "[", ":", "port", "]", "...", "and", "splits", "it", "into", "(", "host", "port", ")", "tuples", ".", "If", "[", ":", "port", "]", "isn", "t", "present", "the",...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L230-L253
train
Takes a string of the form host1. port host2. port... and splits it into host1. port and host2. port. default_port is used when no port is specified.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py
parse_uri
def parse_uri(uri, default_port=DEFAULT_PORT, validate=True, warn=False): """Parse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': <list of (host, port) tuples>, 'username': <username> or None, 'password': <password> or None, 'data...
python
def parse_uri(uri, default_port=DEFAULT_PORT, validate=True, warn=False): """Parse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': <list of (host, port) tuples>, 'username': <username> or None, 'password': <password> or None, 'data...
[ "def", "parse_uri", "(", "uri", ",", "default_port", "=", "DEFAULT_PORT", ",", "validate", "=", "True", ",", "warn", "=", "False", ")", ":", "if", "not", "uri", ".", "startswith", "(", "SCHEME", ")", ":", "raise", "InvalidURI", "(", "\"Invalid URI scheme: ...
Parse and validate a MongoDB URI. Returns a dict of the form:: { 'nodelist': <list of (host, port) tuples>, 'username': <username> or None, 'password': <password> or None, 'database': <database name> or None, 'collection': <collection name> or No...
[ "Parse", "and", "validate", "a", "MongoDB", "URI", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/uri_parser.py#L261-L356
train
Parse and validate a MongoDB URI.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py
_with_primary
def _with_primary(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection with a known primary.""" primary = selection.primary sds = [] for s in selection.server_descriptions: if s.server_type == SERVER_TYPE.RSSecondary: # See max-staleness.rst for explanation ...
python
def _with_primary(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection with a known primary.""" primary = selection.primary sds = [] for s in selection.server_descriptions: if s.server_type == SERVER_TYPE.RSSecondary: # See max-staleness.rst for explanation ...
[ "def", "_with_primary", "(", "max_staleness", ",", "selection", ")", ":", "primary", "=", "selection", ".", "primary", "sds", "=", "[", "]", "for", "s", "in", "selection", ".", "server_descriptions", ":", "if", "s", ".", "server_type", "==", "SERVER_TYPE", ...
Apply max_staleness, in seconds, to a Selection with a known primary.
[ "Apply", "max_staleness", "in", "seconds", "to", "a", "Selection", "with", "a", "known", "primary", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py#L57-L75
train
Apply max_staleness in seconds to a Selection with a known primary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py
_no_primary
def _no_primary(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection with no known primary.""" # Secondary that's replicated the most recent writes. smax = selection.secondary_with_max_last_write_date() if not smax: # No secondaries and no primary, short-circuit out of h...
python
def _no_primary(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection with no known primary.""" # Secondary that's replicated the most recent writes. smax = selection.secondary_with_max_last_write_date() if not smax: # No secondaries and no primary, short-circuit out of h...
[ "def", "_no_primary", "(", "max_staleness", ",", "selection", ")", ":", "# Secondary that's replicated the most recent writes.", "smax", "=", "selection", ".", "secondary_with_max_last_write_date", "(", ")", "if", "not", "smax", ":", "# No secondaries and no primary, short-ci...
Apply max_staleness, in seconds, to a Selection with no known primary.
[ "Apply", "max_staleness", "in", "seconds", "to", "a", "Selection", "with", "no", "known", "primary", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py#L78-L100
train
Apply max_staleness in seconds to a Selection with no known primary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py
select
def select(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection.""" if max_staleness == -1: return selection # Server Selection Spec: If the TopologyType is ReplicaSetWithPrimary or # ReplicaSetNoPrimary, a client MUST raise an error if maxStaleness < # heartbeatFre...
python
def select(max_staleness, selection): """Apply max_staleness, in seconds, to a Selection.""" if max_staleness == -1: return selection # Server Selection Spec: If the TopologyType is ReplicaSetWithPrimary or # ReplicaSetNoPrimary, a client MUST raise an error if maxStaleness < # heartbeatFre...
[ "def", "select", "(", "max_staleness", ",", "selection", ")", ":", "if", "max_staleness", "==", "-", "1", ":", "return", "selection", "# Server Selection Spec: If the TopologyType is ReplicaSetWithPrimary or", "# ReplicaSetNoPrimary, a client MUST raise an error if maxStaleness <",...
Apply max_staleness, in seconds, to a Selection.
[ "Apply", "max_staleness", "in", "seconds", "to", "a", "Selection", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/max_staleness_selectors.py#L103-L116
train
Apply max_staleness in seconds to a Selection.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/tokumx.py
TokuMX.create_event
def create_event(self, state, server, agentConfig): """Create an event with a message describing the replication state of a mongo node""" def get_state_description(state): if state == 0: return 'Starting Up' elif state == 1: return 'Pr...
python
def create_event(self, state, server, agentConfig): """Create an event with a message describing the replication state of a mongo node""" def get_state_description(state): if state == 0: return 'Starting Up' elif state == 1: return 'Pr...
[ "def", "create_event", "(", "self", ",", "state", ",", "server", ",", "agentConfig", ")", ":", "def", "get_state_description", "(", "state", ")", ":", "if", "state", "==", "0", ":", "return", "'Starting Up'", "elif", "state", "==", "1", ":", "return", "'...
Create an event with a message describing the replication state of a mongo node
[ "Create", "an", "event", "with", "a", "message", "describing", "the", "replication", "state", "of", "a", "mongo", "node" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/tokumx.py#L210-L248
train
Create an event describing the replication state of a mongo node
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_base/datadog_checks/base/utils/timeout.py
timeout
def timeout(timeout): """ A decorator to timeout a function. Decorated method calls are executed in a separate new thread with a specified timeout. Also check if a thread for the same function already exists before creating a new one. Note: Compatible with Windows (thread based). """ def de...
python
def timeout(timeout): """ A decorator to timeout a function. Decorated method calls are executed in a separate new thread with a specified timeout. Also check if a thread for the same function already exists before creating a new one. Note: Compatible with Windows (thread based). """ def de...
[ "def", "timeout", "(", "timeout", ")", ":", "def", "decorator", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "key", "=", "\"{0}:{1}:{2}:{3}\"", ".", ...
A decorator to timeout a function. Decorated method calls are executed in a separate new thread with a specified timeout. Also check if a thread for the same function already exists before creating a new one. Note: Compatible with Windows (thread based).
[ "A", "decorator", "to", "timeout", "a", "function", ".", "Decorated", "method", "calls", "are", "executed", "in", "a", "separate", "new", "thread", "with", "a", "specified", "timeout", ".", "Also", "check", "if", "a", "thread", "for", "the", "same", "funct...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_base/datadog_checks/base/utils/timeout.py#L41-L74
train
A decorator to timeout a function.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
process/datadog_checks/process/process.py
ProcessCheck.find_pids
def find_pids(self, name, search_string, exact_match, ignore_ad=True): """ Create a set of pids of selected processes. Search for search_string """ if not self.should_refresh_pid_cache(name): return self.pid_cache[name] ad_error_logger = self.log.debug ...
python
def find_pids(self, name, search_string, exact_match, ignore_ad=True): """ Create a set of pids of selected processes. Search for search_string """ if not self.should_refresh_pid_cache(name): return self.pid_cache[name] ad_error_logger = self.log.debug ...
[ "def", "find_pids", "(", "self", ",", "name", ",", "search_string", ",", "exact_match", ",", "ignore_ad", "=", "True", ")", ":", "if", "not", "self", ".", "should_refresh_pid_cache", "(", "name", ")", ":", "return", "self", ".", "pid_cache", "[", "name", ...
Create a set of pids of selected processes. Search for search_string
[ "Create", "a", "set", "of", "pids", "of", "selected", "processes", ".", "Search", "for", "search_string" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/process/datadog_checks/process/process.py#L98-L163
train
Find all processes with the given name and search string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
process/datadog_checks/process/process.py
ProcessCheck.psutil_wrapper
def psutil_wrapper(self, process, method, accessors, try_sudo, *args, **kwargs): """ A psutil wrapper that is calling * psutil.method(*args, **kwargs) and returns the result OR * psutil.method(*args, **kwargs).accessor[i] for each accessors given in a list, the result bei...
python
def psutil_wrapper(self, process, method, accessors, try_sudo, *args, **kwargs): """ A psutil wrapper that is calling * psutil.method(*args, **kwargs) and returns the result OR * psutil.method(*args, **kwargs).accessor[i] for each accessors given in a list, the result bei...
[ "def", "psutil_wrapper", "(", "self", ",", "process", ",", "method", ",", "accessors", ",", "try_sudo", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "accessors", "is", "None", ":", "result", "=", "None", "else", ":", "result", "=", "{",...
A psutil wrapper that is calling * psutil.method(*args, **kwargs) and returns the result OR * psutil.method(*args, **kwargs).accessor[i] for each accessors given in a list, the result being indexed in a dictionary by the accessor name
[ "A", "psutil", "wrapper", "that", "is", "calling", "*", "psutil", ".", "method", "(", "*", "args", "**", "kwargs", ")", "and", "returns", "the", "result", "OR", "*", "psutil", ".", "method", "(", "*", "args", "**", "kwargs", ")", ".", "accessor", "["...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/process/datadog_checks/process/process.py#L165-L217
train
A wrapper that returns the result of calling the method with the given arguments and the given kwargs.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
process/datadog_checks/process/process.py
ProcessCheck._process_service_check
def _process_service_check(self, name, nb_procs, bounds, tags): """ Report a service check, for each process in search_string. Report as OK if the process is in the warning thresholds CRITICAL out of the critical thresholds WARNING o...
python
def _process_service_check(self, name, nb_procs, bounds, tags): """ Report a service check, for each process in search_string. Report as OK if the process is in the warning thresholds CRITICAL out of the critical thresholds WARNING o...
[ "def", "_process_service_check", "(", "self", ",", "name", ",", "nb_procs", ",", "bounds", ",", "tags", ")", ":", "# FIXME 8.x remove the `process:name` tag", "service_check_tags", "=", "tags", "+", "[", "\"process:{}\"", ".", "format", "(", "name", ")", "]", "s...
Report a service check, for each process in search_string. Report as OK if the process is in the warning thresholds CRITICAL out of the critical thresholds WARNING out of the warning thresholds
[ "Report", "a", "service", "check", "for", "each", "process", "in", "search_string", ".", "Report", "as", "OK", "if", "the", "process", "is", "in", "the", "warning", "thresholds", "CRITICAL", "out", "of", "the", "critical", "thresholds", "WARNING", "out", "of...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/process/datadog_checks/process/process.py#L442-L470
train
Report a service check for each process in search_string.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
process/datadog_checks/process/process.py
ProcessCheck._filter_by_user
def _filter_by_user(self, user, pids): """ Filter pids by it's username. :param user: string with name of system user :param pids: set of pids to filter :return: set of filtered pids """ filtered_pids = set() for pid in pids: try: ...
python
def _filter_by_user(self, user, pids): """ Filter pids by it's username. :param user: string with name of system user :param pids: set of pids to filter :return: set of filtered pids """ filtered_pids = set() for pid in pids: try: ...
[ "def", "_filter_by_user", "(", "self", ",", "user", ",", "pids", ")", ":", "filtered_pids", "=", "set", "(", ")", "for", "pid", "in", "pids", ":", "try", ":", "proc", "=", "psutil", ".", "Process", "(", "pid", ")", "if", "proc", ".", "username", "(...
Filter pids by it's username. :param user: string with name of system user :param pids: set of pids to filter :return: set of filtered pids
[ "Filter", "pids", "by", "it", "s", "username", ".", ":", "param", "user", ":", "string", "with", "name", "of", "system", "user", ":", "param", "pids", ":", "set", "of", "pids", "to", "filter", ":", "return", ":", "set", "of", "filtered", "pids" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/process/datadog_checks/process/process.py#L472-L491
train
Filter pids by user.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
Win32EventLogWMI._dt_to_wmi
def _dt_to_wmi(self, dt): ''' A wrapper around wmi.from_time to get a WMI-formatted time from a time struct. ''' return from_time( year=dt.year, month=dt.month, day=dt.day, hours=dt.hour, minutes=dt.minute, secon...
python
def _dt_to_wmi(self, dt): ''' A wrapper around wmi.from_time to get a WMI-formatted time from a time struct. ''' return from_time( year=dt.year, month=dt.month, day=dt.day, hours=dt.hour, minutes=dt.minute, secon...
[ "def", "_dt_to_wmi", "(", "self", ",", "dt", ")", ":", "return", "from_time", "(", "year", "=", "dt", ".", "year", ",", "month", "=", "dt", ".", "month", ",", "day", "=", "dt", ".", "day", ",", "hours", "=", "dt", ".", "hour", ",", "minutes", "...
A wrapper around wmi.from_time to get a WMI-formatted time from a time struct.
[ "A", "wrapper", "around", "wmi", ".", "from_time", "to", "get", "a", "WMI", "-", "formatted", "time", "from", "a", "time", "struct", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L160-L173
train
A wrapper around wmi. from_time to get a WMI - formatted time from a time struct.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
LogEvent._msg_text
def _msg_text(self): """ Generate the event's body to send to Datadog. Consider `event_format` parameter: * Only use the specified list of event properties. * If unspecified, default to the EventLog's `Message` or `InsertionStrings`. """ msg_text = u"" i...
python
def _msg_text(self): """ Generate the event's body to send to Datadog. Consider `event_format` parameter: * Only use the specified list of event properties. * If unspecified, default to the EventLog's `Message` or `InsertionStrings`. """ msg_text = u"" i...
[ "def", "_msg_text", "(", "self", ")", ":", "msg_text", "=", "u\"\"", "if", "self", ".", "_format", ":", "msg_text_fields", "=", "[", "\"%%%\\n```\"", "]", "for", "event_property", "in", "self", ".", "_format", ":", "property_value", "=", "self", ".", "even...
Generate the event's body to send to Datadog. Consider `event_format` parameter: * Only use the specified list of event properties. * If unspecified, default to the EventLog's `Message` or `InsertionStrings`.
[ "Generate", "the", "event", "s", "body", "to", "send", "to", "Datadog", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L192-L229
train
Generates the event s body to send to Datadog.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
LogEvent.is_after
def is_after(self, ts): ''' Compare this event's timestamp to a give timestamp. ''' if self.timestamp >= int(calendar.timegm(ts.timetuple())): return True return False
python
def is_after(self, ts): ''' Compare this event's timestamp to a give timestamp. ''' if self.timestamp >= int(calendar.timegm(ts.timetuple())): return True return False
[ "def", "is_after", "(", "self", ",", "ts", ")", ":", "if", "self", ".", "timestamp", ">=", "int", "(", "calendar", ".", "timegm", "(", "ts", ".", "timetuple", "(", ")", ")", ")", ":", "return", "True", "return", "False" ]
Compare this event's timestamp to a give timestamp.
[ "Compare", "this", "event", "s", "timestamp", "to", "a", "give", "timestamp", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L262-L266
train
Compare this event s timestamp to a give timestamp.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
LogEvent._wmi_to_ts
def _wmi_to_ts(self, wmi_ts): ''' Convert a wmi formatted timestamp into an epoch. ''' year, month, day, hour, minute, second, microsecond, tz = to_time(wmi_ts) tz_delta = timedelta(minutes=int(tz)) if '+' in wmi_ts: tz_delta = -tz_delta dt = ( da...
python
def _wmi_to_ts(self, wmi_ts): ''' Convert a wmi formatted timestamp into an epoch. ''' year, month, day, hour, minute, second, microsecond, tz = to_time(wmi_ts) tz_delta = timedelta(minutes=int(tz)) if '+' in wmi_ts: tz_delta = -tz_delta dt = ( da...
[ "def", "_wmi_to_ts", "(", "self", ",", "wmi_ts", ")", ":", "year", ",", "month", ",", "day", ",", "hour", ",", "minute", ",", "second", ",", "microsecond", ",", "tz", "=", "to_time", "(", "wmi_ts", ")", "tz_delta", "=", "timedelta", "(", "minutes", "...
Convert a wmi formatted timestamp into an epoch.
[ "Convert", "a", "wmi", "formatted", "timestamp", "into", "an", "epoch", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L268-L280
train
Convert a wmi formatted timestamp into an epoch.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
win32_event_log/datadog_checks/win32_event_log/win32_event_log.py
LogEvent._tags
def _tags(self, tags, event_code): ''' Inject additional tags into the list already supplied to LogEvent. ''' tags_list = [] if tags is not None: tags_list += list(tags) tags_list.append("event_id:{event_id}".format(event_id=event_code)) return tags_list
python
def _tags(self, tags, event_code): ''' Inject additional tags into the list already supplied to LogEvent. ''' tags_list = [] if tags is not None: tags_list += list(tags) tags_list.append("event_id:{event_id}".format(event_id=event_code)) return tags_list
[ "def", "_tags", "(", "self", ",", "tags", ",", "event_code", ")", ":", "tags_list", "=", "[", "]", "if", "tags", "is", "not", "None", ":", "tags_list", "+=", "list", "(", "tags", ")", "tags_list", ".", "append", "(", "\"event_id:{event_id}\"", ".", "fo...
Inject additional tags into the list already supplied to LogEvent.
[ "Inject", "additional", "tags", "into", "the", "list", "already", "supplied", "to", "LogEvent", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/win32_event_log/datadog_checks/win32_event_log/win32_event_log.py#L282-L289
train
Inject additional tags into the list already supplied to LogEvent.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
tokumx/datadog_checks/tokumx/vendor/pymongo/cursor_manager.py
CursorManager.close
def close(self, cursor_id, address): """Kill a cursor. Raises TypeError if cursor_id is not an instance of (int, long). :Parameters: - `cursor_id`: cursor id to close - `address`: the cursor's server's (host, port) pair .. versionchanged:: 3.0 Now requir...
python
def close(self, cursor_id, address): """Kill a cursor. Raises TypeError if cursor_id is not an instance of (int, long). :Parameters: - `cursor_id`: cursor id to close - `address`: the cursor's server's (host, port) pair .. versionchanged:: 3.0 Now requir...
[ "def", "close", "(", "self", ",", "cursor_id", ",", "address", ")", ":", "if", "not", "isinstance", "(", "cursor_id", ",", "integer_types", ")", ":", "raise", "TypeError", "(", "\"cursor_id must be an integer\"", ")", "self", ".", "__client", "(", ")", ".", ...
Kill a cursor. Raises TypeError if cursor_id is not an instance of (int, long). :Parameters: - `cursor_id`: cursor id to close - `address`: the cursor's server's (host, port) pair .. versionchanged:: 3.0 Now requires an `address` argument.
[ "Kill", "a", "cursor", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/tokumx/datadog_checks/tokumx/vendor/pymongo/cursor_manager.py#L50-L65
train
Kill a cursor.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
etcd/datadog_checks/etcd/etcd.py
Etcd._get_health_status
def _get_health_status(self, url, ssl_params, timeout): """ Don't send the "can connect" service check if we have troubles getting the health status """ try: r = self._perform_request(url, "/health", ssl_params, timeout) # we don't use get() here so we can...
python
def _get_health_status(self, url, ssl_params, timeout): """ Don't send the "can connect" service check if we have troubles getting the health status """ try: r = self._perform_request(url, "/health", ssl_params, timeout) # we don't use get() here so we can...
[ "def", "_get_health_status", "(", "self", ",", "url", ",", "ssl_params", ",", "timeout", ")", ":", "try", ":", "r", "=", "self", ".", "_perform_request", "(", "url", ",", "\"/health\"", ",", "ssl_params", ",", "timeout", ")", "# we don't use get() here so we c...
Don't send the "can connect" service check if we have troubles getting the health status
[ "Don", "t", "send", "the", "can", "connect", "service", "check", "if", "we", "have", "troubles", "getting", "the", "health", "status" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/etcd/datadog_checks/etcd/etcd.py#L270-L280
train
Get the health status of a specific resource.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/commands/env/stop.py
stop
def stop(check, env): """Stop environments.""" all_checks = check == 'all' checks = get_configured_checks() if all_checks else [check] if all_checks: env_indent = DEFAULT_INDENT status_indent = DEFAULT_INDENT * 2 else: env_indent = None status_indent = DEFAULT_INDENT...
python
def stop(check, env): """Stop environments.""" all_checks = check == 'all' checks = get_configured_checks() if all_checks else [check] if all_checks: env_indent = DEFAULT_INDENT status_indent = DEFAULT_INDENT * 2 else: env_indent = None status_indent = DEFAULT_INDENT...
[ "def", "stop", "(", "check", ",", "env", ")", ":", "all_checks", "=", "check", "==", "'all'", "checks", "=", "get_configured_checks", "(", ")", "if", "all_checks", "else", "[", "check", "]", "if", "all_checks", ":", "env_indent", "=", "DEFAULT_INDENT", "st...
Stop environments.
[ "Stop", "environments", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/env/stop.py#L13-L50
train
Stop the check and environment.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
istio/datadog_checks/istio/istio.py
Istio.check
def check(self, instance): """ Process both the istio_mesh instance and process_mixer instance associated with this instance """ # Get the config for the istio_mesh instance istio_mesh_endpoint = instance.get('istio_mesh_endpoint') istio_mesh_config = self.config_map[ist...
python
def check(self, instance): """ Process both the istio_mesh instance and process_mixer instance associated with this instance """ # Get the config for the istio_mesh instance istio_mesh_endpoint = instance.get('istio_mesh_endpoint') istio_mesh_config = self.config_map[ist...
[ "def", "check", "(", "self", ",", "instance", ")", ":", "# Get the config for the istio_mesh instance", "istio_mesh_endpoint", "=", "instance", ".", "get", "(", "'istio_mesh_endpoint'", ")", "istio_mesh_config", "=", "self", ".", "config_map", "[", "istio_mesh_endpoint"...
Process both the istio_mesh instance and process_mixer instance associated with this instance
[ "Process", "both", "the", "istio_mesh", "instance", "and", "process_mixer", "instance", "associated", "with", "this", "instance" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/istio/datadog_checks/istio/istio.py#L26-L43
train
Process both the istio_mesh instance and process_mixer instance associated with this instance
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
istio/datadog_checks/istio/istio.py
Istio.create_generic_instances
def create_generic_instances(self, instances): """ Generalize each (single) Istio instance into two OpenMetricsBaseCheck instances """ generic_instances = [] for instance in instances: istio_mesh_instance = self._create_istio_mesh_instance(instance) proce...
python
def create_generic_instances(self, instances): """ Generalize each (single) Istio instance into two OpenMetricsBaseCheck instances """ generic_instances = [] for instance in instances: istio_mesh_instance = self._create_istio_mesh_instance(instance) proce...
[ "def", "create_generic_instances", "(", "self", ",", "instances", ")", ":", "generic_instances", "=", "[", "]", "for", "instance", "in", "instances", ":", "istio_mesh_instance", "=", "self", ".", "_create_istio_mesh_instance", "(", "instance", ")", "process_mixer_in...
Generalize each (single) Istio instance into two OpenMetricsBaseCheck instances
[ "Generalize", "each", "(", "single", ")", "Istio", "instance", "into", "two", "OpenMetricsBaseCheck", "instances" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/istio/datadog_checks/istio/istio.py#L45-L57
train
Generalize each Istio instance into two OpenMetricsBaseCheck instances
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
istio/datadog_checks/istio/istio.py
Istio._create_istio_mesh_instance
def _create_istio_mesh_instance(self, instance): """ Grab the istio mesh scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict """ endpoint = instance.get('istio_mesh_endpoint') if endpoint is None: raise CheckE...
python
def _create_istio_mesh_instance(self, instance): """ Grab the istio mesh scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict """ endpoint = instance.get('istio_mesh_endpoint') if endpoint is None: raise CheckE...
[ "def", "_create_istio_mesh_instance", "(", "self", ",", "instance", ")", ":", "endpoint", "=", "instance", ".", "get", "(", "'istio_mesh_endpoint'", ")", "if", "endpoint", "is", "None", ":", "raise", "CheckException", "(", "\"Unable to find istio_mesh_endpoint in conf...
Grab the istio mesh scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict
[ "Grab", "the", "istio", "mesh", "scraper", "from", "the", "dict", "and", "return", "it", "if", "it", "exists", "otherwise", "create", "the", "scraper", "and", "add", "it", "to", "the", "dict" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/istio/datadog_checks/istio/istio.py#L59-L95
train
Create the istio mesh scraper from the dict and return it if it exists otherwise create it and add it to the dict
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
istio/datadog_checks/istio/istio.py
Istio._create_process_mixer_instance
def _create_process_mixer_instance(self, instance): """ Grab the mixer scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict """ endpoint = instance.get('mixer_endpoint') if endpoint is None: raise CheckException...
python
def _create_process_mixer_instance(self, instance): """ Grab the mixer scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict """ endpoint = instance.get('mixer_endpoint') if endpoint is None: raise CheckException...
[ "def", "_create_process_mixer_instance", "(", "self", ",", "instance", ")", ":", "endpoint", "=", "instance", ".", "get", "(", "'mixer_endpoint'", ")", "if", "endpoint", "is", "None", ":", "raise", "CheckException", "(", "\"Unable to find mixer_endpoint in config file...
Grab the mixer scraper from the dict and return it if it exists, otherwise create the scraper and add it to the dict
[ "Grab", "the", "mixer", "scraper", "from", "the", "dict", "and", "return", "it", "if", "it", "exists", "otherwise", "create", "the", "scraper", "and", "add", "it", "to", "the", "dict" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/istio/datadog_checks/istio/istio.py#L97-L168
train
Create the process_mixer_instance from the dict and return it if it exists otherwise create the scraper and add it to the dict.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
marathon/datadog_checks/marathon/marathon.py
Marathon.get_apps_json
def get_apps_json(self, url, timeout, auth, acs_url, ssl_verify, tags, group): """ The dictionary containing the apps is cached during collection and reset at every `check()` call. """ if self.apps_response is not None: return self.apps_response # Marathon ap...
python
def get_apps_json(self, url, timeout, auth, acs_url, ssl_verify, tags, group): """ The dictionary containing the apps is cached during collection and reset at every `check()` call. """ if self.apps_response is not None: return self.apps_response # Marathon ap...
[ "def", "get_apps_json", "(", "self", ",", "url", ",", "timeout", ",", "auth", ",", "acs_url", ",", "ssl_verify", ",", "tags", ",", "group", ")", ":", "if", "self", ".", "apps_response", "is", "not", "None", ":", "return", "self", ".", "apps_response", ...
The dictionary containing the apps is cached during collection and reset at every `check()` call.
[ "The", "dictionary", "containing", "the", "apps", "is", "cached", "during", "collection", "and", "reset", "at", "every", "check", "()", "call", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/marathon/datadog_checks/marathon/marathon.py#L156-L175
train
Get the apps from Marathon and return the response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
marathon/datadog_checks/marathon/marathon.py
Marathon.ensure_queue_count
def ensure_queue_count( self, queued, url, timeout, auth, acs_url, ssl_verify, tags=None, label_tags=None, group=None ): """ Ensure `marathon.queue.count` is reported as zero for apps without queued instances. """ metric_name = '{}.count'.format(self.QUEUE_PREFIX) ap...
python
def ensure_queue_count( self, queued, url, timeout, auth, acs_url, ssl_verify, tags=None, label_tags=None, group=None ): """ Ensure `marathon.queue.count` is reported as zero for apps without queued instances. """ metric_name = '{}.count'.format(self.QUEUE_PREFIX) ap...
[ "def", "ensure_queue_count", "(", "self", ",", "queued", ",", "url", ",", "timeout", ",", "auth", ",", "acs_url", ",", "ssl_verify", ",", "tags", "=", "None", ",", "label_tags", "=", "None", ",", "group", "=", "None", ")", ":", "metric_name", "=", "'{}...
Ensure `marathon.queue.count` is reported as zero for apps without queued instances.
[ "Ensure", "marathon", ".", "queue", ".", "count", "is", "reported", "as", "zero", "for", "apps", "without", "queued", "instances", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/marathon/datadog_checks/marathon/marathon.py#L263-L276
train
Ensure queue. count is reported as zero for apps with queued instances.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/py3.py
py3
def py3(check): """Verify if a custom check or integration can run on python 3. CHECK can be an integration name or a valid path to a Python module or package folder. """ if check in get_valid_checks(): path_to_module = os.path.dirname(get_version_file(check)) else: path_to_module =...
python
def py3(check): """Verify if a custom check or integration can run on python 3. CHECK can be an integration name or a valid path to a Python module or package folder. """ if check in get_valid_checks(): path_to_module = os.path.dirname(get_version_file(check)) else: path_to_module =...
[ "def", "py3", "(", "check", ")", ":", "if", "check", "in", "get_valid_checks", "(", ")", ":", "path_to_module", "=", "os", ".", "path", ".", "dirname", "(", "get_version_file", "(", "check", ")", ")", "else", ":", "path_to_module", "=", "check", "if", ...
Verify if a custom check or integration can run on python 3. CHECK can be an integration name or a valid path to a Python module or package folder.
[ "Verify", "if", "a", "custom", "check", "or", "integration", "can", "run", "on", "python", "3", ".", "CHECK", "can", "be", "an", "integration", "name", "or", "a", "valid", "path", "to", "a", "Python", "module", "or", "package", "folder", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/commands/validate/py3.py#L18-L50
train
Verify if a custom check can run on python 3.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
http_check/datadog_checks/http_check/config.py
from_instance
def from_instance(instance, default_ca_certs=None): """ Create a config object from an instance dictionary """ method = instance.get('method', 'get') data = instance.get('data', {}) tags = instance.get('tags', []) ntlm_domain = instance.get('ntlm_domain') username = instance.get('usernam...
python
def from_instance(instance, default_ca_certs=None): """ Create a config object from an instance dictionary """ method = instance.get('method', 'get') data = instance.get('data', {}) tags = instance.get('tags', []) ntlm_domain = instance.get('ntlm_domain') username = instance.get('usernam...
[ "def", "from_instance", "(", "instance", ",", "default_ca_certs", "=", "None", ")", ":", "method", "=", "instance", ".", "get", "(", "'method'", ",", "'get'", ")", "data", "=", "instance", ".", "get", "(", "'data'", ",", "{", "}", ")", "tags", "=", "...
Create a config object from an instance dictionary
[ "Create", "a", "config", "object", "from", "an", "instance", "dictionary" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/http_check/datadog_checks/http_check/config.py#L24-L94
train
Create a config object from a dictionary.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/release.py
update_version_module
def update_version_module(check_name, old_ver, new_ver): """ Change the Python code in the __about__.py module so that `__version__` contains the new value. """ version_file = get_version_file(check_name) contents = read_file(version_file) contents = contents.replace(old_ver, new_ver) w...
python
def update_version_module(check_name, old_ver, new_ver): """ Change the Python code in the __about__.py module so that `__version__` contains the new value. """ version_file = get_version_file(check_name) contents = read_file(version_file) contents = contents.replace(old_ver, new_ver) w...
[ "def", "update_version_module", "(", "check_name", ",", "old_ver", ",", "new_ver", ")", ":", "version_file", "=", "get_version_file", "(", "check_name", ")", "contents", "=", "read_file", "(", "version_file", ")", "contents", "=", "contents", ".", "replace", "("...
Change the Python code in the __about__.py module so that `__version__` contains the new value.
[ "Change", "the", "Python", "code", "in", "the", "__about__", ".", "py", "module", "so", "that", "__version__", "contains", "the", "new", "value", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/release.py#L25-L34
train
Update the Python code in the version module so that it contains the new value.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/release.py
get_agent_requirement_line
def get_agent_requirement_line(check, version): """ Compose a text line to be used in a requirements.txt file to install a check pinned to a specific version. """ package_name = get_package_name(check) # no manifest if check in ('datadog_checks_base', 'datadog_checks_downloader'): r...
python
def get_agent_requirement_line(check, version): """ Compose a text line to be used in a requirements.txt file to install a check pinned to a specific version. """ package_name = get_package_name(check) # no manifest if check in ('datadog_checks_base', 'datadog_checks_downloader'): r...
[ "def", "get_agent_requirement_line", "(", "check", ",", "version", ")", ":", "package_name", "=", "get_package_name", "(", "check", ")", "# no manifest", "if", "check", "in", "(", "'datadog_checks_base'", ",", "'datadog_checks_downloader'", ")", ":", "return", "'{}=...
Compose a text line to be used in a requirements.txt file to install a check pinned to a specific version.
[ "Compose", "a", "text", "line", "to", "be", "used", "in", "a", "requirements", ".", "txt", "file", "to", "install", "a", "check", "pinned", "to", "a", "specific", "version", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/release.py#L63-L91
train
Returns a text line to be used in a requirements. txt file to install a check pinned to a specific version.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
datadog_checks_dev/datadog_checks/dev/tooling/release.py
update_agent_requirements
def update_agent_requirements(req_file, check, newline): """ Replace the requirements line for the given check """ package_name = get_package_name(check) lines = read_file_lines(req_file) for i, line in enumerate(lines): current_package_name = line.split('==')[0] if current_pac...
python
def update_agent_requirements(req_file, check, newline): """ Replace the requirements line for the given check """ package_name = get_package_name(check) lines = read_file_lines(req_file) for i, line in enumerate(lines): current_package_name = line.split('==')[0] if current_pac...
[ "def", "update_agent_requirements", "(", "req_file", ",", "check", ",", "newline", ")", ":", "package_name", "=", "get_package_name", "(", "check", ")", "lines", "=", "read_file_lines", "(", "req_file", ")", "for", "i", ",", "line", "in", "enumerate", "(", "...
Replace the requirements line for the given check
[ "Replace", "the", "requirements", "line", "for", "the", "given", "check" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/datadog_checks_dev/datadog_checks/dev/tooling/release.py#L94-L108
train
Update the requirements line for the given check
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
directory/datadog_checks/directory/traverse.py
_walk
def _walk(top): """Modified version of https://docs.python.org/3/library/os.html#os.scandir that returns https://docs.python.org/3/library/os.html#os.DirEntry for files directly to take advantage of possible cached os.stat calls. """ dirs = [] nondirs = [] try: scandir_iter = scandi...
python
def _walk(top): """Modified version of https://docs.python.org/3/library/os.html#os.scandir that returns https://docs.python.org/3/library/os.html#os.DirEntry for files directly to take advantage of possible cached os.stat calls. """ dirs = [] nondirs = [] try: scandir_iter = scandi...
[ "def", "_walk", "(", "top", ")", ":", "dirs", "=", "[", "]", "nondirs", "=", "[", "]", "try", ":", "scandir_iter", "=", "scandir", "(", "top", ")", "except", "OSError", ":", "return", "# Avoid repeated global lookups.", "get_next", "=", "next", "while", ...
Modified version of https://docs.python.org/3/library/os.html#os.scandir that returns https://docs.python.org/3/library/os.html#os.DirEntry for files directly to take advantage of possible cached os.stat calls.
[ "Modified", "version", "of", "https", ":", "//", "docs", ".", "python", ".", "org", "/", "3", "/", "library", "/", "os", ".", "html#os", ".", "scandir", "that", "returns", "https", ":", "//", "docs", ".", "python", ".", "org", "/", "3", "/", "libra...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/directory/datadog_checks/directory/traverse.py#L11-L49
train
Modified version of os. scandir that returns https://docs. python. org / 3. html#os. DirEntry for files and os. stat calls.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._yarn_cluster_metrics
def _yarn_cluster_metrics(self, rm_address, instance, addl_tags): """ Get metrics related to YARN cluster """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_CLUSTER_METRICS_PATH, addl_tags) if metrics_json: yarn_metrics = metrics_json[YARN_CLUS...
python
def _yarn_cluster_metrics(self, rm_address, instance, addl_tags): """ Get metrics related to YARN cluster """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_CLUSTER_METRICS_PATH, addl_tags) if metrics_json: yarn_metrics = metrics_json[YARN_CLUS...
[ "def", "_yarn_cluster_metrics", "(", "self", ",", "rm_address", ",", "instance", ",", "addl_tags", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "rm_address", ",", "instance", ",", "YARN_CLUSTER_METRICS_PATH", ",", "addl_tags", ")", "if...
Get metrics related to YARN cluster
[ "Get", "metrics", "related", "to", "YARN", "cluster" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L186-L197
train
Get metrics related to YARN cluster
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._yarn_app_metrics
def _yarn_app_metrics(self, rm_address, instance, app_tags, addl_tags): """ Get metrics for running applications """ metrics_json = self._rest_request_to_json( rm_address, instance, YARN_APPS_PATH, addl_tags, states=YARN_APPLICATION_STATES ) if metrics_json a...
python
def _yarn_app_metrics(self, rm_address, instance, app_tags, addl_tags): """ Get metrics for running applications """ metrics_json = self._rest_request_to_json( rm_address, instance, YARN_APPS_PATH, addl_tags, states=YARN_APPLICATION_STATES ) if metrics_json a...
[ "def", "_yarn_app_metrics", "(", "self", ",", "rm_address", ",", "instance", ",", "app_tags", ",", "addl_tags", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "rm_address", ",", "instance", ",", "YARN_APPS_PATH", ",", "addl_tags", ",",...
Get metrics for running applications
[ "Get", "metrics", "for", "running", "applications" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L199-L222
train
Get metrics for running applications
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._yarn_node_metrics
def _yarn_node_metrics(self, rm_address, instance, addl_tags): """ Get metrics related to YARN nodes """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_NODES_PATH, addl_tags) if metrics_json and metrics_json['nodes'] is not None and metrics_json['nodes']['n...
python
def _yarn_node_metrics(self, rm_address, instance, addl_tags): """ Get metrics related to YARN nodes """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_NODES_PATH, addl_tags) if metrics_json and metrics_json['nodes'] is not None and metrics_json['nodes']['n...
[ "def", "_yarn_node_metrics", "(", "self", ",", "rm_address", ",", "instance", ",", "addl_tags", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "rm_address", ",", "instance", ",", "YARN_NODES_PATH", ",", "addl_tags", ")", "if", "metrics...
Get metrics related to YARN nodes
[ "Get", "metrics", "related", "to", "YARN", "nodes" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L224-L238
train
Get metrics related to YARN nodes
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._yarn_scheduler_metrics
def _yarn_scheduler_metrics(self, rm_address, instance, addl_tags, queue_blacklist): """ Get metrics from YARN scheduler """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_SCHEDULER_PATH, addl_tags) try: metrics_json = metrics_json['scheduler'][...
python
def _yarn_scheduler_metrics(self, rm_address, instance, addl_tags, queue_blacklist): """ Get metrics from YARN scheduler """ metrics_json = self._rest_request_to_json(rm_address, instance, YARN_SCHEDULER_PATH, addl_tags) try: metrics_json = metrics_json['scheduler'][...
[ "def", "_yarn_scheduler_metrics", "(", "self", ",", "rm_address", ",", "instance", ",", "addl_tags", ",", "queue_blacklist", ")", ":", "metrics_json", "=", "self", ".", "_rest_request_to_json", "(", "rm_address", ",", "instance", ",", "YARN_SCHEDULER_PATH", ",", "...
Get metrics from YARN scheduler
[ "Get", "metrics", "from", "YARN", "scheduler" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L240-L253
train
Get metrics from YARN scheduler
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._yarn_capacity_scheduler_metrics
def _yarn_capacity_scheduler_metrics(self, metrics_json, addl_tags, queue_blacklist): """ Get metrics from YARN scheduler if it's type is capacityScheduler """ tags = ['queue_name:{}'.format(metrics_json['queueName'])] tags.extend(addl_tags) self._set_yarn_metrics_from_j...
python
def _yarn_capacity_scheduler_metrics(self, metrics_json, addl_tags, queue_blacklist): """ Get metrics from YARN scheduler if it's type is capacityScheduler """ tags = ['queue_name:{}'.format(metrics_json['queueName'])] tags.extend(addl_tags) self._set_yarn_metrics_from_j...
[ "def", "_yarn_capacity_scheduler_metrics", "(", "self", ",", "metrics_json", ",", "addl_tags", ",", "queue_blacklist", ")", ":", "tags", "=", "[", "'queue_name:{}'", ".", "format", "(", "metrics_json", "[", "'queueName'", "]", ")", "]", "tags", ".", "extend", ...
Get metrics from YARN scheduler if it's type is capacityScheduler
[ "Get", "metrics", "from", "YARN", "scheduler", "if", "it", "s", "type", "is", "capacityScheduler" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L255-L285
train
Get metrics from YARN capacity scheduler if it s type is capacityScheduler
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._set_yarn_metrics_from_json
def _set_yarn_metrics_from_json(self, tags, metrics_json, yarn_metrics): """ Parse the JSON response and set the metrics """ for dict_path, metric in iteritems(yarn_metrics): metric_name, metric_type = metric metric_value = self._get_value_from_json(dict_path, me...
python
def _set_yarn_metrics_from_json(self, tags, metrics_json, yarn_metrics): """ Parse the JSON response and set the metrics """ for dict_path, metric in iteritems(yarn_metrics): metric_name, metric_type = metric metric_value = self._get_value_from_json(dict_path, me...
[ "def", "_set_yarn_metrics_from_json", "(", "self", ",", "tags", ",", "metrics_json", ",", "yarn_metrics", ")", ":", "for", "dict_path", ",", "metric", "in", "iteritems", "(", "yarn_metrics", ")", ":", "metric_name", ",", "metric_type", "=", "metric", "metric_val...
Parse the JSON response and set the metrics
[ "Parse", "the", "JSON", "response", "and", "set", "the", "metrics" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L287-L297
train
Parse the JSON response and set the metrics
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._get_value_from_json
def _get_value_from_json(self, dict_path, metrics_json): """ Get a value from a dictionary under N keys, represented as str("key1.key2...key{n}") """ for key in dict_path.split('.'): if key in metrics_json: metrics_json = metrics_json.get(key) else...
python
def _get_value_from_json(self, dict_path, metrics_json): """ Get a value from a dictionary under N keys, represented as str("key1.key2...key{n}") """ for key in dict_path.split('.'): if key in metrics_json: metrics_json = metrics_json.get(key) else...
[ "def", "_get_value_from_json", "(", "self", ",", "dict_path", ",", "metrics_json", ")", ":", "for", "key", "in", "dict_path", ".", "split", "(", "'.'", ")", ":", "if", "key", "in", "metrics_json", ":", "metrics_json", "=", "metrics_json", ".", "get", "(", ...
Get a value from a dictionary under N keys, represented as str("key1.key2...key{n}")
[ "Get", "a", "value", "from", "a", "dictionary", "under", "N", "keys", "represented", "as", "str", "(", "key1", ".", "key2", "...", "key", "{", "n", "}", ")" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L299-L308
train
Get a value from a dictionary under N keys represented as str ( key1. key2... keyN
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._set_metric
def _set_metric(self, metric_name, metric_type, value, tags=None, device_name=None): """ Set a metric """ if metric_type == GAUGE: self.gauge(metric_name, value, tags=tags, device_name=device_name) elif metric_type == INCREMENT: self.increment(metric_name,...
python
def _set_metric(self, metric_name, metric_type, value, tags=None, device_name=None): """ Set a metric """ if metric_type == GAUGE: self.gauge(metric_name, value, tags=tags, device_name=device_name) elif metric_type == INCREMENT: self.increment(metric_name,...
[ "def", "_set_metric", "(", "self", ",", "metric_name", ",", "metric_type", ",", "value", ",", "tags", "=", "None", ",", "device_name", "=", "None", ")", ":", "if", "metric_type", "==", "GAUGE", ":", "self", ".", "gauge", "(", "metric_name", ",", "value",...
Set a metric
[ "Set", "a", "metric" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L310-L319
train
Set a metric in the cache.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._rest_request_to_json
def _rest_request_to_json(self, url, instance, object_path, tags, *args, **kwargs): """ Query the given URL and return the JSON response """ service_check_tags = ['url:{}'.format(self._get_url_base(url))] + tags service_check_tags = list(set(service_check_tags)) if objec...
python
def _rest_request_to_json(self, url, instance, object_path, tags, *args, **kwargs): """ Query the given URL and return the JSON response """ service_check_tags = ['url:{}'.format(self._get_url_base(url))] + tags service_check_tags = list(set(service_check_tags)) if objec...
[ "def", "_rest_request_to_json", "(", "self", ",", "url", ",", "instance", ",", "object_path", ",", "tags", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "service_check_tags", "=", "[", "'url:{}'", ".", "format", "(", "self", ".", "_get_url_base", ...
Query the given URL and return the JSON response
[ "Query", "the", "given", "URL", "and", "return", "the", "JSON", "response" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L321-L409
train
Helper function to make a REST request to the given URL and return the JSON response.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._join_url_dir
def _join_url_dir(self, url, *args): """ Join a URL with multiple directories """ for path in args: url = url.rstrip('/') + '/' url = urljoin(url, path.lstrip('/')) return url
python
def _join_url_dir(self, url, *args): """ Join a URL with multiple directories """ for path in args: url = url.rstrip('/') + '/' url = urljoin(url, path.lstrip('/')) return url
[ "def", "_join_url_dir", "(", "self", ",", "url", ",", "*", "args", ")", ":", "for", "path", "in", "args", ":", "url", "=", "url", ".", "rstrip", "(", "'/'", ")", "+", "'/'", "url", "=", "urljoin", "(", "url", ",", "path", ".", "lstrip", "(", "'...
Join a URL with multiple directories
[ "Join", "a", "URL", "with", "multiple", "directories" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L411-L419
train
Join a URL with multiple directories
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
yarn/datadog_checks/yarn/yarn.py
YarnCheck._get_url_base
def _get_url_base(self, url): """ Return the base of a URL """ s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, '', '', ''])
python
def _get_url_base(self, url): """ Return the base of a URL """ s = urlsplit(url) return urlunsplit([s.scheme, s.netloc, '', '', ''])
[ "def", "_get_url_base", "(", "self", ",", "url", ")", ":", "s", "=", "urlsplit", "(", "url", ")", "return", "urlunsplit", "(", "[", "s", ".", "scheme", ",", "s", ".", "netloc", ",", "''", ",", "''", ",", "''", "]", ")" ]
Return the base of a URL
[ "Return", "the", "base", "of", "a", "URL" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/yarn/datadog_checks/yarn/yarn.py#L421-L426
train
Return the base of a URL
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
ntp/datadog_checks/ntp/ntp.py
NtpCheck._get_service_port
def _get_service_port(self, instance): """ Get the ntp server port """ host = instance.get('host', DEFAULT_HOST) port = instance.get('port', DEFAULT_PORT) # default port is the name of the service but lookup would fail # if the /etc/services file is missing. In th...
python
def _get_service_port(self, instance): """ Get the ntp server port """ host = instance.get('host', DEFAULT_HOST) port = instance.get('port', DEFAULT_PORT) # default port is the name of the service but lookup would fail # if the /etc/services file is missing. In th...
[ "def", "_get_service_port", "(", "self", ",", "instance", ")", ":", "host", "=", "instance", ".", "get", "(", "'host'", ",", "DEFAULT_HOST", ")", "port", "=", "instance", ".", "get", "(", "'port'", ",", "DEFAULT_PORT", ")", "# default port is the name of the s...
Get the ntp server port
[ "Get", "the", "ntp", "server", "port" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/ntp/datadog_checks/ntp/ntp.py#L23-L36
train
Get the service port from the instance dict.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
kubelet/datadog_checks/kubelet/prometheus.py
CadvisorPrometheusScraperMixin._create_cadvisor_prometheus_instance
def _create_cadvisor_prometheus_instance(self, instance): """ Create a copy of the instance and set default values. This is so the base class can create a scraper_config with the proper values. """ cadvisor_instance = deepcopy(instance) cadvisor_instance.update( ...
python
def _create_cadvisor_prometheus_instance(self, instance): """ Create a copy of the instance and set default values. This is so the base class can create a scraper_config with the proper values. """ cadvisor_instance = deepcopy(instance) cadvisor_instance.update( ...
[ "def", "_create_cadvisor_prometheus_instance", "(", "self", ",", "instance", ")", ":", "cadvisor_instance", "=", "deepcopy", "(", "instance", ")", "cadvisor_instance", ".", "update", "(", "{", "'namespace'", ":", "self", ".", "NAMESPACE", ",", "# We need to specify ...
Create a copy of the instance and set default values. This is so the base class can create a scraper_config with the proper values.
[ "Create", "a", "copy", "of", "the", "instance", "and", "set", "default", "values", ".", "This", "is", "so", "the", "base", "class", "can", "create", "a", "scraper_config", "with", "the", "proper", "values", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/prometheus.py#L58-L96
train
Create a copy of the instance and set default values.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
kubelet/datadog_checks/kubelet/prometheus.py
CadvisorPrometheusScraperMixin._is_container_metric
def _is_container_metric(labels): """ Return whether a metric is about a container or not. It can be about pods, or even higher levels in the cgroup hierarchy and we don't want to report on that. :param metric: :return: bool """ for lbl in CONTAINER_LABELS...
python
def _is_container_metric(labels): """ Return whether a metric is about a container or not. It can be about pods, or even higher levels in the cgroup hierarchy and we don't want to report on that. :param metric: :return: bool """ for lbl in CONTAINER_LABELS...
[ "def", "_is_container_metric", "(", "labels", ")", ":", "for", "lbl", "in", "CONTAINER_LABELS", ":", "if", "lbl", "==", "'container_name'", ":", "if", "lbl", "in", "labels", ":", "if", "labels", "[", "lbl", "]", "==", "''", "or", "labels", "[", "lbl", ...
Return whether a metric is about a container or not. It can be about pods, or even higher levels in the cgroup hierarchy and we don't want to report on that. :param metric: :return: bool
[ "Return", "whether", "a", "metric", "is", "about", "a", "container", "or", "not", ".", "It", "can", "be", "about", "pods", "or", "even", "higher", "levels", "in", "the", "cgroup", "hierarchy", "and", "we", "don", "t", "want", "to", "report", "on", "tha...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/prometheus.py#L99-L114
train
Return whether a metric is about a container or not.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
kubelet/datadog_checks/kubelet/prometheus.py
CadvisorPrometheusScraperMixin._is_pod_metric
def _is_pod_metric(labels): """ Return whether a metric is about a pod or not. It can be about containers, pods, or higher levels in the cgroup hierarchy and we don't want to report on that. :param metric :return bool """ if 'container_name' in labels: ...
python
def _is_pod_metric(labels): """ Return whether a metric is about a pod or not. It can be about containers, pods, or higher levels in the cgroup hierarchy and we don't want to report on that. :param metric :return bool """ if 'container_name' in labels: ...
[ "def", "_is_pod_metric", "(", "labels", ")", ":", "if", "'container_name'", "in", "labels", ":", "if", "labels", "[", "'container_name'", "]", "==", "'POD'", ":", "return", "True", "# containerd does not report container_name=\"POD\"", "elif", "labels", "[", "'conta...
Return whether a metric is about a pod or not. It can be about containers, pods, or higher levels in the cgroup hierarchy and we don't want to report on that. :param metric :return bool
[ "Return", "whether", "a", "metric", "is", "about", "a", "pod", "or", "not", ".", "It", "can", "be", "about", "containers", "pods", "or", "higher", "levels", "in", "the", "cgroup", "hierarchy", "and", "we", "don", "t", "want", "to", "report", "on", "tha...
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/prometheus.py#L117-L139
train
Return whether a metric is about a pod or not.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
kubelet/datadog_checks/kubelet/prometheus.py
CadvisorPrometheusScraperMixin._get_container_id
def _get_container_id(self, labels): """ Should only be called on a container-scoped metric It gets the container id from the podlist using the metrics labels :param labels :return str or None """ namespace = CadvisorPrometheusScraperMixin._get_container_label(la...
python
def _get_container_id(self, labels): """ Should only be called on a container-scoped metric It gets the container id from the podlist using the metrics labels :param labels :return str or None """ namespace = CadvisorPrometheusScraperMixin._get_container_label(la...
[ "def", "_get_container_id", "(", "self", ",", "labels", ")", ":", "namespace", "=", "CadvisorPrometheusScraperMixin", ".", "_get_container_label", "(", "labels", ",", "\"namespace\"", ")", "pod_name", "=", "CadvisorPrometheusScraperMixin", ".", "_get_container_label", "...
Should only be called on a container-scoped metric It gets the container id from the podlist using the metrics labels :param labels :return str or None
[ "Should", "only", "be", "called", "on", "a", "container", "-", "scoped", "metric", "It", "gets", "the", "container", "id", "from", "the", "podlist", "using", "the", "metrics", "labels" ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/prometheus.py#L152-L163
train
This method gets the container id from the podlist using the metrics labels
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...
DataDog/integrations-core
kubelet/datadog_checks/kubelet/prometheus.py
CadvisorPrometheusScraperMixin._get_entity_id_if_container_metric
def _get_entity_id_if_container_metric(self, labels): """ Checks the labels indicate a container metric, then extract the container id from them. :param labels :return str or None """ if CadvisorPrometheusScraperMixin._is_container_metric(labels): pod...
python
def _get_entity_id_if_container_metric(self, labels): """ Checks the labels indicate a container metric, then extract the container id from them. :param labels :return str or None """ if CadvisorPrometheusScraperMixin._is_container_metric(labels): pod...
[ "def", "_get_entity_id_if_container_metric", "(", "self", ",", "labels", ")", ":", "if", "CadvisorPrometheusScraperMixin", ".", "_is_container_metric", "(", "labels", ")", ":", "pod", "=", "self", ".", "_get_pod_by_metric_label", "(", "labels", ")", "if", "is_static...
Checks the labels indicate a container metric, then extract the container id from them. :param labels :return str or None
[ "Checks", "the", "labels", "indicate", "a", "container", "metric", "then", "extract", "the", "container", "id", "from", "them", "." ]
ebd41c873cf9f97a8c51bf9459bc6a7536af8acd
https://github.com/DataDog/integrations-core/blob/ebd41c873cf9f97a8c51bf9459bc6a7536af8acd/kubelet/datadog_checks/kubelet/prometheus.py#L165-L179
train
Checks the labels indicate a container metric and extract the container id from them.
Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL...