repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
spry-group/python-vultr
vultr/v1_firewall.py
VultrFirewall.group_list
def group_list(self, params=None): ''' /v1/firewall/group_list GET - account List all firewall groups on the current account. Link: https://www.vultr.com/api/#firewall_group_list ''' params = params if params else dict() return self.request('/v1/firewall/group_li...
python
def group_list(self, params=None): ''' /v1/firewall/group_list GET - account List all firewall groups on the current account. Link: https://www.vultr.com/api/#firewall_group_list ''' params = params if params else dict() return self.request('/v1/firewall/group_li...
[ "def", "group_list", "(", "self", ",", "params", "=", "None", ")", ":", "params", "=", "params", "if", "params", "else", "dict", "(", ")", "return", "self", ".", "request", "(", "'/v1/firewall/group_list'", ",", "params", ",", "'GET'", ")" ]
/v1/firewall/group_list GET - account List all firewall groups on the current account. Link: https://www.vultr.com/api/#firewall_group_list
[ "/", "v1", "/", "firewall", "/", "group_list", "GET", "-", "account", "List", "all", "firewall", "groups", "on", "the", "current", "account", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_firewall.py#L10-L18
spry-group/python-vultr
vultr/v1_account.py
VultrAccount.info
def info(self, params=None): ''' /v1/account/info GET - account Retrieve information about the current account Link: https://www.vultr.com/api/#account_info ''' params = params if params else dict() return self.request('/v1/account/info', params, 'GET')
python
def info(self, params=None): ''' /v1/account/info GET - account Retrieve information about the current account Link: https://www.vultr.com/api/#account_info ''' params = params if params else dict() return self.request('/v1/account/info', params, 'GET')
[ "def", "info", "(", "self", ",", "params", "=", "None", ")", ":", "params", "=", "params", "if", "params", "else", "dict", "(", ")", "return", "self", ".", "request", "(", "'/v1/account/info'", ",", "params", ",", "'GET'", ")" ]
/v1/account/info GET - account Retrieve information about the current account Link: https://www.vultr.com/api/#account_info
[ "/", "v1", "/", "account", "/", "info", "GET", "-", "account", "Retrieve", "information", "about", "the", "current", "account" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_account.py#L10-L18
spry-group/python-vultr
examples/basic_list.py
dump_info
def dump_info(): '''Shows various details about the account & servers''' vultr = Vultr(API_KEY) try: logging.info('Listing account info:\n%s', dumps( vultr.account.info(), indent=2 )) logging.info('Listing apps:\n%s', dumps( vultr.app.list(), indent=2 ...
python
def dump_info(): '''Shows various details about the account & servers''' vultr = Vultr(API_KEY) try: logging.info('Listing account info:\n%s', dumps( vultr.account.info(), indent=2 )) logging.info('Listing apps:\n%s', dumps( vultr.app.list(), indent=2 ...
[ "def", "dump_info", "(", ")", ":", "vultr", "=", "Vultr", "(", "API_KEY", ")", "try", ":", "logging", ".", "info", "(", "'Listing account info:\\n%s'", ",", "dumps", "(", "vultr", ".", "account", ".", "info", "(", ")", ",", "indent", "=", "2", ")", "...
Shows various details about the account & servers
[ "Shows", "various", "details", "about", "the", "account", "&", "servers" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/examples/basic_list.py#L19-L72
spry-group/python-vultr
vultr/v1_regions.py
VultrRegions.availability
def availability(self, dcid, params=None): ''' /v1/regions/availability GET - public Retrieve a list of the VPSPLANIDs currently available in this location. If your account has special plans available, you will need to pass your api_key in in order to see them. For all ot...
python
def availability(self, dcid, params=None): ''' /v1/regions/availability GET - public Retrieve a list of the VPSPLANIDs currently available in this location. If your account has special plans available, you will need to pass your api_key in in order to see them. For all ot...
[ "def", "availability", "(", "self", ",", "dcid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'DCID'", ":", "dcid", "}", ")", "return", "self", ".", "request", "(", "'/v1/regions/availability'", ",", "pa...
/v1/regions/availability GET - public Retrieve a list of the VPSPLANIDs currently available in this location. If your account has special plans available, you will need to pass your api_key in in order to see them. For all other accounts, the API key is not optional. Lin...
[ "/", "v1", "/", "regions", "/", "availability", "GET", "-", "public", "Retrieve", "a", "list", "of", "the", "VPSPLANIDs", "currently", "available", "in", "this", "location", ".", "If", "your", "account", "has", "special", "plans", "available", "you", "will",...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_regions.py#L10-L21
spry-group/python-vultr
vultr/utils.py
update_params
def update_params(params, updates): '''Merges updates into params''' params = params.copy() if isinstance(params, dict) else dict() params.update(updates) return params
python
def update_params(params, updates): '''Merges updates into params''' params = params.copy() if isinstance(params, dict) else dict() params.update(updates) return params
[ "def", "update_params", "(", "params", ",", "updates", ")", ":", "params", "=", "params", ".", "copy", "(", ")", "if", "isinstance", "(", "params", ",", "dict", ")", "else", "dict", "(", ")", "params", ".", "update", "(", "updates", ")", "return", "p...
Merges updates into params
[ "Merges", "updates", "into", "params" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L94-L98
spry-group/python-vultr
vultr/utils.py
VultrBase.set_requests_per_second
def set_requests_per_second(self, req_per_second): '''Adjusts the request/second at run-time''' self.req_per_second = req_per_second self.req_duration = 1 / self.req_per_second
python
def set_requests_per_second(self, req_per_second): '''Adjusts the request/second at run-time''' self.req_per_second = req_per_second self.req_duration = 1 / self.req_per_second
[ "def", "set_requests_per_second", "(", "self", ",", "req_per_second", ")", ":", "self", ".", "req_per_second", "=", "req_per_second", "self", ".", "req_duration", "=", "1", "/", "self", ".", "req_per_second" ]
Adjusts the request/second at run-time
[ "Adjusts", "the", "request", "/", "second", "at", "run", "-", "time" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L21-L24
spry-group/python-vultr
vultr/utils.py
VultrBase._request_get_helper
def _request_get_helper(self, url, params=None): '''API GET request helper''' if not isinstance(params, dict): params = dict() if self.api_key: params['api_key'] = self.api_key return requests.get(url, params=params, timeout=60)
python
def _request_get_helper(self, url, params=None): '''API GET request helper''' if not isinstance(params, dict): params = dict() if self.api_key: params['api_key'] = self.api_key return requests.get(url, params=params, timeout=60)
[ "def", "_request_get_helper", "(", "self", ",", "url", ",", "params", "=", "None", ")", ":", "if", "not", "isinstance", "(", "params", ",", "dict", ")", ":", "params", "=", "dict", "(", ")", "if", "self", ".", "api_key", ":", "params", "[", "'api_key...
API GET request helper
[ "API", "GET", "request", "helper" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L26-L33
spry-group/python-vultr
vultr/utils.py
VultrBase._request_post_helper
def _request_post_helper(self, url, params=None): '''API POST helper''' if self.api_key: query = {'api_key': self.api_key} return requests.post(url, params=query, data=params, timeout=60)
python
def _request_post_helper(self, url, params=None): '''API POST helper''' if self.api_key: query = {'api_key': self.api_key} return requests.post(url, params=query, data=params, timeout=60)
[ "def", "_request_post_helper", "(", "self", ",", "url", ",", "params", "=", "None", ")", ":", "if", "self", ".", "api_key", ":", "query", "=", "{", "'api_key'", ":", "self", ".", "api_key", "}", "return", "requests", ".", "post", "(", "url", ",", "pa...
API POST helper
[ "API", "POST", "helper" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L35-L39
spry-group/python-vultr
vultr/utils.py
VultrBase._request_helper
def _request_helper(self, url, params, method): '''API request helper method''' try: if method == 'POST': return self._request_post_helper(url, params) elif method == 'GET': return self._request_get_helper(url, params) raise VultrError(...
python
def _request_helper(self, url, params, method): '''API request helper method''' try: if method == 'POST': return self._request_post_helper(url, params) elif method == 'GET': return self._request_get_helper(url, params) raise VultrError(...
[ "def", "_request_helper", "(", "self", ",", "url", ",", "params", ",", "method", ")", ":", "try", ":", "if", "method", "==", "'POST'", ":", "return", "self", ".", "_request_post_helper", "(", "url", ",", "params", ")", "elif", "method", "==", "'GET'", ...
API request helper method
[ "API", "request", "helper", "method" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L41-L50
spry-group/python-vultr
vultr/utils.py
VultrBase.request
def request(self, path, params=None, method='GET'): '''API request / call method''' _start = time.time() if not path.startswith('/'): path = '/' + path resp = self._request_helper(self.api_endpoint + path, params, method) if resp.status_code != 200: if ...
python
def request(self, path, params=None, method='GET'): '''API request / call method''' _start = time.time() if not path.startswith('/'): path = '/' + path resp = self._request_helper(self.api_endpoint + path, params, method) if resp.status_code != 200: if ...
[ "def", "request", "(", "self", ",", "path", ",", "params", "=", "None", ",", "method", "=", "'GET'", ")", ":", "_start", "=", "time", ".", "time", "(", ")", "if", "not", "path", ".", "startswith", "(", "'/'", ")", ":", "path", "=", "'/'", "+", ...
API request / call method
[ "API", "request", "/", "call", "method" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/utils.py#L52-L91
spry-group/python-vultr
vultr/v1_snapshot.py
VultrSnapshot.create
def create(self, subid, params=None): ''' /v1/snapshot/create POST - account Create a snapshot from an existing virtual machine. The virtual machine does not need to be stopped. Link: https://www.vultr.com/api/#snapshot_create ''' params = update_params(params, {...
python
def create(self, subid, params=None): ''' /v1/snapshot/create POST - account Create a snapshot from an existing virtual machine. The virtual machine does not need to be stopped. Link: https://www.vultr.com/api/#snapshot_create ''' params = update_params(params, {...
[ "def", "create", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/snapshot/create'", ",", "params", ...
/v1/snapshot/create POST - account Create a snapshot from an existing virtual machine. The virtual machine does not need to be stopped. Link: https://www.vultr.com/api/#snapshot_create
[ "/", "v1", "/", "snapshot", "/", "create", "POST", "-", "account", "Create", "a", "snapshot", "from", "an", "existing", "virtual", "machine", ".", "The", "virtual", "machine", "does", "not", "need", "to", "be", "stopped", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_snapshot.py#L10-L19
spry-group/python-vultr
vultr/v1_snapshot.py
VultrSnapshot.destroy
def destroy(self, snapshotid, params=None): ''' /v1/snapshot/destroy POST - account Destroy (delete) a snapshot. There is no going back from this call. Link: https://www.vultr.com/api/#snapshot_destroy ''' params = update_params(params, {'SNAPSHOTID': snapshotid}...
python
def destroy(self, snapshotid, params=None): ''' /v1/snapshot/destroy POST - account Destroy (delete) a snapshot. There is no going back from this call. Link: https://www.vultr.com/api/#snapshot_destroy ''' params = update_params(params, {'SNAPSHOTID': snapshotid}...
[ "def", "destroy", "(", "self", ",", "snapshotid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SNAPSHOTID'", ":", "snapshotid", "}", ")", "return", "self", ".", "request", "(", "'/v1/snapshot/destroy'", "...
/v1/snapshot/destroy POST - account Destroy (delete) a snapshot. There is no going back from this call. Link: https://www.vultr.com/api/#snapshot_destroy
[ "/", "v1", "/", "snapshot", "/", "destroy", "POST", "-", "account", "Destroy", "(", "delete", ")", "a", "snapshot", ".", "There", "is", "no", "going", "back", "from", "this", "call", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_snapshot.py#L21-L30
spry-group/python-vultr
vultr/v1_server_ipv4.py
VultrServerIPv4.destroy
def destroy(self, subid, ipaddr, params=None): ''' /v1/server/destroy_ipv4 POST - account Removes a secondary IPv4 address from a server. Your server will be hard-restarted. We suggest halting the machine gracefully before removing IPs. Link: https://www.vultr.com/api/#s...
python
def destroy(self, subid, ipaddr, params=None): ''' /v1/server/destroy_ipv4 POST - account Removes a secondary IPv4 address from a server. Your server will be hard-restarted. We suggest halting the machine gracefully before removing IPs. Link: https://www.vultr.com/api/#s...
[ "def", "destroy", "(", "self", ",", "subid", ",", "ipaddr", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'ip'", ":", "ipaddr", "}", ")", "return", "self", ".", "request"...
/v1/server/destroy_ipv4 POST - account Removes a secondary IPv4 address from a server. Your server will be hard-restarted. We suggest halting the machine gracefully before removing IPs. Link: https://www.vultr.com/api/#server_destroy_ipv4
[ "/", "v1", "/", "server", "/", "destroy_ipv4", "POST", "-", "account", "Removes", "a", "secondary", "IPv4", "address", "from", "a", "server", ".", "Your", "server", "will", "be", "hard", "-", "restarted", ".", "We", "suggest", "halting", "the", "machine", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv4.py#L23-L36
spry-group/python-vultr
vultr/v1_server_ipv4.py
VultrServerIPv4.list
def list(self, subid, params=None): ''' /v1/server/list_ipv4 GET - account List the IPv4 information of a virtual machine. IP information is only available for virtual machines in the "active" state. Link: https://www.vultr.com/api/#server_list_ipv4 ''' params = ...
python
def list(self, subid, params=None): ''' /v1/server/list_ipv4 GET - account List the IPv4 information of a virtual machine. IP information is only available for virtual machines in the "active" state. Link: https://www.vultr.com/api/#server_list_ipv4 ''' params = ...
[ "def", "list", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/list_ipv4'", ",", "params", ...
/v1/server/list_ipv4 GET - account List the IPv4 information of a virtual machine. IP information is only available for virtual machines in the "active" state. Link: https://www.vultr.com/api/#server_list_ipv4
[ "/", "v1", "/", "server", "/", "list_ipv4", "GET", "-", "account", "List", "the", "IPv4", "information", "of", "a", "virtual", "machine", ".", "IP", "information", "is", "only", "available", "for", "virtual", "machines", "in", "the", "active", "state", "."...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv4.py#L38-L47
spry-group/python-vultr
vultr/v1_server_ipv4.py
VultrServerIPv4.reverse_default
def reverse_default(self, subid, ipaddr, params=None): ''' /v1/server/reverse_default_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine to the original setting. Upon success, DNS changes may take 6-12 hours to become active. Link: https...
python
def reverse_default(self, subid, ipaddr, params=None): ''' /v1/server/reverse_default_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine to the original setting. Upon success, DNS changes may take 6-12 hours to become active. Link: https...
[ "def", "reverse_default", "(", "self", ",", "subid", ",", "ipaddr", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'ip'", ":", "ipaddr", "}", ")", "return", "self", ".", "...
/v1/server/reverse_default_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine to the original setting. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reverse_default_ipv4
[ "/", "v1", "/", "server", "/", "reverse_default_ipv4", "POST", "-", "account", "Set", "a", "reverse", "DNS", "entry", "for", "an", "IPv4", "address", "of", "a", "virtual", "machine", "to", "the", "original", "setting", ".", "Upon", "success", "DNS", "chang...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv4.py#L49-L62
spry-group/python-vultr
vultr/v1_server_ipv4.py
VultrServerIPv4.reverse_set
def reverse_set(self, subid, ipaddr, entry, params=None): ''' /v1/server/reverse_set_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reve...
python
def reverse_set(self, subid, ipaddr, entry, params=None): ''' /v1/server/reverse_set_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reve...
[ "def", "reverse_set", "(", "self", ",", "subid", ",", "ipaddr", ",", "entry", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'ip'", ":", "ipaddr", ",", "'entry'", ":", "en...
/v1/server/reverse_set_ipv4 POST - account Set a reverse DNS entry for an IPv4 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reverse_set_ipv4
[ "/", "v1", "/", "server", "/", "reverse_set_ipv4", "POST", "-", "account", "Set", "a", "reverse", "DNS", "entry", "for", "an", "IPv4", "address", "of", "a", "virtual", "machine", ".", "Upon", "success", "DNS", "changes", "may", "take", "6", "-", "12", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv4.py#L64-L77
spry-group/python-vultr
vultr/v1_server.py
VultrServer.bandwidth
def bandwidth(self, subid, params=None): ''' /v1/server/bandwidth GET - account Get the bandwidth used by a virtual machine Link: https://www.vultr.com/api/#server_bandwidth ''' params = update_params(params, {'SUBID': subid}) return self.request('/v1/server/band...
python
def bandwidth(self, subid, params=None): ''' /v1/server/bandwidth GET - account Get the bandwidth used by a virtual machine Link: https://www.vultr.com/api/#server_bandwidth ''' params = update_params(params, {'SUBID': subid}) return self.request('/v1/server/band...
[ "def", "bandwidth", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/bandwidth'", ",", "params...
/v1/server/bandwidth GET - account Get the bandwidth used by a virtual machine Link: https://www.vultr.com/api/#server_bandwidth
[ "/", "v1", "/", "server", "/", "bandwidth", "GET", "-", "account", "Get", "the", "bandwidth", "used", "by", "a", "virtual", "machine" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L14-L22
spry-group/python-vultr
vultr/v1_server.py
VultrServer.create
def create(self, dcid, vpsplanid, osid, params=None): ''' /v1/server/create POST - account Create a new virtual machine. You will start being billed for this immediately. The response only contains the SUBID for the new machine. You should use v1/server/list to poll and wait for ...
python
def create(self, dcid, vpsplanid, osid, params=None): ''' /v1/server/create POST - account Create a new virtual machine. You will start being billed for this immediately. The response only contains the SUBID for the new machine. You should use v1/server/list to poll and wait for ...
[ "def", "create", "(", "self", ",", "dcid", ",", "vpsplanid", ",", "osid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'DCID'", ":", "dcid", ",", "'VPSPLANID'", ":", "vpsplanid", ",", "'OSID'", ":", ...
/v1/server/create POST - account Create a new virtual machine. You will start being billed for this immediately. The response only contains the SUBID for the new machine. You should use v1/server/list to poll and wait for the machine to be created (as this does not happen instant...
[ "/", "v1", "/", "server", "/", "create", "POST", "-", "account", "Create", "a", "new", "virtual", "machine", ".", "You", "will", "start", "being", "billed", "for", "this", "immediately", ".", "The", "response", "only", "contains", "the", "SUBID", "for", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L24-L39
spry-group/python-vultr
vultr/v1_server.py
VultrServer.get_user_data
def get_user_data(self, subid, params=None): ''' /v1/server/get_user_data GET - account Retrieves the (base64 encoded) user-data for this subscription. Link: https://www.vultr.com/api/#server_get_user_data ''' params = update_params(params, {'SUBID': subid}) retu...
python
def get_user_data(self, subid, params=None): ''' /v1/server/get_user_data GET - account Retrieves the (base64 encoded) user-data for this subscription. Link: https://www.vultr.com/api/#server_get_user_data ''' params = update_params(params, {'SUBID': subid}) retu...
[ "def", "get_user_data", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/get_user_data'", ",", ...
/v1/server/get_user_data GET - account Retrieves the (base64 encoded) user-data for this subscription. Link: https://www.vultr.com/api/#server_get_user_data
[ "/", "v1", "/", "server", "/", "get_user_data", "GET", "-", "account", "Retrieves", "the", "(", "base64", "encoded", ")", "user", "-", "data", "for", "this", "subscription", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L53-L61
spry-group/python-vultr
vultr/v1_server.py
VultrServer.halt
def halt(self, subid, params=None): ''' /v1/server/halt POST - account Halt a virtual machine. This is a hard power off (basically, unplugging the machine). The data on the machine will not be modified, and you will still be billed for the machine. To completely delete a ...
python
def halt(self, subid, params=None): ''' /v1/server/halt POST - account Halt a virtual machine. This is a hard power off (basically, unplugging the machine). The data on the machine will not be modified, and you will still be billed for the machine. To completely delete a ...
[ "def", "halt", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/halt'", ",", "params", ",", ...
/v1/server/halt POST - account Halt a virtual machine. This is a hard power off (basically, unplugging the machine). The data on the machine will not be modified, and you will still be billed for the machine. To completely delete a machine, see v1/server/destroy Link: ht...
[ "/", "v1", "/", "server", "/", "halt", "POST", "-", "account", "Halt", "a", "virtual", "machine", ".", "This", "is", "a", "hard", "power", "off", "(", "basically", "unplugging", "the", "machine", ")", ".", "The", "data", "on", "the", "machine", "will",...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L63-L74
spry-group/python-vultr
vultr/v1_server.py
VultrServer.label_set
def label_set(self, subid, label, params=None): ''' /v1/server/label_set POST - account Set the label of a virtual machine. Link: https://www.vultr.com/api/#server_label_set ''' params = update_params(params, { 'SUBID': subid, 'label': label ...
python
def label_set(self, subid, label, params=None): ''' /v1/server/label_set POST - account Set the label of a virtual machine. Link: https://www.vultr.com/api/#server_label_set ''' params = update_params(params, { 'SUBID': subid, 'label': label ...
[ "def", "label_set", "(", "self", ",", "subid", ",", "label", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'label'", ":", "label", "}", ")", "return", "self", ".", "reque...
/v1/server/label_set POST - account Set the label of a virtual machine. Link: https://www.vultr.com/api/#server_label_set
[ "/", "v1", "/", "server", "/", "label_set", "POST", "-", "account", "Set", "the", "label", "of", "a", "virtual", "machine", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L76-L87
spry-group/python-vultr
vultr/v1_server.py
VultrServer.neighbors
def neighbors(self, subid, params=None): ''' v1/server/neighbors GET - account Determine what other subscriptions are hosted on the same physical host as a given subscription. Link: https://www.vultr.com/api/#server_neighbors ''' params = update_params(params, {'...
python
def neighbors(self, subid, params=None): ''' v1/server/neighbors GET - account Determine what other subscriptions are hosted on the same physical host as a given subscription. Link: https://www.vultr.com/api/#server_neighbors ''' params = update_params(params, {'...
[ "def", "neighbors", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/neighbors'", ",", "params...
v1/server/neighbors GET - account Determine what other subscriptions are hosted on the same physical host as a given subscription. Link: https://www.vultr.com/api/#server_neighbors
[ "v1", "/", "server", "/", "neighbors", "GET", "-", "account", "Determine", "what", "other", "subscriptions", "are", "hosted", "on", "the", "same", "physical", "host", "as", "a", "given", "subscription", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L107-L116
spry-group/python-vultr
vultr/v1_server.py
VultrServer.os_change
def os_change(self, subid, osid, params=None): ''' /v1/server/os_change POST - account Changes the operating system of a virtual machine. All data will be permanently lost. Link: https://www.vultr.com/api/#server_os_change ''' params = update_params(params, { ...
python
def os_change(self, subid, osid, params=None): ''' /v1/server/os_change POST - account Changes the operating system of a virtual machine. All data will be permanently lost. Link: https://www.vultr.com/api/#server_os_change ''' params = update_params(params, { ...
[ "def", "os_change", "(", "self", ",", "subid", ",", "osid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'OSID'", ":", "osid", "}", ")", "return", "self", ".", "request"...
/v1/server/os_change POST - account Changes the operating system of a virtual machine. All data will be permanently lost. Link: https://www.vultr.com/api/#server_os_change
[ "/", "v1", "/", "server", "/", "os_change", "POST", "-", "account", "Changes", "the", "operating", "system", "of", "a", "virtual", "machine", ".", "All", "data", "will", "be", "permanently", "lost", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L118-L130
spry-group/python-vultr
vultr/v1_server.py
VultrServer.os_change_list
def os_change_list(self, subid, params=None): ''' /v1/server/os_change_list GET - account Retrieves a list of operating systems to which this server can be changed. Link: https://www.vultr.com/api/#server_os_change_list ''' params = update_params(params, {'SUBID'...
python
def os_change_list(self, subid, params=None): ''' /v1/server/os_change_list GET - account Retrieves a list of operating systems to which this server can be changed. Link: https://www.vultr.com/api/#server_os_change_list ''' params = update_params(params, {'SUBID'...
[ "def", "os_change_list", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/os_change_list'", ",",...
/v1/server/os_change_list GET - account Retrieves a list of operating systems to which this server can be changed. Link: https://www.vultr.com/api/#server_os_change_list
[ "/", "v1", "/", "server", "/", "os_change_list", "GET", "-", "account", "Retrieves", "a", "list", "of", "operating", "systems", "to", "which", "this", "server", "can", "be", "changed", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L132-L141
spry-group/python-vultr
vultr/v1_server.py
VultrServer.reboot
def reboot(self, subid, params=None): ''' /v1/server/reboot POST - account Reboot a virtual machine. This is a hard reboot (basically, unplugging the machine). Link: https://www.vultr.com/api/#server_reboot ''' params = update_params(params, {'SUBID': subid}) ...
python
def reboot(self, subid, params=None): ''' /v1/server/reboot POST - account Reboot a virtual machine. This is a hard reboot (basically, unplugging the machine). Link: https://www.vultr.com/api/#server_reboot ''' params = update_params(params, {'SUBID': subid}) ...
[ "def", "reboot", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/reboot'", ",", "params", "...
/v1/server/reboot POST - account Reboot a virtual machine. This is a hard reboot (basically, unplugging the machine). Link: https://www.vultr.com/api/#server_reboot
[ "/", "v1", "/", "server", "/", "reboot", "POST", "-", "account", "Reboot", "a", "virtual", "machine", ".", "This", "is", "a", "hard", "reboot", "(", "basically", "unplugging", "the", "machine", ")", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L143-L152
spry-group/python-vultr
vultr/v1_server.py
VultrServer.reinstall
def reinstall(self, subid, params=None): ''' /v1/server/reinstall POST - account Reinstall the operating system on a virtual machine. All data will be permanently lost, but the IP address will remain the same There is no going back from this call. Link: https://www.vultr...
python
def reinstall(self, subid, params=None): ''' /v1/server/reinstall POST - account Reinstall the operating system on a virtual machine. All data will be permanently lost, but the IP address will remain the same There is no going back from this call. Link: https://www.vultr...
[ "def", "reinstall", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/reinstall'", ",", "params...
/v1/server/reinstall POST - account Reinstall the operating system on a virtual machine. All data will be permanently lost, but the IP address will remain the same There is no going back from this call. Link: https://www.vultr.com/api/#server_reinstall
[ "/", "v1", "/", "server", "/", "reinstall", "POST", "-", "account", "Reinstall", "the", "operating", "system", "on", "a", "virtual", "machine", ".", "All", "data", "will", "be", "permanently", "lost", "but", "the", "IP", "address", "will", "remain", "the",...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L154-L164
spry-group/python-vultr
vultr/v1_server.py
VultrServer.restore_backup
def restore_backup(self, subid, backupid, params=None): ''' /v1/server/restore_backup POST - account Restore the specified backup to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_backup ''' ...
python
def restore_backup(self, subid, backupid, params=None): ''' /v1/server/restore_backup POST - account Restore the specified backup to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_backup ''' ...
[ "def", "restore_backup", "(", "self", ",", "subid", ",", "backupid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'BACKUPID'", ":", "backupid", "}", ")", "return", "self", ...
/v1/server/restore_backup POST - account Restore the specified backup to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_backup
[ "/", "v1", "/", "server", "/", "restore_backup", "POST", "-", "account", "Restore", "the", "specified", "backup", "to", "the", "virtual", "machine", ".", "Any", "data", "already", "on", "the", "virtual", "machine", "will", "be", "lost", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L166-L178
spry-group/python-vultr
vultr/v1_server.py
VultrServer.restore_snapshot
def restore_snapshot(self, subid, snapshotid, params=None): ''' /v1/server/restore_snapshot POST - account Restore the specificed snapshot to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_snapshot ...
python
def restore_snapshot(self, subid, snapshotid, params=None): ''' /v1/server/restore_snapshot POST - account Restore the specificed snapshot to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_snapshot ...
[ "def", "restore_snapshot", "(", "self", ",", "subid", ",", "snapshotid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'SNAPSHOTID'", ":", "snapshotid", "}", ")", "return", "...
/v1/server/restore_snapshot POST - account Restore the specificed snapshot to the virtual machine. Any data already on the virtual machine will be lost. Link: https://www.vultr.com/api/#server_restore_snapshot
[ "/", "v1", "/", "server", "/", "restore_snapshot", "POST", "-", "account", "Restore", "the", "specificed", "snapshot", "to", "the", "virtual", "machine", ".", "Any", "data", "already", "on", "the", "virtual", "machine", "will", "be", "lost", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L180-L192
spry-group/python-vultr
vultr/v1_server.py
VultrServer.set_user_data
def set_user_data(self, subid, userdata, params=None): ''' /v1/server/set_user_data POST - account Sets the cloud-init user-data (base64) for this subscription. Note that user-data is not supported on every operating system, and is generally only provided on instance startup. ...
python
def set_user_data(self, subid, userdata, params=None): ''' /v1/server/set_user_data POST - account Sets the cloud-init user-data (base64) for this subscription. Note that user-data is not supported on every operating system, and is generally only provided on instance startup. ...
[ "def", "set_user_data", "(", "self", ",", "subid", ",", "userdata", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'userdata'", ":", "userdata", "}", ")", "return", "self", ...
/v1/server/set_user_data POST - account Sets the cloud-init user-data (base64) for this subscription. Note that user-data is not supported on every operating system, and is generally only provided on instance startup. Link: https://www.vultr.com/api/#server_set_user_data
[ "/", "v1", "/", "server", "/", "set_user_data", "POST", "-", "account", "Sets", "the", "cloud", "-", "init", "user", "-", "data", "(", "base64", ")", "for", "this", "subscription", ".", "Note", "that", "user", "-", "data", "is", "not", "supported", "on...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L194-L207
spry-group/python-vultr
vultr/v1_server.py
VultrServer.start
def start(self, subid, params=None): ''' /v1/server/start POST - account Start a virtual machine. If the machine is already running, it will be restarted. Link: https://www.vultr.com/api/#server_start ''' params = update_params(params, {'SUBID': subid}) r...
python
def start(self, subid, params=None): ''' /v1/server/start POST - account Start a virtual machine. If the machine is already running, it will be restarted. Link: https://www.vultr.com/api/#server_start ''' params = update_params(params, {'SUBID': subid}) r...
[ "def", "start", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/start'", ",", "params", ","...
/v1/server/start POST - account Start a virtual machine. If the machine is already running, it will be restarted. Link: https://www.vultr.com/api/#server_start
[ "/", "v1", "/", "server", "/", "start", "POST", "-", "account", "Start", "a", "virtual", "machine", ".", "If", "the", "machine", "is", "already", "running", "it", "will", "be", "restarted", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L209-L218
spry-group/python-vultr
vultr/v1_server.py
VultrServer.upgrade_plan
def upgrade_plan(self, subid, vpsplanid, params=None): ''' /v1/server/upgrade_plan POST - account Upgrade the plan of a virtual machine. The virtual machine will be rebooted upon a successful upgrade. Link: https://www.vultr.com/api/#server_upgrade_plan ''' param...
python
def upgrade_plan(self, subid, vpsplanid, params=None): ''' /v1/server/upgrade_plan POST - account Upgrade the plan of a virtual machine. The virtual machine will be rebooted upon a successful upgrade. Link: https://www.vultr.com/api/#server_upgrade_plan ''' param...
[ "def", "upgrade_plan", "(", "self", ",", "subid", ",", "vpsplanid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'VPSPLANID'", ":", "vpsplanid", "}", ")", "return", "self", ...
/v1/server/upgrade_plan POST - account Upgrade the plan of a virtual machine. The virtual machine will be rebooted upon a successful upgrade. Link: https://www.vultr.com/api/#server_upgrade_plan
[ "/", "v1", "/", "server", "/", "upgrade_plan", "POST", "-", "account", "Upgrade", "the", "plan", "of", "a", "virtual", "machine", ".", "The", "virtual", "machine", "will", "be", "rebooted", "upon", "a", "successful", "upgrade", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L220-L232
spry-group/python-vultr
vultr/v1_server.py
VultrServer.upgrade_plan_list
def upgrade_plan_list(self, subid, params=None): ''' /v1/server/upgrade_plan_list GET - account Retrieve a list of the VPSPLANIDs for which a virtual machine can be upgraded. An empty response array means that there are currently no upgrades available. Link: https://www....
python
def upgrade_plan_list(self, subid, params=None): ''' /v1/server/upgrade_plan_list GET - account Retrieve a list of the VPSPLANIDs for which a virtual machine can be upgraded. An empty response array means that there are currently no upgrades available. Link: https://www....
[ "def", "upgrade_plan_list", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/upgrade_plan_list'", ...
/v1/server/upgrade_plan_list GET - account Retrieve a list of the VPSPLANIDs for which a virtual machine can be upgraded. An empty response array means that there are currently no upgrades available. Link: https://www.vultr.com/api/#server_upgrade_plan_list
[ "/", "v1", "/", "server", "/", "upgrade_plan_list", "GET", "-", "account", "Retrieve", "a", "list", "of", "the", "VPSPLANIDs", "for", "which", "a", "virtual", "machine", "can", "be", "upgraded", ".", "An", "empty", "response", "array", "means", "that", "th...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server.py#L234-L244
spry-group/python-vultr
vultr/v1_sshkey.py
VultrSSHKey.create
def create(self, name, ssh_key, params=None): ''' /v1/sshkey/create POST - account Create a new SSH Key Link: https://www.vultr.com/api/#sshkey_create ''' params = update_params(params, { 'name': name, 'ssh_key': ssh_key }) return ...
python
def create(self, name, ssh_key, params=None): ''' /v1/sshkey/create POST - account Create a new SSH Key Link: https://www.vultr.com/api/#sshkey_create ''' params = update_params(params, { 'name': name, 'ssh_key': ssh_key }) return ...
[ "def", "create", "(", "self", ",", "name", ",", "ssh_key", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'name'", ":", "name", ",", "'ssh_key'", ":", "ssh_key", "}", ")", "return", "self", ".", "reque...
/v1/sshkey/create POST - account Create a new SSH Key Link: https://www.vultr.com/api/#sshkey_create
[ "/", "v1", "/", "sshkey", "/", "create", "POST", "-", "account", "Create", "a", "new", "SSH", "Key" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_sshkey.py#L10-L21
spry-group/python-vultr
vultr/v1_sshkey.py
VultrSSHKey.destroy
def destroy(self, sshkeyid, params=None): ''' /v1/sshkey/destroy POST - account Remove a SSH key. Note that this will not remove the key from any machines that already have it. Link: https://www.vultr.com/api/#sshkey_destroy ''' params = update_params(params, {'S...
python
def destroy(self, sshkeyid, params=None): ''' /v1/sshkey/destroy POST - account Remove a SSH key. Note that this will not remove the key from any machines that already have it. Link: https://www.vultr.com/api/#sshkey_destroy ''' params = update_params(params, {'S...
[ "def", "destroy", "(", "self", ",", "sshkeyid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SSHKEYID'", ":", "sshkeyid", "}", ")", "return", "self", ".", "request", "(", "'/v1/sshkey/destroy'", ",", "p...
/v1/sshkey/destroy POST - account Remove a SSH key. Note that this will not remove the key from any machines that already have it. Link: https://www.vultr.com/api/#sshkey_destroy
[ "/", "v1", "/", "sshkey", "/", "destroy", "POST", "-", "account", "Remove", "a", "SSH", "key", ".", "Note", "that", "this", "will", "not", "remove", "the", "key", "from", "any", "machines", "that", "already", "have", "it", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_sshkey.py#L23-L32
spry-group/python-vultr
vultr/v1_sshkey.py
VultrSSHKey.list
def list(self, params=None): ''' /v1/sshkey/list GET - account List all the SSH keys on the current account Link: https://www.vultr.com/api/#sshkey_list ''' params = params if params else dict() return self.request('/v1/sshkey/list', params, 'GET')
python
def list(self, params=None): ''' /v1/sshkey/list GET - account List all the SSH keys on the current account Link: https://www.vultr.com/api/#sshkey_list ''' params = params if params else dict() return self.request('/v1/sshkey/list', params, 'GET')
[ "def", "list", "(", "self", ",", "params", "=", "None", ")", ":", "params", "=", "params", "if", "params", "else", "dict", "(", ")", "return", "self", ".", "request", "(", "'/v1/sshkey/list'", ",", "params", ",", "'GET'", ")" ]
/v1/sshkey/list GET - account List all the SSH keys on the current account Link: https://www.vultr.com/api/#sshkey_list
[ "/", "v1", "/", "sshkey", "/", "list", "GET", "-", "account", "List", "all", "the", "SSH", "keys", "on", "the", "current", "account" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_sshkey.py#L34-L42
spry-group/python-vultr
vultr/v1_sshkey.py
VultrSSHKey.update
def update(self, sshkeyid, params=None): ''' /v1/sshkey/update POST - account Update an existing SSH Key. Note that this will only update newly installed machines. The key will not be updated on any existing machines. Link: https://www.vultr.com/api/#sshkey_update ...
python
def update(self, sshkeyid, params=None): ''' /v1/sshkey/update POST - account Update an existing SSH Key. Note that this will only update newly installed machines. The key will not be updated on any existing machines. Link: https://www.vultr.com/api/#sshkey_update ...
[ "def", "update", "(", "self", ",", "sshkeyid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SSHKEYID'", ":", "sshkeyid", "}", ")", "return", "self", ".", "request", "(", "'/v1/sshkey/update'", ",", "par...
/v1/sshkey/update POST - account Update an existing SSH Key. Note that this will only update newly installed machines. The key will not be updated on any existing machines. Link: https://www.vultr.com/api/#sshkey_update
[ "/", "v1", "/", "sshkey", "/", "update", "POST", "-", "account", "Update", "an", "existing", "SSH", "Key", ".", "Note", "that", "this", "will", "only", "update", "newly", "installed", "machines", ".", "The", "key", "will", "not", "be", "updated", "on", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_sshkey.py#L44-L54
spry-group/python-vultr
vultr/v1_iso.py
VultrISO.create_from_url
def create_from_url(self, url, params=None): ''' /vi/iso/create_from_url POST - account Create a new ISO image on the current account. The ISO image will be downloaded from a given URL. Download status can be checked with the v1/iso/list call. Link: https://www.vultr.com...
python
def create_from_url(self, url, params=None): ''' /vi/iso/create_from_url POST - account Create a new ISO image on the current account. The ISO image will be downloaded from a given URL. Download status can be checked with the v1/iso/list call. Link: https://www.vultr.com...
[ "def", "create_from_url", "(", "self", ",", "url", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'url'", ":", "url", ",", "}", ")", "return", "self", ".", "request", "(", "'/v1/iso/create_from_url'", ",",...
/vi/iso/create_from_url POST - account Create a new ISO image on the current account. The ISO image will be downloaded from a given URL. Download status can be checked with the v1/iso/list call. Link: https://www.vultr.com/api/#iso_create_from_url
[ "/", "vi", "/", "iso", "/", "create_from_url", "POST", "-", "account", "Create", "a", "new", "ISO", "image", "on", "the", "current", "account", ".", "The", "ISO", "image", "will", "be", "downloaded", "from", "a", "given", "URL", ".", "Download", "status"...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_iso.py#L20-L32
spry-group/python-vultr
vultr/v1_server_ipv6.py
VultrServerIPv6.list_ipv6
def list_ipv6(self, subid, params=None): ''' /v1/server/list_ipv6 GET - account List the IPv6 information of a virtual machine. IP information is only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 enabled, then an empty array is r...
python
def list_ipv6(self, subid, params=None): ''' /v1/server/list_ipv6 GET - account List the IPv6 information of a virtual machine. IP information is only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 enabled, then an empty array is r...
[ "def", "list_ipv6", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/list_ipv6'", ",", "params...
/v1/server/list_ipv6 GET - account List the IPv6 information of a virtual machine. IP information is only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 enabled, then an empty array is returned. Link: https://www.vultr.com/api/#se...
[ "/", "v1", "/", "server", "/", "list_ipv6", "GET", "-", "account", "List", "the", "IPv6", "information", "of", "a", "virtual", "machine", ".", "IP", "information", "is", "only", "available", "for", "virtual", "machines", "in", "the", "active", "state", "."...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv6.py#L10-L20
spry-group/python-vultr
vultr/v1_server_ipv6.py
VultrServerIPv6.reverse_delete_ipv6
def reverse_delete_ipv6(self, subid, ipaddr, params=None): ''' /v1/server/reverse_delete_ipv6 POST - account Remove a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#serv...
python
def reverse_delete_ipv6(self, subid, ipaddr, params=None): ''' /v1/server/reverse_delete_ipv6 POST - account Remove a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#serv...
[ "def", "reverse_delete_ipv6", "(", "self", ",", "subid", ",", "ipaddr", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'ip'", ":", "ipaddr", "}", ")", "return", "self", ".",...
/v1/server/reverse_delete_ipv6 POST - account Remove a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reverse_delete_ipv6
[ "/", "v1", "/", "server", "/", "reverse_delete_ipv6", "POST", "-", "account", "Remove", "a", "reverse", "DNS", "entry", "for", "an", "IPv6", "address", "of", "a", "virtual", "machine", ".", "Upon", "success", "DNS", "changes", "may", "take", "6", "-", "1...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv6.py#L22-L34
spry-group/python-vultr
vultr/v1_server_ipv6.py
VultrServerIPv6.reverse_list_ipv6
def reverse_list_ipv6(self, subid, params=None): ''' /v1/server/reverse_list_ipv6 GET - account List the IPv6 reverse DNS entries of a virtual machine. Reverse DNS entries are only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 ena...
python
def reverse_list_ipv6(self, subid, params=None): ''' /v1/server/reverse_list_ipv6 GET - account List the IPv6 reverse DNS entries of a virtual machine. Reverse DNS entries are only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 ena...
[ "def", "reverse_list_ipv6", "(", "self", ",", "subid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", "}", ")", "return", "self", ".", "request", "(", "'/v1/server/reverse_list_ipv6'", ...
/v1/server/reverse_list_ipv6 GET - account List the IPv6 reverse DNS entries of a virtual machine. Reverse DNS entries are only available for virtual machines in the "active" state. If the virtual machine does not have IPv6 enabled, then an empty array is returned. Link:...
[ "/", "v1", "/", "server", "/", "reverse_list_ipv6", "GET", "-", "account", "List", "the", "IPv6", "reverse", "DNS", "entries", "of", "a", "virtual", "machine", ".", "Reverse", "DNS", "entries", "are", "only", "available", "for", "virtual", "machines", "in", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv6.py#L36-L47
spry-group/python-vultr
vultr/v1_server_ipv6.py
VultrServerIPv6.reverse_set_ipv6
def reverse_set_ipv6(self, subid, ipaddr, entry, params=None): ''' /v1/server/reverse_set_ipv6 POST - account Set a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server...
python
def reverse_set_ipv6(self, subid, ipaddr, entry, params=None): ''' /v1/server/reverse_set_ipv6 POST - account Set a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server...
[ "def", "reverse_set_ipv6", "(", "self", ",", "subid", ",", "ipaddr", ",", "entry", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SUBID'", ":", "subid", ",", "'ip'", ":", "ipaddr", ",", "'entry'", ":", ...
/v1/server/reverse_set_ipv6 POST - account Set a reverse DNS entry for an IPv6 address of a virtual machine. Upon success, DNS changes may take 6-12 hours to become active. Link: https://www.vultr.com/api/#server_reverse_set_ipv6
[ "/", "v1", "/", "server", "/", "reverse_set_ipv6", "POST", "-", "account", "Set", "a", "reverse", "DNS", "entry", "for", "an", "IPv6", "address", "of", "a", "virtual", "machine", ".", "Upon", "success", "DNS", "changes", "may", "take", "6", "-", "12", ...
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_server_ipv6.py#L49-L62
spry-group/python-vultr
vultr/v1_startupscript.py
VultrStartupScript.create
def create(self, name, script, params=None): ''' /v1/startupscript/create POST - account Create a startup script Link: https://www.vultr.com/api/#startupscript_create ''' params = update_params(params, { 'name': name, 'script': script }) ...
python
def create(self, name, script, params=None): ''' /v1/startupscript/create POST - account Create a startup script Link: https://www.vultr.com/api/#startupscript_create ''' params = update_params(params, { 'name': name, 'script': script }) ...
[ "def", "create", "(", "self", ",", "name", ",", "script", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'name'", ":", "name", ",", "'script'", ":", "script", "}", ")", "return", "self", ".", "request"...
/v1/startupscript/create POST - account Create a startup script Link: https://www.vultr.com/api/#startupscript_create
[ "/", "v1", "/", "startupscript", "/", "create", "POST", "-", "account", "Create", "a", "startup", "script" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_startupscript.py#L10-L21
spry-group/python-vultr
vultr/v1_startupscript.py
VultrStartupScript.destroy
def destroy(self, scriptid, params=None): ''' /v1/startupscript/destroy POST - account Remove a startup script Link: https://www.vultr.com/api/#startupscript_destroy ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startupscript...
python
def destroy(self, scriptid, params=None): ''' /v1/startupscript/destroy POST - account Remove a startup script Link: https://www.vultr.com/api/#startupscript_destroy ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startupscript...
[ "def", "destroy", "(", "self", ",", "scriptid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SCRIPTID'", ":", "scriptid", "}", ")", "return", "self", ".", "request", "(", "'/v1/startupscript/destroy'", ",...
/v1/startupscript/destroy POST - account Remove a startup script Link: https://www.vultr.com/api/#startupscript_destroy
[ "/", "v1", "/", "startupscript", "/", "destroy", "POST", "-", "account", "Remove", "a", "startup", "script" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_startupscript.py#L23-L31
spry-group/python-vultr
vultr/v1_startupscript.py
VultrStartupScript.update
def update(self, scriptid, params=None): ''' /v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startu...
python
def update(self, scriptid, params=None): ''' /v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update ''' params = update_params(params, {'SCRIPTID': scriptid}) return self.request('/v1/startu...
[ "def", "update", "(", "self", ",", "scriptid", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'SCRIPTID'", ":", "scriptid", "}", ")", "return", "self", ".", "request", "(", "'/v1/startupscript/update'", ",",...
/v1/startupscript/update POST - account Update an existing startup script Link: https://www.vultr.com/api/#startupscript_update
[ "/", "v1", "/", "startupscript", "/", "update", "POST", "-", "account", "Update", "an", "existing", "startup", "script" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_startupscript.py#L46-L54
spry-group/python-vultr
examples/basic_haltRunning.py
halt_running
def halt_running(): '''Halts all running servers''' vultr = Vultr(API_KEY) try: serverList = vultr.server.list() #logging.info('Listing servers:\n%s', dumps( #serverList, indent=2 #)) except VultrError as ex: logging.error('VultrError: %s', ex) f...
python
def halt_running(): '''Halts all running servers''' vultr = Vultr(API_KEY) try: serverList = vultr.server.list() #logging.info('Listing servers:\n%s', dumps( #serverList, indent=2 #)) except VultrError as ex: logging.error('VultrError: %s', ex) f...
[ "def", "halt_running", "(", ")", ":", "vultr", "=", "Vultr", "(", "API_KEY", ")", "try", ":", "serverList", "=", "vultr", ".", "server", ".", "list", "(", ")", "#logging.info('Listing servers:\\n%s', dumps(", "#serverList, indent=2", "#))", "except", "VultrError",...
Halts all running servers
[ "Halts", "all", "running", "servers" ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/examples/basic_haltRunning.py#L18-L33
spry-group/python-vultr
vultr/v1_reservedip.py
VultrReservedIP.create
def create(self, dcid, ip_type, params=None): ''' /v1/reservedip/create POST - account Create a new reserved IP. Reserved IPs can only be used within the same datacenter for which they were created. Link: https://www.vultr.com/api/#reservedip_create ''' params = ...
python
def create(self, dcid, ip_type, params=None): ''' /v1/reservedip/create POST - account Create a new reserved IP. Reserved IPs can only be used within the same datacenter for which they were created. Link: https://www.vultr.com/api/#reservedip_create ''' params = ...
[ "def", "create", "(", "self", ",", "dcid", ",", "ip_type", ",", "params", "=", "None", ")", ":", "params", "=", "update_params", "(", "params", ",", "{", "'DCID'", ":", "dcid", ",", "'ip_type'", ":", "ip_type", "}", ")", "return", "self", ".", "reque...
/v1/reservedip/create POST - account Create a new reserved IP. Reserved IPs can only be used within the same datacenter for which they were created. Link: https://www.vultr.com/api/#reservedip_create
[ "/", "v1", "/", "reservedip", "/", "create", "POST", "-", "account", "Create", "a", "new", "reserved", "IP", ".", "Reserved", "IPs", "can", "only", "be", "used", "within", "the", "same", "datacenter", "for", "which", "they", "were", "created", "." ]
train
https://github.com/spry-group/python-vultr/blob/bad1448f1df7b5dba70fd3d11434f32580f0b850/vultr/v1_reservedip.py#L10-L22
inspirehep/refextract
refextract/references/tag.py
process_reference_line
def process_reference_line(working_line, journals_matches, pprint_repnum_len, pprint_repnum_matchtext, publishers_matches, removed_spaces, standardised_titles...
python
def process_reference_line(working_line, journals_matches, pprint_repnum_len, pprint_repnum_matchtext, publishers_matches, removed_spaces, standardised_titles...
[ "def", "process_reference_line", "(", "working_line", ",", "journals_matches", ",", "pprint_repnum_len", ",", "pprint_repnum_matchtext", ",", "publishers_matches", ",", "removed_spaces", ",", "standardised_titles", ",", "kbs", ")", ":", "if", "len", "(", "journals_match...
After the phase of identifying and tagging citation instances in a reference line, this function is called to go through the line and the collected information about the recognised citations, and to transform the line into a string of MARC XML in which the recognised citations are grouped un...
[ "After", "the", "phase", "of", "identifying", "and", "tagging", "citation", "instances", "in", "a", "reference", "line", "this", "function", "is", "called", "to", "go", "through", "the", "line", "and", "the", "collected", "information", "about", "the", "recogn...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L182-L338
inspirehep/refextract
refextract/references/tag.py
tag_arxiv
def tag_arxiv(line): """Tag arxiv report numbers We handle arXiv in 2 ways: * starting with arXiv:1022.1111 * this format exactly 9999.9999 We also format the output to the standard arxiv notation: * arXiv:2007.12.1111 * arXiv:2007.12.1111v2 """ def tagger(match): groups = m...
python
def tag_arxiv(line): """Tag arxiv report numbers We handle arXiv in 2 ways: * starting with arXiv:1022.1111 * this format exactly 9999.9999 We also format the output to the standard arxiv notation: * arXiv:2007.12.1111 * arXiv:2007.12.1111v2 """ def tagger(match): groups = m...
[ "def", "tag_arxiv", "(", "line", ")", ":", "def", "tagger", "(", "match", ")", ":", "groups", "=", "match", ".", "groupdict", "(", ")", "if", "match", ".", "group", "(", "'suffix'", ")", ":", "groups", "[", "'suffix'", "]", "=", "' '", "+", "groups...
Tag arxiv report numbers We handle arXiv in 2 ways: * starting with arXiv:1022.1111 * this format exactly 9999.9999 We also format the output to the standard arxiv notation: * arXiv:2007.12.1111 * arXiv:2007.12.1111v2
[ "Tag", "arxiv", "report", "numbers" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L360-L384
inspirehep/refextract
refextract/references/tag.py
tag_arxiv_more
def tag_arxiv_more(line): """Tag old arxiv report numbers Either formats: * hep-th/1234567 * arXiv:1022111 [hep-ph] which transforms to hep-ph/1022111 """ line = RE_ARXIV_CATCHUP.sub(ur"\g<suffix>/\g<year>\g<month>\g<num>", line) for report_re, report_repl in RE_OLD_ARXIV: report_n...
python
def tag_arxiv_more(line): """Tag old arxiv report numbers Either formats: * hep-th/1234567 * arXiv:1022111 [hep-ph] which transforms to hep-ph/1022111 """ line = RE_ARXIV_CATCHUP.sub(ur"\g<suffix>/\g<year>\g<month>\g<num>", line) for report_re, report_repl in RE_OLD_ARXIV: report_n...
[ "def", "tag_arxiv_more", "(", "line", ")", ":", "line", "=", "RE_ARXIV_CATCHUP", ".", "sub", "(", "ur\"\\g<suffix>/\\g<year>\\g<month>\\g<num>\"", ",", "line", ")", "for", "report_re", ",", "report_repl", "in", "RE_OLD_ARXIV", ":", "report_number", "=", "report_repl...
Tag old arxiv report numbers Either formats: * hep-th/1234567 * arXiv:1022111 [hep-ph] which transforms to hep-ph/1022111
[ "Tag", "old", "arxiv", "report", "numbers" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L387-L402
inspirehep/refextract
refextract/references/tag.py
tag_pos_volume
def tag_pos_volume(line): """Tag POS volume number POS is journal that has special volume numbers e.g. PoS LAT2007 (2007) 369 """ def tagger(match): groups = match.groupdict() try: year = match.group('year') except IndexError: # Extract year from volu...
python
def tag_pos_volume(line): """Tag POS volume number POS is journal that has special volume numbers e.g. PoS LAT2007 (2007) 369 """ def tagger(match): groups = match.groupdict() try: year = match.group('year') except IndexError: # Extract year from volu...
[ "def", "tag_pos_volume", "(", "line", ")", ":", "def", "tagger", "(", "match", ")", ":", "groups", "=", "match", ".", "groupdict", "(", ")", "try", ":", "year", "=", "match", ".", "group", "(", "'year'", ")", "except", "IndexError", ":", "# Extract yea...
Tag POS volume number POS is journal that has special volume numbers e.g. PoS LAT2007 (2007) 369
[ "Tag", "POS", "volume", "number" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L405-L436
inspirehep/refextract
refextract/references/tag.py
find_numeration_more
def find_numeration_more(line): """Look for other numeration in line.""" # First, attempt to use marked-up titles patterns = ( re_correct_numeration_2nd_try_ptn1, re_correct_numeration_2nd_try_ptn2, re_correct_numeration_2nd_try_ptn3, re_correct_numeration_2nd_try_ptn4, )...
python
def find_numeration_more(line): """Look for other numeration in line.""" # First, attempt to use marked-up titles patterns = ( re_correct_numeration_2nd_try_ptn1, re_correct_numeration_2nd_try_ptn2, re_correct_numeration_2nd_try_ptn3, re_correct_numeration_2nd_try_ptn4, )...
[ "def", "find_numeration_more", "(", "line", ")", ":", "# First, attempt to use marked-up titles", "patterns", "=", "(", "re_correct_numeration_2nd_try_ptn1", ",", "re_correct_numeration_2nd_try_ptn2", ",", "re_correct_numeration_2nd_try_ptn3", ",", "re_correct_numeration_2nd_try_ptn4...
Look for other numeration in line.
[ "Look", "for", "other", "numeration", "in", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L456-L481
inspirehep/refextract
refextract/references/tag.py
add_tagged_report_number
def add_tagged_report_number(reading_line, len_reportnum, reportnum, startpos, true_replacement_index, extras): """In rebuilding the line, add an identified institutional ...
python
def add_tagged_report_number(reading_line, len_reportnum, reportnum, startpos, true_replacement_index, extras): """In rebuilding the line, add an identified institutional ...
[ "def", "add_tagged_report_number", "(", "reading_line", ",", "len_reportnum", ",", "reportnum", ",", "startpos", ",", "true_replacement_index", ",", "extras", ")", ":", "rebuilt_line", "=", "u\"\"", "# The segment of the line that's being rebuilt to", "# include the tagged & ...
In rebuilding the line, add an identified institutional REPORT-NUMBER (standardised and tagged) into the line. @param reading_line: (string) The reference line before capitalization was performed, and before REPORT-NUMBERs and TITLEs were stipped out. @param len_reportnum: (integer) the len...
[ "In", "rebuilding", "the", "line", "add", "an", "identified", "institutional", "REPORT", "-", "NUMBER", "(", "standardised", "and", "tagged", ")", "into", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L484-L535
inspirehep/refextract
refextract/references/tag.py
add_tagged_journal
def add_tagged_journal(reading_line, journal_info, previous_match, startpos, true_replacement_index, extras, standardised_titles): """In rebuilding the line, add an identified pe...
python
def add_tagged_journal(reading_line, journal_info, previous_match, startpos, true_replacement_index, extras, standardised_titles): """In rebuilding the line, add an identified pe...
[ "def", "add_tagged_journal", "(", "reading_line", ",", "journal_info", ",", "previous_match", ",", "startpos", ",", "true_replacement_index", ",", "extras", ",", "standardised_titles", ")", ":", "old_startpos", "=", "startpos", "old_previous_match", "=", "previous_match...
In rebuilding the line, add an identified periodical TITLE (standardised and tagged) into the line. @param reading_line: (string) The reference line before capitalization was performed, and before REPORT-NUMBERs and TITLEs were stripped out. @param len_title: (integer) the length of the mat...
[ "In", "rebuilding", "the", "line", "add", "an", "identified", "periodical", "TITLE", "(", "standardised", "and", "tagged", ")", "into", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L582-L689
inspirehep/refextract
refextract/references/tag.py
add_tagged_publisher
def add_tagged_publisher(reading_line, matched_publisher, startpos, true_replacement_index, extras, kb_publishers): """In rebuilding the line, add an identified periodical TITLE (standardised...
python
def add_tagged_publisher(reading_line, matched_publisher, startpos, true_replacement_index, extras, kb_publishers): """In rebuilding the line, add an identified periodical TITLE (standardised...
[ "def", "add_tagged_publisher", "(", "reading_line", ",", "matched_publisher", ",", "startpos", ",", "true_replacement_index", ",", "extras", ",", "kb_publishers", ")", ":", "# Fill 'rebuilt_line' (the segment of the line that is being rebuilt to", "# include the tagged and standard...
In rebuilding the line, add an identified periodical TITLE (standardised and tagged) into the line. @param reading_line: (string) The reference line before capitalization was performed, and before REPORT-NUMBERs and TITLEs were stripped out. @param len_title: (integer) the length of the mat...
[ "In", "rebuilding", "the", "line", "add", "an", "identified", "periodical", "TITLE", "(", "standardised", "and", "tagged", ")", "into", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L692-L733
inspirehep/refextract
refextract/references/tag.py
get_replacement_types
def get_replacement_types(titles, reportnumbers, publishers): """Given the indices of the titles and reportnumbers that have been recognised within a reference line, create a dictionary keyed by the replacement position in the line, where the value for each key is a string describing the type o...
python
def get_replacement_types(titles, reportnumbers, publishers): """Given the indices of the titles and reportnumbers that have been recognised within a reference line, create a dictionary keyed by the replacement position in the line, where the value for each key is a string describing the type o...
[ "def", "get_replacement_types", "(", "titles", ",", "reportnumbers", ",", "publishers", ")", ":", "rep_types", "=", "{", "}", "for", "item_idx", "in", "titles", ":", "rep_types", "[", "item_idx", "]", "=", "\"journal\"", "for", "item_idx", "in", "reportnumbers...
Given the indices of the titles and reportnumbers that have been recognised within a reference line, create a dictionary keyed by the replacement position in the line, where the value for each key is a string describing the type of item replaced at that position in the line. The descr...
[ "Given", "the", "indices", "of", "the", "titles", "and", "reportnumbers", "that", "have", "been", "recognised", "within", "a", "reference", "line", "create", "a", "dictionary", "keyed", "by", "the", "replacement", "position", "in", "the", "line", "where", "the...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L736-L761
inspirehep/refextract
refextract/references/tag.py
account_for_stripped_whitespace
def account_for_stripped_whitespace(spaces_keys, removed_spaces, replacement_types, len_reportnums, journals_matches, replacement_index): ...
python
def account_for_stripped_whitespace(spaces_keys, removed_spaces, replacement_types, len_reportnums, journals_matches, replacement_index): ...
[ "def", "account_for_stripped_whitespace", "(", "spaces_keys", ",", "removed_spaces", ",", "replacement_types", ",", "len_reportnums", ",", "journals_matches", ",", "replacement_index", ")", ":", "extras", "=", "0", "true_replacement_index", "=", "replacement_index", "spar...
To build a processed (MARC XML) reference line in which the recognised citations such as standardised periodical TITLEs and REPORT-NUMBERs have been marked up, it is necessary to read from the reference line BEFORE all punctuation was stripped and it was made into upper-case. The indices of ...
[ "To", "build", "a", "processed", "(", "MARC", "XML", ")", "reference", "line", "in", "which", "the", "recognised", "citations", "such", "as", "standardised", "periodical", "TITLEs", "and", "REPORT", "-", "NUMBERs", "have", "been", "marked", "up", "it", "is",...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L764-L844
inspirehep/refextract
refextract/references/tag.py
identify_and_tag_collaborations
def identify_and_tag_collaborations(line, collaborations_kb): """Given a line where Authors have been tagged, and all other tags and content has been replaced with underscores, go through and try to identify extra items of data which should be placed into 'h' subfields. Later on, these t...
python
def identify_and_tag_collaborations(line, collaborations_kb): """Given a line where Authors have been tagged, and all other tags and content has been replaced with underscores, go through and try to identify extra items of data which should be placed into 'h' subfields. Later on, these t...
[ "def", "identify_and_tag_collaborations", "(", "line", ",", "collaborations_kb", ")", ":", "for", "dummy_collab", ",", "re_collab", "in", "collaborations_kb", ".", "iteritems", "(", ")", ":", "matches", "=", "re_collab", ".", "finditer", "(", "strip_tags", "(", ...
Given a line where Authors have been tagged, and all other tags and content has been replaced with underscores, go through and try to identify extra items of data which should be placed into 'h' subfields. Later on, these tagged pieces of information will be merged into the content of...
[ "Given", "a", "line", "where", "Authors", "have", "been", "tagged", "and", "all", "other", "tags", "and", "content", "has", "been", "replaced", "with", "underscores", "go", "through", "and", "try", "to", "identify", "extra", "items", "of", "data", "which", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L860-L881
inspirehep/refextract
refextract/references/tag.py
identify_and_tag_authors
def identify_and_tag_authors(line, authors_kb): """Given a reference, look for a group of author names, place tags around the author group, return the newly tagged line. """ re_auth, re_auth_near_miss = get_author_regexps() # Replace authors which do not convert well from utf-8 for pattern, ...
python
def identify_and_tag_authors(line, authors_kb): """Given a reference, look for a group of author names, place tags around the author group, return the newly tagged line. """ re_auth, re_auth_near_miss = get_author_regexps() # Replace authors which do not convert well from utf-8 for pattern, ...
[ "def", "identify_and_tag_authors", "(", "line", ",", "authors_kb", ")", ":", "re_auth", ",", "re_auth_near_miss", "=", "get_author_regexps", "(", ")", "# Replace authors which do not convert well from utf-8", "for", "pattern", ",", "repl", "in", "authors_kb", ":", "line...
Given a reference, look for a group of author names, place tags around the author group, return the newly tagged line.
[ "Given", "a", "reference", "look", "for", "a", "group", "of", "author", "names", "place", "tags", "around", "the", "author", "group", "return", "the", "newly", "tagged", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L884-L1028
inspirehep/refextract
refextract/references/tag.py
sum_2_dictionaries
def sum_2_dictionaries(dicta, dictb): """Given two dictionaries of totals, where each total refers to a key in the dictionary, add the totals. E.g.: dicta = { 'a' : 3, 'b' : 1 } dictb = { 'a' : 1, 'c' : 5 } dicta + dictb = { 'a' : 4, 'b' : 1, 'c' : 5 } @param dicta:...
python
def sum_2_dictionaries(dicta, dictb): """Given two dictionaries of totals, where each total refers to a key in the dictionary, add the totals. E.g.: dicta = { 'a' : 3, 'b' : 1 } dictb = { 'a' : 1, 'c' : 5 } dicta + dictb = { 'a' : 4, 'b' : 1, 'c' : 5 } @param dicta:...
[ "def", "sum_2_dictionaries", "(", "dicta", ",", "dictb", ")", ":", "dict_out", "=", "dicta", ".", "copy", "(", ")", "for", "key", "in", "dictb", ".", "keys", "(", ")", ":", "if", "'key'", "in", "dict_out", ":", "# Add the sum for key in dictb to that of dict...
Given two dictionaries of totals, where each total refers to a key in the dictionary, add the totals. E.g.: dicta = { 'a' : 3, 'b' : 1 } dictb = { 'a' : 1, 'c' : 5 } dicta + dictb = { 'a' : 4, 'b' : 1, 'c' : 5 } @param dicta: (dictionary) @param dictb: (dictionar...
[ "Given", "two", "dictionaries", "of", "totals", "where", "each", "total", "refers", "to", "a", "key", "in", "the", "dictionary", "add", "the", "totals", ".", "E", ".", "g", ".", ":", "dicta", "=", "{", "a", ":", "3", "b", ":", "1", "}", "dictb", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1031-L1049
inspirehep/refextract
refextract/references/tag.py
identify_ibids
def identify_ibids(line): """Find IBIDs within the line, record their position and length, and replace them with underscores. @param line: (string) the working reference line @return: (tuple) containing 2 dictionaries and a string: Dictionary: matched IBID text: (Key: position of IBI...
python
def identify_ibids(line): """Find IBIDs within the line, record their position and length, and replace them with underscores. @param line: (string) the working reference line @return: (tuple) containing 2 dictionaries and a string: Dictionary: matched IBID text: (Key: position of IBI...
[ "def", "identify_ibids", "(", "line", ")", ":", "ibid_match_txt", "=", "{", "}", "# Record details of each matched ibid:", "for", "m_ibid", "in", "re_ibid", ".", "finditer", "(", "line", ")", ":", "ibid_match_txt", "[", "m_ibid", ".", "start", "(", ")", "]", ...
Find IBIDs within the line, record their position and length, and replace them with underscores. @param line: (string) the working reference line @return: (tuple) containing 2 dictionaries and a string: Dictionary: matched IBID text: (Key: position of IBID in line;...
[ "Find", "IBIDs", "within", "the", "line", "record", "their", "position", "and", "length", "and", "replace", "them", "with", "underscores", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1052-L1070
inspirehep/refextract
refextract/references/tag.py
find_numeration
def find_numeration(line): """Given a reference line, attempt to locate instances of citation 'numeration' in the line. @param line: (string) the reference line. @return: (string) the reference line after numeration has been checked and possibly recognized/marked-up. """ pattern...
python
def find_numeration(line): """Given a reference line, attempt to locate instances of citation 'numeration' in the line. @param line: (string) the reference line. @return: (string) the reference line after numeration has been checked and possibly recognized/marked-up. """ pattern...
[ "def", "find_numeration", "(", "line", ")", ":", "patterns", "=", "(", "# vol,page,year", "re_numeration_vol_page_yr", ",", "re_numeration_vol_nucphys_page_yr", ",", "re_numeration_nucphys_vol_page_yr", ",", "# With sub volume", "re_numeration_vol_subvol_nucphys_yr_page", ",", ...
Given a reference line, attempt to locate instances of citation 'numeration' in the line. @param line: (string) the reference line. @return: (string) the reference line after numeration has been checked and possibly recognized/marked-up.
[ "Given", "a", "reference", "line", "attempt", "to", "locate", "instances", "of", "citation", "numeration", "in", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1083-L1127
inspirehep/refextract
refextract/references/tag.py
identify_journals
def identify_journals(line, kb_journals): """Attempt to identify all periodical titles in a reference line. Titles will be identified, their information (location in line, length in line, and non-standardised version) will be recorded, and they will be replaced in the working line by underscore...
python
def identify_journals(line, kb_journals): """Attempt to identify all periodical titles in a reference line. Titles will be identified, their information (location in line, length in line, and non-standardised version) will be recorded, and they will be replaced in the working line by underscore...
[ "def", "identify_journals", "(", "line", ",", "kb_journals", ")", ":", "periodical_title_search_kb", "=", "kb_journals", "[", "0", "]", "periodical_title_search_keys", "=", "kb_journals", "[", "2", "]", "title_matches", "=", "{", "}", "# the text matched at the given ...
Attempt to identify all periodical titles in a reference line. Titles will be identified, their information (location in line, length in line, and non-standardised version) will be recorded, and they will be replaced in the working line by underscores. @param line: (string) - the working ref...
[ "Attempt", "to", "identify", "all", "periodical", "titles", "in", "a", "reference", "line", ".", "Titles", "will", "be", "identified", "their", "information", "(", "location", "in", "line", "length", "in", "line", "and", "non", "-", "standardised", "version", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1130-L1192
inspirehep/refextract
refextract/references/tag.py
identify_report_numbers
def identify_report_numbers(line, kb_reports): """Attempt to identify all preprint report numbers in a reference line. Report numbers will be identified, their information (location in line, length in line, and standardised replacement version) will be recorded, and they will be replaced...
python
def identify_report_numbers(line, kb_reports): """Attempt to identify all preprint report numbers in a reference line. Report numbers will be identified, their information (location in line, length in line, and standardised replacement version) will be recorded, and they will be replaced...
[ "def", "identify_report_numbers", "(", "line", ",", "kb_reports", ")", ":", "def", "_by_len", "(", "a", ",", "b", ")", ":", "\"\"\"Comparison function used to sort a list by the length of the\n strings in each element of the list.\n \"\"\"", "if", "len", "(", ...
Attempt to identify all preprint report numbers in a reference line. Report numbers will be identified, their information (location in line, length in line, and standardised replacement version) will be recorded, and they will be replaced in the working-line by underscores. @pa...
[ "Attempt", "to", "identify", "all", "preprint", "report", "numbers", "in", "a", "reference", "line", ".", "Report", "numbers", "will", "be", "identified", "their", "information", "(", "location", "in", "line", "length", "in", "line", "and", "standardised", "re...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1195-L1280
inspirehep/refextract
refextract/references/tag.py
identify_and_tag_URLs
def identify_and_tag_URLs(line): """Given a reference line, identify URLs in the line, record the information about them, and replace them with a "<cds.URL />" tag. URLs are identified in 2 forms: + Raw: http://invenio-software.org/ + HTML marked-up: <a href="http://invenio-software.or...
python
def identify_and_tag_URLs(line): """Given a reference line, identify URLs in the line, record the information about them, and replace them with a "<cds.URL />" tag. URLs are identified in 2 forms: + Raw: http://invenio-software.org/ + HTML marked-up: <a href="http://invenio-software.or...
[ "def", "identify_and_tag_URLs", "(", "line", ")", ":", "# Take a copy of the line:", "line_pre_url_check", "=", "line", "# Dictionaries to record details of matched URLs:", "found_url_full_matchlen", "=", "{", "}", "found_url_urlstring", "=", "{", "}", "found_url_urldescr", "...
Given a reference line, identify URLs in the line, record the information about them, and replace them with a "<cds.URL />" tag. URLs are identified in 2 forms: + Raw: http://invenio-software.org/ + HTML marked-up: <a href="http://invenio-software.org/">CERN Document Server Softw...
[ "Given", "a", "reference", "line", "identify", "URLs", "in", "the", "line", "record", "the", "information", "about", "them", "and", "replace", "them", "with", "a", "<cds", ".", "URL", "/", ">", "tag", ".", "URLs", "are", "identified", "in", "2", "forms",...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1295-L1405
inspirehep/refextract
refextract/references/tag.py
identify_and_tag_DOI
def identify_and_tag_DOI(line): """takes a single citation line and attempts to locate any DOI references. DOI references are recognised in both http (url) format and also the standard DOI notation (DOI: ...) @param line: (string) the reference line in which to search for DOI's. @return:...
python
def identify_and_tag_DOI(line): """takes a single citation line and attempts to locate any DOI references. DOI references are recognised in both http (url) format and also the standard DOI notation (DOI: ...) @param line: (string) the reference line in which to search for DOI's. @return:...
[ "def", "identify_and_tag_DOI", "(", "line", ")", ":", "# Used to hold the DOI strings in the citation line", "doi_strings", "=", "[", "]", "# Run the DOI pattern on the line, returning the re.match objects", "matched_doi", "=", "re_doi", ".", "finditer", "(", "line", ")", "# ...
takes a single citation line and attempts to locate any DOI references. DOI references are recognised in both http (url) format and also the standard DOI notation (DOI: ...) @param line: (string) the reference line in which to search for DOI's. @return: the tagged line and a list of DOI stri...
[ "takes", "a", "single", "citation", "line", "and", "attempts", "to", "locate", "any", "DOI", "references", ".", "DOI", "references", "are", "recognised", "in", "both", "http", "(", "url", ")", "format", "and", "also", "the", "standard", "DOI", "notation", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/tag.py#L1408-L1436
inspirehep/refextract
refextract/references/engine.py
remove_reference_line_marker
def remove_reference_line_marker(line): """Trim a reference line's 'marker' from the beginning of the line. @param line: (string) - the reference line. @return: (tuple) containing two strings: + The reference line's marker (or if there was not one, a 'space' charact...
python
def remove_reference_line_marker(line): """Trim a reference line's 'marker' from the beginning of the line. @param line: (string) - the reference line. @return: (tuple) containing two strings: + The reference line's marker (or if there was not one, a 'space' charact...
[ "def", "remove_reference_line_marker", "(", "line", ")", ":", "# Get patterns to identify reference-line marker patterns:", "marker_patterns", "=", "get_reference_line_numeration_marker_patterns", "(", ")", "line", "=", "line", ".", "lstrip", "(", ")", "marker_match", "=", ...
Trim a reference line's 'marker' from the beginning of the line. @param line: (string) - the reference line. @return: (tuple) containing two strings: + The reference line's marker (or if there was not one, a 'space' character. + The reference line with ...
[ "Trim", "a", "reference", "line", "s", "marker", "from", "the", "beginning", "of", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L92-L114
inspirehep/refextract
refextract/references/engine.py
roman2arabic
def roman2arabic(num): """Convert numbers from roman to arabic This function expects a string like XXII and outputs an integer """ t = 0 p = 0 for r in num: n = 10 ** (205558 % ord(r) % 7) % 9995 t += n - 2 * p % n p = n return t
python
def roman2arabic(num): """Convert numbers from roman to arabic This function expects a string like XXII and outputs an integer """ t = 0 p = 0 for r in num: n = 10 ** (205558 % ord(r) % 7) % 9995 t += n - 2 * p % n p = n return t
[ "def", "roman2arabic", "(", "num", ")", ":", "t", "=", "0", "p", "=", "0", "for", "r", "in", "num", ":", "n", "=", "10", "**", "(", "205558", "%", "ord", "(", "r", ")", "%", "7", ")", "%", "9995", "t", "+=", "n", "-", "2", "*", "p", "%"...
Convert numbers from roman to arabic This function expects a string like XXII and outputs an integer
[ "Convert", "numbers", "from", "roman", "to", "arabic" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L117-L129
inspirehep/refextract
refextract/references/engine.py
format_volume
def format_volume(citation_elements): """format volume number (roman numbers to arabic) When the volume number is expressed in roman numbers (CXXII), they are converted to their equivalent in arabic numbers (42) """ re_roman = re.compile(re_roman_numbers + u'$', re.UNICODE) for el in citation_e...
python
def format_volume(citation_elements): """format volume number (roman numbers to arabic) When the volume number is expressed in roman numbers (CXXII), they are converted to their equivalent in arabic numbers (42) """ re_roman = re.compile(re_roman_numbers + u'$', re.UNICODE) for el in citation_e...
[ "def", "format_volume", "(", "citation_elements", ")", ":", "re_roman", "=", "re", ".", "compile", "(", "re_roman_numbers", "+", "u'$'", ",", "re", ".", "UNICODE", ")", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'...
format volume number (roman numbers to arabic) When the volume number is expressed in roman numbers (CXXII), they are converted to their equivalent in arabic numbers (42)
[ "format", "volume", "number", "(", "roman", "numbers", "to", "arabic", ")" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L134-L144
inspirehep/refextract
refextract/references/engine.py
handle_special_journals
def handle_special_journals(citation_elements, kbs): """format special journals (like JHEP) volume number JHEP needs the volume number prefixed with the year e.g. JHEP 0301 instead of JHEP 01 """ for el in citation_elements: if el['type'] == 'JOURNAL' and el['title'] in kbs['special_journal...
python
def handle_special_journals(citation_elements, kbs): """format special journals (like JHEP) volume number JHEP needs the volume number prefixed with the year e.g. JHEP 0301 instead of JHEP 01 """ for el in citation_elements: if el['type'] == 'JOURNAL' and el['title'] in kbs['special_journal...
[ "def", "handle_special_journals", "(", "citation_elements", ",", "kbs", ")", ":", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'JOURNAL'", "and", "el", "[", "'title'", "]", "in", "kbs", "[", "'special_journals'", "]", ...
format special journals (like JHEP) volume number JHEP needs the volume number prefixed with the year e.g. JHEP 0301 instead of JHEP 01
[ "format", "special", "journals", "(", "like", "JHEP", ")", "volume", "number" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L147-L168
inspirehep/refextract
refextract/references/engine.py
format_report_number
def format_report_number(citation_elements): """Format report numbers that are missing a dash e.g. CERN-LCHH2003-01 to CERN-LHCC-2003-01 """ re_report = re.compile(ur'^(?P<name>[A-Z-]+)(?P<nums>[\d-]+)$', re.UNICODE) for el in citation_elements: if el['type'] == 'REPORTNUMBER': ...
python
def format_report_number(citation_elements): """Format report numbers that are missing a dash e.g. CERN-LCHH2003-01 to CERN-LHCC-2003-01 """ re_report = re.compile(ur'^(?P<name>[A-Z-]+)(?P<nums>[\d-]+)$', re.UNICODE) for el in citation_elements: if el['type'] == 'REPORTNUMBER': ...
[ "def", "format_report_number", "(", "citation_elements", ")", ":", "re_report", "=", "re", ".", "compile", "(", "ur'^(?P<name>[A-Z-]+)(?P<nums>[\\d-]+)$'", ",", "re", ".", "UNICODE", ")", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]...
Format report numbers that are missing a dash e.g. CERN-LCHH2003-01 to CERN-LHCC-2003-01
[ "Format", "report", "numbers", "that", "are", "missing", "a", "dash" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L171-L184
inspirehep/refextract
refextract/references/engine.py
format_hep
def format_hep(citation_elements): """Format hep-th report numbers with a dash e.g. replaces hep-th-9711200 with hep-th/9711200 """ prefixes = ('astro-ph-', 'hep-th-', 'hep-ph-', 'hep-ex-', 'hep-lat-', 'math-ph-') for el in citation_elements: if el['type'] == 'REPORTNUMBER':...
python
def format_hep(citation_elements): """Format hep-th report numbers with a dash e.g. replaces hep-th-9711200 with hep-th/9711200 """ prefixes = ('astro-ph-', 'hep-th-', 'hep-ph-', 'hep-ex-', 'hep-lat-', 'math-ph-') for el in citation_elements: if el['type'] == 'REPORTNUMBER':...
[ "def", "format_hep", "(", "citation_elements", ")", ":", "prefixes", "=", "(", "'astro-ph-'", ",", "'hep-th-'", ",", "'hep-ph-'", ",", "'hep-ex-'", ",", "'hep-lat-'", ",", "'math-ph-'", ")", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'typ...
Format hep-th report numbers with a dash e.g. replaces hep-th-9711200 with hep-th/9711200
[ "Format", "hep", "-", "th", "report", "numbers", "with", "a", "dash" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L187-L200
inspirehep/refextract
refextract/references/engine.py
format_author_ed
def format_author_ed(citation_elements): """Standardise to (ed.) and (eds.) e.g. Remove extra space in (ed. ) """ for el in citation_elements: if el['type'] == 'AUTH': el['auth_txt'] = el['auth_txt'].replace('(ed. )', '(ed.)') el['auth_txt'] = el['auth_txt'].replace('(ed...
python
def format_author_ed(citation_elements): """Standardise to (ed.) and (eds.) e.g. Remove extra space in (ed. ) """ for el in citation_elements: if el['type'] == 'AUTH': el['auth_txt'] = el['auth_txt'].replace('(ed. )', '(ed.)') el['auth_txt'] = el['auth_txt'].replace('(ed...
[ "def", "format_author_ed", "(", "citation_elements", ")", ":", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'AUTH'", ":", "el", "[", "'auth_txt'", "]", "=", "el", "[", "'auth_txt'", "]", ".", "replace", "(", "'(ed. ...
Standardise to (ed.) and (eds.) e.g. Remove extra space in (ed. )
[ "Standardise", "to", "(", "ed", ".", ")", "and", "(", "eds", ".", ")" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L203-L212
inspirehep/refextract
refextract/references/engine.py
look_for_books
def look_for_books(citation_elements, kbs): """Look for books in our kb Create book tags by using the authors and the title to find books in our knowledge base """ title = None for el in citation_elements: if el['type'] == 'QUOTED': title = el break if title...
python
def look_for_books(citation_elements, kbs): """Look for books in our kb Create book tags by using the authors and the title to find books in our knowledge base """ title = None for el in citation_elements: if el['type'] == 'QUOTED': title = el break if title...
[ "def", "look_for_books", "(", "citation_elements", ",", "kbs", ")", ":", "title", "=", "None", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'QUOTED'", ":", "title", "=", "el", "break", "if", "title", ":", "normalize...
Look for books in our kb Create book tags by using the authors and the title to find books in our knowledge base
[ "Look", "for", "books", "in", "our", "kb" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L215-L239
inspirehep/refextract
refextract/references/engine.py
split_volume_from_journal
def split_volume_from_journal(citation_elements): """Split volume from journal title We need this because sometimes the volume is attached to the journal title instead of the volume. In those cases we move it here from the title to the volume """ for el in citation_elements: if el['type...
python
def split_volume_from_journal(citation_elements): """Split volume from journal title We need this because sometimes the volume is attached to the journal title instead of the volume. In those cases we move it here from the title to the volume """ for el in citation_elements: if el['type...
[ "def", "split_volume_from_journal", "(", "citation_elements", ")", ":", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'JOURNAL'", "and", "';'", "in", "el", "[", "'title'", "]", ":", "el", "[", "'title'", "]", ",", "s...
Split volume from journal title We need this because sometimes the volume is attached to the journal title instead of the volume. In those cases we move it here from the title to the volume
[ "Split", "volume", "from", "journal", "title" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L242-L253
inspirehep/refextract
refextract/references/engine.py
remove_b_for_nucl_phys
def remove_b_for_nucl_phys(citation_elements): """Removes b from the volume of some journals Removes the B from the volume for Nucl.Phys.Proc.Suppl. because in INSPIRE that journal is handled differently. """ for el in citation_elements: if el['type'] == 'JOURNAL' and el['title'] == 'Nucl.P...
python
def remove_b_for_nucl_phys(citation_elements): """Removes b from the volume of some journals Removes the B from the volume for Nucl.Phys.Proc.Suppl. because in INSPIRE that journal is handled differently. """ for el in citation_elements: if el['type'] == 'JOURNAL' and el['title'] == 'Nucl.P...
[ "def", "remove_b_for_nucl_phys", "(", "citation_elements", ")", ":", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'JOURNAL'", "and", "el", "[", "'title'", "]", "==", "'Nucl.Phys.Proc.Suppl.'", "and", "'volume'", "in", "el...
Removes b from the volume of some journals Removes the B from the volume for Nucl.Phys.Proc.Suppl. because in INSPIRE that journal is handled differently.
[ "Removes", "b", "from", "the", "volume", "of", "some", "journals" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L256-L267
inspirehep/refextract
refextract/references/engine.py
mangle_volume
def mangle_volume(citation_elements): """Make sure the volume letter is before the volume number e.g. transforms 100B to B100 """ volume_re = re.compile(ur"(\d+)([A-Z])", re.U | re.I) for el in citation_elements: if el['type'] == 'JOURNAL': matches = volume_re.match(el['volume']...
python
def mangle_volume(citation_elements): """Make sure the volume letter is before the volume number e.g. transforms 100B to B100 """ volume_re = re.compile(ur"(\d+)([A-Z])", re.U | re.I) for el in citation_elements: if el['type'] == 'JOURNAL': matches = volume_re.match(el['volume']...
[ "def", "mangle_volume", "(", "citation_elements", ")", ":", "volume_re", "=", "re", ".", "compile", "(", "ur\"(\\d+)([A-Z])\"", ",", "re", ".", "U", "|", "re", ".", "I", ")", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", ...
Make sure the volume letter is before the volume number e.g. transforms 100B to B100
[ "Make", "sure", "the", "volume", "letter", "is", "before", "the", "volume", "number" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L270-L282
inspirehep/refextract
refextract/references/engine.py
split_citations
def split_citations(citation_elements): """Split a citation line in multiple citations We handle the case where the author has put 2 citations in the same line but split with ; or some other method. """ splitted_citations = [] new_elements = [] current_recid = None current_doi = None ...
python
def split_citations(citation_elements): """Split a citation line in multiple citations We handle the case where the author has put 2 citations in the same line but split with ; or some other method. """ splitted_citations = [] new_elements = [] current_recid = None current_doi = None ...
[ "def", "split_citations", "(", "citation_elements", ")", ":", "splitted_citations", "=", "[", "]", "new_elements", "=", "[", "]", "current_recid", "=", "None", "current_doi", "=", "None", "def", "check_ibid", "(", "current_elements", ",", "trigger_el", ")", ":",...
Split a citation line in multiple citations We handle the case where the author has put 2 citations in the same line but split with ; or some other method.
[ "Split", "a", "citation", "line", "in", "multiple", "citations" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L307-L383
inspirehep/refextract
refextract/references/engine.py
look_for_hdl
def look_for_hdl(citation_elements): """Looks for handle identifiers in the misc txt of the citation elements When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process """ for el in list(citation_elements): matched_hdl = re_hdl.finditer(el['m...
python
def look_for_hdl(citation_elements): """Looks for handle identifiers in the misc txt of the citation elements When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process """ for el in list(citation_elements): matched_hdl = re_hdl.finditer(el['m...
[ "def", "look_for_hdl", "(", "citation_elements", ")", ":", "for", "el", "in", "list", "(", "citation_elements", ")", ":", "matched_hdl", "=", "re_hdl", ".", "finditer", "(", "el", "[", "'misc_txt'", "]", ")", "for", "match", "in", "reversed", "(", "list", ...
Looks for handle identifiers in the misc txt of the citation elements When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process
[ "Looks", "for", "handle", "identifiers", "in", "the", "misc", "txt", "of", "the", "citation", "elements" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L596-L609
inspirehep/refextract
refextract/references/engine.py
look_for_hdl_urls
def look_for_hdl_urls(citation_elements): """Looks for handle identifiers that have already been identified as urls When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process """ for el in citation_elements: if el['type'] == 'URL': ...
python
def look_for_hdl_urls(citation_elements): """Looks for handle identifiers that have already been identified as urls When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process """ for el in citation_elements: if el['type'] == 'URL': ...
[ "def", "look_for_hdl_urls", "(", "citation_elements", ")", ":", "for", "el", "in", "citation_elements", ":", "if", "el", "[", "'type'", "]", "==", "'URL'", ":", "match", "=", "re_hdl", ".", "match", "(", "el", "[", "'url_string'", "]", ")", "if", "match"...
Looks for handle identifiers that have already been identified as urls When finding an hdl, creates a new HDL element. @param citation_elements: (list) elements to process
[ "Looks", "for", "handle", "identifiers", "that", "have", "already", "been", "identified", "as", "urls" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L612-L625
inspirehep/refextract
refextract/references/engine.py
parse_reference_line
def parse_reference_line(ref_line, kbs, bad_titles_count={}, linker_callback=None): """Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects) """ # Strip the 'marker' (e.g. [1]) from this reference line: line_marker...
python
def parse_reference_line(ref_line, kbs, bad_titles_count={}, linker_callback=None): """Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects) """ # Strip the 'marker' (e.g. [1]) from this reference line: line_marker...
[ "def", "parse_reference_line", "(", "ref_line", ",", "kbs", ",", "bad_titles_count", "=", "{", "}", ",", "linker_callback", "=", "None", ")", ":", "# Strip the 'marker' (e.g. [1]) from this reference line:", "line_marker", ",", "ref_line", "=", "remove_reference_line_mark...
Parse one reference line @input a string representing a single reference bullet @output parsed references (a list of elements objects)
[ "Parse", "one", "reference", "line" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L639-L716
inspirehep/refextract
refextract/references/engine.py
search_for_book_in_misc
def search_for_book_in_misc(citation, kbs): """Searches for books in the misc_txt field if the citation is not recognized as anything like a journal, book, etc. """ citation_year = year_from_citation(citation) for citation_element in citation: LOGGER.debug(u"Searching for book title in: %s", cit...
python
def search_for_book_in_misc(citation, kbs): """Searches for books in the misc_txt field if the citation is not recognized as anything like a journal, book, etc. """ citation_year = year_from_citation(citation) for citation_element in citation: LOGGER.debug(u"Searching for book title in: %s", cit...
[ "def", "search_for_book_in_misc", "(", "citation", ",", "kbs", ")", ":", "citation_year", "=", "year_from_citation", "(", "citation", ")", "for", "citation_element", "in", "citation", ":", "LOGGER", ".", "debug", "(", "u\"Searching for book title in: %s\"", ",", "ci...
Searches for books in the misc_txt field if the citation is not recognized as anything like a journal, book, etc.
[ "Searches", "for", "books", "in", "the", "misc_txt", "field", "if", "the", "citation", "is", "not", "recognized", "as", "anything", "like", "a", "journal", "book", "etc", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L736-L779
inspirehep/refextract
refextract/references/engine.py
parse_references_elements
def parse_references_elements(ref_sect, kbs, linker_callback=None): """Passed a complete reference section, process each line and attempt to ## identify and standardise individual citations within the line. @param ref_sect: (list) of strings - each string in the list is a reference line. ...
python
def parse_references_elements(ref_sect, kbs, linker_callback=None): """Passed a complete reference section, process each line and attempt to ## identify and standardise individual citations within the line. @param ref_sect: (list) of strings - each string in the list is a reference line. ...
[ "def", "parse_references_elements", "(", "ref_sect", ",", "kbs", ",", "linker_callback", "=", "None", ")", ":", "# a list to contain the processed reference lines:", "citations", "=", "[", "]", "# counters for extraction stats:", "counts", "=", "{", "'misc'", ":", "0", ...
Passed a complete reference section, process each line and attempt to ## identify and standardise individual citations within the line. @param ref_sect: (list) of strings - each string in the list is a reference line. @param preprint_repnum_search_kb: (dictionary) - keyed by a tuple ...
[ "Passed", "a", "complete", "reference", "section", "process", "each", "line", "and", "attempt", "to", "##", "identify", "and", "standardise", "individual", "citations", "within", "the", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L839-L907
inspirehep/refextract
refextract/references/engine.py
parse_tagged_reference_line
def parse_tagged_reference_line(line_marker, line, identified_dois, identified_urls): """ Given a single tagged reference line, convert it to its MARC-XML representation. Try to find all tags and extract their co...
python
def parse_tagged_reference_line(line_marker, line, identified_dois, identified_urls): """ Given a single tagged reference line, convert it to its MARC-XML representation. Try to find all tags and extract their co...
[ "def", "parse_tagged_reference_line", "(", "line_marker", ",", "line", ",", "identified_dois", ",", "identified_urls", ")", ":", "count_misc", "=", "count_title", "=", "count_reportnum", "=", "count_url", "=", "count_doi", "=", "count_auth_group", "=", "0", "process...
Given a single tagged reference line, convert it to its MARC-XML representation. Try to find all tags and extract their contents and their types into corresponding dictionary elements. Append each dictionary tag representation onto a list, which is given to 'build_formatted_xml_citation()' where...
[ "Given", "a", "single", "tagged", "reference", "line", "convert", "it", "to", "its", "MARC", "-", "XML", "representation", ".", "Try", "to", "find", "all", "tags", "and", "extract", "their", "contents", "and", "their", "types", "into", "corresponding", "dict...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L910-L1289
inspirehep/refextract
refextract/references/engine.py
map_tag_to_subfield
def map_tag_to_subfield(tag_type, line, cur_misc_txt, dest): """Create a new reference element""" closing_tag = '</cds.%s>' % tag_type # extract the institutional report-number from the line: idx_closing_tag = line.find(closing_tag) # Sanity check - did we find a closing tag? if idx_closing_tag ...
python
def map_tag_to_subfield(tag_type, line, cur_misc_txt, dest): """Create a new reference element""" closing_tag = '</cds.%s>' % tag_type # extract the institutional report-number from the line: idx_closing_tag = line.find(closing_tag) # Sanity check - did we find a closing tag? if idx_closing_tag ...
[ "def", "map_tag_to_subfield", "(", "tag_type", ",", "line", ",", "cur_misc_txt", ",", "dest", ")", ":", "closing_tag", "=", "'</cds.%s>'", "%", "tag_type", "# extract the institutional report-number from the line:", "idx_closing_tag", "=", "line", ".", "find", "(", "c...
Create a new reference element
[ "Create", "a", "new", "reference", "element" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1292-L1312
inspirehep/refextract
refextract/references/engine.py
convert_unusable_tag_to_misc
def convert_unusable_tag_to_misc(line, misc_text, tag_match_end, closing_tag): """Function to remove an unwanted, tagged, citation item from a reference line. The tagged item itself is put into the miscellaneou...
python
def convert_unusable_tag_to_misc(line, misc_text, tag_match_end, closing_tag): """Function to remove an unwanted, tagged, citation item from a reference line. The tagged item itself is put into the miscellaneou...
[ "def", "convert_unusable_tag_to_misc", "(", "line", ",", "misc_text", ",", "tag_match_end", ",", "closing_tag", ")", ":", "# extract the tagged information:", "idx_closing_tag", "=", "line", ".", "find", "(", "closing_tag", ",", "tag_match_end", ")", "# Sanity check - d...
Function to remove an unwanted, tagged, citation item from a reference line. The tagged item itself is put into the miscellaneous text variable; the data up to the closing tag is then trimmed from the beginning of the working line. For example, the following working line: Example, AN. Test...
[ "Function", "to", "remove", "an", "unwanted", "tagged", "citation", "item", "from", "a", "reference", "line", ".", "The", "tagged", "item", "itself", "is", "put", "into", "the", "miscellaneous", "text", "variable", ";", "the", "data", "up", "to", "the", "c...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1315-L1352
inspirehep/refextract
refextract/references/engine.py
remove_leading_garbage_lines_from_reference_section
def remove_leading_garbage_lines_from_reference_section(ref_sectn): """Sometimes, the first lines of the extracted references are completely blank or email addresses. These must be removed as they are not references. @param ref_sectn: (list) of strings - the reference section lines @retu...
python
def remove_leading_garbage_lines_from_reference_section(ref_sectn): """Sometimes, the first lines of the extracted references are completely blank or email addresses. These must be removed as they are not references. @param ref_sectn: (list) of strings - the reference section lines @retu...
[ "def", "remove_leading_garbage_lines_from_reference_section", "(", "ref_sectn", ")", ":", "p_email", "=", "re", ".", "compile", "(", "ur'^\\s*e\\-?mail'", ",", "re", ".", "UNICODE", ")", "while", "ref_sectn", "and", "(", "ref_sectn", "[", "0", "]", ".", "isspace...
Sometimes, the first lines of the extracted references are completely blank or email addresses. These must be removed as they are not references. @param ref_sectn: (list) of strings - the reference section lines @return: (list) of strings - the reference section without leading blank...
[ "Sometimes", "the", "first", "lines", "of", "the", "extracted", "references", "are", "completely", "blank", "or", "email", "addresses", ".", "These", "must", "be", "removed", "as", "they", "are", "not", "references", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1364-L1375
inspirehep/refextract
refextract/references/engine.py
get_plaintext_document_body
def get_plaintext_document_body(fpath, keep_layout=False): """Given a file-path to a full-text, return a list of unicode strings whereby each string is a line of the fulltext. In the case of a plain-text document, this simply means reading the contents in from the file. In the case of a PDF how...
python
def get_plaintext_document_body(fpath, keep_layout=False): """Given a file-path to a full-text, return a list of unicode strings whereby each string is a line of the fulltext. In the case of a plain-text document, this simply means reading the contents in from the file. In the case of a PDF how...
[ "def", "get_plaintext_document_body", "(", "fpath", ",", "keep_layout", "=", "False", ")", ":", "textbody", "=", "[", "]", "mime_type", "=", "magic", ".", "from_file", "(", "fpath", ",", "mime", "=", "True", ")", "if", "mime_type", "==", "\"text/plain\"", ...
Given a file-path to a full-text, return a list of unicode strings whereby each string is a line of the fulltext. In the case of a plain-text document, this simply means reading the contents in from the file. In the case of a PDF however, this means converting the document to plaintext. ...
[ "Given", "a", "file", "-", "path", "to", "a", "full", "-", "text", "return", "a", "list", "of", "unicode", "strings", "whereby", "each", "string", "is", "a", "line", "of", "the", "fulltext", ".", "In", "the", "case", "of", "a", "plain", "-", "text", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1384-L1408
inspirehep/refextract
refextract/references/engine.py
parse_references
def parse_references(reference_lines, recid=None, override_kbs_files=None, reference_format=u"{title} {volume} ({year}) {page}", linker_callback=None): """Parse a list of references Given a list of raw reference lines (list of ...
python
def parse_references(reference_lines, recid=None, override_kbs_files=None, reference_format=u"{title} {volume} ({year}) {page}", linker_callback=None): """Parse a list of references Given a list of raw reference lines (list of ...
[ "def", "parse_references", "(", "reference_lines", ",", "recid", "=", "None", ",", "override_kbs_files", "=", "None", ",", "reference_format", "=", "u\"{title} {volume} ({year}) {page}\"", ",", "linker_callback", "=", "None", ")", ":", "# RefExtract knowledge bases", "k...
Parse a list of references Given a list of raw reference lines (list of strings), output a list of dictionaries containing the parsed references
[ "Parse", "a", "list", "of", "references" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1411-L1428
inspirehep/refextract
refextract/references/engine.py
build_stats
def build_stats(counts): """Return stats information from counts structure.""" stats = { 'status': 0, 'reportnum': counts['reportnum'], 'title': counts['title'], 'author': counts['auth_group'], 'url': counts['url'], 'doi': counts['doi'], 'misc': counts['mi...
python
def build_stats(counts): """Return stats information from counts structure.""" stats = { 'status': 0, 'reportnum': counts['reportnum'], 'title': counts['title'], 'author': counts['auth_group'], 'url': counts['url'], 'doi': counts['doi'], 'misc': counts['mi...
[ "def", "build_stats", "(", "counts", ")", ":", "stats", "=", "{", "'status'", ":", "0", ",", "'reportnum'", ":", "counts", "[", "'reportnum'", "]", ",", "'title'", ":", "counts", "[", "'title'", "]", ",", "'author'", ":", "counts", "[", "'auth_group'", ...
Return stats information from counts structure.
[ "Return", "stats", "information", "from", "counts", "structure", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/engine.py#L1431-L1446
inspirehep/refextract
refextract/documents/pdf.py
replace_undesirable_characters
def replace_undesirable_characters(line): """ Replace certain bad characters in a text line. @param line: (string) the text line in which bad characters are to be replaced. @return: (string) the text line after the bad characters have been replaced. """ # T...
python
def replace_undesirable_characters(line): """ Replace certain bad characters in a text line. @param line: (string) the text line in which bad characters are to be replaced. @return: (string) the text line after the bad characters have been replaced. """ # T...
[ "def", "replace_undesirable_characters", "(", "line", ")", ":", "# These are separate because we want a particular order", "for", "bad_string", ",", "replacement", "in", "UNDESIRABLE_STRING_REPLACEMENTS", ":", "line", "=", "line", ".", "replace", "(", "bad_string", ",", "...
Replace certain bad characters in a text line. @param line: (string) the text line in which bad characters are to be replaced. @return: (string) the text line after the bad characters have been replaced.
[ "Replace", "certain", "bad", "characters", "in", "a", "text", "line", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/documents/pdf.py#L434-L449
inspirehep/refextract
refextract/documents/pdf.py
convert_PDF_to_plaintext
def convert_PDF_to_plaintext(fpath, keep_layout=False): """ Convert PDF to txt using pdftotext Take the path to a PDF file and run pdftotext for this file, capturing the output. @param fpath: (string) path to the PDF file @return: (list) of unicode strings (contents of the PDF file translated i...
python
def convert_PDF_to_plaintext(fpath, keep_layout=False): """ Convert PDF to txt using pdftotext Take the path to a PDF file and run pdftotext for this file, capturing the output. @param fpath: (string) path to the PDF file @return: (list) of unicode strings (contents of the PDF file translated i...
[ "def", "convert_PDF_to_plaintext", "(", "fpath", ",", "keep_layout", "=", "False", ")", ":", "if", "not", "os", ".", "path", ".", "isfile", "(", "CFG_PATH_PDFTOTEXT", ")", ":", "raise", "IOError", "(", "'Missing pdftotext executable'", ")", "if", "keep_layout", ...
Convert PDF to txt using pdftotext Take the path to a PDF file and run pdftotext for this file, capturing the output. @param fpath: (string) path to the PDF file @return: (list) of unicode strings (contents of the PDF file translated into plaintext; each string is a line in the document.)
[ "Convert", "PDF", "to", "txt", "using", "pdftotext" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/documents/pdf.py#L452-L499
inspirehep/refextract
refextract/authors/regexs.py
get_author_affiliation_numeration_str
def get_author_affiliation_numeration_str(punct=None): """The numeration which can be applied to author names. Numeration is sometimes found next to authors of papers. @return: (string), which can be compiled into a regex; identifies numeration next to an author name. """ # FIXME cater for star...
python
def get_author_affiliation_numeration_str(punct=None): """The numeration which can be applied to author names. Numeration is sometimes found next to authors of papers. @return: (string), which can be compiled into a regex; identifies numeration next to an author name. """ # FIXME cater for star...
[ "def", "get_author_affiliation_numeration_str", "(", "punct", "=", "None", ")", ":", "# FIXME cater for start or end numeration (ie two puncs)", "# Number to look for, either general or specific", "re_number", "=", "r'(?:\\d\\d?)'", "re_chained_numbers", "=", "r\"(?:(?:[,;]\\s*%s\\.?\\...
The numeration which can be applied to author names. Numeration is sometimes found next to authors of papers. @return: (string), which can be compiled into a regex; identifies numeration next to an author name.
[ "The", "numeration", "which", "can", "be", "applied", "to", "author", "names", ".", "Numeration", "is", "sometimes", "found", "next", "to", "authors", "of", "papers", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/authors/regexs.py#L36-L64
inspirehep/refextract
refextract/authors/regexs.py
get_initial_surname_author_pattern
def get_initial_surname_author_pattern(incl_numeration=False): """Match an author name of the form: 'initial(s) surname' Return a standard author, with a maximum of 6 initials, and a surname. The author pattern returned will match 'Initials Surname' formats only. The Initials MUST be uppercase, and MUS...
python
def get_initial_surname_author_pattern(incl_numeration=False): """Match an author name of the form: 'initial(s) surname' Return a standard author, with a maximum of 6 initials, and a surname. The author pattern returned will match 'Initials Surname' formats only. The Initials MUST be uppercase, and MUS...
[ "def", "get_initial_surname_author_pattern", "(", "incl_numeration", "=", "False", ")", ":", "# Possible inclusion of superscript numeration at the end of author names", "# Will match the empty string", "if", "incl_numeration", ":", "append_num_re", "=", "get_author_affiliation_numerat...
Match an author name of the form: 'initial(s) surname' Return a standard author, with a maximum of 6 initials, and a surname. The author pattern returned will match 'Initials Surname' formats only. The Initials MUST be uppercase, and MUST have at least a dot, hypen or apostrophe between them. @param in...
[ "Match", "an", "author", "name", "of", "the", "form", ":", "initial", "(", "s", ")", "surname" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/authors/regexs.py#L83-L130
inspirehep/refextract
refextract/authors/regexs.py
get_surname_initial_author_pattern
def get_surname_initial_author_pattern(incl_numeration=False): """Match an author name of the form: 'surname initial(s)' This is sometimes the represention of the first author found inside an author group. This author pattern is only used to find a maximum of ONE author inside an author group. Authors ...
python
def get_surname_initial_author_pattern(incl_numeration=False): """Match an author name of the form: 'surname initial(s)' This is sometimes the represention of the first author found inside an author group. This author pattern is only used to find a maximum of ONE author inside an author group. Authors ...
[ "def", "get_surname_initial_author_pattern", "(", "incl_numeration", "=", "False", ")", ":", "# Possible inclusion of superscript numeration at the end of author names", "# Will match the empty string", "if", "incl_numeration", ":", "append_num_re", "=", "get_author_affiliation_numerat...
Match an author name of the form: 'surname initial(s)' This is sometimes the represention of the first author found inside an author group. This author pattern is only used to find a maximum of ONE author inside an author group. Authors of this form MUST have either a comma after the initials, or an 'and',...
[ "Match", "an", "author", "name", "of", "the", "form", ":", "surname", "initial", "(", "s", ")" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/authors/regexs.py#L133-L180
inspirehep/refextract
refextract/authors/regexs.py
make_auth_regex_str
def make_auth_regex_str(etal, initial_surname_author=None, surname_initial_author=None): """ Returns a regular expression to be used to identify groups of author names in a citation. This method contains patterns for default authors, so no arguments are needed for the most reliable form of m...
python
def make_auth_regex_str(etal, initial_surname_author=None, surname_initial_author=None): """ Returns a regular expression to be used to identify groups of author names in a citation. This method contains patterns for default authors, so no arguments are needed for the most reliable form of m...
[ "def", "make_auth_regex_str", "(", "etal", ",", "initial_surname_author", "=", "None", ",", "surname_initial_author", "=", "None", ")", ":", "if", "not", "initial_surname_author", ":", "# Standard author, with a maximum of 6 initials, and a surname.", "# The Initials MUST be up...
Returns a regular expression to be used to identify groups of author names in a citation. This method contains patterns for default authors, so no arguments are needed for the most reliable form of matching. The returned author pattern is capable of: 1. Identifying single authors, with ...
[ "Returns", "a", "regular", "expression", "to", "be", "used", "to", "identify", "groups", "of", "author", "names", "in", "a", "citation", ".", "This", "method", "contains", "patterns", "for", "default", "authors", "so", "no", "arguments", "are", "needed", "fo...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/authors/regexs.py#L192-L350
inspirehep/refextract
refextract/authors/regexs.py
make_collaborations_regex_str
def make_collaborations_regex_str(): """ From the authors knowledge-base, construct a single regex holding the or'd possibilities of patterns which should be included in $h subfields. The word 'Collaboration' is also converted to 'Coll', and used in finding matches. Letter case is not considered during the ...
python
def make_collaborations_regex_str(): """ From the authors knowledge-base, construct a single regex holding the or'd possibilities of patterns which should be included in $h subfields. The word 'Collaboration' is also converted to 'Coll', and used in finding matches. Letter case is not considered during the ...
[ "def", "make_collaborations_regex_str", "(", ")", ":", "def", "add_to_auth_list", "(", "s", ")", ":", "\"\"\"Strip the line, replace spaces with 'backslash s' and append 'the'\n to the start and 's' to the end. Add the prepared line to the list of\n extra kb authors.\"\"\"", "s...
From the authors knowledge-base, construct a single regex holding the or'd possibilities of patterns which should be included in $h subfields. The word 'Collaboration' is also converted to 'Coll', and used in finding matches. Letter case is not considered during the search. @return: (string) The single patt...
[ "From", "the", "authors", "knowledge", "-", "base", "construct", "a", "single", "regex", "holding", "the", "or", "d", "possibilities", "of", "patterns", "which", "should", "be", "included", "in", "$h", "subfields", ".", "The", "word", "Collaboration", "is", ...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/authors/regexs.py#L398-L445
inspirehep/refextract
refextract/references/find.py
find_reference_section
def find_reference_section(docbody): """Search in document body for its reference section. More precisely, find the first line of the reference section. Effectively, the function starts at the end of a document and works backwards, line-by-line, looking for the title of a reference section. It stop...
python
def find_reference_section(docbody): """Search in document body for its reference section. More precisely, find the first line of the reference section. Effectively, the function starts at the end of a document and works backwards, line-by-line, looking for the title of a reference section. It stop...
[ "def", "find_reference_section", "(", "docbody", ")", ":", "ref_details", "=", "None", "title_patterns", "=", "get_reference_section_title_patterns", "(", ")", "# Try to find refs section title:", "for", "title_pattern", "in", "title_patterns", ":", "# Look for title pattern ...
Search in document body for its reference section. More precisely, find the first line of the reference section. Effectively, the function starts at the end of a document and works backwards, line-by-line, looking for the title of a reference section. It stops when (if) it finds something that it c...
[ "Search", "in", "document", "body", "for", "its", "reference", "section", "." ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/find.py#L45-L97
inspirehep/refextract
refextract/references/find.py
find_numeration
def find_numeration(docbody, title): """Find numeration pattern 1st try to find numeration in the title e.g. References [4] Riotto... 2nd find the numeration alone in the line after the title e.g. References 1 Riotto 3rnd find the numeration in the following line e.g. ...
python
def find_numeration(docbody, title): """Find numeration pattern 1st try to find numeration in the title e.g. References [4] Riotto... 2nd find the numeration alone in the line after the title e.g. References 1 Riotto 3rnd find the numeration in the following line e.g. ...
[ "def", "find_numeration", "(", "docbody", ",", "title", ")", ":", "ref_details", ",", "found_title", "=", "find_numeration_in_title", "(", "docbody", ",", "title", ")", "if", "not", "ref_details", ":", "ref_details", ",", "found_title", "=", "find_numeration_in_bo...
Find numeration pattern 1st try to find numeration in the title e.g. References [4] Riotto... 2nd find the numeration alone in the line after the title e.g. References 1 Riotto 3rnd find the numeration in the following line e.g. References [1] Riotto
[ "Find", "numeration", "pattern" ]
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/find.py#L181-L203
inspirehep/refextract
refextract/references/find.py
find_reference_section_no_title_generic
def find_reference_section_no_title_generic(docbody, marker_patterns): """This function would generally be used when it was not possible to locate the start of a document's reference section by means of its title. Instead, this function will look for reference lines that have numeric markers of...
python
def find_reference_section_no_title_generic(docbody, marker_patterns): """This function would generally be used when it was not possible to locate the start of a document's reference section by means of its title. Instead, this function will look for reference lines that have numeric markers of...
[ "def", "find_reference_section_no_title_generic", "(", "docbody", ",", "marker_patterns", ")", ":", "if", "not", "docbody", ":", "return", "None", "ref_start_line", "=", "ref_line_marker", "=", "None", "# try to find first reference line in the reference section:", "found_ref...
This function would generally be used when it was not possible to locate the start of a document's reference section by means of its title. Instead, this function will look for reference lines that have numeric markers of the format [1], [2], {1}, {2}, etc. @param docbody: (list) of strings ...
[ "This", "function", "would", "generally", "be", "used", "when", "it", "was", "not", "possible", "to", "locate", "the", "start", "of", "a", "document", "s", "reference", "section", "by", "means", "of", "its", "title", ".", "Instead", "this", "function", "wi...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/find.py#L281-L354
inspirehep/refextract
refextract/references/text.py
extract_references_from_fulltext
def extract_references_from_fulltext(fulltext): """Locate and extract the reference section from a fulltext document. Return the extracted reference section as a list of strings, whereby each string in the list is considered to be a single reference line. E.g. a string could be something like:...
python
def extract_references_from_fulltext(fulltext): """Locate and extract the reference section from a fulltext document. Return the extracted reference section as a list of strings, whereby each string in the list is considered to be a single reference line. E.g. a string could be something like:...
[ "def", "extract_references_from_fulltext", "(", "fulltext", ")", ":", "# Try to remove pagebreaks, headers, footers", "fulltext", "=", "remove_page_boundary_lines", "(", "fulltext", ")", "status", "=", "0", "# How ref section found flag", "how_found_start", "=", "0", "# Find ...
Locate and extract the reference section from a fulltext document. Return the extracted reference section as a list of strings, whereby each string in the list is considered to be a single reference line. E.g. a string could be something like: '[19] Wilson, A. Unpublished (1986). @p...
[ "Locate", "and", "extract", "the", "reference", "section", "from", "a", "fulltext", "document", ".", "Return", "the", "extracted", "reference", "section", "as", "a", "list", "of", "strings", "whereby", "each", "string", "in", "the", "list", "is", "considered",...
train
https://github.com/inspirehep/refextract/blob/d70e3787be3c495a3a07d1517b53f81d51c788c7/refextract/references/text.py#L43-L88