query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Searches the images.ndjson file and counts the number of dates found per decade. | def main(input_filename, json_output):
num_parsed = 0
num_total = 0
by_decade = defaultdict(int)
for row in generators.read_ndjson_file(input_filename):
ds = row.get('date')
if not ds:
continue
num_total += 1
d = get_parsed_date(row)
if not d:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_counts(datestruct):\n response = call_responder('elasticsearch', 'query/daily_proofreader_hits')\n for rec in response['result']['hits']['hits']:\n data = rec['_source']\n if data['user'] not in datestruct:\n datestruct[data['user']] = {\"cleave\": 0, \"merge\": 0,\n ... | [
"0.6191097",
"0.6127995",
"0.602175",
"0.57718587",
"0.5609626",
"0.5559178",
"0.55234337",
"0.54777694",
"0.546455",
"0.54527897",
"0.54497105",
"0.53750855",
"0.5370652",
"0.53426784",
"0.53200203",
"0.5316032",
"0.5295907",
"0.52799475",
"0.52579844",
"0.52557826",
"0.5247... | 0.6609439 | 0 |
Run the CommutativeCancellation pass on a dag | def run(self, dag):
q_gate_list = ['cx', 'cy', 'cz', 'h', 'x', 'y', 'z']
# Gate sets to be cancelled
cancellation_sets = defaultdict(lambda: [])
for wire in dag.wires:
wire_name = "{0}[{1}]".format(str(wire.register.name), str(wire.index))
wire_commutation_set ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, dag):\n\n # If the option commutative_analysis is set, construct DAGDependency from the given DAGCircuit.\n if self.do_commutative_analysis:\n dag = dag_to_dagdependency(dag)\n\n # call collect_function to collect blocks from DAG\n blocks = self.collect_function... | [
"0.6119412",
"0.5714813",
"0.54337865",
"0.5399336",
"0.5372339",
"0.5356294",
"0.532089",
"0.5288728",
"0.5269343",
"0.5261692",
"0.5250306",
"0.52219206",
"0.51915073",
"0.51788664",
"0.5174982",
"0.51746696",
"0.5166423",
"0.5163573",
"0.5149194",
"0.51294947",
"0.5109441"... | 0.76111484 | 0 |
Helper to render index page with custom_proc | def render_index(request, *args, **kwargs):
# add context_instance keyword
kwargs.update(
{'context_instance': RequestContext(request, processors=[custom_proc])})
return render(request, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_fn():\n page_title = \"Index\"\n \n if request.method == \"GET\":\n return render_template(\"index.html\",\n pg_title=page_title,\n )",
"def index(self):\n\t\treturn render_template('index.html')",
"def index():\n return... | [
"0.71589965",
"0.69598264",
"0.6947079",
"0.6940647",
"0.6934658",
"0.6934658",
"0.6934658",
"0.6873126",
"0.68489075",
"0.68354297",
"0.68185735",
"0.68185735",
"0.67878515",
"0.6760982",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.67558396",
"0.... | 0.82352185 | 0 |
Test that each paraemter defined in an environment file is also defined in the paired heat template | def test_env_params_are_defined_in_template(yaml_file):
bad = []
template_pair = get_environment_pair(yaml_file)
if not template_pair:
pytest.skip("No yaml/env pair could be determined")
template = template_pair.get("yyml").get("parameters", {})
environment = template_pair.get("eyml").get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_setup_multiple_parameters_system():\n with mmtools.utils.temporary_directory() as tmp_dir:\n yaml_script = get_template_script(tmp_dir)\n\n # Force antechamber parametrization of benzene to output frcmod file\n exp_builder = ExperimentBuilder(yaml_script)\n exp_builder._db._... | [
"0.58821565",
"0.58680266",
"0.56163776",
"0.55792236",
"0.5568075",
"0.552711",
"0.5509854",
"0.54249567",
"0.53922117",
"0.5349689",
"0.53313106",
"0.532554",
"0.5321047",
"0.5313373",
"0.5290485",
"0.52886117",
"0.5285383",
"0.528437",
"0.5277534",
"0.5275471",
"0.5242284"... | 0.7014509 | 0 |
Set the configuration for a provider by calling get_provider() with the given configuraiton. | def set_provider_defaults(provider: str, config: Dict[str, Any]) -> None:
class SetProviderDefaults:
@st.hookimpl
def get_provider_config(self, name, params, registry):
if name != provider:
return None
conf = config.copy()
conf.update(params)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provider(self, provider):\n\n self._provider = provider",
"def provider(self, provider: Provider) -> None:\n self._provider = provider",
"def set_provider(self, provider):\n \n check = self.check_provider(provider)\n if check is not None:\n self.default_provide... | [
"0.7138926",
"0.6993208",
"0.678772",
"0.64115953",
"0.63953626",
"0.6311917",
"0.6282703",
"0.6255965",
"0.6160486",
"0.61591345",
"0.612793",
"0.59540063",
"0.58079547",
"0.57860327",
"0.57618",
"0.57555056",
"0.5730834",
"0.5698895",
"0.56884116",
"0.56884116",
"0.5657185"... | 0.7107458 | 1 |
Test create method We create a dictionary of values We create a user from these values, he has a user profile We check that that the new user has been created with his name | def test_create(self):
userValue = {'name': 'User Test 1',
'login': 'usertest1',
'user_profile_id': self.user_profile2.id,
}
Users = self.env['res.users']
user_test = Users.create(userValue)
newUser = self.env['res.users'].br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_user(self):\n \n new_user = {\"username\": \"beny1976\", \"vocab_count\": 0, \"name\": \"beny rood\", \"sex\": \"male\", \"dob\": \"18/10/1979\"}\n msg = app.create_user(predefined_user=new_user)\n self.assertTrue(msg != \"\")",
"def test_createUser_single(self):\n ... | [
"0.78253496",
"0.765791",
"0.76069736",
"0.7524077",
"0.7516569",
"0.7485291",
"0.74447876",
"0.7440378",
"0.7425919",
"0.7425513",
"0.74086386",
"0.73996085",
"0.7388538",
"0.7337399",
"0.7334261",
"0.7334261",
"0.7334261",
"0.7330658",
"0.72654027",
"0.7246871",
"0.72445744... | 0.83480036 | 0 |
Test write method We use the user created in the first method We change his user_profile_id We check if the update has been done | def test_write(self):
userEdited = self.env['res.users'].browse(
self.user.id).write({'user_profile_id': self.user_profile2.id})
self.assertEqual(userEdited, True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_profile_attribute(self):\n user = self.users[0]\n user.profile.bio = 'bio'\n user.profile.save()\n query = User.objects.first()\n self.assertTrue(query.profile.bio == 'bio')",
"def test_update_user(self):\n pass",
"def test_can_update_user_profile(self)... | [
"0.73722833",
"0.7240795",
"0.723858",
"0.7233905",
"0.7230748",
"0.713083",
"0.70846134",
"0.7058695",
"0.70558417",
"0.7032471",
"0.699041",
"0.6960625",
"0.6956722",
"0.69488096",
"0.6937412",
"0.6928816",
"0.6922781",
"0.69169754",
"0.6872866",
"0.68542856",
"0.6845763",
... | 0.8568167 | 0 |
Test _check_user_profile_id method We try to create a user with admin as user profile It raises a Validation Error | def test_check_user_profile_id(self):
userValue = {'name': 'User Test 1',
'login': 'usertest1',
'user_profile_id': self.env.ref('base.user_root').id,
}
with self.assertRaises(ValidationError):
self.env['res.users'].create(userVal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_onchange_user_profile(self):\n admin = self.env.ref('base.user_root').id\n with self.assertRaises(ValidationError):\n self.env['res.users'].browse(\n self.user.id).write({'user_profile_id': admin})",
"def test_create_profile_on_access(self):\n user = User.o... | [
"0.7712734",
"0.7201624",
"0.7119838",
"0.69911945",
"0.6966534",
"0.6954981",
"0.69544595",
"0.69232625",
"0.68903434",
"0.68688196",
"0.6784438",
"0.67346376",
"0.6706729",
"0.67004544",
"0.67004544",
"0.67004544",
"0.6691957",
"0.66688347",
"0.6655687",
"0.6626389",
"0.662... | 0.8522871 | 0 |
Test onchange user profile method We try to set the profile of an existing user to admin It raises a Validation Error | def test_onchange_user_profile(self):
admin = self.env.ref('base.user_root').id
with self.assertRaises(ValidationError):
self.env['res.users'].browse(
self.user.id).write({'user_profile_id': admin}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_profile_changes_user(self):\n user = self.users[0]\n user.username = 'newname'\n profile = user.profile\n user.profile.save()\n self.assertEquals(user.username, profile.user.username)",
"def test_change_username_changes_profile(self):\n user = self.users[... | [
"0.7477738",
"0.7256297",
"0.7110831",
"0.69922745",
"0.6937833",
"0.6931283",
"0.6902336",
"0.69003004",
"0.68779624",
"0.6848639",
"0.6826865",
"0.67532784",
"0.67202806",
"0.6707016",
"0.66928405",
"0.6688107",
"0.6653077",
"0.6639785",
"0.66318655",
"0.6623886",
"0.661915... | 0.88653076 | 0 |
Force to use assigned new ld.so by changing the binary | def change_ld(binary, ld):
if not os.access(ld, os.R_OK):
log.failure("Invalid path {} to ld".format(ld))
return None
if not isinstance(binary, ELF):
if not os.access(binary, os.R_OK):
log.failure("Invalid path {} to binary".format(binary))
return No... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_executable(fname):\n default_encoding = sys.getdefaultencoding()\n try:\n ostype = subprocess.check_output(\n ['uname', '-s']).strip().decode(default_encoding)\n except subprocess.CalledProcessError:\n return\n except OSError as reason:\n ... | [
"0.6080508",
"0.59798527",
"0.5882375",
"0.5829561",
"0.5821797",
"0.58100384",
"0.57235426",
"0.5645031",
"0.5568604",
"0.54718274",
"0.53370386",
"0.52522343",
"0.5210637",
"0.5204081",
"0.52006644",
"0.51943845",
"0.5176367",
"0.5163168",
"0.5103557",
"0.50893724",
"0.5061... | 0.66148263 | 0 |
Reloads settings and stops the sensor daemon if necessary | def reload_settings():
global settings, cancel_thread
# cancel the thread if the settings say so
if cancel_thread is None:
if settings.get('disabled') is False:
cancel_thread = start_thread()
else:
if settings.get('disabled') is True:
light_scheme_set = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self) -> None:\n self.data = {}\n self.load_settings_file(self.default_settings_path / \"settings.yaml\", file_key=\"internal\")\n self.load_systems(self.default_settings_path / \"systems\")\n self.load_settings_file(self.personal_dir / \"settings.yaml\", file_key=\"user\")\... | [
"0.6269248",
"0.6228141",
"0.6084714",
"0.6025635",
"0.59918356",
"0.5985085",
"0.59474224",
"0.5947158",
"0.5941444",
"0.59340006",
"0.59218776",
"0.5914287",
"0.58856106",
"0.5847929",
"0.5837395",
"0.5835373",
"0.5829937",
"0.5820057",
"0.5804429",
"0.58007795",
"0.5788595... | 0.7108176 | 0 |
Repeatedly calls a function with a set interval and returns a thread cancel handle | def call_repeatedly(interval, function, args):
stopped = threading.Event()
def loop():
while not stopped.wait(interval):
function(**args)
threading.Thread(target=loop).start()
# return the thread closing handle
return stopped.set | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_interval(self, func, sec):\n\n def func_wrapper():\n self.__set_interval(func, sec)\n func()\n\n t = threading.Timer(sec, func_wrapper)\n t.start()\n return t",
"def interval(cls, timeout, f, immediate = False, **kwargs):\n def _interval(*args, *... | [
"0.67053866",
"0.66891724",
"0.64283514",
"0.6361471",
"0.63328284",
"0.6324299",
"0.6230495",
"0.611252",
"0.598195",
"0.5951146",
"0.59462386",
"0.5921696",
"0.59215885",
"0.5894177",
"0.5880573",
"0.58379",
"0.5750367",
"0.57432234",
"0.56841433",
"0.5684028",
"0.56767637"... | 0.7836953 | 0 |
Reads the light sensor data and changes user's color scheme if the reading is above a threshold | def read_sensor_data():
global light_scheme_set, current_timeout
# prevents very rapid changes of the color scheme
if current_timeout is not 0:
current_timeout -= 1
return
else:
# call the shared library's sensor code
reading = dll.readSensor()
scheme = None
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n # color = rb.Color.BLUE.value\n # move_to_color(color)\n infared_sensor()\n\n # WHITE/RED does not work same with the BLUE/GREEN going down",
"def check_light(light: pykulersky.Light):\n light.connect()\n light.get_color()",
"def update(self):\n try:\n if not s... | [
"0.63356465",
"0.6309102",
"0.6276284",
"0.6237545",
"0.60673153",
"0.606334",
"0.59688765",
"0.5941587",
"0.59411585",
"0.5939015",
"0.59064615",
"0.589552",
"0.58872604",
"0.583961",
"0.5819576",
"0.58051085",
"0.5769483",
"0.5767761",
"0.5735046",
"0.5708469",
"0.5697487",... | 0.7226849 | 0 |
Add a version to a template version manager. | def insert(template_version_manager, template, request):
# save the template in database
template_api.upsert(template)
try:
# insert the initial template in the version manager
version_manager_api.insert_version(
template_version_manager, template, request=request
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, bento_name, bento_version):",
"def add_version(self, id, name, files):\n v = Version(self.backend, self.path, id, name, files)\n v.save()\n\n # Do not put duplicated version IDs into the index.\n for v in self.versions:\n if v['id'] == id:\n ret... | [
"0.6088367",
"0.58284575",
"0.56480026",
"0.5622442",
"0.5511425",
"0.5502313",
"0.5485509",
"0.5462675",
"0.5435368",
"0.5433973",
"0.542946",
"0.5405268",
"0.5205288",
"0.51675516",
"0.5159601",
"0.5157442",
"0.5153125",
"0.5153125",
"0.51464003",
"0.51427025",
"0.51373017"... | 0.6161083 | 0 |
Test that mineral list with no pk will redirect | def test_mineral_list_redirect(self):
resp = self.client.get(reverse('minerals:list'))
self.assertEqual(resp.status_code, 302) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_show_shoplists_without_login_redirects(self):\n tester = app.test_client(self)\n response = tester.post('/show_shoplists', follow_redirects=True)\n self.assertEqual(response.status_code, 200)",
"def test_show_activities_without_login_redirects(self):\n User.users = {}\n ... | [
"0.6804747",
"0.6639353",
"0.648068",
"0.6388541",
"0.63525784",
"0.6332835",
"0.630934",
"0.6214183",
"0.617335",
"0.61362755",
"0.6120044",
"0.60898554",
"0.6088404",
"0.6053614",
"0.6034676",
"0.6034676",
"0.6034676",
"0.6029755",
"0.6013406",
"0.60053384",
"0.60053384",
... | 0.7354163 | 0 |
Train the network for ``max_steps`` steps. After each training epoch, validation performance is measured and visualizations are computed and logged to tensorboard. | def train(self, max_steps: int = 1, max_runtime=3600 * 24 * 7) -> None:
self.start_time = datetime.datetime.now()
self.end_time = self.start_time + datetime.timedelta(seconds=max_runtime)
while not self.terminate:
try:
# --> self.train()
self.model.tra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def train(self, max_steps=100_000, instances=1, visualize=False, plot=None, max_subprocesses=0):\n self.agent.training = True\n if max_subprocesses == 0:\n # Use single process implementation\n self._sp_train(max_steps, instances, visualize, plot)\n elif max_subprocesses ... | [
"0.6947871",
"0.685724",
"0.6677812",
"0.6537507",
"0.6392748",
"0.638029",
"0.6369513",
"0.6317855",
"0.6273792",
"0.6248912",
"0.6072411",
"0.607182",
"0.60491323",
"0.6042872",
"0.59877187",
"0.59860224",
"0.59725696",
"0.5950437",
"0.5927182",
"0.5913687",
"0.5912271",
... | 0.75708795 | 0 |
Save/serialize trained model state to files. If the model uses a parallel wrapper like ``torch.nn.DataParallel``, this is automatically detected and the wrapped model is saved directly to make later deserialization easier. This can be disabled by setting ``unwrap_parallel=False``. | def save_model(self, suffix: str = '', unwrap_parallel: bool = True) -> None:
# TODO: Logging
model = self.model
# We do this awkard check because there are too many different
# parallel wrappers in PyTorch and some of them have changed names
# in different releases (DataParallel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_model(self):\n\n # =============================================================\n # Default : pickle the trained model. Change this (and the load\n # function, below) only if the library you used does not support\n # pickling.\n # self.Model_made.save(\"Model_made.h5\")... | [
"0.7230332",
"0.7162599",
"0.7139393",
"0.70704466",
"0.7013741",
"0.6979095",
"0.6976652",
"0.69272524",
"0.69247466",
"0.69072735",
"0.6906031",
"0.6898889",
"0.6883414",
"0.68668175",
"0.6859346",
"0.6856698",
"0.68370855",
"0.6805313",
"0.68041414",
"0.6796176",
"0.675706... | 0.8036562 | 0 |
Defines ``batch2img`` function dynamically, depending on tensor shapes. ``batch2img`` slices a 4D or 5D tensor to (C, H, W) shape, moves it to host memory and converts it to a numpy array. By arbitrary choice, the first element of a batch is always taken here. In the 5D case, the D (depth) dimension is sliced at z_plan... | def _get_batch2img_function(
batch: torch.Tensor,
z_plane: Optional[int] = None
) -> Callable[[torch.Tensor], np.ndarray]:
if batch.dim() == 5: # (N, C, D, H, W)
if z_plane is None:
z_plane = batch.shape[2] // 2
assert z_plane in range(batch.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_batch():\n return np.zeros((2, 1, 4, 4))",
"def get_batches_fn(batch_size):\n image_paths = glob(os.path.join(data_folder, 'image_2', '*.png'))\n label_paths = {\n re.sub(r'_(lane|road)_', '_', os.path.basename(path)): path\n for path in glob(os.path.join(data_fol... | [
"0.5889001",
"0.5834307",
"0.5763898",
"0.5548405",
"0.54911685",
"0.5404486",
"0.5354863",
"0.53391266",
"0.52845913",
"0.52194244",
"0.50857246",
"0.5081543",
"0.50766444",
"0.50407875",
"0.50406784",
"0.5035221",
"0.5017781",
"0.5017628",
"0.50161916",
"0.50143474",
"0.501... | 0.7126705 | 0 |
Archiving the source folder, the training script and environment info. The training script is saved with the prefix '0' to distinguish from regular scripts. | def archive_backup(self):
# Archiving the Training script
shutil.copyfile(self.script_path, self.save_path + '/0-' + os.path.basename(self.script_path))
os.chmod(self.save_path + '/0-' + os.path.basename(self.script_path), 0o755)
# Archiving the src folder
pkg_path = os.path.dir... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_gen(self):\r\n current_path = os.path.join(self.settings.save_path, 'current.json')\r\n current_folder_path = os.path.join(self.settings.save_path, 'current')\r\n history_path = os.path.join(self.settings.save_path, 'history')\r\n archive_folder_path = os.path.join(history_p... | [
"0.55677986",
"0.5472406",
"0.53718376",
"0.53715956",
"0.5341127",
"0.53302145",
"0.5305708",
"0.52769345",
"0.52551335",
"0.5242333",
"0.523944",
"0.52085453",
"0.5205941",
"0.51825994",
"0.51786375",
"0.5160358",
"0.5140444",
"0.5090497",
"0.50718933",
"0.50677264",
"0.506... | 0.78881186 | 0 |
Returns [opcode, immediate1, 2, 3]. | def decode_opcode(self, packed_opcode):
packed_opcode = str(packed_opcode)
while(len(packed_opcode) != 5):
packed_opcode = '0' + packed_opcode
return [int(packed_opcode[3:]), packed_opcode[2] == '1', packed_opcode[1] == '1', packed_opcode[0] == '1'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_ops(opcodes):\n output = []\n for op in opcodes:\n if op in [\"+\", \"*\"]:\n b = output.pop(-1)\n a = output.pop(-1)\n value = ops[op](a, b)\n output.append(value)\n else:\n output.append(op)\n\n assert len(output) == 1\n re... | [
"0.6129944",
"0.57926476",
"0.5783177",
"0.56775135",
"0.56415033",
"0.56394535",
"0.5629857",
"0.5604485",
"0.54920286",
"0.54577243",
"0.5452047",
"0.5442101",
"0.5421196",
"0.53791213",
"0.53581613",
"0.53458023",
"0.5313317",
"0.5296601",
"0.52932817",
"0.5269778",
"0.526... | 0.5846213 | 1 |
Steps the machine 1 instruction, returning True if halted. | def step(self):
start_pc = self.pc
decoded_opcode = self.decode_opcode(self.eat_pc(True))
print('Step from PC=%d (%s)' % (start_pc, decoded_opcode))
opcode = decoded_opcode[0]
if 1 == opcode or 2 == opcode:
self.add_multiply_instruction(decoded_opcode)
elif 3 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def step(self) -> bool:\n raise NotImplementedError()",
"def step(self):\n # parse opcode and parameter mode(s) from instruction\n # (convert integer into 5-digit string with zeroes before parsing)\n instruction = str(self.program[self.index]).zfill(5)\n opcode = int(instructio... | [
"0.6205759",
"0.6091664",
"0.5830088",
"0.5799696",
"0.5696338",
"0.56625956",
"0.5456521",
"0.5393628",
"0.53446066",
"0.5337814",
"0.5318763",
"0.52655756",
"0.5245858",
"0.5241452",
"0.5228499",
"0.5224713",
"0.5211338",
"0.52051055",
"0.5181581",
"0.5164398",
"0.51551384"... | 0.6639182 | 0 |
Calculates the kriging weights for all of the points in the grid | def _buildWeights(self):
# Compute the spatial tree
kd = spatial.cKDTree(self.XYin)
# Perform query on all of the points in the grid
dist,self.ind=kd.query(self.XYout,distance_upper_bound=self.maxdist,k=self.NNear)
self.Nc = np.size(self.ind,axis=0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weights(self):",
"def grid_weights(self):\n return angular_average_nd(\n field=np.ones((len(self.uvgrid),) * 2),\n coords=[self.uvgrid, self.uvgrid],\n bins=self.u_edges, n=self.ps_dim, bin_ave=False,\n average=False)[0]",
"def __weights(self):\n ... | [
"0.6455532",
"0.63486326",
"0.6317665",
"0.6211078",
"0.6192685",
"0.61866015",
"0.6092461",
"0.6031609",
"0.6025631",
"0.60012954",
"0.59838605",
"0.59765804",
"0.59765804",
"0.59717125",
"0.59193355",
"0.59113336",
"0.58744186",
"0.58514315",
"0.5846845",
"0.5845702",
"0.58... | 0.68984425 | 0 |
Calculates the variance of the spectrum. | def spectral_variance(data, fft_data):
return np.var(np.abs(fft_data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def variance(self):\n return 1 / self.count() * sum((number-self.average())**2 for number in self.numbers)",
"def variance(self):\r\n\t\t_mean = sum(self.sample)/len(self.sample)\r\n\t\treturn sum(map(lambda x: (x - _mean)**2, self.sample))/(len(self.sample) - 1)",
"def variance(self):\n sum_sqdi... | [
"0.77939093",
"0.7585608",
"0.74999875",
"0.74020314",
"0.74020314",
"0.73374844",
"0.73331225",
"0.7285661",
"0.72689235",
"0.7261629",
"0.70953506",
"0.70953506",
"0.70953506",
"0.709008",
"0.7080148",
"0.7017273",
"0.7012545",
"0.70008934",
"0.699682",
"0.6989067",
"0.6962... | 0.78063816 | 0 |
Calculate the skewness of the spectrum. | def spectral_skewness(data, fft_data):
return scipy.stats.skew(np.abs(fft_data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def skewness(self):\n self._finalize()\n return self.vskewness",
"def spectral_skewness(sign, fs):\n f, ff = plotfft(sign, fs)\n spect_centr = spectral_centroid(sign, fs)\n if not spectral_spread(sign, fs):\n return 0\n else:\n skew = ((f - spect_centr) ** 3) * (ff / np.su... | [
"0.79790175",
"0.7622297",
"0.75499445",
"0.74275786",
"0.7356237",
"0.69568706",
"0.66155034",
"0.66151226",
"0.6565566",
"0.65512294",
"0.6200791",
"0.60718316",
"0.5972047",
"0.5872354",
"0.5837397",
"0.58353823",
"0.5832275",
"0.5814251",
"0.5724178",
"0.57171047",
"0.569... | 0.79276204 | 1 |
Calculates a measure for the flatness of the spectrum. | def spectral_flatness(data, fft_data):
spec = np.abs(fft_data)
spec_mean = np.mean(spec)
spec_gmean = scipy.stats.gmean(spec)
if spec_mean == 0:
return 1
return spec_gmean/spec_mean | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spectral_spread(sign, fs):\n f, ff = plotfft(sign, fs)\n spect_centr = spectral_centroid(sign, fs)\n if not np.sum(ff):\n return 0\n else:\n return np.dot(((f-spect_centr)**2), (ff / np.sum(ff)))",
"def spectral_slope(sign, fs):\n f, ff = plotfft(sign, fs)\n if not(list(f)):\n... | [
"0.62050503",
"0.60166943",
"0.56262547",
"0.5620439",
"0.5616198",
"0.56150395",
"0.560767",
"0.55894583",
"0.55654633",
"0.5527765",
"0.5519964",
"0.54929906",
"0.54644346",
"0.5439519",
"0.5435739",
"0.54256",
"0.54226637",
"0.54216653",
"0.5389448",
"0.5377065",
"0.534392... | 0.7009917 | 0 |
Install a package. This runs the preinstscript, extracts the data, creates a package content file, sets the rights on extracted files, runs the postinst and removes temporary files created during the installation. Setting `suppressPackageContentFileGeneration` to `True` will suppress the creation of the package content... | def install(self, clientDataDir, suppressPackageContentFileGeneration=False):
self.setClientDataDir(clientDataDir)
self.getMetaData()
self.runPreinst()
self.extractData()
if not suppressPackageContentFileGeneration:
self.createPackageContentFile()
self.setAccessRights()
self.runPostinst()
self.cleanu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_package(package):\n\tn_ucr = extFile(package, 'univention-config-registry')\n\tif not os.path.exists(n_ucr):\n\t\treturn\n\n\tf_ucr = open(n_ucr, 'r')\n\n\tfor item in univention.config_registry.parseRfc822(f_ucr.read()):\n\t\ttyp = item['Type'][0]\n\t\tif typ == 'file':\n\t\t\tf = item['File'][0]\n\t\t\tdo... | [
"0.6358",
"0.62577534",
"0.59546536",
"0.5833951",
"0.5801984",
"0.577501",
"0.57598114",
"0.57473296",
"0.5639463",
"0.55367744",
"0.551623",
"0.549924",
"0.5447735",
"0.54421085",
"0.5431225",
"0.5414615",
"0.5406775",
"0.53997153",
"0.5391413",
"0.5389228",
"0.5366957",
... | 0.7179274 | 0 |
displays a language selector dropdown in the admin, based on Django "LANGUAGES" context. | def language_selector(context):
output = ""
from django.conf import settings
i18 = getattr(settings, 'USE_I18N', False)
if i18:
template = "admin/language_selector.html"
context['i18n_is_set'] = True
try:
output = render_to_string(template, context)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_context(self, request, *args, **kwargs):\n context = super().get_context(request, *args, **kwargs)\n context['lang_versions'] = self.get_translations()\n context['default_lang'] = (settings.LANGUAGES[0][0])\n return context",
"def book_language_list(request):\n languages = ... | [
"0.59492594",
"0.59370124",
"0.5830997",
"0.57654065",
"0.5667339",
"0.5663755",
"0.563679",
"0.5610488",
"0.5570556",
"0.5564695",
"0.5541525",
"0.5510436",
"0.5505482",
"0.54878914",
"0.5480784",
"0.54672724",
"0.5453488",
"0.5449253",
"0.54212254",
"0.54074854",
"0.5400048... | 0.7890218 | 0 |
Objectconstructor for the funnels. Inside init, you could pass all needed variables that will be passed to the Funnel init as well. | def __init__(
self,
start_end_points: Tuple[tuple, tuple],
funnel: Funnel,
count: int,
bins: Union[int, float],
annot: bool = False,
*args,
**kwargs,
):
self.left_top_point = ShapePoint(start_end_points[0])
self.right_top_point = Shape... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args):\n _snap.TCrossNetAFltI_swiginit(self, _snap.new_TCrossNetAFltI(*args))",
"def __init__(self, opts):\n super(FunctionComponent, self).__init__(opts)\n self.options = opts.get(\"fn_cisco_umbrella_inv\", {})\n validate_opts(self)\n self.proxies = get_pro... | [
"0.6120769",
"0.6116087",
"0.60753834",
"0.5962141",
"0.5957412",
"0.59420455",
"0.5935756",
"0.5935756",
"0.59045035",
"0.5900847",
"0.5899501",
"0.5888573",
"0.5870248",
"0.5869776",
"0.58573395",
"0.5797897",
"0.5775388",
"0.57736355",
"0.57629496",
"0.574592",
"0.57338184... | 0.67489994 | 0 |
Method for moving dots into funnels. Calls the same method drag_in_dots for every funnel in self.funnels. | def drag_in_dots(self, scene: Scene, dots: VGroup, animate_slow: int, animate_rest: bool):
if any(not isinstance(x, MovableFunnel) for x in self.funnels):
raise FunnelsExeption('method "drag_in_dots" allowed only for "MovableFunnel"')
# We are sorting dots ascending to be able to play animat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connectTheDots():\n Nodes.connectTheDots()\n TimedNodes.connectTheDots()\n\n return",
"def update_interpolated_and_dots(function_selector, discretization_Slider,\n interpolated_values):\n # Each base point (left or right foot and middle node) is shared by three\n # Finite Elements aside fro... | [
"0.54222375",
"0.527418",
"0.5002062",
"0.49782464",
"0.48366687",
"0.47597006",
"0.47035027",
"0.4701566",
"0.46510434",
"0.4605041",
"0.4603975",
"0.45744327",
"0.4565291",
"0.45511046",
"0.4542252",
"0.45417517",
"0.45346773",
"0.45223463",
"0.44967106",
"0.44768924",
"0.4... | 0.7737243 | 0 |
Test creating and cancelling an invoice | def test_invoice(self):
invoice = self._create_invoice()
self.assertEquals(invoice.total_amount, Decimal('2.38'))
self.assertEquals(invoice.is_paid, False)
# then cancel the created invoice
cancelled_invoice = cancel_invoice(invoice)
self.assertEquals(cancelled_invoice.t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_invoice_delete(self):\n # first we create a customer\n id = self._create_model(\"customer\", self.customer_data, [\"name\", \"email\", \"phone\"])\n if id:\n # then we can create the invoice\n data = self.invoice_data\n data[\"customer_id\"] = id\n ... | [
"0.75387025",
"0.7113662",
"0.7041869",
"0.6957861",
"0.68343097",
"0.6746061",
"0.67317563",
"0.6628058",
"0.6626321",
"0.65469885",
"0.643424",
"0.6363992",
"0.63521475",
"0.63066596",
"0.62726057",
"0.62344754",
"0.6169239",
"0.61677945",
"0.61546206",
"0.61513394",
"0.614... | 0.83051145 | 0 |
Test that the invoice_confirmed signal gets emitted correctly | def test_confirmed_signal(self):
# it is a dict so that it can be modified inside the function
counter = {'n_emits': 0}
def on_invoice_confirmed(*args, **kwargs):
counter['n_emits'] += 1
invoice_confirmed.connect(on_invoice_confirmed)
invoice = self._create_invoice(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_confirmed(self):\n appt_date = datetime.date.today()\n reminders.Patient.objects.filter(\n pk__in=[self.test_patient.pk, self.other_patient.pk]\n ).update(next_visit=appt_date)\n confirmed = self.create_confirmed_notification(self.test_patient, appt_date)\n ... | [
"0.71098185",
"0.7048236",
"0.67829335",
"0.67025834",
"0.6654247",
"0.6595958",
"0.6595958",
"0.654072",
"0.6531124",
"0.6526328",
"0.64574295",
"0.6427712",
"0.6408454",
"0.6397459",
"0.6392092",
"0.6362075",
"0.63616884",
"0.6288885",
"0.6262651",
"0.60832816",
"0.6037275"... | 0.88064384 | 0 |
Gets the active_member_count of this Context17. | def active_member_count(self):
return self._active_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getNumActive(self):\n return self._get_active( )",
"def bounced_member_count(self):\n return self._bounced_member_count",
"def member_count(self):\n return len(self.members)",
"def member_count(self) -> int:\n return sum([g.member_count for g in self.guilds])",
"def active_m... | [
"0.6896081",
"0.640346",
"0.61951387",
"0.61759603",
"0.61616695",
"0.60395855",
"0.6013379",
"0.6006747",
"0.6006747",
"0.59408104",
"0.5931322",
"0.58700466",
"0.5865242",
"0.5846405",
"0.58382374",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671",
"0.5832671... | 0.8488191 | 0 |
Sets the active_member_count of this Context17. | def active_member_count(self, active_member_count):
self._active_member_count = active_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_member_count(self):\n return self._active_member_count",
"def bounced_member_count(self, bounced_member_count):\n\n self._bounced_member_count = bounced_member_count",
"def set_activeLedCount(self, newval):\n rest_val = str(newval)\n return self._setAttr(\"activeLedCount\... | [
"0.64063823",
"0.5860484",
"0.58239967",
"0.5772565",
"0.57543284",
"0.57226",
"0.5673672",
"0.56626874",
"0.56626874",
"0.56626874",
"0.56626874",
"0.56626874",
"0.5575489",
"0.55588037",
"0.55588037",
"0.5521708",
"0.5521708",
"0.5521708",
"0.5521708",
"0.54948616",
"0.5442... | 0.83144844 | 0 |
Gets the bounced_member_count of this Context17. | def bounced_member_count(self):
return self._bounced_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_member_count(self):\n return self._active_member_count",
"def member_count(self) -> int:\n return sum([g.member_count for g in self.guilds])",
"def get_count(self):\n return self._count",
"def get_count(self):\n return self.count",
"def get_count(self):\n retur... | [
"0.7381187",
"0.63977176",
"0.63508046",
"0.63348234",
"0.63348234",
"0.630128",
"0.62972474",
"0.6285729",
"0.6238138",
"0.6193707",
"0.61564",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
"0.6126884",
... | 0.8398334 | 0 |
Sets the bounced_member_count of this Context17. | def bounced_member_count(self, bounced_member_count):
self._bounced_member_count = bounced_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_member_count(self, active_member_count):\n\n self._active_member_count = active_member_count",
"def bounced_member_count(self):\n return self._bounced_member_count",
"def bid_count(self, bid_count):\n\n self._bid_count = bid_count",
"def set_count(self, count):\n self._... | [
"0.71493083",
"0.7031893",
"0.5979804",
"0.59014523",
"0.58768964",
"0.58768964",
"0.58521104",
"0.58517843",
"0.5821436",
"0.5615978",
"0.5615978",
"0.5615978",
"0.5615978",
"0.55973405",
"0.55521816",
"0.554865",
"0.554214",
"0.55111253",
"0.5494533",
"0.5494533",
"0.545971... | 0.86100817 | 0 |
Gets the created_by of this Context17. | def created_by(self):
return self._created_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_by(self) -> str:\n return pulumi.get(self, \"created_by\")",
"def created_by(self):\n url = self._data.get('related', {}).get('created_by')\n return self._tower._get_object_by_url('User', url) # pylint: disable=protected-access",
"def created_by(self) -> Optional[str]:\n ... | [
"0.7789317",
"0.7770012",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.757339",
"0.756759",
"0.7545281",
"0.7522512",
"0.7440229",
"0.7440229",
"0.7440229",
"0.7440229",
"0.7343571",
"0.73141575",
"0.72036463",
"0.7189899",
"0.71786857",
"0.6838154",
"0.66... | 0.81725967 | 0 |
Gets the custom_fields_definition of this Context17. | def custom_fields_definition(self):
return self._custom_fields_definition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_fields(self):\n return custom_fields.CustomFields(self)",
"def custom_fields(self):\r\n return custom_fields.CustomFields(self)",
"def custom_fields_definition(self, custom_fields_definition):\n\n self._custom_fields_definition = custom_fields_definition",
"def field(self) -> ... | [
"0.6732822",
"0.6684957",
"0.5955038",
"0.5517716",
"0.5398259",
"0.5376668",
"0.52525747",
"0.5214191",
"0.51776576",
"0.5158833",
"0.512581",
"0.512581",
"0.51108223",
"0.5084462",
"0.5083847",
"0.5002417",
"0.49952582",
"0.49952582",
"0.49414942",
"0.49301967",
"0.4929908"... | 0.83008784 | 0 |
Sets the custom_fields_definition of this Context17. | def custom_fields_definition(self, custom_fields_definition):
self._custom_fields_definition = custom_fields_definition | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_fields_definition(self):\n return self._custom_fields_definition",
"def custom_fields(self, custom_fields):\n\n self._custom_fields = custom_fields",
"def custom_fields(self, custom_fields):\n\n self._custom_fields = custom_fields",
"def custom_fields(self, custom_fields):\n\n... | [
"0.6642042",
"0.64079607",
"0.64079607",
"0.64079607",
"0.64079607",
"0.64079607",
"0.5507524",
"0.5432757",
"0.5380791",
"0.5177665",
"0.5114241",
"0.50425124",
"0.49577433",
"0.4888433",
"0.4846477",
"0.4803468",
"0.47680637",
"0.47590303",
"0.47508407",
"0.47330523",
"0.46... | 0.83766735 | 0 |
Gets the import_operation of this Context17. | def import_operation(self):
return self._import_operation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self):\n return getattr(self, 'import_{type}'.format(type=self.type))()",
"def get_import_mode(self):\n\t\treturn self.buttonImport.get_active()",
"def import_operation(self, import_operation):\n\n self._import_operation = import_operation",
"def get_import_resource_class(self):\n ... | [
"0.65936714",
"0.6466993",
"0.6325107",
"0.6175758",
"0.5936432",
"0.59285593",
"0.586923",
"0.586923",
"0.5814522",
"0.58043265",
"0.5719262",
"0.5651123",
"0.56482184",
"0.5646165",
"0.5480833",
"0.54793406",
"0.5474109",
"0.5467355",
"0.5420354",
"0.5364674",
"0.53598595",... | 0.8589078 | 0 |
Sets the import_operation of this Context17. | def import_operation(self, import_operation):
self._import_operation = import_operation | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_operation(self):\n return self._import_operation",
"def _import(self, _import):\n\n self.__import = _import",
"def import_ops(self):\n if self.is_training:\n self.lr = tf.get_collection_ref(\"lr\")[0]\n self.new_lr = tf.get_collection_ref(\"new_lr\")[0]\n se... | [
"0.7231188",
"0.6295214",
"0.5836815",
"0.5603795",
"0.5519087",
"0.54600257",
"0.54505676",
"0.5446742",
"0.5352566",
"0.52968585",
"0.5293666",
"0.5288608",
"0.5218256",
"0.52099025",
"0.5184431",
"0.5161995",
"0.5137286",
"0.51354766",
"0.51354766",
"0.51264375",
"0.512354... | 0.84010893 | 0 |
Gets the removed_member_count of this Context17. | def removed_member_count(self):
return self._removed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed_member_count(self):\n return self._unsubscribed_member_count",
"def get_total_words_removed(self):\n return self.total_words_removed",
"def removed_member_count(self, removed_member_count):\n\n self._removed_member_count = removed_member_count",
"def question_count_remov... | [
"0.7013696",
"0.6821845",
"0.6383696",
"0.63803935",
"0.5906242",
"0.5767794",
"0.57416683",
"0.5624927",
"0.55618656",
"0.5561286",
"0.5558821",
"0.55301356",
"0.55023795",
"0.55023795",
"0.5490844",
"0.5486998",
"0.5480672",
"0.54591745",
"0.53917253",
"0.53878504",
"0.5376... | 0.8549048 | 0 |
Sets the removed_member_count of this Context17. | def removed_member_count(self, removed_member_count):
self._removed_member_count = removed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removed_member_count(self):\n return self._removed_member_count",
"def unsubscribed_member_count(self, unsubscribed_member_count):\n\n self._unsubscribed_member_count = unsubscribed_member_count",
"def remove_member(self, member_to_remove):\r\n if (isinstance(member_to_remove, int) or\... | [
"0.697273",
"0.645651",
"0.6037037",
"0.5606054",
"0.55690414",
"0.5482646",
"0.5481552",
"0.5262689",
"0.5258966",
"0.52158",
"0.5182624",
"0.5136192",
"0.503112",
"0.5009139",
"0.49902728",
"0.49869564",
"0.49549592",
"0.491669",
"0.4914983",
"0.48692864",
"0.4866584",
"0... | 0.81735766 | 0 |
Gets the unsubscribed_member_count of this Context17. | def unsubscribed_member_count(self):
return self._unsubscribed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed_member_count(self, unsubscribed_member_count):\n\n self._unsubscribed_member_count = unsubscribed_member_count",
"def removed_member_count(self):\n return self._removed_member_count",
"def get_subscribed_users(self, obj):\n return obj.subscribed_users.count()",
"def acti... | [
"0.71419156",
"0.70558476",
"0.5919587",
"0.5731225",
"0.5730982",
"0.5687569",
"0.5586158",
"0.55647856",
"0.55323863",
"0.5452427",
"0.54399496",
"0.5360487",
"0.53492814",
"0.534088",
"0.5291912",
"0.5260404",
"0.52590173",
"0.52475226",
"0.5246356",
"0.5244646",
"0.524391... | 0.8775167 | 0 |
Sets the unsubscribed_member_count of this Context17. | def unsubscribed_member_count(self, unsubscribed_member_count):
self._unsubscribed_member_count = unsubscribed_member_count | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsubscribed_member_count(self):\n return self._unsubscribed_member_count",
"def removed_member_count(self, removed_member_count):\n\n self._removed_member_count = removed_member_count",
"def _unsubscribe(self):\n self.unsubscribe_date = now()\n self.unsubscribed = True\n ... | [
"0.7436961",
"0.6079733",
"0.57903993",
"0.54903007",
"0.53204024",
"0.52699184",
"0.5116732",
"0.5002936",
"0.49549854",
"0.49549854",
"0.49265596",
"0.4916866",
"0.49056363",
"0.48885486",
"0.4874461",
"0.47977608",
"0.47616208",
"0.4734782",
"0.4723715",
"0.47060105",
"0.4... | 0.8702396 | 0 |
Gets the updated_by of this Context17. | def updated_by(self):
return self._updated_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self) -> Optional[pulumi.Input['UserInfoArgs']]:\n return pulumi.get(self, \"updated_by\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"str\":\n return self._attrs.get(\"updatedBy\")",
"def updated_by(self) -> \"s... | [
"0.77070093",
"0.7586538",
"0.7586538",
"0.7586538",
"0.73329616",
"0.72001487",
"0.70631254",
"0.70631254",
"0.68099815",
"0.671652",
"0.6666177",
"0.6666177",
"0.6666177",
"0.65548086",
"0.65548086",
"0.65548086",
"0.6360967",
"0.63594735",
"0.6252926",
"0.6174813",
"0.6147... | 0.8346993 | 0 |
Sets the updated_by of this Context17. | def updated_by(self, updated_by):
self._updated_by = updated_by | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self, updated_by: \"str\"):\n self._attrs[\"updatedBy\"] = updated_by",
"def updated_by(self):\n ... | [
"0.76505786",
"0.76505786",
"0.76505786",
"0.68549126",
"0.6627744",
"0.64946896",
"0.64946896",
"0.64946896",
"0.64742637",
"0.61784595",
"0.6080924",
"0.6007099",
"0.6007099",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908962",
"0.5908... | 0.786663 | 0 |
Gets the updated_on of this Context17. | def updated_on(self):
return self._updated_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_on(self):\n return self.get_time(\"updated_on\")",
"def updated_at(self):\n return self._updated_at",
"def updated_at(self):\n return self._updated_at",
"def updated_at(self):\n return self._updated_at",
"def time_updated(self):\n return self._time_updated",
... | [
"0.8008507",
"0.72253245",
"0.72253245",
"0.72253245",
"0.707493",
"0.7051411",
"0.69915617",
"0.6950934",
"0.69193465",
"0.6866043",
"0.6785926",
"0.6766942",
"0.6766942",
"0.6668178",
"0.661875",
"0.65489584",
"0.65392816",
"0.6523629",
"0.6523629",
"0.6523629",
"0.6480343"... | 0.8125521 | 0 |
Sets the updated_on of this Context17. | def updated_on(self, updated_on):
self._updated_on = updated_on | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_on(self):\n return self._updated_on",
"def updated(self, updated: datetime):\n\n self._updated = updated",
"def updated_at(self, updated_at):\n\n self._updated_at = updated_at",
"def updated_at(self, updated_at):\n\n self._updated_at = updated_at",
"def updated_at(se... | [
"0.65927917",
"0.65492976",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6331311",
"0.6330777",
"0.6285204",
"0.6285204",
"0.6285204",
"0.6285204",
"0.61929846",
"0.609771",
"0.609771",
"0.6042161",
... | 0.7826675 | 0 |
Build an interpolator for a restricted range of x values | def build_restrict_interp(power, lower, upper):
index = np.searchsorted(power[:,0], [lower,upper])
(imin, imax) = (np.max([0,index[0]-5]), np.min([len(power[:,0])-1,index[-1]+5]))
newint = interp.interp1d(np.log(power[imin:imax:,0]), np.log(power[imin:imax,1]), kind='cubic')
return newint | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_interpolator(x: np.array, y: np.array):\n return intp.PchipInterpolator(x, y)",
"def interpolate_number(x, xp, yp, clamp=True):\n x = np.asarray(x)\n \n # Specific case for empty domain\n if xp[0] == xp[-1] or len(xp)<2:\n if len(x.shape) == 0:\n return yp[0]\n els... | [
"0.6273798",
"0.60789615",
"0.6039472",
"0.5930019",
"0.59064054",
"0.5874849",
"0.57292944",
"0.57271487",
"0.57102585",
"0.56955993",
"0.56856304",
"0.56849724",
"0.56517243",
"0.5645956",
"0.561356",
"0.56114006",
"0.5609342",
"0.56068665",
"0.5606565",
"0.557454",
"0.5573... | 0.61375684 | 1 |
Test that multiplying the power spectrum by some knots gives an accurate answer. | def check_change_power_spectrum(test_knotpos, test_knotval, matpow):
#Get the modified power spectrum
kval = matpow[:,0]
newpk = lyasimulation.change_power_spectrum_knots(test_knotpos, test_knotval, matpow)
#Check the kvalues are still the same for comparison to the transfer function
assert np.all([... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_change_power_spectrum():\n #The 2010 paper had the knots at:\n #k = 0.475 0.75 1.19, 1.89\n #(knotpos, knotval)\n tests = [(np.array([0.475, 0.75, 1.19, 1.89]), np.array([0.475, 0.75, 1.19, 1.89])),\n (np.array([0.475, 0.75, 1.19, 1.89]), np.array([1.2, 1., 1., 1.])),\n ... | [
"0.69962776",
"0.6277038",
"0.6117738",
"0.6112239",
"0.60500044",
"0.60259444",
"0.6025436",
"0.60241675",
"0.602194",
"0.5997189",
"0.59961194",
"0.59884477",
"0.5953086",
"0.5942114",
"0.58822083",
"0.5864141",
"0.58592874",
"0.5849431",
"0.58364874",
"0.581356",
"0.580589... | 0.71301085 | 0 |
Perform the power spectrum check for a number of different knot values and positions | def test_change_power_spectrum():
#The 2010 paper had the knots at:
#k = 0.475 0.75 1.19, 1.89
#(knotpos, knotval)
tests = [(np.array([0.475, 0.75, 1.19, 1.89]), np.array([0.475, 0.75, 1.19, 1.89])),
(np.array([0.475, 0.75, 1.19, 1.89]), np.array([1.2, 1., 1., 1.])),
(np.array(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_change_power_spectrum(test_knotpos, test_knotval, matpow):\n #Get the modified power spectrum\n kval = matpow[:,0]\n newpk = lyasimulation.change_power_spectrum_knots(test_knotpos, test_knotval, matpow)\n #Check the kvalues are still the same for comparison to the transfer function\n asser... | [
"0.6544442",
"0.5945773",
"0.5757839",
"0.5726125",
"0.56503886",
"0.5619751",
"0.5599943",
"0.5566535",
"0.55061376",
"0.54927444",
"0.5486352",
"0.54780996",
"0.546993",
"0.5465748",
"0.5458723",
"0.5456594",
"0.5424176",
"0.5421518",
"0.5421518",
"0.5421518",
"0.5421144",
... | 0.63642925 | 1 |
Returns the module ID | def identifier(self):
mod_id = self.read16(regAddr=0x8000)
# print("Inserted module is", self.cfpDict[mod_id])
# print("Inserted module is", mod_id)
return mod_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id(self):\n return \"non_existing_module_required_plugin\"",
"def get_id(self):\n return \"non_existing_and_existing_module_required_plugin\"",
"def get_id_by_module(self, module_id: str) -> str:\n for labware_id, labware in self.state.labware_by_id.items():\n if (\n ... | [
"0.7149746",
"0.7103554",
"0.7022028",
"0.69918215",
"0.69384813",
"0.6864412",
"0.6813897",
"0.68095",
"0.67557555",
"0.6731446",
"0.6668896",
"0.66298217",
"0.66143405",
"0.6576944",
"0.65093726",
"0.65093726",
"0.65093726",
"0.65093726",
"0.6486482",
"0.6486482",
"0.648648... | 0.79656553 | 0 |
Convert an object to a timedelta. If the object is a timedelta, it is returned; if it is a numeric type, the value is interpreted as seconds and that is returned. | def to_timedelta(obj: "Any") -> "timedelta":
if obj is None:
raise ValueError("obj cannot be None")
if isinstance(obj, timedelta):
return obj
elif isinstance(obj, (int, float)):
return timedelta(seconds=obj)
elif isinstance(obj, Decimal):
return timedelta(seconds=float(ob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timedelta_to_duration(obj: \"timedelta\") -> \"Duration\":\n d = Duration()\n d.seconds = int(obj.total_seconds())\n d.nanos = obj.microseconds * 1000\n return d",
"def _convert_to_timedelta(time_diff):\n return timedelta(seconds=time_diff)",
"def to_timedelta(value) -> timedelta:\n\n ... | [
"0.7549371",
"0.7208493",
"0.71895224",
"0.7143933",
"0.698645",
"0.6935266",
"0.6830268",
"0.6667241",
"0.6469093",
"0.6459836",
"0.6394731",
"0.633544",
"0.6323539",
"0.63086367",
"0.6242395",
"0.62389344",
"0.6208127",
"0.61857295",
"0.6101693",
"0.60412055",
"0.60073674",... | 0.8216954 | 0 |
Returns a list of control panel types to be added for the default ortho panel layout. | def defaultLayout():
return ['OverlayDisplayToolBar',
'OrthoToolBar',
'OverlayListPanel',
'LocationPanel'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controlOrder():\n return ['OverlayListPanel',\n 'LocationPanel',\n 'OverlayInfoPanel',\n 'OverlayDisplayPanel',\n 'CanvasSettingsPanel',\n 'AtlasPanel',\n 'OverlayDisplayToolBar',\n 'OrthoToolBar',\n... | [
"0.69737065",
"0.5614064",
"0.5458695",
"0.53503585",
"0.53226584",
"0.5302421",
"0.5277533",
"0.5258034",
"0.52429163",
"0.5233788",
"0.5225711",
"0.52163637",
"0.5176194",
"0.5174716",
"0.5161187",
"0.5154759",
"0.514805",
"0.5106484",
"0.510523",
"0.5064108",
"0.50568026",... | 0.59009427 | 1 |
Returns a list of control panel names, specifying the order in which they should appear in the FSLeyes ortho panel settings menu. | def controlOrder():
return ['OverlayListPanel',
'LocationPanel',
'OverlayInfoPanel',
'OverlayDisplayPanel',
'CanvasSettingsPanel',
'AtlasPanel',
'OverlayDisplayToolBar',
'OrthoToolBar',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def control_name_list(self):\n return list(self._controls.keys())",
"def list():\n return [Dock.OMNI, Dock.LEFT, Dock.RIGHT]",
"def modes(self) -> List[str]:\n return [m.name for m in self._modes]",
"def all_control_names(self):\n return self._get_control_names(\n zope.... | [
"0.6171476",
"0.5942579",
"0.57504004",
"0.57478034",
"0.57332575",
"0.56833947",
"0.5601973",
"0.55577797",
"0.5538097",
"0.5512628",
"0.54911685",
"0.54777855",
"0.5435794",
"0.5428175",
"0.53371155",
"0.5336312",
"0.5330748",
"0.53245544",
"0.5322314",
"0.5316433",
"0.5286... | 0.7900497 | 0 |
Returns a list of tool names, specifying the order in which they should appear in the FSLeyes ortho panel settings menu. | def toolOrder():
return ['CropImageAction',
'EditTransformAction',
'SampleLineAction',
'LoadAnnotationsAction',
'SaveAnnotationsAction',
'PearsonCorrelateAction'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controlOrder():\n return ['OverlayListPanel',\n 'LocationPanel',\n 'OverlayInfoPanel',\n 'OverlayDisplayPanel',\n 'CanvasSettingsPanel',\n 'AtlasPanel',\n 'OverlayDisplayToolBar',\n 'OrthoToolBar',\n... | [
"0.676183",
"0.6499401",
"0.62972677",
"0.6249077",
"0.5970247",
"0.5940185",
"0.58990747",
"0.57945955",
"0.5769095",
"0.5735396",
"0.56998837",
"0.5694195",
"0.5657685",
"0.56296474",
"0.5604566",
"0.55864596",
"0.5580212",
"0.55689025",
"0.55604416",
"0.55479664",
"0.55206... | 0.6583391 | 1 |
Called when the interaction profile changes (see | def __profileChanged(self, inst, topic, value):
old, new = value
if new is orthoeditprofile.OrthoEditProfile:
self.__addEditMenu()
elif old is orthoeditprofile.OrthoEditProfile:
self.__removeEditMenu() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def activated(self):",
"def _1_profile(self, _1_profile):\n\n self.__1_profile = _1_profile",
"def update_profile(self, channels=None): # pragma: no cover\n pass",
"def on_activate(self):",
"def preferencesChanged(self):\n # do nothing\n pass",
"def on_activate(self) -> None:... | [
"0.58401513",
"0.5827181",
"0.5751403",
"0.5736363",
"0.5725692",
"0.5656051",
"0.5621046",
"0.55915654",
"0.5552427",
"0.55414283",
"0.5520362",
"0.54863906",
"0.54767716",
"0.5453715",
"0.5445739",
"0.5440995",
"0.542009",
"0.5380361",
"0.53492814",
"0.5335435",
"0.5328072"... | 0.67051786 | 0 |
Returns a list of methods to be added to the ``FSLeyesFrame`` Tools menu for ``OrthoPanel`` views. | def getTools(self):
return [self.toggleEditMode] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_explorer_toolbox() -> List[Tuple[str, str, str]]:\n explorer_toolbox = list(_explorer_toolbox)\n explorer_toolbox.extend(\n (func_name, title, description)\n for func_name, title, description in _bio2bel_functions\n if _function_is_registered(func_name)\n )\n return explore... | [
"0.6327928",
"0.61868453",
"0.61474377",
"0.6045081",
"0.59285265",
"0.5887422",
"0.5842914",
"0.5765655",
"0.5742084",
"0.5722469",
"0.57150394",
"0.5635104",
"0.56288284",
"0.562044",
"0.56000537",
"0.5555994",
"0.55218905",
"0.5518331",
"0.54967356",
"0.5490662",
"0.548589... | 0.6589462 | 0 |
Called whenever the panel is resized. Makes sure that the | def __onResize(self, ev):
ev.Skip()
self.__calcCanvasSizes() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resizeEvent(self, event):\n self.resized.emit()\n return super(PiWndow, self).resizeEvent(event)",
"def resizeEvent(self, event):\n self.autosize()\n super().resizeEvent(event)",
"def handleResize(self):\n pass",
"def ev_windowsizechanged(self, event: WindowResized) -> ... | [
"0.7825565",
"0.76452774",
"0.76447415",
"0.7641785",
"0.7606794",
"0.7569148",
"0.7501498",
"0.74807316",
"0.7457183",
"0.74085385",
"0.7377476",
"0.73356706",
"0.7333872",
"0.72169006",
"0.72143465",
"0.7176016",
"0.7165652",
"0.7130218",
"0.7113977",
"0.70820254",
"0.70300... | 0.76875395 | 1 |
Check if two `DomainParam` are equal by comparing all attributes defined in `get_field_names()`. | def __eq__(self, other):
if not isinstance(other, DomainParam):
raise pyrado.TypeErr(given=other, expected_type=DomainParam)
for fn in self.get_field_names():
if getattr(self, fn) != getattr(other, fn):
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return np.all([\n self.__getattribute__(name) == other.__getattribute__(name)\n for name in self._fields\n ])",
"def check_params_equal(param1, param2):\n for key, val in param1.items():\n if np.any(param1[key] != param2[key]):\n ... | [
"0.7002829",
"0.66476244",
"0.6631622",
"0.6536995",
"0.65236616",
"0.6493726",
"0.6433476",
"0.6410068",
"0.63820744",
"0.6351537",
"0.6334997",
"0.62845343",
"0.62749666",
"0.6233371",
"0.62293303",
"0.62159556",
"0.61955047",
"0.6181133",
"0.6106232",
"0.6080795",
"0.60746... | 0.7762589 | 0 |
Put a object in the datastore. An object with the same name must not exist, otherwise a AlreadyInDataStore exception is thrown | def put(self, name, obj, lifetime=ObjectLifetime.Event):
# check if object with the same name is already stored?
if name in self.store.keys():
raise AlreadyInDataStore()
# no, store it!
self.store[name] = (lifetime, obj) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put(cls, obj):\n pass",
"def put_object(self, pool_name, object_name, data):\n return self.put_object_versioned(pool_name, object_name, data)",
"def _put(self, name, document):\n raise NotImplementedError",
"def put(self, obj):\n\n if obj is None:\n return\n\n ... | [
"0.68534213",
"0.6666759",
"0.6426029",
"0.64064765",
"0.6380803",
"0.6362623",
"0.6329907",
"0.6295482",
"0.6227268",
"0.61896014",
"0.6187958",
"0.61455274",
"0.6086965",
"0.60847515",
"0.6070142",
"0.60651827",
"0.6038475",
"0.6037728",
"0.60343707",
"0.6028971",
"0.601849... | 0.75970155 | 0 |
Remove all objects from the datastore which have the lifetime specifies in the parameter | def clear(self, lifetime):
# find all entries with the specified lifetime
to_remove = [k for (k, v) in self.store.items() if v[0] == lifetime]
# remove all these entries from the list
for t in to_remove:
del self.store[t] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all():\n storage = FileStorage()\n objects = storage.all()\n objects = list(objects.values())\n\n for element in objects:\n storage.delete(element)\n objects = storage.all()",
"def _purge(self):\n for _ in self.all():\n self.delete(_)",
... | [
"0.67365104",
"0.6575106",
"0.64553666",
"0.641907",
"0.64045995",
"0.6399982",
"0.6379741",
"0.6345771",
"0.6343712",
"0.6339164",
"0.63021815",
"0.6302086",
"0.62741226",
"0.6257968",
"0.62455934",
"0.6240149",
"0.6227389",
"0.62022084",
"0.6196959",
"0.6175234",
"0.6170243... | 0.7027587 | 0 |
Returns a string with the given datetime formatted as a timestamp for the agent's history folder | def create_history_timestamp(dt=None):
if dt is None:
dt = datetime.datetime.utcnow()
return dt.strftime('%Y-%m-%dT%H-%M-%S') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stamper() :\n\treturn datetime.now().strftime(\"%Y-%m-%d-%H-%M-%S\")",
"def get_git_timestamp(path):\n return int(_run_command(path, 'git log -1 --format=%ct'))",
"def timestamp():\n return datetime.now().strftime('%H:%M:%S %m-%d')",
"def log_timestamp():\n now = time.localtime()\n times... | [
"0.62167615",
"0.6157197",
"0.6116242",
"0.60908395",
"0.60371304",
"0.6034678",
"0.598345",
"0.5981551",
"0.5960698",
"0.5942786",
"0.591269",
"0.59055346",
"0.59042066",
"0.58993036",
"0.58993036",
"0.5898477",
"0.58732146",
"0.5872645",
"0.5860633",
"0.58602196",
"0.583133... | 0.7140919 | 0 |
Parse a hue name into a float from 0 to 100. | def numerical_hue(hue):
if isinstance(hue, str):
match = hue_regex.match(hue)
if match:
return float(match[1]) + HUE_NAMES_TO_NUMBERS[match[3]]
else:
return float(hue)
return hue | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_hue(name):\n all_data = mc.get('sensor_values')\n name = _lookup(name)\n try:\n r = all_data[name][0]\n g = all_data[name][1]\n b = all_data[name][2]\n denom = max(r,g,b) - min(r,g,b)\n if r > g and r > b:\n return (g - b)/denom\n elif g > r and... | [
"0.67143726",
"0.6352335",
"0.6242957",
"0.61540055",
"0.59315515",
"0.58809745",
"0.5822786",
"0.5745986",
"0.5706333",
"0.56886595",
"0.56240076",
"0.5592977",
"0.5583482",
"0.55316204",
"0.5526717",
"0.5519031",
"0.5476976",
"0.54667604",
"0.54288155",
"0.5397848",
"0.5384... | 0.7692158 | 0 |
Makes slices from iterator and process them via a process pool.\n | def slice_and_run(single_iterator: permutations):
step = 10000000
start = 0
stop = start + step
# I use next_it bool to make sure to create one more slice with no end limit when slices are finished
next_it = False
while True:
if next_it is False:
cake_slice = islice(single_it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_pool():\n pop = iter([ 'a', 'b', 'c', 'd', 'e' ])\n pop = ops.pool(pop, size=3)\n\n assert(len(pop) == 3)\n assert(pop == [ 'a', 'b', 'c' ])",
"def chunker( it, size ):\n \n # Variables\n it = iter( it )\n \n # Selecting a bunch of jobs\n while True:\n p = tuple( ite... | [
"0.6685673",
"0.65190715",
"0.6181122",
"0.59900594",
"0.59768945",
"0.5964202",
"0.593769",
"0.5937118",
"0.59308493",
"0.59113395",
"0.5901824",
"0.5894978",
"0.5858956",
"0.58363086",
"0.5830125",
"0.58101326",
"0.5802128",
"0.5788993",
"0.5778363",
"0.5738621",
"0.5733737... | 0.6883492 | 0 |
Apply leet mutagen and then if needed apply append and prepend to leeted version of the string.\n | def leet(line_leet: str):
for old_printer, new_printer in leet_replacements:
line_leet = line_leet.replace(old_printer, new_printer)
print(line_leet)
if args.append is not None:
print(line_leet + args.append)
if args.prepend is not None:
print(args.prepend + line_leet) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmatize_fun(self):\n tokens = str(self.doc).split()\n cleaned_tokens = None\n if self.lemmatize_method == 'wordnet':\n cleaned_tokens = [self.lemmatizer.lemmatize(token) for token in tokens]\n else:\n cleaned_tokens = [self.lemmatizer.stem(token) for token in... | [
"0.5577453",
"0.5502467",
"0.54995257",
"0.5455092",
"0.5454772",
"0.5342663",
"0.53197235",
"0.5301585",
"0.5287481",
"0.52212524",
"0.52083796",
"0.52012616",
"0.51859516",
"0.51522714",
"0.5134461",
"0.5132348",
"0.5117089",
"0.51013833",
"0.5083767",
"0.5057464",
"0.50542... | 0.65273523 | 0 |
This snippet will roundup any given integer or float, to at least 10 or to the highest multiple of 10. You can pass an unsigned/positive integer as the "end" argument if you want the number to be rounded to at least a multiple of "end". Returned value will always be an integer. | def roundAlwaysUp( toRound, end = 10 ):
end = abs( int(end) )
if end == 0:
end = 10
times = toRound/end
if times >= 0:
times = times + 1
else:
times = times - 1
return ( int( times ) )*end; | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upround(x, base):\n return base * math.ceil(float(x) / base)",
"def roundUP(x):\n\treturn int(ceil(x / 10.0)) * 10",
"def roundTo(numberValue, baseValue):\n # Round a numberValue, to multiples of baseValue\n return( numberValue + (baseValue - numberValue) % baseValue ) # roundTo",
"def round_up(... | [
"0.7045952",
"0.66892636",
"0.6606251",
"0.6533036",
"0.6437218",
"0.63580716",
"0.62848383",
"0.62514913",
"0.62276536",
"0.6207034",
"0.6131016",
"0.6117208",
"0.61139303",
"0.6111873",
"0.606857",
"0.60549617",
"0.6051162",
"0.6042114",
"0.6040084",
"0.6027941",
"0.602464"... | 0.7841786 | 0 |
Return an array with the single digits of the pin. Heavily assumes the PIN is made up of 4 digits. | def get_pin_digits(pin):
digits = []
for i in range(1, 5):
digit = pin % 10
pin = int(pin / 10)
digits = [digit] + digits
return digits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pin(length=6):\n pin = str(random.sample(range(10 ** (length - 1), 10 ** length), 1)[0])\n print(\"pin \"+pin)\n\n return pin",
"def __generate_pin(cls) -> str:\n return str(randbelow(10 ** cls.PIN_DIGITS)).zfill(cls.PIN_DIGITS)",
"def getNativeDigitsList(self):\r\n return self.p... | [
"0.65546817",
"0.59906715",
"0.5840187",
"0.5697412",
"0.5486693",
"0.5443754",
"0.54010296",
"0.53635895",
"0.5285393",
"0.5280933",
"0.52720773",
"0.523553",
"0.52265537",
"0.5088144",
"0.5034664",
"0.5028315",
"0.5027332",
"0.49999142",
"0.49928743",
"0.49638876",
"0.49599... | 0.784853 | 0 |
Method to filter Polygons by user and order from newer to older | def get_queryset(self):
return ProviderPolygon.objects.filter(
user=self.kwargs['pk']).order_by('-id') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return ProviderPolygon.objects.filter(user=self.kwargs['pk_user'])",
"def distance_user_point_to_polygons(user_point, polygon_list):\n list_polygons_distances = []\n\n for polygon in polygon_list:\n dist = user_point.distance(polygon)\n list_polygons_distances... | [
"0.6151991",
"0.56732446",
"0.54792386",
"0.5420772",
"0.53110796",
"0.5207796",
"0.51546836",
"0.5097908",
"0.50740474",
"0.4913443",
"0.4897196",
"0.4888024",
"0.4886229",
"0.4841173",
"0.4825977",
"0.4820225",
"0.47709885",
"0.47376594",
"0.4711727",
"0.4710147",
"0.469522... | 0.60019916 | 1 |
Method to filter Polygon by user | def get_queryset(self):
return ProviderPolygon.objects.filter(user=self.kwargs['pk_user']) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return ProviderPolygon.objects.filter(\n user=self.kwargs['pk']).order_by('-id')",
"def get_shape_filter(shapefile):\n with fiona.open(shapefile) as collection:\n shp = collection[0]['geometry']\n project = partial(\n pyproj.transform,\n ... | [
"0.6240812",
"0.6093261",
"0.561257",
"0.5468393",
"0.54671586",
"0.54410464",
"0.5379727",
"0.5269086",
"0.52619064",
"0.5252823",
"0.5219768",
"0.5207153",
"0.5165389",
"0.5165207",
"0.5137693",
"0.5133303",
"0.51292515",
"0.51259184",
"0.51160175",
"0.51157916",
"0.5115787... | 0.6862393 | 0 |
Labels positions Returns xticks, xticklabels | def get_xticks_labels(self):
xticks = np.arange(-1, self.space_between_glyphs * len(self.positions))
xticklabels = [' ']
for p in self.positions:
xticklabels.append(str(p))
xticklabels += [' '] * self.space_between_glyphs
return xticks, xticklabels | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xticks_labels(self):\n xticks = np.arange(-1, self.space_between_glyphs * len(self.coevolving_positions) * 3)\n xticklabels = [' ']\n for p1, p2 in self.coevolving_positions:\n xticklabels += [str(p1), ' ', str(p2)] + [' '] * self.space_between_glyphs\n return xticks,... | [
"0.79856944",
"0.6753631",
"0.6689842",
"0.66790074",
"0.64383024",
"0.6406252",
"0.63756293",
"0.6367111",
"0.63649714",
"0.63599926",
"0.634465",
"0.6342175",
"0.63284785",
"0.6284176",
"0.6272564",
"0.6271432",
"0.6250377",
"0.618463",
"0.61352825",
"0.6110104",
"0.6098895... | 0.8132816 | 0 |
Labels positions Returns xticks, xticklabels | def get_xticks_labels(self):
xticks = np.arange(-1, self.space_between_glyphs * len(self.coevolving_positions) * 3)
xticklabels = [' ']
for p1, p2 in self.coevolving_positions:
xticklabels += [str(p1), ' ', str(p2)] + [' '] * self.space_between_glyphs
return xticks, xticklabe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xticks_labels(self):\n xticks = np.arange(-1, self.space_between_glyphs * len(self.positions))\n xticklabels = [' ']\n for p in self.positions:\n xticklabels.append(str(p))\n xticklabels += [' '] * self.space_between_glyphs\n return xticks, xticklabels",
... | [
"0.8132898",
"0.67532235",
"0.6690399",
"0.6679199",
"0.64378524",
"0.64060897",
"0.6375115",
"0.63673866",
"0.6364803",
"0.63602555",
"0.63443977",
"0.63418126",
"0.6328635",
"0.6284126",
"0.6273749",
"0.6271968",
"0.6250492",
"0.61854696",
"0.6135588",
"0.6110145",
"0.60985... | 0.79857206 | 1 |
Recovers existing persistent job store. | def recover(sched, job_state_file):
logger.debug("jobs before shelve recovery: %d" % len(sched.get_jobs()))
logger.debug("jobs: " + str(sched.get_jobs()))
job_store = ShelveJobStore(job_state_file)
sched.add_jobstore(job_store, _FHANDLE)
logger.debug("jobs after shelve recovery: %d" % len(sched.get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh(self): # noqa\n data = self.connection.hgetall(self.key)\n if not data:\n raise NoSuchJobError('No such job: {0}'.format(self.key))\n self.restore(data)",
"def restore(self, checkpoint):\n raise NotImplementedError",
"def recover(self):\n if self.get_info_... | [
"0.60679954",
"0.572598",
"0.5668713",
"0.56018865",
"0.5573478",
"0.5523758",
"0.550701",
"0.5487265",
"0.5445101",
"0.5402197",
"0.53382146",
"0.530911",
"0.5260216",
"0.52394015",
"0.5200684",
"0.51693606",
"0.51428294",
"0.5140267",
"0.51309043",
"0.5100432",
"0.50839096"... | 0.6704211 | 0 |
Links to output file(s) FITS %(fits_file)s %(xml_link)s | def files(self):
if os.path.exists(self.xml_file):
self.xml_link='<li>XML <a href="../../%(xml_file)s?download=true">%(xml_file)s</a></li>'.format(self.xml_file)
else:
self.xml_link=''
# <a href="../../%(xml)s?download=true">%(xml)s</a></li>
#self.xml = glob.glob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _open_output_files(self):\n self.links_outfile = open(self.opts.links_outfile, 'wb')",
"def write_fits(self, name=None, output_path=None):\n pass",
"def save_as_fits(self, filename):",
"def main(quiet=False):\n if quiet:\n output_stream = StringIO()\n else:\n output_stre... | [
"0.6116024",
"0.53646415",
"0.53519595",
"0.52838266",
"0.5276019",
"0.5173674",
"0.5160593",
"0.515688",
"0.5144383",
"0.51263654",
"0.51257384",
"0.50988704",
"0.5097096",
"0.50741714",
"0.50694925",
"0.5046129",
"0.5036165",
"0.50250024",
"0.50080687",
"0.49870986",
"0.495... | 0.60268843 | 1 |
FITS file summary Read back the FITS file, display numerical column information. %(fits_summary_table)s flux13 and unc_flux13 are not in the FITS file, but set to [Unc_]Flux_Density 1e13 for numerical display. | def fits_summary(self):
t = pyfits.open(self.fits_file)[1].data
# remove columns that have multiple dimensions
for j in range(3):#??? why
for i,col in enumerate(t.columns):
if len(col.array.shape)>1:
t.columns.del_col(i)
tt=pyfits.BinTable... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary_info_aeff(filename):\n # filename = self.out_filename('aeff')\n print('Reading {}'.format(filename))\n table = Table.read(str(filename), hdu='AEFF_2D')\n\n data = dict()\n\n # Copy over header info to the summary table\n data['LO_THRES'] = table.meta['LO_THRES']\n data['HI_THRES'] ... | [
"0.58864206",
"0.5854727",
"0.58462995",
"0.5822299",
"0.57605237",
"0.5732756",
"0.57194835",
"0.56438655",
"0.55709666",
"0.5556235",
"0.55442023",
"0.55412084",
"0.5536046",
"0.55326474",
"0.55268484",
"0.55177194",
"0.55165523",
"0.5450772",
"0.5431529",
"0.5425705",
"0.5... | 0.8071825 | 0 |
Prompts the user for integer inputs and then prints out the largest two integers entered. | def largest_two():
# Add your code below! | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n\n s = set()\n\n while True:\n n = input('Enter a number: ')\n if n == -99:\n break\n\n s.add(n)\n\n l = list(s)\n\n if len(l) < 2:\n print 'sorry but the list is too small'\n exit(1)\n\n l.sort()\n print 'The second largest number is', l... | [
"0.6894364",
"0.66742486",
"0.6549433",
"0.6529827",
"0.6480421",
"0.63954073",
"0.637488",
"0.6278114",
"0.62751466",
"0.61635184",
"0.6126541",
"0.6090925",
"0.6066813",
"0.605354",
"0.6043354",
"0.6009417",
"0.60047644",
"0.6004455",
"0.6001876",
"0.5999565",
"0.59955436",... | 0.692001 | 0 |
Extract poet from the url link | def process_poem(url):
response = get(url)
html_soup = BeautifulSoup(response.text, 'html.parser')
beyts = html_soup.find_all('span', class_ = 'verse')
beyts = [beyt.text for beyt in beyts]
info_dict = process_key_items(html_soup)
info_dict['beyts'] = beyts
return info_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_link(url):\n\theaders = {\"Host\": \"www.zomato.com\",\n\t \"User-Agent\": \"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0\",\n\t \"Accept\": \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\",\n\t \"Accept-Language\": \"en-US,en;q=0.5\"... | [
"0.63206905",
"0.6201261",
"0.6153495",
"0.6138546",
"0.6091984",
"0.60546577",
"0.59694636",
"0.5872868",
"0.5828914",
"0.58068365",
"0.5788576",
"0.5785462",
"0.5776612",
"0.5776533",
"0.57658374",
"0.5763261",
"0.5761654",
"0.57473385",
"0.5730871",
"0.5727238",
"0.5724248... | 0.6467172 | 0 |
Example of using read_poem function for Rumi. | def test_RUMI():
start = 11051
end = 11902
read_poems(start, end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_poem(self, p):\n poem = []\n number = self.int2roman[p] + \".\"\n next_number = self.int2roman[p + 1] + \".\"\n print(self.index[number])\n index1 = self.index[number][0]\n index2 = self.index[next_number][0]\n for i in range(index1 + 1, index2):\n ... | [
"0.58294064",
"0.5599925",
"0.5458955",
"0.5439821",
"0.5309595",
"0.52851164",
"0.5246632",
"0.52451646",
"0.51888615",
"0.51713043",
"0.51402664",
"0.50897837",
"0.498432",
"0.4937878",
"0.49296248",
"0.4915086",
"0.48869547",
"0.48765168",
"0.485589",
"0.48378807",
"0.4827... | 0.6828331 | 0 |
Example of using read_poem function for JAMI. | def test_JAMI():
start = 4107
end = 4126
foldersave = SAVE_PATH + '/jami'
if not os.path.isdir(foldersave):
os.mkdir(foldersave)
read_poems('jami' ,start, end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read():\n # TODO",
"def test_RUMI():\r\n\r\n start = 11051\r\n end = 11902\r\n read_poems(start, end)",
"def get_poem(self, p):\n poem = []\n number = self.int2roman[p] + \".\"\n next_number = self.int2roman[p + 1] + \".\"\n print(self.index[number])\n index1... | [
"0.5775257",
"0.56736845",
"0.5344736",
"0.5199725",
"0.5198908",
"0.5132048",
"0.5058452",
"0.50483435",
"0.50442195",
"0.50354457",
"0.5030674",
"0.5013057",
"0.49539334",
"0.4930905",
"0.49156946",
"0.4905181",
"0.48967895",
"0.4886876",
"0.48672244",
"0.48424646",
"0.4829... | 0.6138367 | 0 |
Returns created or updated environment asset. | def create_or_update(self, environment: Environment) -> Environment:
try:
if not environment.version and environment._auto_increment_version:
environment.version = _get_next_version_from_container(
name=environment.name,
container_operation=sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asset(self):\n\t\treturn self._asset",
"def get_asset(self, name):\n assert self.has_asset(name), \"Asset is not created yet, use has_asset for checking\"\n return self.assets[name]",
"def get_asset(self, asset_id, asset_type):\n return self.asset(asset_id, asset_type=asset_type)",
"... | [
"0.61956143",
"0.61238104",
"0.58050895",
"0.5628729",
"0.56143606",
"0.5594775",
"0.5588402",
"0.5505756",
"0.549205",
"0.5458131",
"0.5398734",
"0.5353036",
"0.53321236",
"0.532311",
"0.53202885",
"0.5256134",
"0.52190095",
"0.5204874",
"0.5187553",
"0.5187243",
"0.5174594"... | 0.61968577 | 0 |
Archive an environment or an environment version. | def archive(
self,
name: str,
version: Optional[str] = None,
label: Optional[str] = None,
**kwargs, # pylint:disable=unused-argument
) -> None:
name = _preprocess_environment_name(name)
_archive_or_restore(
asset_operations=self,
versi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ArchiveChromeEbuildEnv(self):\n files = glob.glob(os.path.join(self._pkg_dir, constants.CHROME_CP) + '-*')\n if not files:\n raise artifact_stages.NothingToArchiveException(\n 'Failed to find package %s' % constants.CHROME_CP)\n if len(files) > 1:\n logging.PrintBuildbotStepWarning... | [
"0.64604753",
"0.62564677",
"0.6224388",
"0.587912",
"0.5624461",
"0.55861765",
"0.53567517",
"0.53505874",
"0.53499496",
"0.5349092",
"0.5345595",
"0.5324937",
"0.5316224",
"0.52405334",
"0.5240352",
"0.517459",
"0.51526314",
"0.5145824",
"0.5133149",
"0.5131143",
"0.5129766... | 0.69926417 | 0 |
Restore an archived environment version. | def restore(
self,
name: str,
version: Optional[str] = None,
label: Optional[str] = None,
**kwargs, # pylint:disable=unused-argument
) -> None:
name = _preprocess_environment_name(name)
_archive_or_restore(
asset_operations=self,
versi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore(self, archive):\n logger.info(\"Restoring an old archive run from {}\".format(archive))\n if os.path.isabs(archive):\n restorefile = archive\n else:\n restorefile = os.path.join(self.containerpath, const.ARCHIVEDIR, archive)\n with ignored(OSError):\n ... | [
"0.63505644",
"0.6313094",
"0.62881464",
"0.6256433",
"0.6234121",
"0.621091",
"0.60073245",
"0.60008067",
"0.5994659",
"0.5933157",
"0.5901754",
"0.5885354",
"0.5843295",
"0.5842139",
"0.5838413",
"0.5836682",
"0.5814803",
"0.57988536",
"0.5793264",
"0.5792679",
"0.5767203",... | 0.66135824 | 0 |
Share a environment asset from workspace to registry. | def share(self, name, version, *, share_with_name, share_with_version, registry_name) -> Environment:
# Get workspace info to get workspace GUID
workspace = self._service_client.workspaces.get(
resource_group_name=self._resource_group_name, workspace_name=self._workspace_name
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_or_update(self, environment: Environment) -> Environment:\n try:\n if not environment.version and environment._auto_increment_version:\n environment.version = _get_next_version_from_container(\n name=environment.name,\n container_ope... | [
"0.5777924",
"0.5638162",
"0.5500348",
"0.5376419",
"0.5235503",
"0.5227396",
"0.5188119",
"0.516572",
"0.5142718",
"0.5114613",
"0.5113794",
"0.5063201",
"0.5045216",
"0.4983797",
"0.49475348",
"0.49176106",
"0.49024117",
"0.48822293",
"0.48794913",
"0.4873375",
"0.48162332"... | 0.70924634 | 0 |
Sets the registry client for the environment operations. | def _set_registry_client(self, registry_name: str) -> None:
rg_ = self._operation_scope._resource_group_name
sub_ = self._operation_scope._subscription_id
registry_ = self._operation_scope.registry_name
client_ = self._service_client
environment_versions_operation_ = self._versio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(self, client):\n if not client:\n raise SurvoxAPIMissingParameter('client')\n c = self.get()\n if not c:\n raise SurvoxAPIRuntime('No client available named: {name}'.format(name=self.name))\n return self.api_put(endpoint=self.url, data=client)",
"def grr_... | [
"0.6370861",
"0.6181394",
"0.5674733",
"0.56536514",
"0.56119114",
"0.56051415",
"0.56028444",
"0.5592929",
"0.54459864",
"0.54050434",
"0.5392513",
"0.53147316",
"0.5255586",
"0.5255586",
"0.5170892",
"0.5153842",
"0.51261556",
"0.5072216",
"0.5055539",
"0.50308275",
"0.5015... | 0.7440585 | 0 |
Generators tensors for BERT | def generate_bert_tensor_data(dataset, tokenizer, MAX_LEN):
# initializes dataset.bert_tokens, dataset.bert_labels
dataset.generate_bert_tokens(tokenizer)
bert_token_ids = []
attn_masks = []
segment_ids = []
for tokens in dataset.bert_tokens:
padded_tokens = tokens + ['[PAD]' for _ in ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bert_module_fn(is_training):\n\n input_ids = tf.compat.v1.placeholder(shape=[None, None], dtype=tf.int32, name=\"input_ids\")\n input_mask = tf.compat.v1.placeholder(shape=[None, None], dtype=tf.int32, name=\"input_mask\")\n token_type = tf.compat.v1.placeholder(shape=[None, None], dtype=t... | [
"0.62490666",
"0.6054576",
"0.6015713",
"0.5830311",
"0.576799",
"0.5767857",
"0.57553375",
"0.5751452",
"0.5746628",
"0.5678213",
"0.5621775",
"0.5615323",
"0.56034464",
"0.5599364",
"0.5594678",
"0.5589969",
"0.5567636",
"0.5561835",
"0.5532102",
"0.5522995",
"0.54923373",
... | 0.6425694 | 0 |
Interpolate a dict of splines over their ranges | def interpolate(att_spline, indices, range_info=None):
v = {}
db = {}
module_logger.debug("interpolate: ranges are %s", range_info)
for index in indices:
if range_info:
v[index] = arange(*range_info[index])
else:
v[index] = arange(-10, 0.5, 0.1)
module_logger.debug("interpolate: %s at \n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolate(self, xs):\n tck = splrep(self._xs, self._ys)\n new_ys = splev(xs, tck, der=0)\n return new_ys",
"def interpolate(i0, d0, i1, d1):\n if i0 == i1:\n return [d0]\n values = []\n a = (d1 - d0) / (i1 - i0)\n d = d0\n for i in range(i0,i1+1):\n values.... | [
"0.67891467",
"0.6077751",
"0.6063687",
"0.6043078",
"0.6020123",
"0.5980172",
"0.5974459",
"0.59378576",
"0.58838826",
"0.5851971",
"0.58322626",
"0.57882226",
"0.5773296",
"0.5692933",
"0.56908214",
"0.5643147",
"0.5640263",
"0.55863905",
"0.5576309",
"0.5572141",
"0.556049... | 0.6808666 | 0 |
Configures an amfast.remoting.channel.ChannelSet object. | def setup_channel_set(channel_set):
#amfast.logger = log.logger
# Map service targets to controller methods
cont_obj = app.controller.Controller()
service = Service('DAService')
service.mapTarget(CallableTarget(cont_obj.get_player_info, 'get_player_info'))
service.mapTarget(CallableTarget(cont... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_channel_set(channel_set):\n\n # Send log messages to STDOUT\n handler = logging.StreamHandler(sys.stdout)\n handler.setLevel(logging.DEBUG)\n amfast.logger.addHandler(handler)\n\n # Map service targets to controller methods\n cont_obj = controller.Controller()\n service = Service('Ex... | [
"0.64508337",
"0.6233799",
"0.62058055",
"0.5804514",
"0.580413",
"0.57061034",
"0.5590135",
"0.558009",
"0.5559871",
"0.5559648",
"0.55508906",
"0.55389106",
"0.55257565",
"0.55187213",
"0.5471973",
"0.5471861",
"0.5437038",
"0.54244226",
"0.5387382",
"0.53786397",
"0.529550... | 0.69039214 | 0 |
Description Returns talk string from character in current location If no character in current location is found, "There is no one to talk to." string is returned | def talk(self):
if self.location.character:
return self.location.character.talk()
else:
return "There is no one to talk to." | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _current_char(self):\r\n\r\n return self._input_string[self._index]",
"def look_at_character(from_char, to_char):\n visible = wornlist(from_char, top=True) \n if from_char == to_char:\n title = \"{} se regarde\".format(from_char.data['name'])\n else:\n title = \"{} regarde {}\"... | [
"0.6283816",
"0.6197168",
"0.6185099",
"0.61481845",
"0.6098568",
"0.60792804",
"0.60104406",
"0.599413",
"0.5783666",
"0.5779067",
"0.57776135",
"0.57432467",
"0.5702468",
"0.56931794",
"0.56701416",
"0.56509495",
"0.5648333",
"0.56452805",
"0.56345314",
"0.5590737",
"0.5574... | 0.74233997 | 0 |
Description Checks if there is a character to fight in current location If there is none, "There is no one to fight here." string is returned Checks if character is Friend If Friend, returns result of Friend class fight() method Calls fight() method from Enemy class and passes current strength attribute to it Checks if... | def fight(self):
returned_string = "You killed {defeated_char_name}" \
"with {Weapon} and lost {health_lost} health. " \
"Your current health is {health_curr}"
if self.location.character is None:
return "There is no one to fight here."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def fight(self, ctx):\r\n attacker = ctx.message.author.name\r\n defenders = ctx.message.mentions\r\n # only continue if valid attacker and defender\r\n attacker_ship = Ship.find_ship(attacker)\r\n if not attacker_ship:\r\n await ctx.send('{0}, you do not have a ... | [
"0.6515021",
"0.6429588",
"0.6201165",
"0.60823286",
"0.57243544",
"0.5717124",
"0.56975776",
"0.5687571",
"0.5674974",
"0.56749326",
"0.5654082",
"0.5598205",
"0.5558623",
"0.5543056",
"0.5525446",
"0.55131817",
"0.5504393",
"0.55029356",
"0.5498872",
"0.5492188",
"0.5482174... | 0.8229072 | 0 |
Description Checks if an item in current location exists Puts item in backpack Assigns None value to item attribute of current location Returns "You took item_name. And put it in your backpack." string Returns "There is nothing to take." string | def take(self):
if self.location.item:
self.backpack[self.location.item.name] = self.location.item
item_name = self.location.item.name
self.location.item = None
return f"You took {item_name}. And put it in your backpack."
else:
return "There is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _item_exists(self, location):\n \"Does nothing\"",
"def do_store(self, arg):\r\n\r\n # put this value in a more suitably named variable\r\n itemToStore = arg.lower()\r\n\r\n # get a list of all \"description words\" for each item in the inventory\r\n invDescWords = getAllDe... | [
"0.7072527",
"0.6410307",
"0.6302232",
"0.6248276",
"0.60911554",
"0.5968652",
"0.58929795",
"0.587979",
"0.5840509",
"0.5822827",
"0.57909214",
"0.57850164",
"0.5784702",
"0.57736444",
"0.57595176",
"0.5756287",
"0.5720788",
"0.5718883",
"0.5711406",
"0.5669959",
"0.5650222"... | 0.7623877 | 0 |
Description Builds string of all item names, descriptions and usages of items in backpack dictionary Returns built string Returns "You have nothing in your backpack." string if backpack is empty | def check_backpack(self):
if self.backpack:
list_of_items =""
for item in self.backpack:
list_of_items += ">" + self.backpack[item].name + "\n" + \
self.backpack[item].description + "\n" + \
self.backpack[item].usage + "\n"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_description():\r\n return{\"I'll never yield!\":\"Grants a shield.\",\r\n \"Stay still!\":\"Affected unit cannot act in their turn.\"\r\n }",
"def __str__(self):\n reprStr = 'Help Mario build Iron Man suit!'+'\\n' +'To make the ' + self._name + ',you need:'+'\\n'\n for p... | [
"0.61309785",
"0.5916461",
"0.57825965",
"0.5776227",
"0.5756864",
"0.5594356",
"0.5594356",
"0.5589774",
"0.55727327",
"0.5532035",
"0.55096483",
"0.55088323",
"0.54915565",
"0.54891926",
"0.5487656",
"0.5467071",
"0.54418087",
"0.5440473",
"0.5426421",
"0.54158795",
"0.5407... | 0.68072677 | 0 |
Description Asks user to input item name to equip\n Checks if item name exists in backpack dictionary\n Returns "You don't have this" string if item name not found in backpack\n Checks if item type is equippable\n Puts item in equipped dictionary\n If item type is "Weapon" changes strength attribute of player to weapon... | def equip(self):
item_name = input("What item do you want to equip?\n>")
if item_name in self.backpack:
item = self.backpack[item_name]
else:
return "You don't have this"
if item.type in self.equipped:
self.equipped[item.type] = item
if ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip(self, command):\n\n if len(command) > 1:\n if not self.weapon:\n for item in self.inventory:\n if item.name == command[1]:\n if command[1] == 'knife' or command[1] == 'rock' or command[1] == 'stick' or command[1] == 'lamp':\n ... | [
"0.711861",
"0.67356426",
"0.6632231",
"0.65054053",
"0.648374",
"0.64348775",
"0.6431",
"0.64257723",
"0.6394632",
"0.63630646",
"0.634077",
"0.6334305",
"0.63015056",
"0.62882954",
"0.6286444",
"0.62789226",
"0.62363315",
"0.620253",
"0.61553633",
"0.6134195",
"0.6131085",
... | 0.85885817 | 0 |
Description Asks user to input item name to be given. Checks if character exists in the current location, Returns "There is no one here" string if no character exists. Checks if item name exists in backpack dictionary, Returns "You don't have this" string if item is not found. Checks return value of give() method from ... | def give(self):
if self.location.character:
item = input(f"What do you want to give to {self.location.character.name}?\n>")
if item in self.backpack:
if self.location.character.give(item):
if isinstance(self.location.character, Friend):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip(self):\n item_name = input(\"What item do you want to equip?\\n>\")\n if item_name in self.backpack:\n item = self.backpack[item_name]\n else:\n return \"You don't have this\"\n if item.type in self.equipped:\n self.equipped[item.type] = item\n... | [
"0.6434494",
"0.6398872",
"0.63884974",
"0.62861234",
"0.60229456",
"0.5971386",
"0.5952871",
"0.5883416",
"0.5823682",
"0.58227223",
"0.5797818",
"0.57711345",
"0.57433754",
"0.5726849",
"0.5726679",
"0.5707468",
"0.5656824",
"0.56306726",
"0.5624708",
"0.5619921",
"0.559709... | 0.73106873 | 0 |
Description Asks user to input an item name to be used Checks if it exists in self.backpack Checks if item type is Food Adds value of heal_amount attribute of the item to self.health value Reduces amount of item charges, deletes item from backpack if charges number become 0 Returns "You ate {self.backpack[item].name}. ... | def use(self):
return_string = ''
item = input(f"What do you want to use?\n>")
if item in self.backpack:
if self.backpack[item].type is "Food":
if (self.health + self.backpack[item].heal_amount) > standard_health:
self.health = standard_health
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def equip(self):\n item_name = input(\"What item do you want to equip?\\n>\")\n if item_name in self.backpack:\n item = self.backpack[item_name]\n else:\n return \"You don't have this\"\n if item.type in self.equipped:\n self.equipped[item.type] = item\n... | [
"0.7249221",
"0.6922872",
"0.6793059",
"0.6642906",
"0.65641373",
"0.62358886",
"0.6145876",
"0.6104031",
"0.5942103",
"0.59400934",
"0.59339803",
"0.5925581",
"0.58787465",
"0.58516383",
"0.5764986",
"0.56911844",
"0.56813616",
"0.56804574",
"0.5635747",
"0.5626358",
"0.5618... | 0.80603635 | 0 |
Can the QUALITY flags be parsed correctly? | def test_quality_flag_decoding_tess():
flags = list(TessQualityFlags.STRINGS.items())
for key, value in flags:
assert TessQualityFlags.decode(key)[0] == value
# Can we recover combinations of flags?
assert TessQualityFlags.decode(flags[5][0] + flags[7][0]) == [flags[5][1], flags[7][1]]
asser... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_quality_filter_illumina_qual(self):\r\n # header with no qual data passes\r\n header = \"990:2:4:11271:5323/1\"\r\n sequence = \\\r\n \"GCACTCACCGCCCGTCACACCACGAAAGTTGGTAACACCCGAAGCCGGTGAGATAACCTTTTAGGAGTCAGCTGTC\"\r\n quality = \\\r\n \"bbbbbbbbbbbbbbbbb... | [
"0.6236157",
"0.591436",
"0.562498",
"0.5375986",
"0.5312736",
"0.528509",
"0.5248987",
"0.52123636",
"0.51925087",
"0.5133117",
"0.5107898",
"0.5096849",
"0.50931865",
"0.5090493",
"0.5027097",
"0.49722502",
"0.49395365",
"0.49296382",
"0.49054652",
"0.48811412",
"0.4877389"... | 0.59472173 | 1 |
Can we create a quality mask using KeplerQualityFlags? | def test_quality_mask():
quality = np.array([0, 0, 1])
assert np.all(KeplerQualityFlags.create_quality_mask(quality, bitmask=0))
assert np.all(KeplerQualityFlags.create_quality_mask(quality, bitmask=None))
assert np.all(KeplerQualityFlags.create_quality_mask(quality, bitmask='none'))
assert (KeplerQ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_quality_flag_decoding_kepler():\n flags = list(KeplerQualityFlags.STRINGS.items())\n for key, value in flags:\n assert KeplerQualityFlags.decode(key)[0] == value\n # Can we recover combinations of flags?\n assert KeplerQualityFlags.decode(flags[5][0] + flags[7][0]) == [flags[5][1], flag... | [
"0.6650363",
"0.5603464",
"0.55853474",
"0.55749416",
"0.5567535",
"0.5443825",
"0.53447133",
"0.53097266",
"0.53067493",
"0.52518195",
"0.5240438",
"0.518615",
"0.5174121",
"0.5170726",
"0.51531535",
"0.50274515",
"0.50269926",
"0.50269127",
"0.50144744",
"0.50123453",
"0.50... | 0.7043028 | 0 |
True if element is \\s or \n | def is_sentence_end(mystem_element):
word = mystem_element.get('text', '')
return word == '\\s' or word == '\n' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _is_whitespace(char):\n # \\t, \\n, and \\r are technically contorl characters but we treat them\n # as whitespace since they are generally considered as such.\n if char == \" \" or char == \"\\t\" or char == \"\\n\" or char == \"\\r\":\n return True\n cat = unicodedata.c... | [
"0.6634618",
"0.65383315",
"0.65339756",
"0.6481999",
"0.63937706",
"0.6269705",
"0.6221383",
"0.59168893",
"0.5899913",
"0.5853028",
"0.5779206",
"0.5760287",
"0.57525533",
"0.56327254",
"0.56196755",
"0.5581376",
"0.5564806",
"0.5559176",
"0.5556629",
"0.5535566",
"0.550236... | 0.683654 | 0 |
wrap for morpho_doc with local session | def morpho_doc2(doc_id):
db.doc_apply(doc_id, morpho_doc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def document(self):\n ...",
"def __init__(self, temboo_session):\n super(DownloadDocument, self).__init__(temboo_session, '/Library/Zoho/Writer/DownloadDocument')",
"def __call__(self, doc):\n return doc",
"def generate_docs(root_dir, session):\n ...",
"def documento():\r\n\tpass",
... | [
"0.6169525",
"0.6089714",
"0.5754191",
"0.5680773",
"0.5625634",
"0.5560101",
"0.5555134",
"0.5552288",
"0.54824644",
"0.54459333",
"0.54459333",
"0.54404557",
"0.54239726",
"0.5403701",
"0.5398525",
"0.5373541",
"0.52517116",
"0.52360654",
"0.5235492",
"0.52008027",
"0.51755... | 0.6099428 | 1 |
morphological analysis for document | def morpho_doc(doc):
doc_text = doc.stripped
mystem_analyzer.start()
# new_morpho = mystem_analyzer.analyze(doc_text)
new_morpho = mystem_analyzer.analyze(doc_text.replace('\n',''))
morpho_list = []
for element in new_morpho: # разрезаем
if is_sentence_end(element):
morpho... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, doc):\n # don't try to process null notes\n if not doc[1]:\n if self.verbose:\n print(\"Error segmenting doc\",doc[0])\n return []\n # odd notes may throw an error. Just continue rather than stopping the entire process\n try:\n ... | [
"0.6044923",
"0.5885203",
"0.58177",
"0.58032626",
"0.5795096",
"0.5754858",
"0.56634796",
"0.5636914",
"0.56317765",
"0.56152934",
"0.5607152",
"0.5593497",
"0.55799764",
"0.557679",
"0.55065227",
"0.5489352",
"0.5421111",
"0.53919905",
"0.53863907",
"0.5376077",
"0.5364964"... | 0.7516963 | 0 |
wrap for lemmas_freq_doc with local session | def lemmas_freq_doc2(doc_id):
db.doc_apply(doc_id, lemmas_freq_doc) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lemmas_freq_doc(doc):\n lemmas = {}\n morpho = doc.morpho\n for i in morpho:\n # if this is a word\n if 'analysis' in i.keys():\n # if there is few lex\n if len(i['analysis']):\n for l in i.get('analysis', []):\n if l.get('lex', Fal... | [
"0.59216833",
"0.5677444",
"0.55503094",
"0.55252546",
"0.55219114",
"0.55058557",
"0.5487935",
"0.54210114",
"0.5392454",
"0.53751504",
"0.5373541",
"0.5278519",
"0.5270846",
"0.5263379",
"0.52370554",
"0.5235091",
"0.52321196",
"0.5221891",
"0.52202755",
"0.5213417",
"0.520... | 0.6881848 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.