partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Dataset.get_maintainer
Get the dataset's maintainer. Returns: User: Dataset's maintainer
src/hdx/data/dataset.py
def get_maintainer(self): # type: () -> hdx.data.user.User """Get the dataset's maintainer. Returns: User: Dataset's maintainer """ return hdx.data.user.User.read_from_hdx(self.data['maintainer'], configuration=self.configuration)
def get_maintainer(self): # type: () -> hdx.data.user.User """Get the dataset's maintainer. Returns: User: Dataset's maintainer """ return hdx.data.user.User.read_from_hdx(self.data['maintainer'], configuration=self.configuration)
[ "Get", "the", "dataset", "s", "maintainer", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1188-L1195
[ "def", "get_maintainer", "(", "self", ")", ":", "# type: () -> hdx.data.user.User", "return", "hdx", ".", "data", ".", "user", ".", "User", ".", "read_from_hdx", "(", "self", ".", "data", "[", "'maintainer'", "]", ",", "configuration", "=", "self", ".", "con...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.set_maintainer
Set the dataset's maintainer. Args: maintainer (Union[User,Dict,str]): Either a user id or User metadata from a User object or dictionary. Returns: None
src/hdx/data/dataset.py
def set_maintainer(self, maintainer): # type: (Union[hdx.data.user.User,Dict,str]) -> None """Set the dataset's maintainer. Args: maintainer (Union[User,Dict,str]): Either a user id or User metadata from a User object or dictionary. Returns: None """ ...
def set_maintainer(self, maintainer): # type: (Union[hdx.data.user.User,Dict,str]) -> None """Set the dataset's maintainer. Args: maintainer (Union[User,Dict,str]): Either a user id or User metadata from a User object or dictionary. Returns: None """ ...
[ "Set", "the", "dataset", "s", "maintainer", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1197-L1214
[ "def", "set_maintainer", "(", "self", ",", "maintainer", ")", ":", "# type: (Union[hdx.data.user.User,Dict,str]) -> None", "if", "isinstance", "(", "maintainer", ",", "hdx", ".", "data", ".", "user", ".", "User", ")", "or", "isinstance", "(", "maintainer", ",", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.get_organization
Get the dataset's organization. Returns: Organization: Dataset's organization
src/hdx/data/dataset.py
def get_organization(self): # type: () -> hdx.data.organization.Organization """Get the dataset's organization. Returns: Organization: Dataset's organization """ return hdx.data.organization.Organization.read_from_hdx(self.data['owner_org'], configuration=self.conf...
def get_organization(self): # type: () -> hdx.data.organization.Organization """Get the dataset's organization. Returns: Organization: Dataset's organization """ return hdx.data.organization.Organization.read_from_hdx(self.data['owner_org'], configuration=self.conf...
[ "Get", "the", "dataset", "s", "organization", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1216-L1223
[ "def", "get_organization", "(", "self", ")", ":", "# type: () -> hdx.data.organization.Organization", "return", "hdx", ".", "data", ".", "organization", ".", "Organization", ".", "read_from_hdx", "(", "self", ".", "data", "[", "'owner_org'", "]", ",", "configuration...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.set_organization
Set the dataset's organization. Args: organization (Union[Organization,Dict,str]): Either an Organization id or Organization metadata from an Organization object or dictionary. Returns: None
src/hdx/data/dataset.py
def set_organization(self, organization): # type: (Union[hdx.data.organization.Organization,Dict,str]) -> None """Set the dataset's organization. Args: organization (Union[Organization,Dict,str]): Either an Organization id or Organization metadata from an Organization object or di...
def set_organization(self, organization): # type: (Union[hdx.data.organization.Organization,Dict,str]) -> None """Set the dataset's organization. Args: organization (Union[Organization,Dict,str]): Either an Organization id or Organization metadata from an Organization object or di...
[ "Set", "the", "dataset", "s", "organization", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1225-L1242
[ "def", "set_organization", "(", "self", ",", "organization", ")", ":", "# type: (Union[hdx.data.organization.Organization,Dict,str]) -> None", "if", "isinstance", "(", "organization", ",", "hdx", ".", "data", ".", "organization", ".", "Organization", ")", "or", "isinsta...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.get_showcases
Get any showcases the dataset is in Returns: List[Showcase]: list of showcases
src/hdx/data/dataset.py
def get_showcases(self): # type: () -> List[hdx.data.showcase.Showcase] """Get any showcases the dataset is in Returns: List[Showcase]: list of showcases """ assoc_result, showcases_dicts = self._read_from_hdx('showcase', self.data['id'], fieldname='package_id', ...
def get_showcases(self): # type: () -> List[hdx.data.showcase.Showcase] """Get any showcases the dataset is in Returns: List[Showcase]: list of showcases """ assoc_result, showcases_dicts = self._read_from_hdx('showcase', self.data['id'], fieldname='package_id', ...
[ "Get", "any", "showcases", "the", "dataset", "is", "in" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1244-L1258
[ "def", "get_showcases", "(", "self", ")", ":", "# type: () -> List[hdx.data.showcase.Showcase]", "assoc_result", ",", "showcases_dicts", "=", "self", ".", "_read_from_hdx", "(", "'showcase'", ",", "self", ".", "data", "[", "'id'", "]", ",", "fieldname", "=", "'pac...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset._get_dataset_showcase_dict
Get dataset showcase dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: dict: dataset showcase dict
src/hdx/data/dataset.py
def _get_dataset_showcase_dict(self, showcase): # type: (Union[hdx.data.showcase.Showcase, Dict,str]) -> Dict """Get dataset showcase dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: ...
def _get_dataset_showcase_dict(self, showcase): # type: (Union[hdx.data.showcase.Showcase, Dict,str]) -> Dict """Get dataset showcase dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: ...
[ "Get", "dataset", "showcase", "dict" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1260-L1278
[ "def", "_get_dataset_showcase_dict", "(", "self", ",", "showcase", ")", ":", "# type: (Union[hdx.data.showcase.Showcase, Dict,str]) -> Dict", "if", "isinstance", "(", "showcase", ",", "hdx", ".", "data", ".", "showcase", ".", "Showcase", ")", "or", "isinstance", "(", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.add_showcase
Add dataset to showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or showcase metadata from a Showcase object or dictionary showcases_to_check (List[Showcase]): list of showcases against which to check existence of showcase. Defaults to showcases containing dataset...
src/hdx/data/dataset.py
def add_showcase(self, showcase, showcases_to_check=None): # type: (Union[hdx.data.showcase.Showcase,Dict,str], List[hdx.data.showcase.Showcase]) -> bool """Add dataset to showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or showcase metadata from a Showcase o...
def add_showcase(self, showcase, showcases_to_check=None): # type: (Union[hdx.data.showcase.Showcase,Dict,str], List[hdx.data.showcase.Showcase]) -> bool """Add dataset to showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or showcase metadata from a Showcase o...
[ "Add", "dataset", "to", "showcase" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1280-L1299
[ "def", "add_showcase", "(", "self", ",", "showcase", ",", "showcases_to_check", "=", "None", ")", ":", "# type: (Union[hdx.data.showcase.Showcase,Dict,str], List[hdx.data.showcase.Showcase]) -> bool", "dataset_showcase", "=", "self", ".", "_get_dataset_showcase_dict", "(", "sho...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.add_showcases
Add dataset to multiple showcases Args: showcases (List[Union[Showcase,Dict,str]]): A list of either showcase ids or showcase metadata from Showcase objects or dictionaries showcases_to_check (List[Showcase]): list of showcases against which to check existence of showcase. Defaults to s...
src/hdx/data/dataset.py
def add_showcases(self, showcases, showcases_to_check=None): # type: (List[Union[hdx.data.showcase.Showcase,Dict,str]], List[hdx.data.showcase.Showcase]) -> bool """Add dataset to multiple showcases Args: showcases (List[Union[Showcase,Dict,str]]): A list of either showcase ids or s...
def add_showcases(self, showcases, showcases_to_check=None): # type: (List[Union[hdx.data.showcase.Showcase,Dict,str]], List[hdx.data.showcase.Showcase]) -> bool """Add dataset to multiple showcases Args: showcases (List[Union[Showcase,Dict,str]]): A list of either showcase ids or s...
[ "Add", "dataset", "to", "multiple", "showcases" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1301-L1318
[ "def", "add_showcases", "(", "self", ",", "showcases", ",", "showcases_to_check", "=", "None", ")", ":", "# type: (List[Union[hdx.data.showcase.Showcase,Dict,str]], List[hdx.data.showcase.Showcase]) -> bool", "if", "showcases_to_check", "is", "None", ":", "showcases_to_check", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.remove_showcase
Remove dataset from showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id string or showcase metadata from a Showcase object or dictionary Returns: None
src/hdx/data/dataset.py
def remove_showcase(self, showcase): # type: (Union[hdx.data.showcase.Showcase,Dict,str]) -> None """Remove dataset from showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id string or showcase metadata from a Showcase object or dictionary Returns: ...
def remove_showcase(self, showcase): # type: (Union[hdx.data.showcase.Showcase,Dict,str]) -> None """Remove dataset from showcase Args: showcase (Union[Showcase,Dict,str]): Either a showcase id string or showcase metadata from a Showcase object or dictionary Returns: ...
[ "Remove", "dataset", "from", "showcase" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1320-L1332
[ "def", "remove_showcase", "(", "self", ",", "showcase", ")", ":", "# type: (Union[hdx.data.showcase.Showcase,Dict,str]) -> None", "dataset_showcase", "=", "self", ".", "_get_dataset_showcase_dict", "(", "showcase", ")", "showcase", "=", "hdx", ".", "data", ".", "showcas...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.set_requestable
Set the dataset to be of type requestable or not Args: requestable (bool): Set whether dataset is requestable. Defaults to True. Returns: None
src/hdx/data/dataset.py
def set_requestable(self, requestable=True): # type: (bool) -> None """Set the dataset to be of type requestable or not Args: requestable (bool): Set whether dataset is requestable. Defaults to True. Returns: None """ self.data['is_requestdata_ty...
def set_requestable(self, requestable=True): # type: (bool) -> None """Set the dataset to be of type requestable or not Args: requestable (bool): Set whether dataset is requestable. Defaults to True. Returns: None """ self.data['is_requestdata_ty...
[ "Set", "the", "dataset", "to", "be", "of", "type", "requestable", "or", "not" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1343-L1355
[ "def", "set_requestable", "(", "self", ",", "requestable", "=", "True", ")", ":", "# type: (bool) -> None", "self", ".", "data", "[", "'is_requestdata_type'", "]", "=", "requestable", "if", "requestable", ":", "self", ".", "data", "[", "'private'", "]", "=", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.get_filetypes
Return list of filetypes in your data Returns: List[str]: List of filetypes
src/hdx/data/dataset.py
def get_filetypes(self): # type: () -> List[str] """Return list of filetypes in your data Returns: List[str]: List of filetypes """ if not self.is_requestable(): return [resource.get_file_type() for resource in self.get_resources()] return self._g...
def get_filetypes(self): # type: () -> List[str] """Return list of filetypes in your data Returns: List[str]: List of filetypes """ if not self.is_requestable(): return [resource.get_file_type() for resource in self.get_resources()] return self._g...
[ "Return", "list", "of", "filetypes", "in", "your", "data" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1410-L1419
[ "def", "get_filetypes", "(", "self", ")", ":", "# type: () -> List[str]", "if", "not", "self", ".", "is_requestable", "(", ")", ":", "return", "[", "resource", ".", "get_file_type", "(", ")", "for", "resource", "in", "self", ".", "get_resources", "(", ")", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.clean_dataset_tags
Clean dataset tags according to tags cleanup spreadsheet and return if any changes occurred Returns: Tuple[bool, bool]: Returns (True if tags changed or False if not, True if error or False if not)
src/hdx/data/dataset.py
def clean_dataset_tags(self): # type: () -> Tuple[bool, bool] """Clean dataset tags according to tags cleanup spreadsheet and return if any changes occurred Returns: Tuple[bool, bool]: Returns (True if tags changed or False if not, True if error or False if not) """ ...
def clean_dataset_tags(self): # type: () -> Tuple[bool, bool] """Clean dataset tags according to tags cleanup spreadsheet and return if any changes occurred Returns: Tuple[bool, bool]: Returns (True if tags changed or False if not, True if error or False if not) """ ...
[ "Clean", "dataset", "tags", "according", "to", "tags", "cleanup", "spreadsheet", "and", "return", "if", "any", "changes", "occurred" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1463-L1534
[ "def", "clean_dataset_tags", "(", "self", ")", ":", "# type: () -> Tuple[bool, bool]", "tags_dict", ",", "wildcard_tags", "=", "Tags", ".", "tagscleanupdicts", "(", ")", "def", "delete_tag", "(", "tag", ")", ":", "logger", ".", "info", "(", "'%s - Deleting tag %s!...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.set_quickchart_resource
Set the resource that will be used for displaying QuickCharts in dataset preview Args: resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or name, resource metadata from a Resource object or a dictionary or position Returns: bool: Returns True if reso...
src/hdx/data/dataset.py
def set_quickchart_resource(self, resource): # type: (Union[hdx.data.resource.Resource,Dict,str,int]) -> bool """Set the resource that will be used for displaying QuickCharts in dataset preview Args: resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or na...
def set_quickchart_resource(self, resource): # type: (Union[hdx.data.resource.Resource,Dict,str,int]) -> bool """Set the resource that will be used for displaying QuickCharts in dataset preview Args: resource (Union[hdx.data.resource.Resource,Dict,str,int]): Either resource id or na...
[ "Set", "the", "resource", "that", "will", "be", "used", "for", "displaying", "QuickCharts", "in", "dataset", "preview" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1556-L1588
[ "def", "set_quickchart_resource", "(", "self", ",", "resource", ")", ":", "# type: (Union[hdx.data.resource.Resource,Dict,str,int]) -> bool", "if", "isinstance", "(", "resource", ",", "int", ")", "and", "not", "isinstance", "(", "resource", ",", "bool", ")", ":", "r...
212440f54f73805826a16db77dbcb6033b18a313
train
Dataset.create_default_views
Create default resource views for all resources in dataset Args: create_datastore_views (bool): Whether to try to create resource views that point to the datastore Returns: None
src/hdx/data/dataset.py
def create_default_views(self, create_datastore_views=False): # type: (bool) -> None """Create default resource views for all resources in dataset Args: create_datastore_views (bool): Whether to try to create resource views that point to the datastore Returns: N...
def create_default_views(self, create_datastore_views=False): # type: (bool) -> None """Create default resource views for all resources in dataset Args: create_datastore_views (bool): Whether to try to create resource views that point to the datastore Returns: N...
[ "Create", "default", "resource", "views", "for", "all", "resources", "in", "dataset" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/dataset.py#L1590-L1605
[ "def", "create_default_views", "(", "self", ",", "create_datastore_views", "=", "False", ")", ":", "# type: (bool) -> None", "package", "=", "deepcopy", "(", "self", ".", "data", ")", "if", "self", ".", "resources", ":", "package", "[", "'resources'", "]", "="...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration._get_credentials
Return HDX site username and password Returns: Optional[Tuple[str, str]]: HDX site username and password or None
src/hdx/hdx_configuration.py
def _get_credentials(self): # type: () -> Optional[Tuple[str, str]] """ Return HDX site username and password Returns: Optional[Tuple[str, str]]: HDX site username and password or None """ site = self.data[self.hdx_site] username = site.get('username...
def _get_credentials(self): # type: () -> Optional[Tuple[str, str]] """ Return HDX site username and password Returns: Optional[Tuple[str, str]]: HDX site username and password or None """ site = self.data[self.hdx_site] username = site.get('username...
[ "Return", "HDX", "site", "username", "and", "password" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L244-L258
[ "def", "_get_credentials", "(", "self", ")", ":", "# type: () -> Optional[Tuple[str, str]]", "site", "=", "self", ".", "data", "[", "self", ".", "hdx_site", "]", "username", "=", "site", ".", "get", "(", "'username'", ")", "if", "username", ":", "return", "b...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration.call_remoteckan
Calls the remote CKAN Args: *args: Arguments to pass to remote CKAN call_action method **kwargs: Keyword arguments to pass to remote CKAN call_action method Returns: Dict: The response from the remote CKAN call_action method
src/hdx/hdx_configuration.py
def call_remoteckan(self, *args, **kwargs): # type: (Any, Any) -> Dict """ Calls the remote CKAN Args: *args: Arguments to pass to remote CKAN call_action method **kwargs: Keyword arguments to pass to remote CKAN call_action method Returns: D...
def call_remoteckan(self, *args, **kwargs): # type: (Any, Any) -> Dict """ Calls the remote CKAN Args: *args: Arguments to pass to remote CKAN call_action method **kwargs: Keyword arguments to pass to remote CKAN call_action method Returns: D...
[ "Calls", "the", "remote", "CKAN" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L286-L306
[ "def", "call_remoteckan", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# type: (Any, Any) -> Dict", "requests_kwargs", "=", "kwargs", ".", "get", "(", "'requests_kwargs'", ",", "dict", "(", ")", ")", "credentials", "=", "self", ".", "...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration._environment_variables
Overwrite keyword arguments with environment variables Args: **kwargs: See below hdx_url (str): HDX url to use. Overrides hdx_site. hdx_site (str): HDX site to use eg. prod, test. Defaults to test. hdx_key (str): Your HDX key. Ignored if hdx_read_only = True. ...
src/hdx/hdx_configuration.py
def _environment_variables(**kwargs): # type: (Any) -> Any """ Overwrite keyword arguments with environment variables Args: **kwargs: See below hdx_url (str): HDX url to use. Overrides hdx_site. hdx_site (str): HDX site to use eg. prod, test. Defaults...
def _environment_variables(**kwargs): # type: (Any) -> Any """ Overwrite keyword arguments with environment variables Args: **kwargs: See below hdx_url (str): HDX url to use. Overrides hdx_site. hdx_site (str): HDX site to use eg. prod, test. Defaults...
[ "Overwrite", "keyword", "arguments", "with", "environment", "variables" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L309-L335
[ "def", "_environment_variables", "(", "*", "*", "kwargs", ")", ":", "# type: (Any) -> Any", "hdx_key", "=", "os", ".", "getenv", "(", "'HDX_KEY'", ")", "if", "hdx_key", "is", "not", "None", ":", "kwargs", "[", "'hdx_key'", "]", "=", "hdx_key", "hdx_url", "...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration.create_remoteckan
Create remote CKAN instance from configuration Args: site_url (str): Site url. user_agent (Optional[str]): User agent string. HDXPythonLibrary/X.X.X- is prefixed. user_agent_config_yaml (Optional[str]): Path to YAML user agent configuration. Ignored if user_agent supplied. D...
src/hdx/hdx_configuration.py
def create_remoteckan(cls, site_url, user_agent=None, user_agent_config_yaml=None, user_agent_lookup=None, session=None, **kwargs): # type: (str, Optional[str], Optional[str], Optional[str], requests.Session, Any) -> ckanapi.RemoteCKAN """ Create remote CKAN instance fr...
def create_remoteckan(cls, site_url, user_agent=None, user_agent_config_yaml=None, user_agent_lookup=None, session=None, **kwargs): # type: (str, Optional[str], Optional[str], Optional[str], requests.Session, Any) -> ckanapi.RemoteCKAN """ Create remote CKAN instance fr...
[ "Create", "remote", "CKAN", "instance", "from", "configuration" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L338-L365
[ "def", "create_remoteckan", "(", "cls", ",", "site_url", ",", "user_agent", "=", "None", ",", "user_agent_config_yaml", "=", "None", ",", "user_agent_lookup", "=", "None", ",", "session", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, Optional[...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration.setup_remoteckan
Set up remote CKAN from provided CKAN or by creating from configuration Args: remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up from configuration. Returns: None
src/hdx/hdx_configuration.py
def setup_remoteckan(self, remoteckan=None, **kwargs): # type: (Optional[ckanapi.RemoteCKAN], Any) -> None """ Set up remote CKAN from provided CKAN or by creating from configuration Args: remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up f...
def setup_remoteckan(self, remoteckan=None, **kwargs): # type: (Optional[ckanapi.RemoteCKAN], Any) -> None """ Set up remote CKAN from provided CKAN or by creating from configuration Args: remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up f...
[ "Set", "up", "remote", "CKAN", "from", "provided", "CKAN", "or", "by", "creating", "from", "configuration" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L367-L383
[ "def", "setup_remoteckan", "(", "self", ",", "remoteckan", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[ckanapi.RemoteCKAN], Any) -> None", "if", "remoteckan", "is", "None", ":", "self", ".", "_remoteckan", "=", "self", ".", "create_remotecka...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration.setup
Set up the HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from passed arguments. **kwargs: See below user_agent (str): User agent string. HDXPythonLibrary/X.X.X- is prefixed. Must be supplied if remoteckan ...
src/hdx/hdx_configuration.py
def setup(cls, configuration=None, **kwargs): # type: (Optional['Configuration'], Any) -> None """ Set up the HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from passed arguments. **kwargs: See ...
def setup(cls, configuration=None, **kwargs): # type: (Optional['Configuration'], Any) -> None """ Set up the HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from passed arguments. **kwargs: See ...
[ "Set", "up", "the", "HDX", "configuration" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L436-L468
[ "def", "setup", "(", "cls", ",", "configuration", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional['Configuration'], Any) -> None", "if", "configuration", "is", "None", ":", "cls", ".", "_configuration", "=", "Configuration", "(", "*", "*", "...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration._create
Create HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from passed arguments. remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults to setting one up from configuration. **kwargs: See below ...
src/hdx/hdx_configuration.py
def _create(cls, configuration=None, remoteckan=None, **kwargs): # type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str """ Create HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from ...
def _create(cls, configuration=None, remoteckan=None, **kwargs): # type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str """ Create HDX configuration Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from ...
[ "Create", "HDX", "configuration" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L471-L504
[ "def", "_create", "(", "cls", ",", "configuration", "=", "None", ",", "remoteckan", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str", "kwargs", "=", "cls", ".", "_environment_variables", "(...
212440f54f73805826a16db77dbcb6033b18a313
train
Configuration.create
Create HDX configuration. Can only be called once (will raise an error if called more than once). Args: configuration (Optional[Configuration]): Configuration instance. Defaults to setting one up from passed arguments. remoteckan (Optional[ckanapi.RemoteCKAN]): CKAN instance. Defaults t...
src/hdx/hdx_configuration.py
def create(cls, configuration=None, remoteckan=None, **kwargs): # type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str """ Create HDX configuration. Can only be called once (will raise an error if called more than once). Args: configuration (Optional[C...
def create(cls, configuration=None, remoteckan=None, **kwargs): # type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str """ Create HDX configuration. Can only be called once (will raise an error if called more than once). Args: configuration (Optional[C...
[ "Create", "HDX", "configuration", ".", "Can", "only", "be", "called", "once", "(", "will", "raise", "an", "error", "if", "called", "more", "than", "once", ")", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_configuration.py#L507-L539
[ "def", "create", "(", "cls", ",", "configuration", "=", "None", ",", "remoteckan", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional['Configuration'], Optional[ckanapi.RemoteCKAN], Any) -> str", "if", "cls", ".", "_configuration", "is", "not", "None...
212440f54f73805826a16db77dbcb6033b18a313
train
kwargs_to_variable_assignment
Convert a dictionary into a string with assignments Each assignment is constructed based on: key assignment_operator value_representation(value) statement_separator, where key and value are the key and value of the dictionary. Moreover one can seprate the assignment statements by new lines. Parame...
run_jnb/util.py
def kwargs_to_variable_assignment(kwargs: dict, value_representation=repr, assignment_operator: str = ' = ', statement_separator: str = '\n', statement_per_line: bool = False) -> str: """ Convert a dictionary i...
def kwargs_to_variable_assignment(kwargs: dict, value_representation=repr, assignment_operator: str = ' = ', statement_separator: str = '\n', statement_per_line: bool = False) -> str: """ Convert a dictionary i...
[ "Convert", "a", "dictionary", "into", "a", "string", "with", "assignments" ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L12-L56
[ "def", "kwargs_to_variable_assignment", "(", "kwargs", ":", "dict", ",", "value_representation", "=", "repr", ",", "assignment_operator", ":", "str", "=", "' = '", ",", "statement_separator", ":", "str", "=", "'\\n'", ",", "statement_per_line", ":", "bool", "=", ...
55e63de33b0643161948864d2c1ec998f02815bf
train
decode_json
Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters ---------- json_input : str, None, optional input json ob...
run_jnb/util.py
def decode_json(json_input: Union[str, None] = None): """ Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters ---...
def decode_json(json_input: Union[str, None] = None): """ Simple wrapper of json.load and json.loads. If json_input is None the output is an empty dictionary. If the input is a string that ends in .json it is decoded using json.load. Otherwise it is decoded using json.loads. Parameters ---...
[ "Simple", "wrapper", "of", "json", ".", "load", "and", "json", ".", "loads", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L69-L104
[ "def", "decode_json", "(", "json_input", ":", "Union", "[", "str", ",", "None", "]", "=", "None", ")", ":", "if", "json_input", "is", "None", ":", "return", "{", "}", "else", ":", "if", "isinstance", "(", "json_input", ",", "str", ")", "is", "False",...
55e63de33b0643161948864d2c1ec998f02815bf
train
is_jsonable
Check if an object is jsonable. An object is jsonable if it is json serialisable and by loading its json representation the same object is recovered. Parameters ---------- obj : Python object Returns ------- bool >>> is_jsonable([1,2,3]) True >>> is_jsonable((1,2,3)) ...
run_jnb/util.py
def is_jsonable(obj) -> bool: """ Check if an object is jsonable. An object is jsonable if it is json serialisable and by loading its json representation the same object is recovered. Parameters ---------- obj : Python object Returns ------- bool >>> is_jsonable([1,2,...
def is_jsonable(obj) -> bool: """ Check if an object is jsonable. An object is jsonable if it is json serialisable and by loading its json representation the same object is recovered. Parameters ---------- obj : Python object Returns ------- bool >>> is_jsonable([1,2,...
[ "Check", "if", "an", "object", "is", "jsonable", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L107-L133
[ "def", "is_jsonable", "(", "obj", ")", "->", "bool", ":", "try", ":", "return", "obj", "==", "json", ".", "loads", "(", "json", ".", "dumps", "(", "obj", ")", ")", "except", "TypeError", ":", "return", "False", "except", ":", "raise" ]
55e63de33b0643161948864d2c1ec998f02815bf
train
is_literal_eval
Check if an expresion can be literal_eval. ---------- node_or_string : Input Returns ------- tuple (bool,python object) If it can be literal_eval the python object is returned. Otherwise None it is returned. >>> is_literal_eval('[1,2,3]') (True, ...
run_jnb/util.py
def is_literal_eval(node_or_string) -> tuple: """ Check if an expresion can be literal_eval. ---------- node_or_string : Input Returns ------- tuple (bool,python object) If it can be literal_eval the python object is returned. Otherwise None it is returne...
def is_literal_eval(node_or_string) -> tuple: """ Check if an expresion can be literal_eval. ---------- node_or_string : Input Returns ------- tuple (bool,python object) If it can be literal_eval the python object is returned. Otherwise None it is returne...
[ "Check", "if", "an", "expresion", "can", "be", "literal_eval", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L136-L161
[ "def", "is_literal_eval", "(", "node_or_string", ")", "->", "tuple", ":", "try", ":", "obj", "=", "ast", ".", "literal_eval", "(", "node_or_string", ")", "return", "(", "True", ",", "obj", ")", "except", ":", "return", "(", "False", ",", "None", ")" ]
55e63de33b0643161948864d2c1ec998f02815bf
train
find_duplicates
Return the duplicates in a list. The function relies on https://stackoverflow.com/questions/9835762/find-and-list-duplicates-in-a-list . Parameters ---------- l : list Name Returns ------- set Duplicated values >>> find_duplicates([1,2,3]) set() >>> find_du...
run_jnb/util.py
def find_duplicates(l: list) -> set: """ Return the duplicates in a list. The function relies on https://stackoverflow.com/questions/9835762/find-and-list-duplicates-in-a-list . Parameters ---------- l : list Name Returns ------- set Duplicated values >>> f...
def find_duplicates(l: list) -> set: """ Return the duplicates in a list. The function relies on https://stackoverflow.com/questions/9835762/find-and-list-duplicates-in-a-list . Parameters ---------- l : list Name Returns ------- set Duplicated values >>> f...
[ "Return", "the", "duplicates", "in", "a", "list", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L164-L185
[ "def", "find_duplicates", "(", "l", ":", "list", ")", "->", "set", ":", "return", "set", "(", "[", "x", "for", "x", "in", "l", "if", "l", ".", "count", "(", "x", ")", ">", "1", "]", ")" ]
55e63de33b0643161948864d2c1ec998f02815bf
train
sort_dict
Sort a dictionary by key or value. The function relies on https://docs.python.org/3/library/collections.html#collections.OrderedDict . The dulicated are determined based on https://stackoverflow.com/questions/9835762/find-and-list-duplicates-in-a-list . Parameters ---------- d : dict ...
run_jnb/util.py
def sort_dict(d: dict, by: str = 'key', allow_duplicates: bool = True) -> collections.OrderedDict: """ Sort a dictionary by key or value. The function relies on https://docs.python.org/3/library/collections.html#collections.OrderedDict . The dulicated are determined based on https...
def sort_dict(d: dict, by: str = 'key', allow_duplicates: bool = True) -> collections.OrderedDict: """ Sort a dictionary by key or value. The function relies on https://docs.python.org/3/library/collections.html#collections.OrderedDict . The dulicated are determined based on https...
[ "Sort", "a", "dictionary", "by", "key", "or", "value", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L188-L236
[ "def", "sort_dict", "(", "d", ":", "dict", ",", "by", ":", "str", "=", "'key'", ",", "allow_duplicates", ":", "bool", "=", "True", ")", "->", "collections", ".", "OrderedDict", ":", "if", "by", "==", "'key'", ":", "i", "=", "0", "elif", "by", "==",...
55e63de33b0643161948864d2c1ec998f02815bf
train
group_dict_by_value
Group a dictionary by values. Parameters ---------- d : dict Input dictionary Returns ------- dict Output dictionary. The keys are the values of the initial dictionary and the values ae given by a list of keys corresponding to the value. >>> group_dict_by_value({2...
run_jnb/util.py
def group_dict_by_value(d: dict) -> dict: """ Group a dictionary by values. Parameters ---------- d : dict Input dictionary Returns ------- dict Output dictionary. The keys are the values of the initial dictionary and the values ae given by a list of keys corre...
def group_dict_by_value(d: dict) -> dict: """ Group a dictionary by values. Parameters ---------- d : dict Input dictionary Returns ------- dict Output dictionary. The keys are the values of the initial dictionary and the values ae given by a list of keys corre...
[ "Group", "a", "dictionary", "by", "values", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L239-L266
[ "def", "group_dict_by_value", "(", "d", ":", "dict", ")", "->", "dict", ":", "d_out", "=", "{", "}", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "v", "in", "d_out", ":", "d_out", "[", "v", "]", ".", "append", "(", "k",...
55e63de33b0643161948864d2c1ec998f02815bf
train
variable_status
Find the possible parameters and "global" variables from a python code. This is achieved by parsing the abstract syntax tree. Parameters ---------- code : str Input code as string. exclude_variable : set, None, optional Variable to exclude. jsonable_parameter: bool, True, optio...
run_jnb/util.py
def variable_status(code: str, exclude_variable: Union[set, None] = None, jsonable_parameter: bool = True) -> tuple: """ Find the possible parameters and "global" variables from a python code. This is achieved by parsing the abstract syntax tree. Parameters ...
def variable_status(code: str, exclude_variable: Union[set, None] = None, jsonable_parameter: bool = True) -> tuple: """ Find the possible parameters and "global" variables from a python code. This is achieved by parsing the abstract syntax tree. Parameters ...
[ "Find", "the", "possible", "parameters", "and", "global", "variables", "from", "a", "python", "code", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L279-L403
[ "def", "variable_status", "(", "code", ":", "str", ",", "exclude_variable", ":", "Union", "[", "set", ",", "None", "]", "=", "None", ",", "jsonable_parameter", ":", "bool", "=", "True", ")", "->", "tuple", ":", "if", "exclude_variable", "is", "None", ":"...
55e63de33b0643161948864d2c1ec998f02815bf
train
increment_name
Increment the name where the incremental part is given by parameters. Parameters ---------- name : str, nbformat.notebooknode.NotebookNode Name start_marker : str The marker used before the incremental end_marker : str The marker after the incrementa Returns -------...
run_jnb/util.py
def increment_name(name: str, start_marker: str = " (", end_marker: str = ")") -> str: """ Increment the name where the incremental part is given by parameters. Parameters ---------- name : str, nbformat.notebooknode.NotebookNode Name start_marker : str The ma...
def increment_name(name: str, start_marker: str = " (", end_marker: str = ")") -> str: """ Increment the name where the incremental part is given by parameters. Parameters ---------- name : str, nbformat.notebooknode.NotebookNode Name start_marker : str The ma...
[ "Increment", "the", "name", "where", "the", "incremental", "part", "is", "given", "by", "parameters", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/util.py#L406-L455
[ "def", "increment_name", "(", "name", ":", "str", ",", "start_marker", ":", "str", "=", "\" (\"", ",", "end_marker", ":", "str", "=", "\")\"", ")", "->", "str", ":", "if", "start_marker", "==", "''", ":", "raise", "ValueError", "(", "\"start_marker can not...
55e63de33b0643161948864d2c1ec998f02815bf
train
ResourceView.read_from_hdx
Reads the resource view given by identifier from HDX and returns ResourceView object Args: identifier (str): Identifier of resource view configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: Optional[ResourceView]: Re...
src/hdx/data/resource_view.py
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['ResourceView'] """Reads the resource view given by identifier from HDX and returns ResourceView object Args: identifier (str): Identifier of resource view configuration...
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['ResourceView'] """Reads the resource view given by identifier from HDX and returns ResourceView object Args: identifier (str): Identifier of resource view configuration...
[ "Reads", "the", "resource", "view", "given", "by", "identifier", "from", "HDX", "and", "returns", "ResourceView", "object" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L71-L87
[ "def", "read_from_hdx", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> Optional['ResourceView']", "resourceview", "=", "ResourceView", "(", "configuration", "=", "configuration", ")", "result", "=", "resourceview",...
212440f54f73805826a16db77dbcb6033b18a313
train
ResourceView.get_all_for_resource
Read all resource views for a resource given by identifier from HDX and returns list of ResourceView objects Args: identifier (str): Identifier of resource configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: List[Re...
src/hdx/data/resource_view.py
def get_all_for_resource(identifier, configuration=None): # type: (str, Optional[Configuration]) -> List['ResourceView'] """Read all resource views for a resource given by identifier from HDX and returns list of ResourceView objects Args: identifier (str): Identifier of resource ...
def get_all_for_resource(identifier, configuration=None): # type: (str, Optional[Configuration]) -> List['ResourceView'] """Read all resource views for a resource given by identifier from HDX and returns list of ResourceView objects Args: identifier (str): Identifier of resource ...
[ "Read", "all", "resource", "views", "for", "a", "resource", "given", "by", "identifier", "from", "HDX", "and", "returns", "list", "of", "ResourceView", "objects" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L90-L109
[ "def", "get_all_for_resource", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> List['ResourceView']", "resourceview", "=", "ResourceView", "(", "configuration", "=", "configuration", ")", "success", ",", "result", ...
212440f54f73805826a16db77dbcb6033b18a313
train
ResourceView._update_resource_view
Check if resource view exists in HDX and if so, update resource view Returns: bool: True if updated and False if not
src/hdx/data/resource_view.py
def _update_resource_view(self, log=False): # type: () -> bool """Check if resource view exists in HDX and if so, update resource view Returns: bool: True if updated and False if not """ update = False if 'id' in self.data and self._load_from_hdx('resource vi...
def _update_resource_view(self, log=False): # type: () -> bool """Check if resource view exists in HDX and if so, update resource view Returns: bool: True if updated and False if not """ update = False if 'id' in self.data and self._load_from_hdx('resource vi...
[ "Check", "if", "resource", "view", "exists", "in", "HDX", "and", "if", "so", "update", "resource", "view" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L124-L147
[ "def", "_update_resource_view", "(", "self", ",", "log", "=", "False", ")", ":", "# type: () -> bool", "update", "=", "False", "if", "'id'", "in", "self", ".", "data", "and", "self", ".", "_load_from_hdx", "(", "'resource view'", ",", "self", ".", "data", ...
212440f54f73805826a16db77dbcb6033b18a313
train
ResourceView.create_in_hdx
Check if resource view exists in HDX and if so, update it, otherwise create resource view Returns: None
src/hdx/data/resource_view.py
def create_in_hdx(self): # type: () -> None """Check if resource view exists in HDX and if so, update it, otherwise create resource view Returns: None """ self.check_required_fields() if not self._update_resource_view(log=True): self._save_to_hdx(...
def create_in_hdx(self): # type: () -> None """Check if resource view exists in HDX and if so, update it, otherwise create resource view Returns: None """ self.check_required_fields() if not self._update_resource_view(log=True): self._save_to_hdx(...
[ "Check", "if", "resource", "view", "exists", "in", "HDX", "and", "if", "so", "update", "it", "otherwise", "create", "resource", "view" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L159-L168
[ "def", "create_in_hdx", "(", "self", ")", ":", "# type: () -> None", "self", ".", "check_required_fields", "(", ")", "if", "not", "self", ".", "_update_resource_view", "(", "log", "=", "True", ")", ":", "self", ".", "_save_to_hdx", "(", "'create'", ",", "'ti...
212440f54f73805826a16db77dbcb6033b18a313
train
ResourceView.copy
Copies all fields except id, resource_id and package_id from another resource view. Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ResourceView object or a dictionary Returns: None
src/hdx/data/resource_view.py
def copy(self, resource_view): # type: (Union[ResourceView,Dict,str]) -> None """Copies all fields except id, resource_id and package_id from another resource view. Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ...
def copy(self, resource_view): # type: (Union[ResourceView,Dict,str]) -> None """Copies all fields except id, resource_id and package_id from another resource view. Args: resource_view (Union[ResourceView,Dict,str]): Either a resource view id or resource view metadata either from a ...
[ "Copies", "all", "fields", "except", "id", "resource_id", "and", "package_id", "from", "another", "resource", "view", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/resource_view.py#L179-L197
[ "def", "copy", "(", "self", ",", "resource_view", ")", ":", "# type: (Union[ResourceView,Dict,str]) -> None", "if", "isinstance", "(", "resource_view", ",", "str", ")", ":", "if", "is_valid_uuid", "(", "resource_view", ")", "is", "False", ":", "raise", "HDXError",...
212440f54f73805826a16db77dbcb6033b18a313
train
Tags.tagscleanupdicts
Get tags cleanup dictionaries Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. url (Optional[str]): Url of tags cleanup spreadsheet. Defaults to None (internal configuration parameter). keycolumn (int): Column number of tag ...
src/hdx/hdx_tagscleanup.py
def tagscleanupdicts(configuration=None, url=None, keycolumn=5, failchained=True): # type: (Optional[Configuration], Optional[str], int, bool) -> Tuple[Dict,List] """ Get tags cleanup dictionaries Args: configuration (Optional[Configuration]): HDX configuration. Defaults to ...
def tagscleanupdicts(configuration=None, url=None, keycolumn=5, failchained=True): # type: (Optional[Configuration], Optional[str], int, bool) -> Tuple[Dict,List] """ Get tags cleanup dictionaries Args: configuration (Optional[Configuration]): HDX configuration. Defaults to ...
[ "Get", "tags", "cleanup", "dictionaries" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/hdx_tagscleanup.py#L24-L71
[ "def", "tagscleanupdicts", "(", "configuration", "=", "None", ",", "url", "=", "None", ",", "keycolumn", "=", "5", ",", "failchained", "=", "True", ")", ":", "# type: (Optional[Configuration], Optional[str], int, bool) -> Tuple[Dict,List]", "if", "not", "Tags", ".", ...
212440f54f73805826a16db77dbcb6033b18a313
train
User.read_from_hdx
Reads the user given by identifier from HDX and returns User object Args: identifier (str): Identifier of user configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: Optional[User]: User object if successful read, None...
src/hdx/data/user.py
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['User'] """Reads the user given by identifier from HDX and returns User object Args: identifier (str): Identifier of user configuration (Optional[Configuration]): HDX co...
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['User'] """Reads the user given by identifier from HDX and returns User object Args: identifier (str): Identifier of user configuration (Optional[Configuration]): HDX co...
[ "Reads", "the", "user", "given", "by", "identifier", "from", "HDX", "and", "returns", "User", "object" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L70-L86
[ "def", "read_from_hdx", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> Optional['User']", "user", "=", "User", "(", "configuration", "=", "configuration", ")", "result", "=", "user", ".", "_load_from_hdx", "(...
212440f54f73805826a16db77dbcb6033b18a313
train
User.update_in_hdx
Check if user exists in HDX and if so, update user Returns: None
src/hdx/data/user.py
def update_in_hdx(self): # type: () -> None """Check if user exists in HDX and if so, update user Returns: None """ capacity = self.data.get('capacity') if capacity is not None: del self.data['capacity'] # remove capacity (which comes from users ...
def update_in_hdx(self): # type: () -> None """Check if user exists in HDX and if so, update user Returns: None """ capacity = self.data.get('capacity') if capacity is not None: del self.data['capacity'] # remove capacity (which comes from users ...
[ "Check", "if", "user", "exists", "in", "HDX", "and", "if", "so", "update", "user" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L101-L113
[ "def", "update_in_hdx", "(", "self", ")", ":", "# type: () -> None", "capacity", "=", "self", ".", "data", ".", "get", "(", "'capacity'", ")", "if", "capacity", "is", "not", "None", ":", "del", "self", ".", "data", "[", "'capacity'", "]", "# remove capacit...
212440f54f73805826a16db77dbcb6033b18a313
train
User.create_in_hdx
Check if user exists in HDX and if so, update it, otherwise create user Returns: None
src/hdx/data/user.py
def create_in_hdx(self): # type: () -> None """Check if user exists in HDX and if so, update it, otherwise create user Returns: None """ capacity = self.data.get('capacity') if capacity is not None: del self.data['capacity'] self._create_i...
def create_in_hdx(self): # type: () -> None """Check if user exists in HDX and if so, update it, otherwise create user Returns: None """ capacity = self.data.get('capacity') if capacity is not None: del self.data['capacity'] self._create_i...
[ "Check", "if", "user", "exists", "in", "HDX", "and", "if", "so", "update", "it", "otherwise", "create", "user" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L115-L127
[ "def", "create_in_hdx", "(", "self", ")", ":", "# type: () -> None", "capacity", "=", "self", ".", "data", ".", "get", "(", "'capacity'", ")", "if", "capacity", "is", "not", "None", ":", "del", "self", ".", "data", "[", "'capacity'", "]", "self", ".", ...
212440f54f73805826a16db77dbcb6033b18a313
train
User.email
Emails a user. Args: subject (str): Email subject text_body (str): Plain text email body html_body (str): HTML email body sender (Optional[str]): Email sender. Defaults to SMTP username. **kwargs: See below mail_options (List): Mail option...
src/hdx/data/user.py
def email(self, subject, text_body, html_body=None, sender=None, **kwargs): # type: (str, str, Optional[str], Optional[str], Any) -> None """Emails a user. Args: subject (str): Email subject text_body (str): Plain text email body html_body (str): HTML email b...
def email(self, subject, text_body, html_body=None, sender=None, **kwargs): # type: (str, str, Optional[str], Optional[str], Any) -> None """Emails a user. Args: subject (str): Email subject text_body (str): Plain text email body html_body (str): HTML email b...
[ "Emails", "a", "user", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L138-L155
[ "def", "email", "(", "self", ",", "subject", ",", "text_body", ",", "html_body", "=", "None", ",", "sender", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (str, str, Optional[str], Optional[str], Any) -> None", "self", ".", "configuration", ".", "emai...
212440f54f73805826a16db77dbcb6033b18a313
train
User.get_all_users
Get all users in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below q (str): Restrict to names containing a string. Defaults to all users. order_by (str): Field by which to sort - any user f...
src/hdx/data/user.py
def get_all_users(configuration=None, **kwargs): # type: (Optional[Configuration], Any) -> List['User'] """Get all users in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below q (str): Re...
def get_all_users(configuration=None, **kwargs): # type: (Optional[Configuration], Any) -> List['User'] """Get all users in HDX Args: configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. **kwargs: See below q (str): Re...
[ "Get", "all", "users", "in", "HDX" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L158-L181
[ "def", "get_all_users", "(", "configuration", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (Optional[Configuration], Any) -> List['User']", "user", "=", "User", "(", "configuration", "=", "configuration", ")", "user", "[", "'id'", "]", "=", "'all users...
212440f54f73805826a16db77dbcb6033b18a313
train
User.email_users
Email a list of users Args: users (List[User]): List of users subject (str): Email subject text_body (str): Plain text email body html_body (str): HTML email body sender (Optional[str]): Email sender. Defaults to SMTP username. configurati...
src/hdx/data/user.py
def email_users(users, subject, text_body, html_body=None, sender=None, configuration=None, **kwargs): # type: (List['User'], str, str, Optional[str], Optional[str], Optional[Configuration], Any) -> None """Email a list of users Args: users (List[User]): List of users su...
def email_users(users, subject, text_body, html_body=None, sender=None, configuration=None, **kwargs): # type: (List['User'], str, str, Optional[str], Optional[str], Optional[Configuration], Any) -> None """Email a list of users Args: users (List[User]): List of users su...
[ "Email", "a", "list", "of", "users" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L184-L209
[ "def", "email_users", "(", "users", ",", "subject", ",", "text_body", ",", "html_body", "=", "None", ",", "sender", "=", "None", ",", "configuration", "=", "None", ",", "*", "*", "kwargs", ")", ":", "# type: (List['User'], str, str, Optional[str], Optional[str], O...
212440f54f73805826a16db77dbcb6033b18a313
train
User.get_organizations
Get organizations in HDX that this user is a member of. Args: permission (str): Permission to check for. Defaults to 'read'. Returns: List[Organization]: List of organizations in HDX that this user is a member of
src/hdx/data/user.py
def get_organizations(self, permission='read'): # type: (str) -> List['Organization'] """Get organizations in HDX that this user is a member of. Args: permission (str): Permission to check for. Defaults to 'read'. Returns: List[Organization]: List of organizatio...
def get_organizations(self, permission='read'): # type: (str) -> List['Organization'] """Get organizations in HDX that this user is a member of. Args: permission (str): Permission to check for. Defaults to 'read'. Returns: List[Organization]: List of organizatio...
[ "Get", "organizations", "in", "HDX", "that", "this", "user", "is", "a", "member", "of", "." ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/user.py#L211-L228
[ "def", "get_organizations", "(", "self", ",", "permission", "=", "'read'", ")", ":", "# type: (str) -> List['Organization']", "success", ",", "result", "=", "self", ".", "_read_from_hdx", "(", "'user'", ",", "self", ".", "data", "[", "'name'", "]", ",", "'id'"...
212440f54f73805826a16db77dbcb6033b18a313
train
facade
Facade to simplify project setup that calls project main function Args: projectmainfn ((None) -> None): main function of project **kwargs: configuration parameters to pass to HDX Configuration class Returns: None
src/hdx/facades/simple.py
def facade(projectmainfn, **kwargs): # (Callable[[None], None], Any) -> None """Facade to simplify project setup that calls project main function Args: projectmainfn ((None) -> None): main function of project **kwargs: configuration parameters to pass to HDX Configuration class Returns...
def facade(projectmainfn, **kwargs): # (Callable[[None], None], Any) -> None """Facade to simplify project setup that calls project main function Args: projectmainfn ((None) -> None): main function of project **kwargs: configuration parameters to pass to HDX Configuration class Returns...
[ "Facade", "to", "simplify", "project", "setup", "that", "calls", "project", "main", "function" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/facades/simple.py#L15-L38
[ "def", "facade", "(", "projectmainfn", ",", "*", "*", "kwargs", ")", ":", "# (Callable[[None], None], Any) -> None", "#", "# Setting up configuration", "#", "site_url", "=", "Configuration", ".", "_create", "(", "*", "*", "kwargs", ")", "logger", ".", "info", "(...
212440f54f73805826a16db77dbcb6033b18a313
train
get_lint_config
Tries loading the config from the given path. If no path is specified, the default config path is tried, and if that is not specified, we the default config is returned.
pymarkdownlint/cli.py
def get_lint_config(config_path=None): """ Tries loading the config from the given path. If no path is specified, the default config path is tried, and if that is not specified, we the default config is returned. """ # config path specified if config_path: config = LintConfig.load_from_file(conf...
def get_lint_config(config_path=None): """ Tries loading the config from the given path. If no path is specified, the default config path is tried, and if that is not specified, we the default config is returned. """ # config path specified if config_path: config = LintConfig.load_from_file(conf...
[ "Tries", "loading", "the", "config", "from", "the", "given", "path", ".", "If", "no", "path", "is", "specified", "the", "default", "config", "path", "is", "tried", "and", "if", "that", "is", "not", "specified", "we", "the", "default", "config", "is", "re...
jorisroovers/pymarkdownlint
python
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/cli.py#L17-L32
[ "def", "get_lint_config", "(", "config_path", "=", "None", ")", ":", "# config path specified", "if", "config_path", ":", "config", "=", "LintConfig", ".", "load_from_file", "(", "config_path", ")", "click", ".", "echo", "(", "\"Using config from {0}\"", ".", "for...
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65
train
cli
Markdown lint tool, checks your markdown for styling issues
pymarkdownlint/cli.py
def cli(list_files, config, ignore, path): """ Markdown lint tool, checks your markdown for styling issues """ files = MarkdownFileFinder.find_files(path) if list_files: echo_files(files) lint_config = get_lint_config(config) lint_config.apply_on_csv_string(ignore, lint_config.disable_rule)...
def cli(list_files, config, ignore, path): """ Markdown lint tool, checks your markdown for styling issues """ files = MarkdownFileFinder.find_files(path) if list_files: echo_files(files) lint_config = get_lint_config(config) lint_config.apply_on_csv_string(ignore, lint_config.disable_rule)...
[ "Markdown", "lint", "tool", "checks", "your", "markdown", "for", "styling", "issues" ]
jorisroovers/pymarkdownlint
python
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/cli.py#L42-L53
[ "def", "cli", "(", "list_files", ",", "config", ",", "ignore", ",", "path", ")", ":", "files", "=", "MarkdownFileFinder", ".", "find_files", "(", "path", ")", "if", "list_files", ":", "echo_files", "(", "files", ")", "lint_config", "=", "get_lint_config", ...
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65
train
main
Main function
automated_ebs_snapshots/__init__.py
def main(): """ Main function """ # Read configuration from the config file if present, else fall back to # command line options if args.config: config = config_file_parser.get_configuration(args.config) access_key_id = config['access-key-id'] secret_access_key = config['secret-a...
def main(): """ Main function """ # Read configuration from the config file if present, else fall back to # command line options if args.config: config = config_file_parser.get_configuration(args.config) access_key_id = config['access-key-id'] secret_access_key = config['secret-a...
[ "Main", "function" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/__init__.py#L109-L171
[ "def", "main", "(", ")", ":", "# Read configuration from the config file if present, else fall back to", "# command line options", "if", "args", ".", "config", ":", "config", "=", "config_file_parser", ".", "get_configuration", "(", "args", ".", "config", ")", "access_key...
9595bc49d458f6ffb93430722757d2284e878fab
train
AutoEBSDaemon.run
Run the daemon :type check_interval: int :param check_interval: Delay in seconds between checks
automated_ebs_snapshots/__init__.py
def run(self, check_interval=300): """ Run the daemon :type check_interval: int :param check_interval: Delay in seconds between checks """ while True: # Read configuration from the config file if present, else fall # back to command line options ...
def run(self, check_interval=300): """ Run the daemon :type check_interval: int :param check_interval: Delay in seconds between checks """ while True: # Read configuration from the config file if present, else fall # back to command line options ...
[ "Run", "the", "daemon" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/__init__.py#L79-L106
[ "def", "run", "(", "self", ",", "check_interval", "=", "300", ")", ":", "while", "True", ":", "# Read configuration from the config file if present, else fall", "# back to command line options", "if", "args", ".", "config", ":", "config", "=", "config_file_parser", ".",...
9595bc49d458f6ffb93430722757d2284e878fab
train
MarkdownLinter._apply_line_rules
Iterates over the lines in a given markdown string and applies all the enabled line rules to each line
pymarkdownlint/lint.py
def _apply_line_rules(self, markdown_string): """ Iterates over the lines in a given markdown string and applies all the enabled line rules to each line """ all_violations = [] lines = markdown_string.split("\n") line_rules = self.line_rules line_nr = 1 ignoring = False ...
def _apply_line_rules(self, markdown_string): """ Iterates over the lines in a given markdown string and applies all the enabled line rules to each line """ all_violations = [] lines = markdown_string.split("\n") line_rules = self.line_rules line_nr = 1 ignoring = False ...
[ "Iterates", "over", "the", "lines", "in", "a", "given", "markdown", "string", "and", "applies", "all", "the", "enabled", "line", "rules", "to", "each", "line" ]
jorisroovers/pymarkdownlint
python
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/lint.py#L13-L35
[ "def", "_apply_line_rules", "(", "self", ",", "markdown_string", ")", ":", "all_violations", "=", "[", "]", "lines", "=", "markdown_string", ".", "split", "(", "\"\\n\"", ")", "line_rules", "=", "self", ".", "line_rules", "line_nr", "=", "1", "ignoring", "="...
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65
train
MarkdownLinter.lint_files
Lints a list of files. :param files: list of files to lint :return: a list of violations found in the files
pymarkdownlint/lint.py
def lint_files(self, files): """ Lints a list of files. :param files: list of files to lint :return: a list of violations found in the files """ all_violations = [] for filename in files: with open(filename, 'r') as f: content = f.read() ...
def lint_files(self, files): """ Lints a list of files. :param files: list of files to lint :return: a list of violations found in the files """ all_violations = [] for filename in files: with open(filename, 'r') as f: content = f.read() ...
[ "Lints", "a", "list", "of", "files", ".", ":", "param", "files", ":", "list", "of", "files", "to", "lint", ":", "return", ":", "a", "list", "of", "violations", "found", "in", "the", "files" ]
jorisroovers/pymarkdownlint
python
https://github.com/jorisroovers/pymarkdownlint/blob/c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65/pymarkdownlint/lint.py#L42-L55
[ "def", "lint_files", "(", "self", ",", "files", ")", ":", "all_violations", "=", "[", "]", "for", "filename", "in", "files", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "f", ":", "content", "=", "f", ".", "read", "(", ")", "violati...
c1044e25e18afd78b3fda8fd9b00a4f67cfbbc65
train
StructOperation.ReadFrom
Read values from a byte stream. Args: byte_stream (bytes): byte stream. Returns: tuple[object, ...]: values copies from the byte stream. Raises: IOError: if byte stream cannot be read. OSError: if byte stream cannot be read.
dtfabric/runtime/byte_operations.py
def ReadFrom(self, byte_stream): """Read values from a byte stream. Args: byte_stream (bytes): byte stream. Returns: tuple[object, ...]: values copies from the byte stream. Raises: IOError: if byte stream cannot be read. OSError: if byte stream cannot be read. """ try:...
def ReadFrom(self, byte_stream): """Read values from a byte stream. Args: byte_stream (bytes): byte stream. Returns: tuple[object, ...]: values copies from the byte stream. Raises: IOError: if byte stream cannot be read. OSError: if byte stream cannot be read. """ try:...
[ "Read", "values", "from", "a", "byte", "stream", "." ]
libyal/dtfabric
python
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/byte_operations.py#L65-L82
[ "def", "ReadFrom", "(", "self", ",", "byte_stream", ")", ":", "try", ":", "return", "self", ".", "_struct", ".", "unpack_from", "(", "byte_stream", ")", "except", "(", "TypeError", ",", "struct", ".", "error", ")", "as", "exception", ":", "raise", "IOErr...
0d2b5719fa257f6e5c661a406737ebcf8c8db266
train
StructOperation.WriteTo
Writes values to a byte stream. Args: values (tuple[object, ...]): values to copy to the byte stream. Returns: bytes: byte stream. Raises: IOError: if byte stream cannot be written. OSError: if byte stream cannot be read.
dtfabric/runtime/byte_operations.py
def WriteTo(self, values): """Writes values to a byte stream. Args: values (tuple[object, ...]): values to copy to the byte stream. Returns: bytes: byte stream. Raises: IOError: if byte stream cannot be written. OSError: if byte stream cannot be read. """ try: re...
def WriteTo(self, values): """Writes values to a byte stream. Args: values (tuple[object, ...]): values to copy to the byte stream. Returns: bytes: byte stream. Raises: IOError: if byte stream cannot be written. OSError: if byte stream cannot be read. """ try: re...
[ "Writes", "values", "to", "a", "byte", "stream", "." ]
libyal/dtfabric
python
https://github.com/libyal/dtfabric/blob/0d2b5719fa257f6e5c661a406737ebcf8c8db266/dtfabric/runtime/byte_operations.py#L84-L101
[ "def", "WriteTo", "(", "self", ",", "values", ")", ":", "try", ":", "return", "self", ".", "_struct", ".", "pack", "(", "*", "values", ")", "except", "(", "TypeError", ",", "struct", ".", "error", ")", "as", "exception", ":", "raise", "IOError", "(",...
0d2b5719fa257f6e5c661a406737ebcf8c8db266
train
run
Ensure that we have snapshots for a given volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None
automated_ebs_snapshots/snapshot_manager.py
def run(connection): """ Ensure that we have snapshots for a given volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None """ volumes = volume_manager.get_watched_volumes(connection) for volume in volumes: _ensure_snapshot...
def run(connection): """ Ensure that we have snapshots for a given volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None """ volumes = volume_manager.get_watched_volumes(connection) for volume in volumes: _ensure_snapshot...
[ "Ensure", "that", "we", "have", "snapshots", "for", "a", "given", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/snapshot_manager.py#L13-L24
[ "def", "run", "(", "connection", ")", ":", "volumes", "=", "volume_manager", ".", "get_watched_volumes", "(", "connection", ")", "for", "volume", "in", "volumes", ":", "_ensure_snapshot", "(", "connection", ",", "volume", ")", "_remove_old_snapshots", "(", "conn...
9595bc49d458f6ffb93430722757d2284e878fab
train
_create_snapshot
Create a new snapshot :type volume: boto.ec2.volume.Volume :param volume: Volume to snapshot :returns: boto.ec2.snapshot.Snapshot -- The new snapshot
automated_ebs_snapshots/snapshot_manager.py
def _create_snapshot(volume): """ Create a new snapshot :type volume: boto.ec2.volume.Volume :param volume: Volume to snapshot :returns: boto.ec2.snapshot.Snapshot -- The new snapshot """ logger.info('Creating new snapshot for {}'.format(volume.id)) snapshot = volume.create_snapshot( ...
def _create_snapshot(volume): """ Create a new snapshot :type volume: boto.ec2.volume.Volume :param volume: Volume to snapshot :returns: boto.ec2.snapshot.Snapshot -- The new snapshot """ logger.info('Creating new snapshot for {}'.format(volume.id)) snapshot = volume.create_snapshot( ...
[ "Create", "a", "new", "snapshot" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/snapshot_manager.py#L27-L40
[ "def", "_create_snapshot", "(", "volume", ")", ":", "logger", ".", "info", "(", "'Creating new snapshot for {}'", ".", "format", "(", "volume", ".", "id", ")", ")", "snapshot", "=", "volume", ".", "create_snapshot", "(", "description", "=", "\"Automatic snapshot...
9595bc49d458f6ffb93430722757d2284e878fab
train
_ensure_snapshot
Ensure that a given volume has an appropriate snapshot :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None
automated_ebs_snapshots/snapshot_manager.py
def _ensure_snapshot(connection, volume): """ Ensure that a given volume has an appropriate snapshot :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None """ if 'Au...
def _ensure_snapshot(connection, volume): """ Ensure that a given volume has an appropriate snapshot :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None """ if 'Au...
[ "Ensure", "that", "a", "given", "volume", "has", "an", "appropriate", "snapshot" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/snapshot_manager.py#L43-L96
[ "def", "_ensure_snapshot", "(", "connection", ",", "volume", ")", ":", "if", "'AutomatedEBSSnapshots'", "not", "in", "volume", ".", "tags", ":", "logger", ".", "warning", "(", "'Missing tag AutomatedEBSSnapshots for volume {}'", ".", "format", "(", "volume", ".", ...
9595bc49d458f6ffb93430722757d2284e878fab
train
_remove_old_snapshots
Remove old snapshots :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None
automated_ebs_snapshots/snapshot_manager.py
def _remove_old_snapshots(connection, volume): """ Remove old snapshots :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None """ if 'AutomatedEBSSnapshotsRetention'...
def _remove_old_snapshots(connection, volume): """ Remove old snapshots :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: boto.ec2.volume.Volume :param volume: Volume to check :returns: None """ if 'AutomatedEBSSnapshotsRetention'...
[ "Remove", "old", "snapshots" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/snapshot_manager.py#L99-L135
[ "def", "_remove_old_snapshots", "(", "connection", ",", "volume", ")", ":", "if", "'AutomatedEBSSnapshotsRetention'", "not", "in", "volume", ".", "tags", ":", "logger", ".", "warning", "(", "'Missing tag AutomatedEBSSnapshotsRetention for volume {}'", ".", "format", "("...
9595bc49d458f6ffb93430722757d2284e878fab
train
list
List watched EBS volumes :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None
automated_ebs_snapshots/volume_manager.py
def list(connection): """ List watched EBS volumes :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None """ volumes = get_watched_volumes(connection) if not volumes: logger.info('No watched volumes found') return l...
def list(connection): """ List watched EBS volumes :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :returns: None """ volumes = get_watched_volumes(connection) if not volumes: logger.info('No watched volumes found') return l...
[ "List", "watched", "EBS", "volumes" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L24-L90
[ "def", "list", "(", "connection", ")", ":", "volumes", "=", "get_watched_volumes", "(", "connection", ")", "if", "not", "volumes", ":", "logger", ".", "info", "(", "'No watched volumes found'", ")", "return", "logger", ".", "info", "(", "'+----------------------...
9595bc49d458f6ffb93430722757d2284e878fab
train
unwatch
Remove watching of a volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :returns: bool - True if the watch was successful
automated_ebs_snapshots/volume_manager.py
def unwatch(connection, volume_id): """ Remove watching of a volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :returns: bool - True if the watch was successful """ ...
def unwatch(connection, volume_id): """ Remove watching of a volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :returns: bool - True if the watch was successful """ ...
[ "Remove", "watching", "of", "a", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L93-L110
[ "def", "unwatch", "(", "connection", ",", "volume_id", ")", ":", "try", ":", "volume", "=", "connection", ".", "get_all_volumes", "(", "volume_ids", "=", "[", "volume_id", "]", ")", "[", "0", "]", "volume", ".", "remove_tag", "(", "'AutomatedEBSSnapshots'", ...
9595bc49d458f6ffb93430722757d2284e878fab
train
watch
Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :type interval: str :param interval: Backup interval [hourly|daily|weekly|monthly|yearly] :type re...
automated_ebs_snapshots/volume_manager.py
def watch(connection, volume_id, interval='daily', retention=0): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :type interval: str :param in...
def watch(connection, volume_id, interval='daily', retention=0): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume_id: str :param volume_id: VolumeID to add to the watchlist :type interval: str :param in...
[ "Start", "watching", "a", "new", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L113-L152
[ "def", "watch", "(", "connection", ",", "volume_id", ",", "interval", "=", "'daily'", ",", "retention", "=", "0", ")", ":", "try", ":", "volume", "=", "connection", ".", "get_all_volumes", "(", "volume_ids", "=", "[", "volume_id", "]", ")", "[", "0", "...
9595bc49d458f6ffb93430722757d2284e878fab
train
get_volume_id
Get Volume ID from the given volume. Input can be volume id or its Name tag. :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: Volume ID or None if the given volume does not exist
automated_ebs_snapshots/volume_manager.py
def get_volume_id(connection, volume): """ Get Volume ID from the given volume. Input can be volume id or its Name tag. :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: Volume...
def get_volume_id(connection, volume): """ Get Volume ID from the given volume. Input can be volume id or its Name tag. :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: Volume...
[ "Get", "Volume", "ID", "from", "the", "given", "volume", ".", "Input", "can", "be", "volume", "id", "or", "its", "Name", "tag", "." ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L155-L189
[ "def", "get_volume_id", "(", "connection", ",", "volume", ")", ":", "# Regular expression to check whether input is a volume id", "volume_id_pattern", "=", "re", ".", "compile", "(", "'vol-\\w{8}'", ")", "if", "volume_id_pattern", ".", "match", "(", "volume", ")", ":"...
9595bc49d458f6ffb93430722757d2284e878fab
train
watch_from_file
Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None
automated_ebs_snapshots/volume_manager.py
def watch_from_file(connection, file_name): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None """ with open(file_name, 'r') as filehandle:...
def watch_from_file(connection, file_name): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None """ with open(file_name, 'r') as filehandle:...
[ "Start", "watching", "a", "new", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L192-L207
[ "def", "watch_from_file", "(", "connection", ",", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "'r'", ")", "as", "filehandle", ":", "for", "line", "in", "filehandle", ".", "xreadlines", "(", ")", ":", "volume", ",", "interval", ",", "ret...
9595bc49d458f6ffb93430722757d2284e878fab
train
unwatch_from_file
Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None
automated_ebs_snapshots/volume_manager.py
def unwatch_from_file(connection, file_name): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None """ with open(file_name, 'r') as filehandl...
def unwatch_from_file(connection, file_name): """ Start watching a new volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type file_name: str :param file_name: path to config file :returns: None """ with open(file_name, 'r') as filehandl...
[ "Start", "watching", "a", "new", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L210-L222
[ "def", "unwatch_from_file", "(", "connection", ",", "file_name", ")", ":", "with", "open", "(", "file_name", ",", "'r'", ")", "as", "filehandle", ":", "for", "line", "in", "filehandle", ".", "xreadlines", "(", ")", ":", "volume", ",", "interval", ",", "r...
9595bc49d458f6ffb93430722757d2284e878fab
train
list_snapshots
List all snapshots for the volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: None
automated_ebs_snapshots/volume_manager.py
def list_snapshots(connection, volume): """ List all snapshots for the volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: None """ logger.info( '+---------------...
def list_snapshots(connection, volume): """ List all snapshots for the volume :type connection: boto.ec2.connection.EC2Connection :param connection: EC2 connection object :type volume: str :param volume: Volume ID or Volume Name :returns: None """ logger.info( '+---------------...
[ "List", "all", "snapshots", "for", "the", "volume" ]
skymill/automated-ebs-snapshots
python
https://github.com/skymill/automated-ebs-snapshots/blob/9595bc49d458f6ffb93430722757d2284e878fab/automated_ebs_snapshots/volume_manager.py#L225-L266
[ "def", "list_snapshots", "(", "connection", ",", "volume", ")", ":", "logger", ".", "info", "(", "'+----------------'", "'+----------------------'", "'+---------------------------+'", ")", "logger", ".", "info", "(", "'| {snapshot:<14} '", "'| {snapshot_name:<20.20} '", "...
9595bc49d458f6ffb93430722757d2284e878fab
train
Morfologik.stem
Get stems for the words using a given parser Example: from .parsing import ListParser parser = ListParser() stemmer = Morfologik() stemmer.stem(['ja tańczę a ona śpi], parser) [ ('ja': ['ja']), ('tańczę': ['tańczyć'...
pymorfologik/morfologik.py
def stem(self, words, parser, **kwargs): """ Get stems for the words using a given parser Example: from .parsing import ListParser parser = ListParser() stemmer = Morfologik() stemmer.stem(['ja tańczę a ona śpi], parser) [ ...
def stem(self, words, parser, **kwargs): """ Get stems for the words using a given parser Example: from .parsing import ListParser parser = ListParser() stemmer = Morfologik() stemmer.stem(['ja tańczę a ona śpi], parser) [ ...
[ "Get", "stems", "for", "the", "words", "using", "a", "given", "parser" ]
dmirecki/pyMorfologik
python
https://github.com/dmirecki/pyMorfologik/blob/e4d93a82e8b4c7a108f01e0456fbeb8024df0259/pymorfologik/morfologik.py#L29-L49
[ "def", "stem", "(", "self", ",", "words", ",", "parser", ",", "*", "*", "kwargs", ")", ":", "output", "=", "self", ".", "_run_morfologik", "(", "words", ")", "return", "parser", ".", "parse", "(", "output", ",", "*", "*", "kwargs", ")" ]
e4d93a82e8b4c7a108f01e0456fbeb8024df0259
train
Morfologik._run_morfologik
Runs morfologik java jar and assumes that input and output is UTF-8 encoded.
pymorfologik/morfologik.py
def _run_morfologik(self, words): """ Runs morfologik java jar and assumes that input and output is UTF-8 encoded. """ p = subprocess.Popen( ['java', '-jar', self.jar_path, 'plstem', '-ie', 'UTF-8', '-oe', 'UTF-8'], bufsize=-1, ...
def _run_morfologik(self, words): """ Runs morfologik java jar and assumes that input and output is UTF-8 encoded. """ p = subprocess.Popen( ['java', '-jar', self.jar_path, 'plstem', '-ie', 'UTF-8', '-oe', 'UTF-8'], bufsize=-1, ...
[ "Runs", "morfologik", "java", "jar", "and", "assumes", "that", "input", "and", "output", "is", "UTF", "-", "8", "encoded", "." ]
dmirecki/pyMorfologik
python
https://github.com/dmirecki/pyMorfologik/blob/e4d93a82e8b4c7a108f01e0456fbeb8024df0259/pymorfologik/morfologik.py#L52-L66
[ "def", "_run_morfologik", "(", "self", ",", "words", ")", ":", "p", "=", "subprocess", ".", "Popen", "(", "[", "'java'", ",", "'-jar'", ",", "self", ".", "jar_path", ",", "'plstem'", ",", "'-ie'", ",", "'UTF-8'", ",", "'-oe'", ",", "'UTF-8'", "]", ",...
e4d93a82e8b4c7a108f01e0456fbeb8024df0259
train
Showcase.read_from_hdx
Reads the showcase given by identifier from HDX and returns Showcase object Args: identifier (str): Identifier of showcase configuration (Optional[Configuration]): HDX configuration. Defaults to global configuration. Returns: Optional[Showcase]: Showcase object if s...
src/hdx/data/showcase.py
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Showcase'] """Reads the showcase given by identifier from HDX and returns Showcase object Args: identifier (str): Identifier of showcase configuration (Optional[Configu...
def read_from_hdx(identifier, configuration=None): # type: (str, Optional[Configuration]) -> Optional['Showcase'] """Reads the showcase given by identifier from HDX and returns Showcase object Args: identifier (str): Identifier of showcase configuration (Optional[Configu...
[ "Reads", "the", "showcase", "given", "by", "identifier", "from", "HDX", "and", "returns", "Showcase", "object" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/showcase.py#L76-L92
[ "def", "read_from_hdx", "(", "identifier", ",", "configuration", "=", "None", ")", ":", "# type: (str, Optional[Configuration]) -> Optional['Showcase']", "showcase", "=", "Showcase", "(", "configuration", "=", "configuration", ")", "result", "=", "showcase", ".", "_load...
212440f54f73805826a16db77dbcb6033b18a313
train
Showcase.get_datasets
Get any datasets in the showcase Returns: List[Dataset]: List of datasets
src/hdx/data/showcase.py
def get_datasets(self): # type: () -> List[hdx.data.dataset.Dataset] """Get any datasets in the showcase Returns: List[Dataset]: List of datasets """ assoc_result, datasets_dicts = self._read_from_hdx('showcase', self.data['id'], fieldname='showcase_id', ...
def get_datasets(self): # type: () -> List[hdx.data.dataset.Dataset] """Get any datasets in the showcase Returns: List[Dataset]: List of datasets """ assoc_result, datasets_dicts = self._read_from_hdx('showcase', self.data['id'], fieldname='showcase_id', ...
[ "Get", "any", "datasets", "in", "the", "showcase" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/showcase.py#L179-L193
[ "def", "get_datasets", "(", "self", ")", ":", "# type: () -> List[hdx.data.dataset.Dataset]", "assoc_result", ",", "datasets_dicts", "=", "self", ".", "_read_from_hdx", "(", "'showcase'", ",", "self", ".", "data", "[", "'id'", "]", ",", "fieldname", "=", "'showcas...
212440f54f73805826a16db77dbcb6033b18a313
train
Showcase._get_showcase_dataset_dict
Get showcase dataset dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: Dict: showcase dataset dict
src/hdx/data/showcase.py
def _get_showcase_dataset_dict(self, dataset): # type: (Union[hdx.data.dataset.Dataset,Dict,str]) -> Dict """Get showcase dataset dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: ...
def _get_showcase_dataset_dict(self, dataset): # type: (Union[hdx.data.dataset.Dataset,Dict,str]) -> Dict """Get showcase dataset dict Args: showcase (Union[Showcase,Dict,str]): Either a showcase id or Showcase metadata from a Showcase object or dictionary Returns: ...
[ "Get", "showcase", "dataset", "dict" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/showcase.py#L195-L213
[ "def", "_get_showcase_dataset_dict", "(", "self", ",", "dataset", ")", ":", "# type: (Union[hdx.data.dataset.Dataset,Dict,str]) -> Dict", "if", "isinstance", "(", "dataset", ",", "hdx", ".", "data", ".", "dataset", ".", "Dataset", ")", "or", "isinstance", "(", "data...
212440f54f73805826a16db77dbcb6033b18a313
train
Showcase.add_dataset
Add a dataset Args: dataset (Union[Dataset,Dict,str]): Either a dataset id or dataset metadata either from a Dataset object or a dictionary datasets_to_check (List[Dataset]): List of datasets against which to check existence of dataset. Defaults to datasets in showcase. Returns...
src/hdx/data/showcase.py
def add_dataset(self, dataset, datasets_to_check=None): # type: (Union[hdx.data.dataset.Dataset,Dict,str], List[hdx.data.dataset.Dataset]) -> bool """Add a dataset Args: dataset (Union[Dataset,Dict,str]): Either a dataset id or dataset metadata either from a Dataset object or a dict...
def add_dataset(self, dataset, datasets_to_check=None): # type: (Union[hdx.data.dataset.Dataset,Dict,str], List[hdx.data.dataset.Dataset]) -> bool """Add a dataset Args: dataset (Union[Dataset,Dict,str]): Either a dataset id or dataset metadata either from a Dataset object or a dict...
[ "Add", "a", "dataset" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/showcase.py#L215-L233
[ "def", "add_dataset", "(", "self", ",", "dataset", ",", "datasets_to_check", "=", "None", ")", ":", "# type: (Union[hdx.data.dataset.Dataset,Dict,str], List[hdx.data.dataset.Dataset]) -> bool", "showcase_dataset", "=", "self", ".", "_get_showcase_dataset_dict", "(", "dataset", ...
212440f54f73805826a16db77dbcb6033b18a313
train
Showcase.add_datasets
Add multiple datasets Args: datasets (List[Union[Dataset,Dict,str]]): A list of either dataset ids or dataset metadata from Dataset objects or dictionaries datasets_to_check (List[Dataset]): List of datasets against which to check existence of dataset. Defaults to datasets in showcase. ...
src/hdx/data/showcase.py
def add_datasets(self, datasets, datasets_to_check=None): # type: (List[Union[hdx.data.dataset.Dataset,Dict,str]], List[hdx.data.dataset.Dataset]) -> bool """Add multiple datasets Args: datasets (List[Union[Dataset,Dict,str]]): A list of either dataset ids or dataset metadata from D...
def add_datasets(self, datasets, datasets_to_check=None): # type: (List[Union[hdx.data.dataset.Dataset,Dict,str]], List[hdx.data.dataset.Dataset]) -> bool """Add multiple datasets Args: datasets (List[Union[Dataset,Dict,str]]): A list of either dataset ids or dataset metadata from D...
[ "Add", "multiple", "datasets" ]
OCHA-DAP/hdx-python-api
python
https://github.com/OCHA-DAP/hdx-python-api/blob/212440f54f73805826a16db77dbcb6033b18a313/src/hdx/data/showcase.py#L235-L252
[ "def", "add_datasets", "(", "self", ",", "datasets", ",", "datasets_to_check", "=", "None", ")", ":", "# type: (List[Union[hdx.data.dataset.Dataset,Dict,str]], List[hdx.data.dataset.Dataset]) -> bool", "if", "datasets_to_check", "is", "None", ":", "datasets_to_check", "=", "s...
212440f54f73805826a16db77dbcb6033b18a313
train
possible_parameter
Find the possible parameters from a jupyter notebook (python3 only). The possible parameters are obtained by parsing the abstract syntax tree of the python code generated from the jupyter notebook. For a jupuyter notebook, a variable can be a possible parameter if: - it is defined in a cell that c...
run_jnb/core.py
def possible_parameter(nb, jsonable_parameter=True, end_cell_index=None): """ Find the possible parameters from a jupyter notebook (python3 only). The possible parameters are obtained by parsing the abstract syntax tree of the python code generated from the jupyter notebook. For a jupuyter noteboo...
def possible_parameter(nb, jsonable_parameter=True, end_cell_index=None): """ Find the possible parameters from a jupyter notebook (python3 only). The possible parameters are obtained by parsing the abstract syntax tree of the python code generated from the jupyter notebook. For a jupuyter noteboo...
[ "Find", "the", "possible", "parameters", "from", "a", "jupyter", "notebook", "(", "python3", "only", ")", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/core.py#L16-L57
[ "def", "possible_parameter", "(", "nb", ",", "jsonable_parameter", "=", "True", ",", "end_cell_index", "=", "None", ")", ":", "jh", "=", "_JupyterNotebookHelper", "(", "nb", ",", "jsonable_parameter", ",", "end_cell_index", ")", "if", "jsonable_parameter", "is", ...
55e63de33b0643161948864d2c1ec998f02815bf
train
run_jnb
Run an input jupyter notebook file and optionally (python3 only) parametrise it. One can pass arguments as keyword arguments or in a json format (file or string). For safety reasons, in order to avoid any code injection, only json serialisable keywords arguments are available. The keyword arguments...
run_jnb/core.py
def run_jnb(input_path, output_path=r"///_run_jnb/*-output", execution_path=r'///input', return_mode='except', overwrite=False, timeout=ExecutePreprocessor.timeout.default_value, kernel_name=ExecutePreprocessor.kernel_name.default_value, ep_kwargs=...
def run_jnb(input_path, output_path=r"///_run_jnb/*-output", execution_path=r'///input', return_mode='except', overwrite=False, timeout=ExecutePreprocessor.timeout.default_value, kernel_name=ExecutePreprocessor.kernel_name.default_value, ep_kwargs=...
[ "Run", "an", "input", "jupyter", "notebook", "file", "and", "optionally", "(", "python3", "only", ")", "parametrise", "it", "." ]
hz-inova/run_jnb
python
https://github.com/hz-inova/run_jnb/blob/55e63de33b0643161948864d2c1ec998f02815bf/run_jnb/core.py#L60-L256
[ "def", "run_jnb", "(", "input_path", ",", "output_path", "=", "r\"///_run_jnb/*-output\"", ",", "execution_path", "=", "r'///input'", ",", "return_mode", "=", "'except'", ",", "overwrite", "=", "False", ",", "timeout", "=", "ExecutePreprocessor", ".", "timeout", "...
55e63de33b0643161948864d2c1ec998f02815bf
train
ListWrapper.join
Join values and convert to string Example: >>> from ww import l >>> lst = l('012') >>> lst.join(',') u'0,1,2' >>> lst.join(',', template="{}#") u'0#,1#,2#' >>> string = lst.join(',',\ formatte...
src/ww/wrappers/lists.py
def join(self, joiner, formatter=lambda s, t: t.format(s), template="{}"): """Join values and convert to string Example: >>> from ww import l >>> lst = l('012') >>> lst.join(',') u'0,1,2' >>> lst.join(',', template="{}#") ...
def join(self, joiner, formatter=lambda s, t: t.format(s), template="{}"): """Join values and convert to string Example: >>> from ww import l >>> lst = l('012') >>> lst.join(',') u'0,1,2' >>> lst.join(',', template="{}#") ...
[ "Join", "values", "and", "convert", "to", "string" ]
Tygs/ww
python
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/lists.py#L33-L51
[ "def", "join", "(", "self", ",", "joiner", ",", "formatter", "=", "lambda", "s", ",", "t", ":", "t", ".", "format", "(", "s", ")", ",", "template", "=", "\"{}\"", ")", ":", "return", "ww", ".", "s", "(", "joiner", ")", ".", "join", "(", "self",...
6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4
train
ListWrapper.append
Append values at the end of the list Allow chaining. Args: values: values to be appened at the end. Example: >>> from ww import l >>> lst = l([]) >>> lst.append(1) [1] >>> lst [1] >>> lst.append(2...
src/ww/wrappers/lists.py
def append(self, *values): """Append values at the end of the list Allow chaining. Args: values: values to be appened at the end. Example: >>> from ww import l >>> lst = l([]) >>> lst.append(1) [1] >>> lst ...
def append(self, *values): """Append values at the end of the list Allow chaining. Args: values: values to be appened at the end. Example: >>> from ww import l >>> lst = l([]) >>> lst.append(1) [1] >>> lst ...
[ "Append", "values", "at", "the", "end", "of", "the", "list" ]
Tygs/ww
python
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/lists.py#L53-L77
[ "def", "append", "(", "self", ",", "*", "values", ")", ":", "for", "value", "in", "values", ":", "list", ".", "append", "(", "self", ",", "value", ")", "return", "self" ]
6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4
train
ListWrapper.extend
Add all values of all iterables at the end of the list Args: iterables: iterable which content to add at the end Example: >>> from ww import l >>> lst = l([]) >>> lst.extend([1, 2]) [1, 2] >>> lst [1, 2] >...
src/ww/wrappers/lists.py
def extend(self, *iterables): """Add all values of all iterables at the end of the list Args: iterables: iterable which content to add at the end Example: >>> from ww import l >>> lst = l([]) >>> lst.extend([1, 2]) [1, 2] ...
def extend(self, *iterables): """Add all values of all iterables at the end of the list Args: iterables: iterable which content to add at the end Example: >>> from ww import l >>> lst = l([]) >>> lst.extend([1, 2]) [1, 2] ...
[ "Add", "all", "values", "of", "all", "iterables", "at", "the", "end", "of", "the", "list" ]
Tygs/ww
python
https://github.com/Tygs/ww/blob/6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4/src/ww/wrappers/lists.py#L79-L101
[ "def", "extend", "(", "self", ",", "*", "iterables", ")", ":", "for", "value", "in", "iterables", ":", "list", ".", "extend", "(", "self", ",", "value", ")", "return", "self" ]
6a4b85141c9b74026abe8f3fa9bc7021f3c99fd4
train
normalize_cell_value
Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value
housecanary/excel/utilities.py
def normalize_cell_value(value): """Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value """ if isinstance(value, dict) or isinstance(value, list): return json.dumps(value) return va...
def normalize_cell_value(value): """Process value for writing into a cell. Args: value: any type of variable Returns: json serialized value if value is list or dict, else value """ if isinstance(value, dict) or isinstance(value, list): return json.dumps(value) return va...
[ "Process", "value", "for", "writing", "into", "a", "cell", "." ]
housecanary/hc-api-python
python
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L11-L22
[ "def", "normalize_cell_value", "(", "value", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", "or", "isinstance", "(", "value", ",", "list", ")", ":", "return", "json", ".", "dumps", "(", "value", ")", "return", "value" ]
2bb9e2208b34e8617575de45934357ee33b8531c
train
get_addresses_from_input_file
Read addresses from input file into list of tuples. This only supports address and zipcode headers
housecanary/excel/utilities.py
def get_addresses_from_input_file(input_file_name): """Read addresses from input file into list of tuples. This only supports address and zipcode headers """ mode = 'r' if sys.version_info[0] < 3: mode = 'rb' with io.open(input_file_name, mode) as input_file: reader = csv.read...
def get_addresses_from_input_file(input_file_name): """Read addresses from input file into list of tuples. This only supports address and zipcode headers """ mode = 'r' if sys.version_info[0] < 3: mode = 'rb' with io.open(input_file_name, mode) as input_file: reader = csv.read...
[ "Read", "addresses", "from", "input", "file", "into", "list", "of", "tuples", ".", "This", "only", "supports", "address", "and", "zipcode", "headers" ]
housecanary/hc-api-python
python
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L35-L59
[ "def", "get_addresses_from_input_file", "(", "input_file_name", ")", ":", "mode", "=", "'r'", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "mode", "=", "'rb'", "with", "io", ".", "open", "(", "input_file_name", ",", "mode", ")", "as", ...
2bb9e2208b34e8617575de45934357ee33b8531c
train
get_identifiers_from_input_file
Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values.
housecanary/excel/utilities.py
def get_identifiers_from_input_file(input_file_name): """Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values. """ valid_identifiers = ['address', 'zipcode', 'unit', 'city', 'state', 'slug', 'block_id', 'msa', ...
def get_identifiers_from_input_file(input_file_name): """Read identifiers from input file into list of dicts with the header row values as keys, and the rest of the rows as values. """ valid_identifiers = ['address', 'zipcode', 'unit', 'city', 'state', 'slug', 'block_id', 'msa', ...
[ "Read", "identifiers", "from", "input", "file", "into", "list", "of", "dicts", "with", "the", "header", "row", "values", "as", "keys", "and", "the", "rest", "of", "the", "rows", "as", "values", "." ]
housecanary/hc-api-python
python
https://github.com/housecanary/hc-api-python/blob/2bb9e2208b34e8617575de45934357ee33b8531c/housecanary/excel/utilities.py#L62-L75
[ "def", "get_identifiers_from_input_file", "(", "input_file_name", ")", ":", "valid_identifiers", "=", "[", "'address'", ",", "'zipcode'", ",", "'unit'", ",", "'city'", ",", "'state'", ",", "'slug'", ",", "'block_id'", ",", "'msa'", ",", "'num_bins'", ",", "'prop...
2bb9e2208b34e8617575de45934357ee33b8531c
train
get_real_time_locate
function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a single host due to a partially discovered network or misconfigur...
build/lib/pyhpeimc/plat/termaccess.py
def get_real_time_locate(ipAddress, auth, url): """ function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a sing...
def get_real_time_locate(ipAddress, auth, url): """ function takes the ipAddress of a specific host and issues a RESTFUL call to get the device and interface that the target host is currently connected to. Note: Although intended to return a single location, Multiple locations may be returned for a sing...
[ "function", "takes", "the", "ipAddress", "of", "a", "specific", "host", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "device", "and", "interface", "that", "the", "target", "host", "is", "currently", "connected", "to", ".", "Note", ":", "Alt...
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L19-L77
[ "def", "get_real_time_locate", "(", "ipAddress", ",", "auth", ",", "url", ")", ":", "real_time_locate_url", "=", "\"/imcrs/res/access/realtimeLocate?type=2&value=\"", "+", "str", "(", "ipAddress", ")", "+", "\"&total=false\"", "f_url", "=", "url", "+", "real_time_loca...
4fba31827573587e03a6233c7db60f188038c8e5
train
get_ip_mac_arp_list
function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually a...
build/lib/pyhpeimc/plat/termaccess.py
def get_ip_mac_arp_list(devId, auth,url): """ function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
def get_ip_mac_arp_list(devId, auth,url): """ function takes devid of specific device and issues a RESTFUL call to get the IP/MAC/ARP list from the target device. :param devId: int or str value of the target device. :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class ...
[ "function", "takes", "devid", "of", "specific", "device", "and", "issues", "a", "RESTFUL", "call", "to", "get", "the", "IP", "/", "MAC", "/", "ARP", "list", "from", "the", "target", "device", "." ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L80-L121
[ "def", "get_ip_mac_arp_list", "(", "devId", ",", "auth", ",", "url", ")", ":", "if", "auth", "is", "None", "or", "url", "is", "None", ":", "# checks to see if the imc credentials are already available", "set_imc_creds", "(", ")", "ip_mac_arp_list_url", "=", "\"/imcr...
4fba31827573587e03a6233c7db60f188038c8e5
train
get_ip_scope_detail
function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scope id ( optional ) :param auth: requests auth object #...
build/lib/pyhpeimc/plat/termaccess.py
def get_ip_scope_detail(scopeId, auth, url ): """ function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scop...
def get_ip_scope_detail(scopeId, auth, url ): """ function requires no inputs and returns all IP address scopes currently configured on the HPE IMC server. If the optional scopeId parameter is included, this will automatically return only the desired scope id. :param scopeId: integer of the desired scop...
[ "function", "requires", "no", "inputs", "and", "returns", "all", "IP", "address", "scopes", "currently", "configured", "on", "the", "HPE", "IMC", "server", ".", "If", "the", "optional", "scopeId", "parameter", "is", "included", "this", "will", "automatically", ...
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L170-L206
[ "def", "get_ip_scope_detail", "(", "scopeId", ",", "auth", ",", "url", ")", ":", "get_ip_scope_url", "=", "\"/imcrs/res/access/assignedIpScope/\"", "+", "str", "(", "scopeId", ")", "f_url", "=", "url", "+", "get_ip_scope_url", "r", "=", "requests", ".", "get", ...
4fba31827573587e03a6233c7db60f188038c8e5
train
delete_ip_scope
Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth("http://", "10.101.0.203", "8080", "admin", "admin") ...
build/lib/pyhpeimc/plat/termaccess.py
def delete_ip_scope(network_address, auth, url): '''Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth(...
def delete_ip_scope(network_address, auth, url): '''Function to delete an entire IP segment from the IMC IP Address management under terminal access :param network_address :param auth :param url >>> from pyhpeimc.auth import * >>> from pyhpeimc.plat.termaccess import * >>> auth = IMCAuth(...
[ "Function", "to", "delete", "an", "entire", "IP", "segment", "from", "the", "IMC", "IP", "Address", "management", "under", "terminal", "access", ":", "param", "network_address", ":", "param", "auth", ":", "param", "url" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L320-L348
[ "def", "delete_ip_scope", "(", "network_address", ",", "auth", ",", "url", ")", ":", "scope_id", "=", "get_scope_id", "(", "network_address", ",", "auth", ",", "url", ")", "delete_ip_address_url", "=", "'''/imcrs/res/access/assignedIpScope/'''", "+", "str", "(", "...
4fba31827573587e03a6233c7db60f188038c8e5
train
add_scope_ip
Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interf...
build/lib/pyhpeimc/plat/termaccess.py
def add_scope_ip(ipaddress, name, description, scopeid, auth, url): """ Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually aut...
def add_scope_ip(ipaddress, name, description, scopeid, auth, url): """ Function to add new host IP address allocation to existing scope ID :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param auth: requests auth object #usually aut...
[ "Function", "to", "add", "new", "host", "IP", "address", "allocation", "to", "existing", "scope", "ID" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L352-L395
[ "def", "add_scope_ip", "(", "ipaddress", ",", "name", ",", "description", ",", "scopeid", ",", "auth", ",", "url", ")", ":", "new_ip", "=", "{", "\"ip\"", ":", "ipaddress", ",", "\"name\"", ":", "name", ",", "\"description\"", ":", "description", "}", "a...
4fba31827573587e03a6233c7db60f188038c8e5
train
remove_scope_ip
Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :return: String of HTTP response c...
build/lib/pyhpeimc/plat/termaccess.py
def remove_scope_ip(hostid, auth, url): """ Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au...
def remove_scope_ip(hostid, auth, url): """ Function to add remove IP address allocation :param hostid: Host id of the host to be deleted :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.au...
[ "Function", "to", "add", "remove", "IP", "address", "allocation" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L397-L443
[ "def", "remove_scope_ip", "(", "hostid", ",", "auth", ",", "url", ")", ":", "add_scope_ip_url", "=", "'/imcrs/res/access/assignedIpScope/ip/'", "+", "str", "(", "hostid", ")", "f_url", "=", "url", "+", "add_scope_ip_url", "r", "=", "requests", ".", "delete", "...
4fba31827573587e03a6233c7db60f188038c8e5
train
get_ip_scope_hosts
Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhpeimc.auth.authclass :param scopeId: Interger of teh ...
build/lib/pyhpeimc/plat/termaccess.py
def get_ip_scope_hosts( scopeId, auth, url): """ Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhp...
def get_ip_scope_hosts( scopeId, auth, url): """ Function requires input of scope ID and returns list of allocated IP address for the specified scope :param auth: requests auth object #usually auth.creds from auth pyhpeimc.auth.class :param url: base url of IMC RS interface #usually auth.url from pyhp...
[ "Function", "requires", "input", "of", "scope", "ID", "and", "returns", "list", "of", "allocated", "IP", "address", "for", "the", "specified", "scope" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L447-L497
[ "def", "get_ip_scope_hosts", "(", "scopeId", ",", "auth", ",", "url", ")", ":", "get_ip_scope_url", "=", "\"/imcrs/res/access/assignedIpScope/ip?size=10000&ipScopeId=\"", "+", "str", "(", "scopeId", ")", "f_url", "=", "url", "+", "get_ip_scope_url", "r", "=", "reque...
4fba31827573587e03a6233c7db60f188038c8e5
train
add_host_to_segment
Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param description: Description of the host :param: network_address: network address of the target s...
build/lib/pyhpeimc/plat/termaccess.py
def add_host_to_segment(ipaddress, name, description, network_address, auth, url): ''' Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param descrip...
def add_host_to_segment(ipaddress, name, description, network_address, auth, url): ''' Function to abstract existing add_scope_ip_function. Allows for use of network address rather than forcing human to learn the scope_id :param ipaddress: :param name: name of the owner of this host :param descrip...
[ "Function", "to", "abstract", "existing", "add_scope_ip_function", ".", "Allows", "for", "use", "of", "network", "address", "rather", "than", "forcing", "human", "to", "learn", "the", "scope_id", ":", "param", "ipaddress", ":" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L544-L569
[ "def", "add_host_to_segment", "(", "ipaddress", ",", "name", ",", "description", ",", "network_address", ",", "auth", ",", "url", ")", ":", "scope_id", "=", "get_scope_id", "(", "network_address", ",", "auth", ",", "url", ")", "add_scope_ip", "(", "ipaddress",...
4fba31827573587e03a6233c7db60f188038c8e5
train
delete_host_from_segment
Function to abstract
build/lib/pyhpeimc/plat/termaccess.py
def delete_host_from_segment(ipaddress, networkaddress, auth, url): '''Function to abstract ''' host_id = get_host_id(ipaddress, networkaddress, auth, url) remove_scope_ip(host_id, auth.creds, auth.url)
def delete_host_from_segment(ipaddress, networkaddress, auth, url): '''Function to abstract ''' host_id = get_host_id(ipaddress, networkaddress, auth, url) remove_scope_ip(host_id, auth.creds, auth.url)
[ "Function", "to", "abstract" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/build/lib/pyhpeimc/plat/termaccess.py#L572-L577
[ "def", "delete_host_from_segment", "(", "ipaddress", ",", "networkaddress", ",", "auth", ",", "url", ")", ":", "host_id", "=", "get_host_id", "(", "ipaddress", ",", "networkaddress", ",", "auth", ",", "url", ")", "remove_scope_ip", "(", "host_id", ",", "auth",...
4fba31827573587e03a6233c7db60f188038c8e5
train
generate_signature
Generates the API request signature from the given parameters.
src/ai/backend/client/auth.py
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
def generate_signature(method, version, endpoint, date, rel_url, content_type, content, access_key, secret_key, hash_type): ''' Generates the API request signature from the given parameters. ''' hash_type = hash_type hostname = endpoint._val.netloc # FI...
[ "Generates", "the", "API", "request", "signature", "from", "the", "given", "parameters", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/auth.py#L5-L43
[ "def", "generate_signature", "(", "method", ",", "version", ",", "endpoint", ",", "date", ",", "rel_url", ",", "content_type", ",", "content", ",", "access_key", ",", "secret_key", ",", "hash_type", ")", ":", "hash_type", "=", "hash_type", "hostname", "=", "...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Agent.list_with_limit
Fetches the list of agents with the given status with limit and offset for pagination. :param limit: number of agents to get :param offset: offset index of agents to get :param status: An upper-cased string constant representing agent status (one of ``'ALIVE'``, ``'TERMINATE...
src/ai/backend/client/agent.py
async def list_with_limit(cls, limit, offset, status: str = 'ALIVE', fields: Iterable[str] = None) -> Sequence[dict]: ''' Fetches the list of agents with the given status with limit an...
async def list_with_limit(cls, limit, offset, status: str = 'ALIVE', fields: Iterable[str] = None) -> Sequence[dict]: ''' Fetches the list of agents with the given status with limit an...
[ "Fetches", "the", "list", "of", "agents", "with", "the", "given", "status", "with", "limit", "and", "offset", "for", "pagination", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/agent.py#L28-L73
[ "async", "def", "list_with_limit", "(", "cls", ",", "limit", ",", "offset", ",", "status", ":", "str", "=", "'ALIVE'", ",", "fields", ":", "Iterable", "[", "str", "]", "=", "None", ")", "->", "Sequence", "[", "dict", "]", ":", "if", "fields", "is", ...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request.set_content
Sets the content of the request.
src/ai/backend/client/request.py
def set_content(self, value: RequestContent, *, content_type: str = None): ''' Sets the content of the request. ''' assert self._attached_files is None, \ 'cannot set content because you already attached files.' guessed_content_type = 'applicati...
def set_content(self, value: RequestContent, *, content_type: str = None): ''' Sets the content of the request. ''' assert self._attached_files is None, \ 'cannot set content because you already attached files.' guessed_content_type = 'applicati...
[ "Sets", "the", "content", "of", "the", "request", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L130-L148
[ "def", "set_content", "(", "self", ",", "value", ":", "RequestContent", ",", "*", ",", "content_type", ":", "str", "=", "None", ")", ":", "assert", "self", ".", "_attached_files", "is", "None", ",", "'cannot set content because you already attached files.'", "gues...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request.set_json
A shortcut for set_content() with JSON objects.
src/ai/backend/client/request.py
def set_json(self, value: object): ''' A shortcut for set_content() with JSON objects. ''' self.set_content(modjson.dumps(value, cls=ExtendedJSONEncoder), content_type='application/json')
def set_json(self, value: object): ''' A shortcut for set_content() with JSON objects. ''' self.set_content(modjson.dumps(value, cls=ExtendedJSONEncoder), content_type='application/json')
[ "A", "shortcut", "for", "set_content", "()", "with", "JSON", "objects", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L150-L155
[ "def", "set_json", "(", "self", ",", "value", ":", "object", ")", ":", "self", ".", "set_content", "(", "modjson", ".", "dumps", "(", "value", ",", "cls", "=", "ExtendedJSONEncoder", ")", ",", "content_type", "=", "'application/json'", ")" ]
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request.attach_files
Attach a list of files represented as AttachedFile.
src/ai/backend/client/request.py
def attach_files(self, files: Sequence[AttachedFile]): ''' Attach a list of files represented as AttachedFile. ''' assert not self._content, 'content must be empty to attach files.' self.content_type = 'multipart/form-data' self._attached_files = files
def attach_files(self, files: Sequence[AttachedFile]): ''' Attach a list of files represented as AttachedFile. ''' assert not self._content, 'content must be empty to attach files.' self.content_type = 'multipart/form-data' self._attached_files = files
[ "Attach", "a", "list", "of", "files", "represented", "as", "AttachedFile", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L157-L163
[ "def", "attach_files", "(", "self", ",", "files", ":", "Sequence", "[", "AttachedFile", "]", ")", ":", "assert", "not", "self", ".", "_content", ",", "'content must be empty to attach files.'", "self", ".", "content_type", "=", "'multipart/form-data'", "self", "."...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request._sign
Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server.
src/ai/backend/client/request.py
def _sign(self, rel_url, access_key=None, secret_key=None, hash_type=None): ''' Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server. '...
def _sign(self, rel_url, access_key=None, secret_key=None, hash_type=None): ''' Calculates the signature of the given request and adds the Authorization HTTP header. It should be called at the very end of request preparation and before sending the request to the server. '...
[ "Calculates", "the", "signature", "of", "the", "given", "request", "and", "adds", "the", "Authorization", "HTTP", "header", ".", "It", "should", "be", "called", "at", "the", "very", "end", "of", "request", "preparation", "and", "before", "sending", "the", "r...
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L165-L182
[ "def", "_sign", "(", "self", ",", "rel_url", ",", "access_key", "=", "None", ",", "secret_key", "=", "None", ",", "hash_type", "=", "None", ")", ":", "if", "access_key", "is", "None", ":", "access_key", "=", "self", ".", "config", ".", "access_key", "i...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request.fetch
Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.backend.client.request import Request from ai.backend.client.sess...
src/ai/backend/client/request.py
def fetch(self, **kwargs) -> 'FetchContextManager': ''' Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.bac...
def fetch(self, **kwargs) -> 'FetchContextManager': ''' Sends the request to the server and reads the response. You may use this method either with plain synchronous Session or AsyncSession. Both the followings patterns are valid: .. code-block:: python3 from ai.bac...
[ "Sends", "the", "request", "to", "the", "server", "and", "reads", "the", "response", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L211-L252
[ "def", "fetch", "(", "self", ",", "*", "*", "kwargs", ")", "->", "'FetchContextManager'", ":", "assert", "self", ".", "method", "in", "self", ".", "_allowed_methods", ",", "'Disallowed HTTP method: {}'", ".", "format", "(", "self", ".", "method", ")", "self"...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
Request.connect_websocket
Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`.
src/ai/backend/client/request.py
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager': ''' Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`. ''' assert isinstance(self.session, AsyncSession), \ ...
def connect_websocket(self, **kwargs) -> 'WebSocketContextManager': ''' Creates a WebSocket connection. .. warning:: This method only works with :class:`~ai.backend.client.session.AsyncSession`. ''' assert isinstance(self.session, AsyncSession), \ ...
[ "Creates", "a", "WebSocket", "connection", "." ]
lablup/backend.ai-client-py
python
https://github.com/lablup/backend.ai-client-py/blob/a063d774fea6f4350b89498c40d3c837ec3029a7/src/ai/backend/client/request.py#L254-L276
[ "def", "connect_websocket", "(", "self", ",", "*", "*", "kwargs", ")", "->", "'WebSocketContextManager'", ":", "assert", "isinstance", "(", "self", ".", "session", ",", "AsyncSession", ")", ",", "'Cannot use websockets with sessions in the synchronous mode'", "assert", ...
a063d774fea6f4350b89498c40d3c837ec3029a7
train
main
Main function. :return: None.
src/aoiklivereload/demo/tornado_demo.py
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
def main(): """ Main function. :return: None. """ try: # Get the `src` directory's absolute path src_path = os.path.dirname( # `aoiklivereload` directory's absolute path os.path.dirname( # `demo` directory's absolute path ...
[ "Main", "function", "." ]
AoiKuiyuyou/AoikLiveReload
python
https://github.com/AoiKuiyuyou/AoikLiveReload/blob/0d5adb12118a33749e6690a8165fdb769cff7d5c/src/aoiklivereload/demo/tornado_demo.py#L16-L123
[ "def", "main", "(", ")", ":", "try", ":", "# Get the `src` directory's absolute path", "src_path", "=", "os", ".", "path", ".", "dirname", "(", "# `aoiklivereload` directory's absolute path", "os", ".", "path", ".", "dirname", "(", "# `demo` directory's absolute path", ...
0d5adb12118a33749e6690a8165fdb769cff7d5c
train
add_perf_task
function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks :param auth: requests auth object #usually ...
pyhpeimc/plat/perf.py
def add_perf_task(task, auth, url): """ function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks ...
def add_perf_task(task, auth, url): """ function takes the a python dict containing all necessary fields for a performance tasks, transforms the dict into JSON and issues a RESTFUL call to create the performance task. device. :param task: dictionary containing all required fields for performance tasks ...
[ "function", "takes", "the", "a", "python", "dict", "containing", "all", "necessary", "fields", "for", "a", "performance", "tasks", "transforms", "the", "dict", "into", "JSON", "and", "issues", "a", "RESTFUL", "call", "to", "create", "the", "performance", "task...
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L19-L56
[ "def", "add_perf_task", "(", "task", ",", "auth", ",", "url", ")", ":", "add_perf_task_url", "=", "\"/imcrs/perf/task\"", "f_url", "=", "url", "+", "add_perf_task_url", "payload", "=", "json", ".", "dumps", "(", "task", ")", "response", "=", "requests", ".",...
4fba31827573587e03a6233c7db60f188038c8e5
train
get_perf_task
function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: requests auth object #usually auth.creds from auth pyhpei...
pyhpeimc/plat/perf.py
def get_perf_task(task_name, auth, url): """ function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: ...
def get_perf_task(task_name, auth, url): """ function takes the a str object containing the name of an existing performance tasks and issues a RESTFUL call to the IMC REST service. It will return a list :param task_name: str containing the name of the performance task :param auth: ...
[ "function", "takes", "the", "a", "str", "object", "containing", "the", "name", "of", "an", "existing", "performance", "tasks", "and", "issues", "a", "RESTFUL", "call", "to", "the", "IMC", "REST", "service", ".", "It", "will", "return", "a", "list" ]
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L59-L98
[ "def", "get_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", ":", "get_perf_task_url", "=", "\"/imcrs/perf/task?name=\"", "+", "task_name", "+", "\"&orderBy=taskId&desc=false\"", "f_url", "=", "url", "+", "get_perf_task_url", "response", "=", "requests", ...
4fba31827573587e03a6233c7db60f188038c8e5
train
delete_perf_task
Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC REST interface to delete the target task. :param ta...
pyhpeimc/plat/perf.py
def delete_perf_task(task_name, auth, url): """ Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC RES...
def delete_perf_task(task_name, auth, url): """ Function takes a str of the target task_name to be deleted and retrieves task_id using the get_perf_task function. Once the task_id has been successfully retrieved it is populated into the task_id variable and an DELETE call is made against the HPE IMC RES...
[ "Function", "takes", "a", "str", "of", "the", "target", "task_name", "to", "be", "deleted", "and", "retrieves", "task_id", "using", "the", "get_perf_task", "function", ".", "Once", "the", "task_id", "has", "been", "successfully", "retrieved", "it", "is", "popu...
HPENetworking/PYHPEIMC
python
https://github.com/HPENetworking/PYHPEIMC/blob/4fba31827573587e03a6233c7db60f188038c8e5/pyhpeimc/plat/perf.py#L101-L130
[ "def", "delete_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", ":", "task_id", "=", "get_perf_task", "(", "task_name", ",", "auth", ",", "url", ")", "if", "isinstance", "(", "task_id", ",", "str", ")", ":", "print", "(", "\"Perf task doesn't ex...
4fba31827573587e03a6233c7db60f188038c8e5