partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
OSBS._get_existing_build_config
Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR - metadata.labels.git-repo-name AND metadata.labels.git-branch are ...
osbs/api.py
def _get_existing_build_config(self, build_config): """ Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR ...
def _get_existing_build_config(self, build_config): """ Uses the given build config to find an existing matching build config. Build configs are a match if: - metadata.labels.git-repo-name AND metadata.labels.git-branch AND metadata.labels.git-full-repo are equal OR ...
[ "Uses", "the", "given", "build", "config", "to", "find", "an", "existing", "matching", "build", "config", ".", "Build", "configs", "are", "a", "match", "if", ":", "-", "metadata", ".", "labels", ".", "git", "-", "repo", "-", "name", "AND", "metadata", ...
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L294-L338
[ "def", "_get_existing_build_config", "(", "self", ",", "build_config", ")", ":", "bc_labels", "=", "build_config", "[", "'metadata'", "]", "[", "'labels'", "]", "git_labels", "=", "{", "\"label_selectors\"", ":", "[", "(", "key", ",", "bc_labels", "[", "key", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS._get_image_stream_info_for_build_request
Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned.
osbs/api.py
def _get_image_stream_info_for_build_request(self, build_request): """Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned. """ image_stream = None image_...
def _get_image_stream_info_for_build_request(self, build_request): """Return ImageStream, and ImageStreamTag name for base_image of build_request If build_request is not auto instantiated, objects are not fetched and None, None is returned. """ image_stream = None image_...
[ "Return", "ImageStream", "and", "ImageStreamTag", "name", "for", "base_image", "of", "build_request" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L393-L419
[ "def", "_get_image_stream_info_for_build_request", "(", "self", ",", "build_request", ")", ":", "image_stream", "=", "None", "image_stream_tag_name", "=", "None", "if", "build_request", ".", "has_ist_trigger", "(", ")", ":", "image_stream_tag_id", "=", "build_request", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.create_prod_build
Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore :param target: str, koji target :param architectu...
osbs/api.py
def create_prod_build(self, *args, **kwargs): """ Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore...
def create_prod_build(self, *args, **kwargs): """ Create a production build :param git_uri: str, URI of git repository :param git_ref: str, reference to commit :param git_branch: str, branch name :param user: str, user name :param component: str, not used anymore...
[ "Create", "a", "production", "build" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L765-L793
[ "def", "create_prod_build", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "logger", ".", "warning", "(", "\"prod (all-in-one) builds are deprecated, \"", "\"please use create_orchestrator_build \"", "\"(support will be removed in version 0.54)\"", ")", "...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.create_worker_build
Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is used to select which worker_inner:n.json template...
osbs/api.py
def create_worker_build(self, **kwargs): """ Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is us...
def create_worker_build(self, **kwargs): """ Create a worker build Pass through method to create_prod_build with the following modifications: - platform param is required - release param is required - arrangement_version param is required, which is us...
[ "Create", "a", "worker", "build" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L806-L847
[ "def", "create_worker_build", "(", "self", ",", "*", "*", "kwargs", ")", ":", "missing", "=", "set", "(", ")", "for", "required", "in", "(", "'platform'", ",", "'release'", ",", "'arrangement_version'", ")", ":", "if", "not", "kwargs", ".", "get", "(", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.create_orchestrator_build
Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestrator_inner:n.json template to use - inner template set ...
osbs/api.py
def create_orchestrator_build(self, **kwargs): """ Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestr...
def create_orchestrator_build(self, **kwargs): """ Create an orchestrator build Pass through method to create_prod_build with the following modifications: - platforms param is required - arrangement_version param may be used to select which orchestr...
[ "Create", "an", "orchestrator", "build" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L850-L891
[ "def", "create_orchestrator_build", "(", "self", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "can_orchestrate", "(", ")", ":", "raise", "OsbsOrchestratorNotEnabled", "(", "\"can't create orchestrate build \"", "\"when can_orchestrate isn't enabled\"", "...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.get_build_logs
provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise, we return the bytes exactly as they came from the container. :param build_id: str :param follow: bool, fetch logs as the...
osbs/api.py
def get_build_logs(self, build_id, follow=False, build_json=None, wait_if_missing=False, decode=False): """ provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise...
def get_build_logs(self, build_id, follow=False, build_json=None, wait_if_missing=False, decode=False): """ provide logs from build NOTE: Since atomic-reactor 1.6.25, logs are always in UTF-8, so if asked to decode, we assume that is the encoding in use. Otherwise...
[ "provide", "logs", "from", "build" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L899-L925
[ "def", "get_build_logs", "(", "self", ",", "build_id", ",", "follow", "=", "False", ",", "build_json", "=", "None", ",", "wait_if_missing", "=", "False", ",", "decode", "=", "False", ")", ":", "logs", "=", "self", ".", "os", ".", "logs", "(", "build_id...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.get_orchestrator_build_logs
provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator yielding objects with attributes 'platform' and 'line'
osbs/api.py
def get_orchestrator_build_logs(self, build_id, follow=False, wait_if_missing=False): """ provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator...
def get_orchestrator_build_logs(self, build_id, follow=False, wait_if_missing=False): """ provide logs from orchestrator build :param build_id: str :param follow: bool, fetch logs as they come? :param wait_if_missing: bool, if build doesn't exist, wait :return: generator...
[ "provide", "logs", "from", "orchestrator", "build" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L958-L978
[ "def", "get_orchestrator_build_logs", "(", "self", ",", "build_id", ",", "follow", "=", "False", ",", "wait_if_missing", "=", "False", ")", ":", "logs", "=", "self", ".", "get_build_logs", "(", "build_id", "=", "build_id", ",", "follow", "=", "follow", ",", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.import_image
Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported
osbs/api.py
def import_image(self, name, tags=None): """ Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported """ stream_import_file = os.path.join(self.os_conf.get_build_json_store(), 'image_stream_...
def import_image(self, name, tags=None): """ Import image tags from a Docker registry into an ImageStream :return: bool, whether tags were imported """ stream_import_file = os.path.join(self.os_conf.get_build_json_store(), 'image_stream_...
[ "Import", "image", "tags", "from", "a", "Docker", "registry", "into", "an", "ImageStream" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1021-L1031
[ "def", "import_image", "(", "self", ",", "name", ",", "tags", "=", "None", ")", ":", "stream_import_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ",", "'image_stream_import.json'", ")", "wit...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.import_image_tags
Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image in the format <registry>/<repository> :param insecure...
osbs/api.py
def import_image_tags(self, name, tags, repository, insecure=False): """Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image ...
def import_image_tags(self, name, tags, repository, insecure=False): """Import image tags from specified container repository. :param name: str, name of ImageStream object :param tags: iterable, tags to be imported :param repository: str, remote location of container image ...
[ "Import", "image", "tags", "from", "specified", "container", "repository", "." ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1034-L1050
[ "def", "import_image_tags", "(", "self", ",", "name", ",", "tags", ",", "repository", ",", "insecure", "=", "False", ")", ":", "stream_import_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.ensure_image_stream_tag
Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, without name of ImageStream as prefix :param scheduled: bool, if True, importPolicy.scheduled will be set...
osbs/api.py
def ensure_image_stream_tag(self, stream, tag_name, scheduled=False, source_registry=None, organization=None, base_image=None): """Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, with...
def ensure_image_stream_tag(self, stream, tag_name, scheduled=False, source_registry=None, organization=None, base_image=None): """Ensures the tag is monitored in ImageStream :param stream: dict, ImageStream object :param tag_name: str, name of tag to check, with...
[ "Ensures", "the", "tag", "is", "monitored", "in", "ImageStream" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1120-L1153
[ "def", "ensure_image_stream_tag", "(", "self", ",", "stream", ",", "tag_name", ",", "scheduled", "=", "False", ",", "source_registry", "=", "None", ",", "organization", "=", "None", ",", "base_image", "=", "None", ")", ":", "img_stream_tag_file", "=", "os", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.create_image_stream
Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image repository :param insecure_registry: bool, whether plain HTTP should be used :return: response
osbs/api.py
def create_image_stream(self, name, docker_image_repository, insecure_registry=False): """ Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image ...
def create_image_stream(self, name, docker_image_repository, insecure_registry=False): """ Create an ImageStream object Raises exception on error :param name: str, name of ImageStream :param docker_image_repository: str, pull spec for docker image ...
[ "Create", "an", "ImageStream", "object" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1175-L1197
[ "def", "create_image_stream", "(", "self", ",", "name", ",", "docker_image_repository", ",", "insecure_registry", "=", "False", ")", ":", "img_stream_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")"...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.get_compression_extension
Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot, or else None if no compression
osbs/api.py
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
def get_compression_extension(self): """ Find the filename extension for the 'docker save' output, which may or may not be compressed. Raises OsbsValidationException if the extension cannot be determined due to a configuration error. :returns: str including leading dot,...
[ "Find", "the", "filename", "extension", "for", "the", "docker", "save", "output", "which", "may", "or", "may", "not", "be", "compressed", "." ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1267-L1292
[ "def", "get_compression_extension", "(", "self", ")", ":", "build_request", "=", "BuildRequest", "(", "build_json_store", "=", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ")", "inner", "=", "build_request", ".", "inner_template", "postbuild_plugin...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.create_config_map
Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data
osbs/api.py
def create_config_map(self, name, data): """ Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data...
def create_config_map(self, name, data): """ Create an ConfigMap object on the server Raises exception on error :param name: str, name of configMap :param data: dict, dictionary of data to be stored :returns: ConfigMapResponse containing the ConfigMap with name and data...
[ "Create", "an", "ConfigMap", "object", "on", "the", "server" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1307-L1328
[ "def", "create_config_map", "(", "self", ",", "name", ",", "data", ")", ":", "config_data_file", "=", "os", ".", "path", ".", "join", "(", "self", ".", "os_conf", ".", "get_build_json_store", "(", ")", ",", "'config_map.json'", ")", "with", "open", "(", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.get_config_map
Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name
osbs/api.py
def get_config_map(self, name): """ Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name """ response = self.os.ge...
def get_config_map(self, name): """ Get a ConfigMap object from the server Raises exception on error :param name: str, name of configMap to get from the server :returns: ConfigMapResponse containing the ConfigMap with the requested name """ response = self.os.ge...
[ "Get", "a", "ConfigMap", "object", "from", "the", "server" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1331-L1342
[ "def", "get_config_map", "(", "self", ",", "name", ")", ":", "response", "=", "self", ".", "os", ".", "get_config_map", "(", "name", ")", "config_map_response", "=", "ConfigMapResponse", "(", "response", ".", "json", "(", ")", ")", "return", "config_map_resp...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
OSBS.retries_disabled
Context manager to disable retries on requests :returns: OSBS object
osbs/api.py
def retries_disabled(self): """ Context manager to disable retries on requests :returns: OSBS object """ self.os.retries_enabled = False yield self.os.retries_enabled = True
def retries_disabled(self): """ Context manager to disable retries on requests :returns: OSBS object """ self.os.retries_enabled = False yield self.os.retries_enabled = True
[ "Context", "manager", "to", "disable", "retries", "on", "requests", ":", "returns", ":", "OSBS", "object" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/api.py#L1356-L1363
[ "def", "retries_disabled", "(", "self", ")", ":", "self", ".", "os", ".", "retries_enabled", "=", "False", "yield", "self", ".", "os", ".", "retries_enabled", "=", "True" ]
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
HoverPy.wipe
Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests.
hoverpy/hp.py
def wipe(self): """ Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests. """ try: if os.isfile(self._dbpath): os.remove(self._dbpath)...
def wipe(self): """ Wipe the bolt database. Calling this after HoverPy has been instantiated is potentially dangerous. This function is mostly used internally for unit tests. """ try: if os.isfile(self._dbpath): os.remove(self._dbpath)...
[ "Wipe", "the", "bolt", "database", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L95-L107
[ "def", "wipe", "(", "self", ")", ":", "try", ":", "if", "os", ".", "isfile", "(", "self", ".", "_dbpath", ")", ":", "os", ".", "remove", "(", "self", ".", "_dbpath", ")", "except", "OSError", ":", "pass" ]
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.simulation
Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None)
hoverpy/hp.py
def simulation(self, data=None): """ Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None) ...
def simulation(self, data=None): """ Gets / Sets the simulation data. If no data is passed in, then this method acts as a getter. if data is passed in, then this method acts as a setter. Keyword arguments: data -- the simulation data you wish to set (default None) ...
[ "Gets", "/", "Sets", "the", "simulation", "data", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L135-L148
[ "def", "simulation", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v2", "(", ")", "+", "\"/simulation\"", ",", "data", "=", "data", ")", "else", ":", "return"...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.destination
Gets / Sets the destination data.
hoverpy/hp.py
def destination(self, name=""): """ Gets / Sets the destination data. """ if name: return self._session.put( self.__v2() + "/hoverfly/destination", data={"destination": name}).json() else: return self._session.get( ...
def destination(self, name=""): """ Gets / Sets the destination data. """ if name: return self._session.put( self.__v2() + "/hoverfly/destination", data={"destination": name}).json() else: return self._session.get( ...
[ "Gets", "/", "Sets", "the", "destination", "data", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L150-L160
[ "def", "destination", "(", "self", ",", "name", "=", "\"\"", ")", ":", "if", "name", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v2", "(", ")", "+", "\"/hoverfly/destination\"", ",", "data", "=", "{", "\"destination\"", ":"...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.mode
Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None)
hoverpy/hp.py
def mode(self, mode=None): """ Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None) """ if mode: logging.debug("SWITCHING TO %s" % mod...
def mode(self, mode=None): """ Gets / Sets the mode. If no mode is provided, then this method acts as a getter. Keyword arguments: mode -- this should either be 'capture' or 'simulate' (default None) """ if mode: logging.debug("SWITCHING TO %s" % mod...
[ "Gets", "/", "Sets", "the", "mode", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L168-L185
[ "def", "mode", "(", "self", ",", "mode", "=", "None", ")", ":", "if", "mode", ":", "logging", ".", "debug", "(", "\"SWITCHING TO %s\"", "%", "mode", ")", "url", "=", "self", ".", "__v2", "(", ")", "+", "\"/hoverfly/mode\"", "logging", ".", "debug", "...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.metadata
Gets the metadata.
hoverpy/hp.py
def metadata(self, delete=False): """ Gets the metadata. """ if delete: return self._session.delete(self.__v1() + "/metadata").json() else: return self._session.get(self.__v1() + "/metadata").json()
def metadata(self, delete=False): """ Gets the metadata. """ if delete: return self._session.delete(self.__v1() + "/metadata").json() else: return self._session.get(self.__v1() + "/metadata").json()
[ "Gets", "the", "metadata", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L193-L200
[ "def", "metadata", "(", "self", ",", "delete", "=", "False", ")", ":", "if", "delete", ":", "return", "self", ".", "_session", ".", "delete", "(", "self", ".", "__v1", "(", ")", "+", "\"/metadata\"", ")", ".", "json", "(", ")", "else", ":", "return...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.records
Gets / Sets records.
hoverpy/hp.py
def records(self, data=None): """ Gets / Sets records. """ if data: return self._session.post( self.__v1() + "/records", data=data).json() else: return self._session.get(self.__v1() + "/records").json()
def records(self, data=None): """ Gets / Sets records. """ if data: return self._session.post( self.__v1() + "/records", data=data).json() else: return self._session.get(self.__v1() + "/records").json()
[ "Gets", "/", "Sets", "records", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L202-L210
[ "def", "records", "(", "self", ",", "data", "=", "None", ")", ":", "if", "data", ":", "return", "self", ".", "_session", ".", "post", "(", "self", ".", "__v1", "(", ")", "+", "\"/records\"", ",", "data", "=", "data", ")", ".", "json", "(", ")", ...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.delays
Gets / Sets the delays.
hoverpy/hp.py
def delays(self, delays=[]): """ Gets / Sets the delays. """ if delays: return self._session.put( self.__v1() + "/delays", data=json.dumps(delays)).json() else: return self._session.get(self.__v1() + "/delays").json()
def delays(self, delays=[]): """ Gets / Sets the delays. """ if delays: return self._session.put( self.__v1() + "/delays", data=json.dumps(delays)).json() else: return self._session.get(self.__v1() + "/delays").json()
[ "Gets", "/", "Sets", "the", "delays", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L212-L220
[ "def", "delays", "(", "self", ",", "delays", "=", "[", "]", ")", ":", "if", "delays", ":", "return", "self", ".", "_session", ".", "put", "(", "self", ".", "__v1", "(", ")", "+", "\"/delays\"", ",", "data", "=", "json", ".", "dumps", "(", "delays...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.addDelay
Adds delays.
hoverpy/hp.py
def addDelay(self, urlPattern="", delay=0, httpMethod=None): """ Adds delays. """ print("addDelay is deprecated please use delays instead") delay = {"urlPattern": urlPattern, "delay": delay} if httpMethod: delay["httpMethod"] = httpMethod return self....
def addDelay(self, urlPattern="", delay=0, httpMethod=None): """ Adds delays. """ print("addDelay is deprecated please use delays instead") delay = {"urlPattern": urlPattern, "delay": delay} if httpMethod: delay["httpMethod"] = httpMethod return self....
[ "Adds", "delays", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L222-L230
[ "def", "addDelay", "(", "self", ",", "urlPattern", "=", "\"\"", ",", "delay", "=", "0", ",", "httpMethod", "=", "None", ")", ":", "print", "(", "\"addDelay is deprecated please use delays instead\"", ")", "delay", "=", "{", "\"urlPattern\"", ":", "urlPattern", ...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__enableProxy
Set the required environment variables to enable the use of hoverfly as a proxy.
hoverpy/hp.py
def __enableProxy(self): """ Set the required environment variables to enable the use of hoverfly as a proxy. """ os.environ[ "HTTP_PROXY"] = self.httpProxy() os.environ[ "HTTPS_PROXY"] = self.httpsProxy() os.environ["REQUESTS_CA_BUNDLE"] = os.pat...
def __enableProxy(self): """ Set the required environment variables to enable the use of hoverfly as a proxy. """ os.environ[ "HTTP_PROXY"] = self.httpProxy() os.environ[ "HTTPS_PROXY"] = self.httpsProxy() os.environ["REQUESTS_CA_BUNDLE"] = os.pat...
[ "Set", "the", "required", "environment", "variables", "to", "enable", "the", "use", "of", "hoverfly", "as", "a", "proxy", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L270-L282
[ "def", "__enableProxy", "(", "self", ")", ":", "os", ".", "environ", "[", "\"HTTP_PROXY\"", "]", "=", "self", ".", "httpProxy", "(", ")", "os", ".", "environ", "[", "\"HTTPS_PROXY\"", "]", "=", "self", ".", "httpsProxy", "(", ")", "os", ".", "environ",...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__writepid
HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID.
hoverpy/hp.py
def __writepid(self, pid): """ HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID. """ import tempfile d = tempfile.gettem...
def __writepid(self, pid): """ HoverFly fails to launch if it's already running on the same ports. So we have to keep track of them using temp files with the proxy port and admin port, containing the processe's PID. """ import tempfile d = tempfile.gettem...
[ "HoverFly", "fails", "to", "launch", "if", "it", "s", "already", "running", "on", "the", "same", "ports", ".", "So", "we", "have", "to", "keep", "track", "of", "them", "using", "temp", "files", "with", "the", "proxy", "port", "and", "admin", "port", "c...
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L292-L304
[ "def", "__writepid", "(", "self", ",", "pid", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ","...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__rmpid
Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down.
hoverpy/hp.py
def __rmpid(self): """ Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down. """ import tempfile d = tempfile.gettempdir() name = os.path.join(d, "hoverpy.%i.%i"%(self._proxyPort, self._adminPort)) ...
def __rmpid(self): """ Remove the PID file on shutdown, unfortunately this may not get called if not given the time to shut down. """ import tempfile d = tempfile.gettempdir() name = os.path.join(d, "hoverpy.%i.%i"%(self._proxyPort, self._adminPort)) ...
[ "Remove", "the", "PID", "file", "on", "shutdown", "unfortunately", "this", "may", "not", "get", "called", "if", "not", "given", "the", "time", "to", "shut", "down", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L306-L317
[ "def", "__rmpid", "(", "self", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ",", "self", ".", ...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__kill_if_not_shut_properly
If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately
hoverpy/hp.py
def __kill_if_not_shut_properly(self): """ If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately """ imp...
def __kill_if_not_shut_properly(self): """ If the HoverFly process on these given ports did not shut down correctly, then kill the pid before launching a new instance. todo: this will kill existing HoverFly processes on those ports indiscriminately """ imp...
[ "If", "the", "HoverFly", "process", "on", "these", "given", "ports", "did", "not", "shut", "down", "correctly", "then", "kill", "the", "pid", "before", "launching", "a", "new", "instance", ".", "todo", ":", "this", "will", "kill", "existing", "HoverFly", "...
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L319-L342
[ "def", "__kill_if_not_shut_properly", "(", "self", ")", ":", "import", "tempfile", "d", "=", "tempfile", ".", "gettempdir", "(", ")", "name", "=", "os", ".", "path", ".", "join", "(", "d", ",", "\"hoverpy.%i.%i\"", "%", "(", "self", ".", "_proxyPort", ",...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__start
Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning.
hoverpy/hp.py
def __start(self): """ Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning. """ logging.debug("starting %i" % id(self)) self.__kill_if_not_shut_properly() self.FNULL = open(os.devnull, 'w') ...
def __start(self): """ Start the hoverfly process. This function waits until it can make contact with the hoverfly API before returning. """ logging.debug("starting %i" % id(self)) self.__kill_if_not_shut_properly() self.FNULL = open(os.devnull, 'w') ...
[ "Start", "the", "hoverfly", "process", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L344-L385
[ "def", "__start", "(", "self", ")", ":", "logging", ".", "debug", "(", "\"starting %i\"", "%", "id", "(", "self", ")", ")", "self", ".", "__kill_if_not_shut_properly", "(", ")", "self", ".", "FNULL", "=", "open", "(", "os", ".", "devnull", ",", "'w'", ...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__stop
Stop the hoverfly process.
hoverpy/hp.py
def __stop(self): """ Stop the hoverfly process. """ if logging: logging.debug("stopping") self._process.terminate() # communicate means we wait until the process # was actually terminated, this removes some # warnings in python3 self._...
def __stop(self): """ Stop the hoverfly process. """ if logging: logging.debug("stopping") self._process.terminate() # communicate means we wait until the process # was actually terminated, this removes some # warnings in python3 self._...
[ "Stop", "the", "hoverfly", "process", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L387-L404
[ "def", "__stop", "(", "self", ")", ":", "if", "logging", ":", "logging", ".", "debug", "(", "\"stopping\"", ")", "self", ".", "_process", ".", "terminate", "(", ")", "# communicate means we wait until the process", "# was actually terminated, this removes some", "# wa...
e153ec57f80634019d827d378f184c01fedc5a0e
train
HoverPy.__flags
Internal method. Turns arguments into flags.
hoverpy/hp.py
def __flags(self): """ Internal method. Turns arguments into flags. """ flags = [] if self._capture: flags.append("-capture") if self._spy: flags.append("-spy") if self._dbpath: flags += ["-db-path", self._dbpath] fl...
def __flags(self): """ Internal method. Turns arguments into flags. """ flags = [] if self._capture: flags.append("-capture") if self._spy: flags.append("-spy") if self._dbpath: flags += ["-db-path", self._dbpath] fl...
[ "Internal", "method", ".", "Turns", "arguments", "into", "flags", "." ]
SpectoLabs/hoverpy
python
https://github.com/SpectoLabs/hoverpy/blob/e153ec57f80634019d827d378f184c01fedc5a0e/hoverpy/hp.py#L406-L460
[ "def", "__flags", "(", "self", ")", ":", "flags", "=", "[", "]", "if", "self", ".", "_capture", ":", "flags", ".", "append", "(", "\"-capture\"", ")", "if", "self", ".", "_spy", ":", "flags", ".", "append", "(", "\"-spy\"", ")", "if", "self", ".", ...
e153ec57f80634019d827d378f184c01fedc5a0e
train
JsonTableFileLoader.load
Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Schema (1): single table ...
pytablereader/json/core.py
def load(self): """ Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Sc...
def load(self): """ Extract tabular data as |TableData| instances from a JSON file. |load_source_desc_file| This method can be loading four types of JSON formats: **(1)** Single table data in a file: .. code-block:: json :caption: Acceptable JSON Sc...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "JSON", "file", ".", "|load_source_desc_file|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/json/core.py#L67-L439
[ "def", "load", "(", "self", ")", ":", "formatter", "=", "JsonTableFormatter", "(", "self", ".", "load_dict", "(", ")", ")", "formatter", ".", "accept", "(", "self", ")", "return", "formatter", ".", "to_table_data", "(", ")" ]
bc3c057a2cc775bcce690e0e9019c2907b638101
train
MediaWikiTableFileLoader.load
Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== Format specifier Value after ...
pytablereader/mediawiki/core.py
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== ...
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki file. |load_source_desc_file| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "MediaWiki", "file", ".", "|load_source_desc_file|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L51-L86
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "encoding", "=", "get_file_encoding", "(", "self", ".", "source", ",", "self", ".", "encoding", ")", "with", ...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
MediaWikiTableTextLoader.load
Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== ============================================== Format specifier ...
pytablereader/mediawiki/core.py
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== =========================================...
def load(self): """ Extract tabular data as |TableData| instances from a MediaWiki text object. |load_source_desc_text| :return: Loaded table data iterator. |load_table_name_desc| =================== =========================================...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "MediaWiki", "text", "object", ".", "|load_source_desc_text|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/mediawiki/core.py#L113-L147
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "formatter", "=", "MediaWikiTableFormatter", "(", "self", ".", "source", ")", "formatter", ".", "accept", "(", "self", ")", ...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
DockJsonManipulator.get_dock_json
return dock json from existing build json
osbs/build/manipulate.py
def get_dock_json(self): """ return dock json from existing build json """ env_json = self.build_json['spec']['strategy']['customStrategy']['env'] try: p = [env for env in env_json if env["name"] == "ATOMIC_REACTOR_PLUGINS"] except TypeError: raise RuntimeError("\...
def get_dock_json(self): """ return dock json from existing build json """ env_json = self.build_json['spec']['strategy']['customStrategy']['env'] try: p = [env for env in env_json if env["name"] == "ATOMIC_REACTOR_PLUGINS"] except TypeError: raise RuntimeError("\...
[ "return", "dock", "json", "from", "existing", "build", "json" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L21-L32
[ "def", "get_dock_json", "(", "self", ")", ":", "env_json", "=", "self", ".", "build_json", "[", "'spec'", "]", "[", "'strategy'", "]", "[", "'customStrategy'", "]", "[", "'env'", "]", "try", ":", "p", "=", "[", "env", "for", "env", "in", "env_json", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
DockJsonManipulator.dock_json_get_plugin_conf
Return the configuration for a plugin. Raises KeyError if there are no plugins of that type. Raises IndexError if the named plugin is not listed.
osbs/build/manipulate.py
def dock_json_get_plugin_conf(self, plugin_type, plugin_name): """ Return the configuration for a plugin. Raises KeyError if there are no plugins of that type. Raises IndexError if the named plugin is not listed. """ match = [x for x in self.dock_json[plugin_type] if x.g...
def dock_json_get_plugin_conf(self, plugin_type, plugin_name): """ Return the configuration for a plugin. Raises KeyError if there are no plugins of that type. Raises IndexError if the named plugin is not listed. """ match = [x for x in self.dock_json[plugin_type] if x.g...
[ "Return", "the", "configuration", "for", "a", "plugin", "." ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L34-L42
[ "def", "dock_json_get_plugin_conf", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "match", "=", "[", "x", "for", "x", "in", "self", ".", "dock_json", "[", "plugin_type", "]", "if", "x", ".", "get", "(", "'name'", ")", "==", "plugin_name"...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
DockJsonManipulator.remove_plugin
if config contains plugin, remove it
osbs/build/manipulate.py
def remove_plugin(self, plugin_type, plugin_name): """ if config contains plugin, remove it """ for p in self.dock_json[plugin_type]: if p.get('name') == plugin_name: self.dock_json[plugin_type].remove(p) break
def remove_plugin(self, plugin_type, plugin_name): """ if config contains plugin, remove it """ for p in self.dock_json[plugin_type]: if p.get('name') == plugin_name: self.dock_json[plugin_type].remove(p) break
[ "if", "config", "contains", "plugin", "remove", "it" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L44-L51
[ "def", "remove_plugin", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "for", "p", "in", "self", ".", "dock_json", "[", "plugin_type", "]", ":", "if", "p", ".", "get", "(", "'name'", ")", "==", "plugin_name", ":", "self", ".", "dock_jso...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
DockJsonManipulator.add_plugin
if config has plugin, override it, else add it
osbs/build/manipulate.py
def add_plugin(self, plugin_type, plugin_name, args_dict): """ if config has plugin, override it, else add it """ plugin_modified = False for plugin in self.dock_json[plugin_type]: if plugin['name'] == plugin_name: plugin['args'] = args_dict ...
def add_plugin(self, plugin_type, plugin_name, args_dict): """ if config has plugin, override it, else add it """ plugin_modified = False for plugin in self.dock_json[plugin_type]: if plugin['name'] == plugin_name: plugin['args'] = args_dict ...
[ "if", "config", "has", "plugin", "override", "it", "else", "add", "it" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L53-L66
[ "def", "add_plugin", "(", "self", ",", "plugin_type", ",", "plugin_name", ",", "args_dict", ")", ":", "plugin_modified", "=", "False", "for", "plugin", "in", "self", ".", "dock_json", "[", "plugin_type", "]", ":", "if", "plugin", "[", "'name'", "]", "==", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
DockJsonManipulator.dock_json_has_plugin_conf
Check whether a plugin is configured.
osbs/build/manipulate.py
def dock_json_has_plugin_conf(self, plugin_type, plugin_name): """ Check whether a plugin is configured. """ try: self.dock_json_get_plugin_conf(plugin_type, plugin_name) return True except (KeyError, IndexError): return False
def dock_json_has_plugin_conf(self, plugin_type, plugin_name): """ Check whether a plugin is configured. """ try: self.dock_json_get_plugin_conf(plugin_type, plugin_name) return True except (KeyError, IndexError): return False
[ "Check", "whether", "a", "plugin", "is", "configured", "." ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/manipulate.py#L68-L77
[ "def", "dock_json_has_plugin_conf", "(", "self", ",", "plugin_type", ",", "plugin_name", ")", ":", "try", ":", "self", ".", "dock_json_get_plugin_conf", "(", "plugin_type", ",", "plugin_name", ")", "return", "True", "except", "(", "KeyError", ",", "IndexError", ...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
TableUrlLoaderFactory.create_from_path
Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ========================================...
pytablereader/factory/_url.py
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ...
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================================= ===================================== Extension Loader ...
[ "Create", "a", "file", "loader", "from", "the", "file", "extension", "to", "loading", "file", ".", "Supported", "file", "extensions", "are", "as", "follows", ":" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L53-L100
[ "def", "create_from_path", "(", "self", ")", ":", "import", "requests", "url_path", "=", "urlparse", "(", "self", ".", "__url", ")", ".", "path", "try", ":", "url_extension", "=", "get_extension", "(", "url_path", ".", "rstrip", "(", "\"/\"", ")", ")", "...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableUrlLoaderFactory.create_from_format_name
Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader ========================== ====================================== ``"csv"`` ...
pytablereader/factory/_url.py
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader =========================...
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ========================== ====================================== Format name Loader =========================...
[ "Create", "a", "file", "loader", "from", "a", "format", "name", ".", "Supported", "file", "formats", "are", "as", "follows", ":" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L102-L148
[ "def", "create_from_format_name", "(", "self", ",", "format_name", ")", ":", "import", "requests", "logger", ".", "debug", "(", "\"TableUrlLoaderFactory: name={}\"", ".", "format", "(", "format_name", ")", ")", "loader_class", "=", "self", ".", "_get_loader_class", ...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableUrlLoaderFactory._get_extension_loader_mapping
:return: Mappings of format-extension and loader class. :rtype: dict
pytablereader/factory/_url.py
def _get_extension_loader_mapping(self): """ :return: Mappings of format-extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "asp": HtmlTableTextLoader, "aspx": H...
def _get_extension_loader_mapping(self): """ :return: Mappings of format-extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "asp": HtmlTableTextLoader, "aspx": H...
[ ":", "return", ":", "Mappings", "of", "format", "-", "extension", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L204-L223
[ "def", "_get_extension_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"asp\"", ":", "HtmlTableTextLoader", ",", "\"aspx\"", ":", "HtmlTableTextLoader", ",",...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableUrlLoaderFactory._get_format_name_loader_mapping
:return: Mappings of format-name and loader class. :rtype: dict
pytablereader/factory/_url.py
def _get_format_name_loader_mapping(self): """ :return: Mappings of format-name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
def _get_format_name_loader_mapping(self): """ :return: Mappings of format-name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
[ ":", "return", ":", "Mappings", "of", "format", "-", "name", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_url.py#L225-L242
[ "def", "_get_format_name_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"excel\"", ":", "ExcelTableFileLoader", ",", "\"json_lines\"", ":", "JsonLinesTableTex...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
PodResponse.get_container_image_ids
Find the image IDs the containers use. :return: dict, image tag to docker ID
osbs/build/pod_response.py
def get_container_image_ids(self): """ Find the image IDs the containers use. :return: dict, image tag to docker ID """ statuses = graceful_chain_get(self.json, "status", "containerStatuses") if statuses is None: return {} def remove_prefix(image_id...
def get_container_image_ids(self): """ Find the image IDs the containers use. :return: dict, image tag to docker ID """ statuses = graceful_chain_get(self.json, "status", "containerStatuses") if statuses is None: return {} def remove_prefix(image_id...
[ "Find", "the", "image", "IDs", "the", "containers", "use", "." ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L33-L51
[ "def", "get_container_image_ids", "(", "self", ")", ":", "statuses", "=", "graceful_chain_get", "(", "self", ".", "json", ",", "\"status\"", ",", "\"containerStatuses\"", ")", "if", "statuses", "is", "None", ":", "return", "{", "}", "def", "remove_prefix", "("...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
PodResponse.get_failure_reason
Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code
osbs/build/pod_response.py
def get_failure_reason(self): """ Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code """ ...
def get_failure_reason(self): """ Find the reason a pod failed :return: dict, which will always have key 'reason': reason: brief reason for state containerID (if known): ID of container exitCode (if known): numeric exit code """ ...
[ "Find", "the", "reason", "a", "pod", "failed" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/pod_response.py#L53-L108
[ "def", "get_failure_reason", "(", "self", ")", ":", "reason_key", "=", "'reason'", "cid_key", "=", "'containerID'", "exit_key", "=", "'exitCode'", "pod_status", "=", "self", ".", "json", ".", "get", "(", "'status'", ",", "{", "}", ")", "statuses", "=", "po...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
BuildResponse.get_error_message
Return an error message based on atomic-reactor's metadata
osbs/build/build_response.py
def get_error_message(self): """ Return an error message based on atomic-reactor's metadata """ error_reason = self.get_error_reason() if error_reason: error_message = error_reason.get('pod') or None if error_message: return "Error in pod: ...
def get_error_message(self): """ Return an error message based on atomic-reactor's metadata """ error_reason = self.get_error_reason() if error_reason: error_message = error_reason.get('pod') or None if error_message: return "Error in pod: ...
[ "Return", "an", "error", "message", "based", "on", "atomic", "-", "reactor", "s", "metadata" ]
projectatomic/osbs-client
python
https://github.com/projectatomic/osbs-client/blob/571fe035dab3a7c02e1dccd5d65ffd75be750458/osbs/build/build_response.py#L108-L123
[ "def", "get_error_message", "(", "self", ")", ":", "error_reason", "=", "self", ".", "get_error_reason", "(", ")", "if", "error_reason", ":", "error_message", "=", "error_reason", ".", "get", "(", "'pod'", ")", "or", "None", "if", "error_message", ":", "retu...
571fe035dab3a7c02e1dccd5d65ffd75be750458
train
TableFileLoaderFactory.create_from_path
Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ========================== ======================================= ...
pytablereader/factory/_file.py
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ====================...
def create_from_path(self): """ Create a file loader from the file extension to loading file. Supported file extensions are as follows: ========================== ======================================= Extension Loader ====================...
[ "Create", "a", "file", "loader", "from", "the", "file", "extension", "to", "loading", "file", ".", "Supported", "file", "extensions", "are", "as", "follows", ":" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L49-L85
[ "def", "create_from_path", "(", "self", ")", ":", "loader", "=", "self", ".", "_create_from_extension", "(", "self", ".", "file_extension", ")", "logger", ".", "debug", "(", "\"TableFileLoaderFactory.create_from_path: extension={}, loader={}\"", ".", "format", "(", "s...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableFileLoaderFactory.create_from_format_name
Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ====================================== ``"csv"`` :py:class:`~.CsvTa...
pytablereader/factory/_file.py
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ===================...
def create_from_format_name(self, format_name): """ Create a file loader from a format name. Supported file formats are as follows: ================ ====================================== Format name Loader ================ ===================...
[ "Create", "a", "file", "loader", "from", "a", "format", "name", ".", "Supported", "file", "formats", "are", "as", "follows", ":" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L87-L125
[ "def", "create_from_format_name", "(", "self", ",", "format_name", ")", ":", "loader", "=", "self", ".", "_create_from_format_name", "(", "format_name", ")", "logger", ".", "debug", "(", "\"TableFileLoaderFactory.create_from_format_name: name={}, loader={}\"", ".", "forma...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableFileLoaderFactory._get_extension_loader_mapping
:return: Mappings of format extension and loader class. :rtype: dict
pytablereader/factory/_file.py
def _get_extension_loader_mapping(self): """ :return: Mappings of format extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "htm": HtmlTableFileLoader, "md": Mar...
def _get_extension_loader_mapping(self): """ :return: Mappings of format extension and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "htm": HtmlTableFileLoader, "md": Mar...
[ ":", "return", ":", "Mappings", "of", "format", "extension", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L141-L158
[ "def", "_get_extension_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"htm\"", ":", "HtmlTableFileLoader", ",", "\"md\"", ":", "MarkdownTableFileLoader", ",...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
TableFileLoaderFactory._get_format_name_loader_mapping
:return: Mappings of format name and loader class. :rtype: dict
pytablereader/factory/_file.py
def _get_format_name_loader_mapping(self): """ :return: Mappings of format name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
def _get_format_name_loader_mapping(self): """ :return: Mappings of format name and loader class. :rtype: dict """ loader_table = self._get_common_loader_mapping() loader_table.update( { "excel": ExcelTableFileLoader, "json_lin...
[ ":", "return", ":", "Mappings", "of", "format", "name", "and", "loader", "class", ".", ":", "rtype", ":", "dict" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/factory/_file.py#L160-L177
[ "def", "_get_format_name_loader_mapping", "(", "self", ")", ":", "loader_table", "=", "self", ".", "_get_common_loader_mapping", "(", ")", "loader_table", ".", "update", "(", "{", "\"excel\"", ":", "ExcelTableFileLoader", ",", "\"json_lines\"", ":", "JsonLinesTableFil...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
ExcelTableFileLoader.load
Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| =================== ==============================...
pytablereader/spreadsheet/excelloader.py
def load(self): """ Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| ===============...
def load(self): """ Extract tabular data as |TableData| instances from an Excel file. |spreadsheet_load_desc| :return: Loaded |TableData| iterator. |TableData| created for each sheet in the workbook. |load_table_name_desc| ===============...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "an", "Excel", "file", ".", "|spreadsheet_load_desc|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/spreadsheet/excelloader.py#L59-L122
[ "def", "load", "(", "self", ")", ":", "import", "xlrd", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "try", ":", "workbook", "=", "xlrd", ".", "open_workbook", "(", "self", ".", "source", ")", "except", "...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
LtsvTableFileLoader.load
Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier Value after the replacement ...
pytablereader/ltsv/core.py
def load(self): """ Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier ...
def load(self): """ Extract tabular data as |TableData| instances from a LTSV file. |load_source_desc_file| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier ...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "LTSV", "file", ".", "|load_source_desc_file|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L106-L140
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "encoding", "=", "get_file_encoding", "(", "self", ".", "source", ",", "self", ".", "encoding", ")", "self", ...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
LtsvTableTextLoader.load
Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format specifier Value after the replaceme...
pytablereader/ltsv/core.py
def load(self): """ Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spe...
def load(self): """ Extract tabular data as |TableData| instances from a LTSV text object. |load_source_desc_text| :return: Loaded table data. |load_table_name_desc| =================== ======================================== Format spe...
[ "Extract", "tabular", "data", "as", "|TableData|", "instances", "from", "a", "LTSV", "text", "object", ".", "|load_source_desc_text|" ]
thombashi/pytablereader
python
https://github.com/thombashi/pytablereader/blob/bc3c057a2cc775bcce690e0e9019c2907b638101/pytablereader/ltsv/core.py#L164-L197
[ "def", "load", "(", "self", ")", ":", "self", ".", "_validate", "(", ")", "self", ".", "_logger", ".", "logging_load", "(", ")", "self", ".", "_ltsv_input_stream", "=", "self", ".", "source", ".", "splitlines", "(", ")", "for", "data_matrix", "in", "se...
bc3c057a2cc775bcce690e0e9019c2907b638101
train
EventSummary.totals
Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }``
nhlscrapi/games/eventsummary.py
def totals(self): """ Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }`` """ def agg(d): keys = ['g','a','p','pm','pn','pim','s','ab','ms','h...
def totals(self): """ Computes and returns dictionary containing home/away by player, shots and face-off totals :returns: dict of the form ``{ 'home/away': { 'all_keys': w_numeric_data } }`` """ def agg(d): keys = ['g','a','p','pm','pn','pim','s','ab','ms','h...
[ "Computes", "and", "returns", "dictionary", "containing", "home", "/", "away", "by", "player", "shots", "and", "face", "-", "off", "totals", ":", "returns", ":", "dict", "of", "the", "form", "{", "home", "/", "away", ":", "{", "all_keys", ":", "w_numeric...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L137-L154
[ "def", "totals", "(", "self", ")", ":", "def", "agg", "(", "d", ")", ":", "keys", "=", "[", "'g'", ",", "'a'", ",", "'p'", ",", "'pm'", ",", "'pn'", ",", "'pim'", ",", "'s'", ",", "'ab'", ",", "'ms'", ",", "'ht'", ",", "'gv'", ",", "'tk'", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummary.filter_players
Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`home_players` and :py:func:`away_players`
nhlscrapi/games/eventsummary.py
def filter_players(self, pl_filter): """ Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:f...
def filter_players(self, pl_filter): """ Return the subset home and away players that satisfy the provided filter function. :param pl_filter: function that takes a by player dictionary and returns bool :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:f...
[ "Return", "the", "subset", "home", "and", "away", "players", "that", "satisfy", "the", "provided", "filter", "function", ".", ":", "param", "pl_filter", ":", "function", "that", "takes", "a", "by", "player", "dictionary", "and", "returns", "bool", ":", "retu...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L156-L170
[ "def", "filter_players", "(", "self", ",", "pl_filter", ")", ":", "def", "each", "(", "d", ")", ":", "return", "{", "k", ":", "v", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", "if", "pl_filter", "(", "k", ",", "v", ")", "}", "retu...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummary.sort_players
Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) dict key to sort on :param sort_func: (def None) sorting function :param r...
nhlscrapi/games/eventsummary.py
def sort_players(self, sort_key=None, sort_func=None, reverse=False): """ Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) ...
def sort_players(self, sort_key=None, sort_func=None, reverse=False): """ Return all home and away by player info sorted by either the provided key or function. Must provide at least one of the two parameters. Can sort either ascending or descending. :param sort_key: (def None) ...
[ "Return", "all", "home", "and", "away", "by", "player", "info", "sorted", "by", "either", "the", "provided", "key", "or", "function", ".", "Must", "provide", "at", "least", "one", "of", "the", "two", "parameters", ".", "Can", "sort", "either", "ascending",...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L172-L194
[ "def", "sort_players", "(", "self", ",", "sort_key", "=", "None", ",", "sort_func", "=", "None", ",", "reverse", "=", "False", ")", ":", "def", "each", "(", "d", ")", ":", "t", "=", "[", "]", "for", "num", ",", "v", "in", "d", ".", "items", "("...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummary.top_by_key
Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`home_players` and :py:func:`away_players`
nhlscrapi/games/eventsummary.py
def top_by_key(self, sort_key): """ Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`ho...
def top_by_key(self, sort_key): """ Return home/away by player info for the players on each team that are first in the provided category. :param sort_key: str, the dictionary key to be sorted on :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py:func:`ho...
[ "Return", "home", "/", "away", "by", "player", "info", "for", "the", "players", "on", "each", "team", "that", "are", "first", "in", "the", "provided", "category", ".", ":", "param", "sort_key", ":", "str", "the", "dictionary", "key", "to", "be", "sorted"...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L226-L237
[ "def", "top_by_key", "(", "self", ",", "sort_key", ")", ":", "res", "=", "self", ".", "sort_players", "(", "sort_key", "=", "sort_key", ",", "reverse", "=", "True", ")", "return", "{", "'home'", ":", "res", "[", "'home'", "]", "[", "0", "]", ",", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventSummary.top_by_func
Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the form ``{ 'home/away': { by_player_dict } }``. See :py...
nhlscrapi/games/eventsummary.py
def top_by_func(self, sort_func): """ Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the...
def top_by_func(self, sort_func): """ Return home/away by player info for the players on each team who come in first according to the provided sorting function. Will perform ascending sort. :param sort_func: function that yields the sorting quantity :returns: dict of the...
[ "Return", "home", "/", "away", "by", "player", "info", "for", "the", "players", "on", "each", "team", "who", "come", "in", "first", "according", "to", "the", "provided", "sorting", "function", ".", "Will", "perform", "ascending", "sort", ".", ":", "param",...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/eventsummary.py#L239-L251
[ "def", "top_by_func", "(", "self", ",", "sort_func", ")", ":", "res", "=", "self", ".", "sort_players", "(", "sort_func", "=", "sort_func", ",", "reverse", "=", "True", ")", "return", "{", "'home'", ":", "res", "[", "'home'", "]", "[", "0", "]", ",",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
encode
Encode one argument/object to json
zombie/proxy/client.py
def encode(obj): """ Encode one argument/object to json """ if hasattr(obj, 'json'): return obj.json if hasattr(obj, '__json__'): return obj.__json__() return dumps(obj)
def encode(obj): """ Encode one argument/object to json """ if hasattr(obj, 'json'): return obj.json if hasattr(obj, '__json__'): return obj.__json__() return dumps(obj)
[ "Encode", "one", "argument", "/", "object", "to", "json" ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L14-L22
[ "def", "encode", "(", "obj", ")", ":", "if", "hasattr", "(", "obj", ",", "'json'", ")", ":", "return", "obj", ".", "json", "if", "hasattr", "(", "obj", ",", "'__json__'", ")", ":", "return", "obj", ".", "__json__", "(", ")", "return", "dumps", "(",...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
encode_args
Encode a list of arguments
zombie/proxy/client.py
def encode_args(args, extra=False): """ Encode a list of arguments """ if not args: return '' methodargs = ', '.join([encode(a) for a in args]) if extra: methodargs += ', ' return methodargs
def encode_args(args, extra=False): """ Encode a list of arguments """ if not args: return '' methodargs = ', '.join([encode(a) for a in args]) if extra: methodargs += ', ' return methodargs
[ "Encode", "a", "list", "of", "arguments" ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L25-L36
[ "def", "encode_args", "(", "args", ",", "extra", "=", "False", ")", ":", "if", "not", "args", ":", "return", "''", "methodargs", "=", "', '", ".", "join", "(", "[", "encode", "(", "a", ")", "for", "a", "in", "args", "]", ")", "if", "extra", ":", ...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
ZombieProxyClient._send
Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute
zombie/proxy/client.py
def _send(self, javascript): """ Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute """ # Prepend JS to switch to the proper client context. message = """ var _ctx = ...
def _send(self, javascript): """ Establishes a socket connection to the zombie.js server and sends Javascript instructions. :param js: the Javascript string to execute """ # Prepend JS to switch to the proper client context. message = """ var _ctx = ...
[ "Establishes", "a", "socket", "connection", "to", "the", "zombie", ".", "js", "server", "and", "sends", "Javascript", "instructions", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L123-L141
[ "def", "_send", "(", "self", ",", "javascript", ")", ":", "# Prepend JS to switch to the proper client context.", "message", "=", "\"\"\"\n var _ctx = ctx_switch('%s'),\n browser = _ctx[0],\n ELEMENTS = _ctx[1];\n %s\n \"\"\"", "%", ...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
ZombieProxyClient.wait
Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method
zombie/proxy/client.py
def wait(self, method, *args): """ Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method """ methodargs = encode_args(args, extra=True) js = """ ...
def wait(self, method, *args): """ Call a method on the zombie.js Browser instance and wait on a callback. :param method: the method to call, e.g., html() :param args: one of more arguments for the method """ methodargs = encode_args(args, extra=True) js = """ ...
[ "Call", "a", "method", "on", "the", "zombie", ".", "js", "Browser", "instance", "and", "wait", "on", "a", "callback", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L168-L179
[ "def", "wait", "(", "self", ",", "method", ",", "*", "args", ")", ":", "methodargs", "=", "encode_args", "(", "args", ",", "extra", "=", "True", ")", "js", "=", "\"\"\"\n %s(%s wait_callback);\n \"\"\"", "%", "(", "method", ",", "methodargs", "...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
ZombieProxyClient.create_element
Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to the following Javascript... browser.query('body > div') ...
zombie/proxy/client.py
def create_element(self, method, args=None): """ Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to ...
def create_element(self, method, args=None): """ Evaluate a browser method and CSS selector against the document (or an optional context DOMNode) and return a single :class:`zombie.dom.DOMNode` object, e.g., browser._node('query', 'body > div') ...roughly translates to ...
[ "Evaluate", "a", "browser", "method", "and", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", "DOMNode", ")", "and", "return", "a", "single", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", "object", "e", ...
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L213-L245
[ "def", "create_element", "(", "self", ",", "method", ",", "args", "=", "None", ")", ":", "if", "args", "is", "None", ":", "arguments", "=", "''", "else", ":", "arguments", "=", "\"(%s)\"", "%", "encode_args", "(", "args", ")", "js", "=", "\"\"\"\n ...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
ZombieProxyClient.create_elements
Execute a browser method that will return a list of elements. Returns a list of the element indexes
zombie/proxy/client.py
def create_elements(self, method, args=[]): """ Execute a browser method that will return a list of elements. Returns a list of the element indexes """ args = encode_args(args) js = """ create_elements(ELEMENTS, %(method)s(%(args)s)) """ % { ...
def create_elements(self, method, args=[]): """ Execute a browser method that will return a list of elements. Returns a list of the element indexes """ args = encode_args(args) js = """ create_elements(ELEMENTS, %(method)s(%(args)s)) """ % { ...
[ "Execute", "a", "browser", "method", "that", "will", "return", "a", "list", "of", "elements", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/proxy/client.py#L247-L263
[ "def", "create_elements", "(", "self", ",", "method", ",", "args", "=", "[", "]", ")", ":", "args", "=", "encode_args", "(", "args", ")", "js", "=", "\"\"\"\n create_elements(ELEMENTS, %(method)s(%(args)s))\n \"\"\"", "%", "{", "'method'", ":", "...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
Browser.fill
Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining.
zombie/browser.py
def fill(self, field, value): """ Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining. """ self.client.nowait('browser.fill', (field,...
def fill(self, field, value): """ Fill a specified form field in the current document. :param field: an instance of :class:`zombie.dom.DOMNode` :param value: any string value :return: self to allow function chaining. """ self.client.nowait('browser.fill', (field,...
[ "Fill", "a", "specified", "form", "field", "in", "the", "current", "document", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L39-L48
[ "def", "fill", "(", "self", ",", "field", ",", "value", ")", ":", "self", ".", "client", ".", "nowait", "(", "'browser.fill'", ",", "(", "field", ",", "value", ")", ")", "return", "self" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
Browser.query
Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.labnotes.org/selectors) :param context: an (optional) i...
zombie/browser.py
def query(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.la...
def query(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a single :class:`zombie.dom.DOMNode` object. :param selector: a string CSS selector (http://zombie.la...
[ "Evaluate", "a", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", "and", "return", "a", "single", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNo...
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L124-L136
[ "def", "query", "(", "self", ",", "selector", ",", "context", "=", "None", ")", ":", "element", "=", "self", ".", "client", ".", "create_element", "(", "'browser.query'", ",", "(", "selector", ",", "context", ")", ")", "return", "DOMNode", ".", "factory"...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
Browser.queryAll
Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zombie.labnotes.org/selectors) :param context: an (optional)...
zombie/browser.py
def queryAll(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zomb...
def queryAll(self, selector, context=None): """ Evaluate a CSS selector against the document (or an optional context :class:`zombie.dom.DOMNode`) and return a list of :class:`zombie.dom.DOMNode` objects. :param selector: a string CSS selector (http://zomb...
[ "Evaluate", "a", "CSS", "selector", "against", "the", "document", "(", "or", "an", "optional", "context", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", "and", "return", "a", "list", "of", ":", "class", ":", "zombie", ".", "dom", ".", ...
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L138-L150
[ "def", "queryAll", "(", "self", ",", "selector", ",", "context", "=", "None", ")", ":", "elements", "=", "self", ".", "client", ".", "create_elements", "(", "'browser.queryAll'", ",", "(", "selector", ",", "context", ")", ")", "return", "[", "DOMNode", "...
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
Browser.link
Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector (http://zombie.labnotes.org/sele...
zombie/browser.py
def link(self, selector): """ Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector ...
def link(self, selector): """ Finds and returns a link ``<a>`` element (:class:`zombie.dom.DOMNode`). You can use a CSS selector or find a link by its text contents (case sensitive, but ignores leading/trailing spaces). :param selector: an optional string CSS selector ...
[ "Finds", "and", "returns", "a", "link", "<a", ">", "element", "(", ":", "class", ":", "zombie", ".", "dom", ".", "DOMNode", ")", ".", "You", "can", "use", "a", "CSS", "selector", "or", "find", "a", "link", "by", "its", "text", "contents", "(", "cas...
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L234-L244
[ "def", "link", "(", "self", ",", "selector", ")", ":", "element", "=", "self", ".", "client", ".", "create_element", "(", "'browser.link'", ",", "(", "selector", ",", ")", ")", "return", "DOMNode", "(", "element", ",", "self", ")" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
DOMNode.value
Used to set the ``value`` of form elements.
zombie/browser.py
def value(self, value): """ Used to set the ``value`` of form elements. """ self.client.nowait( 'set_field', (Literal('browser'), self.element, value))
def value(self, value): """ Used to set the ``value`` of form elements. """ self.client.nowait( 'set_field', (Literal('browser'), self.element, value))
[ "Used", "to", "set", "the", "value", "of", "form", "elements", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L527-L532
[ "def", "value", "(", "self", ",", "value", ")", ":", "self", ".", "client", ".", "nowait", "(", "'set_field'", ",", "(", "Literal", "(", "'browser'", ")", ",", "self", ".", "element", ",", "value", ")", ")" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
DOMNode.fire
Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining.
zombie/browser.py
def fire(self, event): """ Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining. """ self.browser.fire(self.element, event) return self
def fire(self, event): """ Fires a specified DOM event on the current node. :param event: the name of the event to fire (e.g., 'click'). Returns the :class:`zombie.dom.DOMNode` to allow function chaining. """ self.browser.fire(self.element, event) return self
[ "Fires", "a", "specified", "DOM", "event", "on", "the", "current", "node", "." ]
ryanpetrello/python-zombie
python
https://github.com/ryanpetrello/python-zombie/blob/638916572d8ee5ebbdb2dcfc5000a952e99f280f/zombie/browser.py#L562-L571
[ "def", "fire", "(", "self", ",", "event", ")", ":", "self", ".", "browser", ".", "fire", "(", "self", ".", "element", ",", "event", ")", "return", "self" ]
638916572d8ee5ebbdb2dcfc5000a952e99f280f
train
Game.load_all
Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails
nhlscrapi/games/game.py
def load_all(self): """ Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails """ try: self.toi.load_all() self.rosters.load_all() #self.summary.load_all() ...
def load_all(self): """ Force all reports to be loaded and parsed instead of lazy loading on demand. :returns: ``self`` or ``None`` if load fails """ try: self.toi.load_all() self.rosters.load_all() #self.summary.load_all() ...
[ "Force", "all", "reports", "to", "be", "loaded", "and", "parsed", "instead", "of", "lazy", "loading", "on", "demand", ".", ":", "returns", ":", "self", "or", "None", "if", "load", "fails" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/game.py#L135-L150
[ "def", "load_all", "(", "self", ")", ":", "try", ":", "self", ".", "toi", ".", "load_all", "(", ")", "self", ".", "rosters", ".", "load_all", "(", ")", "#self.summary.load_all()", "self", ".", "play_by_play", ".", "load_all", "(", ")", "self", ".", "fa...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
Game.matchup
Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, 'final': final, ...
nhlscrapi/games/game.py
def matchup(self): """ Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, ...
def matchup(self): """ Return the game meta information displayed in report banners including team names, final score, game date, location, and attendance. Data format is .. code:: python { 'home': home, 'away': away, ...
[ "Return", "the", "game", "meta", "information", "displayed", "in", "report", "banners", "including", "team", "names", "final", "score", "game", "date", "location", "and", "attendance", ".", "Data", "format", "is", "..", "code", "::", "python", "{", "home", "...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/game.py#L159-L185
[ "def", "matchup", "(", "self", ")", ":", "if", "self", ".", "play_by_play", ".", "matchup", ":", "return", "self", ".", "play_by_play", ".", "matchup", "elif", "self", ".", "rosters", ".", "matchup", ":", "return", "self", ".", "rosters", ".", "matchup",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
articleAPI._utf8_encode
Ensures all values are encoded in UTF-8 and converts them to lowercase
nytimesarticle.py
def _utf8_encode(self, d): """ Ensures all values are encoded in UTF-8 and converts them to lowercase """ for k, v in d.items(): if isinstance(v, str): d[k] = v.encode('utf8').lower() if isinstance(v, list): for index,item ...
def _utf8_encode(self, d): """ Ensures all values are encoded in UTF-8 and converts them to lowercase """ for k, v in d.items(): if isinstance(v, str): d[k] = v.encode('utf8').lower() if isinstance(v, list): for index,item ...
[ "Ensures", "all", "values", "are", "encoded", "in", "UTF", "-", "8", "and", "converts", "them", "to", "lowercase" ]
evansherlock/nytimesarticle
python
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L29-L44
[ "def", "_utf8_encode", "(", "self", ",", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "str", ")", ":", "d", "[", "k", "]", "=", "v", ".", "encode", "(", "'utf8'", ")", ".", ...
89f551699ffb11f71b47271246d350a1043e9326
train
articleAPI._bool_encode
Converts bool values to lowercase strings
nytimesarticle.py
def _bool_encode(self, d): """ Converts bool values to lowercase strings """ for k, v in d.items(): if isinstance(v, bool): d[k] = str(v).lower() return d
def _bool_encode(self, d): """ Converts bool values to lowercase strings """ for k, v in d.items(): if isinstance(v, bool): d[k] = str(v).lower() return d
[ "Converts", "bool", "values", "to", "lowercase", "strings" ]
evansherlock/nytimesarticle
python
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L46-L55
[ "def", "_bool_encode", "(", "self", ",", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "bool", ")", ":", "d", "[", "k", "]", "=", "str", "(", "v", ")", ".", "lower", "(", "...
89f551699ffb11f71b47271246d350a1043e9326
train
articleAPI._options
Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values
nytimesarticle.py
def _options(self, **kwargs): """ Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values """ def _format_fq(d): for k,v in d.items(): if isinstance(v, list): d[k] = ' '.join(m...
def _options(self, **kwargs): """ Formats search parameters/values for use with API :param \*\*kwargs: search parameters/values """ def _format_fq(d): for k,v in d.items(): if isinstance(v, list): d[k] = ' '.join(m...
[ "Formats", "search", "parameters", "/", "values", "for", "use", "with", "API", ":", "param", "\\", "*", "\\", "*", "kwargs", ":", "search", "parameters", "/", "values" ]
evansherlock/nytimesarticle
python
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L57-L89
[ "def", "_options", "(", "self", ",", "*", "*", "kwargs", ")", ":", "def", "_format_fq", "(", "d", ")", ":", "for", "k", ",", "v", "in", "d", ".", "items", "(", ")", ":", "if", "isinstance", "(", "v", ",", "list", ")", ":", "d", "[", "k", "]...
89f551699ffb11f71b47271246d350a1043e9326
train
articleAPI.search
Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, includes JSON (.json) and JSONP (.jsonp). Defaults to '.json'. :...
nytimesarticle.py
def search(self, response_format = None, key = None, **kwargs): """ Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, inc...
def search(self, response_format = None, key = None, **kwargs): """ Calls the API and returns a dictionary of the search results :param response_format: the format that the API uses for its response, inc...
[ "Calls", "the", "API", "and", "returns", "a", "dictionary", "of", "the", "search", "results", ":", "param", "response_format", ":", "the", "format", "that", "the", "API", "uses", "for", "its", "response", "includes", "JSON", "(", ".", "json", ")", "and", ...
evansherlock/nytimesarticle
python
https://github.com/evansherlock/nytimesarticle/blob/89f551699ffb11f71b47271246d350a1043e9326/nytimesarticle.py#L91-L115
[ "def", "search", "(", "self", ",", "response_format", "=", "None", ",", "key", "=", "None", ",", "*", "*", "kwargs", ")", ":", "if", "response_format", "is", "None", ":", "response_format", "=", "self", ".", "response_format", "if", "key", "is", "None", ...
89f551699ffb11f71b47271246d350a1043e9326
train
parse
Fully parses game summary report. :returns: boolean success indicator :rtype: bool
nhlscrapi/scrapr/gamesummrep.py
def parse(self): """Fully parses game summary report. :returns: boolean success indicator :rtype: bool """ r = super(GameSummRep, self).parse() try: self.parse_scoring_summary() return r and False except: return False
def parse(self): """Fully parses game summary report. :returns: boolean success indicator :rtype: bool """ r = super(GameSummRep, self).parse() try: self.parse_scoring_summary() return r and False except: return False
[ "Fully", "parses", "game", "summary", "report", ".", ":", "returns", ":", "boolean", "success", "indicator", ":", "rtype", ":", "bool" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/gamesummrep.py#L18-L28
[ "def", "parse", "(", "self", ")", ":", "r", "=", "super", "(", "GameSummRep", ",", "self", ")", ".", "parse", "(", ")", "try", ":", "self", ".", "parse_scoring_summary", "(", ")", "return", "r", "and", "False", "except", ":", "return", "False" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
EventFactory.Create
Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event`
nhlscrapi/games/events.py
def Create(event_type): """ Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event...
def Create(event_type): """ Factory method creates objects derived from :py:class`.Event` with class name matching the :py:class`.EventType`. :param event_type: number for type of event :returns: constructed event corresponding to ``event_type`` :rtype: :py:class:`.Event...
[ "Factory", "method", "creates", "objects", "derived", "from", ":", "py", ":", "class", ".", "Event", "with", "class", "name", "matching", "the", ":", "py", ":", "class", ".", "EventType", ".", ":", "param", "event_type", ":", "number", "for", "type", "of...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/events.py#L167-L183
[ "def", "Create", "(", "event_type", ")", ":", "if", "event_type", "in", "EventType", ".", "Name", ":", "# unknown event type gets base class", "if", "EventType", ".", "Name", "[", "event_type", "]", "==", "Event", ".", "__name__", ":", "return", "Event", "(", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
TOI.home_shift_summ
:returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }``
nhlscrapi/games/toi.py
def home_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_home: self.__wrapped_home = self.__wrap(self._home.by_player) return self.__wra...
def home_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the home team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_home: self.__wrapped_home = self.__wrap(self._home.by_player) return self.__wra...
[ ":", "returns", ":", ":", "py", ":", "class", ":", ".", "ShiftSummary", "by", "player", "for", "the", "home", "team", ":", "rtype", ":", "dict", "{", "player_num", ":", "shift_summary_obj", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/toi.py#L88-L96
[ "def", "home_shift_summ", "(", "self", ")", ":", "if", "not", "self", ".", "__wrapped_home", ":", "self", ".", "__wrapped_home", "=", "self", ".", "__wrap", "(", "self", ".", "_home", ".", "by_player", ")", "return", "self", ".", "__wrapped_home" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
TOI.away_shift_summ
:returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }``
nhlscrapi/games/toi.py
def away_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_away: self.__wrapped_away = self.__wrap(self._away.by_player) return self.__wra...
def away_shift_summ(self): """ :returns: :py:class:`.ShiftSummary` by player for the away team :rtype: dict ``{ player_num: shift_summary_obj }`` """ if not self.__wrapped_away: self.__wrapped_away = self.__wrap(self._away.by_player) return self.__wra...
[ ":", "returns", ":", ":", "py", ":", "class", ":", ".", "ShiftSummary", "by", "player", "for", "the", "away", "team", ":", "rtype", ":", "dict", "{", "player_num", ":", "shift_summary_obj", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/toi.py#L100-L108
[ "def", "away_shift_summ", "(", "self", ")", ":", "if", "not", "self", ".", "__wrapped_away", ":", "self", ".", "__wrapped_away", "=", "self", ".", "__wrap", "(", "self", ".", "_away", ".", "by_player", ")", "return", "self", ".", "__wrapped_away" ]
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RosterRep.parse
Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/rosterrep.py
def parse(self): """ Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise """ try: return super(RosterRep, self).parse() \ .parse_rosters() \ .p...
def parse(self): """ Retreive and parse Play by Play data for the given :py:class:`nhlscrapi.games.game.GameKey`` :returns: ``self`` on success, ``None`` otherwise """ try: return super(RosterRep, self).parse() \ .parse_rosters() \ .p...
[ "Retreive", "and", "parse", "Play", "by", "Play", "data", "for", "the", "given", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "game", ".", "GameKey" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L65-L79
[ "def", "parse", "(", "self", ")", ":", "try", ":", "return", "super", "(", "RosterRep", ",", "self", ")", ".", "parse", "(", ")", ".", "parse_rosters", "(", ")", ".", "parse_scratches", "(", ")", ".", "parse_coaches", "(", ")", ".", "parse_officials", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RosterRep.parse_rosters
Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/rosterrep.py
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['home', 'away']: self.rosters[t] = ...
def parse_rosters(self): """ Parse the home and away game rosters :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['home', 'away']: self.rosters[t] = ...
[ "Parse", "the", "home", "and", "away", "game", "rosters" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L82-L96
[ "def", "parse_rosters", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "not", "self", ".", "__blocks", ":", "self", ".", "__pl_blocks", "(", "lx_doc", ")", "for", "t", "in", "[", "'home'", ",", "'away'", "]", ":", "s...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RosterRep.parse_scratches
Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/rosterrep.py
def parse_scratches(self): """ Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['aw_scr', 'h_scr']: ix = 'awa...
def parse_scratches(self): """ Parse the home and away healthy scratches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() if not self.__blocks: self.__pl_blocks(lx_doc) for t in ['aw_scr', 'h_scr']: ix = 'awa...
[ "Parse", "the", "home", "and", "away", "healthy", "scratches" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L99-L113
[ "def", "parse_scratches", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "not", "self", ".", "__blocks", ":", "self", ".", "__pl_blocks", "(", "lx_doc", ")", "for", "t", "in", "[", "'aw_scr'", ",", "'h_scr'", "]", ":",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RosterRep.parse_coaches
Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/rosterrep.py
def parse_coaches(self): """ Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() tr = lx_doc.xpath('//tr[@id="HeadCoaches"]')[0] for i, td in enumerate(tr): txt = td.xpath('.//text()') ...
def parse_coaches(self): """ Parse the home and away coaches :returns: ``self`` on success, ``None`` otherwise """ lx_doc = self.html_doc() tr = lx_doc.xpath('//tr[@id="HeadCoaches"]')[0] for i, td in enumerate(tr): txt = td.xpath('.//text()') ...
[ "Parse", "the", "home", "and", "away", "coaches" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L116-L131
[ "def", "parse_coaches", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "tr", "=", "lx_doc", ".", "xpath", "(", "'//tr[@id=\"HeadCoaches\"]'", ")", "[", "0", "]", "for", "i", ",", "td", "in", "enumerate", "(", "tr", ")", ":",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RosterRep.parse_officials
Parse the officials :returns: ``self`` on success, ``None`` otherwise
nhlscrapi/scrapr/rosterrep.py
def parse_officials(self): """ Parse the officials :returns: ``self`` on success, ``None`` otherwise """ # begin proper body of method lx_doc = self.html_doc() off_parser = opm(self.game_key.season) self.officials = off_parser(lx_doc) return self...
def parse_officials(self): """ Parse the officials :returns: ``self`` on success, ``None`` otherwise """ # begin proper body of method lx_doc = self.html_doc() off_parser = opm(self.game_key.season) self.officials = off_parser(lx_doc) return self...
[ "Parse", "the", "officials" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rosterrep.py#L134-L145
[ "def", "parse_officials", "(", "self", ")", ":", "# begin proper body of method", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "off_parser", "=", "opm", "(", "self", ".", "game_key", ".", "season", ")", "self", ".", "officials", "=", "off_parser", "(", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
is_email
Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis
pyisemail/__init__.py
def is_email(address, check_dns=False, diagnose=False): """Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis """ ...
def is_email(address, check_dns=False, diagnose=False): """Validate an email address. Keyword arguments: address --- the email address as a string check_dns --- flag for whether to check the DNS status of the domain diagnose --- flag for whether to return True/False or a Diagnosis """ ...
[ "Validate", "an", "email", "address", "." ]
michaelherold/pyIsEmail
python
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/__init__.py#L12-L28
[ "def", "is_email", "(", "address", ",", "check_dns", "=", "False", ",", "diagnose", "=", "False", ")", ":", "threshold", "=", "BaseDiagnosis", ".", "CATEGORIES", "[", "\"THRESHOLD\"", "]", "d", "=", "ParserValidator", "(", ")", ".", "is_email", "(", "addre...
dd42d6425c59e5061fc214d42672210dccc64cf5
train
dispatch_loader
Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing an object of type :py:class:`scrapr.ReportLoader` :...
nhlscrapi/games/repscrwrap.py
def dispatch_loader(scraper, loader_name): """ Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing ...
def dispatch_loader(scraper, loader_name): """ Decorator that enforces one time loading for scrapers. The one time loading is applied to partial loaders, e.g. only parse and load the home team roster once. This is not meant to be used directly. :param scraper: property name (string) containing ...
[ "Decorator", "that", "enforces", "one", "time", "loading", "for", "scrapers", ".", "The", "one", "time", "loading", "is", "applied", "to", "partial", "loaders", "e", ".", "g", ".", "only", "parse", "and", "load", "the", "home", "team", "roster", "once", ...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/repscrwrap.py#L5-L28
[ "def", "dispatch_loader", "(", "scraper", ",", "loader_name", ")", ":", "l", "=", "'.'", ".", "join", "(", "[", "scraper", ",", "loader_name", "]", ")", "def", "wrapper", "(", "f", ")", ":", "@", "wraps", "(", "f", ")", "def", "wrapped", "(", "self...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
TOIRepBase.parse_shifts
Parse shifts from TOI report :returns: self if successfule else None
nhlscrapi/scrapr/toirep.py
def parse_shifts(self): """ Parse shifts from TOI report :returns: self if successfule else None """ lx_doc = self.html_doc() pl_heads = lx_doc.xpath('//td[contains(@class, "playerHeading")]') for pl in pl_heads: sh_sum = { } ...
def parse_shifts(self): """ Parse shifts from TOI report :returns: self if successfule else None """ lx_doc = self.html_doc() pl_heads = lx_doc.xpath('//td[contains(@class, "playerHeading")]') for pl in pl_heads: sh_sum = { } ...
[ "Parse", "shifts", "from", "TOI", "report", ":", "returns", ":", "self", "if", "successfule", "else", "None" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/toirep.py#L130-L159
[ "def", "parse_shifts", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "pl_heads", "=", "lx_doc", ".", "xpath", "(", "'//td[contains(@class, \"playerHeading\")]'", ")", "for", "pl", "in", "pl_heads", ":", "sh_sum", "=", "{", "}", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
DNSValidator.is_valid
Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False)
pyisemail/validators/dns_validator.py
def is_valid(self, domain, diagnose=False): """Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False) """ return_status = [ValidDiagnosis()] dn...
def is_valid(self, domain, diagnose=False): """Check whether a domain has a valid MX or A record. Keyword arguments: domain --- the domain to check diagnose --- flag to report a diagnosis or a boolean (default False) """ return_status = [ValidDiagnosis()] dn...
[ "Check", "whether", "a", "domain", "has", "a", "valid", "MX", "or", "A", "record", "." ]
michaelherold/pyIsEmail
python
https://github.com/michaelherold/pyIsEmail/blob/dd42d6425c59e5061fc214d42672210dccc64cf5/pyisemail/validators/dns_validator.py#L8-L111
[ "def", "is_valid", "(", "self", ",", "domain", ",", "diagnose", "=", "False", ")", ":", "return_status", "=", "[", "ValidDiagnosis", "(", ")", "]", "dns_checked", "=", "False", "# http://tools.ietf.org/html/rfc5321#section-2.3.5", "# Names that can be resolved to MX R...
dd42d6425c59e5061fc214d42672210dccc64cf5
train
ReportLoader.html_doc
:returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output
nhlscrapi/scrapr/reportloader.py
def html_doc(self): """ :returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output """ if self.__lx_doc is None: cn = NHLCn() if hasattr(cn, self.report_type): html = getattr(cn, self.rep...
def html_doc(self): """ :returns: the lxml processed html document :rtype: ``lxml.html.document_fromstring`` output """ if self.__lx_doc is None: cn = NHLCn() if hasattr(cn, self.report_type): html = getattr(cn, self.rep...
[ ":", "returns", ":", "the", "lxml", "processed", "html", "document", ":", "rtype", ":", "lxml", ".", "html", ".", "document_fromstring", "output" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/reportloader.py#L52-L71
[ "def", "html_doc", "(", "self", ")", ":", "if", "self", ".", "__lx_doc", "is", "None", ":", "cn", "=", "NHLCn", "(", ")", "if", "hasattr", "(", "cn", ",", "self", ".", "report_type", ")", ":", "html", "=", "getattr", "(", "cn", ",", "self", ".", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
ReportLoader.parse_matchup
Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None``
nhlscrapi/scrapr/reportloader.py
def parse_matchup(self): """ Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None`` """ lx_doc = self.html_doc() try: if not self.matchup: self.matchup = self._fill_meta(lx_doc) return se...
def parse_matchup(self): """ Parse the banner matchup meta info for the game. :returns: ``self`` on success or ``None`` """ lx_doc = self.html_doc() try: if not self.matchup: self.matchup = self._fill_meta(lx_doc) return se...
[ "Parse", "the", "banner", "matchup", "meta", "info", "for", "the", "game", ".", ":", "returns", ":", "self", "on", "success", "or", "None" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/reportloader.py#L74-L86
[ "def", "parse_matchup", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "try", ":", "if", "not", "self", ".", "matchup", ":", "self", ".", "matchup", "=", "self", ".", "_fill_meta", "(", "lx_doc", ")", "return", "self", "exce...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
RTSS.parse_plays_stream
Generate and yield a stream of parsed plays. Useful for per play processing.
nhlscrapi/scrapr/rtss.py
def parse_plays_stream(self): """Generate and yield a stream of parsed plays. Useful for per play processing.""" lx_doc = self.html_doc() if lx_doc is not None: parser = PlayParser(self.game_key.season, self.game_key.game_type) plays = lx_doc.xpath('//tr[@class =...
def parse_plays_stream(self): """Generate and yield a stream of parsed plays. Useful for per play processing.""" lx_doc = self.html_doc() if lx_doc is not None: parser = PlayParser(self.game_key.season, self.game_key.game_type) plays = lx_doc.xpath('//tr[@class =...
[ "Generate", "and", "yield", "a", "stream", "of", "parsed", "plays", ".", "Useful", "for", "per", "play", "processing", "." ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L48-L59
[ "def", "parse_plays_stream", "(", "self", ")", ":", "lx_doc", "=", "self", ".", "html_doc", "(", ")", "if", "lx_doc", "is", "not", "None", ":", "parser", "=", "PlayParser", "(", "self", ".", "game_key", ".", "season", ",", "self", ".", "game_key", ".",...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
PlayParser.ColMap
Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type :rtype: dict, keys are ``'play_num...
nhlscrapi/scrapr/rtss.py
def ColMap(season): """ Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type ...
def ColMap(season): """ Returns a dictionary mapping the type of information in the RTSS play row to the appropriate column number. The column locations pre/post 2008 are different. :param season: int for the season number :returns: mapping of RTSS column to info type ...
[ "Returns", "a", "dictionary", "mapping", "the", "type", "of", "information", "in", "the", "RTSS", "play", "row", "to", "the", "appropriate", "column", "number", ".", "The", "column", "locations", "pre", "/", "post", "2008", "are", "different", ".", ":", "p...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L71-L92
[ "def", "ColMap", "(", "season", ")", ":", "if", "c", ".", "MIN_SEASON", "<=", "season", "<=", "c", ".", "MAX_SEASON", ":", "return", "{", "\"play_num\"", ":", "0", ",", "\"per\"", ":", "1", ",", "\"str\"", ":", "2", ",", "\"time\"", ":", "3", ",", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
PlayParser.build_play
Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form .. code:: python ...
nhlscrapi/scrapr/rtss.py
def build_play(self, pbp_row): """ Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form ...
def build_play(self, pbp_row): """ Parses table row from RTSS. These are the rows tagged with ``<tr class='evenColor' ... >``. Result set contains :py:class:`nhlscrapi.games.playbyplay.Strength` and :py:class:`nhlscrapi.games.events.EventType` objects. Returned play data is in the form ...
[ "Parses", "table", "row", "from", "RTSS", ".", "These", "are", "the", "rows", "tagged", "with", "<tr", "class", "=", "evenColor", "...", ">", ".", "Result", "set", "contains", ":", "py", ":", "class", ":", "nhlscrapi", ".", "games", ".", "playbyplay", ...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L94-L145
[ "def", "build_play", "(", "self", ",", "pbp_row", ")", ":", "d", "=", "pbp_row", ".", "findall", "(", "'./td'", ")", "c", "=", "PlayParser", ".", "ColMap", "(", "self", ".", "season", ")", "p", "=", "{", "}", "to_dig", "=", "lambda", "t", ":", "i...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
PlayParser.__skaters
Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name]
nhlscrapi/scrapr/rtss.py
def __skaters(self, tab): """ Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name] """ res ...
def __skaters(self, tab): """ Constructs dictionary of players on the ice in the provided table at time of play. :param tab: RTSS table of the skaters and goalie on at the time of the play :rtype: dictionary, key = player number, value = [position, name] """ res ...
[ "Constructs", "dictionary", "of", "players", "on", "the", "ice", "in", "the", "provided", "table", "at", "time", "of", "play", ".", ":", "param", "tab", ":", "RTSS", "table", "of", "the", "skaters", "and", "goalie", "on", "at", "the", "time", "of", "th...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/scrapr/rtss.py#L147-L166
[ "def", "__skaters", "(", "self", ",", "tab", ")", ":", "res", "=", "{", "}", "for", "td", "in", "tab", ".", "iterchildren", "(", ")", ":", "if", "len", "(", "td", ")", ":", "pl_data", "=", "td", ".", "xpath", "(", "\"./table/tr\"", ")", "pl", "...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
exclude_from
Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob']
nhlscrapi/_tools.py
def exclude_from(l, containing = [], equal_to = []): """Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob...
def exclude_from(l, containing = [], equal_to = []): """Exclude elements in list l containing any elements from list ex. Example: >>> l = ['bob', 'r', 'rob\r', '\r\nrobert'] >>> containing = ['\n', '\r'] >>> equal_to = ['r'] >>> exclude_from(l, containing, equal_to) ['bob...
[ "Exclude", "elements", "in", "list", "l", "containing", "any", "elements", "from", "list", "ex", ".", "Example", ":", ">>>", "l", "=", "[", "bob", "r", "rob", "\\", "r", "\\", "r", "\\", "nrobert", "]", ">>>", "containing", "=", "[", "\\", "n", "\\...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/_tools.py#L23-L35
[ "def", "exclude_from", "(", "l", ",", "containing", "=", "[", "]", ",", "equal_to", "=", "[", "]", ")", ":", "cont", "=", "lambda", "li", ":", "any", "(", "c", "in", "li", "for", "c", "in", "containing", ")", "eq", "=", "lambda", "li", ":", "an...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
calc_surfdist
inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot - annot file (e.g. lh.aparc.a2009s.annot, with full path) reg - registration file (lh.sphere.reg) origin - the label from which we calculate distances target - target surface (e.g. ...
nipype/surfdist_nipype.py
def calc_surfdist(surface, labels, annot, reg, origin, target): import nibabel as nib import numpy as np import os from surfdist import load, utils, surfdist import csv """ inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot -...
def calc_surfdist(surface, labels, annot, reg, origin, target): import nibabel as nib import numpy as np import os from surfdist import load, utils, surfdist import csv """ inputs: surface - surface file (e.g. lh.pial, with full path) labels - label file (e.g. lh.cortex.label, with full path) annot -...
[ "inputs", ":", "surface", "-", "surface", "file", "(", "e", ".", "g", ".", "lh", ".", "pial", "with", "full", "path", ")", "labels", "-", "label", "file", "(", "e", ".", "g", ".", "lh", ".", "cortex", ".", "label", "with", "full", "path", ")", ...
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/nipype/surfdist_nipype.py#L20-L56
[ "def", "calc_surfdist", "(", "surface", ",", "labels", ",", "annot", ",", "reg", ",", "origin", ",", "target", ")", ":", "import", "nibabel", "as", "nib", "import", "numpy", "as", "np", "import", "os", "from", "surfdist", "import", "load", ",", "utils", ...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
stack_files
This function takes a list of files as input and vstacks them
nipype/surfdist_nipype.py
def stack_files(files, hemi, source, target): """ This function takes a list of files as input and vstacks them """ import csv import os import numpy as np fname = "sdist_%s_%s_%s.csv" % (hemi, source, target) filename = os.path.join(os.getcwd(),fname) alldist = [] for dfile in files: alldist...
def stack_files(files, hemi, source, target): """ This function takes a list of files as input and vstacks them """ import csv import os import numpy as np fname = "sdist_%s_%s_%s.csv" % (hemi, source, target) filename = os.path.join(os.getcwd(),fname) alldist = [] for dfile in files: alldist...
[ "This", "function", "takes", "a", "list", "of", "files", "as", "input", "and", "vstacks", "them" ]
NeuroanatomyAndConnectivity/surfdist
python
https://github.com/NeuroanatomyAndConnectivity/surfdist/blob/849fdfbb2822ff1aa530a3b0bc955a4312e3edf1/nipype/surfdist_nipype.py#L58-L77
[ "def", "stack_files", "(", "files", ",", "hemi", ",", "source", ",", "target", ")", ":", "import", "csv", "import", "os", "import", "numpy", "as", "np", "fname", "=", "\"sdist_%s_%s_%s.csv\"", "%", "(", "hemi", ",", "source", ",", "target", ")", "filenam...
849fdfbb2822ff1aa530a3b0bc955a4312e3edf1
train
PostOutputSerializer.get_short_url
Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend.
mezzanine_api/serializers.py
def get_short_url(self, obj): """ Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend. """ try: url = obj.get_absolute_url() ...
def get_short_url(self, obj): """ Get short URL of blog post like '/blog/<slug>/' using ``get_absolute_url`` if available. Removes dependency on reverse URLs of Mezzanine views when deploying Mezzanine only as an API backend. """ try: url = obj.get_absolute_url() ...
[ "Get", "short", "URL", "of", "blog", "post", "like", "/", "blog", "/", "<slug", ">", "/", "using", "get_absolute_url", "if", "available", ".", "Removes", "dependency", "on", "reverse", "URLs", "of", "Mezzanine", "views", "when", "deploying", "Mezzanine", "on...
gcushen/mezzanine-api
python
https://github.com/gcushen/mezzanine-api/blob/8e9d519c0008f46019302fa3d4bf83c372d4ae21/mezzanine_api/serializers.py#L253-L262
[ "def", "get_short_url", "(", "self", ",", "obj", ")", ":", "try", ":", "url", "=", "obj", ".", "get_absolute_url", "(", ")", "except", "NoReverseMatch", ":", "url", "=", "'/blog/'", "+", "obj", ".", "slug", "return", "url" ]
8e9d519c0008f46019302fa3d4bf83c372d4ae21
train
FaceOffComparison.head_to_head
Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player :returns: dict, either ``{ }`` or the following ...
nhlscrapi/games/faceoffcomp.py
def head_to_head(self, home_num, away_num): """ Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player ...
def head_to_head(self, home_num, away_num): """ Return the head-to-head face-off outcomes between two players. If the matchup didn't happen, ``{ }`` is returned. :param home_num: the number of the home team player :param away_num: the number of the away team player ...
[ "Return", "the", "head", "-", "to", "-", "head", "face", "-", "off", "outcomes", "between", "two", "players", ".", "If", "the", "matchup", "didn", "t", "happen", "{", "}", "is", "returned", ".", ":", "param", "home_num", ":", "the", "number", "of", "...
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L47-L72
[ "def", "head_to_head", "(", "self", ",", "home_num", ",", "away_num", ")", ":", "if", "home_num", "in", "self", ".", "home_fo", "and", "away_num", "in", "self", ".", "home_fo", "[", "home_num", "]", "[", "'opps'", "]", ":", "h_fo", "=", "self", ".", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b
train
FaceOffComparison.team_totals
Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }``
nhlscrapi/games/faceoffcomp.py
def team_totals(self): """ Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }`` """ if self.__team_tots is None: self.__team_tots = self.__comp_tot() return {...
def team_totals(self): """ Returns the overall faceoff win/total breakdown for home and away as :returns: dict, ``{ 'home/away': { 'won': won, 'total': total } }`` """ if self.__team_tots is None: self.__team_tots = self.__comp_tot() return {...
[ "Returns", "the", "overall", "faceoff", "win", "/", "total", "breakdown", "for", "home", "and", "away", "as", ":", "returns", ":", "dict", "{", "home", "/", "away", ":", "{", "won", ":", "won", "total", ":", "total", "}", "}" ]
robhowley/nhlscrapi
python
https://github.com/robhowley/nhlscrapi/blob/2273683497ff27b0e92c8d1557ff0ce962dbf43b/nhlscrapi/games/faceoffcomp.py#L75-L87
[ "def", "team_totals", "(", "self", ")", ":", "if", "self", ".", "__team_tots", "is", "None", ":", "self", ".", "__team_tots", "=", "self", ".", "__comp_tot", "(", ")", "return", "{", "t", ":", "self", ".", "__team_tots", "[", "t", "]", "[", "'all'", ...
2273683497ff27b0e92c8d1557ff0ce962dbf43b