repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
falkr/stmpy
stmpy/__init__.py
_parse_action_list_attribute
def _parse_action_list_attribute(attribute): """ Parses a list of actions, as found in the effect attribute of transitions, and the enry and exit actions of states. Actions are separated by a semicolon, surrounded by any amount of whitespace. A action can have the following form: m; m(); m...
python
def _parse_action_list_attribute(attribute): """ Parses a list of actions, as found in the effect attribute of transitions, and the enry and exit actions of states. Actions are separated by a semicolon, surrounded by any amount of whitespace. A action can have the following form: m; m(); m...
[ "def", "_parse_action_list_attribute", "(", "attribute", ")", ":", "actions", "=", "[", "]", "for", "action_call", "in", "attribute", ".", "split", "(", "';'", ")", ":", "action_call", "=", "action_call", ".", "strip", "(", ")", "if", "action_call", ":", "...
Parses a list of actions, as found in the effect attribute of transitions, and the enry and exit actions of states. Actions are separated by a semicolon, surrounded by any amount of whitespace. A action can have the following form: m; m(); m(True); m(*) The asterisk that the state machine sho...
[ "Parses", "a", "list", "of", "actions", "as", "found", "in", "the", "effect", "attribute", "of", "transitions", "and", "the", "enry", "and", "exit", "actions", "of", "states", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L180-L198
train
falkr/stmpy
stmpy/__init__.py
Driver.print_status
def print_status(self): """Provide a snapshot of the current status.""" s = [] s.append('=== State Machines: ===\n') for stm_id in Driver._stms_by_id: stm = Driver._stms_by_id[stm_id] s.append(' - {} in state {}\n'.format(stm.id, stm.state)) s.append('=...
python
def print_status(self): """Provide a snapshot of the current status.""" s = [] s.append('=== State Machines: ===\n') for stm_id in Driver._stms_by_id: stm = Driver._stms_by_id[stm_id] s.append(' - {} in state {}\n'.format(stm.id, stm.state)) s.append('=...
[ "def", "print_status", "(", "self", ")", ":", "s", "=", "[", "]", "s", ".", "append", "(", "'=== State Machines: ===\\n'", ")", "for", "stm_id", "in", "Driver", ".", "_stms_by_id", ":", "stm", "=", "Driver", ".", "_stms_by_id", "[", "stm_id", "]", "s", ...
Provide a snapshot of the current status.
[ "Provide", "a", "snapshot", "of", "the", "current", "status", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L242-L260
train
falkr/stmpy
stmpy/__init__.py
Driver.add_machine
def add_machine(self, machine): """Add the state machine to this driver.""" self._logger.debug('Adding machine {} to driver'.format(machine.id)) machine._driver = self machine._reset() if machine.id is not None: # TODO warning when STM already registered D...
python
def add_machine(self, machine): """Add the state machine to this driver.""" self._logger.debug('Adding machine {} to driver'.format(machine.id)) machine._driver = self machine._reset() if machine.id is not None: # TODO warning when STM already registered D...
[ "def", "add_machine", "(", "self", ",", "machine", ")", ":", "self", ".", "_logger", ".", "debug", "(", "'Adding machine {} to driver'", ".", "format", "(", "machine", ".", "id", ")", ")", "machine", ".", "_driver", "=", "self", "machine", ".", "_reset", ...
Add the state machine to this driver.
[ "Add", "the", "state", "machine", "to", "this", "driver", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L262-L270
train
falkr/stmpy
stmpy/__init__.py
Driver.start
def start(self, max_transitions=None, keep_active=False): """ Start the driver. This method creates a thread which runs the event loop. The method returns immediately. To wait until the driver finishes, use `stmpy.Driver.wait_until_finished`. `max_transitions`: execute ...
python
def start(self, max_transitions=None, keep_active=False): """ Start the driver. This method creates a thread which runs the event loop. The method returns immediately. To wait until the driver finishes, use `stmpy.Driver.wait_until_finished`. `max_transitions`: execute ...
[ "def", "start", "(", "self", ",", "max_transitions", "=", "None", ",", "keep_active", "=", "False", ")", ":", "self", ".", "_active", "=", "True", "self", ".", "_max_transitions", "=", "max_transitions", "self", ".", "_keep_active", "=", "keep_active", "self...
Start the driver. This method creates a thread which runs the event loop. The method returns immediately. To wait until the driver finishes, use `stmpy.Driver.wait_until_finished`. `max_transitions`: execute only this number of transitions, then stop `keep_active`: When true, k...
[ "Start", "the", "driver", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L272-L288
train
falkr/stmpy
stmpy/__init__.py
Driver.wait_until_finished
def wait_until_finished(self): """Blocking method to wait until the driver finished its execution.""" try: self.thread.join() except KeyboardInterrupt: self._logger.debug('Keyboard interrupt detected, stopping driver.') self._active = False self._w...
python
def wait_until_finished(self): """Blocking method to wait until the driver finished its execution.""" try: self.thread.join() except KeyboardInterrupt: self._logger.debug('Keyboard interrupt detected, stopping driver.') self._active = False self._w...
[ "def", "wait_until_finished", "(", "self", ")", ":", "try", ":", "self", ".", "thread", ".", "join", "(", ")", "except", "KeyboardInterrupt", ":", "self", ".", "_logger", ".", "debug", "(", "'Keyboard interrupt detected, stopping driver.'", ")", "self", ".", "...
Blocking method to wait until the driver finished its execution.
[ "Blocking", "method", "to", "wait", "until", "the", "driver", "finished", "its", "execution", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L300-L307
train
falkr/stmpy
stmpy/__init__.py
Driver._check_timers
def _check_timers(self): """ Check for expired timers. If there are any timers that expired, place them in the event queue. """ if self._timer_queue: timer = self._timer_queue[0] if timer['timeout_abs'] < _current_time_millis(): # ...
python
def _check_timers(self): """ Check for expired timers. If there are any timers that expired, place them in the event queue. """ if self._timer_queue: timer = self._timer_queue[0] if timer['timeout_abs'] < _current_time_millis(): # ...
[ "def", "_check_timers", "(", "self", ")", ":", "if", "self", ".", "_timer_queue", ":", "timer", "=", "self", ".", "_timer_queue", "[", "0", "]", "if", "timer", "[", "'timeout_abs'", "]", "<", "_current_time_millis", "(", ")", ":", "self", ".", "_timer_qu...
Check for expired timers. If there are any timers that expired, place them in the event queue.
[ "Check", "for", "expired", "timers", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L344-L367
train
falkr/stmpy
stmpy/__init__.py
Driver.send
def send(self, message_id, stm_id, args=[], kwargs={}): """ Send a message to a state machine handled by this driver. If you have a reference to the state machine, you can also send it directly to it by using `stmpy.Machine.send`. `stm_id` must be the id of a state machine earl...
python
def send(self, message_id, stm_id, args=[], kwargs={}): """ Send a message to a state machine handled by this driver. If you have a reference to the state machine, you can also send it directly to it by using `stmpy.Machine.send`. `stm_id` must be the id of a state machine earl...
[ "def", "send", "(", "self", ",", "message_id", ",", "stm_id", ",", "args", "=", "[", "]", ",", "kwargs", "=", "{", "}", ")", ":", "if", "stm_id", "not", "in", "Driver", ".", "_stms_by_id", ":", "self", ".", "_logger", ".", "warn", "(", "'Machine wi...
Send a message to a state machine handled by this driver. If you have a reference to the state machine, you can also send it directly to it by using `stmpy.Machine.send`. `stm_id` must be the id of a state machine earlier added to the driver.
[ "Send", "a", "message", "to", "a", "state", "machine", "handled", "by", "this", "driver", "." ]
78b016f7bf6fa7b6eba8dae58997fb99f7215bf7
https://github.com/falkr/stmpy/blob/78b016f7bf6fa7b6eba8dae58997fb99f7215bf7/stmpy/__init__.py#L375-L389
train
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.get_group
def get_group(self, name, user_name=None): """Get owner of group and the resources it's attached to. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: ...
python
def get_group(self, name, user_name=None): """Get owner of group and the resources it's attached to. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: ...
[ "def", "get_group", "(", "self", ",", "name", ",", "user_name", "=", "None", ")", ":", "return", "self", ".", "service", ".", "get_group", "(", "name", ",", "user_name", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "ses...
Get owner of group and the resources it's attached to. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: (dict): Keys include 'owner', 'name', 'res...
[ "Get", "owner", "of", "group", "and", "the", "resources", "it", "s", "attached", "to", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L57-L72
train
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.add_permissions
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. ...
python
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. ...
[ "def", "add_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "service", ".", "add_permissions", "(", "grp_name", ",", "resource", ",", "permissions", ",", "self", ".", "url_prefix", ",", "self", ".", "...
Add additional permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.BossResource): Identifies which data model object to operate on. permissions (list): List of permissions to add to the given re...
[ "Add", "additional", "permissions", "for", "the", "group", "associated", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L257-L270
train
jhuapl-boss/intern
intern/service/boss/project.py
ProjectService.create
def create(self, resource): """Create the given resource. Args: resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on s...
python
def create(self, resource): """Create the given resource. Args: resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on s...
[ "def", "create", "(", "self", ",", "resource", ")", ":", "return", "self", ".", "service", ".", "create", "(", "resource", ",", "self", ".", "url_prefix", ",", "self", ".", "auth", ",", "self", ".", "session", ",", "self", ".", "session_send_opts", ")"...
Create the given resource. Args: resource (intern.resource.boss.BossResource): Create a data model object with attributes matching those of the resource. Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Raises: re...
[ "Create", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/service/boss/project.py#L404-L418
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_project_service
def _init_project_service(self, version): """ Method to initialize the Project Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ p...
python
def _init_project_service(self, version): """ Method to initialize the Project Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ p...
[ "def", "_init_project_service", "(", "self", ",", "version", ")", ":", "project_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_PROJECT_SECTION", ")", "self", ".", "_token_project", "=", "project_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "project_...
Method to initialize the Project Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
[ "Method", "to", "initialize", "the", "Project", "Service", "from", "the", "config", "data" ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L83-L103
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_metadata_service
def _init_metadata_service(self, version): """ Method to initialize the Metadata Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ ...
python
def _init_metadata_service(self, version): """ Method to initialize the Metadata Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ ...
[ "def", "_init_metadata_service", "(", "self", ",", "version", ")", ":", "metadata_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_METADATA_SECTION", ")", "self", ".", "_token_metadata", "=", "metadata_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "met...
Method to initialize the Metadata Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
[ "Method", "to", "initialize", "the", "Metadata", "Service", "from", "the", "config", "data" ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L105-L125
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._init_volume_service
def _init_volume_service(self, version): """ Method to initialize the Volume Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ vol...
python
def _init_volume_service(self, version): """ Method to initialize the Volume Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version. """ vol...
[ "def", "_init_volume_service", "(", "self", ",", "version", ")", ":", "volume_cfg", "=", "self", ".", "_load_config_section", "(", "CONFIG_VOLUME_SECTION", ")", "self", ".", "_token_volume", "=", "volume_cfg", "[", "CONFIG_TOKEN", "]", "proto", "=", "volume_cfg", ...
Method to initialize the Volume Service from the config data Args: version (string): Version of Boss API to use. Returns: None Raises: (KeyError): if given invalid version.
[ "Method", "to", "initialize", "the", "Volume", "Service", "from", "the", "config", "data" ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L127-L147
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._load_config_section
def _load_config_section(self, section_name): """ Method to load the specific Service section from the config file if it exists, or fall back to the default Args: section_name (str): The desired service section name Returns: (dict): the section parameter...
python
def _load_config_section(self, section_name): """ Method to load the specific Service section from the config file if it exists, or fall back to the default Args: section_name (str): The desired service section name Returns: (dict): the section parameter...
[ "def", "_load_config_section", "(", "self", ",", "section_name", ")", ":", "if", "self", ".", "_config", ".", "has_section", "(", "section_name", ")", ":", "section", "=", "dict", "(", "self", ".", "_config", ".", "items", "(", "section_name", ")", ")", ...
Method to load the specific Service section from the config file if it exists, or fall back to the default Args: section_name (str): The desired service section name Returns: (dict): the section parameters
[ "Method", "to", "load", "the", "specific", "Service", "section", "from", "the", "config", "file", "if", "it", "exists", "or", "fall", "back", "to", "the", "default" ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L149-L179
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_group
def get_group(self, name, user_name=None): """ Get information on the given group or whether or not a user is a member of the group. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determinin...
python
def get_group(self, name, user_name=None): """ Get information on the given group or whether or not a user is a member of the group. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determinin...
[ "def", "get_group", "(", "self", ",", "name", ",", "user_name", "=", "None", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_group", "(", "name", ",", ...
Get information on the given group or whether or not a user is a member of the group. Args: name (string): Name of group to query. user_name (optional[string]): Supply None if not interested in determining if user is a member of the given group. Returns: ...
[ "Get", "information", "on", "the", "given", "group", "or", "whether", "or", "not", "a", "user", "is", "a", "member", "of", "the", "group", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L235-L253
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_group_members
def list_group_members(self, name): """ Get the members of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure. """ self.project_service.s...
python
def list_group_members(self, name): """ Get the members of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure. """ self.project_service.s...
[ "def", "list_group_members", "(", "self", ",", "name", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "list_group_members", "(", "name", ")" ]
Get the members of a group. Args: name (string): Name of group to query. Returns: (list[string]): List of member names. Raises: requests.HTTPError on failure.
[ "Get", "the", "members", "of", "a", "group", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L287-L301
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_permissions
def get_permissions(self, grp_name, resource): """ Get permissions associated the group has with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. ...
python
def get_permissions(self, grp_name, resource): """ Get permissions associated the group has with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. ...
[ "def", "get_permissions", "(", "self", ",", "grp_name", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_permissions", "(", "grp_name", ",",...
Get permissions associated the group has with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. Returns: (list): List of permissions. Raise...
[ "Get", "permissions", "associated", "the", "group", "has", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L432-L448
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.add_permissions
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to ...
python
def add_permissions(self, grp_name, resource, permissions): """ Add additional permissions for the group associated with the resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to ...
[ "def", "add_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "add_permissions", "(", "grp_n...
Add additional permissions for the group associated with the resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on. permissions (list): List of permissions to add to the gi...
[ "Add", "additional", "permissions", "for", "the", "group", "associated", "with", "the", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L450-L464
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.update_permissions
def update_permissions(self, grp_name, resource, permissions): """ Update permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to...
python
def update_permissions(self, grp_name, resource, permissions): """ Update permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to...
[ "def", "update_permissions", "(", "self", ",", "grp_name", ",", "resource", ",", "permissions", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "update_permissions", "(", ...
Update permissions for the group associated with the given resource. Args: grp_name (string): Name of group. resource (intern.resource.boss.Resource): Identifies which data model object to operate on permissions (list): List of permissions to add to the given...
[ "Update", "permissions", "for", "the", "group", "associated", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L466-L480
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_user_role
def delete_user_role(self, user, role): """ Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
python
def delete_user_role(self, user, role): """ Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
[ "def", "delete_user_role", "(", "self", ",", "user", ",", "role", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "self", ".", "project_service", ".", "delete_user_role", "(", "user", ",", "role", ")" ]
Remove role from given user. Args: user (string): User name. role (string): Role to remove. Raises: requests.HTTPError on failure.
[ "Remove", "role", "from", "given", "user", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L527-L539
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_user_groups
def get_user_groups(self, user): """ Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
python
def get_user_groups(self, user): """ Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure. """ self.project_service.set_auth(self._token_project) ...
[ "def", "get_user_groups", "(", "self", ",", "user", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "get_user_groups", "(", "user", ")" ]
Get user's group memberships. Args: user (string): User name. Returns: (list): User's groups. Raises: requests.HTTPError on failure.
[ "Get", "user", "s", "group", "memberships", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L557-L571
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote._list_resource
def _list_resource(self, resource): """ List all instances of the given resource type. Use the specific list_<resource>() methods instead: list_collections() list_experiments() list_channels() list_coordinate_frames() Args: re...
python
def _list_resource(self, resource): """ List all instances of the given resource type. Use the specific list_<resource>() methods instead: list_collections() list_experiments() list_channels() list_coordinate_frames() Args: re...
[ "def", "_list_resource", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "super", "(", "BossRemote", ",", "self", ")", ".", "list_project", "(", "resource", "=", "r...
List all instances of the given resource type. Use the specific list_<resource>() methods instead: list_collections() list_experiments() list_channels() list_coordinate_frames() Args: resource (intern.resource.boss.BossResource): resource.nam...
[ "List", "all", "instances", "of", "the", "given", "resource", "type", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L608-L629
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_experiments
def list_experiments(self, collection_name): """ List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure. """ exp ...
python
def list_experiments(self, collection_name): """ List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure. """ exp ...
[ "def", "list_experiments", "(", "self", ",", "collection_name", ")", ":", "exp", "=", "ExperimentResource", "(", "name", "=", "''", ",", "collection_name", "=", "collection_name", ",", "coord_frame", "=", "'foo'", ")", "return", "self", ".", "_list_resource", ...
List all experiments that belong to a collection. Args: collection_name (string): Name of the parent collection. Returns: (list) Raises: requests.HTTPError on failure.
[ "List", "all", "experiments", "that", "belong", "to", "a", "collection", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L644-L659
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_channels
def list_channels(self, collection_name, experiment_name): """ List all channels belonging to the named experiment that is part of the named collection. Args: collection_name (string): Name of the parent collection. experiment_name (string): Name of the parent ex...
python
def list_channels(self, collection_name, experiment_name): """ List all channels belonging to the named experiment that is part of the named collection. Args: collection_name (string): Name of the parent collection. experiment_name (string): Name of the parent ex...
[ "def", "list_channels", "(", "self", ",", "collection_name", ",", "experiment_name", ")", ":", "dont_care", "=", "'image'", "chan", "=", "ChannelResource", "(", "name", "=", "''", ",", "collection_name", "=", "collection_name", ",", "experiment_name", "=", "expe...
List all channels belonging to the named experiment that is part of the named collection. Args: collection_name (string): Name of the parent collection. experiment_name (string): Name of the parent experiment. Returns: (list) Raises: req...
[ "List", "all", "channels", "belonging", "to", "the", "named", "experiment", "that", "is", "part", "of", "the", "named", "collection", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L661-L680
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.create_project
def create_project(self, resource): """ Create the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Ra...
python
def create_project(self, resource): """ Create the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Ra...
[ "def", "create_project", "(", "self", ",", "resource", ")", ":", "self", ".", "project_service", ".", "set_auth", "(", "self", ".", "_token_project", ")", "return", "self", ".", "project_service", ".", "create", "(", "resource", ")" ]
Create the entity described by the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (intern.resource.boss.BossResource): Returns resource of type requested on success. Raises: requests.HTTPError on failure.
[ "Create", "the", "entity", "described", "by", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L710-L725
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.list_metadata
def list_metadata(self, resource): """ List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure. """ self.metadata_service.se...
python
def list_metadata(self, resource): """ List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure. """ self.metadata_service.se...
[ "def", "list_metadata", "(", "self", ",", "resource", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "return", "self", ".", "metadata_service", ".", "list", "(", "resource", ")" ]
List all keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) Returns: (list) Raises: requests.HTTPError on a failure.
[ "List", "all", "keys", "associated", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L778-L792
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.create_metadata
def create_metadata(self, resource, keys_vals): """ Associates new key-value pairs with the given resource. Will attempt to add all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-va...
python
def create_metadata(self, resource, keys_vals): """ Associates new key-value pairs with the given resource. Will attempt to add all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-va...
[ "def", "create_metadata", "(", "self", ",", "resource", ",", "keys_vals", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "create", "(", "resource", ",", "keys_vals", ...
Associates new key-value pairs with the given resource. Will attempt to add all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-value pairs to assign to given resource. Rais...
[ "Associates", "new", "key", "-", "value", "pairs", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L794-L809
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.get_metadata
def get_metadata(self, resource, keys): """ Gets the values for given keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) keys (list) Returns: (dictionary) Raises: HTTPErrorList on failure....
python
def get_metadata(self, resource, keys): """ Gets the values for given keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) keys (list) Returns: (dictionary) Raises: HTTPErrorList on failure....
[ "def", "get_metadata", "(", "self", ",", "resource", ",", "keys", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "return", "self", ".", "metadata_service", ".", "get", "(", "resource", ",", "keys", ")"...
Gets the values for given keys associated with the given resource. Args: resource (intern.resource.boss.BossResource) keys (list) Returns: (dictionary) Raises: HTTPErrorList on failure.
[ "Gets", "the", "values", "for", "given", "keys", "associated", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L811-L826
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.update_metadata
def update_metadata(self, resource, keys_vals): """ Updates key-value pairs with the given resource. Will attempt to update all key-value pairs even if some fail. Keys must already exist. Args: resource (intern.resource.boss.BossResource) keys_vals (dict...
python
def update_metadata(self, resource, keys_vals): """ Updates key-value pairs with the given resource. Will attempt to update all key-value pairs even if some fail. Keys must already exist. Args: resource (intern.resource.boss.BossResource) keys_vals (dict...
[ "def", "update_metadata", "(", "self", ",", "resource", ",", "keys_vals", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "update", "(", "resource", ",", "keys_vals", ...
Updates key-value pairs with the given resource. Will attempt to update all key-value pairs even if some fail. Keys must already exist. Args: resource (intern.resource.boss.BossResource) keys_vals (dictionary): Collection of key-value pairs to update on ...
[ "Updates", "key", "-", "value", "pairs", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L828-L844
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.delete_metadata
def delete_metadata(self, resource, keys): """ Deletes the given key-value pairs associated with the given resource. Will attempt to delete all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys (list) Raises: ...
python
def delete_metadata(self, resource, keys): """ Deletes the given key-value pairs associated with the given resource. Will attempt to delete all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys (list) Raises: ...
[ "def", "delete_metadata", "(", "self", ",", "resource", ",", "keys", ")", ":", "self", ".", "metadata_service", ".", "set_auth", "(", "self", ".", "_token_metadata", ")", "self", ".", "metadata_service", ".", "delete", "(", "resource", ",", "keys", ")" ]
Deletes the given key-value pairs associated with the given resource. Will attempt to delete all key-value pairs even if some fail. Args: resource (intern.resource.boss.BossResource) keys (list) Raises: HTTPErrorList on failure.
[ "Deletes", "the", "given", "key", "-", "value", "pairs", "associated", "with", "the", "given", "resource", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L846-L860
train
jhuapl-boss/intern
intern/remote/boss/remote.py
BossRemote.parse_bossURI
def parse_bossURI(self, uri): # type: (str) -> Resource """ Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource """ t = uri.split("://")[1].split("/")...
python
def parse_bossURI(self, uri): # type: (str) -> Resource """ Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource """ t = uri.split("://")[1].split("/")...
[ "def", "parse_bossURI", "(", "self", ",", "uri", ")", ":", "t", "=", "uri", ".", "split", "(", "\"://\"", ")", "[", "1", "]", ".", "split", "(", "\"/\"", ")", "if", "len", "(", "t", ")", "is", "3", ":", "return", "self", ".", "get_channel", "("...
Parse a bossDB URI and handle malform errors. Arguments: uri (str): URI of the form bossdb://<collection>/<experiment>/<channel> Returns: Resource
[ "Parse", "a", "bossDB", "URI", "and", "handle", "malform", "errors", "." ]
d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed
https://github.com/jhuapl-boss/intern/blob/d8fc6df011d8f212c87e6a1fd4cc21cfb5d103ed/intern/remote/boss/remote.py#L862-L876
train
rmorshea/spectate
spectate/mvc/base.py
views
def views(model: "Model") -> list: """Return a model's views keyed on what events they respond to. Model views are added by calling :func:`view` on a model. """ if not isinstance(model, Model): raise TypeError("Expected a Model, not %r." % model) return model._model_views[:]
python
def views(model: "Model") -> list: """Return a model's views keyed on what events they respond to. Model views are added by calling :func:`view` on a model. """ if not isinstance(model, Model): raise TypeError("Expected a Model, not %r." % model) return model._model_views[:]
[ "def", "views", "(", "model", ":", "\"Model\"", ")", "->", "list", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r.\"", "%", "model", ")", "return", "model", ".", "_model_views", ...
Return a model's views keyed on what events they respond to. Model views are added by calling :func:`view` on a model.
[ "Return", "a", "model", "s", "views", "keyed", "on", "what", "events", "they", "respond", "to", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L14-L21
train
rmorshea/spectate
spectate/mvc/base.py
view
def view(model: "Model", *functions: Callable) -> Optional[Callable]: """A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc i...
python
def view(model: "Model", *functions: Callable) -> Optional[Callable]: """A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc i...
[ "def", "view", "(", "model", ":", "\"Model\"", ",", "*", "functions", ":", "Callable", ")", "->", "Optional", "[", "Callable", "]", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r...
A decorator for registering a callback to a model Parameters: model: the model object whose changes the callback should respond to. Examples: .. code-block:: python from spectate import mvc items = mvc.List() @mvc.view(items) def printer(items...
[ "A", "decorator", "for", "registering", "a", "callback", "to", "a", "model" ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L24-L55
train
rmorshea/spectate
spectate/mvc/base.py
Control.before
def before(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts before the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If ...
python
def before(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts before the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If ...
[ "def", "before", "(", "self", ",", "callback", ":", "Union", "[", "Callable", ",", "str", "]", ")", "->", "\"Control\"", ":", "if", "isinstance", "(", "callback", ",", "Control", ")", ":", "callback", "=", "callback", ".", "_before", "self", ".", "_bef...
Register a control method that reacts before the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If given as a string, then the control will look up a method ...
[ "Register", "a", "control", "method", "that", "reacts", "before", "the", "trigger", "method", "is", "called", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L137-L149
train
rmorshea/spectate
spectate/mvc/base.py
Control.after
def after(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts after the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If gi...
python
def after(self, callback: Union[Callable, str]) -> "Control": """Register a control method that reacts after the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If gi...
[ "def", "after", "(", "self", ",", "callback", ":", "Union", "[", "Callable", ",", "str", "]", ")", "->", "\"Control\"", ":", "if", "isinstance", "(", "callback", ",", "Control", ")", ":", "callback", "=", "callback", ".", "_after", "self", ".", "_after...
Register a control method that reacts after the trigger method is called. Parameters: callback: The control method. If given as a callable, then that function will be used as the callback. If given as a string, then the control will look up a method w...
[ "Register", "a", "control", "method", "that", "reacts", "after", "the", "trigger", "method", "is", "called", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/base.py#L151-L163
train
witchard/grole
grole.py
serve_static
def serve_static(app, base_url, base_path, index=False): """ Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if Tr...
python
def serve_static(app, base_url, base_path, index=False): """ Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if Tr...
[ "def", "serve_static", "(", "app", ",", "base_url", ",", "base_path", ",", "index", "=", "False", ")", ":", "@", "app", ".", "route", "(", "base_url", "+", "'/(.*)'", ")", "def", "serve", "(", "env", ",", "req", ")", ":", "try", ":", "base", "=", ...
Serve a directory statically Parameters: * app: Grole application object * base_url: Base URL to serve from, e.g. /static * base_path: Base path to look for files in * index: Provide simple directory indexes if True
[ "Serve", "a", "directory", "statically" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L242-L282
train
witchard/grole
grole.py
serve_doc
def serve_doc(app, url): """ Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at """ @app.route(url, doc=False) def index(env, req): ret = '' for d in env['doc']: ret += ...
python
def serve_doc(app, url): """ Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at """ @app.route(url, doc=False) def index(env, req): ret = '' for d in env['doc']: ret += ...
[ "def", "serve_doc", "(", "app", ",", "url", ")", ":", "@", "app", ".", "route", "(", "url", ",", "doc", "=", "False", ")", "def", "index", "(", "env", ",", "req", ")", ":", "ret", "=", "''", "for", "d", "in", "env", "[", "'doc'", "]", ":", ...
Serve API documentation extracted from request handler docstrings Parameters: * app: Grole application object * url: URL to serve at
[ "Serve", "API", "documentation", "extracted", "from", "request", "handler", "docstrings" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L284-L297
train
witchard/grole
grole.py
parse_args
def parse_args(args=sys.argv[1:]): """ Parse command line arguments for Grole server running as static file server """ parser = argparse.ArgumentParser() parser.add_argument('-a', '--address', help='address to listen on, default localhost', default='localhost') pa...
python
def parse_args(args=sys.argv[1:]): """ Parse command line arguments for Grole server running as static file server """ parser = argparse.ArgumentParser() parser.add_argument('-a', '--address', help='address to listen on, default localhost', default='localhost') pa...
[ "def", "parse_args", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "'-a'", ",", "'--address'", ",", "help", "=", "'address to listen on,...
Parse command line arguments for Grole server running as static file server
[ "Parse", "command", "line", "arguments", "for", "Grole", "server", "running", "as", "static", "file", "server" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L413-L431
train
witchard/grole
grole.py
main
def main(args=sys.argv[1:]): """ Run Grole static file server """ args = parse_args(args) if args.verbose: logging.basicConfig(level=logging.DEBUG) elif args.quiet: logging.basicConfig(level=logging.ERROR) else: logging.basicConfig(level=logging.INFO) app = Grole(...
python
def main(args=sys.argv[1:]): """ Run Grole static file server """ args = parse_args(args) if args.verbose: logging.basicConfig(level=logging.DEBUG) elif args.quiet: logging.basicConfig(level=logging.ERROR) else: logging.basicConfig(level=logging.INFO) app = Grole(...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "args", "=", "parse_args", "(", "args", ")", "if", "args", ".", "verbose", ":", "logging", ".", "basicConfig", "(", "level", "=", "logging", ".", "DEBUG", ")", "el...
Run Grole static file server
[ "Run", "Grole", "static", "file", "server" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L433-L446
train
witchard/grole
grole.py
Request._read
async def _read(self, reader): """ Parses HTTP request into member variables """ start_line = await self._readline(reader) self.method, self.location, self.version = start_line.decode().split() path_query = urllib.parse.unquote(self.location).split('?', 1) self.pa...
python
async def _read(self, reader): """ Parses HTTP request into member variables """ start_line = await self._readline(reader) self.method, self.location, self.version = start_line.decode().split() path_query = urllib.parse.unquote(self.location).split('?', 1) self.pa...
[ "async", "def", "_read", "(", "self", ",", "reader", ")", ":", "start_line", "=", "await", "self", ".", "_readline", "(", "reader", ")", "self", ".", "method", ",", "self", ".", "location", ",", "self", ".", "version", "=", "start_line", ".", "decode",...
Parses HTTP request into member variables
[ "Parses", "HTTP", "request", "into", "member", "variables" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L40-L66
train
witchard/grole
grole.py
Request._buffer_body
async def _buffer_body(self, reader): """ Buffers the body of the request """ remaining = int(self.headers.get('Content-Length', 0)) if remaining > 0: try: self.data = await reader.readexactly(remaining) except asyncio.IncompleteReadError: ...
python
async def _buffer_body(self, reader): """ Buffers the body of the request """ remaining = int(self.headers.get('Content-Length', 0)) if remaining > 0: try: self.data = await reader.readexactly(remaining) except asyncio.IncompleteReadError: ...
[ "async", "def", "_buffer_body", "(", "self", ",", "reader", ")", ":", "remaining", "=", "int", "(", "self", ".", "headers", ".", "get", "(", "'Content-Length'", ",", "0", ")", ")", "if", "remaining", ">", "0", ":", "try", ":", "self", ".", "data", ...
Buffers the body of the request
[ "Buffers", "the", "body", "of", "the", "request" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L77-L86
train
witchard/grole
grole.py
Grole.route
def route(self, path_regex, methods=['GET'], doc=True): """ Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc struct...
python
def route(self, path_regex, methods=['GET'], doc=True): """ Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc struct...
[ "def", "route", "(", "self", ",", "path_regex", ",", "methods", "=", "[", "'GET'", "]", ",", "doc", "=", "True", ")", ":", "def", "register_func", "(", "func", ")", ":", "if", "doc", ":", "self", ".", "env", "[", "'doc'", "]", ".", "append", "(",...
Decorator to register a handler Parameters: * path_regex: Request path regex to match against for running the handler * methods: HTTP methods to use this handler for * doc: Add to internal doc structure
[ "Decorator", "to", "register", "a", "handler" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L316-L334
train
witchard/grole
grole.py
Grole._handle
async def _handle(self, reader, writer): """ Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses """ peer = writer.get_extra_info('peername') self._logger.debug('New connection from {}'.format(peer)) try: #...
python
async def _handle(self, reader, writer): """ Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses """ peer = writer.get_extra_info('peername') self._logger.debug('New connection from {}'.format(peer)) try: #...
[ "async", "def", "_handle", "(", "self", ",", "reader", ",", "writer", ")", ":", "peer", "=", "writer", ".", "get_extra_info", "(", "'peername'", ")", "self", ".", "_logger", ".", "debug", "(", "'New connection from {}'", ".", "format", "(", "peer", ")", ...
Handle a single TCP connection Parses requests, finds appropriate handlers and returns responses
[ "Handle", "a", "single", "TCP", "connection" ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L336-L381
train
witchard/grole
grole.py
Grole.run
def run(self, host='localhost', port=1234): """ Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on """ # Setup loop loop = asyncio.get_event_loop() ...
python
def run(self, host='localhost', port=1234): """ Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on """ # Setup loop loop = asyncio.get_event_loop() ...
[ "def", "run", "(", "self", ",", "host", "=", "'localhost'", ",", "port", "=", "1234", ")", ":", "loop", "=", "asyncio", ".", "get_event_loop", "(", ")", "coro", "=", "asyncio", ".", "start_server", "(", "self", ".", "_handle", ",", "host", ",", "port...
Launch the server. Will run forever accepting connections until interrupted. Parameters: * host: The host to listen on * port: The port to listen on
[ "Launch", "the", "server", ".", "Will", "run", "forever", "accepting", "connections", "until", "interrupted", "." ]
54c0bd13e4d4c74a2997ec4254527d937d6e0565
https://github.com/witchard/grole/blob/54c0bd13e4d4c74a2997ec4254527d937d6e0565/grole.py#L383-L411
train
rmorshea/spectate
spectate/mvc/events.py
hold
def hold(model: Model, reducer: Optional[Callable] = None) -> Iterator[list]: """Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desi...
python
def hold(model: Model, reducer: Optional[Callable] = None) -> Iterator[list]: """Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desi...
[ "def", "hold", "(", "model", ":", "Model", ",", "reducer", ":", "Optional", "[", "Callable", "]", "=", "None", ")", "->", "Iterator", "[", "list", "]", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", ...
Temporarilly withold change events in a modifiable list. All changes that are captured within a "hold" context are forwarded to a list which is yielded to the user before being sent to views of the given ``model``. If desired, the user may modify the list of events before the context is left in order t...
[ "Temporarilly", "withold", "change", "events", "in", "a", "modifiable", "list", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L12-L76
train
rmorshea/spectate
spectate/mvc/events.py
rollback
def rollback( model: Model, undo: Optional[Callable] = None, *args, **kwargs ) -> Iterator[list]: """Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for revers...
python
def rollback( model: Model, undo: Optional[Callable] = None, *args, **kwargs ) -> Iterator[list]: """Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for revers...
[ "def", "rollback", "(", "model", ":", "Model", ",", "undo", ":", "Optional", "[", "Callable", "]", "=", "None", ",", "*", "args", ",", "**", "kwargs", ")", "->", "Iterator", "[", "list", "]", ":", "with", "hold", "(", "model", ",", "*", "args", "...
Withold events if an error occurs. Generall operate Parameters: model: The model object whose change events may be witheld. undo: An optional function for reversing any changes that may have taken place. Its signature is ``(model, events, error)`` where ``mo...
[ "Withold", "events", "if", "an", "error", "occurs", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L80-L156
train
rmorshea/spectate
spectate/mvc/events.py
mute
def mute(model: Model): """Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change e...
python
def mute(model: Model): """Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change e...
[ "def", "mute", "(", "model", ":", "Model", ")", ":", "if", "not", "isinstance", "(", "model", ",", "Model", ")", ":", "raise", "TypeError", "(", "\"Expected a Model, not %r.\"", "%", "model", ")", "restore", "=", "model", ".", "__dict__", ".", "get", "("...
Block a model's views from being notified. All changes within a "mute" context will be blocked. No content is yielded to the user as in :func:`hold`, and the views of the model are never notified that changes took place. Parameters: mode: The model whose change events will be blocked. Exa...
[ "Block", "a", "model", "s", "views", "from", "being", "notified", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/mvc/events.py#L160-L197
train
rmorshea/spectate
spectate/core.py
expose
def expose(*methods): """A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose m...
python
def expose(*methods): """A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose m...
[ "def", "expose", "(", "*", "methods", ")", ":", "def", "setup", "(", "base", ")", ":", "return", "expose_as", "(", "base", ".", "__name__", ",", "base", ",", "*", "methods", ")", "return", "setup" ]
A decorator for exposing the methods of a class. Parameters ---------- *methods : str A str representation of the methods that should be exposed to callbacks. Returns ------- decorator : function A function accepting one argument - the class whose methods will be expose...
[ "A", "decorator", "for", "exposing", "the", "methods", "of", "a", "class", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L250-L273
train
rmorshea/spectate
spectate/core.py
expose_as
def expose_as(name, base, *methods): """Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the method...
python
def expose_as(name, base, *methods): """Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the method...
[ "def", "expose_as", "(", "name", ",", "base", ",", "*", "methods", ")", ":", "classdict", "=", "{", "}", "for", "method", "in", "methods", ":", "if", "not", "hasattr", "(", "base", ",", "method", ")", ":", "raise", "AttributeError", "(", "\"Cannot expo...
Return a new type with certain methods that are exposed to callback registration. Parameters ---------- name : str The name of the new type. base : type A type such as list or dict. *methods : str A str representation of the methods that should be exposed to callbacks. ...
[ "Return", "a", "new", "type", "with", "certain", "methods", "that", "are", "exposed", "to", "callback", "registration", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L276-L302
train
rmorshea/spectate
spectate/core.py
Spectator.callback
def callback(self, name, before=None, after=None): """Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. ...
python
def callback(self, name, before=None, after=None): """Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. ...
[ "def", "callback", "(", "self", ",", "name", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "name", "in", "name", ":", "self", ".", "callback...
Add a callback pair to this spectator. You can specify, with keywords, whether each callback should be triggered before, and/or or after a given method is called - hereafter refered to as "beforebacks" and "afterbacks" respectively. Parameters ---------- name: str ...
[ "Add", "a", "callback", "pair", "to", "this", "spectator", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L74-L117
train
rmorshea/spectate
spectate/core.py
Spectator.remove_callback
def remove_callback(self, name, before=None, after=None): """Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parame...
python
def remove_callback(self, name, before=None, after=None): """Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parame...
[ "def", "remove_callback", "(", "self", ",", "name", ",", "before", "=", "None", ",", "after", "=", "None", ")", ":", "if", "isinstance", "(", "name", ",", "(", "list", ",", "tuple", ")", ")", ":", "for", "name", "in", "name", ":", "self", ".", "r...
Remove a beforeback, and afterback pair from this Spectator If ``before`` and ``after`` are None then all callbacks for the given method will be removed. Otherwise, only the exact callback pair will be removed. Parameters ---------- name: str The name of the...
[ "Remove", "a", "beforeback", "and", "afterback", "pair", "from", "this", "Spectator" ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L119-L149
train
rmorshea/spectate
spectate/core.py
Spectator.call
def call(self, obj, name, method, args, kwargs): """Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method ...
python
def call(self, obj, name, method, args, kwargs): """Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method ...
[ "def", "call", "(", "self", ",", "obj", ",", "name", ",", "method", ",", "args", ",", "kwargs", ")", ":", "if", "name", "in", "self", ".", "_callback_registry", ":", "beforebacks", ",", "afterbacks", "=", "zip", "(", "*", "self", ".", "_callback_regist...
Trigger a method along with its beforebacks and afterbacks. Parameters ---------- name: str The name of the method that will be called args: tuple The arguments that will be passed to the base method kwargs: dict The keyword args that will be ...
[ "Trigger", "a", "method", "along", "with", "its", "beforebacks", "and", "afterbacks", "." ]
79bd84dd8d00889015ce1d1e190db865a02cdb93
https://github.com/rmorshea/spectate/blob/79bd84dd8d00889015ce1d1e190db865a02cdb93/spectate/core.py#L151-L186
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
cut_to_length
def cut_to_length(text, length, delim): """Shorten given text on first delimiter after given number of characters. """ cut = text.find(delim, length) if cut > -1: return text[:cut] else: return text
python
def cut_to_length(text, length, delim): """Shorten given text on first delimiter after given number of characters. """ cut = text.find(delim, length) if cut > -1: return text[:cut] else: return text
[ "def", "cut_to_length", "(", "text", ",", "length", ",", "delim", ")", ":", "cut", "=", "text", ".", "find", "(", "delim", ",", "length", ")", "if", "cut", ">", "-", "1", ":", "return", "text", "[", ":", "cut", "]", "else", ":", "return", "text" ...
Shorten given text on first delimiter after given number of characters.
[ "Shorten", "given", "text", "on", "first", "delimiter", "after", "given", "number", "of", "characters", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L32-L40
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
get_interpreter_path
def get_interpreter_path(version=None): """Return the executable of a specified or current version.""" if version and version != str(sys.version_info[0]): return settings.PYTHON_INTERPRETER + version else: return sys.executable
python
def get_interpreter_path(version=None): """Return the executable of a specified or current version.""" if version and version != str(sys.version_info[0]): return settings.PYTHON_INTERPRETER + version else: return sys.executable
[ "def", "get_interpreter_path", "(", "version", "=", "None", ")", ":", "if", "version", "and", "version", "!=", "str", "(", "sys", ".", "version_info", "[", "0", "]", ")", ":", "return", "settings", ".", "PYTHON_INTERPRETER", "+", "version", "else", ":", ...
Return the executable of a specified or current version.
[ "Return", "the", "executable", "of", "a", "specified", "or", "current", "version", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L43-L48
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
pypi_metadata_extension
def pypi_metadata_extension(extraction_fce): """Extracts data from PyPI and merges them with data from extraction method. """ def inner(self, client=None): data = extraction_fce(self) if client is None: logger.warning("Client is None, it was probably disabled") d...
python
def pypi_metadata_extension(extraction_fce): """Extracts data from PyPI and merges them with data from extraction method. """ def inner(self, client=None): data = extraction_fce(self) if client is None: logger.warning("Client is None, it was probably disabled") d...
[ "def", "pypi_metadata_extension", "(", "extraction_fce", ")", ":", "def", "inner", "(", "self", ",", "client", "=", "None", ")", ":", "data", "=", "extraction_fce", "(", "self", ")", "if", "client", "is", "None", ":", "logger", ".", "warning", "(", "\"Cl...
Extracts data from PyPI and merges them with data from extraction method.
[ "Extracts", "data", "from", "PyPI", "and", "merges", "them", "with", "data", "from", "extraction", "method", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L88-L120
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
venv_metadata_extension
def venv_metadata_extension(extraction_fce): """Extracts specific metadata from virtualenv object, merges them with data from given extraction method. """ def inner(self): data = extraction_fce(self) if virtualenv is None or not self.venv: logger.debug("Skipping virtualenv m...
python
def venv_metadata_extension(extraction_fce): """Extracts specific metadata from virtualenv object, merges them with data from given extraction method. """ def inner(self): data = extraction_fce(self) if virtualenv is None or not self.venv: logger.debug("Skipping virtualenv m...
[ "def", "venv_metadata_extension", "(", "extraction_fce", ")", ":", "def", "inner", "(", "self", ")", ":", "data", "=", "extraction_fce", "(", "self", ")", "if", "virtualenv", "is", "None", "or", "not", "self", ".", "venv", ":", "logger", ".", "debug", "(...
Extracts specific metadata from virtualenv object, merges them with data from given extraction method.
[ "Extracts", "specific", "metadata", "from", "virtualenv", "object", "merges", "them", "with", "data", "from", "given", "extraction", "method", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L123-L146
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
process_description
def process_description(description_fce): """Removes special character delimiters, titles and wraps paragraphs. """ def inner(description): clear_description = \ re.sub(r'\s+', ' ', # multiple whitespaces # general URLs re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*...
python
def process_description(description_fce): """Removes special character delimiters, titles and wraps paragraphs. """ def inner(description): clear_description = \ re.sub(r'\s+', ' ', # multiple whitespaces # general URLs re.sub(r'\w+:\/{2}[\d\w-]+(\.[\d\w-]+)*...
[ "def", "process_description", "(", "description_fce", ")", ":", "def", "inner", "(", "description", ")", ":", "clear_description", "=", "re", ".", "sub", "(", "r'\\s+'", ",", "' '", ",", "re", ".", "sub", "(", "r'\\w+:\\/{2}[\\d\\w-]+(\\.[\\d\\w-]+)*(?:(?:\\/[^\\s...
Removes special character delimiters, titles and wraps paragraphs.
[ "Removes", "special", "character", "delimiters", "titles", "and", "wraps", "paragraphs", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L149-L167
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
LocalMetadataExtractor.versions_from_archive
def versions_from_archive(self): """Return Python versions extracted from trove classifiers. """ py_vers = versions_from_trove(self.classifiers) return [ver for ver in py_vers if ver != self.unsupported_version]
python
def versions_from_archive(self): """Return Python versions extracted from trove classifiers. """ py_vers = versions_from_trove(self.classifiers) return [ver for ver in py_vers if ver != self.unsupported_version]
[ "def", "versions_from_archive", "(", "self", ")", ":", "py_vers", "=", "versions_from_trove", "(", "self", ".", "classifiers", ")", "return", "[", "ver", "for", "ver", "in", "py_vers", "if", "ver", "!=", "self", ".", "unsupported_version", "]" ]
Return Python versions extracted from trove classifiers.
[ "Return", "Python", "versions", "extracted", "from", "trove", "classifiers", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L205-L208
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
LocalMetadataExtractor.srcname
def srcname(self): """Return srcname for the macro if the pypi name should be changed. Those cases are: - name was provided with -r option - pypi name is like python-<name> """ if self.rpm_name or self.name.startswith(('python-', 'Python-')): return self.name...
python
def srcname(self): """Return srcname for the macro if the pypi name should be changed. Those cases are: - name was provided with -r option - pypi name is like python-<name> """ if self.rpm_name or self.name.startswith(('python-', 'Python-')): return self.name...
[ "def", "srcname", "(", "self", ")", ":", "if", "self", ".", "rpm_name", "or", "self", ".", "name", ".", "startswith", "(", "(", "'python-'", ",", "'Python-'", ")", ")", ":", "return", "self", ".", "name_convertor", ".", "base_name", "(", "self", ".", ...
Return srcname for the macro if the pypi name should be changed. Those cases are: - name was provided with -r option - pypi name is like python-<name>
[ "Return", "srcname", "for", "the", "macro", "if", "the", "pypi", "name", "should", "be", "changed", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L235-L243
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
SetupPyMetadataExtractor.runtime_deps
def runtime_deps(self): # install_requires """Returns list of runtime dependencies of the package specified in setup.py. Dependencies are in RPM SPECFILE format - see dependency_to_rpm() for details, but names are already transformed according to current distro. Return...
python
def runtime_deps(self): # install_requires """Returns list of runtime dependencies of the package specified in setup.py. Dependencies are in RPM SPECFILE format - see dependency_to_rpm() for details, but names are already transformed according to current distro. Return...
[ "def", "runtime_deps", "(", "self", ")", ":", "install_requires", "=", "self", ".", "metadata", "[", "'install_requires'", "]", "if", "self", ".", "metadata", "[", "'entry_points'", "]", "and", "'setuptools'", "not", "in", "install_requires", ":", "install_requi...
Returns list of runtime dependencies of the package specified in setup.py. Dependencies are in RPM SPECFILE format - see dependency_to_rpm() for details, but names are already transformed according to current distro. Returns: list of runtime dependencies of the pack...
[ "Returns", "list", "of", "runtime", "dependencies", "of", "the", "package", "specified", "in", "setup", ".", "py", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L370-L387
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
SetupPyMetadataExtractor.build_deps
def build_deps(self): # setup_requires [tests_require, install_requires] """Same as runtime_deps, but build dependencies. Test and install requires are included if package contains test suite to prevent %check phase crashes because of missing dependencies Returns: list of b...
python
def build_deps(self): # setup_requires [tests_require, install_requires] """Same as runtime_deps, but build dependencies. Test and install requires are included if package contains test suite to prevent %check phase crashes because of missing dependencies Returns: list of b...
[ "def", "build_deps", "(", "self", ")", ":", "build_requires", "=", "self", ".", "metadata", "[", "'setup_requires'", "]", "if", "self", ".", "has_test_suite", ":", "build_requires", "+=", "self", ".", "metadata", "[", "'tests_require'", "]", "+", "self", "."...
Same as runtime_deps, but build dependencies. Test and install requires are included if package contains test suite to prevent %check phase crashes because of missing dependencies Returns: list of build dependencies of the package
[ "Same", "as", "runtime_deps", "but", "build", "dependencies", ".", "Test", "and", "install", "requires", "are", "included", "if", "package", "contains", "test", "suite", "to", "prevent", "%check", "phase", "crashes", "because", "of", "missing", "dependencies" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L390-L407
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
SetupPyMetadataExtractor.data_from_archive
def data_from_archive(self): """Appends setup.py specific metadata to archive_data.""" archive_data = super(SetupPyMetadataExtractor, self).data_from_archive archive_data['has_packages'] = self.has_packages archive_data['packages'] = self.packages archive_data['has_bundled_egg_...
python
def data_from_archive(self): """Appends setup.py specific metadata to archive_data.""" archive_data = super(SetupPyMetadataExtractor, self).data_from_archive archive_data['has_packages'] = self.has_packages archive_data['packages'] = self.packages archive_data['has_bundled_egg_...
[ "def", "data_from_archive", "(", "self", ")", ":", "archive_data", "=", "super", "(", "SetupPyMetadataExtractor", ",", "self", ")", ".", "data_from_archive", "archive_data", "[", "'has_packages'", "]", "=", "self", ".", "has_packages", "archive_data", "[", "'packa...
Appends setup.py specific metadata to archive_data.
[ "Appends", "setup", ".", "py", "specific", "metadata", "to", "archive_data", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L518-L533
train
fedora-python/pyp2rpm
pyp2rpm/metadata_extractors.py
WheelMetadataExtractor.get_requires
def get_requires(self, requires_types): """Extracts requires of given types from metadata file, filter windows specific requires. """ if not isinstance(requires_types, list): requires_types = list(requires_types) extracted_requires = [] for requires_name in re...
python
def get_requires(self, requires_types): """Extracts requires of given types from metadata file, filter windows specific requires. """ if not isinstance(requires_types, list): requires_types = list(requires_types) extracted_requires = [] for requires_name in re...
[ "def", "get_requires", "(", "self", ",", "requires_types", ")", ":", "if", "not", "isinstance", "(", "requires_types", ",", "list", ")", ":", "requires_types", "=", "list", "(", "requires_types", ")", "extracted_requires", "=", "[", "]", "for", "requires_name"...
Extracts requires of given types from metadata file, filter windows specific requires.
[ "Extracts", "requires", "of", "given", "types", "from", "metadata", "file", "filter", "windows", "specific", "requires", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/metadata_extractors.py#L545-L557
train
fedora-python/pyp2rpm
pyp2rpm/package_getters.py
get_url
def get_url(client, name, version, wheel=False, hashed_format=False): """Retrieves list of package URLs using PyPI's XML-RPC. Chooses URL of prefered archive and md5_digest. """ try: release_urls = client.release_urls(name, version) release_data = client.release_data(name, version) e...
python
def get_url(client, name, version, wheel=False, hashed_format=False): """Retrieves list of package URLs using PyPI's XML-RPC. Chooses URL of prefered archive and md5_digest. """ try: release_urls = client.release_urls(name, version) release_data = client.release_data(name, version) e...
[ "def", "get_url", "(", "client", ",", "name", ",", "version", ",", "wheel", "=", "False", ",", "hashed_format", "=", "False", ")", ":", "try", ":", "release_urls", "=", "client", ".", "release_urls", "(", "name", ",", "version", ")", "release_data", "=",...
Retrieves list of package URLs using PyPI's XML-RPC. Chooses URL of prefered archive and md5_digest.
[ "Retrieves", "list", "of", "package", "URLs", "using", "PyPI", "s", "XML", "-", "RPC", ".", "Chooses", "URL", "of", "prefered", "archive", "and", "md5_digest", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/package_getters.py#L25-L78
train
fedora-python/pyp2rpm
pyp2rpm/virtualenv.py
DirsContent.fill
def fill(self, path): ''' Scans content of directories ''' self.bindir = set(os.listdir(path + 'bin/')) self.lib_sitepackages = set(os.listdir(glob.glob( path + 'lib/python?.?/site-packages/')[0]))
python
def fill(self, path): ''' Scans content of directories ''' self.bindir = set(os.listdir(path + 'bin/')) self.lib_sitepackages = set(os.listdir(glob.glob( path + 'lib/python?.?/site-packages/')[0]))
[ "def", "fill", "(", "self", ",", "path", ")", ":", "self", ".", "bindir", "=", "set", "(", "os", ".", "listdir", "(", "path", "+", "'bin/'", ")", ")", "self", ".", "lib_sitepackages", "=", "set", "(", "os", ".", "listdir", "(", "glob", ".", "glob...
Scans content of directories
[ "Scans", "content", "of", "directories" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/virtualenv.py#L39-L45
train
fedora-python/pyp2rpm
pyp2rpm/virtualenv.py
VirtualEnv.install_package_to_venv
def install_package_to_venv(self): ''' Installs package given as first argument to virtualenv without dependencies ''' try: self.env.install(self.name, force=True, options=["--no-deps"]) except (ve.PackageInstallationException, ve.VirtualenvRea...
python
def install_package_to_venv(self): ''' Installs package given as first argument to virtualenv without dependencies ''' try: self.env.install(self.name, force=True, options=["--no-deps"]) except (ve.PackageInstallationException, ve.VirtualenvRea...
[ "def", "install_package_to_venv", "(", "self", ")", ":", "try", ":", "self", ".", "env", ".", "install", "(", "self", ".", "name", ",", "force", "=", "True", ",", "options", "=", "[", "\"--no-deps\"", "]", ")", "except", "(", "ve", ".", "PackageInstall...
Installs package given as first argument to virtualenv without dependencies
[ "Installs", "package", "given", "as", "first", "argument", "to", "virtualenv", "without", "dependencies" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/virtualenv.py#L81-L92
train
fedora-python/pyp2rpm
pyp2rpm/virtualenv.py
VirtualEnv.get_dirs_differance
def get_dirs_differance(self): ''' Makes final versions of site_packages and scripts using DirsContent sub method and filters ''' try: diff = self.dirs_after_install - self.dirs_before_install except ValueError: raise VirtualenvFailException( ...
python
def get_dirs_differance(self): ''' Makes final versions of site_packages and scripts using DirsContent sub method and filters ''' try: diff = self.dirs_after_install - self.dirs_before_install except ValueError: raise VirtualenvFailException( ...
[ "def", "get_dirs_differance", "(", "self", ")", ":", "try", ":", "diff", "=", "self", ".", "dirs_after_install", "-", "self", ".", "dirs_before_install", "except", "ValueError", ":", "raise", "VirtualenvFailException", "(", "\"Some of the DirsContent attributes is unini...
Makes final versions of site_packages and scripts using DirsContent sub method and filters
[ "Makes", "final", "versions", "of", "site_packages", "and", "scripts", "using", "DirsContent", "sub", "method", "and", "filters" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/virtualenv.py#L94-L115
train
fedora-python/pyp2rpm
pyp2rpm/bin.py
main
def main(package, v, d, s, r, proxy, srpm, p, b, o, t, venv, autonc, sclize, **scl_kwargs): """Convert PyPI package to RPM specfile or SRPM. \b \b\bArguments: PACKAGE Provide PyPI name of the package or path to compressed source file. """ register_fi...
python
def main(package, v, d, s, r, proxy, srpm, p, b, o, t, venv, autonc, sclize, **scl_kwargs): """Convert PyPI package to RPM specfile or SRPM. \b \b\bArguments: PACKAGE Provide PyPI name of the package or path to compressed source file. """ register_fi...
[ "def", "main", "(", "package", ",", "v", ",", "d", ",", "s", ",", "r", ",", "proxy", ",", "srpm", ",", "p", ",", "b", ",", "o", ",", "t", ",", "venv", ",", "autonc", ",", "sclize", ",", "**", "scl_kwargs", ")", ":", "register_file_log_handler", ...
Convert PyPI package to RPM specfile or SRPM. \b \b\bArguments: PACKAGE Provide PyPI name of the package or path to compressed source file.
[ "Convert", "PyPI", "package", "to", "RPM", "specfile", "or", "SRPM", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/bin.py#L170-L253
train
fedora-python/pyp2rpm
pyp2rpm/bin.py
convert_to_scl
def convert_to_scl(spec, scl_options): """Convert spec into SCL-style spec file using `spec2scl`. Args: spec: (str) a spec file scl_options: (dict) SCL options provided Returns: A converted spec file """ scl_options['skip_functions'] = scl_options['skip_functions'].split(','...
python
def convert_to_scl(spec, scl_options): """Convert spec into SCL-style spec file using `spec2scl`. Args: spec: (str) a spec file scl_options: (dict) SCL options provided Returns: A converted spec file """ scl_options['skip_functions'] = scl_options['skip_functions'].split(','...
[ "def", "convert_to_scl", "(", "spec", ",", "scl_options", ")", ":", "scl_options", "[", "'skip_functions'", "]", "=", "scl_options", "[", "'skip_functions'", "]", ".", "split", "(", "','", ")", "scl_options", "[", "'meta_spec'", "]", "=", "None", "convertor", ...
Convert spec into SCL-style spec file using `spec2scl`. Args: spec: (str) a spec file scl_options: (dict) SCL options provided Returns: A converted spec file
[ "Convert", "spec", "into", "SCL", "-", "style", "spec", "file", "using", "spec2scl", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/bin.py#L256-L268
train
fedora-python/pyp2rpm
pyp2rpm/bin.py
Pyp2rpmCommand.format_options
def format_options(self, ctx, formatter): """Writes SCL related options into the formatter as a separate group. """ super(Pyp2rpmCommand, self).format_options(ctx, formatter) scl_opts = [] for param in self.get_params(ctx): if isinstance(param, SclizeOption): ...
python
def format_options(self, ctx, formatter): """Writes SCL related options into the formatter as a separate group. """ super(Pyp2rpmCommand, self).format_options(ctx, formatter) scl_opts = [] for param in self.get_params(ctx): if isinstance(param, SclizeOption): ...
[ "def", "format_options", "(", "self", ",", "ctx", ",", "formatter", ")", ":", "super", "(", "Pyp2rpmCommand", ",", "self", ")", ".", "format_options", "(", "ctx", ",", "formatter", ")", "scl_opts", "=", "[", "]", "for", "param", "in", "self", ".", "get...
Writes SCL related options into the formatter as a separate group.
[ "Writes", "SCL", "related", "options", "into", "the", "formatter", "as", "a", "separate", "group", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/bin.py#L32-L44
train
fedora-python/pyp2rpm
pyp2rpm/bin.py
SclizeOption.handle_parse_result
def handle_parse_result(self, ctx, opts, args): """Validate SCL related options before parsing.""" if 'sclize' in opts and not SclConvertor: raise click.UsageError("Please install spec2scl package to " "perform SCL-style conversion") if self.name in...
python
def handle_parse_result(self, ctx, opts, args): """Validate SCL related options before parsing.""" if 'sclize' in opts and not SclConvertor: raise click.UsageError("Please install spec2scl package to " "perform SCL-style conversion") if self.name in...
[ "def", "handle_parse_result", "(", "self", ",", "ctx", ",", "opts", ",", "args", ")", ":", "if", "'sclize'", "in", "opts", "and", "not", "SclConvertor", ":", "raise", "click", ".", "UsageError", "(", "\"Please install spec2scl package to \"", "\"perform SCL-style ...
Validate SCL related options before parsing.
[ "Validate", "SCL", "related", "options", "before", "parsing", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/bin.py#L53-L63
train
fedora-python/pyp2rpm
pyp2rpm/command/extract_dist.py
to_list
def to_list(var): """Checks if given value is a list, tries to convert, if it is not.""" if var is None: return [] if isinstance(var, str): var = var.split('\n') elif not isinstance(var, list): try: var = list(var) except TypeError: raise ValueErro...
python
def to_list(var): """Checks if given value is a list, tries to convert, if it is not.""" if var is None: return [] if isinstance(var, str): var = var.split('\n') elif not isinstance(var, list): try: var = list(var) except TypeError: raise ValueErro...
[ "def", "to_list", "(", "var", ")", ":", "if", "var", "is", "None", ":", "return", "[", "]", "if", "isinstance", "(", "var", ",", "str", ")", ":", "var", "=", "var", ".", "split", "(", "'\\n'", ")", "elif", "not", "isinstance", "(", "var", ",", ...
Checks if given value is a list, tries to convert, if it is not.
[ "Checks", "if", "given", "value", "is", "a", "list", "tries", "to", "convert", "if", "it", "is", "not", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/command/extract_dist.py#L75-L86
train
fedora-python/pyp2rpm
pyp2rpm/command/extract_dist.py
extract_dist.run
def run(self): """Sends extracted metadata in json format to stdout if stdout option is specified, assigns metadata dictionary to class_metadata variable otherwise. """ if self.stdout: sys.stdout.write("extracted json data:\n" + json.dumps( self.metada...
python
def run(self): """Sends extracted metadata in json format to stdout if stdout option is specified, assigns metadata dictionary to class_metadata variable otherwise. """ if self.stdout: sys.stdout.write("extracted json data:\n" + json.dumps( self.metada...
[ "def", "run", "(", "self", ")", ":", "if", "self", ".", "stdout", ":", "sys", ".", "stdout", ".", "write", "(", "\"extracted json data:\\n\"", "+", "json", ".", "dumps", "(", "self", ".", "metadata", ",", "default", "=", "to_str", ")", "+", "\"\\n\"", ...
Sends extracted metadata in json format to stdout if stdout option is specified, assigns metadata dictionary to class_metadata variable otherwise.
[ "Sends", "extracted", "metadata", "in", "json", "format", "to", "stdout", "if", "stdout", "option", "is", "specified", "assigns", "metadata", "dictionary", "to", "class_metadata", "variable", "otherwise", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/command/extract_dist.py#L63-L72
train
fedora-python/pyp2rpm
pyp2rpm/package_data.py
PackageData.get_changelog_date_packager
def get_changelog_date_packager(self): """Returns part of the changelog entry, containing date and packager. """ try: packager = subprocess.Popen( 'rpmdev-packager', stdout=subprocess.PIPE).communicate( )[0].strip() except OSError: ...
python
def get_changelog_date_packager(self): """Returns part of the changelog entry, containing date and packager. """ try: packager = subprocess.Popen( 'rpmdev-packager', stdout=subprocess.PIPE).communicate( )[0].strip() except OSError: ...
[ "def", "get_changelog_date_packager", "(", "self", ")", ":", "try", ":", "packager", "=", "subprocess", ".", "Popen", "(", "'rpmdev-packager'", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "communicate", "(", ")", "[", "0", "]", ".", "strip", ...
Returns part of the changelog entry, containing date and packager.
[ "Returns", "part", "of", "the", "changelog", "entry", "containing", "date", "and", "packager", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/package_data.py#L89-L104
train
fedora-python/pyp2rpm
pyp2rpm/module_runners.py
RunpyModuleRunner.run
def run(self): """Executes the code of the specified module.""" with utils.ChangeDir(self.dirname): sys.path.insert(0, self.dirname) sys.argv[1:] = self.args runpy.run_module(self.not_suffixed(self.filename), run_name='__main__', ...
python
def run(self): """Executes the code of the specified module.""" with utils.ChangeDir(self.dirname): sys.path.insert(0, self.dirname) sys.argv[1:] = self.args runpy.run_module(self.not_suffixed(self.filename), run_name='__main__', ...
[ "def", "run", "(", "self", ")", ":", "with", "utils", ".", "ChangeDir", "(", "self", ".", "dirname", ")", ":", "sys", ".", "path", ".", "insert", "(", "0", ",", "self", ".", "dirname", ")", "sys", ".", "argv", "[", "1", ":", "]", "=", "self", ...
Executes the code of the specified module.
[ "Executes", "the", "code", "of", "the", "specified", "module", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/module_runners.py#L35-L42
train
fedora-python/pyp2rpm
pyp2rpm/module_runners.py
SubprocessModuleRunner.run
def run(self, interpreter): """Executes the code of the specified module. Deserializes captured json data. """ with utils.ChangeDir(self.dirname): command_list = ['PYTHONPATH=' + main_dir, interpreter, self.filename] + list(self.args) t...
python
def run(self, interpreter): """Executes the code of the specified module. Deserializes captured json data. """ with utils.ChangeDir(self.dirname): command_list = ['PYTHONPATH=' + main_dir, interpreter, self.filename] + list(self.args) t...
[ "def", "run", "(", "self", ",", "interpreter", ")", ":", "with", "utils", ".", "ChangeDir", "(", "self", ".", "dirname", ")", ":", "command_list", "=", "[", "'PYTHONPATH='", "+", "main_dir", ",", "interpreter", ",", "self", ".", "filename", "]", "+", "...
Executes the code of the specified module. Deserializes captured json data.
[ "Executes", "the", "code", "of", "the", "specified", "module", ".", "Deserializes", "captured", "json", "data", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/module_runners.py#L52-L73
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
generator_to_list
def generator_to_list(fn): """This decorator is for flat_list function. It converts returned generator to list. """ def wrapper(*args, **kw): return list(fn(*args, **kw)) return wrapper
python
def generator_to_list(fn): """This decorator is for flat_list function. It converts returned generator to list. """ def wrapper(*args, **kw): return list(fn(*args, **kw)) return wrapper
[ "def", "generator_to_list", "(", "fn", ")", ":", "def", "wrapper", "(", "*", "args", ",", "**", "kw", ")", ":", "return", "list", "(", "fn", "(", "*", "args", ",", "**", "kw", ")", ")", "return", "wrapper" ]
This decorator is for flat_list function. It converts returned generator to list.
[ "This", "decorator", "is", "for", "flat_list", "function", ".", "It", "converts", "returned", "generator", "to", "list", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L17-L23
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.get_content_of_file
def get_content_of_file(self, name, full_path=False): """Returns content of file from archive. If full_path is set to False and two files with given name exist, content of one is returned (it is not specified which one that is). If set to True, returns content of exactly that file. ...
python
def get_content_of_file(self, name, full_path=False): """Returns content of file from archive. If full_path is set to False and two files with given name exist, content of one is returned (it is not specified which one that is). If set to True, returns content of exactly that file. ...
[ "def", "get_content_of_file", "(", "self", ",", "name", ",", "full_path", "=", "False", ")", ":", "if", "self", ".", "handle", ":", "for", "member", "in", "self", ".", "handle", ".", "getmembers", "(", ")", ":", "if", "(", "full_path", "and", "member",...
Returns content of file from archive. If full_path is set to False and two files with given name exist, content of one is returned (it is not specified which one that is). If set to True, returns content of exactly that file. Args: name: name of the file to get content of ...
[ "Returns", "content", "of", "file", "from", "archive", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L147-L168
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.extract_file
def extract_file(self, name, full_path=False, directory="."): """Extract a member from the archive to the specified working directory. Behaviour of name and pull_path is the same as in function get_content_of_file. """ if self.handle: for member in self.handle.getmemb...
python
def extract_file(self, name, full_path=False, directory="."): """Extract a member from the archive to the specified working directory. Behaviour of name and pull_path is the same as in function get_content_of_file. """ if self.handle: for member in self.handle.getmemb...
[ "def", "extract_file", "(", "self", ",", "name", ",", "full_path", "=", "False", ",", "directory", "=", "\".\"", ")", ":", "if", "self", ".", "handle", ":", "for", "member", "in", "self", ".", "handle", ".", "getmembers", "(", ")", ":", "if", "(", ...
Extract a member from the archive to the specified working directory. Behaviour of name and pull_path is the same as in function get_content_of_file.
[ "Extract", "a", "member", "from", "the", "archive", "to", "the", "specified", "working", "directory", ".", "Behaviour", "of", "name", "and", "pull_path", "is", "the", "same", "as", "in", "function", "get_content_of_file", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L170-L181
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.extract_all
def extract_all(self, directory=".", members=None): """Extract all member from the archive to the specified working directory. """ if self.handle: self.handle.extractall(path=directory, members=members)
python
def extract_all(self, directory=".", members=None): """Extract all member from the archive to the specified working directory. """ if self.handle: self.handle.extractall(path=directory, members=members)
[ "def", "extract_all", "(", "self", ",", "directory", "=", "\".\"", ",", "members", "=", "None", ")", ":", "if", "self", ".", "handle", ":", "self", ".", "handle", ".", "extractall", "(", "path", "=", "directory", ",", "members", "=", "members", ")" ]
Extract all member from the archive to the specified working directory.
[ "Extract", "all", "member", "from", "the", "archive", "to", "the", "specified", "working", "directory", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L183-L188
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.get_files_re
def get_files_re(self, file_re, full_path=False, ignorecase=False): """Finds all files that match file_re and returns their list. Doesn't return directories, only files. Args: file_re: raw string to match files against (gets compiled into re) full_path: whether to match ...
python
def get_files_re(self, file_re, full_path=False, ignorecase=False): """Finds all files that match file_re and returns their list. Doesn't return directories, only files. Args: file_re: raw string to match files against (gets compiled into re) full_path: whether to match ...
[ "def", "get_files_re", "(", "self", ",", "file_re", ",", "full_path", "=", "False", ",", "ignorecase", "=", "False", ")", ":", "try", ":", "if", "ignorecase", ":", "compiled_re", "=", "re", ".", "compile", "(", "file_re", ",", "re", ".", "I", ")", "e...
Finds all files that match file_re and returns their list. Doesn't return directories, only files. Args: file_re: raw string to match files against (gets compiled into re) full_path: whether to match against full path inside the archive or just the filenames ...
[ "Finds", "all", "files", "that", "match", "file_re", "and", "returns", "their", "list", ".", "Doesn", "t", "return", "directories", "only", "files", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L215-L248
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.get_directories_re
def get_directories_re( self, directory_re, full_path=False, ignorecase=False): """Same as get_files_re, but for directories""" if ignorecase: compiled_re = re.compile(directory_re, re.I) else: compiled_re = re.compile(direc...
python
def get_directories_re( self, directory_re, full_path=False, ignorecase=False): """Same as get_files_re, but for directories""" if ignorecase: compiled_re = re.compile(directory_re, re.I) else: compiled_re = re.compile(direc...
[ "def", "get_directories_re", "(", "self", ",", "directory_re", ",", "full_path", "=", "False", ",", "ignorecase", "=", "False", ")", ":", "if", "ignorecase", ":", "compiled_re", "=", "re", ".", "compile", "(", "directory_re", ",", "re", ".", "I", ")", "e...
Same as get_files_re, but for directories
[ "Same", "as", "get_files_re", "but", "for", "directories" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L250-L279
train
fedora-python/pyp2rpm
pyp2rpm/archive.py
Archive.top_directory
def top_directory(self): """Return the name of the archive topmost directory.""" if self.handle: return os.path.commonprefix(self.handle.getnames()).rstrip('/')
python
def top_directory(self): """Return the name of the archive topmost directory.""" if self.handle: return os.path.commonprefix(self.handle.getnames()).rstrip('/')
[ "def", "top_directory", "(", "self", ")", ":", "if", "self", ".", "handle", ":", "return", "os", ".", "path", ".", "commonprefix", "(", "self", ".", "handle", ".", "getnames", "(", ")", ")", ".", "rstrip", "(", "'/'", ")" ]
Return the name of the archive topmost directory.
[ "Return", "the", "name", "of", "the", "archive", "topmost", "directory", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/archive.py#L282-L285
train
fedora-python/pyp2rpm
pyp2rpm/name_convertor.py
NameConvertor.base_name
def base_name(self, name): """Removes any python prefixes of suffixes from name if present.""" base_name = name.replace('.', "-") # remove python prefix if present found_prefix = self.reg_start.search(name) if found_prefix: base_name = found_prefix.group(2) #...
python
def base_name(self, name): """Removes any python prefixes of suffixes from name if present.""" base_name = name.replace('.', "-") # remove python prefix if present found_prefix = self.reg_start.search(name) if found_prefix: base_name = found_prefix.group(2) #...
[ "def", "base_name", "(", "self", ",", "name", ")", ":", "base_name", "=", "name", ".", "replace", "(", "'.'", ",", "\"-\"", ")", "found_prefix", "=", "self", ".", "reg_start", ".", "search", "(", "name", ")", "if", "found_prefix", ":", "base_name", "="...
Removes any python prefixes of suffixes from name if present.
[ "Removes", "any", "python", "prefixes", "of", "suffixes", "from", "name", "if", "present", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/name_convertor.py#L108-L121
train
fedora-python/pyp2rpm
pyp2rpm/name_convertor.py
NameVariants.merge
def merge(self, other): """Merges object with other NameVariants object, not set values of self.variants are replace by values from other object. """ if not isinstance(other, NameVariants): raise TypeError("NameVariants isinstance can be merge with" ...
python
def merge(self, other): """Merges object with other NameVariants object, not set values of self.variants are replace by values from other object. """ if not isinstance(other, NameVariants): raise TypeError("NameVariants isinstance can be merge with" ...
[ "def", "merge", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "NameVariants", ")", ":", "raise", "TypeError", "(", "\"NameVariants isinstance can be merge with\"", "\"other isinstance of the same class\"", ")", "for", "key", "in"...
Merges object with other NameVariants object, not set values of self.variants are replace by values from other object.
[ "Merges", "object", "with", "other", "NameVariants", "object", "not", "set", "values", "of", "self", ".", "variants", "are", "replace", "by", "values", "from", "other", "object", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/name_convertor.py#L144-L154
train
fedora-python/pyp2rpm
pyp2rpm/convertor.py
Convertor.merge_versions
def merge_versions(self, data): """Merges python versions specified in command lines options with extracted versions, checks if some of the versions is not > 2 if EPEL6 template will be used. attributes base_python_version and python_versions contain values specified by command line opti...
python
def merge_versions(self, data): """Merges python versions specified in command lines options with extracted versions, checks if some of the versions is not > 2 if EPEL6 template will be used. attributes base_python_version and python_versions contain values specified by command line opti...
[ "def", "merge_versions", "(", "self", ",", "data", ")", ":", "if", "self", ".", "template", "==", "\"epel6.spec\"", ":", "requested_versions", "=", "self", ".", "python_versions", "if", "self", ".", "base_python_version", ":", "requested_versions", "+=", "[", ...
Merges python versions specified in command lines options with extracted versions, checks if some of the versions is not > 2 if EPEL6 template will be used. attributes base_python_version and python_versions contain values specified by command line options or default values, data.python_...
[ "Merges", "python", "versions", "specified", "in", "command", "lines", "options", "with", "extracted", "versions", "checks", "if", "some", "of", "the", "versions", "is", "not", ">", "2", "if", "EPEL6", "template", "will", "be", "used", ".", "attributes", "ba...
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/convertor.py#L81-L123
train
fedora-python/pyp2rpm
pyp2rpm/convertor.py
Convertor.getter
def getter(self): """Returns an instance of proper PackageGetter subclass. Always returns the same instance. Returns: Instance of the proper PackageGetter subclass according to provided argument. Raises: NoSuchSourceException if source to get the pack...
python
def getter(self): """Returns an instance of proper PackageGetter subclass. Always returns the same instance. Returns: Instance of the proper PackageGetter subclass according to provided argument. Raises: NoSuchSourceException if source to get the pack...
[ "def", "getter", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_getter'", ")", ":", "if", "not", "self", ".", "pypi", ":", "self", ".", "_getter", "=", "package_getters", ".", "LocalFileGetter", "(", "self", ".", "package", ",", ...
Returns an instance of proper PackageGetter subclass. Always returns the same instance. Returns: Instance of the proper PackageGetter subclass according to provided argument. Raises: NoSuchSourceException if source to get the package from is unknown ...
[ "Returns", "an", "instance", "of", "proper", "PackageGetter", "subclass", ".", "Always", "returns", "the", "same", "instance", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/convertor.py#L172-L198
train
fedora-python/pyp2rpm
pyp2rpm/convertor.py
Convertor.metadata_extractor
def metadata_extractor(self): """Returns an instance of proper MetadataExtractor subclass. Always returns the same instance. Returns: The proper MetadataExtractor subclass according to local file suffix. """ if not hasattr(self, '_local_file'): ...
python
def metadata_extractor(self): """Returns an instance of proper MetadataExtractor subclass. Always returns the same instance. Returns: The proper MetadataExtractor subclass according to local file suffix. """ if not hasattr(self, '_local_file'): ...
[ "def", "metadata_extractor", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_local_file'", ")", ":", "raise", "AttributeError", "(", "\"local_file attribute must be set before \"", "\"calling metadata_extractor\"", ")", "if", "not", "hasattr", "(",...
Returns an instance of proper MetadataExtractor subclass. Always returns the same instance. Returns: The proper MetadataExtractor subclass according to local file suffix.
[ "Returns", "an", "instance", "of", "proper", "MetadataExtractor", "subclass", ".", "Always", "returns", "the", "same", "instance", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/convertor.py#L245-L278
train
fedora-python/pyp2rpm
pyp2rpm/convertor.py
Convertor.client
def client(self): """XMLRPC client for PyPI. Always returns the same instance. If the package is provided as a path to compressed source file, PyPI will not be used and the client will not be instantiated. Returns: XMLRPC client for PyPI or None. """ if self...
python
def client(self): """XMLRPC client for PyPI. Always returns the same instance. If the package is provided as a path to compressed source file, PyPI will not be used and the client will not be instantiated. Returns: XMLRPC client for PyPI or None. """ if self...
[ "def", "client", "(", "self", ")", ":", "if", "self", ".", "proxy", ":", "proxyhandler", "=", "urllib", ".", "ProxyHandler", "(", "{", "\"http\"", ":", "self", ".", "proxy", "}", ")", "opener", "=", "urllib", ".", "build_opener", "(", "proxyhandler", "...
XMLRPC client for PyPI. Always returns the same instance. If the package is provided as a path to compressed source file, PyPI will not be used and the client will not be instantiated. Returns: XMLRPC client for PyPI or None.
[ "XMLRPC", "client", "for", "PyPI", ".", "Always", "returns", "the", "same", "instance", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/convertor.py#L281-L307
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
memoize_by_args
def memoize_by_args(func): """Memoizes return value of a func based on args.""" memory = {} @functools.wraps(func) def memoized(*args): if args not in memory.keys(): value = func(*args) memory[args] = value return memory[args] return memoized
python
def memoize_by_args(func): """Memoizes return value of a func based on args.""" memory = {} @functools.wraps(func) def memoized(*args): if args not in memory.keys(): value = func(*args) memory[args] = value return memory[args] return memoized
[ "def", "memoize_by_args", "(", "func", ")", ":", "memory", "=", "{", "}", "@", "functools", ".", "wraps", "(", "func", ")", "def", "memoized", "(", "*", "args", ")", ":", "if", "args", "not", "in", "memory", ".", "keys", "(", ")", ":", "value", "...
Memoizes return value of a func based on args.
[ "Memoizes", "return", "value", "of", "a", "func", "based", "on", "args", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L44-L56
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
build_srpm
def build_srpm(specfile, save_dir): """Builds a srpm from given specfile using rpmbuild. Generated srpm is stored in directory specified by save_dir. Args: specfile: path to a specfile save_dir: path to source and build tree """ logger.info('Starting rpmbuild to build: {0} SRPM.'.fo...
python
def build_srpm(specfile, save_dir): """Builds a srpm from given specfile using rpmbuild. Generated srpm is stored in directory specified by save_dir. Args: specfile: path to a specfile save_dir: path to source and build tree """ logger.info('Starting rpmbuild to build: {0} SRPM.'.fo...
[ "def", "build_srpm", "(", "specfile", ",", "save_dir", ")", ":", "logger", ".", "info", "(", "'Starting rpmbuild to build: {0} SRPM.'", ".", "format", "(", "specfile", ")", ")", "if", "save_dir", "!=", "get_default_save_path", "(", ")", ":", "try", ":", "msg",...
Builds a srpm from given specfile using rpmbuild. Generated srpm is stored in directory specified by save_dir. Args: specfile: path to a specfile save_dir: path to source and build tree
[ "Builds", "a", "srpm", "from", "given", "specfile", "using", "rpmbuild", ".", "Generated", "srpm", "is", "stored", "in", "directory", "specified", "by", "save_dir", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L59-L101
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
remove_major_minor_suffix
def remove_major_minor_suffix(scripts): """Checks if executables already contain a "-MAJOR.MINOR" suffix. """ minor_major_regex = re.compile("-\d.?\d?$") return [x for x in scripts if not minor_major_regex.search(x)]
python
def remove_major_minor_suffix(scripts): """Checks if executables already contain a "-MAJOR.MINOR" suffix. """ minor_major_regex = re.compile("-\d.?\d?$") return [x for x in scripts if not minor_major_regex.search(x)]
[ "def", "remove_major_minor_suffix", "(", "scripts", ")", ":", "minor_major_regex", "=", "re", ".", "compile", "(", "\"-\\d.?\\d?$\"", ")", "return", "[", "x", "for", "x", "in", "scripts", "if", "not", "minor_major_regex", ".", "search", "(", "x", ")", "]" ]
Checks if executables already contain a "-MAJOR.MINOR" suffix.
[ "Checks", "if", "executables", "already", "contain", "a", "-", "MAJOR", ".", "MINOR", "suffix", "." ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L104-L107
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
runtime_to_build
def runtime_to_build(runtime_deps): """Adds all runtime deps to build deps""" build_deps = copy.deepcopy(runtime_deps) for dep in build_deps: if len(dep) > 0: dep[0] = 'BuildRequires' return build_deps
python
def runtime_to_build(runtime_deps): """Adds all runtime deps to build deps""" build_deps = copy.deepcopy(runtime_deps) for dep in build_deps: if len(dep) > 0: dep[0] = 'BuildRequires' return build_deps
[ "def", "runtime_to_build", "(", "runtime_deps", ")", ":", "build_deps", "=", "copy", ".", "deepcopy", "(", "runtime_deps", ")", "for", "dep", "in", "build_deps", ":", "if", "len", "(", "dep", ")", ">", "0", ":", "dep", "[", "0", "]", "=", "'BuildRequir...
Adds all runtime deps to build deps
[ "Adds", "all", "runtime", "deps", "to", "build", "deps" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L110-L116
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
unique_deps
def unique_deps(deps): """Remove duplicities from deps list of the lists""" deps.sort() return list(k for k, _ in itertools.groupby(deps))
python
def unique_deps(deps): """Remove duplicities from deps list of the lists""" deps.sort() return list(k for k, _ in itertools.groupby(deps))
[ "def", "unique_deps", "(", "deps", ")", ":", "deps", ".", "sort", "(", ")", "return", "list", "(", "k", "for", "k", ",", "_", "in", "itertools", ".", "groupby", "(", "deps", ")", ")" ]
Remove duplicities from deps list of the lists
[ "Remove", "duplicities", "from", "deps", "list", "of", "the", "lists" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L119-L122
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
c_time_locale
def c_time_locale(): """Context manager with C LC_TIME locale""" old_time_locale = locale.getlocale(locale.LC_TIME) locale.setlocale(locale.LC_TIME, 'C') yield locale.setlocale(locale.LC_TIME, old_time_locale)
python
def c_time_locale(): """Context manager with C LC_TIME locale""" old_time_locale = locale.getlocale(locale.LC_TIME) locale.setlocale(locale.LC_TIME, 'C') yield locale.setlocale(locale.LC_TIME, old_time_locale)
[ "def", "c_time_locale", "(", ")", ":", "old_time_locale", "=", "locale", ".", "getlocale", "(", "locale", ".", "LC_TIME", ")", "locale", ".", "setlocale", "(", "locale", ".", "LC_TIME", ",", "'C'", ")", "yield", "locale", ".", "setlocale", "(", "locale", ...
Context manager with C LC_TIME locale
[ "Context", "manager", "with", "C", "LC_TIME", "locale" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L137-L142
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
rpm_eval
def rpm_eval(macro): """Get value of given macro using rpm tool""" try: value = subprocess.Popen( ['rpm', '--eval', macro], stdout=subprocess.PIPE).communicate()[0].strip() except OSError: logger.error('Failed to get value of {0} rpm macro'.format( macro),...
python
def rpm_eval(macro): """Get value of given macro using rpm tool""" try: value = subprocess.Popen( ['rpm', '--eval', macro], stdout=subprocess.PIPE).communicate()[0].strip() except OSError: logger.error('Failed to get value of {0} rpm macro'.format( macro),...
[ "def", "rpm_eval", "(", "macro", ")", ":", "try", ":", "value", "=", "subprocess", ".", "Popen", "(", "[", "'rpm'", ",", "'--eval'", ",", "macro", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "communicate", "(", ")", "[", "0", "]",...
Get value of given macro using rpm tool
[ "Get", "value", "of", "given", "macro", "using", "rpm", "tool" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L145-L155
train
fedora-python/pyp2rpm
pyp2rpm/utils.py
get_default_save_path
def get_default_save_path(): """Return default save path for the packages""" macro = '%{_topdir}' if rpm: save_path = rpm.expandMacro(macro) else: save_path = rpm_eval(macro) if not save_path: logger.warn("rpm tools are missing, using default save path " ...
python
def get_default_save_path(): """Return default save path for the packages""" macro = '%{_topdir}' if rpm: save_path = rpm.expandMacro(macro) else: save_path = rpm_eval(macro) if not save_path: logger.warn("rpm tools are missing, using default save path " ...
[ "def", "get_default_save_path", "(", ")", ":", "macro", "=", "'%{_topdir}'", "if", "rpm", ":", "save_path", "=", "rpm", ".", "expandMacro", "(", "macro", ")", "else", ":", "save_path", "=", "rpm_eval", "(", "macro", ")", "if", "not", "save_path", ":", "l...
Return default save path for the packages
[ "Return", "default", "save", "path", "for", "the", "packages" ]
853eb3d226689a5ccdcdb9358b1a3394fafbd2b5
https://github.com/fedora-python/pyp2rpm/blob/853eb3d226689a5ccdcdb9358b1a3394fafbd2b5/pyp2rpm/utils.py#L158-L169
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
check_and_get_data
def check_and_get_data(input_list,**pars): """Verify that all specified files are present. If not, retrieve them from MAST. Parameters ---------- input_list : list List of one or more calibrated fits images that will be used for catalog generation. Returns ======= total_input_list:...
python
def check_and_get_data(input_list,**pars): """Verify that all specified files are present. If not, retrieve them from MAST. Parameters ---------- input_list : list List of one or more calibrated fits images that will be used for catalog generation. Returns ======= total_input_list:...
[ "def", "check_and_get_data", "(", "input_list", ",", "**", "pars", ")", ":", "empty_list", "=", "[", "]", "retrieve_list", "=", "[", "]", "candidate_list", "=", "[", "]", "ipppssoot_list", "=", "[", "]", "total_input_list", "=", "[", "]", "for", "input_ite...
Verify that all specified files are present. If not, retrieve them from MAST. Parameters ---------- input_list : list List of one or more calibrated fits images that will be used for catalog generation. Returns ======= total_input_list: list list of full filenames
[ "Verify", "that", "all", "specified", "files", "are", "present", ".", "If", "not", "retrieve", "them", "from", "MAST", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L78-L172
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
perform_align
def perform_align(input_list, **kwargs): """Main calling function. Parameters ---------- input_list : list List of one or more IPPSSOOTs (rootnames) to align. archive : Boolean Retain copies of the downloaded files in the astroquery created sub-directories? clobber : Boolean ...
python
def perform_align(input_list, **kwargs): """Main calling function. Parameters ---------- input_list : list List of one or more IPPSSOOTs (rootnames) to align. archive : Boolean Retain copies of the downloaded files in the astroquery created sub-directories? clobber : Boolean ...
[ "def", "perform_align", "(", "input_list", ",", "**", "kwargs", ")", ":", "filteredTable", "=", "Table", "(", ")", "run_align", "(", "input_list", ",", "result", "=", "filteredTable", ",", "**", "kwargs", ")", "return", "filteredTable" ]
Main calling function. Parameters ---------- input_list : list List of one or more IPPSSOOTs (rootnames) to align. archive : Boolean Retain copies of the downloaded files in the astroquery created sub-directories? clobber : Boolean Download and overwrite existing local cop...
[ "Main", "calling", "function", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L175-L216
train
spacetelescope/drizzlepac
drizzlepac/alignimages.py
generate_astrometric_catalog
def generate_astrometric_catalog(imglist, **pars): """Generates a catalog of all sources from an existing astrometric catalog are in or near the FOVs of the images in the input list. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for ca...
python
def generate_astrometric_catalog(imglist, **pars): """Generates a catalog of all sources from an existing astrometric catalog are in or near the FOVs of the images in the input list. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for ca...
[ "def", "generate_astrometric_catalog", "(", "imglist", ",", "**", "pars", ")", ":", "temp_pars", "=", "pars", ".", "copy", "(", ")", "if", "pars", "[", "'output'", "]", "==", "True", ":", "pars", "[", "'output'", "]", "=", "'ref_cat.ecsv'", "else", ":", ...
Generates a catalog of all sources from an existing astrometric catalog are in or near the FOVs of the images in the input list. Parameters ---------- imglist : list List of one or more calibrated fits images that will be used for catalog generation. Returns ======= ref_table :...
[ "Generates", "a", "catalog", "of", "all", "sources", "from", "an", "existing", "astrometric", "catalog", "are", "in", "or", "near", "the", "FOVs", "of", "the", "images", "in", "the", "input", "list", "." ]
15bec3c929a6a869d9e71b9398ced43ede0620f1
https://github.com/spacetelescope/drizzlepac/blob/15bec3c929a6a869d9e71b9398ced43ede0620f1/drizzlepac/alignimages.py#L868-L897
train