body
stringlengths
26
98.2k
body_hash
int64
-9,222,864,604,528,158,000
9,221,803,474B
docstring
stringlengths
1
16.8k
path
stringlengths
5
230
name
stringlengths
1
96
repository_name
stringlengths
7
89
lang
stringclasses
1 value
body_without_docstring
stringlengths
20
98.2k
@utils.retry(exception.SnapshotIsBusy) def wait_for_busy_snapshot(self, flexvol, snapshot_name): 'Checks for and handles a busy snapshot.\n\n If a snapshot is busy, for reasons other than cloning, an exception is\n raised immediately. Otherwise, wait for a period of time for the clone\n depende...
-4,402,261,725,681,839,000
Checks for and handles a busy snapshot. If a snapshot is busy, for reasons other than cloning, an exception is raised immediately. Otherwise, wait for a period of time for the clone dependency to finish before giving up. If the snapshot is not busy then no action is taken and the method exits.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
wait_for_busy_snapshot
sapcc/cinder
python
@utils.retry(exception.SnapshotIsBusy) def wait_for_busy_snapshot(self, flexvol, snapshot_name): 'Checks for and handles a busy snapshot.\n\n If a snapshot is busy, for reasons other than cloning, an exception is\n raised immediately. Otherwise, wait for a period of time for the clone\n depende...
def mark_snapshot_for_deletion(self, volume, snapshot_name): 'Mark snapshot for deletion by renaming snapshot.' return self.rename_snapshot(volume, snapshot_name, (DELETED_PREFIX + snapshot_name))
7,240,036,683,890,597,000
Mark snapshot for deletion by renaming snapshot.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
mark_snapshot_for_deletion
sapcc/cinder
python
def mark_snapshot_for_deletion(self, volume, snapshot_name): return self.rename_snapshot(volume, snapshot_name, (DELETED_PREFIX + snapshot_name))
def rename_snapshot(self, volume, current_name, new_name): 'Renames a snapshot.' api_args = {'volume': volume, 'current-name': current_name, 'new-name': new_name} return self.connection.send_request('snapshot-rename', api_args)
-129,262,650,287,414,140
Renames a snapshot.
cinder/volume/drivers/netapp/dataontap/client/client_base.py
rename_snapshot
sapcc/cinder
python
def rename_snapshot(self, volume, current_name, new_name): api_args = {'volume': volume, 'current-name': current_name, 'new-name': new_name} return self.connection.send_request('snapshot-rename', api_args)
def test_missing_cwl_version(): 'No cwlVersion in the workflow.' assert (main([get_data('tests/wf/missing_cwlVersion.cwl')]) == 1)
-6,386,936,996,461,566,000
No cwlVersion in the workflow.
tests/test_cwl_version.py
test_missing_cwl_version
jayvdb/cwltool
python
def test_missing_cwl_version(): assert (main([get_data('tests/wf/missing_cwlVersion.cwl')]) == 1)
def test_incorrect_cwl_version(): 'Using cwlVersion: v0.1 in the workflow.' assert (main([get_data('tests/wf/wrong_cwlVersion.cwl')]) == 1)
3,053,709,548,438,482,000
Using cwlVersion: v0.1 in the workflow.
tests/test_cwl_version.py
test_incorrect_cwl_version
jayvdb/cwltool
python
def test_incorrect_cwl_version(): assert (main([get_data('tests/wf/wrong_cwlVersion.cwl')]) == 1)
def should_retry_start_pod(exception: Exception): 'Check if an Exception indicates a transient error and warrants retrying' if isinstance(exception, ApiException): return (exception.status == 409) return False
5,044,609,249,089,285,000
Check if an Exception indicates a transient error and warrants retrying
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
should_retry_start_pod
kevin0120/airflow
python
def should_retry_start_pod(exception: Exception): if isinstance(exception, ApiException): return (exception.status == 409) return False
def __init__(self, kube_client: client.CoreV1Api=None, in_cluster: bool=True, cluster_context: Optional[str]=None, extract_xcom: bool=False): '\n Creates the launcher.\n\n :param kube_client: kubernetes client\n :param in_cluster: whether we are in cluster\n :param cluster_context: conte...
4,478,250,144,300,716,000
Creates the launcher. :param kube_client: kubernetes client :param in_cluster: whether we are in cluster :param cluster_context: context of the cluster :param extract_xcom: whether we should extract xcom
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
__init__
kevin0120/airflow
python
def __init__(self, kube_client: client.CoreV1Api=None, in_cluster: bool=True, cluster_context: Optional[str]=None, extract_xcom: bool=False): '\n Creates the launcher.\n\n :param kube_client: kubernetes client\n :param in_cluster: whether we are in cluster\n :param cluster_context: conte...
def run_pod_async(self, pod: V1Pod, **kwargs): 'Runs POD asynchronously' pod_mutation_hook(pod) sanitized_pod = self._client.api_client.sanitize_for_serialization(pod) json_pod = json.dumps(sanitized_pod, indent=2) self.log.debug('Pod Creation Request: \n%s', json_pod) try: resp = self._...
-3,677,110,547,369,796,600
Runs POD asynchronously
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
run_pod_async
kevin0120/airflow
python
def run_pod_async(self, pod: V1Pod, **kwargs): pod_mutation_hook(pod) sanitized_pod = self._client.api_client.sanitize_for_serialization(pod) json_pod = json.dumps(sanitized_pod, indent=2) self.log.debug('Pod Creation Request: \n%s', json_pod) try: resp = self._client.create_namespaced_...
def delete_pod(self, pod: V1Pod): 'Deletes POD' try: self._client.delete_namespaced_pod(pod.metadata.name, pod.metadata.namespace, body=client.V1DeleteOptions()) except ApiException as e: if (e.status != 404): raise
-814,575,188,438,192,100
Deletes POD
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
delete_pod
kevin0120/airflow
python
def delete_pod(self, pod: V1Pod): try: self._client.delete_namespaced_pod(pod.metadata.name, pod.metadata.namespace, body=client.V1DeleteOptions()) except ApiException as e: if (e.status != 404): raise
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_random_exponential(), reraise=True, retry=tenacity.retry_if_exception(should_retry_start_pod)) def start_pod(self, pod: V1Pod, startup_timeout: int=120): '\n Launches the pod synchronously and waits for completion.\n\n :param pod:...
-4,370,534,234,727,821,000
Launches the pod synchronously and waits for completion. :param pod: :param startup_timeout: Timeout for startup of the pod (if pod is pending for too long, fails task) :return:
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
start_pod
kevin0120/airflow
python
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_random_exponential(), reraise=True, retry=tenacity.retry_if_exception(should_retry_start_pod)) def start_pod(self, pod: V1Pod, startup_timeout: int=120): '\n Launches the pod synchronously and waits for completion.\n\n :param pod:...
def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[(State, V1Pod, Optional[str])]: '\n Monitors a pod and returns the final state, pod and xcom result\n\n :param pod: pod spec that will be monitored\n :param get_logs: whether to read the logs locally\n :return: Tuple[State, Opti...
-4,386,082,111,302,640,000
Monitors a pod and returns the final state, pod and xcom result :param pod: pod spec that will be monitored :param get_logs: whether to read the logs locally :return: Tuple[State, Optional[str]]
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
monitor_pod
kevin0120/airflow
python
def monitor_pod(self, pod: V1Pod, get_logs: bool) -> Tuple[(State, V1Pod, Optional[str])]: '\n Monitors a pod and returns the final state, pod and xcom result\n\n :param pod: pod spec that will be monitored\n :param get_logs: whether to read the logs locally\n :return: Tuple[State, Opti...
def parse_log_line(self, line: str) -> Tuple[(str, str)]: '\n Parse K8s log line and returns the final state\n\n :param line: k8s log line\n :type line: str\n :return: timestamp and log message\n :rtype: Tuple[str, str]\n ' split_at = line.find(' ') if (split_at == ...
-177,840,822,609,086,880
Parse K8s log line and returns the final state :param line: k8s log line :type line: str :return: timestamp and log message :rtype: Tuple[str, str]
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
parse_log_line
kevin0120/airflow
python
def parse_log_line(self, line: str) -> Tuple[(str, str)]: '\n Parse K8s log line and returns the final state\n\n :param line: k8s log line\n :type line: str\n :return: timestamp and log message\n :rtype: Tuple[str, str]\n ' split_at = line.find(' ') if (split_at == ...
def pod_not_started(self, pod: V1Pod): 'Tests if pod has not started' state = self._task_status(self.read_pod(pod)) return (state == State.QUEUED)
3,744,247,621,719,285,000
Tests if pod has not started
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
pod_not_started
kevin0120/airflow
python
def pod_not_started(self, pod: V1Pod): state = self._task_status(self.read_pod(pod)) return (state == State.QUEUED)
def pod_is_running(self, pod: V1Pod): 'Tests if pod is running' state = self._task_status(self.read_pod(pod)) return (state not in (State.SUCCESS, State.FAILED))
714,326,589,583,116,200
Tests if pod is running
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
pod_is_running
kevin0120/airflow
python
def pod_is_running(self, pod: V1Pod): state = self._task_status(self.read_pod(pod)) return (state not in (State.SUCCESS, State.FAILED))
def base_container_is_running(self, pod: V1Pod): 'Tests if base container is running' event = self.read_pod(pod) status = next(iter(filter((lambda s: (s.name == 'base')), event.status.container_statuses)), None) if (not status): return False return (status.state.running is not None)
-6,574,634,565,868,021,000
Tests if base container is running
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
base_container_is_running
kevin0120/airflow
python
def base_container_is_running(self, pod: V1Pod): event = self.read_pod(pod) status = next(iter(filter((lambda s: (s.name == 'base')), event.status.container_statuses)), None) if (not status): return False return (status.state.running is not None)
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod_logs(self, pod: V1Pod, tail_lines: Optional[int]=None, timestamps: bool=False, since_seconds: Optional[int]=None): 'Reads log from the POD' additional_kwargs = {} if since_seconds: addit...
-2,652,322,289,505,761,300
Reads log from the POD
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
read_pod_logs
kevin0120/airflow
python
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod_logs(self, pod: V1Pod, tail_lines: Optional[int]=None, timestamps: bool=False, since_seconds: Optional[int]=None): additional_kwargs = {} if since_seconds: additional_kwargs['since_seco...
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod_events(self, pod): 'Reads events from the POD' try: return self._client.list_namespaced_event(namespace=pod.metadata.namespace, field_selector=f'involvedObject.name={pod.metadata.name}') ...
6,136,619,614,378,336,000
Reads events from the POD
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
read_pod_events
kevin0120/airflow
python
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod_events(self, pod): try: return self._client.list_namespaced_event(namespace=pod.metadata.namespace, field_selector=f'involvedObject.name={pod.metadata.name}') except BaseHTTPError as e:...
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod(self, pod: V1Pod): 'Read POD information' try: return self._client.read_namespaced_pod(pod.metadata.name, pod.metadata.namespace) except BaseHTTPError as e: raise AirflowExceptio...
-1,437,380,743,902,670,600
Read POD information
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
read_pod
kevin0120/airflow
python
@tenacity.retry(stop=tenacity.stop_after_attempt(3), wait=tenacity.wait_exponential(), reraise=True) def read_pod(self, pod: V1Pod): try: return self._client.read_namespaced_pod(pod.metadata.name, pod.metadata.namespace) except BaseHTTPError as e: raise AirflowException(f'There was an error...
def process_status(self, job_id, status): 'Process status information for the JOB' status = status.lower() if (status == PodStatus.PENDING): return State.QUEUED elif (status == PodStatus.FAILED): self.log.error('Event with job id %s Failed', job_id) return State.FAILED elif (...
8,111,311,642,689,768,000
Process status information for the JOB
airflow/providers/cncf/kubernetes/utils/pod_launcher.py
process_status
kevin0120/airflow
python
def process_status(self, job_id, status): status = status.lower() if (status == PodStatus.PENDING): return State.QUEUED elif (status == PodStatus.FAILED): self.log.error('Event with job id %s Failed', job_id) return State.FAILED elif (status == PodStatus.SUCCEEDED): ...
def get_host_error_message(): 'Return host error message.' buf = create_string_buffer(PM_HOST_ERROR_MSG_LEN) lib.Pm_GetHostErrorText(buf, PM_HOST_ERROR_MSG_LEN) return buf.raw.decode().rstrip('\x00')
2,564,961,688,497,364,500
Return host error message.
mido/backends/portmidi_init.py
get_host_error_message
EnjoyLifeFund/macHighSierra-py36-pkgs
python
def get_host_error_message(): buf = create_string_buffer(PM_HOST_ERROR_MSG_LEN) lib.Pm_GetHostErrorText(buf, PM_HOST_ERROR_MSG_LEN) return buf.raw.decode().rstrip('\x00')
def layer_op(self, inputs, is_training=True): '\n Consists of::\n\n (inputs)--conv_0-o-conv_1--conv_2-+-(conv_res)--down_sample--\n | |\n o----------------o\n\n conv_0, conv_res is also returned for feature forwarding pu...
5,549,436,719,628,099,000
Consists of:: (inputs)--conv_0-o-conv_1--conv_2-+-(conv_res)--down_sample-- | | o----------------o conv_0, conv_res is also returned for feature forwarding purpose
niftynet/layer/downsample_res_block.py
layer_op
BRAINSia/NiftyNet
python
def layer_op(self, inputs, is_training=True): '\n Consists of::\n\n (inputs)--conv_0-o-conv_1--conv_2-+-(conv_res)--down_sample--\n | |\n o----------------o\n\n conv_0, conv_res is also returned for feature forwarding pu...
def _align_32(f): 'Align to the next 32-bit position in a file' pos = f.tell() if ((pos % 4) != 0): f.seek(((pos + 4) - (pos % 4))) return
6,305,285,988,810,641,000
Align to the next 32-bit position in a file
scipy/io/idl.py
_align_32
ikamensh/scipy
python
def _align_32(f): pos = f.tell() if ((pos % 4) != 0): f.seek(((pos + 4) - (pos % 4))) return
def _skip_bytes(f, n): 'Skip `n` bytes' f.read(n) return
-7,825,523,354,475,326,000
Skip `n` bytes
scipy/io/idl.py
_skip_bytes
ikamensh/scipy
python
def _skip_bytes(f, n): f.read(n) return
def _read_bytes(f, n): 'Read the next `n` bytes' return f.read(n)
4,321,045,088,081,049,000
Read the next `n` bytes
scipy/io/idl.py
_read_bytes
ikamensh/scipy
python
def _read_bytes(f, n): return f.read(n)
def _read_byte(f): 'Read a single byte' return np.uint8(struct.unpack('>B', f.read(4)[:1])[0])
9,107,050,557,744,537,000
Read a single byte
scipy/io/idl.py
_read_byte
ikamensh/scipy
python
def _read_byte(f): return np.uint8(struct.unpack('>B', f.read(4)[:1])[0])
def _read_long(f): 'Read a signed 32-bit integer' return np.int32(struct.unpack('>l', f.read(4))[0])
-8,751,783,939,665,687,000
Read a signed 32-bit integer
scipy/io/idl.py
_read_long
ikamensh/scipy
python
def _read_long(f): return np.int32(struct.unpack('>l', f.read(4))[0])
def _read_int16(f): 'Read a signed 16-bit integer' return np.int16(struct.unpack('>h', f.read(4)[2:4])[0])
6,401,136,554,309,534,000
Read a signed 16-bit integer
scipy/io/idl.py
_read_int16
ikamensh/scipy
python
def _read_int16(f): return np.int16(struct.unpack('>h', f.read(4)[2:4])[0])
def _read_int32(f): 'Read a signed 32-bit integer' return np.int32(struct.unpack('>i', f.read(4))[0])
-1,097,645,181,429,358,300
Read a signed 32-bit integer
scipy/io/idl.py
_read_int32
ikamensh/scipy
python
def _read_int32(f): return np.int32(struct.unpack('>i', f.read(4))[0])
def _read_int64(f): 'Read a signed 64-bit integer' return np.int64(struct.unpack('>q', f.read(8))[0])
6,429,411,224,549,086,000
Read a signed 64-bit integer
scipy/io/idl.py
_read_int64
ikamensh/scipy
python
def _read_int64(f): return np.int64(struct.unpack('>q', f.read(8))[0])
def _read_uint16(f): 'Read an unsigned 16-bit integer' return np.uint16(struct.unpack('>H', f.read(4)[2:4])[0])
-4,292,512,204,628,479,000
Read an unsigned 16-bit integer
scipy/io/idl.py
_read_uint16
ikamensh/scipy
python
def _read_uint16(f): return np.uint16(struct.unpack('>H', f.read(4)[2:4])[0])
def _read_uint32(f): 'Read an unsigned 32-bit integer' return np.uint32(struct.unpack('>I', f.read(4))[0])
-897,737,826,672,022,300
Read an unsigned 32-bit integer
scipy/io/idl.py
_read_uint32
ikamensh/scipy
python
def _read_uint32(f): return np.uint32(struct.unpack('>I', f.read(4))[0])
def _read_uint64(f): 'Read an unsigned 64-bit integer' return np.uint64(struct.unpack('>Q', f.read(8))[0])
-8,666,359,356,249,165,000
Read an unsigned 64-bit integer
scipy/io/idl.py
_read_uint64
ikamensh/scipy
python
def _read_uint64(f): return np.uint64(struct.unpack('>Q', f.read(8))[0])
def _read_float32(f): 'Read a 32-bit float' return np.float32(struct.unpack('>f', f.read(4))[0])
3,231,013,858,213,479,000
Read a 32-bit float
scipy/io/idl.py
_read_float32
ikamensh/scipy
python
def _read_float32(f): return np.float32(struct.unpack('>f', f.read(4))[0])
def _read_float64(f): 'Read a 64-bit float' return np.float64(struct.unpack('>d', f.read(8))[0])
-1,608,278,296,860,134,100
Read a 64-bit float
scipy/io/idl.py
_read_float64
ikamensh/scipy
python
def _read_float64(f): return np.float64(struct.unpack('>d', f.read(8))[0])
def _read_string(f): 'Read a string' length = _read_long(f) if (length > 0): chars = _read_bytes(f, length) _align_32(f) chars = asstr(chars) else: chars = '' return chars
-243,961,948,650,962,400
Read a string
scipy/io/idl.py
_read_string
ikamensh/scipy
python
def _read_string(f): length = _read_long(f) if (length > 0): chars = _read_bytes(f, length) _align_32(f) chars = asstr(chars) else: chars = return chars
def _read_string_data(f): 'Read a data string (length is specified twice)' length = _read_long(f) if (length > 0): length = _read_long(f) string_data = _read_bytes(f, length) _align_32(f) else: string_data = '' return string_data
-6,102,874,539,855,738,000
Read a data string (length is specified twice)
scipy/io/idl.py
_read_string_data
ikamensh/scipy
python
def _read_string_data(f): length = _read_long(f) if (length > 0): length = _read_long(f) string_data = _read_bytes(f, length) _align_32(f) else: string_data = return string_data
def _read_data(f, dtype): 'Read a variable with a specified data type' if (dtype == 1): if (_read_int32(f) != 1): raise Exception('Error occurred while reading byte variable') return _read_byte(f) elif (dtype == 2): return _read_int16(f) elif (dtype == 3): ret...
9,175,905,220,718,660,000
Read a variable with a specified data type
scipy/io/idl.py
_read_data
ikamensh/scipy
python
def _read_data(f, dtype): if (dtype == 1): if (_read_int32(f) != 1): raise Exception('Error occurred while reading byte variable') return _read_byte(f) elif (dtype == 2): return _read_int16(f) elif (dtype == 3): return _read_int32(f) elif (dtype == 4): ...
def _read_structure(f, array_desc, struct_desc): '\n Read a structure, with the array and structure descriptors given as\n `array_desc` and `structure_desc` respectively.\n ' nrows = array_desc['nelements'] columns = struct_desc['tagtable'] dtype = [] for col in columns: if (col['st...
6,718,153,048,390,739,000
Read a structure, with the array and structure descriptors given as `array_desc` and `structure_desc` respectively.
scipy/io/idl.py
_read_structure
ikamensh/scipy
python
def _read_structure(f, array_desc, struct_desc): '\n Read a structure, with the array and structure descriptors given as\n `array_desc` and `structure_desc` respectively.\n ' nrows = array_desc['nelements'] columns = struct_desc['tagtable'] dtype = [] for col in columns: if (col['st...
def _read_array(f, typecode, array_desc): '\n Read an array of type `typecode`, with the array descriptor given as\n `array_desc`.\n ' if (typecode in [1, 3, 4, 5, 6, 9, 13, 14, 15]): if (typecode == 1): nbytes = _read_int32(f) if (nbytes != array_desc['nbytes']): ...
8,033,665,999,947,200,000
Read an array of type `typecode`, with the array descriptor given as `array_desc`.
scipy/io/idl.py
_read_array
ikamensh/scipy
python
def _read_array(f, typecode, array_desc): '\n Read an array of type `typecode`, with the array descriptor given as\n `array_desc`.\n ' if (typecode in [1, 3, 4, 5, 6, 9, 13, 14, 15]): if (typecode == 1): nbytes = _read_int32(f) if (nbytes != array_desc['nbytes']): ...
def _read_record(f): 'Function to read in a full record' record = {'rectype': _read_long(f)} nextrec = _read_uint32(f) nextrec += (_read_uint32(f) * (2 ** 32)) _skip_bytes(f, 4) if (not (record['rectype'] in RECTYPE_DICT)): raise Exception(('Unknown RECTYPE: %i' % record['rectype'])) ...
-6,800,225,076,854,987,000
Function to read in a full record
scipy/io/idl.py
_read_record
ikamensh/scipy
python
def _read_record(f): record = {'rectype': _read_long(f)} nextrec = _read_uint32(f) nextrec += (_read_uint32(f) * (2 ** 32)) _skip_bytes(f, 4) if (not (record['rectype'] in RECTYPE_DICT)): raise Exception(('Unknown RECTYPE: %i' % record['rectype'])) record['rectype'] = RECTYPE_DICT[r...
def _read_typedesc(f): 'Function to read in a type descriptor' typedesc = {'typecode': _read_long(f), 'varflags': _read_long(f)} if ((typedesc['varflags'] & 2) == 2): raise Exception('System variables not implemented') typedesc['array'] = ((typedesc['varflags'] & 4) == 4) typedesc['structure...
-3,107,632,973,865,778,000
Function to read in a type descriptor
scipy/io/idl.py
_read_typedesc
ikamensh/scipy
python
def _read_typedesc(f): typedesc = {'typecode': _read_long(f), 'varflags': _read_long(f)} if ((typedesc['varflags'] & 2) == 2): raise Exception('System variables not implemented') typedesc['array'] = ((typedesc['varflags'] & 4) == 4) typedesc['structure'] = ((typedesc['varflags'] & 32) == 32...
def _read_arraydesc(f): 'Function to read in an array descriptor' arraydesc = {'arrstart': _read_long(f)} if (arraydesc['arrstart'] == 8): _skip_bytes(f, 4) arraydesc['nbytes'] = _read_long(f) arraydesc['nelements'] = _read_long(f) arraydesc['ndims'] = _read_long(f) _...
6,493,596,777,023,376,000
Function to read in an array descriptor
scipy/io/idl.py
_read_arraydesc
ikamensh/scipy
python
def _read_arraydesc(f): arraydesc = {'arrstart': _read_long(f)} if (arraydesc['arrstart'] == 8): _skip_bytes(f, 4) arraydesc['nbytes'] = _read_long(f) arraydesc['nelements'] = _read_long(f) arraydesc['ndims'] = _read_long(f) _skip_bytes(f, 8) arraydesc['nmax'...
def _read_structdesc(f): 'Function to read in a structure descriptor' structdesc = {} structstart = _read_long(f) if (structstart != 9): raise Exception('STRUCTSTART should be 9') structdesc['name'] = _read_string(f) predef = _read_long(f) structdesc['ntags'] = _read_long(f) stru...
1,344,744,848,076,249,000
Function to read in a structure descriptor
scipy/io/idl.py
_read_structdesc
ikamensh/scipy
python
def _read_structdesc(f): structdesc = {} structstart = _read_long(f) if (structstart != 9): raise Exception('STRUCTSTART should be 9') structdesc['name'] = _read_string(f) predef = _read_long(f) structdesc['ntags'] = _read_long(f) structdesc['nbytes'] = _read_long(f) structd...
def _read_tagdesc(f): 'Function to read in a tag descriptor' tagdesc = {'offset': _read_long(f)} if (tagdesc['offset'] == (- 1)): tagdesc['offset'] = _read_uint64(f) tagdesc['typecode'] = _read_long(f) tagflags = _read_long(f) tagdesc['array'] = ((tagflags & 4) == 4) tagdesc['structu...
-756,983,100,868,209,700
Function to read in a tag descriptor
scipy/io/idl.py
_read_tagdesc
ikamensh/scipy
python
def _read_tagdesc(f): tagdesc = {'offset': _read_long(f)} if (tagdesc['offset'] == (- 1)): tagdesc['offset'] = _read_uint64(f) tagdesc['typecode'] = _read_long(f) tagflags = _read_long(f) tagdesc['array'] = ((tagflags & 4) == 4) tagdesc['structure'] = ((tagflags & 32) == 32) tag...
def readsav(file_name, idict=None, python_dict=False, uncompressed_file_name=None, verbose=False): "\n Read an IDL .sav file.\n\n Parameters\n ----------\n file_name : str\n Name of the IDL save file.\n idict : dict, optional\n Dictionary in which to insert .sav file variables.\n pyt...
-8,938,747,479,362,647,000
Read an IDL .sav file. Parameters ---------- file_name : str Name of the IDL save file. idict : dict, optional Dictionary in which to insert .sav file variables. python_dict : bool, optional By default, the object return is not a Python dictionary, but a case-insensitive dictionary with item, attribute...
scipy/io/idl.py
readsav
ikamensh/scipy
python
def readsav(file_name, idict=None, python_dict=False, uncompressed_file_name=None, verbose=False): "\n Read an IDL .sav file.\n\n Parameters\n ----------\n file_name : str\n Name of the IDL save file.\n idict : dict, optional\n Dictionary in which to insert .sav file variables.\n pyt...
def test_pdis_plot(self): ' Test combined spectral plots. ' os.chdir((REAL_PATH + '/data/dispersion')) expected_file = 'K3P-OQMD_4786-CollCode25550_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--png', '-sca...
7,943,555,130,315,218,000
Test combined spectral plots.
tests/test_plotting.py
test_pdis_plot
AJMGroup/matador
python
def test_pdis_plot(self): ' ' os.chdir((REAL_PATH + '/data/dispersion')) expected_file = 'K3P-OQMD_4786-CollCode25550_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--png', '-scale', '10', '-interp', '2', '-...
def test_dos_only(self): ' Test combined spectral plots. ' os.chdir((REAL_PATH + '/data/dispersion')) expected_file = 'K3P-OQMD_4786-CollCode25550_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--png', '--dos...
-7,719,930,184,175,832,000
Test combined spectral plots.
tests/test_plotting.py
test_dos_only
AJMGroup/matador
python
def test_dos_only(self): ' ' os.chdir((REAL_PATH + '/data/dispersion')) expected_file = 'K3P-OQMD_4786-CollCode25550_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--png', '--dos_only', '--figsize', '10', '1...
def test_multiseed(self): ' Test plotting two seed bandstructures on top of each other. ' os.chdir((REAL_PATH + '/data/bands_files')) expected_file = 'KPSn_spectral.png' sys.argv = ['dispersion', 'KPSn', 'KPSn_2', '--dos_only', '--cmap', 'viridis', '--png', '--band_reorder', '--labels', 'PBE, LDA', '--f...
-3,365,651,731,351,200,000
Test plotting two seed bandstructures on top of each other.
tests/test_plotting.py
test_multiseed
AJMGroup/matador
python
def test_multiseed(self): ' ' os.chdir((REAL_PATH + '/data/bands_files')) expected_file = 'KPSn_spectral.png' sys.argv = ['dispersion', 'KPSn', 'KPSn_2', '--dos_only', '--cmap', 'viridis', '--png', '--band_reorder', '--labels', 'PBE, LDA', '--figsize', '10', '10', '--colours', 'green', 'red'] error...
def test_x11_no_fail(self): ' Test combined spectral plots. ' os.chdir((REAL_PATH + '/data/dispersion')) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--dos_only', '--cmap', 'viridis', '--figsize', '10', '10'] errored = False try: matador.cli.dispersion.main() except Exceptio...
-2,491,664,025,944,966,000
Test combined spectral plots.
tests/test_plotting.py
test_x11_no_fail
AJMGroup/matador
python
def test_x11_no_fail(self): ' ' os.chdir((REAL_PATH + '/data/dispersion')) sys.argv = ['dispersion', 'K3P-OQMD_4786-CollCode25550', '--dos_only', '--cmap', 'viridis', '--figsize', '10', '10'] errored = False try: matador.cli.dispersion.main() except Exception as exc: errored = T...
def test_phonon_dispersion(self): ' Test phonon dispersion plot. ' os.chdir((REAL_PATH + '/data/phonon_dispersion')) expected_file = 'K3P_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P', '--png', '-ph', '--colours', 'grey', 'green', 'b...
5,399,417,869,385,618,000
Test phonon dispersion plot.
tests/test_plotting.py
test_phonon_dispersion
AJMGroup/matador
python
def test_phonon_dispersion(self): ' ' os.chdir((REAL_PATH + '/data/phonon_dispersion')) expected_file = 'K3P_spectral.png' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'K3P', '--png', '-ph', '--colours', 'grey', 'green', 'blue', '--figsize', '10', '10...
def test_phonon_ir(self): ' Test phonon IR/Raman plot. ' os.chdir((REAL_PATH + '/data/phonon_ir')) expected_file = 'h-BN_IRR_ir.svg' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'h-BN_IRR', '--svg', '-ir', '--figsize', '5', '5'] errored = False ...
-5,958,142,489,704,375,000
Test phonon IR/Raman plot.
tests/test_plotting.py
test_phonon_ir
AJMGroup/matador
python
def test_phonon_ir(self): ' ' os.chdir((REAL_PATH + '/data/phonon_ir')) expected_file = 'h-BN_IRR_ir.svg' if os.path.isfile(expected_file): os.remove(expected_file) sys.argv = ['dispersion', 'h-BN_IRR', '--svg', '-ir', '--figsize', '5', '5'] errored = False try: matador.cli....
def test_binary_hull_plot(self): ' Test plotting binary hull. ' expected_files = ['KP_hull_simple.svg'] cursor = res2dict((REAL_PATH + 'data/hull-KP-KSnP_pub/*.res'))[0] QueryConvexHull(cursor=cursor, elements=['K', 'P'], svg=True, hull_cutoff=0.0, plot_kwargs={'plot_fname': 'KP_hull_simple', 'svg': Tru...
499,941,889,050,099,460
Test plotting binary hull.
tests/test_plotting.py
test_binary_hull_plot
AJMGroup/matador
python
def test_binary_hull_plot(self): ' ' expected_files = ['KP_hull_simple.svg'] cursor = res2dict((REAL_PATH + 'data/hull-KP-KSnP_pub/*.res'))[0] QueryConvexHull(cursor=cursor, elements=['K', 'P'], svg=True, hull_cutoff=0.0, plot_kwargs={'plot_fname': 'KP_hull_simple', 'svg': True}) for expected_file ...
def test_binary_battery_plots(self): ' Test plotting binary hull. ' expected_files = ['KP_hull.png', 'KP_voltage.png', 'KP_volume.png'] cursor = res2dict((REAL_PATH + 'data/hull-KP-KSnP_pub/*.res'))[0] QueryConvexHull(cursor=cursor, elements=['K', 'P'], no_plot=False, png=True, quiet=False, voltage=True...
-5,268,088,620,267,915,000
Test plotting binary hull.
tests/test_plotting.py
test_binary_battery_plots
AJMGroup/matador
python
def test_binary_battery_plots(self): ' ' expected_files = ['KP_hull.png', 'KP_voltage.png', 'KP_volume.png'] cursor = res2dict((REAL_PATH + 'data/hull-KP-KSnP_pub/*.res'))[0] QueryConvexHull(cursor=cursor, elements=['K', 'P'], no_plot=False, png=True, quiet=False, voltage=True, labels=True, label_cutof...
@unittest.skipIf((not TERNARY_PRESENT), 'Skipping as python-ternary not found') def test_ternary_hull_plot(self): ' Test plotting ternary hull. ' expected_files = ['KSnP_hull.png', 'KSnP_voltage.png'] for expected_file in expected_files: if os.path.isfile(expected_file): os.remove(expect...
7,532,324,327,218,296,000
Test plotting ternary hull.
tests/test_plotting.py
test_ternary_hull_plot
AJMGroup/matador
python
@unittest.skipIf((not TERNARY_PRESENT), 'Skipping as python-ternary not found') def test_ternary_hull_plot(self): ' ' expected_files = ['KSnP_hull.png', 'KSnP_voltage.png'] for expected_file in expected_files: if os.path.isfile(expected_file): os.remove(expected_file) res_list = glo...
def test_beef_hull_plot(self): ' Test plotting BEEF hull. ' from matador.hull import EnsembleHull from matador.scrapers import castep2dict expected_file = 'KP_beef_hull.svg' (cursor, s) = castep2dict((REAL_PATH + 'data/beef_files/*.castep'), db=False) self.assertEqual(len(s), 0) beef_hull = ...
-8,681,327,293,378,057,000
Test plotting BEEF hull.
tests/test_plotting.py
test_beef_hull_plot
AJMGroup/matador
python
def test_beef_hull_plot(self): ' ' from matador.hull import EnsembleHull from matador.scrapers import castep2dict expected_file = 'KP_beef_hull.svg' (cursor, s) = castep2dict((REAL_PATH + 'data/beef_files/*.castep'), db=False) self.assertEqual(len(s), 0) beef_hull = EnsembleHull(cursor, '_b...
def __init__(self, audit_reason_id=None, comment=None): 'GetEdocWithAuditReasonRequest - a model defined in Swagger' self._audit_reason_id = None self._comment = None self.discriminator = None if (audit_reason_id is not None): self.audit_reason_id = audit_reason_id if (comment is not Non...
1,768,202,398,402,747,600
GetEdocWithAuditReasonRequest - a model defined in Swagger
laserfiche_api/models/get_edoc_with_audit_reason_request.py
__init__
Layer8Err/laserfiche-api
python
def __init__(self, audit_reason_id=None, comment=None): self._audit_reason_id = None self._comment = None self.discriminator = None if (audit_reason_id is not None): self.audit_reason_id = audit_reason_id if (comment is not None): self.comment = comment
@property def audit_reason_id(self): 'Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The reason id for this audit event. # noqa: E501\n\n :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: int\n ' return sel...
-1,139,160,547,206,664,100
Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501 The reason id for this audit event. # noqa: E501 :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501 :rtype: int
laserfiche_api/models/get_edoc_with_audit_reason_request.py
audit_reason_id
Layer8Err/laserfiche-api
python
@property def audit_reason_id(self): 'Gets the audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The reason id for this audit event. # noqa: E501\n\n :return: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: int\n ' return sel...
@audit_reason_id.setter def audit_reason_id(self, audit_reason_id): 'Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.\n\n The reason id for this audit event. # noqa: E501\n\n :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type...
-7,435,327,145,679,349,000
Sets the audit_reason_id of this GetEdocWithAuditReasonRequest. The reason id for this audit event. # noqa: E501 :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501 :type: int
laserfiche_api/models/get_edoc_with_audit_reason_request.py
audit_reason_id
Layer8Err/laserfiche-api
python
@audit_reason_id.setter def audit_reason_id(self, audit_reason_id): 'Sets the audit_reason_id of this GetEdocWithAuditReasonRequest.\n\n The reason id for this audit event. # noqa: E501\n\n :param audit_reason_id: The audit_reason_id of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type...
@property def comment(self): 'Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The comment for this audit event. # noqa: E501\n\n :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: str\n ' return self._comment
-6,609,239,928,674,097,000
Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501 The comment for this audit event. # noqa: E501 :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501 :rtype: str
laserfiche_api/models/get_edoc_with_audit_reason_request.py
comment
Layer8Err/laserfiche-api
python
@property def comment(self): 'Gets the comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n\n The comment for this audit event. # noqa: E501\n\n :return: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :rtype: str\n ' return self._comment
@comment.setter def comment(self, comment): 'Sets the comment of this GetEdocWithAuditReasonRequest.\n\n The comment for this audit event. # noqa: E501\n\n :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type: str\n ' self._comment = comment
1,478,110,770,522,016,800
Sets the comment of this GetEdocWithAuditReasonRequest. The comment for this audit event. # noqa: E501 :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501 :type: str
laserfiche_api/models/get_edoc_with_audit_reason_request.py
comment
Layer8Err/laserfiche-api
python
@comment.setter def comment(self, comment): 'Sets the comment of this GetEdocWithAuditReasonRequest.\n\n The comment for this audit event. # noqa: E501\n\n :param comment: The comment of this GetEdocWithAuditReasonRequest. # noqa: E501\n :type: str\n ' self._comment = comment
def to_dict(self): 'Returns the model properties as a dict' result = {} for (attr, _) in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) e...
-3,092,012,831,975,072,300
Returns the model properties as a dict
laserfiche_api/models/get_edoc_with_audit_reason_request.py
to_dict
Layer8Err/laserfiche-api
python
def to_dict(self): result = {} for (attr, _) in six.iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map((lambda x: (x.to_dict() if hasattr(x, 'to_dict') else x)), value)) elif hasattr(value, 'to_dict'): ...
def to_str(self): 'Returns the string representation of the model' return pprint.pformat(self.to_dict())
5,849,158,643,760,736,000
Returns the string representation of the model
laserfiche_api/models/get_edoc_with_audit_reason_request.py
to_str
Layer8Err/laserfiche-api
python
def to_str(self): return pprint.pformat(self.to_dict())
def __repr__(self): 'For `print` and `pprint`' return self.to_str()
-8,960,031,694,814,905,000
For `print` and `pprint`
laserfiche_api/models/get_edoc_with_audit_reason_request.py
__repr__
Layer8Err/laserfiche-api
python
def __repr__(self): return self.to_str()
def __eq__(self, other): 'Returns true if both objects are equal' if (not isinstance(other, GetEdocWithAuditReasonRequest)): return False return (self.__dict__ == other.__dict__)
8,442,840,344,376,126,000
Returns true if both objects are equal
laserfiche_api/models/get_edoc_with_audit_reason_request.py
__eq__
Layer8Err/laserfiche-api
python
def __eq__(self, other): if (not isinstance(other, GetEdocWithAuditReasonRequest)): return False return (self.__dict__ == other.__dict__)
def __ne__(self, other): 'Returns true if both objects are not equal' return (not (self == other))
7,764,124,047,908,058,000
Returns true if both objects are not equal
laserfiche_api/models/get_edoc_with_audit_reason_request.py
__ne__
Layer8Err/laserfiche-api
python
def __ne__(self, other): return (not (self == other))
def complete_login(self, request, app): '\n Returns a SocialLogin instance\n ' raise NotImplementedError
4,991,094,973,540,804,000
Returns a SocialLogin instance
allauth/socialaccount/providers/oauth/views.py
complete_login
rawjam/django-allauth
python
def complete_login(self, request, app): '\n \n ' raise NotImplementedError
def dispatch(self, request): '\n View to handle final steps of OAuth based authentication where the user\n gets redirected back to from the service provider\n ' login_done_url = reverse((self.adapter.provider_id + '_callback')) client = self._get_client(request, login_done_url) if (...
7,326,730,518,377,786,000
View to handle final steps of OAuth based authentication where the user gets redirected back to from the service provider
allauth/socialaccount/providers/oauth/views.py
dispatch
rawjam/django-allauth
python
def dispatch(self, request): '\n View to handle final steps of OAuth based authentication where the user\n gets redirected back to from the service provider\n ' login_done_url = reverse((self.adapter.provider_id + '_callback')) client = self._get_client(request, login_done_url) if (...
def get_machine_learning_compute(compute_name: Optional[str]=None, resource_group_name: Optional[str]=None, workspace_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetMachineLearningComputeResult: '\n Use this data source to access information about an existing resource.\n\n ...
396,372,869,333,231,360
Use this data source to access information about an existing resource. :param str compute_name: Name of the Azure Machine Learning compute. :param str resource_group_name: Name of the resource group in which workspace is located. :param str workspace_name: Name of Azure Machine Learning workspace.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
get_machine_learning_compute
test-wiz-sec/pulumi-azure-nextgen
python
def get_machine_learning_compute(compute_name: Optional[str]=None, resource_group_name: Optional[str]=None, workspace_name: Optional[str]=None, opts: Optional[pulumi.InvokeOptions]=None) -> AwaitableGetMachineLearningComputeResult: '\n Use this data source to access information about an existing resource.\n\n ...
@property @pulumi.getter def identity(self) -> Optional['outputs.IdentityResponse']: '\n The identity of the resource.\n ' return pulumi.get(self, 'identity')
-3,116,828,005,937,086,000
The identity of the resource.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
identity
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def identity(self) -> Optional['outputs.IdentityResponse']: '\n \n ' return pulumi.get(self, 'identity')
@property @pulumi.getter def location(self) -> Optional[str]: '\n Specifies the location of the resource.\n ' return pulumi.get(self, 'location')
7,379,677,595,793,272,000
Specifies the location of the resource.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
location
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def location(self) -> Optional[str]: '\n \n ' return pulumi.get(self, 'location')
@property @pulumi.getter def name(self) -> str: '\n Specifies the name of the resource.\n ' return pulumi.get(self, 'name')
-4,591,409,987,009,933,000
Specifies the name of the resource.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
name
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def name(self) -> str: '\n \n ' return pulumi.get(self, 'name')
@property @pulumi.getter def properties(self) -> Any: '\n Compute properties\n ' return pulumi.get(self, 'properties')
1,575,765,894,159,976,400
Compute properties
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
properties
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def properties(self) -> Any: '\n \n ' return pulumi.get(self, 'properties')
@property @pulumi.getter def sku(self) -> Optional['outputs.SkuResponse']: '\n The sku of the workspace.\n ' return pulumi.get(self, 'sku')
-6,725,223,236,896,668,000
The sku of the workspace.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
sku
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def sku(self) -> Optional['outputs.SkuResponse']: '\n \n ' return pulumi.get(self, 'sku')
@property @pulumi.getter def tags(self) -> Optional[Mapping[(str, str)]]: '\n Contains resource tags defined as key/value pairs.\n ' return pulumi.get(self, 'tags')
-3,898,261,538,620,266,000
Contains resource tags defined as key/value pairs.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
tags
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def tags(self) -> Optional[Mapping[(str, str)]]: '\n \n ' return pulumi.get(self, 'tags')
@property @pulumi.getter def type(self) -> str: '\n Specifies the type of the resource.\n ' return pulumi.get(self, 'type')
3,039,650,124,608,506,000
Specifies the type of the resource.
sdk/python/pulumi_azure_nextgen/machinelearningservices/v20200901preview/get_machine_learning_compute.py
type
test-wiz-sec/pulumi-azure-nextgen
python
@property @pulumi.getter def type(self) -> str: '\n \n ' return pulumi.get(self, 'type')
def get_full_page_url(self, page_number, scheme=None): 'Get the full, external URL for this page, optinally with the passed in URL scheme' args = dict(request.view_args, _external=True) if (scheme is not None): args['_scheme'] = scheme if (page_number != 1): args['page'] = page_number ...
-4,384,661,751,867,713,000
Get the full, external URL for this page, optinally with the passed in URL scheme
build/lib/littlefish/pager.py
get_full_page_url
michaelwalkerfl/littlefish
python
def get_full_page_url(self, page_number, scheme=None): args = dict(request.view_args, _external=True) if (scheme is not None): args['_scheme'] = scheme if (page_number != 1): args['page'] = page_number return url_for(request.endpoint, **args)
def get_canonical_url(self, scheme=None): 'Get the canonical page URL' return self.get_full_page_url(self.page_number, scheme=scheme)
7,753,665,875,289,943,000
Get the canonical page URL
build/lib/littlefish/pager.py
get_canonical_url
michaelwalkerfl/littlefish
python
def get_canonical_url(self, scheme=None): return self.get_full_page_url(self.page_number, scheme=scheme)
def render_prev_next_links(self, scheme=None): 'Render the rel=prev and rel=next links to a Markup object for injection into a template' output = '' if self.has_prev: output += '<link rel="prev" href="{}" />\n'.format(self.get_full_page_url(self.prev, scheme=scheme)) if self.has_next: ou...
7,284,570,635,124,984,000
Render the rel=prev and rel=next links to a Markup object for injection into a template
build/lib/littlefish/pager.py
render_prev_next_links
michaelwalkerfl/littlefish
python
def render_prev_next_links(self, scheme=None): output = if self.has_prev: output += '<link rel="prev" href="{}" />\n'.format(self.get_full_page_url(self.prev, scheme=scheme)) if self.has_next: output += '<link rel="next" href="{}" />\n'.format(self.get_full_page_url(self.next, scheme=s...
def render_canonical_link(self, scheme=None): 'Render the rel=canonical link to a Markup object for injection into a template' return Markup('<link rel="canonical" href="{}" />'.format(self.get_canonical_url(scheme=scheme)))
-7,152,500,946,951,668,000
Render the rel=canonical link to a Markup object for injection into a template
build/lib/littlefish/pager.py
render_canonical_link
michaelwalkerfl/littlefish
python
def render_canonical_link(self, scheme=None): return Markup('<link rel="canonical" href="{}" />'.format(self.get_canonical_url(scheme=scheme)))
def render_seo_links(self, scheme=None): 'Render the rel=canonical, rel=prev and rel=next links to a Markup object for injection into a template' out = self.render_prev_next_links(scheme=scheme) if (self.total_pages == 1): out += self.render_canonical_link(scheme=scheme) return out
85,314,694,721,360,780
Render the rel=canonical, rel=prev and rel=next links to a Markup object for injection into a template
build/lib/littlefish/pager.py
render_seo_links
michaelwalkerfl/littlefish
python
def render_seo_links(self, scheme=None): out = self.render_prev_next_links(scheme=scheme) if (self.total_pages == 1): out += self.render_canonical_link(scheme=scheme) return out
@property def first_item_number(self): '\n :return: The first "item number", used when displaying messages to the user\n like "Displaying items 1 to 10 of 123" - in this example 1 would be returned\n ' return (self.offset + 1)
3,773,746,073,670,640,000
:return: The first "item number", used when displaying messages to the user like "Displaying items 1 to 10 of 123" - in this example 1 would be returned
build/lib/littlefish/pager.py
first_item_number
michaelwalkerfl/littlefish
python
@property def first_item_number(self): '\n :return: The first "item number", used when displaying messages to the user\n like "Displaying items 1 to 10 of 123" - in this example 1 would be returned\n ' return (self.offset + 1)
@property def last_item_number(self): '\n :return: The last "item number", used when displaying messages to the user\n like "Displaying items 1 to 10 of 123" - in this example 10 would be returned\n ' n = ((self.first_item_number + self.page_size) - 1) if (n > self.total_items): ...
2,972,782,625,575,436,300
:return: The last "item number", used when displaying messages to the user like "Displaying items 1 to 10 of 123" - in this example 10 would be returned
build/lib/littlefish/pager.py
last_item_number
michaelwalkerfl/littlefish
python
@property def last_item_number(self): '\n :return: The last "item number", used when displaying messages to the user\n like "Displaying items 1 to 10 of 123" - in this example 10 would be returned\n ' n = ((self.first_item_number + self.page_size) - 1) if (n > self.total_items): ...
def __init__(self, page_size, page_number, query, max_pages=12): '\n :param max_pages: The maximum number of page links to display\n ' super().__init__(page_size, page_number, query) self.max_pages = max_pages
-3,194,777,528,965,526,000
:param max_pages: The maximum number of page links to display
build/lib/littlefish/pager.py
__init__
michaelwalkerfl/littlefish
python
def __init__(self, page_size, page_number, query, max_pages=12): '\n \n ' super().__init__(page_size, page_number, query) self.max_pages = max_pages
async def async_setup_platform(hass, config, add_entities, discovery_info=None): 'Set up the platform.\n\n Deprecated.\n ' _LOGGER.warning('Loading as a platform is no longer supported, convert to use the tplink component.')
494,254,728,963,673,150
Set up the platform. Deprecated.
homeassistant/components/tplink/switch.py
async_setup_platform
ABOTlegacy/home-assistant
python
async def async_setup_platform(hass, config, add_entities, discovery_info=None): 'Set up the platform.\n\n Deprecated.\n ' _LOGGER.warning('Loading as a platform is no longer supported, convert to use the tplink component.')
def add_entity(device: SmartPlug, async_add_entities): 'Check if device is online and add the entity.' device.get_sysinfo() async_add_entities([SmartPlugSwitch(device)], update_before_add=True)
5,229,561,941,067,430,000
Check if device is online and add the entity.
homeassistant/components/tplink/switch.py
add_entity
ABOTlegacy/home-assistant
python
def add_entity(device: SmartPlug, async_add_entities): device.get_sysinfo() async_add_entities([SmartPlugSwitch(device)], update_before_add=True)
async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities): 'Set up switches.' (await async_add_entities_retry(hass, async_add_entities, hass.data[TPLINK_DOMAIN][CONF_SWITCH], add_entity)) return True
5,713,788,469,790,789,000
Set up switches.
homeassistant/components/tplink/switch.py
async_setup_entry
ABOTlegacy/home-assistant
python
async def async_setup_entry(hass: HomeAssistantType, config_entry, async_add_entities): (await async_add_entities_retry(hass, async_add_entities, hass.data[TPLINK_DOMAIN][CONF_SWITCH], add_entity)) return True
def __init__(self, smartplug: SmartPlug): 'Initialize the switch.' self.smartplug = smartplug self._sysinfo = None self._state = None self._available = False self._emeter_params = {} self._mac = None self._alias = None self._model = None self._device_id = None
2,103,936,367,212,845,600
Initialize the switch.
homeassistant/components/tplink/switch.py
__init__
ABOTlegacy/home-assistant
python
def __init__(self, smartplug: SmartPlug): self.smartplug = smartplug self._sysinfo = None self._state = None self._available = False self._emeter_params = {} self._mac = None self._alias = None self._model = None self._device_id = None
@property def unique_id(self): 'Return a unique ID.' return self._device_id
-8,516,317,523,930,494,000
Return a unique ID.
homeassistant/components/tplink/switch.py
unique_id
ABOTlegacy/home-assistant
python
@property def unique_id(self): return self._device_id
@property def name(self): 'Return the name of the Smart Plug.' return self._alias
5,040,068,852,810,455,000
Return the name of the Smart Plug.
homeassistant/components/tplink/switch.py
name
ABOTlegacy/home-assistant
python
@property def name(self): return self._alias
@property def device_info(self): 'Return information about the device.' return {'name': self._alias, 'model': self._model, 'manufacturer': 'TP-Link', 'connections': {(dr.CONNECTION_NETWORK_MAC, self._mac)}, 'sw_version': self._sysinfo['sw_ver']}
-1,675,202,575,605,957,600
Return information about the device.
homeassistant/components/tplink/switch.py
device_info
ABOTlegacy/home-assistant
python
@property def device_info(self): return {'name': self._alias, 'model': self._model, 'manufacturer': 'TP-Link', 'connections': {(dr.CONNECTION_NETWORK_MAC, self._mac)}, 'sw_version': self._sysinfo['sw_ver']}
@property def available(self) -> bool: 'Return if switch is available.' return self._available
1,696,820,960,810,640,100
Return if switch is available.
homeassistant/components/tplink/switch.py
available
ABOTlegacy/home-assistant
python
@property def available(self) -> bool: return self._available
@property def is_on(self): 'Return true if switch is on.' return self._state
1,076,728,360,152,047,200
Return true if switch is on.
homeassistant/components/tplink/switch.py
is_on
ABOTlegacy/home-assistant
python
@property def is_on(self): return self._state
def turn_on(self, **kwargs): 'Turn the switch on.' self.smartplug.turn_on()
3,127,283,808,176,620,000
Turn the switch on.
homeassistant/components/tplink/switch.py
turn_on
ABOTlegacy/home-assistant
python
def turn_on(self, **kwargs): self.smartplug.turn_on()
def turn_off(self, **kwargs): 'Turn the switch off.' self.smartplug.turn_off()
-3,362,160,142,785,076,000
Turn the switch off.
homeassistant/components/tplink/switch.py
turn_off
ABOTlegacy/home-assistant
python
def turn_off(self, **kwargs): self.smartplug.turn_off()
@property def device_state_attributes(self): 'Return the state attributes of the device.' return self._emeter_params
4,651,969,869,013,440,000
Return the state attributes of the device.
homeassistant/components/tplink/switch.py
device_state_attributes
ABOTlegacy/home-assistant
python
@property def device_state_attributes(self): return self._emeter_params
def update(self): "Update the TP-Link switch's state." try: if (not self._sysinfo): self._sysinfo = self.smartplug.sys_info self._mac = self.smartplug.mac self._model = self.smartplug.model if (self.smartplug.context is None): self._alias =...
8,787,886,636,677,659,000
Update the TP-Link switch's state.
homeassistant/components/tplink/switch.py
update
ABOTlegacy/home-assistant
python
def update(self): try: if (not self._sysinfo): self._sysinfo = self.smartplug.sys_info self._mac = self.smartplug.mac self._model = self.smartplug.model if (self.smartplug.context is None): self._alias = self.smartplug.alias ...
def get_constant_vars() -> Dict: '\n Get a dictionary of constant environment variables.\n ' result = {} for (name, members) in CONSTANT_ENVIRONMENT_VARS.items(): members = {k: v(is_immutable=True) for (k, v) in members.items()} result[name] = StructDefinition(name, members, is_immutab...
-2,572,485,749,946,484,000
Get a dictionary of constant environment variables.
vyper/semantics/environment.py
get_constant_vars
GDGSNF/vyper
python
def get_constant_vars() -> Dict: '\n \n ' result = {} for (name, members) in CONSTANT_ENVIRONMENT_VARS.items(): members = {k: v(is_immutable=True) for (k, v) in members.items()} result[name] = StructDefinition(name, members, is_immutable=True) return result
def get_mutable_vars() -> Dict: '\n Get a dictionary of mutable environment variables (those that are\n modified during the course of contract execution, such as `self`).\n ' return {name: type_(is_immutable=True) for (name, type_) in MUTABLE_ENVIRONMENT_VARS.items()}
8,367,429,888,535,597,000
Get a dictionary of mutable environment variables (those that are modified during the course of contract execution, such as `self`).
vyper/semantics/environment.py
get_mutable_vars
GDGSNF/vyper
python
def get_mutable_vars() -> Dict: '\n Get a dictionary of mutable environment variables (those that are\n modified during the course of contract execution, such as `self`).\n ' return {name: type_(is_immutable=True) for (name, type_) in MUTABLE_ENVIRONMENT_VARS.items()}
@pytest.mark.skipif((not gdal_version.at_least((1, 11))), reason='Requires GDAL >= 1.11') @pytest.mark.skipif((not has_driver), reason='Requires {} driver'.format(driver)) def test_read_topojson(data_dir): "Test reading a TopoJSON file\n\n The TopoJSON support in GDAL is a little unpredictable. In some versions\...
-3,518,232,574,399,921,000
Test reading a TopoJSON file The TopoJSON support in GDAL is a little unpredictable. In some versions the geometries or properties aren't parsed correctly. Here we just check that we can open the file, get the right number of features out, and that they have a geometry and some properties. See GH#722.
tests/test_topojson.py
test_read_topojson
HirniMeshram1/Fiona
python
@pytest.mark.skipif((not gdal_version.at_least((1, 11))), reason='Requires GDAL >= 1.11') @pytest.mark.skipif((not has_driver), reason='Requires {} driver'.format(driver)) def test_read_topojson(data_dir): "Test reading a TopoJSON file\n\n The TopoJSON support in GDAL is a little unpredictable. In some versions\...
@deprecated def get_log_file_path() -> Optional[str]: 'DEPRECATED: Use get_latest_log_file instead.' return log_file_path
-8,588,523,497,299,603,000
DEPRECATED: Use get_latest_log_file instead.
aw_core/log.py
get_log_file_path
minhlt9196/activeseconds-aw-core
python
@deprecated def get_log_file_path() -> Optional[str]: return log_file_path