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 |
|---|---|---|---|---|---|---|---|
async def test_form_ssdp(hass):
'Test we get the form with ssdp source.'
(await setup.async_setup_component(hass, 'persistent_notification', {}))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': config_entries.SOURCE_SSDP}, data={'friendlyName': 'UniFi Dream Machine', 'mo... | 368,373,610,883,121,660 | Test we get the form with ssdp source. | tests/components/unifi/test_config_flow.py | test_form_ssdp | Nixon506E/home-assistant | python | async def test_form_ssdp(hass):
(await setup.async_setup_component(hass, 'persistent_notification', {}))
result = (await hass.config_entries.flow.async_init(UNIFI_DOMAIN, context={'source': config_entries.SOURCE_SSDP}, data={'friendlyName': 'UniFi Dream Machine', 'modelDescription': 'UniFi Dream Machine Pr... |
async def test_form_ssdp_aborts_if_host_already_exists(hass):
'Test we abort if the host is already configured.'
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '192.168.208.1', 'site': 'site_id'}})
entry.... | -2,059,152,354,034,528,300 | Test we abort if the host is already configured. | tests/components/unifi/test_config_flow.py | test_form_ssdp_aborts_if_host_already_exists | Nixon506E/home-assistant | python | async def test_form_ssdp_aborts_if_host_already_exists(hass):
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '192.168.208.1', 'site': 'site_id'}})
entry.add_to_hass(hass)
result = (await hass.config_... |
async def test_form_ssdp_aborts_if_serial_already_exists(hass):
'Test we abort if the serial is already configured.'
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '1.2.3.4', 'site': 'site_id'}}, unique_id='e... | -1,591,089,730,494,826,500 | Test we abort if the serial is already configured. | tests/components/unifi/test_config_flow.py | test_form_ssdp_aborts_if_serial_already_exists | Nixon506E/home-assistant | python | async def test_form_ssdp_aborts_if_serial_already_exists(hass):
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'controller': {'host': '1.2.3.4', 'site': 'site_id'}}, unique_id='e0:63:da:20:14:a9')
entry.add_to_hass(hass)
r... |
async def test_form_ssdp_gets_form_with_ignored_entry(hass):
'Test we can still setup if there is an ignored entry.'
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'not_controller_key': None}, source=config_entries.SOURCE_IGNORE)
... | 7,864,262,452,009,473,000 | Test we can still setup if there is an ignored entry. | tests/components/unifi/test_config_flow.py | test_form_ssdp_gets_form_with_ignored_entry | Nixon506E/home-assistant | python | async def test_form_ssdp_gets_form_with_ignored_entry(hass):
(await setup.async_setup_component(hass, 'persistent_notification', {}))
entry = MockConfigEntry(domain=UNIFI_DOMAIN, data={'not_controller_key': None}, source=config_entries.SOURCE_IGNORE)
entry.add_to_hass(hass)
result = (await hass.con... |
def setup_platform(hass, config, add_devices, discovery_info=None):
'Setup the available BloomSky weather sensors.'
logger = logging.getLogger(__name__)
bloomsky = get_component('bloomsky')
sensors = config.get('monitored_conditions', SENSOR_TYPES)
for device in bloomsky.BLOOMSKY.devices.values():
... | 4,047,506,490,008,436,700 | Setup the available BloomSky weather sensors. | homeassistant/components/sensor/bloomsky.py | setup_platform | 1lann/home-assistant | python | def setup_platform(hass, config, add_devices, discovery_info=None):
logger = logging.getLogger(__name__)
bloomsky = get_component('bloomsky')
sensors = config.get('monitored_conditions', SENSOR_TYPES)
for device in bloomsky.BLOOMSKY.devices.values():
for variable in sensors:
if ... |
def __init__(self, bs, device, sensor_name):
'Initialize a bloomsky sensor.'
self._bloomsky = bs
self._device_id = device['DeviceID']
self._sensor_name = sensor_name
self._name = '{} {}'.format(device['DeviceName'], sensor_name)
self._unique_id = 'bloomsky_sensor {}'.format(self._name)
self.... | -5,146,920,514,635,128,000 | Initialize a bloomsky sensor. | homeassistant/components/sensor/bloomsky.py | __init__ | 1lann/home-assistant | python | def __init__(self, bs, device, sensor_name):
self._bloomsky = bs
self._device_id = device['DeviceID']
self._sensor_name = sensor_name
self._name = '{} {}'.format(device['DeviceName'], sensor_name)
self._unique_id = 'bloomsky_sensor {}'.format(self._name)
self.update() |
@property
def name(self):
'The name of the BloomSky device and this sensor.'
return self._name | 9,038,137,262,409,299,000 | The name of the BloomSky device and this sensor. | homeassistant/components/sensor/bloomsky.py | name | 1lann/home-assistant | python | @property
def name(self):
return self._name |
@property
def unique_id(self):
'Return the unique ID for this sensor.'
return self._unique_id | 1,956,464,878,067,841,800 | Return the unique ID for this sensor. | homeassistant/components/sensor/bloomsky.py | unique_id | 1lann/home-assistant | python | @property
def unique_id(self):
return self._unique_id |
@property
def state(self):
'The current state, eg. value, of this sensor.'
return self._state | -8,008,055,729,367,274,000 | The current state, eg. value, of this sensor. | homeassistant/components/sensor/bloomsky.py | state | 1lann/home-assistant | python | @property
def state(self):
return self._state |
@property
def unit_of_measurement(self):
'Return the sensor units.'
return SENSOR_UNITS.get(self._sensor_name, None) | -20,660,918,308,585,132 | Return the sensor units. | homeassistant/components/sensor/bloomsky.py | unit_of_measurement | 1lann/home-assistant | python | @property
def unit_of_measurement(self):
return SENSOR_UNITS.get(self._sensor_name, None) |
def update(self):
'Request an update from the BloomSky API.'
self._bloomsky.refresh_devices()
state = self._bloomsky.devices[self._device_id]['Data'][self._sensor_name]
if (self._sensor_name in FORMAT_NUMBERS):
self._state = '{0:.2f}'.format(state)
else:
self._state = state | 100,917,558,859,747,420 | Request an update from the BloomSky API. | homeassistant/components/sensor/bloomsky.py | update | 1lann/home-assistant | python | def update(self):
self._bloomsky.refresh_devices()
state = self._bloomsky.devices[self._device_id]['Data'][self._sensor_name]
if (self._sensor_name in FORMAT_NUMBERS):
self._state = '{0:.2f}'.format(state)
else:
self._state = state |
@cluster(num_nodes=12)
@parametrize(producer_version=str(DEV_BRANCH), consumer_version=str(DEV_BRANCH))
@parametrize(producer_version=str(LATEST_0_10), consumer_version=str(LATEST_0_10))
@parametrize(producer_version=str(LATEST_0_9), consumer_version=str(LATEST_0_9))
def test_compatibility(self, producer_version, consu... | -1,733,980,396,280,035,000 | This tests performs the following checks:
The workload is a mix of 0.9.x, 0.10.x and 0.11.x producers and consumers
that produce to and consume from a DEV_BRANCH cluster
1. initially the topic is using message format 0.9.0
2. change the message format version for topic to 0.10.0 on the fly.
3. change the message format... | tests/kafkatest/tests/client/message_format_change_test.py | test_compatibility | 1810824959/kafka | python | @cluster(num_nodes=12)
@parametrize(producer_version=str(DEV_BRANCH), consumer_version=str(DEV_BRANCH))
@parametrize(producer_version=str(LATEST_0_10), consumer_version=str(LATEST_0_10))
@parametrize(producer_version=str(LATEST_0_9), consumer_version=str(LATEST_0_9))
def test_compatibility(self, producer_version, consu... |
def make_finite(data_gen):
'An adapter for Keras data generators that makes them finite.\n\n The default behavior in Keras is to keep looping infinitely through\n the data.\n\n Args:\n data_gen: An infinite Keras data generator.\n\n Yields:\n Same values as the parameter generator.\n '
num_samples = ... | 8,984,614,373,540,869,000 | An adapter for Keras data generators that makes them finite.
The default behavior in Keras is to keep looping infinitely through
the data.
Args:
data_gen: An infinite Keras data generator.
Yields:
Same values as the parameter generator. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | make_finite | 121Y/examples | python | def make_finite(data_gen):
'An adapter for Keras data generators that makes them finite.\n\n The default behavior in Keras is to keep looping infinitely through\n the data.\n\n Args:\n data_gen: An infinite Keras data generator.\n\n Yields:\n Same values as the parameter generator.\n '
num_samples = ... |
def pad_batch(batch, batch_size):
'Resize batch to a given size, tiling present samples over missing.\n\n Example:\n Suppose batch_size is 5, batch is [1, 2].\n Then the return value is [1, 2, 1, 2, 1].\n\n Args:\n batch: An ndarray with first dimension size <= batch_size.\n batch_size: Desired size f... | -8,425,979,928,581,526,000 | Resize batch to a given size, tiling present samples over missing.
Example:
Suppose batch_size is 5, batch is [1, 2].
Then the return value is [1, 2, 1, 2, 1].
Args:
batch: An ndarray with first dimension size <= batch_size.
batch_size: Desired size for first dimension.
Returns:
An ndarray of the same shap... | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | pad_batch | 121Y/examples | python | def pad_batch(batch, batch_size):
'Resize batch to a given size, tiling present samples over missing.\n\n Example:\n Suppose batch_size is 5, batch is [1, 2].\n Then the return value is [1, 2, 1, 2, 1].\n\n Args:\n batch: An ndarray with first dimension size <= batch_size.\n batch_size: Desired size f... |
def __init__(self, dataset_dir, base_model, head_model, optimizer):
'Creates a wrapper for a set of models and a data set.'
self.dataset_dir = dataset_dir
datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=(1.0 / 255), validation_split=VALIDATION_SPLIT)
self.train_img_generator = datagen.... | -7,315,273,624,684,874,000 | Creates a wrapper for a set of models and a data set. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | __init__ | 121Y/examples | python | def __init__(self, dataset_dir, base_model, head_model, optimizer):
self.dataset_dir = dataset_dir
datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=(1.0 / 255), validation_split=VALIDATION_SPLIT)
self.train_img_generator = datagen.flow_from_directory(self.dataset_dir, target_size=(IMAG... |
def _generate_initial_variables(self):
'Generates the initial model variables.'
interpreter = tf.lite.Interpreter(model_content=self.initialize_model)
zero_in = interpreter.get_input_details()[0]
variable_outs = interpreter.get_output_details()
interpreter.allocate_tensors()
interpreter.set_tens... | 6,259,699,830,710,801,000 | Generates the initial model variables. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _generate_initial_variables | 121Y/examples | python | def _generate_initial_variables(self):
interpreter = tf.lite.Interpreter(model_content=self.initialize_model)
zero_in = interpreter.get_input_details()[0]
variable_outs = interpreter.get_output_details()
interpreter.allocate_tensors()
interpreter.set_tensor(zero_in['index'], np.float32(0.0))
... |
def _optimizer_state_shapes(self):
'Reads the shapes of the optimizer parameters (mutable state).'
interpreter = tf.lite.Interpreter(model_content=self.optimizer_model)
num_variables = len(self.variables)
optim_state_inputs = interpreter.get_input_details()[(num_variables * 2):]
return [input_['shap... | 8,370,520,153,972,423,000 | Reads the shapes of the optimizer parameters (mutable state). | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _optimizer_state_shapes | 121Y/examples | python | def _optimizer_state_shapes(self):
interpreter = tf.lite.Interpreter(model_content=self.optimizer_model)
num_variables = len(self.variables)
optim_state_inputs = interpreter.get_input_details()[(num_variables * 2):]
return [input_['shape'] for input_ in optim_state_inputs] |
def prepare_bottlenecks(self):
'Passes all images through the base model and save the bottlenecks.\n\n This method has to be called before any training or inference.\n '
(self.train_bottlenecks, self.train_labels) = self._collect_and_generate_bottlenecks(self.train_img_generator)
(self.val_bottlenecks... | 2,736,615,339,603,315,700 | Passes all images through the base model and save the bottlenecks.
This method has to be called before any training or inference. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | prepare_bottlenecks | 121Y/examples | python | def prepare_bottlenecks(self):
'Passes all images through the base model and save the bottlenecks.\n\n This method has to be called before any training or inference.\n '
(self.train_bottlenecks, self.train_labels) = self._collect_and_generate_bottlenecks(self.train_img_generator)
(self.val_bottlenecks... |
def _collect_and_generate_bottlenecks(self, image_gen):
'Consumes a generator and converts all images to bottlenecks.\n\n Args:\n image_gen: A Keras data generator for images to process\n\n Returns:\n Two NumPy arrays: (bottlenecks, labels).\n '
collected_bottlenecks = np.zeros(((image_gen.sa... | 2,256,107,985,492,601,900 | Consumes a generator and converts all images to bottlenecks.
Args:
image_gen: A Keras data generator for images to process
Returns:
Two NumPy arrays: (bottlenecks, labels). | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _collect_and_generate_bottlenecks | 121Y/examples | python | def _collect_and_generate_bottlenecks(self, image_gen):
'Consumes a generator and converts all images to bottlenecks.\n\n Args:\n image_gen: A Keras data generator for images to process\n\n Returns:\n Two NumPy arrays: (bottlenecks, labels).\n '
collected_bottlenecks = np.zeros(((image_gen.sa... |
def _generate_bottlenecks(self, image_gen):
'Generator adapter that passes images through the bottleneck model.\n\n Args:\n image_gen: A generator that returns images to be processed. Images are\n paired with ground truth labels.\n\n Yields:\n Bottlenecks from input images, paired with ground... | -2,999,031,076,376,204,300 | Generator adapter that passes images through the bottleneck model.
Args:
image_gen: A generator that returns images to be processed. Images are
paired with ground truth labels.
Yields:
Bottlenecks from input images, paired with ground truth labels. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _generate_bottlenecks | 121Y/examples | python | def _generate_bottlenecks(self, image_gen):
'Generator adapter that passes images through the bottleneck model.\n\n Args:\n image_gen: A generator that returns images to be processed. Images are\n paired with ground truth labels.\n\n Yields:\n Bottlenecks from input images, paired with ground... |
def train_head(self, num_epochs):
'Trains the head model for a given number of epochs.\n\n SGD is used as an optimizer.\n\n Args:\n num_epochs: how many epochs should be trained\n\n Returns:\n A list of train_loss values after every epoch trained.\n\n Raises:\n RuntimeError: when prepare_... | -6,946,596,642,517,278,000 | Trains the head model for a given number of epochs.
SGD is used as an optimizer.
Args:
num_epochs: how many epochs should be trained
Returns:
A list of train_loss values after every epoch trained.
Raises:
RuntimeError: when prepare_bottlenecks() has not been called. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | train_head | 121Y/examples | python | def train_head(self, num_epochs):
'Trains the head model for a given number of epochs.\n\n SGD is used as an optimizer.\n\n Args:\n num_epochs: how many epochs should be trained\n\n Returns:\n A list of train_loss values after every epoch trained.\n\n Raises:\n RuntimeError: when prepare_... |
def _generate_batches(self, x, y):
'Creates a generator that iterates over the data in batches.'
num_total = x.shape[0]
for begin in range(0, num_total, BATCH_SIZE):
end = min((begin + BATCH_SIZE), num_total)
(yield (x[begin:end], y[begin:end])) | 6,442,735,420,916,530,000 | Creates a generator that iterates over the data in batches. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _generate_batches | 121Y/examples | python | def _generate_batches(self, x, y):
num_total = x.shape[0]
for begin in range(0, num_total, BATCH_SIZE):
end = min((begin + BATCH_SIZE), num_total)
(yield (x[begin:end], y[begin:end])) |
def _train_one_epoch(self, train_gen):
'Performs one training epoch.'
interpreter = tf.lite.Interpreter(model_content=self.train_head_model)
interpreter.allocate_tensors()
(x_in, y_in) = interpreter.get_input_details()[:2]
variable_ins = interpreter.get_input_details()[2:]
loss_out = interpreter... | -3,484,671,471,586,543,600 | Performs one training epoch. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _train_one_epoch | 121Y/examples | python | def _train_one_epoch(self, train_gen):
interpreter = tf.lite.Interpreter(model_content=self.train_head_model)
interpreter.allocate_tensors()
(x_in, y_in) = interpreter.get_input_details()[:2]
variable_ins = interpreter.get_input_details()[2:]
loss_out = interpreter.get_output_details()[0]
g... |
def _apply_gradients(self, gradients):
'Applies the optimizer to the model parameters.'
interpreter = tf.lite.Interpreter(model_content=self.optimizer_model)
interpreter.allocate_tensors()
num_variables = len(self.variables)
variable_ins = interpreter.get_input_details()[:num_variables]
gradient... | 1,172,778,093,618,668,000 | Applies the optimizer to the model parameters. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | _apply_gradients | 121Y/examples | python | def _apply_gradients(self, gradients):
interpreter = tf.lite.Interpreter(model_content=self.optimizer_model)
interpreter.allocate_tensors()
num_variables = len(self.variables)
variable_ins = interpreter.get_input_details()[:num_variables]
gradient_ins = interpreter.get_input_details()[num_varia... |
def measure_inference_accuracy(self):
'Runs the inference model and measures accuracy on the validation set.'
interpreter = tf.lite.Interpreter(model_content=self.inference_model)
bottleneck_in = interpreter.get_input_details()[0]
variable_ins = interpreter.get_input_details()[1:]
[y_out] = interpre... | -1,351,305,172,050,004,500 | Runs the inference model and measures accuracy on the validation set. | lite/examples/model_personalization/converter/tfltransfer/model_correctness_test.py | measure_inference_accuracy | 121Y/examples | python | def measure_inference_accuracy(self):
interpreter = tf.lite.Interpreter(model_content=self.inference_model)
bottleneck_in = interpreter.get_input_details()[0]
variable_ins = interpreter.get_input_details()[1:]
[y_out] = interpreter.get_output_details()
inference_accuracy = 0.0
num_processed... |
def importance_matrix(sensitivities, data, print_imp=True, show_table=True, tag_to_ablate=None):
'\n Builds a matrix of tag sensitivities\n :param sensitivities: This is a matrix of [num_tags, num_neurons],\n which is [10 x 50] in our experimental configuration.\n :return:\n '
important_lists = [... | 5,640,006,925,624,561,000 | Builds a matrix of tag sensitivities
:param sensitivities: This is a matrix of [num_tags, num_neurons],
which is [10 x 50] in our experimental configuration.
:return: | main.py | importance_matrix | DeniseMak/ner-neuron | python | def importance_matrix(sensitivities, data, print_imp=True, show_table=True, tag_to_ablate=None):
'\n Builds a matrix of tag sensitivities\n :param sensitivities: This is a matrix of [num_tags, num_neurons],\n which is [10 x 50] in our experimental configuration.\n :return:\n '
important_lists = [... |
def heatmap_sensitivity(sensitivities, modelname=DEFAULT_TRAINED_FILE, testname='', show_pad=False, show_vals=True, disable=False):
'\n Shows a heatmap for the sensitivity values, saves the heatmap to a PNG file,\n and also saves the sensitivity matrix to an .npy file,\n which we use for calculating correl... | 6,119,709,356,291,908,000 | Shows a heatmap for the sensitivity values, saves the heatmap to a PNG file,
and also saves the sensitivity matrix to an .npy file,
which we use for calculating correlations between models later.
:param sensitivities: This is a matrix of [num_tags, num_neurons],
which is [10 x 50] in our experimental configuration.
:pa... | main.py | heatmap_sensitivity | DeniseMak/ner-neuron | python | def heatmap_sensitivity(sensitivities, modelname=DEFAULT_TRAINED_FILE, testname=, show_pad=False, show_vals=True, disable=False):
'\n Shows a heatmap for the sensitivity values, saves the heatmap to a PNG file,\n and also saves the sensitivity matrix to an .npy file,\n which we use for calculating correlat... |
def get_sensitivity_matrix(label, debug=True):
'\n Given a tag like 4: (B-PER), return the sensitivity matrix\n :param label:\n :return:\n '
avg_for_label = (data.tag_contributions[label] / data.tag_counts[label])
sum_other_counts = 0
sum_other_contributions = np.zeros((10, 50))
for l in... | -964,061,719,209,157,100 | Given a tag like 4: (B-PER), return the sensitivity matrix
:param label:
:return: | main.py | get_sensitivity_matrix | DeniseMak/ner-neuron | python | def get_sensitivity_matrix(label, debug=True):
'\n Given a tag like 4: (B-PER), return the sensitivity matrix\n :param label:\n :return:\n '
avg_for_label = (data.tag_contributions[label] / data.tag_counts[label])
sum_other_counts = 0
sum_other_contributions = np.zeros((10, 50))
for l in... |
def predict_check(pred_variable, gold_variable, mask_variable, sentence_classification=False):
'\n input:\n pred_variable (batch_size, sent_len): pred tag result, in numpy format\n gold_variable (batch_size, sent_len): gold result variable\n mask_variable (batch_size, sent_le... | 9,179,701,905,884,813,000 | input:
pred_variable (batch_size, sent_len): pred tag result, in numpy format
gold_variable (batch_size, sent_len): gold result variable
mask_variable (batch_size, sent_len): mask variable | main.py | predict_check | DeniseMak/ner-neuron | python | def predict_check(pred_variable, gold_variable, mask_variable, sentence_classification=False):
'\n input:\n pred_variable (batch_size, sent_len): pred tag result, in numpy format\n gold_variable (batch_size, sent_len): gold result variable\n mask_variable (batch_size, sent_le... |
def recover_label(pred_variable, gold_variable, mask_variable, label_alphabet, word_recover, sentence_classification=False):
'\n input:\n pred_variable (batch_size, sent_len): pred tag result\n gold_variable (batch_size, sent_len): gold result variable\n mask_variable (batch_... | -7,238,641,698,619,610,000 | input:
pred_variable (batch_size, sent_len): pred tag result
gold_variable (batch_size, sent_len): gold result variable
mask_variable (batch_size, sent_len): mask variable | main.py | recover_label | DeniseMak/ner-neuron | python | def recover_label(pred_variable, gold_variable, mask_variable, label_alphabet, word_recover, sentence_classification=False):
'\n input:\n pred_variable (batch_size, sent_len): pred tag result\n gold_variable (batch_size, sent_len): gold result variable\n mask_variable (batch_... |
def recover_nbest_label(pred_variable, mask_variable, label_alphabet, word_recover):
'\n input:\n pred_variable (batch_size, sent_len, nbest): pred tag result\n mask_variable (batch_size, sent_len): mask variable\n word_recover (batch_size)\n output:\n nbest... | 7,128,950,410,604,630,000 | input:
pred_variable (batch_size, sent_len, nbest): pred tag result
mask_variable (batch_size, sent_len): mask variable
word_recover (batch_size)
output:
nbest_pred_label list: [batch_size, nbest, each_seq_len] | main.py | recover_nbest_label | DeniseMak/ner-neuron | python | def recover_nbest_label(pred_variable, mask_variable, label_alphabet, word_recover):
'\n input:\n pred_variable (batch_size, sent_len, nbest): pred tag result\n mask_variable (batch_size, sent_len): mask variable\n word_recover (batch_size)\n output:\n nbest... |
def evaluate(data, model, name, nbest=None, print_tag_counts=False, tag_to_ablate=None):
"\n\n :param data:\n :param model:\n :param name:\n :param nbest:\n :param print_tag_counts:\n :param tag_to_ablate: if this is set to a tag name, like 'B-ORG', then in the LSTM layer's forward() we ablate the... | 6,244,522,984,307,677,000 | :param data:
:param model:
:param name:
:param nbest:
:param print_tag_counts:
:param tag_to_ablate: if this is set to a tag name, like 'B-ORG', then in the LSTM layer's forward() we ablate the
number of neurons specified by data.ablate_num
:return: | main.py | evaluate | DeniseMak/ner-neuron | python | def evaluate(data, model, name, nbest=None, print_tag_counts=False, tag_to_ablate=None):
"\n\n :param data:\n :param model:\n :param name:\n :param nbest:\n :param print_tag_counts:\n :param tag_to_ablate: if this is set to a tag name, like 'B-ORG', then in the LSTM layer's forward() we ablate the... |
def batchify_sequence_labeling_with_label(input_batch_list, gpu, if_train=True):
'\n input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]\n words: word ids for one sentence. (batch_size, sent_len)\n features: feat... | 1,337,854,411,642,345,500 | input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]
words: word ids for one sentence. (batch_size, sent_len)
features: features ids for one sentence. (batch_size, sent_len, feature_num)
chars: char ids for on sentences, various lengt... | main.py | batchify_sequence_labeling_with_label | DeniseMak/ner-neuron | python | def batchify_sequence_labeling_with_label(input_batch_list, gpu, if_train=True):
'\n input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]\n words: word ids for one sentence. (batch_size, sent_len)\n features: feat... |
def batchify_sentence_classification_with_label(input_batch_list, gpu, if_train=True):
'\n input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]\n words: word ids for one sentence. (batch_size, sent_len)\n features... | -4,112,489,582,308,551,700 | input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]
words: word ids for one sentence. (batch_size, sent_len)
features: features ids for one sentence. (batch_size, feature_num), each sentence has one set of feature
chars: char ids for... | main.py | batchify_sentence_classification_with_label | DeniseMak/ner-neuron | python | def batchify_sentence_classification_with_label(input_batch_list, gpu, if_train=True):
'\n input: list of words, chars and labels, various length. [[words, features, chars, labels],[words, features, chars,labels],...]\n words: word ids for one sentence. (batch_size, sent_len)\n features... |
def load_model_to_test(data, train=False, dev=True, test=False, tag=None):
'\n Set any ONE of train, dev, test to true, in order to evaluate on that set.\n :param data:\n :param train:\n :param dev: Default set to test, because that was what the original experiment did\n :param test:\n :return:\n ... | -2,669,934,518,169,888,000 | Set any ONE of train, dev, test to true, in order to evaluate on that set.
:param data:
:param train:
:param dev: Default set to test, because that was what the original experiment did
:param test:
:return: | main.py | load_model_to_test | DeniseMak/ner-neuron | python | def load_model_to_test(data, train=False, dev=True, test=False, tag=None):
'\n Set any ONE of train, dev, test to true, in order to evaluate on that set.\n :param data:\n :param train:\n :param dev: Default set to test, because that was what the original experiment did\n :param test:\n :return:\n ... |
@pytest.fixture
def preprocessor():
'Return an instance of FixLatexPreprocessor.'
return FixLatexPreprocessor() | 3,498,699,546,808,116,700 | Return an instance of FixLatexPreprocessor. | tests/preprocessors/test_fixlatex.py | preprocessor | IMTorgDemo/hugo-nb2hugo | python | @pytest.fixture
def preprocessor():
return FixLatexPreprocessor() |
def __init__(self, n_dims_before, dims_neighbourhoods, strides=None, ignore_border=False, inverse=False):
'\n This extracts neighbourhoods from "images", but in a\n dimension-generic manner.\n\n In the 2D case, this is similar to downsampling, but instead of reducing\n a group of 2x2 pix... | -7,338,087,771,251,095,000 | This extracts neighbourhoods from "images", but in a
dimension-generic manner.
In the 2D case, this is similar to downsampling, but instead of reducing
a group of 2x2 pixels (for example) to a single new pixel in the output,
you place those 4 pixels in a row.
For example, say you have this 2x4 image::
[ [ 0.5, 0... | theano/sandbox/neighbourhoods.py | __init__ | jych/Theano | python | def __init__(self, n_dims_before, dims_neighbourhoods, strides=None, ignore_border=False, inverse=False):
'\n This extracts neighbourhoods from "images", but in a\n dimension-generic manner.\n\n In the 2D case, this is similar to downsampling, but instead of reducing\n a group of 2x2 pix... |
def get(path):
"\n Define decorator @get('/path')\n "
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
wrapper.__method__ = 'GET'
wrapper.__route__ = path
return wrapper
return decorator | -1,081,527,196,878,977,900 | Define decorator @get('/path') | qiushaoyi/programs/qsy_program_codes/python3-webapp/www/coroweb.py | get | qsyPython/Python_play_now | python | def get(path):
"\n \n "
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
wrapper.__method__ = 'GET'
wrapper.__route__ = path
return wrapper
return decorator |
def post(path):
"\n Define decorator @post('/path')\n "
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
wrapper.__method__ = 'POST'
wrapper.__route__ = path
return wrapper
return decorator | -1,957,891,444,018,988,300 | Define decorator @post('/path') | qiushaoyi/programs/qsy_program_codes/python3-webapp/www/coroweb.py | post | qsyPython/Python_play_now | python | def post(path):
"\n \n "
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
wrapper.__method__ = 'POST'
wrapper.__route__ = path
return wrapper
return decorator |
def _clear_edit_handler_cache(self):
'\n These tests generate new EditHandlers with different settings. The\n cached edit handlers should be cleared before and after each test run\n to ensure that no changes leak through to other tests.\n '
from wagtail.tests.testapp.models import De... | 6,077,374,927,507,667,000 | These tests generate new EditHandlers with different settings. The
cached edit handlers should be cleared before and after each test run
to ensure that no changes leak through to other tests. | wagtail/wagtailadmin/tests/test_rich_text.py | _clear_edit_handler_cache | Girbons/wagtail | python | def _clear_edit_handler_cache(self):
'\n These tests generate new EditHandlers with different settings. The\n cached edit handlers should be cleared before and after each test run\n to ensure that no changes leak through to other tests.\n '
from wagtail.tests.testapp.models import De... |
def _match_vcs_scheme(url):
"Look for VCS schemes in the URL.\n\n Returns the matched VCS scheme, or None if there's no match.\n "
for scheme in vcs.schemes:
if (url.lower().startswith(scheme) and (url[len(scheme)] in '+:')):
return scheme
return None | -2,767,249,340,109,071,000 | Look for VCS schemes in the URL.
Returns the matched VCS scheme, or None if there's no match. | src/pip/_internal/index/collector.py | _match_vcs_scheme | FFY00/pip | python | def _match_vcs_scheme(url):
"Look for VCS schemes in the URL.\n\n Returns the matched VCS scheme, or None if there's no match.\n "
for scheme in vcs.schemes:
if (url.lower().startswith(scheme) and (url[len(scheme)] in '+:')):
return scheme
return None |
def _is_url_like_archive(url):
'Return whether the URL looks like an archive.\n '
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False | -4,260,495,002,805,551,600 | Return whether the URL looks like an archive. | src/pip/_internal/index/collector.py | _is_url_like_archive | FFY00/pip | python | def _is_url_like_archive(url):
'\n '
filename = Link(url).filename
for bad_ext in ARCHIVE_EXTENSIONS:
if filename.endswith(bad_ext):
return True
return False |
def _ensure_html_header(response):
'Check the Content-Type header to ensure the response contains HTML.\n\n Raises `_NotHTML` if the content type is not text/html.\n '
content_type = response.headers.get('Content-Type', '')
if (not content_type.lower().startswith('text/html')):
raise _NotHTML(... | 7,393,163,883,968,440,000 | Check the Content-Type header to ensure the response contains HTML.
Raises `_NotHTML` if the content type is not text/html. | src/pip/_internal/index/collector.py | _ensure_html_header | FFY00/pip | python | def _ensure_html_header(response):
'Check the Content-Type header to ensure the response contains HTML.\n\n Raises `_NotHTML` if the content type is not text/html.\n '
content_type = response.headers.get('Content-Type', )
if (not content_type.lower().startswith('text/html')):
raise _NotHTML(co... |
def _ensure_html_response(url, session):
'Send a HEAD request to the URL, and ensure the response contains HTML.\n\n Raises `_NotHTTP` if the URL is not available for a HEAD request, or\n `_NotHTML` if the content type is not text/html.\n '
(scheme, netloc, path, query, fragment) = urllib_parse.urlspli... | 9,111,036,939,874,658,000 | Send a HEAD request to the URL, and ensure the response contains HTML.
Raises `_NotHTTP` if the URL is not available for a HEAD request, or
`_NotHTML` if the content type is not text/html. | src/pip/_internal/index/collector.py | _ensure_html_response | FFY00/pip | python | def _ensure_html_response(url, session):
'Send a HEAD request to the URL, and ensure the response contains HTML.\n\n Raises `_NotHTTP` if the URL is not available for a HEAD request, or\n `_NotHTML` if the content type is not text/html.\n '
(scheme, netloc, path, query, fragment) = urllib_parse.urlspli... |
def _get_html_response(url, session):
'Access an HTML page with GET, and return the response.\n\n This consists of three parts:\n\n 1. If the URL looks suspiciously like an archive, send a HEAD first to\n check the Content-Type is HTML, to avoid downloading a large file.\n Raise `_NotHTTP` if the ... | -2,997,599,138,486,661,600 | Access an HTML page with GET, and return the response.
This consists of three parts:
1. If the URL looks suspiciously like an archive, send a HEAD first to
check the Content-Type is HTML, to avoid downloading a large file.
Raise `_NotHTTP` if the content type cannot be determined, or
`_NotHTML` if it is not ... | src/pip/_internal/index/collector.py | _get_html_response | FFY00/pip | python | def _get_html_response(url, session):
'Access an HTML page with GET, and return the response.\n\n This consists of three parts:\n\n 1. If the URL looks suspiciously like an archive, send a HEAD first to\n check the Content-Type is HTML, to avoid downloading a large file.\n Raise `_NotHTTP` if the ... |
def _get_encoding_from_headers(headers):
'Determine if we have any encoding information in our headers.\n '
if (headers and ('Content-Type' in headers)):
(content_type, params) = cgi.parse_header(headers['Content-Type'])
if ('charset' in params):
return params['charset']
retur... | 4,644,743,172,171,733,000 | Determine if we have any encoding information in our headers. | src/pip/_internal/index/collector.py | _get_encoding_from_headers | FFY00/pip | python | def _get_encoding_from_headers(headers):
'\n '
if (headers and ('Content-Type' in headers)):
(content_type, params) = cgi.parse_header(headers['Content-Type'])
if ('charset' in params):
return params['charset']
return None |
def _determine_base_url(document, page_url):
"Determine the HTML document's base URL.\n\n This looks for a ``<base>`` tag in the HTML document. If present, its href\n attribute denotes the base URL of anchor tags in the document. If there is\n no such tag (or if it does not have a valid href attribute), th... | -3,132,334,396,255,823,400 | Determine the HTML document's base URL.
This looks for a ``<base>`` tag in the HTML document. If present, its href
attribute denotes the base URL of anchor tags in the document. If there is
no such tag (or if it does not have a valid href attribute), the HTML
file's URL is used as the base URL.
:param document: An HT... | src/pip/_internal/index/collector.py | _determine_base_url | FFY00/pip | python | def _determine_base_url(document, page_url):
"Determine the HTML document's base URL.\n\n This looks for a ``<base>`` tag in the HTML document. If present, its href\n attribute denotes the base URL of anchor tags in the document. If there is\n no such tag (or if it does not have a valid href attribute), th... |
def _clean_url_path_part(part):
'\n Clean a "part" of a URL path (i.e. after splitting on "@" characters).\n '
return urllib_parse.quote(urllib_parse.unquote(part)) | -1,455,366,948,776,871,400 | Clean a "part" of a URL path (i.e. after splitting on "@" characters). | src/pip/_internal/index/collector.py | _clean_url_path_part | FFY00/pip | python | def _clean_url_path_part(part):
'\n \n '
return urllib_parse.quote(urllib_parse.unquote(part)) |
def _clean_file_url_path(part):
'\n Clean the first part of a URL path that corresponds to a local\n filesystem path (i.e. the first part after splitting on "@" characters).\n '
return urllib_request.pathname2url(urllib_request.url2pathname(part)) | 1,475,497,318,402,513,400 | Clean the first part of a URL path that corresponds to a local
filesystem path (i.e. the first part after splitting on "@" characters). | src/pip/_internal/index/collector.py | _clean_file_url_path | FFY00/pip | python | def _clean_file_url_path(part):
'\n Clean the first part of a URL path that corresponds to a local\n filesystem path (i.e. the first part after splitting on "@" characters).\n '
return urllib_request.pathname2url(urllib_request.url2pathname(part)) |
def _clean_url_path(path, is_local_path):
'\n Clean the path portion of a URL.\n '
if is_local_path:
clean_func = _clean_file_url_path
else:
clean_func = _clean_url_path_part
parts = _reserved_chars_re.split(path)
cleaned_parts = []
for (to_clean, reserved) in pairwise(iter... | 8,829,866,879,231,687,000 | Clean the path portion of a URL. | src/pip/_internal/index/collector.py | _clean_url_path | FFY00/pip | python | def _clean_url_path(path, is_local_path):
'\n \n '
if is_local_path:
clean_func = _clean_file_url_path
else:
clean_func = _clean_url_path_part
parts = _reserved_chars_re.split(path)
cleaned_parts = []
for (to_clean, reserved) in pairwise(itertools.chain(parts, [])):
... |
def _clean_link(url):
'\n Make sure a link is fully quoted.\n For example, if \' \' occurs in the URL, it will be replaced with "%20",\n and without double-quoting other characters.\n '
result = urllib_parse.urlparse(url)
is_local_path = (not result.netloc)
path = _clean_url_path(result.path... | -1,719,449,041,498,693,400 | Make sure a link is fully quoted.
For example, if ' ' occurs in the URL, it will be replaced with "%20",
and without double-quoting other characters. | src/pip/_internal/index/collector.py | _clean_link | FFY00/pip | python | def _clean_link(url):
'\n Make sure a link is fully quoted.\n For example, if \' \' occurs in the URL, it will be replaced with "%20",\n and without double-quoting other characters.\n '
result = urllib_parse.urlparse(url)
is_local_path = (not result.netloc)
path = _clean_url_path(result.path... |
def _create_link_from_element(anchor, page_url, base_url):
'\n Convert an anchor element in a simple repository page to a Link.\n '
href = anchor.get('href')
if (not href):
return None
url = _clean_link(urllib_parse.urljoin(base_url, href))
pyrequire = anchor.get('data-requires-python'... | 3,313,022,715,014,799,000 | Convert an anchor element in a simple repository page to a Link. | src/pip/_internal/index/collector.py | _create_link_from_element | FFY00/pip | python | def _create_link_from_element(anchor, page_url, base_url):
'\n \n '
href = anchor.get('href')
if (not href):
return None
url = _clean_link(urllib_parse.urljoin(base_url, href))
pyrequire = anchor.get('data-requires-python')
pyrequire = (unescape(pyrequire) if pyrequire else None)
... |
def with_cached_html_pages(fn):
"\n Given a function that parses an Iterable[Link] from an HTMLPage, cache the\n function's result (keyed by CacheablePageContent), unless the HTMLPage\n `page` has `page.cache_link_parsing == False`.\n "
@_lru_cache(maxsize=None)
def wrapper(cacheable_page):
... | 7,444,462,802,212,503,000 | Given a function that parses an Iterable[Link] from an HTMLPage, cache the
function's result (keyed by CacheablePageContent), unless the HTMLPage
`page` has `page.cache_link_parsing == False`. | src/pip/_internal/index/collector.py | with_cached_html_pages | FFY00/pip | python | def with_cached_html_pages(fn):
"\n Given a function that parses an Iterable[Link] from an HTMLPage, cache the\n function's result (keyed by CacheablePageContent), unless the HTMLPage\n `page` has `page.cache_link_parsing == False`.\n "
@_lru_cache(maxsize=None)
def wrapper(cacheable_page):
... |
@with_cached_html_pages
def parse_links(page):
'\n Parse an HTML document, and yield its anchor elements as Link objects.\n '
document = html5lib.parse(page.content, transport_encoding=page.encoding, namespaceHTMLElements=False)
url = page.url
base_url = _determine_base_url(document, url)
for ... | -2,005,043,465,176,568,300 | Parse an HTML document, and yield its anchor elements as Link objects. | src/pip/_internal/index/collector.py | parse_links | FFY00/pip | python | @with_cached_html_pages
def parse_links(page):
'\n \n '
document = html5lib.parse(page.content, transport_encoding=page.encoding, namespaceHTMLElements=False)
url = page.url
base_url = _determine_base_url(document, url)
for anchor in document.findall('.//a'):
link = _create_link_from_e... |
def _remove_duplicate_links(links):
'\n Return a list of links, with duplicates removed and ordering preserved.\n '
return list(OrderedDict.fromkeys(links)) | -1,224,858,665,223,807,500 | Return a list of links, with duplicates removed and ordering preserved. | src/pip/_internal/index/collector.py | _remove_duplicate_links | FFY00/pip | python | def _remove_duplicate_links(links):
'\n \n '
return list(OrderedDict.fromkeys(links)) |
def group_locations(locations, expand_dir=False):
'\n Divide a list of locations into two groups: "files" (archives) and "urls."\n\n :return: A pair of lists (files, urls).\n '
files = []
urls = []
def sort_path(path):
url = path_to_url(path)
if (mimetypes.guess_type(url, stric... | 4,359,161,462,114,489,300 | Divide a list of locations into two groups: "files" (archives) and "urls."
:return: A pair of lists (files, urls). | src/pip/_internal/index/collector.py | group_locations | FFY00/pip | python | def group_locations(locations, expand_dir=False):
'\n Divide a list of locations into two groups: "files" (archives) and "urls."\n\n :return: A pair of lists (files, urls).\n '
files = []
urls = []
def sort_path(path):
url = path_to_url(path)
if (mimetypes.guess_type(url, stric... |
def __init__(self, content, encoding, url, cache_link_parsing=True):
"\n :param encoding: the encoding to decode the given content.\n :param url: the URL from which the HTML was downloaded.\n :param cache_link_parsing: whether links parsed from this page's url\n ... | 2,947,765,301,962,677,000 | :param encoding: the encoding to decode the given content.
:param url: the URL from which the HTML was downloaded.
:param cache_link_parsing: whether links parsed from this page's url
should be cached. PyPI index urls should
have this set to False, for example. | src/pip/_internal/index/collector.py | __init__ | FFY00/pip | python | def __init__(self, content, encoding, url, cache_link_parsing=True):
"\n :param encoding: the encoding to decode the given content.\n :param url: the URL from which the HTML was downloaded.\n :param cache_link_parsing: whether links parsed from this page's url\n ... |
def __init__(self, files, find_links, project_urls):
'\n :param files: Links from file locations.\n :param find_links: Links from find_links.\n :param project_urls: URLs to HTML project pages, as described by\n the PEP 503 simple repository API.\n '
self.files = files
... | -7,833,018,662,680,880,000 | :param files: Links from file locations.
:param find_links: Links from find_links.
:param project_urls: URLs to HTML project pages, as described by
the PEP 503 simple repository API. | src/pip/_internal/index/collector.py | __init__ | FFY00/pip | python | def __init__(self, files, find_links, project_urls):
'\n :param files: Links from file locations.\n :param find_links: Links from find_links.\n :param project_urls: URLs to HTML project pages, as described by\n the PEP 503 simple repository API.\n '
self.files = files
... |
def fetch_page(self, location):
'\n Fetch an HTML page containing package links.\n '
return _get_html_page(location, session=self.session) | 4,139,731,530,769,525,000 | Fetch an HTML page containing package links. | src/pip/_internal/index/collector.py | fetch_page | FFY00/pip | python | def fetch_page(self, location):
'\n \n '
return _get_html_page(location, session=self.session) |
def collect_links(self, project_name):
'Find all available links for the given project name.\n\n :return: All the Link objects (unfiltered), as a CollectedLinks object.\n '
search_scope = self.search_scope
index_locations = search_scope.get_index_urls_locations(project_name)
(index_file_lo... | 8,680,116,040,653,082,000 | Find all available links for the given project name.
:return: All the Link objects (unfiltered), as a CollectedLinks object. | src/pip/_internal/index/collector.py | collect_links | FFY00/pip | python | def collect_links(self, project_name):
'Find all available links for the given project name.\n\n :return: All the Link objects (unfiltered), as a CollectedLinks object.\n '
search_scope = self.search_scope
index_locations = search_scope.get_index_urls_locations(project_name)
(index_file_lo... |
def fetch(self, is_dl_forced=False):
'\n :return: None\n\n '
self.get_files(is_dl_forced)
return | 8,409,556,957,349,451,000 | :return: None | dipper/sources/Panther.py | fetch | putmantime/dipper | python | def fetch(self, is_dl_forced=False):
'\n \n\n '
self.get_files(is_dl_forced)
return |
def parse(self, limit=None):
'\n :return: None\n '
if self.testOnly:
self.testMode = True
if (self.tax_ids is None):
logger.info('No taxon filter set; Dumping all orthologous associations.')
else:
logger.info('Only the following taxa will be dumped: %s', str(self.ta... | -2,486,379,677,687,401,000 | :return: None | dipper/sources/Panther.py | parse | putmantime/dipper | python | def parse(self, limit=None):
'\n \n '
if self.testOnly:
self.testMode = True
if (self.tax_ids is None):
logger.info('No taxon filter set; Dumping all orthologous associations.')
else:
logger.info('Only the following taxa will be dumped: %s', str(self.tax_ids))
s... |
def _get_orthologs(self, limit):
"\n This will process each of the specified pairwise orthology files,\n creating orthology associations based on the specified orthology code.\n this currently assumes that each of the orthology files is identically\n formatted. Relationships are made bet... | 7,377,265,323,652,030,000 | This will process each of the specified pairwise orthology files,
creating orthology associations based on the specified orthology code.
this currently assumes that each of the orthology files is identically
formatted. Relationships are made between genes here.
There is also a nominal amount of identifier re-formattin... | dipper/sources/Panther.py | _get_orthologs | putmantime/dipper | python | def _get_orthologs(self, limit):
"\n This will process each of the specified pairwise orthology files,\n creating orthology associations based on the specified orthology code.\n this currently assumes that each of the orthology files is identically\n formatted. Relationships are made bet... |
@staticmethod
def _map_taxon_abbr_to_id(ptax):
'\n Will map the panther-specific taxon abbreviations to NCBI taxon numbers\n :param ptax:\n :return: NCBITaxon id\n '
taxid = None
ptax_to_taxid_map = {'ANOCA': 28377, 'ARATH': 3702, 'BOVIN': 9913, 'CAEEL': 6239, 'CANFA': 9615, 'CHI... | 6,544,314,553,461,517,000 | Will map the panther-specific taxon abbreviations to NCBI taxon numbers
:param ptax:
:return: NCBITaxon id | dipper/sources/Panther.py | _map_taxon_abbr_to_id | putmantime/dipper | python | @staticmethod
def _map_taxon_abbr_to_id(ptax):
'\n Will map the panther-specific taxon abbreviations to NCBI taxon numbers\n :param ptax:\n :return: NCBITaxon id\n '
taxid = None
ptax_to_taxid_map = {'ANOCA': 28377, 'ARATH': 3702, 'BOVIN': 9913, 'CAEEL': 6239, 'CANFA': 9615, 'CHI... |
@staticmethod
def _map_orthology_code_to_RO(ortho):
'\n Map the panther-specific orthology code (P,O,LDO,X,LDX)\n to relationship-ontology\n identifiers.\n :param ortho: orthology code\n :return: RO identifier\n '
ortho_rel = OrthologyAssoc.ortho_rel
ro_id = ortho_r... | 612,825,542,876,158,200 | Map the panther-specific orthology code (P,O,LDO,X,LDX)
to relationship-ontology
identifiers.
:param ortho: orthology code
:return: RO identifier | dipper/sources/Panther.py | _map_orthology_code_to_RO | putmantime/dipper | python | @staticmethod
def _map_orthology_code_to_RO(ortho):
'\n Map the panther-specific orthology code (P,O,LDO,X,LDX)\n to relationship-ontology\n identifiers.\n :param ortho: orthology code\n :return: RO identifier\n '
ortho_rel = OrthologyAssoc.ortho_rel
ro_id = ortho_r... |
@staticmethod
def _clean_up_gene_id(geneid, sp):
'\n A series of identifier rewriting to conform with\n standard gene identifiers.\n :param geneid:\n :param sp:\n :return:\n '
geneid = re.sub('MGI:MGI:', 'MGI:', geneid)
geneid = re.sub('Ensembl', 'ENSEMBL', geneid)
... | 3,802,867,241,168,685,000 | A series of identifier rewriting to conform with
standard gene identifiers.
:param geneid:
:param sp:
:return: | dipper/sources/Panther.py | _clean_up_gene_id | putmantime/dipper | python | @staticmethod
def _clean_up_gene_id(geneid, sp):
'\n A series of identifier rewriting to conform with\n standard gene identifiers.\n :param geneid:\n :param sp:\n :return:\n '
geneid = re.sub('MGI:MGI:', 'MGI:', geneid)
geneid = re.sub('Ensembl', 'ENSEMBL', geneid)
... |
@deprecated_args(family=None)
def translate(page=None, hints=None, auto=True, removebrackets=False, site=None):
'\n Return a list of links to pages on other sites based on hints.\n\n Entries for single page titles list those pages. Page titles for entries\n such as "all:" or "xyz:" or "20:" are first built... | -3,098,732,767,313,872,000 | Return a list of links to pages on other sites based on hints.
Entries for single page titles list those pages. Page titles for entries
such as "all:" or "xyz:" or "20:" are first built from the page title of
'page' and then listed. When 'removebrackets' is True, a trailing pair of
brackets and the text between them i... | pywikibot/titletranslate.py | translate | h4ck3rm1k3/pywikibot-core | python | @deprecated_args(family=None)
def translate(page=None, hints=None, auto=True, removebrackets=False, site=None):
'\n Return a list of links to pages on other sites based on hints.\n\n Entries for single page titles list those pages. Page titles for entries\n such as "all:" or "xyz:" or "20:" are first built... |
def get_command_line(only_print_help=False):
'\n Parse command line arguments when GoogleScraper is used as a CLI application.\n\n Returns:\n The configuration as a dictionary that determines the behaviour of the app.\n '
parser = argparse.ArgumentParser(prog='GoogleScraper', description='Scrape... | 5,549,819,006,311,449,000 | Parse command line arguments when GoogleScraper is used as a CLI application.
Returns:
The configuration as a dictionary that determines the behaviour of the app. | GoogleScraper/commandline.py | get_command_line | hnhnarek/GoogleScraper | python | def get_command_line(only_print_help=False):
'\n Parse command line arguments when GoogleScraper is used as a CLI application.\n\n Returns:\n The configuration as a dictionary that determines the behaviour of the app.\n '
parser = argparse.ArgumentParser(prog='GoogleScraper', description='Scrape... |
def main(self, regex_string):
'\n regex string input\n :regex_string: regex match string\n :return:\n '
pass | -2,005,913,430,576,091,400 | regex string input
:regex_string: regex match string
:return: | rules/javascript/CVI_3003.py | main | Afant1/Kunlun-M | python | def main(self, regex_string):
'\n regex string input\n :regex_string: regex match string\n :return:\n '
pass |
@classmethod
def new_game(cls, user, attempts, deck, disp_deck, attempts_made, match_list, match_list_int, matches_found, guess1_or_guess2, guess_history):
'Create and return a new game'
if ((attempts < 30) or (attempts > 60)):
raise ValueError('Number of attempts must be more than 29 and less than 61')... | 1,032,905,783,144,670,100 | Create and return a new game | models/game.py | new_game | bencam/pelmanism | python | @classmethod
def new_game(cls, user, attempts, deck, disp_deck, attempts_made, match_list, match_list_int, matches_found, guess1_or_guess2, guess_history):
if ((attempts < 30) or (attempts > 60)):
raise ValueError('Number of attempts must be more than 29 and less than 61')
game = Game(user=user, de... |
def to_form(self, message):
'Return a GameForm representation of the game'
form = GameForm()
form.urlsafe_key = self.key.urlsafe()
form.user_name = self.user.get().name
form.attempts_remaining = self.attempts_remaining
form.game_over = self.game_over
form.cancelled = self.cancelled
form.... | -4,697,406,924,980,220,000 | Return a GameForm representation of the game | models/game.py | to_form | bencam/pelmanism | python | def to_form(self, message):
form = GameForm()
form.urlsafe_key = self.key.urlsafe()
form.user_name = self.user.get().name
form.attempts_remaining = self.attempts_remaining
form.game_over = self.game_over
form.cancelled = self.cancelled
form.disp_deck = self.disp_deck
form.attempts_m... |
def to_form_user_games(self):
'Return a GameFormUserGame representation of the game;\n this form displays a custom list of the game entities and is\n used in the get_user_games endpoint'
return GameFormUserGame(urlsafe_key=self.key.urlsafe(), user_name=self.user.get().name, attempts_remaining=self... | 5,650,300,017,706,337,000 | Return a GameFormUserGame representation of the game;
this form displays a custom list of the game entities and is
used in the get_user_games endpoint | models/game.py | to_form_user_games | bencam/pelmanism | python | def to_form_user_games(self):
'Return a GameFormUserGame representation of the game;\n this form displays a custom list of the game entities and is\n used in the get_user_games endpoint'
return GameFormUserGame(urlsafe_key=self.key.urlsafe(), user_name=self.user.get().name, attempts_remaining=self... |
def to_form_game_history(self, message):
'Return a GameHistory representation of the game;\n this form displays a custom list of the game entities and is\n used in the get_game_history endpoint'
return GameHistory(user_name=self.user.get().name, guess_history=self.guess_history, attempts_made=self... | 2,492,024,020,348,699,000 | Return a GameHistory representation of the game;
this form displays a custom list of the game entities and is
used in the get_game_history endpoint | models/game.py | to_form_game_history | bencam/pelmanism | python | def to_form_game_history(self, message):
'Return a GameHistory representation of the game;\n this form displays a custom list of the game entities and is\n used in the get_game_history endpoint'
return GameHistory(user_name=self.user.get().name, guess_history=self.guess_history, attempts_made=self... |
def end_game(self, won=False):
'End the game; if won is True, the player won;\n if won is False, the player lost'
self.game_over = True
self.put()
points = self.points = (500 - ((self.attempts_made - self.matches_found) * 10))
score = Score(user=self.user, time_completed=str(datetime.now()), ... | -163,030,221,212,685,150 | End the game; if won is True, the player won;
if won is False, the player lost | models/game.py | end_game | bencam/pelmanism | python | def end_game(self, won=False):
'End the game; if won is True, the player won;\n if won is False, the player lost'
self.game_over = True
self.put()
points = self.points = (500 - ((self.attempts_made - self.matches_found) * 10))
score = Score(user=self.user, time_completed=str(datetime.now()), ... |
def test_open_with_plus(self):
'Opening with r+ is not allowed.'
with scratch_file('example.gz') as path:
with open(path, 'w+') as fout:
pass
with self.assertRaises(ValueError):
with gzippy.open(path, 'r+') as fin:
pass | 1,762,328,780,264,199,700 | Opening with r+ is not allowed. | test/test_gzippy.py | test_open_with_plus | seomoz/gzippy | python | def test_open_with_plus(self):
with scratch_file('example.gz') as path:
with open(path, 'w+') as fout:
pass
with self.assertRaises(ValueError):
with gzippy.open(path, 'r+') as fin:
pass |
def test_open_with_append(self):
'Opening in append mode is not allowed.'
with scratch_file('example.gz') as path:
with open(path, 'w+') as fout:
pass
with self.assertRaises(ValueError):
with gzippy.open(path, 'ab') as fout:
pass | 2,778,444,649,322,058,000 | Opening in append mode is not allowed. | test/test_gzippy.py | test_open_with_append | seomoz/gzippy | python | def test_open_with_append(self):
with scratch_file('example.gz') as path:
with open(path, 'w+') as fout:
pass
with self.assertRaises(ValueError):
with gzippy.open(path, 'ab') as fout:
pass |
@classmethod
def init_and_run(cls, *args, **kwargs):
'Instantiate and run `self.main()` using `curses.wrapper`.\n\n Parameters\n ----------\n *args : tuple\n Positional arguments to be passed to the CursesInterface constructor.\n **kwargs : dict, optional\n Keyword ... | 210,966,248,905,593,100 | Instantiate and run `self.main()` using `curses.wrapper`.
Parameters
----------
*args : tuple
Positional arguments to be passed to the CursesInterface constructor.
**kwargs : dict, optional
Keyword arguments to be passed to the CursesInterface constructor.
Returns
-------
CursesInterface object
An instanc... | src/wordle_cheater/interface.py | init_and_run | edsq/wordle-cheater | python | @classmethod
def init_and_run(cls, *args, **kwargs):
'Instantiate and run `self.main()` using `curses.wrapper`.\n\n Parameters\n ----------\n *args : tuple\n Positional arguments to be passed to the CursesInterface constructor.\n **kwargs : dict, optional\n Keyword ... |
def main(self, stdscr):
'Run the interface.\n\n Should typically be called using `curses.wrapper`.\n\n Parameters\n ----------\n stdscr : curses.Window object\n The curses screen which the user interacts with.\n '
self.stdscr = stdscr
curses.use_default_colors()... | -9,170,470,526,508,910,000 | Run the interface.
Should typically be called using `curses.wrapper`.
Parameters
----------
stdscr : curses.Window object
The curses screen which the user interacts with. | src/wordle_cheater/interface.py | main | edsq/wordle-cheater | python | def main(self, stdscr):
'Run the interface.\n\n Should typically be called using `curses.wrapper`.\n\n Parameters\n ----------\n stdscr : curses.Window object\n The curses screen which the user interacts with.\n '
self.stdscr = stdscr
curses.use_default_colors()... |
def center_print(self, y, string, *args, **kwargs):
'Print in the center of the screen.\n\n Parameters\n ----------\n y : int\n The vertical location at which to print.\n string : str\n The string to print.\n *args : tuple\n Additional arguments to... | -5,137,827,943,173,549,000 | Print in the center of the screen.
Parameters
----------
y : int
The vertical location at which to print.
string : str
The string to print.
*args : tuple
Additional arguments to be passed to `stdscr.addstr`.
**kwargs : dict, optional
Keyword arguments to be passed to `stdscr.addstr`. | src/wordle_cheater/interface.py | center_print | edsq/wordle-cheater | python | def center_print(self, y, string, *args, **kwargs):
'Print in the center of the screen.\n\n Parameters\n ----------\n y : int\n The vertical location at which to print.\n string : str\n The string to print.\n *args : tuple\n Additional arguments to... |
def print_title(self):
'Print title and instructions.'
self.center_print(1, 'Wordle Cheater :(', curses.A_BOLD)
self.center_print(2, 'Enter guesses below.')
self.center_print(3, 'spacebar: change color', curses.A_DIM) | -4,790,512,370,770,830,000 | Print title and instructions. | src/wordle_cheater/interface.py | print_title | edsq/wordle-cheater | python | def print_title(self):
self.center_print(1, 'Wordle Cheater :(', curses.A_BOLD)
self.center_print(2, 'Enter guesses below.')
self.center_print(3, 'spacebar: change color', curses.A_DIM) |
def print_results(self, sep=' '):
'Print possible solutions given guesses.\n\n Parameters\n ----------\n sep : str, optional\n The string to display between each possible solution.\n '
(height, width) = self.results_window.getmaxyx()
max_rows = (height - 1)
col... | 5,907,706,909,988,606,000 | Print possible solutions given guesses.
Parameters
----------
sep : str, optional
The string to display between each possible solution. | src/wordle_cheater/interface.py | print_results | edsq/wordle-cheater | python | def print_results(self, sep=' '):
'Print possible solutions given guesses.\n\n Parameters\n ----------\n sep : str, optional\n The string to display between each possible solution.\n '
(height, width) = self.results_window.getmaxyx()
max_rows = (height - 1)
col... |
def print(self, x, y, string, c=None):
"Print `string` at coordinates `x`, `y`.\n\n Parameters\n ----------\n x : int\n Horizontal position at which to print the string.\n y : int\n Height at which to print the string.\n string : str\n The string t... | -7,147,534,154,132,215,000 | Print `string` at coordinates `x`, `y`.
Parameters
----------
x : int
Horizontal position at which to print the string.
y : int
Height at which to print the string.
string : str
The string to print.
c : str, {None, 'black', 'yellow', 'green', 'red'}
The color in which to print. Must be one of
['bl... | src/wordle_cheater/interface.py | print | edsq/wordle-cheater | python | def print(self, x, y, string, c=None):
"Print `string` at coordinates `x`, `y`.\n\n Parameters\n ----------\n x : int\n Horizontal position at which to print the string.\n y : int\n Height at which to print the string.\n string : str\n The string t... |
def sleep(self, ms):
'Temporarily suspend execution.\n\n Parameters\n ----------\n ms : int\n Number of miliseconds before execution resumes.\n '
curses.napms(ms)
self.stdscr.refresh() | -479,470,963,160,505,860 | Temporarily suspend execution.
Parameters
----------
ms : int
Number of miliseconds before execution resumes. | src/wordle_cheater/interface.py | sleep | edsq/wordle-cheater | python | def sleep(self, ms):
'Temporarily suspend execution.\n\n Parameters\n ----------\n ms : int\n Number of miliseconds before execution resumes.\n '
curses.napms(ms)
self.stdscr.refresh() |
def move_cursor(self, x, y):
'Move cursor to position `x`, `y`.\n\n Parameters\n ----------\n x : int\n Desired horizontal position of cursor.\n y : int\n Desired vertical position of cursor.\n '
self.stdscr.move(y, x) | -8,032,974,080,929,446,000 | Move cursor to position `x`, `y`.
Parameters
----------
x : int
Desired horizontal position of cursor.
y : int
Desired vertical position of cursor. | src/wordle_cheater/interface.py | move_cursor | edsq/wordle-cheater | python | def move_cursor(self, x, y):
'Move cursor to position `x`, `y`.\n\n Parameters\n ----------\n x : int\n Desired horizontal position of cursor.\n y : int\n Desired vertical position of cursor.\n '
self.stdscr.move(y, x) |
def set_cursor_visibility(self, visible):
'Set cursor visibility.\n\n Parameters\n ----------\n visible : bool\n Whether or not the cursor is visible.\n '
curses.curs_set(visible) | -411,079,154,944,363,970 | Set cursor visibility.
Parameters
----------
visible : bool
Whether or not the cursor is visible. | src/wordle_cheater/interface.py | set_cursor_visibility | edsq/wordle-cheater | python | def set_cursor_visibility(self, visible):
'Set cursor visibility.\n\n Parameters\n ----------\n visible : bool\n Whether or not the cursor is visible.\n '
curses.curs_set(visible) |
def get_key(self):
'Get a key press.\n\n Returns\n -------\n key : str\n The key that was pressed.\n '
return self.stdscr.getkey() | -7,643,117,547,012,769,000 | Get a key press.
Returns
-------
key : str
The key that was pressed. | src/wordle_cheater/interface.py | get_key | edsq/wordle-cheater | python | def get_key(self):
'Get a key press.\n\n Returns\n -------\n key : str\n The key that was pressed.\n '
return self.stdscr.getkey() |
def is_enter(self, key):
'Check if `key` is the enter/return key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_enter : bool\n True if `key` is the enter or return key, False otherwise.\n '
if ((key =... | -7,837,240,422,818,573,000 | Check if `key` is the enter/return key.
Parameters
----------
key : str
The key to check.
Returns
-------
is_enter : bool
True if `key` is the enter or return key, False otherwise. | src/wordle_cheater/interface.py | is_enter | edsq/wordle-cheater | python | def is_enter(self, key):
'Check if `key` is the enter/return key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_enter : bool\n True if `key` is the enter or return key, False otherwise.\n '
if ((key =... |
def is_backspace(self, key):
'Check if `key` is the backspace/delete key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_backspace : bool\n True if `key` is the backspace or delete key, False otherwise.\n ... | -1,635,305,886,461,331,500 | Check if `key` is the backspace/delete key.
Parameters
----------
key : str
The key to check.
Returns
-------
is_backspace : bool
True if `key` is the backspace or delete key, False otherwise. | src/wordle_cheater/interface.py | is_backspace | edsq/wordle-cheater | python | def is_backspace(self, key):
'Check if `key` is the backspace/delete key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_backspace : bool\n True if `key` is the backspace or delete key, False otherwise.\n ... |
@property
def curs_xy(self):
'Location of cursor.'
return self._curs_xy | -8,168,196,711,324,319,000 | Location of cursor. | src/wordle_cheater/interface.py | curs_xy | edsq/wordle-cheater | python | @property
def curs_xy(self):
return self._curs_xy |
@curs_xy.setter
def curs_xy(self, xy):
'Update max line lengths when we update cursor position.'
(x, y) = xy
if (y > (len(self.line_lengths) - 1)):
self.line_lengths += [0 for i in range(((y - len(self.line_lengths)) + 1))]
if (x > self.line_lengths[y]):
self.line_lengths[y] = x
self... | 1,690,258,665,582,618,400 | Update max line lengths when we update cursor position. | src/wordle_cheater/interface.py | curs_xy | edsq/wordle-cheater | python | @curs_xy.setter
def curs_xy(self, xy):
(x, y) = xy
if (y > (len(self.line_lengths) - 1)):
self.line_lengths += [0 for i in range(((y - len(self.line_lengths)) + 1))]
if (x > self.line_lengths[y]):
self.line_lengths[y] = x
self._curs_xy = xy |
def main(self):
'Run the interface.'
try:
self.print_title()
self.enter_letters(x0=self.x0, y0=self.y0)
self.print_results()
finally:
self.set_cursor_visibility(True) | -3,395,075,301,970,717,000 | Run the interface. | src/wordle_cheater/interface.py | main | edsq/wordle-cheater | python | def main(self):
try:
self.print_title()
self.enter_letters(x0=self.x0, y0=self.y0)
self.print_results()
finally:
self.set_cursor_visibility(True) |
def print_title(self):
'Print title and instructions.'
self.print(0, 0, 'Wordle Cheater :(', bold=True)
self.print(0, 1, 'Enter guesses below.')
self.print(0, 2, 'spacebar: change color', dim=True) | 4,562,588,889,675,491,000 | Print title and instructions. | src/wordle_cheater/interface.py | print_title | edsq/wordle-cheater | python | def print_title(self):
self.print(0, 0, 'Wordle Cheater :(', bold=True)
self.print(0, 1, 'Enter guesses below.')
self.print(0, 2, 'spacebar: change color', dim=True) |
def print_results(self):
'Print possible solutions given guesses.'
if self.entering_letters:
return
out_str = self.get_results_string(max_rows=self.max_rows, max_cols=self.max_cols, sep=' ')
self.move_cursor(0, (self.curs_xy[1] + 1))
click.secho('Possible solutions:', underline=True)
... | -5,675,137,717,710,156,000 | Print possible solutions given guesses. | src/wordle_cheater/interface.py | print_results | edsq/wordle-cheater | python | def print_results(self):
if self.entering_letters:
return
out_str = self.get_results_string(max_rows=self.max_rows, max_cols=self.max_cols, sep=' ')
self.move_cursor(0, (self.curs_xy[1] + 1))
click.secho('Possible solutions:', underline=True)
click.echo(out_str) |
def print(self, x, y, string, c=None, *args, **kwargs):
"Print `string` at coordinates `x`, `y`.\n\n Parameters\n ----------\n x : int\n Horizontal position at which to print the string.\n y : int\n Height at which to print the string.\n string : str\n ... | 733,578,645,901,021,300 | Print `string` at coordinates `x`, `y`.
Parameters
----------
x : int
Horizontal position at which to print the string.
y : int
Height at which to print the string.
string : str
The string to print.
c : str, {None, 'black', 'yellow', 'green', 'red'}
The color in which to print. Must be one of
['bl... | src/wordle_cheater/interface.py | print | edsq/wordle-cheater | python | def print(self, x, y, string, c=None, *args, **kwargs):
"Print `string` at coordinates `x`, `y`.\n\n Parameters\n ----------\n x : int\n Horizontal position at which to print the string.\n y : int\n Height at which to print the string.\n string : str\n ... |
def sleep(self, ms):
'Temporarily suspend execution.\n\n Parameters\n ----------\n ms : int\n Number of miliseconds before execution resumes.\n '
time.sleep((ms / 1000)) | 3,032,397,926,492,459,000 | Temporarily suspend execution.
Parameters
----------
ms : int
Number of miliseconds before execution resumes. | src/wordle_cheater/interface.py | sleep | edsq/wordle-cheater | python | def sleep(self, ms):
'Temporarily suspend execution.\n\n Parameters\n ----------\n ms : int\n Number of miliseconds before execution resumes.\n '
time.sleep((ms / 1000)) |
def move_cursor(self, x, y):
'Move cursor to position `x`, `y`.\n\n Parameters\n ----------\n x : int\n Desired horizontal position of cursor.\n y : int\n Desired vertical position of cursor.\n '
if (self.curs_xy[1] > y):
click.echo(f'{self.esc}[{... | 1,471,144,024,528,282,600 | Move cursor to position `x`, `y`.
Parameters
----------
x : int
Desired horizontal position of cursor.
y : int
Desired vertical position of cursor. | src/wordle_cheater/interface.py | move_cursor | edsq/wordle-cheater | python | def move_cursor(self, x, y):
'Move cursor to position `x`, `y`.\n\n Parameters\n ----------\n x : int\n Desired horizontal position of cursor.\n y : int\n Desired vertical position of cursor.\n '
if (self.curs_xy[1] > y):
click.echo(f'{self.esc}[{... |
def set_cursor_visibility(self, visible):
'Set cursor visibility.\n\n Parameters\n ----------\n visible : bool\n Whether or not the cursor is visible.\n '
if visible:
click.echo(f'{self.esc}[?25h', nl=False)
else:
click.echo(f'{self.esc}[?25l', nl=False... | 396,357,219,551,274,560 | Set cursor visibility.
Parameters
----------
visible : bool
Whether or not the cursor is visible. | src/wordle_cheater/interface.py | set_cursor_visibility | edsq/wordle-cheater | python | def set_cursor_visibility(self, visible):
'Set cursor visibility.\n\n Parameters\n ----------\n visible : bool\n Whether or not the cursor is visible.\n '
if visible:
click.echo(f'{self.esc}[?25h', nl=False)
else:
click.echo(f'{self.esc}[?25l', nl=False... |
def get_key(self):
'Get a key press.\n\n Returns\n -------\n key : str\n The key that was pressed.\n '
return click.getchar() | -1,230,420,192,345,417,700 | Get a key press.
Returns
-------
key : str
The key that was pressed. | src/wordle_cheater/interface.py | get_key | edsq/wordle-cheater | python | def get_key(self):
'Get a key press.\n\n Returns\n -------\n key : str\n The key that was pressed.\n '
return click.getchar() |
def is_enter(self, key):
'Check if `key` is the enter/return key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_enter : bool\n True if `key` is the enter or return key, False otherwise.\n '
if ((key =... | 1,334,841,429,322,325,000 | Check if `key` is the enter/return key.
Parameters
----------
key : str
The key to check.
Returns
-------
is_enter : bool
True if `key` is the enter or return key, False otherwise. | src/wordle_cheater/interface.py | is_enter | edsq/wordle-cheater | python | def is_enter(self, key):
'Check if `key` is the enter/return key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_enter : bool\n True if `key` is the enter or return key, False otherwise.\n '
if ((key =... |
def is_backspace(self, key):
'Check if `key` is the backspace/delete key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_backspace : bool\n True if `key` is the backspace or delete key, False otherwise.\n ... | -1,771,721,439,019,337,500 | Check if `key` is the backspace/delete key.
Parameters
----------
key : str
The key to check.
Returns
-------
is_backspace : bool
True if `key` is the backspace or delete key, False otherwise. | src/wordle_cheater/interface.py | is_backspace | edsq/wordle-cheater | python | def is_backspace(self, key):
'Check if `key` is the backspace/delete key.\n\n Parameters\n ----------\n key : str\n The key to check.\n\n Returns\n -------\n is_backspace : bool\n True if `key` is the backspace or delete key, False otherwise.\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.