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 |
|---|---|---|---|---|---|---|
Generates the headers to use for the API invocation. Attemps to use a Query API key, if it exists, then falls back to a User API if no query API key is returned. | def _build_headers(self, params: Dict) -> None:
api_key = self._get_query_api_key(params) or self.user_api_key
if api_key is None:
raise RedashApiKeyNotProvidedException('No API key provided')
self.headers = {"Authorization": "Key {}".format(api_key)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_common_headers(apikey: str):\n return {\n \"Authorization\": f\"token {apikey}\",\n \"User-Agent\": \"sharing-api-fetcher\",\n \"Accept-Encoding\": \"gzip\",\n \"Accept\": \"application/json\",\n }",
"def _get_headers() -> dict:\n api_key = ... | [
"0.6608862",
"0.6515079",
"0.63939565",
"0.61925447",
"0.6093824",
"0.602265",
"0.5996472",
"0.5959184",
"0.59449047",
"0.59408766",
"0.5939129",
"0.59307647",
"0.5928254",
"0.5927411",
"0.5919036",
"0.58882684",
"0.5884055",
"0.58772504",
"0.58772504",
"0.5845113",
"0.582315... | 0.73137933 | 0 |
This function can be overridden by sub classes to look up the specific API key to use for a given database / cluster / schema / table combination. | def _get_query_api_key(self, params: Dict) -> Optional[str]:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_api_key(api_key):\n api.get(api_key)",
"def api_key(self):\r\n if not self._api_key:\r\n res = DBSession.execute(\r\n \"SELECT api_key FROM users WHERE username='admin'\").fetchone()\r\n self._api_key = res['api_key']\r\n return self._api_key",
"def... | [
"0.63959783",
"0.6235148",
"0.6019554",
"0.6010721",
"0.5973823",
"0.5969861",
"0.5958504",
"0.5940758",
"0.5896475",
"0.58939356",
"0.5893077",
"0.58501697",
"0.58501697",
"0.58235025",
"0.58235025",
"0.58235025",
"0.58235025",
"0.5811296",
"0.5806146",
"0.57761776",
"0.5765... | 0.6415753 | 0 |
Allows customization of the 'WHERE' clause to be provided for each set of parameters by the client implementation. Defaults to an empty string. | def get_where_clause(self, params: Dict) -> str:
return '' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def where(condition):\r\n return ('', []) if condition.clause == '' else (f'WHERE {condition.clause}', list(condition.params))",
"def _build_where_clause(**kwds_filter):\n clause = []\n params = []\n items = kwds_filter.items()\n items = sorted(items, key=lambda x: x[0]) # Ordered... | [
"0.6664562",
"0.6523522",
"0.6510388",
"0.6334557",
"0.63276654",
"0.6312176",
"0.6312176",
"0.6312176",
"0.6159147",
"0.6126587",
"0.610801",
"0.6091489",
"0.6034291",
"0.58740854",
"0.58259207",
"0.5822783",
"0.58167803",
"0.58079535",
"0.5806758",
"0.5792341",
"0.57800716"... | 0.7794601 | 0 |
Builds a dictionary of parameters that will be injected into the Redash query template. The keys in this dictionary MUST be a casesensitive match to the template names in the Redash query and you MUST have the exact same parameters, no more, no less. Override this function to provide custom values. | def build_redash_query_params(self, params: Dict) -> Dict:
return {
'parameters': {
'SELECT_FIELDS': self.get_select_fields(params),
'SCHEMA_NAME': params.get('schema'),
'TABLE_NAME': params.get('tableName'),
'WHERE_CLAUSE': self.get_wh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_template_dict(self):\n # Get the existing parameters\n params = super().generate_template_dict()\n\n # Add our custom parameters\n params['job_parameter_file'] = self.job_parameter_file\n params['job_output_directory'] = self.job_output_directory\n\n # Return ... | [
"0.6909239",
"0.6332519",
"0.6309205",
"0.6264976",
"0.61563927",
"0.6138303",
"0.60468847",
"0.59783953",
"0.59466684",
"0.58836806",
"0.5850396",
"0.58461237",
"0.5789234",
"0.5772803",
"0.5720923",
"0.57074153",
"0.5693521",
"0.5691967",
"0.56907636",
"0.56797206",
"0.5675... | 0.7181173 | 0 |
Starts a query in Redash. Returns a job ID that can be used to poll for the job status. | def _start_redash_query(self, query_id: int, query_params: Dict) -> Tuple[Any, bool]:
url_inputs = {'redash_host': self.redash_host, 'query_id': query_id}
query_url = REDASH_SUBMIT_QUERY_ENDPOINT.format(**url_inputs)
resp = r.post(query_url, json=query_params, headers=self.headers)
resp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_query_job(iden, pickled_cr):\r\n precompute_worker = g.query_queue_worker\r\n def job():\r\n try:\r\n finished = False\r\n r = Request(url = precompute_worker + '/doquery',\r\n data = urlencode([('query', pickled_cr)]),\r\n #... | [
"0.61714923",
"0.60743093",
"0.59327674",
"0.584376",
"0.5814082",
"0.57303476",
"0.57197654",
"0.5716636",
"0.56817716",
"0.5680003",
"0.5678536",
"0.5670579",
"0.56171185",
"0.56030375",
"0.55916005",
"0.55841756",
"0.55805826",
"0.5576898",
"0.55647004",
"0.555271",
"0.555... | 0.689332 | 0 |
Returns a FlaskResponse object, where the response data represents a json object with the preview data accessible on 'preview_data' key. The preview data should match amundsen_application.models.preview_data.PreviewDataSchema | def get_preview_data(self, params: Dict, optionalHeaders: Dict = None) -> FlaskResponse:
LOGGER.debug('Retrieving preview data from Redash with params: %s', params)
try:
query_id = self.get_redash_query_id(params)
if query_id is None:
raise RedashQueryTemplateDoes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getPreviewStatus(self) -> dict:\n if self.loggingEnabled:\n self.logger.debug(f\"Starting getPreviewStatus\")\n path = \"/previewsamplestatus\"\n privateHeader = deepcopy(self.header)\n privateHeader[\"Accept\"] = \"application/json\"\n res = self.connector.getData... | [
"0.6352922",
"0.6307447",
"0.609098",
"0.6019505",
"0.57551557",
"0.57525045",
"0.5701352",
"0.5687577",
"0.5634645",
"0.56210864",
"0.5586955",
"0.5566232",
"0.55552495",
"0.5417472",
"0.5392133",
"0.53805906",
"0.53805906",
"0.5363474",
"0.53467715",
"0.5332995",
"0.5312453... | 0.6645567 | 0 |
Run 100 episodes, then report results | def test():
env = gym.make('CartPole-v1')
results = []
for _ in range(100):
results.append(episode(env, render=False, verbose=False))
print(f'average={sum(results) / len(results)} '
f'max={max(results)} '
f'min={min(results)}') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self) -> None:\n for episode in range(1, self.episodes + 1):\n print('Episode:', episode)\n steps, state_action_history = self.run_one_episode()\n self.steps_per_episode.append(steps)\n if episode % parameters.CACHING_INTERVAL == 0 or steps < 1000:\n ... | [
"0.7220863",
"0.7045146",
"0.69564694",
"0.69283205",
"0.6908558",
"0.6864333",
"0.6858754",
"0.68127096",
"0.68127096",
"0.6812413",
"0.6726398",
"0.66405255",
"0.6614671",
"0.6599261",
"0.6598578",
"0.65780646",
"0.6500496",
"0.64934766",
"0.6469181",
"0.64309716",
"0.64180... | 0.7105309 | 1 |
Update target parameters to be closer to those of source parameters using an exponential moving average. | def update_ema(target_params, source_params, rate=0.99):
for targ, src in zip(target_params, source_params):
targ.detach().mul_(rate).add_(src, alpha=1 - rate) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_average(source, target, tau=0.005):\n for target_param, param in zip(target.parameters(), source.parameters()):\n target_param.data.copy_(\n target_param.data * (1.0 - tau) + param.data * tau\n )",
"def exponentialMovingAverage(self,new,old, alpha):\n return alpha * ne... | [
"0.65540874",
"0.63846195",
"0.60326076",
"0.5953432",
"0.5940762",
"0.589877",
"0.58710045",
"0.5857003",
"0.57975394",
"0.5707032",
"0.5690643",
"0.5686295",
"0.5622819",
"0.5593131",
"0.5593131",
"0.55850744",
"0.5550918",
"0.5540762",
"0.55254173",
"0.55038905",
"0.549471... | 0.7388066 | 0 |
Zero out the parameters of a module and return it. | def zero_module(module):
for p in module.parameters():
p.detach().zero_()
return module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def emptyModule():\n return(Module(\"\",[]))",
"def _reset_module(m):\n raise NotImplementedError",
"def resetParameter(pname):\n dislin.reset(pname)",
"def NoModulator(*args, **kwargs):\n return None",
"def reset() -> None:\n Parameter.by_name = {}",
"def reset_parameters(self):\n... | [
"0.6263158",
"0.6212617",
"0.58497363",
"0.57775503",
"0.56752926",
"0.56713647",
"0.56491196",
"0.558287",
"0.5534604",
"0.55231965",
"0.5513227",
"0.54866874",
"0.5483356",
"0.5481485",
"0.5383151",
"0.53667295",
"0.534895",
"0.5339156",
"0.532932",
"0.532932",
"0.532932",
... | 0.77744645 | 0 |
Scale the parameters of a module and return it. | def scale_module(module, scale):
for p in module.parameters():
p.detach().mul_(scale)
return module | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _rescale_module(module):\n for sub in module.modules():\n if isinstance(sub, (nn.Conv1d, nn.ConvTranspose1d, nn.Conv2d, nn.ConvTranspose2d)):\n std = sub.weight.std().detach()\n scale = (std / 0.1) ** 0.5\n sub.weight.data /= scale\n if sub.bias is not None... | [
"0.6347111",
"0.62950075",
"0.6279172",
"0.61472464",
"0.60894835",
"0.5947047",
"0.5862599",
"0.5825257",
"0.5821015",
"0.57890415",
"0.5776177",
"0.5753903",
"0.5747533",
"0.56942105",
"0.56745505",
"0.5660839",
"0.5641823",
"0.56101644",
"0.5579674",
"0.5573407",
"0.556518... | 0.78723633 | 0 |
Create sinusoidal timestep embeddings. | def timestep_embedding(timesteps, dim, max_period=10000):
half = dim // 2
freqs = paddle.exp(-math.log(max_period) * paddle.arange(start=0, end=half, dtype=paddle.float32) / half)
args = paddle.cast(timesteps[:, None], 'float32') * freqs[None]
embedding = paddle.concat([paddle.cos(args), paddle.sin(args... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timestep_embedding(timesteps, dim, max_period=10000):\n half = dim // 2\n freqs = torch.exp(-math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half)\n args = timesteps[:, None].float() * freqs[None]\n embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)\n ... | [
"0.66085994",
"0.65616596",
"0.60627913",
"0.59043974",
"0.5894194",
"0.5874639",
"0.58046216",
"0.5689095",
"0.5540392",
"0.5476205",
"0.54213727",
"0.53775567",
"0.53557706",
"0.53395146",
"0.5328101",
"0.53141636",
"0.53015023",
"0.52998585",
"0.52972686",
"0.52835363",
"0... | 0.66800493 | 0 |
Inserts the DataFrame to the database and table provided. Creates an insert query for each row in dataframe and send to db. | def insert_data(df, database, table, db_uri):
try:
engine = sqlalchemy.create_engine(db_uri)
df = create_hash_id(df)
def create_insert_sql(x):
cols = "`" + "`,`".join(list(df.columns)) + "`"
values = "\'" + "\',\'".join(list(x)) + "\'"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert_into_db(dataframe, query):\n for col, row in dataframe.iterrows():\n cursor.execute(query.format(tuple(row)))\n print (tuple(row))\n connection.commit()",
"def InsertDFtoDB(table: str, schema: str, dataframe: pd.DataFrame, dtype=None, con=None, engine: Engine=None):\r\n if e... | [
"0.8086966",
"0.7872292",
"0.77744377",
"0.7563819",
"0.75591505",
"0.75344455",
"0.75281644",
"0.747461",
"0.73796487",
"0.736072",
"0.7270612",
"0.7252401",
"0.7245645",
"0.6928958",
"0.69168055",
"0.68712676",
"0.6829359",
"0.68259054",
"0.6825743",
"0.68178684",
"0.681703... | 0.83281714 | 0 |
Update the data in table using the provided key and values | def update_data(self, update_key, update_values):
engine = sqlalchemy.create_engine(self.db_uri)
final_where_cond = create_cond_string(update_key, flag='where')
read_sql = f"SELECT * FROM {self.database_params['database']}.{self.database_params['table']} WHERE {final_where_cond};"
upda... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self, table, key, value, values):\n\n self._check_values(values)\n self._check_connection()\n alls = []\n for k, v in values.items():\n if k != key:\n if isinstance(v, (str, datetime.datetime)):\n alls += [\"%s='%s'\" % (k, str(v))... | [
"0.729415",
"0.7134297",
"0.7101659",
"0.70681983",
"0.69620126",
"0.6924248",
"0.6899457",
"0.68640137",
"0.67386425",
"0.664817",
"0.6586165",
"0.65793043",
"0.6512324",
"0.64819616",
"0.64749783",
"0.6453075",
"0.6428944",
"0.6426257",
"0.6425415",
"0.6393401",
"0.6383283"... | 0.7503505 | 0 |
Test that q_hat_cov has the right shape and accepts keys in correct format. Also validate with arbitrary number of delays. | def test_cov_q(self, ndlys=13):
for d in self.d:
d.flag_array[:] = False #ensure that there are no flags!
d.select(times=np.unique(d.time_array)[:10], frequencies=d.freq_array[:16])
for d_std in self.d_std:
d_std.flag_array[:] = False
d_std.select(times=np... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_q_hat(self):\n # Set weights and pack data into PSpecData\n self.ds = pspecdata.PSpecData(dsets=self.d, wgts=self.w)\n Nfreq = self.ds.Nfreqs\n Ntime = self.ds.Ntimes\n Ndlys = Nfreq - 3\n self.ds.spw_Ndlys = Ndlys\n\n\n # Set baselines to use for tests\n ... | [
"0.71095884",
"0.6681699",
"0.6121157",
"0.6112217",
"0.57491",
"0.5500836",
"0.5479007",
"0.54770714",
"0.5466799",
"0.5438459",
"0.5427393",
"0.5405259",
"0.53681564",
"0.53401345",
"0.533942",
"0.53254235",
"0.5290872",
"0.52767426",
"0.52632093",
"0.5258145",
"0.5258145",... | 0.7053423 | 1 |
Test cov_p_hat, verify on identity. | def test_cov_p_hat(self):
self.ds = pspecdata.PSpecData(dsets=self.d, wgts=self.w, dsets_std=self.d_std)
cov_p = self.ds.cov_p_hat(np.sqrt(6.)*np.identity(10),np.array([5.*np.identity(10)]))
for p in range(10):
for q in range(10):
if p == q:
self.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_identity(self, input_shape, eps, device, dtype):\n data = torch.randn(*input_shape, device=device, dtype=dtype)\n\n zca = kornia.enhance.ZCAWhitening(compute_inv=True, eps=eps).fit(data)\n\n data_w = zca(data)\n\n data_hat = zca.inverse_transform(data_w)\n\n self.assert_... | [
"0.61970204",
"0.5769216",
"0.56324273",
"0.56284046",
"0.55734885",
"0.55635446",
"0.555935",
"0.5558165",
"0.5534711",
"0.5532942",
"0.55327445",
"0.5517006",
"0.5515461",
"0.5508455",
"0.5434649",
"0.54096967",
"0.5405473",
"0.5399108",
"0.539647",
"0.5386834",
"0.5374785"... | 0.7594356 | 0 |
Test truncation of Rmatrices. These should give a q_hat that is all zeros outside of the with fstart and fend. | def test_R_truncation(self):
self.ds = pspecdata.PSpecData(dsets=self.d, wgts=self.w)
Nfreq = self.ds.spw_Nfreqs
Ntime = self.ds.Ntimes
Ndlys = Nfreq - 3
self.ds.spw_Ndlys = Ndlys
# Set baselines to use for tests
key1 = (0, 24, 38)
key2 = (1, 25, 38)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_truncate_seqs(self):\r\n\r\n base_pos = 5\r\n\r\n fasta_seqs = {'seq1': 'GAAATCAAGAATAC',\r\n 'seq2': 'ATAAACAAGAT'}\r\n qual_scores = {'seq1': array(map(str, [20, 10, 15, 25, 24, 25, 27])),\r\n 'seq2': array(map(str, [22, 21, 15, 12, 22, 25,... | [
"0.521518",
"0.5085821",
"0.5085335",
"0.50753456",
"0.50627524",
"0.50234723",
"0.49952266",
"0.4990746",
"0.496539",
"0.49216327",
"0.48870108",
"0.48666817",
"0.48548737",
"0.48372695",
"0.48176652",
"0.47996798",
"0.47647285",
"0.47511008",
"0.47493395",
"0.47486636",
"0.... | 0.543723 | 0 |
Test that q_hat has right shape and accepts keys in the right format. | def test_q_hat(self):
# Set weights and pack data into PSpecData
self.ds = pspecdata.PSpecData(dsets=self.d, wgts=self.w)
Nfreq = self.ds.Nfreqs
Ntime = self.ds.Ntimes
Ndlys = Nfreq - 3
self.ds.spw_Ndlys = Ndlys
# Set baselines to use for tests
key1 = (0... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_Q(self):\n vect_length = 50\n x_vect = np.random.normal(size=vect_length) \\\n + 1.j * np.random.normal(size=vect_length)\n y_vect = np.random.normal(size=vect_length) \\\n + 1.j * np.random.normal(size=vect_length)\n\n self.ds.spw_Nfreqs = vect_... | [
"0.61863965",
"0.5988287",
"0.5859122",
"0.5859122",
"0.58507466",
"0.5819924",
"0.5818468",
"0.5788406",
"0.5744077",
"0.56924844",
"0.5691904",
"0.56756884",
"0.5660292",
"0.5638133",
"0.5625994",
"0.5601798",
"0.56001824",
"0.5598095",
"0.5555872",
"0.55300945",
"0.5517296... | 0.73177737 | 0 |
Test window function computation in ds.pspec() This is complementary to test_get_MW above. | def test_window_funcs():
# get a PSpecData
uvd = UVData()
uvd.read_miriad(
os.path.join(DATA_PATH, 'zen.even.xx.LST.1.28828.uvOCRSA'),
use_future_array_shapes=True
)
beam = pspecbeam.PSpecBeamUV(os.path.join(DATA_PATH, "HERA_NF_dipole_power.beamfits"))
ds = pspecdata.PSpecData(ds... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_window_filter(self):\n test_window_scheme = WindowingScheme(self.window_test_filter, 5)\n filtered_value = test_window_scheme.filter(self.middle_value)\n self.assertEquals(filtered_value, self.middle_value)",
"def _wk_test(self, alternative='two-sided', alpha=0.01):\n\n q0 = ... | [
"0.6493523",
"0.63320696",
"0.6184265",
"0.5963282",
"0.59387535",
"0.5938714",
"0.5893483",
"0.5824908",
"0.5821792",
"0.582108",
"0.57919675",
"0.57837456",
"0.5761483",
"0.5737254",
"0.57190114",
"0.5709116",
"0.5678121",
"0.5659045",
"0.56555593",
"0.5655115",
"0.5616158"... | 0.7371776 | 0 |
Let's add a price modifier to the settings, then load it, then call a method on it to make sure it works. | def test_01_cart_modifier_pool_loads_modifiers_properly(self):
MODIFIERS = [
'shop.cart.modifiers.tax_modifiers.TenPercentGlobalTaxModifier']
with SettingsOverride(SHOP_CART_MODIFIERS=MODIFIERS):
thelist = modifiers_pool.cart_modifiers_pool.get_modifiers_list()
self.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __create_update_price_modifiers(key, value, modifier_map):\n (_, identifier, field_name) = validate.regex_match_modifiers(key)\n\n modifier = modifier_map.get(identifier, dict())\n\n if value is not None and not value.isalpha():\n value = value.replace('$', '')\n value = validate.is_vali... | [
"0.5401929",
"0.5398447",
"0.5264956",
"0.5263192",
"0.5233313",
"0.5225037",
"0.50494987",
"0.50227",
"0.5001838",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.49951902",
"0.496... | 0.6693661 | 0 |
Scans and memoizes all nontrivial entity hooks. | def refresh_entity_hooks(self):
for hook_name in HOOK_NAMES:
hooks = []
for entity in self._task.root_entity.iter_entities():
entity_hook = getattr(entity, hook_name)
# Ignore any hook that is a no-op to avoid function call overhead.
if not _callable_is_trivial(entity_hook):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _apply_hooks(\n context: HookContext, hooks: HookDispatcher, strategy: st.SearchStrategy[Case], location: str\n) -> st.SearchStrategy[Case]:\n container = LOCATION_TO_CONTAINER[location]\n for hook in hooks.get_all_by_name(f\"before_generate_{container}\"):\n strategy = hook(context, strategy)\... | [
"0.54932904",
"0.5307784",
"0.52845526",
"0.5261744",
"0.523551",
"0.519652",
"0.51915973",
"0.51147115",
"0.5096828",
"0.50686115",
"0.5031074",
"0.500587",
"0.49608418",
"0.49489692",
"0.49116755",
"0.48470926",
"0.48053527",
"0.4803118",
"0.4792423",
"0.47914103",
"0.47734... | 0.67347914 | 0 |
Creates a new Physics using the latest MJCF model from the task. | def _recompile_physics(self):
if getattr(self, '_physics', None):
self._physics.free()
self._physics = mjcf.Physics.from_mjcf_model(
self._task.root_entity.mjcf_model) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_model(self) -> None:\n self._model = create_model_with_temperature_scaling(self.config)",
"def create(cls, task_name, cfd_mesh):\n if task_name not in cls._available_tasks:\n raise KeyError(\"Invalid task name: %s\"%task_name)\n tcls = cls._available_tasks[task_name]\n ... | [
"0.58101165",
"0.56875163",
"0.5579714",
"0.5562471",
"0.55113566",
"0.5511043",
"0.5350944",
"0.53346694",
"0.5327134",
"0.5297994",
"0.5289999",
"0.5287961",
"0.5266746",
"0.52496046",
"0.524225",
"0.5231731",
"0.5223686",
"0.52091223",
"0.51993084",
"0.51845074",
"0.516047... | 0.6277442 | 0 |
Returns a `weakref.ProxyType` pointing to the current `mjcf.Physics`. Note that the underlying `mjcf.Physics` will be destroyed whenever the MJCF model is recompiled. It is therefore unsafe for external objects to hold a reference to `environment.physics`. Attempting to access attributes of a dead `Physics` instance wi... | def physics(self):
return self._physics_proxy | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def physics_type(self):\n return self._get_physics_type()",
"def _recompile_physics(self):\n if getattr(self, '_physics', None):\n self._physics.free()\n self._physics = mjcf.Physics.from_mjcf_model(\n self._task.root_entity.mjcf_model)",
"def net_alchemical_force(self):\n retur... | [
"0.6687715",
"0.6192828",
"0.54551363",
"0.52891564",
"0.5210657",
"0.50008684",
"0.4992405",
"0.4900569",
"0.48929566",
"0.48858643",
"0.4878047",
"0.4764205",
"0.47636336",
"0.47470704",
"0.47321174",
"0.47266316",
"0.46804094",
"0.46572185",
"0.4656365",
"0.4646913",
"0.46... | 0.7240104 | 0 |
Describes the reward returned by this environment. This will be the output of `self.task.reward_spec()` if it is not None, otherwise it will be the default spec returned by `dm_env.Environment.reward_spec()`. | def reward_spec(self):
task_reward_spec = self._task.get_reward_spec()
if task_reward_spec is not None:
return task_reward_spec
else:
return super(Environment, self).reward_spec() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reward(self):\n return self._reward",
"def reward(self) -> float:\n\n if not self._reward_provided:\n self._reward_provided = True\n return self._reward\n\n return 0",
"def _get_reward(self):\n if self.status():\n return self.current_step/self.ep_length # ... | [
"0.7284608",
"0.711442",
"0.6816103",
"0.6748322",
"0.67263234",
"0.67089385",
"0.66217846",
"0.657204",
"0.6561018",
"0.65577865",
"0.65072244",
"0.6432149",
"0.64281243",
"0.64074045",
"0.6405595",
"0.6353284",
"0.63424635",
"0.6261873",
"0.62002194",
"0.61989987",
"0.61448... | 0.78244424 | 0 |
Describes the discount returned by this environment. This will be the output of `self.task.discount_spec()` if it is not None, otherwise it will be the default spec returned by `dm_env.Environment.discount_spec()`. | def discount_spec(self):
task_discount_spec = self._task.get_discount_spec()
if task_discount_spec is not None:
return task_discount_spec
else:
return super(Environment, self).discount_spec() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def discounted(self):\n return self._discounted",
"def discount_amount(self):\n return self._discount_amount",
"def discount(self):\r\n return DiscountResource(self)",
"def make_test_discount(self):\n return Discount()",
"def get_discount(self, price):\r\n pass",
"def c... | [
"0.630877",
"0.6280058",
"0.61775196",
"0.6125317",
"0.5985453",
"0.582354",
"0.57208353",
"0.57101107",
"0.5703723",
"0.56657386",
"0.5641902",
"0.56034434",
"0.5523278",
"0.5502888",
"0.5472991",
"0.5471211",
"0.5408042",
"0.538245",
"0.5368142",
"0.53592867",
"0.5344118",
... | 0.785936 | 0 |
Returns the observation specification for this environment. | def observation_spec(self):
return self._observation_updater.observation_spec() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observation_spec(self):\n return self._observation_spec",
"def observation_spec(self):\r\n pass",
"def observation_spec(self) -> Dict[str, Any]:",
"def observation_spec(self):\n observation_specs = {\n name: observer.observation_spec()\n for name, observer in se... | [
"0.8197049",
"0.7521371",
"0.7124413",
"0.7098681",
"0.7007113",
"0.6571844",
"0.6571844",
"0.6571844",
"0.63408303",
"0.6337267",
"0.6337267",
"0.61973697",
"0.61973697",
"0.6184182",
"0.61484206",
"0.6121121",
"0.5976088",
"0.59630907",
"0.58521813",
"0.5799161",
"0.5636848... | 0.798817 | 1 |
Creates a dataframe called dfDates by passing a start_date and end_date | def create_dates_dataframe(start_date,end_date):
DateList = [start_date]
while max(DateList) < end_date:
DateKey = max(DateList) + timedelta(days=1)
DateList.append(DateKey)
DateList.sort()
dfDates = pd.DataFrame(pd.to_datetime(DateList), columns = ['DateKey'])
return dfDates | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dataframe(start_date=INITIAL_DATE, end_date=None) -> pd.DataFrame:\n\n end_date = (\n end_date\n if end_date is not None\n else dt.datetime.utcnow() - dt.timedelta(days=1)\n ).date()\n\n dates = pd.date_range(start_date, end_date)\n\n with futures.ThreadPoolExecutor() as ex... | [
"0.7376108",
"0.7361266",
"0.69451666",
"0.6934058",
"0.6681604",
"0.66222554",
"0.6496288",
"0.6488919",
"0.6469713",
"0.6324548",
"0.62931514",
"0.6251764",
"0.6247517",
"0.62450945",
"0.6190501",
"0.6179699",
"0.6161607",
"0.6150894",
"0.6150894",
"0.61377776",
"0.6132888"... | 0.80828166 | 0 |
Make a cross join (cartesian product) between two dataframes by using a constant temporary key. Also sets a MultiIndex which is the cartesian product of the indices of the input dataframes. | def dataframe_crossjoin(df1, df2, **kwargs):
df1['_tmpkey'] = 1
df2['_tmpkey'] = 1
res = pd.merge(df1, df2, on='_tmpkey', **kwargs).drop('_tmpkey', axis=1)
res.index = pd.MultiIndex.from_product((df1.index, df2.index))
df1.drop('_tmpkey', axis=1, inplace=True)
df2.drop('_tmpkey', axis=1, inpla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cross(df1, df2, **kwargs):\r\n df1['_tmpkey'] = 1\r\n df2['_tmpkey'] = 1\r\n\r\n res = pd.merge(df1, df2, on='_tmpkey', **kwargs).drop('_tmpkey', axis=1)\r\n res.index = pd.MultiIndex.from_product((df1.index, df2.index))\r\n\r\n df1.drop('_tmpkey', axis=1, inplace=True)\r\n df2.drop('_tmpkey'... | [
"0.81467605",
"0.81443954",
"0.71390814",
"0.59914374",
"0.59035194",
"0.57073027",
"0.5670425",
"0.5616074",
"0.54027313",
"0.5352004",
"0.5317544",
"0.5309182",
"0.5286443",
"0.52507704",
"0.5247948",
"0.52383626",
"0.52379304",
"0.5214881",
"0.52071345",
"0.51398855",
"0.5... | 0.82196695 | 0 |
Processes an audio file into an Example proto. | def create_example(filename, hparams):
wav_data = audio_io.samples_to_wav_data( # class bytes
librosa.util.normalize(librosa.core.load(
filename, sr=hparams.sample_rate)[0]), hparams.sample_rate)
example = tf.train.Example(features=tf.train.Features(feature={
'id':
tf... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_example(filename, sample_rate, load_audio_with_librosa):\n wav_data = tf.gfile.Open(filename, 'rb').read()\n example_list = list(\n audio_label_data_utils.process_record(\n wav_data=wav_data,\n sample_rate=sample_rate,\n ns=music_pb2.NoteSequence(),\n ... | [
"0.66682696",
"0.63421124",
"0.6330964",
"0.63157487",
"0.6230479",
"0.61547005",
"0.6040891",
"0.59767234",
"0.5903792",
"0.5826872",
"0.58114284",
"0.57510334",
"0.5736071",
"0.5734026",
"0.57185847",
"0.5672172",
"0.56704783",
"0.5592936",
"0.5587452",
"0.5546548",
"0.5509... | 0.6479555 | 1 |
(Convenience function) Return the norm of the baseline between antennae and | def baselength(ant_ID1, ant_ID2):
return np.linalg.norm(baseline(ant_ID1, ant_ID2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def baseline(spectra):\n\n return spectra - np.mean(spectra, axis=0)",
"def norm(self):",
"def norm_ape(self) -> float:\n return float(np.sqrt(np.sum(np.square(self._percentage_error() - self.mape())) / (len(self.true) - 1)))",
"def baseline(ant_ID1, ant_ID2):\n return ant_pos[ant_ID2] - ant... | [
"0.6451244",
"0.6372604",
"0.6318515",
"0.6263118",
"0.625192",
"0.61706823",
"0.61667514",
"0.6159731",
"0.61566687",
"0.6152515",
"0.612216",
"0.6104494",
"0.6016858",
"0.5997538",
"0.59787655",
"0.5969085",
"0.5950784",
"0.5944063",
"0.59439176",
"0.5940242",
"0.592199",
... | 0.6484621 | 0 |
Calculate the baseline between antennae and by a simple difference of their coordinates. | def baseline(ant_ID1, ant_ID2):
return ant_pos[ant_ID2] - ant_pos[ant_ID1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def baseline(self):\n if getattr(self, \"_baseline\", None) is None:\n self._baseline = (self.container.height - 1) / 2\n return self._baseline",
"def baseline_height(self):\n if self.beam and self.beam.is_valid:\n # Refined beam has at least 2 per-scan baselines - obta... | [
"0.6836832",
"0.66321886",
"0.62977743",
"0.6219014",
"0.6213344",
"0.61114717",
"0.6101411",
"0.58687854",
"0.57778394",
"0.57766056",
"0.5720142",
"0.5669752",
"0.5663572",
"0.5662754",
"0.5615937",
"0.5612027",
"0.5597841",
"0.55699056",
"0.5561959",
"0.5561959",
"0.555880... | 0.7719002 | 0 |
Calculate the phase factor in the direction (l, m) (we assume that n is of insignificant magnitude) and at the frequency between two antennae whose ID s are and . When we calculate the baseline (u, v, w), we assume that w is of insignificant magnitude. | def phase_factor(ant1, ant2, r, nu=151e6):
b = baseline(ant1, ant2)[0:2] # kill w
br = np.dot(b, r)
return np.exp(-2j * np.pi * nu * br / c) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_phase(p, t):\n\n return (t % p)/p",
"def phase_lifetime(r, freq=1):\n return np.tan(np.angle(r)) / (2 * np.pi * freq)",
"def phase(self):\r\n return 0.2 * self.weights",
"def relative_phases(self):\r\n return np.angle(self.coherency)",
"def relative_phases(self):\r\n ret... | [
"0.6382303",
"0.60177404",
"0.59439707",
"0.59410644",
"0.59410644",
"0.5918118",
"0.59171",
"0.59152853",
"0.5896537",
"0.5891957",
"0.5855584",
"0.58490056",
"0.58345765",
"0.5806209",
"0.58017606",
"0.5787582",
"0.5785131",
"0.57164425",
"0.57159466",
"0.5712336",
"0.56823... | 0.65056306 | 0 |
Return the value of the field rendered for df. | def render_df(self, field: str) -> str:
value = self.__getattribute__(field)
if field in ["date", "workers"]:
return str(value)
elif field in ["locations", "struggles", "companies", "tags", "sources"]:
return str(value).strip("[").strip("]").replace("'", "").replace('"', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field(self):\r\n return self.value",
"def getValue(self):\n return self.field.value()",
"def getValue(self):\n return self.field.value()",
"def getValue(self):\n return self.field.text()",
"def getValue(self):\n return self.field.currentText()",
"def _value(self, ro... | [
"0.7245886",
"0.6686086",
"0.6686086",
"0.646056",
"0.638217",
"0.6314827",
"0.6311197",
"0.6303911",
"0.6258393",
"0.62353027",
"0.6215717",
"0.6215717",
"0.6215717",
"0.6215717",
"0.62007105",
"0.6190443",
"0.6178967",
"0.612278",
"0.61176664",
"0.60814285",
"0.60682887",
... | 0.78506464 | 0 |
Convert field for markdown Takes a td BeautifulSoup object and updates it according to the field type so that it renders correctly in markdown. | def to_md(self, field: str, td: bs4.element.Tag) -> str:
assert (
field in self.__dataclass_fields__
), f"Cannot serialize {field}. Not a valid field in Action."
value = self.__getattribute__(field)
if field in ["date", "workers"]:
td.string = str(value)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def markdown_unescape_field(model, field_name):\n setattr(model, field_name, markdown_unescape(getattr(model, field_name)))",
"def markdown_unescape_field(obj, field_name):\n if isinstance(obj, Model):\n setattr(obj, field_name,\n djblets_markdown.markdown_unescape(getattr(obj, field_... | [
"0.67622274",
"0.6483723",
"0.6274827",
"0.6074001",
"0.60647833",
"0.6060771",
"0.5983518",
"0.5848693",
"0.58304775",
"0.5717892",
"0.57109666",
"0.57083356",
"0.569018",
"0.5662428",
"0.5593534",
"0.5581412",
"0.55783105",
"0.5533869",
"0.5522005",
"0.5507499",
"0.54924184... | 0.6871704 | 0 |
Create an Action instance from a md table. | def create_from_md(cls, table: bs4.element.Tag) -> "Action":
a = {}
trs = table.find_all("tr")
for key, val in table.attrs.items():
if key != "class":
a[key] = val
for i, tr in enumerate(trs):
td_key = tr.find("td", class_="field-key")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_md(cls, md_doc: MarkdownDocument) -> \"Actions\":\n md_data = re.findall(fr'<div id=\"{cls.action_id}\">+[\\s\\S]+<\\/div>', md_doc)\n assert len(md_data) == 1, f\"multiple divs with id={cls.action_id} were found\"\n md_data = md_data[0]\n soup = BeautifulSoup(md_data, \"h... | [
"0.666644",
"0.59317386",
"0.58961225",
"0.5869714",
"0.57931435",
"0.57931435",
"0.56673735",
"0.56640005",
"0.5312523",
"0.51799715",
"0.5166762",
"0.5127067",
"0.50330085",
"0.50269014",
"0.49806857",
"0.49253443",
"0.49246252",
"0.49069986",
"0.48996797",
"0.48802152",
"0... | 0.83146924 | 0 |
Create an Action instance from a dataframe row. | def create_from_row(cls, row: pd.Series) -> "Action":
fields = [
key
for key, value in cls.__dataclass_fields__.items()
if value.type != ClassVar
]
d = {key: value for key, value in row.to_dict().items() if key in fields}
return cls(**d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_from_df(df: pd.DataFrame) -> \"Actions\":\n actions = Actions()\n for i, row in df.iterrows():\n action = Action.create_from_row(row)\n actions.append(action)\n return actions",
"def from_dataframe(cls, dataframe):\n return cls(dataframe)",
"def FromRo... | [
"0.7450033",
"0.6170774",
"0.5990652",
"0.58422154",
"0.5713543",
"0.55582273",
"0.5490763",
"0.54875004",
"0.5413658",
"0.539996",
"0.5394156",
"0.53519624",
"0.5331359",
"0.5267999",
"0.52194196",
"0.52122515",
"0.51671094",
"0.51299727",
"0.5126559",
"0.5064013",
"0.506401... | 0.78083163 | 0 |
Sorts the list of actions. | def sort(self, *args, **kwargs) -> "Actions":
self.actions.sort(*args, **kwargs)
return self | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort(self):\n self.tasks = sorted(self.tasks, key=lambda k: k.priority, reverse=True)",
"def reorder( self ):\n self.sorted.sort(self.compareFunction)",
"def sort(self):\n self.list.sort(key=lambda x: ''.join)",
"def sort(self):\r\n self.list.sort(key=lambda x: ''.join(x))",
... | [
"0.6750864",
"0.660031",
"0.6549552",
"0.65411633",
"0.6455784",
"0.6455784",
"0.64553297",
"0.643278",
"0.6385295",
"0.63739717",
"0.63254124",
"0.631707",
"0.63024896",
"0.62974167",
"0.6266015",
"0.6196876",
"0.6194629",
"0.6181447",
"0.6169255",
"0.6162588",
"0.6155766",
... | 0.805816 | 0 |
Append an action onto this instance of Actions. | def append(self, action: Action):
self.actions.append(action) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_action(self, action):\n self._actions.append(action)",
"def add_action(self, action: BaseAction):\n\n logger.debug(f'registering action {action}')\n self.actions.append(action)",
"def add_action(self, action):\n self.action = action",
"def add_action(self, action):\n ... | [
"0.86832625",
"0.8299085",
"0.8135429",
"0.8135429",
"0.766771",
"0.7395202",
"0.7291464",
"0.7283457",
"0.70902437",
"0.6955517",
"0.6937636",
"0.6888517",
"0.6871711",
"0.6853858",
"0.6812504",
"0.6760585",
"0.6725914",
"0.6649311",
"0.65724874",
"0.65606445",
"0.6557143",
... | 0.904249 | 0 |
Converts this instance of Actions to a df. | def to_df(self) -> pd.DataFrame:
data = []
for action in self.actions:
data.append(action.to_df())
df = pd.read_json(json.dumps(data), orient="list")
return df[self.fields] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_df(self):\n return pd.DataFrame([dict(self)])",
"def to_df(self):\n return pd.DataFrame([dict(self)])",
"def to_df(self):\n return pd.DataFrame([dict(self)])",
"def to_df(self):\n return pd.DataFrame([dict(self)])",
"def to_df(self):\n return pd.DataFrame([dict(sel... | [
"0.7052811",
"0.7052811",
"0.7052811",
"0.7052811",
"0.7052811",
"0.704461",
"0.66909885",
"0.65945745",
"0.6583666",
"0.65026647",
"0.6496791",
"0.64873725",
"0.64673084",
"0.6423704",
"0.6396283",
"0.63379693",
"0.6311073",
"0.6303729",
"0.62922996",
"0.62855774",
"0.627629... | 0.86642236 | 0 |
Convert this instance of Actions to markdown/HTML. | def to_md(self):
soup = BeautifulSoup(f"<div id={self.action_id}></div>", "html.parser")
for action in self.actions:
table = soup.new_tag("table")
soup.div.append(table)
for meta_field in Action._meta_fields:
table[meta_field] = action.__getattribute__... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_markdown(self):\n s = \"[\" + self.label + \"]\"\n if self.is_reflink:\n s += \": \" + self.url\n else:\n s += \"(\" + self.url + \")\"\n return s",
"def __formatToHtml(self, recommendedActions: List[Dict[str, str]]) -> str:\n recommendedSteps = []\... | [
"0.6700692",
"0.62819725",
"0.61019474",
"0.6031709",
"0.60275227",
"0.59863985",
"0.58994997",
"0.58777225",
"0.585601",
"0.5854592",
"0.5813436",
"0.57863355",
"0.5765884",
"0.5754859",
"0.5721884",
"0.57139605",
"0.5710462",
"0.5684506",
"0.5623157",
"0.56181914",
"0.56148... | 0.7104706 | 0 |
Create and populate an Actions instance from a Markdown Document. | def read_from_md(cls, md_doc: MarkdownDocument) -> "Actions":
md_data = re.findall(fr'<div id="{cls.action_id}">+[\s\S]+<\/div>', md_doc)
assert len(md_data) == 1, f"multiple divs with id={cls.action_id} were found"
md_data = md_data[0]
soup = BeautifulSoup(md_data, "html.parser")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_markdown(self):\n renderer = MyRenderer()\n md = mistune.Markdown(renderer=renderer)\n md.render(self._markdown_text)\n self._bash_commands = renderer._bash_commands",
"def __init__(self, doc, artDirection, path=None, mdText=None, startPage=1,\n name=None, **kwar... | [
"0.53123885",
"0.5283563",
"0.51251745",
"0.50680196",
"0.49466327",
"0.4878446",
"0.48407146",
"0.46644166",
"0.46518624",
"0.46409634",
"0.46352047",
"0.46063307",
"0.45948508",
"0.45946482",
"0.4590695",
"0.4575447",
"0.45685115",
"0.4545301",
"0.45294997",
"0.45218614",
"... | 0.7191003 | 0 |
Create and populate an Actions instance from a dataframe. | def read_from_df(df: pd.DataFrame) -> "Actions":
actions = Actions()
for i, row in df.iterrows():
action = Action.create_from_row(row)
actions.append(action)
return actions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dataframe(cls, df, data_cls):\n pass",
"def from_dataframe(cls, dataframe):\n return cls(dataframe)",
"def to_df(self) -> pd.DataFrame:\n data = []\n for action in self.actions:\n data.append(action.to_df())\n df = pd.read_json(json.dumps(data), orient=\"l... | [
"0.6376314",
"0.62171835",
"0.61774087",
"0.61188424",
"0.5571766",
"0.54238445",
"0.53674656",
"0.5364075",
"0.53555757",
"0.53466356",
"0.5298514",
"0.52791834",
"0.52594185",
"0.52458936",
"0.52094465",
"0.51978266",
"0.5179351",
"0.51169455",
"0.5114981",
"0.5038581",
"0.... | 0.822363 | 0 |
Load the requested journal | def load(name):
jrn_path = build_path(name)
if not os.path.exists(jrn_path):
print(f'... journal file \'{jrn_path}\' does not exist ...')
print('... initializing new journal ...')
with open(jrn_path, 'w') as file:
pass
return []
else:
print(f'... loading j... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(journal: Journal, file: Path) -> None:",
"def getJournal(self):\n if 'journal' in self.extras: \n return self.extras['journal']\n #--Default \n self.extras['journal'] = _('[No Journal Record Found.]')\n #--Open save file and look for journal entry\n inPath =... | [
"0.8061932",
"0.66369516",
"0.61857927",
"0.61656517",
"0.58804095",
"0.5755738",
"0.5633216",
"0.5570596",
"0.55279833",
"0.5516685",
"0.5497263",
"0.5485919",
"0.5451337",
"0.53860325",
"0.53600425",
"0.5352979",
"0.5352979",
"0.53500277",
"0.5342552",
"0.5341046",
"0.53363... | 0.7134312 | 1 |
save journal and exit program | def save_exit(name, data):
jrn_path = build_path(name)
print(f'... saving new journal entries to {jrn_path} ...')
with open(jrn_path, 'w') as file:
for line in data:
file.write(line + '\n')
print('... save complete ...') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def atexit_operations(self):\n\n # input history\n self.savehist()\n\n # Cleanup all tempfiles left around\n for tfile in self.tempfiles:\n try:\n os.unlink(tfile)\n except OSError:\n pass\n\n # save the \"persistent data\" catc... | [
"0.6992078",
"0.6672989",
"0.63447386",
"0.61931944",
"0.6177601",
"0.6061689",
"0.6007395",
"0.5989892",
"0.5950258",
"0.59390515",
"0.58860475",
"0.58747995",
"0.58730984",
"0.5869995",
"0.5836056",
"0.5784641",
"0.5780053",
"0.5768109",
"0.57471186",
"0.57455045",
"0.57403... | 0.7477796 | 0 |
we sum each column of the inverted image. The columns should show up as peaks in the sums uses scipy.signal.find_peaks to find those peaks and use them as column indexes | def createColumnImages(img, basename, directory):
files = []
temp_img = convertToGrayscale(img)
temp_img = invert(temp_img)
temp_img = dilateDirection(temp_img)
sums = np.sum(temp_img, axis = COLUMNS)
sums[0] = 1000 # some random value so that find_peaks properly detects the peak for t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def energy_map(img):\n img_new = img.astype(float) #converting image to float\n total_energy = 0.0 # To store the sum of energy for all channels\n r,c,d = img.shape \n for i in range(d):\n dy = np.zeros([r, c], dtype=float) \n dx = np.zeros([r, c], dtype=float)\n if r > 1:\n ... | [
"0.5717793",
"0.56370825",
"0.54898673",
"0.5456523",
"0.53876954",
"0.5356704",
"0.53351176",
"0.5308954",
"0.52943933",
"0.52759457",
"0.5257518",
"0.5164766",
"0.51455396",
"0.51121944",
"0.51008034",
"0.50832224",
"0.5080768",
"0.5080622",
"0.504817",
"0.50435597",
"0.503... | 0.6545618 | 0 |
Encodes the datset using the specified tokenizer | def encode(batch, tokenizer):
return tokenizer.batch_encode_plus(batch['sentence'], padding='max_length') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_datset_train_tokenization(dataset,tokenizer,tokenizer_trainer,batch_size : int):\n def make_batch_iter(dataset):\n for i in range(0, len(dataset), batch_size):\n yield dataset[i : i + batch_size][\"code\"]\n tokenizer.train_from_iterator(make_batch_iter(), trainer=tokenizer_trainer... | [
"0.6543669",
"0.60095066",
"0.58805245",
"0.58645904",
"0.5772518",
"0.5714913",
"0.5704001",
"0.5596012",
"0.55420864",
"0.5484476",
"0.5465402",
"0.54140276",
"0.5384169",
"0.537915",
"0.5338198",
"0.53048414",
"0.52819514",
"0.52666897",
"0.52389973",
"0.5219068",
"0.52019... | 0.6225287 | 1 |
Fills up the car's Fuel | def fill_up(self):
self.fuel = self.gas_tank_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_fuel(self):\n self._fuel = self._calculate_fuel_r(self._mass)",
"def fill_tank(self):\r\n self.fuel_level = self.fuel_capacity",
"def fill_tank(self):\r\n self.fuel_level = self.fuel_capacity\r\n print(\"Fuel tank is full\")",
"def fill_tank(self):\n self.fue... | [
"0.7378566",
"0.724516",
"0.7014073",
"0.7012993",
"0.7012993",
"0.6589794",
"0.6501443",
"0.64590937",
"0.6230165",
"0.6120655",
"0.6022268",
"0.6022268",
"0.59986377",
"0.599274",
"0.59406894",
"0.59405994",
"0.5890774",
"0.5882069",
"0.58557856",
"0.5831565",
"0.58273375",... | 0.7999962 | 0 |
Remove the amount of fuel, based on distance driven | def drive(self, kilometres_driven):
self.fuel -= (self.litres_per_kilometre * kilometres_driven) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _calculate_fuel_simple(self):\n self._fuel_simple = (self.mass // 3) - 2",
"def compact(self, distance=2):\n pass",
"def get_remaining_fuel(self):\n return min(self.liquid_fuel, self.oxidizer)",
"def remove_energy_consumption_from_unavailable_vehicles(self):\n\n # we flag cars... | [
"0.57630485",
"0.57378715",
"0.57348025",
"0.5663492",
"0.56254464",
"0.5596029",
"0.55287725",
"0.5506817",
"0.54561925",
"0.5443969",
"0.54234725",
"0.5422049",
"0.5418787",
"0.54036295",
"0.5398828",
"0.5350269",
"0.5344612",
"0.5335128",
"0.53332967",
"0.5316582",
"0.5310... | 0.5826325 | 0 |
Return the number of kilometers that the car could drive with the current amount of fuel | def kilometres_available(self):
return self.fuel / self.litres_per_kilometre | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def car_cost(self,car,car_stations):\n car_cost = car.capacity # Aqui le deberiamos aumentar el peso\n #de acuerdo a la capacidad del carro y la cantidad de lugares \n #en la estacion\n return car_stations",
"def fuel_calc(mass):\n return max((mass / 3) - 2, 0)",
"def distance_betw... | [
"0.661191",
"0.64701277",
"0.6244502",
"0.6227709",
"0.61918616",
"0.6186821",
"0.6109732",
"0.6107541",
"0.6093332",
"0.6087604",
"0.6075328",
"0.60385",
"0.60379356",
"0.602898",
"0.5992731",
"0.5970651",
"0.5968693",
"0.5967135",
"0.5958971",
"0.59395933",
"0.59244424",
... | 0.7633903 | 0 |
test delete cascade of client | def test_client_delete_cascade(self):
assert 12 == self.session.query(Invoice).count()
assert 24 == self.session.query(Iitem).count()
assert 48 == self.session.query(Citem).count()
assert 12 == self.session.query(Contract).count()
assert 4 == self.session.query(Employee).count()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_client(self):\n pass",
"def test_client_nationlity_delete(self):\n pass",
"def test_05_delete_client(self):\n try:\n for k, v in self.test_data.items():\n client = Client()\n test_str = v.split(',')\n client.user_id = ... | [
"0.8247567",
"0.7930924",
"0.78829575",
"0.74679774",
"0.73994315",
"0.7352157",
"0.7331069",
"0.7077141",
"0.70686513",
"0.7064528",
"0.7021556",
"0.7006687",
"0.6991396",
"0.6982793",
"0.6970468",
"0.6952109",
"0.6923533",
"0.6891509",
"0.68763953",
"0.6858841",
"0.6839468"... | 0.84361404 | 0 |
SPM HRF function from sum of two gamma PDFs This function is designed to be partially compatible with SPMs `spm_hrf.m` function. The SPN HRF is a peak gamma PDF (with location `peak_delay` and dispersion `peak_disp`), minus an undershoot gamma PDF (with location `under_delay` and dispersion `under_disp`, and divided by... | def spm_hrf_compat(t,
peak_delay=6,
under_delay=16,
peak_disp=1,
under_disp=1,
p_u_ratio = 6,
normalize=True,
):
if len([v for v in [peak_delay, peak_disp, under_delay, under_disp]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def g0_hz(sp,cal_Veff = 5e-3, V_pi = None, askFit = True,T = 293,PM_calib_file = \"M:\\\\phaseModulationCalibrations\\\\V_pi1550.spe\"):#V_pi = 7.1\n \n cal_Veff = addDefaultUnit(cal_Veff,V)\n T = addDefaultUnit(T,K)\n f = sp.fitter\n if not isinstance(sp.fitter,fit.FitterLorentzAndGauss):\n ... | [
"0.5862923",
"0.5721346",
"0.53323734",
"0.5312868",
"0.5214165",
"0.52100307",
"0.5155407",
"0.513588",
"0.5106559",
"0.5069951",
"0.50463253",
"0.5001016",
"0.4977515",
"0.497188",
"0.49632442",
"0.49322107",
"0.4928783",
"0.49214113",
"0.4920459",
"0.4919216",
"0.49125183"... | 0.7192134 | 0 |
SPM canonical HRF, HRF values for time values `t` This is the canonical HRF function as used in SPM. It | def spmt(t):
return spm_hrf_compat(t, normalize=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def t0shft(t,P,t0):\n t = t.copy()\n dt = 0\n\n t -= t0 # Shifts the timeseries s.t. transits are at 0,P,2P ...\n dt -= t0\n\n # The first transit is at t = nFirstTransit * P\n nFirstTrans = np.ceil(t[0]/P) \n dt -= nFirstTrans*P \n\n return dt",
"def dspmt(t):\n t = np.asarray(t)\n... | [
"0.6297978",
"0.6254013",
"0.62385476",
"0.59057575",
"0.5887309",
"0.5848774",
"0.5797152",
"0.5715426",
"0.57009876",
"0.5688594",
"0.5671279",
"0.5665372",
"0.56517905",
"0.56217635",
"0.5608033",
"0.5582303",
"0.554004",
"0.5528651",
"0.5505442",
"0.55003494",
"0.5485473"... | 0.7174997 | 0 |
SPM canonical HRF derivative, HRF derivative values for time values `t` This is the canonical HRF derivative function as used in SPM. It is the numerical difference of the HRF sampled at time `t` minus the values sampled at time `t` 1 | def dspmt(t):
t = np.asarray(t)
return spmt(t) - spmt(t - 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drift_fn(model, x, t):\n score_fn = get_score_fn(sde, model, train=False)\n rsde = sde.reverse(score_fn, probability_flow=True)\n return rsde.sde(x, t)[0]",
"def instantFwd(self, T, h=0.0001):\r\n der = (np.log(self.P_M(T+h))-np.log(self.P_M(T-h)))/2*h\r\n return -der",
"... | [
"0.66334814",
"0.660244",
"0.6574317",
"0.6545996",
"0.65438646",
"0.65089315",
"0.65089315",
"0.6424046",
"0.639276",
"0.63296604",
"0.6318173",
"0.62752116",
"0.61187786",
"0.6107205",
"0.6099191",
"0.6091156",
"0.60870725",
"0.6071824",
"0.6061604",
"0.60401106",
"0.600808... | 0.70634705 | 0 |
SPM canonical HRF dispersion derivative, values for time values `t` This is the canonical HRF dispersion derivative function as used in SPM. It is the numerical difference between the HRF sampled at time `t`, and values at `t` for another HRF shape with a small change in the peak | def ddspmt(t):
return (spmt(t) - _spm_dd_func(t)) / 0.01 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dspmt(t):\n t = np.asarray(t)\n return spmt(t) - spmt(t - 1)",
"def compute_dewpoint(t,h):\n\n tempC = (t-32)*5/9 #convert from deg F to deg C\n rh = h/100\n\n b = 18.678\n c = 257.14 #deg C\n\n gamma = math.log(rh)+(b*tempC)/(c+tempC)\n tdp = c*gamma/(b-gamma)\n\n tdp_F = 9/5*tdp ... | [
"0.65601486",
"0.6276826",
"0.62321556",
"0.61545813",
"0.6146959",
"0.6102474",
"0.6099014",
"0.60560775",
"0.60290974",
"0.59620625",
"0.5952291",
"0.58474",
"0.57840955",
"0.57832676",
"0.5753513",
"0.5744639",
"0.57421285",
"0.57421285",
"0.5741198",
"0.57375777",
"0.5736... | 0.63825226 | 1 |
Give a laika GPSTime object for the given time string | def gpstime_fromstr(timestr: str) -> GPSTime:
return GPSTime.from_datetime(datetime.strptime(timestr, "%Y-%m-%d")) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_from_string(time):\n _type = type(time)\n try:\n if _type == datetime.time:\n return time\n elif _type == datetime.datetime:\n return datetime.datetime.time(time)\n else:\n try:\n return datetime.datetime.time(datetime.datetime.str... | [
"0.75480986",
"0.7298038",
"0.72171795",
"0.72087836",
"0.7159023",
"0.71491885",
"0.7112612",
"0.70903695",
"0.70088893",
"0.69227946",
"0.6875086",
"0.6873041",
"0.6861174",
"0.68290454",
"0.6786592",
"0.6736096",
"0.6729889",
"0.6726104",
"0.6647806",
"0.6638368",
"0.66195... | 0.7937386 | 0 |
Opens a RINEX file and looks in the headers for the station's position | def station_location_from_rinex(rinex_path: str) -> Optional[types.ECEF_XYZ]:
xyz = None
lat = None
lon = None
height = None
with open(rinex_path, "rb") as filedat:
for _ in range(50):
linedat = filedat.readline()
if b"POSITION XYZ" in linedat:
xyz = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rinex_info(rinex_fname,\n nav_fname,\n work_path=None):\n if not os.path.isfile(rinex_fname):\n raise ValueError('RINEX observation file {} does not exist'.format(rinex_fname))\n if not os.path.isfile(nav_fname):\n raise ValueError('RINEX navigation file {} does ... | [
"0.5984605",
"0.56610113",
"0.56274825",
"0.5590077",
"0.5464356",
"0.5459087",
"0.544624",
"0.54359317",
"0.54272556",
"0.5405764",
"0.5372955",
"0.53684723",
"0.5320453",
"0.5320453",
"0.5315182",
"0.5309052",
"0.5268431",
"0.52528477",
"0.52447104",
"0.52425325",
"0.523901... | 0.6337787 | 0 |
create new connections entry for a new pca | def addPCA(self,pcaId):
self.openConnections[pcaId]=set() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_conn(self, a1, a2):\n if self.use_pconn:\n raise ValueError(\"Can not add bonds to systems with pconn - well, we can fix this ;) \")\n self.conn[a1].append(a2)\n self.conn[a2].append(a1)\n d,v,imgi = self.get_distvec(a1,a2)\n self.pconn[a1].append(images[imgi])... | [
"0.6130992",
"0.610374",
"0.60056",
"0.56695604",
"0.5598425",
"0.55005217",
"0.5487705",
"0.54763985",
"0.5470526",
"0.54506135",
"0.540509",
"0.5366453",
"0.53416806",
"0.53134257",
"0.52898943",
"0.52859",
"0.52717245",
"0.52390325",
"0.5209636",
"0.5180201",
"0.51329464",... | 0.65222394 | 0 |
remove open connections for a pca | def removePCA(self,pcaId):
if pcaId in self.openConnections:
del self.openConnections[pcaId] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def killconnections(self):\n for conn in self._connections:\n try:conn.close()\n except:pass\n self._connections=[]",
"def delConns(self):\r\n for line in self.connLines:\r\n self.canvasCirkt.delete(line)\r\n self.canvasCirkt.update()",
"def remove_c... | [
"0.6531249",
"0.62973726",
"0.62702227",
"0.62407535",
"0.6209398",
"0.6208054",
"0.61334765",
"0.60495514",
"0.604046",
"0.6017139",
"0.598172",
"0.59516555",
"0.59455156",
"0.5886622",
"0.58595043",
"0.58093405",
"0.5800065",
"0.5793603",
"0.5774142",
"0.5766303",
"0.576163... | 0.7227091 | 0 |
adds a user with a authentification token | def addUser(self,username,token):
self.user_tokens[username] = token | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user_to_g():\n if \"Authorization\" in request.headers:\n token = request.headers[\"Authorization\"]\n payload = jwt.decode(token, app.config.get(\n 'SECRET_KEY'), algorithms=[\"HS256\"])\n\n if \"username\" in payload:\n g.user = User.query.filter_by(username=... | [
"0.7462619",
"0.73011166",
"0.7166944",
"0.701359",
"0.6978779",
"0.6921255",
"0.69086087",
"0.6850173",
"0.68355024",
"0.67927223",
"0.6751605",
"0.6690581",
"0.6675359",
"0.6674367",
"0.66498744",
"0.66407967",
"0.6628114",
"0.6619684",
"0.6605395",
"0.6560021",
"0.6556698"... | 0.78146493 | 0 |
add websocket to user and group sets | def addWebSocket(self,webSocket,group,user):
self.webSocketLocks[webSocket]=threading.Lock()
self.openConnections[group].add(webSocket)
self.openConnections[user].add(webSocket) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, websocket, name, group=None):\n\t\tself.websocket = websocket\n\t\tself.name = name\n\t\tself.group = group\n\t\tself.session = utilities.random_string(32)\n\t\tself.uid = utilities.random_string(32)\n\t\tself.active = 1\n\n\t\tshared.users.append(self)",
"async def register(websocket):\n a... | [
"0.6466919",
"0.6307626",
"0.6034622",
"0.5993273",
"0.59737545",
"0.5941978",
"0.58086157",
"0.5794253",
"0.5786319",
"0.5781917",
"0.5758896",
"0.5744689",
"0.5729159",
"0.5716774",
"0.5620582",
"0.56041837",
"0.5584999",
"0.55606925",
"0.55547816",
"0.55535656",
"0.5470171... | 0.7704391 | 0 |
remove websocket from groups | def removeWebSocket(self,webSocket,group,user):
if group in self.openConnections and webSocket in self.openConnections[group]:
self.openConnections[group].remove(webSocket)
if user in self.openConnections and webSocket in self.openConnections[user]:
self.openConnections[user].rem... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_mailing_list_group(sender, instance, **kwargs):\n\tname = instance.name\n\treturn requests.delete(\"https://api.mailgun.net/v3/lists/{}@arenbergorkest.be\".format(name),auth=('api', settings.MAILGUN_API_KEY))",
"async def websocket_disconnect(self, event):\n\n await self.channel_layer.group_dis... | [
"0.6432472",
"0.6282162",
"0.6267116",
"0.62454146",
"0.622023",
"0.6205093",
"0.61887324",
"0.60645133",
"0.60641783",
"0.6054499",
"0.6029896",
"0.6028009",
"0.5997941",
"0.59604615",
"0.5945879",
"0.5898059",
"0.58830583",
"0.58699346",
"0.5854946",
"0.580604",
"0.5777142"... | 0.7200737 | 0 |
send update to a websocket pca group | def sendUpdate(self,update,pcaId):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_sendUpdate(update,pcaId)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def __async_sendUpdate(self,update,pcaId):\n message = {\n \"type\": \"state\",\n \"message\": update,\n \"origin\" : pcaId,\n }\n if pcaId in self.openConnections and self.openConnections[pcaId]:\n #await asyncio.wait([user.send(json.dumps(mes... | [
"0.7219413",
"0.61536247",
"0.60943794",
"0.59595025",
"0.592219",
"0.5746953",
"0.5663877",
"0.5655345",
"0.5642729",
"0.55866903",
"0.5577151",
"0.55750835",
"0.5572997",
"0.5557421",
"0.55495125",
"0.55271304",
"0.5504903",
"0.5478009",
"0.5442547",
"0.5437821",
"0.5428839... | 0.6881366 | 1 |
send update to a websocket pca group | async def __async_sendUpdate(self,update,pcaId):
message = {
"type": "state",
"message": update,
"origin" : pcaId,
}
if pcaId in self.openConnections and self.openConnections[pcaId]:
#await asyncio.wait([user.send(json.dumps(message)) for user in s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendUpdate(update,pcaId))",
"def sendLogUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendLogUpdate(update,pcaId))",
"def sendUpdate(... | [
"0.68808544",
"0.6153006",
"0.6093909",
"0.5958259",
"0.59209234",
"0.57459795",
"0.56620014",
"0.5654551",
"0.5642542",
"0.5585612",
"0.5578645",
"0.55729544",
"0.55711675",
"0.5557949",
"0.55471057",
"0.55246735",
"0.550237",
"0.5476655",
"0.54404104",
"0.5438445",
"0.54274... | 0.72186065 | 0 |
send logupdate to a pca group | def sendLogUpdate(self,update,pcaId):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_sendLogUpdate(update,pcaId)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def __async_sendLogUpdate(self,logmessage,pcaId):\n message = {\n \"type\": \"log\",\n \"message\": logmessage,\n \"origin\": pcaId\n }\n if pcaId in self.openConnections and self.openConnections[pcaId]:\n await asyncio.wait([self.__async_send(... | [
"0.6385476",
"0.5962748",
"0.5728788",
"0.56958264",
"0.5578072",
"0.550695",
"0.54320204",
"0.53694946",
"0.5313997",
"0.5300338",
"0.52386427",
"0.5237516",
"0.5202878",
"0.5175928",
"0.51740235",
"0.51641834",
"0.5160995",
"0.5148698",
"0.51391417",
"0.5124863",
"0.5119094... | 0.6950007 | 0 |
send logupdate to a pca group | async def __async_sendLogUpdate(self,logmessage,pcaId):
message = {
"type": "log",
"message": logmessage,
"origin": pcaId
}
if pcaId in self.openConnections and self.openConnections[pcaId]:
await asyncio.wait([self.__async_send(user,message,self.we... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sendLogUpdate(self,update,pcaId):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_sendLogUpdate(update,pcaId))",
"def update_log(self, plog, clog):\n if plog:\n self.converter.update_log(plog)\n if clog:\n self.converter.update_log(clog)",
... | [
"0.6950007",
"0.5962748",
"0.5728788",
"0.56958264",
"0.5578072",
"0.550695",
"0.54320204",
"0.53694946",
"0.5313997",
"0.5300338",
"0.52386427",
"0.5237516",
"0.5202878",
"0.5175928",
"0.51740235",
"0.51641834",
"0.5160995",
"0.5148698",
"0.51391417",
"0.5124863",
"0.5119094... | 0.6385476 | 1 |
send iformation about a permission timeout to a user | def permissionTimeout(self,user):
l = asyncio.new_event_loop()
l.run_until_complete(self.__async_permissionTimeout(user)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def __async_permissionTimeout(self,userGroup):\n message = {\n \"type\": \"permissionTimeout\",\n }\n if userGroup in self.openConnections and self.openConnections[userGroup]:\n await asyncio.wait([user.send(json.dumps(message)) for user in self.openConnections[user... | [
"0.735895",
"0.62723875",
"0.62557316",
"0.6076344",
"0.59872735",
"0.59872735",
"0.57383454",
"0.57251614",
"0.5715892",
"0.56761515",
"0.5645125",
"0.55931556",
"0.55516267",
"0.55329835",
"0.55242723",
"0.54528105",
"0.54382324",
"0.5436949",
"0.5431201",
"0.5428595",
"0.5... | 0.7918334 | 0 |
send iformation about a permission timeout to a user | async def __async_permissionTimeout(self,userGroup):
message = {
"type": "permissionTimeout",
}
if userGroup in self.openConnections and self.openConnections[userGroup]:
await asyncio.wait([user.send(json.dumps(message)) for user in self.openConnections[userGroup]]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permissionTimeout(self,user):\n l = asyncio.new_event_loop()\n l.run_until_complete(self.__async_permissionTimeout(user))",
"def conversation_timeout(update: Update, _: CCT) -> int:\n cast(User, update.effective_user).send_message('Operation timed out. Aborting.')\n\n return ConversationH... | [
"0.7918026",
"0.6272327",
"0.6256113",
"0.6077857",
"0.5989232",
"0.5989232",
"0.5738815",
"0.5727099",
"0.5716373",
"0.5676011",
"0.5646385",
"0.5593294",
"0.5551698",
"0.55348635",
"0.55264735",
"0.54547036",
"0.54408455",
"0.5436361",
"0.54319614",
"0.5430947",
"0.54241943... | 0.7359067 | 1 |
Disables database tracking, prevents database events from being sent to the client. | def disable(self) -> Awaitable[Dict]:
return self.client.send("Database.disable", {}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_syncdb(self, db, model):\n return True",
"def allow_syncdb(self, db, model):\n return True",
"def allow_syncdb(self, db, model):\n\n return True",
"def disable_cached_db_connections():\n with _global_db_cache_lock:\n keys = list(_global_db_cache.keys())\n for key ... | [
"0.5871413",
"0.5871413",
"0.5855502",
"0.5736905",
"0.5704989",
"0.56463003",
"0.56001246",
"0.55956894",
"0.5552927",
"0.5543423",
"0.55383486",
"0.54480714",
"0.5447123",
"0.5431284",
"0.5429728",
"0.5425498",
"0.54150677",
"0.5394105",
"0.53505415",
"0.5348374",
"0.533530... | 0.60048616 | 0 |
Given a cient's PEM certificate in cert_string, return True if we allow the client access or False if we deny access. The allow/deny decision is based on comparing the certificate's Subject Alternative Name to a configured whitelist of allowed names. | def authorized_certificate(cert_string):
# parse the certificate data
try:
cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
cert_string)
except Exception, e:
print "Failed to parse certificate: %s" % (str(e))
return Fals... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_certificate_name(cert_file, robot_name) -> bool:\r\n if cert_file is None or robot_name is None:\r\n return False\r\n\r\n with open(cert_file, \"rb\") as f:\r\n cert_data = f.read()\r\n return EscapePod.get_certificate_name(cert_data) == robot_name",
"d... | [
"0.56414235",
"0.55414754",
"0.54304516",
"0.54140604",
"0.53200495",
"0.52936494",
"0.5283823",
"0.5239262",
"0.51987207",
"0.51937973",
"0.5176987",
"0.5129372",
"0.50765395",
"0.5066394",
"0.5066394",
"0.50135946",
"0.50109214",
"0.49653503",
"0.49653503",
"0.4947426",
"0.... | 0.7322978 | 0 |
Prints a nice representation of the robot's room | def print_room(room):
for row in room:
for cell in row:
if cell == "obstacle":
print("O", end="")
elif cell == "robot":
print("R", end="")
elif cell == "empty":
print(" ", end="")
elif cell == "dirt":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_room(room):\r\n cls()\r\n print(\"\\n\" + room[\"name\"].upper() + \"\\n\")\r\n wrap_print(room[\"description\"] + print_room_items(room) + print_room_entities(room))",
"def print_room(self, room_name):\n pass",
"def print_room(dungeon, room):\n if not isinstance(room, str):\n ... | [
"0.77963537",
"0.72407466",
"0.71808004",
"0.71625555",
"0.68116397",
"0.6722648",
"0.67088467",
"0.66559607",
"0.66192555",
"0.65677875",
"0.6463875",
"0.64499384",
"0.643986",
"0.6433628",
"0.64182234",
"0.64161426",
"0.64107305",
"0.64037126",
"0.6396229",
"0.63892835",
"0... | 0.74921817 | 1 |
Find the robot's row and column in the room | def robot_location(room):
for r in range(WIDTH):
for c in range(WIDTH):
if room[r][c] == "robot":
return (r, c) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locateRobot(self):\n logging.info(\"Display Carte : {}\".format(self.name))\n for r, row in enumerate(self.map):\n #print(row)\n for c, cell in enumerate(row):\n if (cell == \"X\"):\n logging.info(\"r={} / c={}\".format(r, c))\n ... | [
"0.7209209",
"0.68491966",
"0.67484796",
"0.6742116",
"0.66422343",
"0.65613884",
"0.6508796",
"0.64626616",
"0.645346",
"0.64490324",
"0.64116305",
"0.64116305",
"0.64116305",
"0.64116305",
"0.6384425",
"0.6384425",
"0.6384425",
"0.6382094",
"0.63803464",
"0.63532513",
"0.63... | 0.83412594 | 0 |
Randomly moves robot around room for steps steps | def random_walk(room, steps):
# Track the robot location
visits = []
for _ in range(WIDTH):
row = [0] * WIDTH
visits.append(row)
for i in range(steps):
direction = random.choice(DIRECTIONS)
room = move_robot(room, direction)
print("After {} steps, r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_walk(turtle, distance, steps):\n turtle.color(randcolor(), randcolor())\n for step in range(0,steps):\n random_move(turtle, distance)\n gohome(turtle)",
"def __random_movement(self):\n\t\tself.__steps += 1 \t\t# Increment after every frame\n\t\t# When __steps greater than threshold reverse the... | [
"0.7774502",
"0.75863487",
"0.73070693",
"0.73070693",
"0.7106863",
"0.70158184",
"0.70033383",
"0.6929114",
"0.6925242",
"0.68895966",
"0.6882411",
"0.6853489",
"0.6732789",
"0.66730416",
"0.66123164",
"0.6584355",
"0.65496343",
"0.6464167",
"0.64255637",
"0.6416204",
"0.641... | 0.76237047 | 1 |
Find discordant SNPs between two or three individuals. | def find_discordant_snps(
self, individual1, individual2, individual3=None, save_output=False
):
self._remap_snps_to_GRCh37([individual1, individual2, individual3])
df = individual1.snps
# remove nulls for reference individual
df = df.loc[df["genotype"].notnull()]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_all_ORFs_both_strands(dna):\n \n # YOUR IMPLEMENTATION HERE",
"def diagnose(patient: Patient) -> Disease:\n symptom_lists = Doctor.check_symptoms()\n for idx, value in enumerate(symptom_lists):\n print(idx + 1, end=': ')\n print(value)\n list_num = input... | [
"0.54238117",
"0.5397499",
"0.50213706",
"0.49540493",
"0.49468315",
"0.48935726",
"0.4861322",
"0.48398855",
"0.48368677",
"0.4829102",
"0.48204935",
"0.4819739",
"0.48099115",
"0.48077846",
"0.47982892",
"0.47820273",
"0.47720265",
"0.47696325",
"0.47652066",
"0.4755059",
"... | 0.74235433 | 0 |
Find the shared DNA between individuals. Computes the genetic distance in centiMorgans (cMs) between SNPs using the specified genetic map. Applies thresholds to determine the shared DNA. Plots shared DNA. Optionally determines shared genes (i.e., genes transcribed from the shared DNA). All output is saved to the output... | def find_shared_dna(
self,
individuals=(),
cM_threshold=0.75,
snp_threshold=1100,
shared_genes=False,
save_output=True,
genetic_map="HapMap2",
):
# initialize all objects to be returned to be empty to start
one_chrom_shared_dna = pd.DataFrame()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compute_snp_distances(self, task):\n genetic_map = task[\"genetic_map\"]\n temp = task[\"snps\"]\n\n # merge genetic map for this chrom\n temp = pd.concat([temp, genetic_map], ignore_index=False, sort=True)\n\n # sort based on pos\n temp = temp.sort_values(\"pos\")\n\... | [
"0.56576556",
"0.5647759",
"0.53735024",
"0.53276324",
"0.5262516",
"0.52343667",
"0.51697755",
"0.5114177",
"0.50524485",
"0.5048508",
"0.5034508",
"0.501827",
"0.49911427",
"0.49678725",
"0.49570465",
"0.4941199",
"0.49343064",
"0.49177906",
"0.49145517",
"0.49005",
"0.4889... | 0.77915484 | 0 |
Shrinks learning rate by a specified factor. | def adjust_learning_rate(optimizer, shrink_factor):
print("\nDECAYING learning rate.")
for param_group in optimizer.param_groups:
param_group['lr'] = param_group['lr'] * shrink_factor
print("The new learning rate is %f\n" % (optimizer.param_groups[0]['lr'],)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _shrink_main(self, amt):\n self.ratio -= amt\n self.ratio = max(self.min_ratio, self.ratio)",
"def increase_learning(self, factor):\n pass",
"def adjust_learning_rate(optimizer, lr_factor, epoch):\n #lr = args.lr * (0.1 ** (epoch // 30))\n print('the learning rate is set to {0:.5... | [
"0.621651",
"0.6192596",
"0.61244947",
"0.6090921",
"0.6086119",
"0.6037739",
"0.6035497",
"0.6027836",
"0.59555835",
"0.58451587",
"0.5829488",
"0.58293223",
"0.5815257",
"0.5783322",
"0.5766719",
"0.5764448",
"0.5741555",
"0.573596",
"0.5732485",
"0.57179576",
"0.5712487",
... | 0.73205805 | 1 |
Performs histogram equalization of a given grayscale or RGB image. | def histogram_equalize(im_orig):
if im_orig.ndim == 3:
return _histogram_equalize_rgb(im_orig)
return _histogram_equalize_grayscale(im_orig) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def histogram_equalization(img):\n\n if len(img.shape) == 3:\n img_copy = np.copy(img)\n\n blue = img_copy[:,:,0]\n blue = histogram_equalize(blue)\n\n green = img_copy[:,:,1]\n green = histogram_equalize(green)\n\n red = img_copy[:,:,2]\n red = histogram_equaliz... | [
"0.78980786",
"0.7792403",
"0.7586312",
"0.75559366",
"0.7529373",
"0.7455406",
"0.7434594",
"0.73722005",
"0.7365525",
"0.7349805",
"0.7252676",
"0.72253525",
"0.721632",
"0.7205233",
"0.7183504",
"0.7164575",
"0.70882064",
"0.70414686",
"0.700131",
"0.6878102",
"0.6867632",... | 0.7982988 | 0 |
Prefix to append the observation with. | def observation_prefix(self) -> str:
return "Observation: " | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_prefix(self, prefix):\n self._prefix_stack.append(prefix)\n return Record._add_prefix_context()",
"def add_prefix_to_records(\n self, prefix: str, output_file: Path = None, point_to_new_file: bool = True\n ) -> None:\n if output_file is None:\n output_file = (... | [
"0.6778349",
"0.6228139",
"0.61473584",
"0.59861934",
"0.5979503",
"0.59719294",
"0.5958021",
"0.59409523",
"0.59362584",
"0.59227794",
"0.5903754",
"0.59030205",
"0.59030205",
"0.589633",
"0.58646214",
"0.5783678",
"0.57718897",
"0.56981474",
"0.56878805",
"0.5656983",
"0.56... | 0.6702096 | 1 |
Prefix to append the llm call with. | def llm_prefix(self) -> str:
return "Thought:" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _join_mgm_lfn(self, mgm, lfn):\n if not mgm.endswith('/'): mgm += '/'\n return mgm + lfn",
"async def prefix(self, _bot, message: discord.Message):\n mention = [self.user.mention + ' ', f'<@!{self.user.id}> ']\n additional_prefixes = await self.get_prefixes(message.guild)\n ... | [
"0.5902713",
"0.587203",
"0.58335036",
"0.58031607",
"0.5793552",
"0.5653821",
"0.5645744",
"0.55652654",
"0.5514967",
"0.55146754",
"0.549201",
"0.54632914",
"0.54285276",
"0.5409203",
"0.5408288",
"0.5392059",
"0.5372708",
"0.5365805",
"0.5286357",
"0.52636105",
"0.5255531"... | 0.6970243 | 0 |
Construct an agent from an LLM and tools. | def from_llm_and_tools(
cls,
llm: BaseLanguageModel,
tools: Sequence[BaseTool],
callback_manager: Optional[BaseCallbackManager] = None,
prefix: str = PREFIX,
suffix: str = SUFFIX,
format_instructions: str = FORMAT_INSTRUCTIONS,
input_variables: Optional[Li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_agent(\n tools: Sequence[BaseTool],\n llm: BaseLLM,\n agent: Optional[str] = None,\n callback_manager: Optional[BaseCallbackManager] = None,\n agent_path: Optional[str] = None,\n agent_kwargs: Optional[dict] = None,\n **kwargs: Any,\n) -> AgentExecutor:\n if agent is None and... | [
"0.68544346",
"0.6114651",
"0.5870215",
"0.573769",
"0.57143545",
"0.5678269",
"0.56483686",
"0.5615278",
"0.56061935",
"0.560567",
"0.5566924",
"0.5560545",
"0.552811",
"0.55249405",
"0.5508944",
"0.5458894",
"0.5445085",
"0.5435058",
"0.5418489",
"0.5398637",
"0.5394378",
... | 0.7422969 | 0 |
Convert the class properties defined in the enum_class into list of names | def as_name_list(cls, lower=True, **kwargs):
return cls.enum_class.as_name_list(lower=lower, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enum_names(self):\n return [enum.name for enum in self]",
"def names(cls) -> List[str]:",
"def handle_enum(enum_annotations: Any) -> list:\n result = []\n for attribute in list(enum_annotations):\n result.append(attribute.value)\n return result",
"def _fields_names(... | [
"0.73643816",
"0.64861864",
"0.64017457",
"0.62679327",
"0.6237692",
"0.62372243",
"0.61504334",
"0.6142872",
"0.6105514",
"0.6006661",
"0.5971565",
"0.59683406",
"0.5967604",
"0.5929065",
"0.58582693",
"0.5822312",
"0.5791551",
"0.5785187",
"0.57733375",
"0.5748512",
"0.5747... | 0.70861554 | 1 |
Instantiate the class from a bitwise value. This is commonly used by serializer's to_representation since the internal value saved is an integer and we convert that integer value into actual BitFlag class so we can access each flags later on | def from_value(cls, value):
value = value if value else 0
try:
flags = [flag.name for flag in cls.enum_class if flag.value & value]
except TypeError:
flags = [flag.name for flag in cls.enum_class if flag.name == value]
return cls(*flags) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_python(self, value):\n if value is None:\n return value\n value = super(BitOptionsField, self).to_python(value)\n return BitOptions(self.options.flags, value)",
"def from_bitmask ( cls, mode, rwx_bits ):\n return cls (\n mode & rwx_bits[0], mode & rwx_bits[1], ... | [
"0.6639832",
"0.6513308",
"0.62424076",
"0.6198424",
"0.61865187",
"0.6142332",
"0.61278284",
"0.5993367",
"0.58608305",
"0.5787658",
"0.5765185",
"0.57612026",
"0.5718666",
"0.57036215",
"0.5638888",
"0.5621487",
"0.56064117",
"0.55868185",
"0.558416",
"0.5535991",
"0.553599... | 0.70349735 | 0 |
Lower health of turret due to shell hit input amount of damage | def Hit(self, damage):
self.health -= damage | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_damage(self, damage):\n attack = damage - (0.05 + self.__experience / 1000)\n self.set_health(self.get_health - attack)",
"def take_damage(self, damage):\n if self.hp - damage <= 0:\n self.hp = 0\n self.die()\n else:\n self.hp -= damage",
"d... | [
"0.70182437",
"0.6977498",
"0.6884602",
"0.68226564",
"0.6801658",
"0.67975295",
"0.668892",
"0.6684949",
"0.6664647",
"0.6655365",
"0.6645822",
"0.6637415",
"0.6626659",
"0.6607689",
"0.6567997",
"0.6564653",
"0.6558304",
"0.6519946",
"0.6503513",
"0.6475692",
"0.6468832",
... | 0.6995039 | 1 |
Increment barrel angle by increment | def Incrbarrel(self, increment):
self.barrel += increment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle(self) -> int:",
"def adjAngle(self, amt): \r\n\r\n self.angle = self.angle + radians(amt)\r\n self.redraw()",
"def adjAngle(self, amt):\n \n self.angle = self.angle+radians(amt)\n self.redraw()",
"def angle(self) -> float:\n ...",
"def rel_angle(self, ang... | [
"0.69371337",
"0.6809668",
"0.66042465",
"0.66021353",
"0.6482482",
"0.63182825",
"0.62997943",
"0.6202629",
"0.61922526",
"0.6171799",
"0.6101318",
"0.60996515",
"0.60916734",
"0.6063008",
"0.6055057",
"0.6044777",
"0.6028799",
"0.6024444",
"0.5974746",
"0.59703976",
"0.5961... | 0.6972426 | 0 |
Increment shell power by increment | def Incrpower(self, increment):
self.power += increment | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment(self) -> global___Expression:",
"def increment_counter(self) -> None:",
"def increment(self):\r\n return self.add(1)",
"def inc(self):\n self._value += 1",
"def inc(self):\n \n self.count += 1",
"def increment(val):\n return coerce_to_int(val) + 1",
"def inc( se... | [
"0.70788616",
"0.7046641",
"0.69630647",
"0.6938372",
"0.6881359",
"0.68417203",
"0.6839004",
"0.6824465",
"0.6761665",
"0.66231424",
"0.6622987",
"0.662135",
"0.65952545",
"0.656082",
"0.65343285",
"0.6497119",
"0.6488115",
"0.6474628",
"0.6469687",
"0.6448081",
"0.642667",
... | 0.77311605 | 0 |
Draw the turret on screen at xcoord | def DrawTurret(self):
pygame.draw.rect(self.displaysurf, self.color, (int(self.x_coord - T_W1 / 2), WINHEIGHT - T_H1 - GR_HEIGHT, T_W1, T_H1), 0)
pygame.draw.rect(self.displaysurf, self.color, (int(self.x_coord - T_W2 / 2), WINHEIGHT - (T_H2 + T_H1) - GR_HEIGHT, T_W2, T_H2), 0)
self.barrel_endx ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def specialfire_draw(self, window):\n self.specialfire_x = self.x + 10\n window.blit(self.specialfire_image, (self.specialfire_x, self.specialfire_y))",
"def draw(self, window):\n window.blit(self.bullet_img, (self.x - 5, self.y))",
"def draw(self,x=0,y=0):\n\t\tself.center = x,y\n\t\tr\t\... | [
"0.66439855",
"0.62891454",
"0.6282445",
"0.60863936",
"0.60694295",
"0.60072845",
"0.5998672",
"0.5984415",
"0.5950994",
"0.5937683",
"0.59221476",
"0.58638984",
"0.58491594",
"0.5811734",
"0.57983315",
"0.57904226",
"0.5784325",
"0.57671064",
"0.57671064",
"0.5745044",
"0.5... | 0.781046 | 0 |
Given a requested geometry, apply all applicable resistance and return the nearest acceptable geometry. | def resist(self, geometry, gravity=Gravity.Center):
def apply_resistance(geometry, gravity, direction, resistance):
if is_positive_direction(direction):
if gravity[cardinal_axis(direction)] < 0:
return geometry - Rectangle(*direction) * resistance
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simplify(self, tolerance, preserve_topology=...): # -> BaseGeometry:\n ...",
"def query_geometries(self, geometry_params):\n username, password, api_key, max_items_to_return = SettingsOps.get_settings()\n geometry_runnable = GeometryRunnable(username, password, api_key, geometry_params)... | [
"0.57061934",
"0.56025225",
"0.5505393",
"0.52996415",
"0.52572227",
"0.5243619",
"0.5201118",
"0.5165462",
"0.5110524",
"0.50984764",
"0.5073225",
"0.5044998",
"0.502902",
"0.50104994",
"0.49985996",
"0.49984774",
"0.49900553",
"0.49641076",
"0.4944794",
"0.49333483",
"0.490... | 0.6679861 | 0 |
Compute applicable resistance in the given cardinal direction. | def compute_resistance(self, geometry, gravity, direction):
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\n\n return (4095./value - 1.) * self.RLOAD",
"def get_resistance(self):\n adc = ADC(self.pin)\n value = adc.read()\n if value == 0:\n return -1\... | [
"0.61296314",
"0.61282647",
"0.57395494",
"0.56371367",
"0.55882496",
"0.55312586",
"0.54207295",
"0.54207295",
"0.5417482",
"0.53956866",
"0.5388082",
"0.53652346",
"0.53387743",
"0.5309407",
"0.5303155",
"0.5297276",
"0.5261827",
"0.5260851",
"0.52532184",
"0.52486545",
"0.... | 0.70023644 | 0 |
Run experiments defined by `config` serially. | def run_experiment(experiment_name: str = None,
output_path: str = '/tmp/sweep',
start_count: int = 0,
end_count: int = int(1e6),
ignore_errors: bool = False,
agent_module: str = None,
config: Dict[str, Any... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self, *args, **kwargs) -> None:\n loop = tqdm(self.configs, desc='Configurations')\n for cfg in loop:\n loop.set_postfix_str(cfg.experiment_cfg['name'])\n for i in range(cfg.num_models):\n filename = None\n run_id = None\n if ... | [
"0.65934515",
"0.6450689",
"0.6370365",
"0.62233114",
"0.61923033",
"0.61813575",
"0.6084442",
"0.59835315",
"0.5939352",
"0.5933978",
"0.5889302",
"0.5861062",
"0.5848335",
"0.579134",
"0.5772339",
"0.5732809",
"0.56940126",
"0.5693156",
"0.5691312",
"0.5688873",
"0.568135",... | 0.64592427 | 1 |
Sets the contact_id of this PostPurchaseInvoicesPurchaseInvoice. | def contact_id(self, contact_id):
if self.local_vars_configuration.client_side_validation and contact_id is None: # noqa: E501
raise ValueError("Invalid value for `contact_id`, must not be `None`") # noqa: E501
self._contact_id = contact_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact(self, contact):\n\n self.logger.debug(\"In 'contact' setter.\")\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def contact_reference(self, contact_reference):\n\n ... | [
"0.6285092",
"0.6063074",
"0.6063074",
"0.5719032",
"0.57064533",
"0.56510955",
"0.5626504",
"0.5626504",
"0.5544567",
"0.5544567",
"0.54794806",
"0.54794806",
"0.54268795",
"0.54248273",
"0.5423989",
"0.54142874",
"0.54142874",
"0.5390441",
"0.53047955",
"0.5275996",
"0.5263... | 0.68784446 | 0 |
Sets the postponed_accounting of this PostPurchaseInvoicesPurchaseInvoice. | def postponed_accounting(self, postponed_accounting):
self._postponed_accounting = postponed_accounting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def planned_purge_date(self, planned_purge_date):\n\n self._planned_purge_date = planned_purge_date",
"def planned_purge_date(self, planned_purge_date):\n\n self._planned_purge_date = planned_purge_date",
"def billing(self, billing):\n\n self._billing = billing",
"def stripe_invoices(sel... | [
"0.5164518",
"0.5164518",
"0.5129151",
"0.510779",
"0.50539356",
"0.48352224",
"0.48083425",
"0.48063827",
"0.47485515",
"0.47256663",
"0.47247475",
"0.46916565",
"0.4663355",
"0.46363682",
"0.45863387",
"0.45349258",
"0.44853544",
"0.44791558",
"0.44712302",
"0.43583533",
"0... | 0.85412544 | 0 |
Sets the _import of this PostPurchaseInvoicesPurchaseInvoice. | def _import(self, _import):
self.__import = _import | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purchase_import(self, cr, uid, ids, context=None):\n wizard_row = self.browse(cr, uid, ids)[0]\n if wizard_row.add_import == 'add':\n self.pool.get('purchase.import').write(cr, uid, [wizard_row.import_id.id], {'purchase_related_ids': [(4,wizard_row.purchase_id.id)]})\n impor... | [
"0.618004",
"0.6174455",
"0.60219365",
"0.5662718",
"0.5567216",
"0.53898066",
"0.5327924",
"0.5311895",
"0.51925117",
"0.51909274",
"0.51852715",
"0.5076225",
"0.5050261",
"0.5043181",
"0.50084424",
"0.49955246",
"0.49931264",
"0.49931264",
"0.4992524",
"0.4968823",
"0.49602... | 0.65040016 | 0 |
Sets the contact_name of this PostPurchaseInvoicesPurchaseInvoice. | def contact_name(self, contact_name):
self._contact_name = contact_name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact_name(self) -> str:\n return pulumi.get(self, \"contact_name\")",
"def contact(self, contact):\n\n self.logger.debug(\"In 'contact' setter.\")\n\n self._contact = contact",
"def primary_contact_name(self, primary_contact_name):\n\n self._primary_contact_name = primary_con... | [
"0.622506",
"0.6194355",
"0.6183277",
"0.59499365",
"0.59499365",
"0.5937808",
"0.5937808",
"0.5915116",
"0.5810493",
"0.5577777",
"0.5577777",
"0.55287033",
"0.54999256",
"0.544679",
"0.53931767",
"0.5383851",
"0.5381487",
"0.53345734",
"0.53317356",
"0.53317356",
"0.5275610... | 0.79246986 | 1 |
Sets the contact_reference of this PostPurchaseInvoicesPurchaseInvoice. | def contact_reference(self, contact_reference):
self._contact_reference = contact_reference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contact(self, contact):\n\n self.logger.debug(\"In 'contact' setter.\")\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def contact(self, contact):\n\n self._contact = contact",
"def billing_contact(self, billing_contact):\n\n s... | [
"0.6713272",
"0.6480639",
"0.6480639",
"0.63949925",
"0.6050419",
"0.59468305",
"0.59468305",
"0.5923061",
"0.5904237",
"0.57644933",
"0.57644933",
"0.56140673",
"0.55840105",
"0.55726564",
"0.55439264",
"0.55439264",
"0.5491725",
"0.5442325",
"0.5413189",
"0.5404995",
"0.540... | 0.7702224 | 0 |
Sets the vendor_reference of this PostPurchaseInvoicesPurchaseInvoice. | def vendor_reference(self, vendor_reference):
self._vendor_reference = vendor_reference | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vendor(self, vendor):\n\n self._vendor = vendor",
"def vendor_id(self, vendor_id):\n\n self._vendor_id = vendor_id",
"def vendorid(self, vendorid):\n\n self._vendorid = vendorid",
"def preview_vendor_hash(self, preview_vendor_hash):\n\n self._preview_vendor_hash = preview_vend... | [
"0.6127532",
"0.6047234",
"0.60127974",
"0.5142039",
"0.47634998",
"0.47176838",
"0.46963373",
"0.46252054",
"0.46232238",
"0.43928522",
"0.43740016",
"0.43684146",
"0.43338934",
"0.42771545",
"0.4275448",
"0.42525345",
"0.425153",
"0.42063642",
"0.42063642",
"0.41791555",
"0... | 0.7597187 | 0 |
Sets the total_quantity of this PostPurchaseInvoicesPurchaseInvoice. | def total_quantity(self, total_quantity):
self._total_quantity = total_quantity | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_sold_quantity(self, total_sold_quantity):\n\n self._total_sold_quantity = total_sold_quantity",
"def trash_item_quantity(self, trash_item_quantity):\n\n self._trash_item_quantity = trash_item_quantity",
"def total_amount(self, total_amount):\n\n self._total_amount = total_amount"... | [
"0.65348953",
"0.6143091",
"0.6062372",
"0.5747401",
"0.5747401",
"0.5747401",
"0.5747401",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57295144",
"0.57032037",
"0.5658872",
"0.5599074",
"0.5587467",
"0.5582165",
"0.554... | 0.765062 | 0 |
Sets the net_amount of this PostPurchaseInvoicesPurchaseInvoice. | def net_amount(self, net_amount):
self._net_amount = net_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_currency_net_amount(self, base_currency_net_amount):\n\n self._base_currency_net_amount = base_currency_net_amount",
"def netincome_multiple(self, netincome_multiple):\n\n self._netincome_multiple = netincome_multiple",
"def netTrdQtyLot(self, netTrdQtyLot):\n\n self._netTrdQtyLot... | [
"0.681148",
"0.6227932",
"0.57708323",
"0.5584708",
"0.52162313",
"0.52098954",
"0.5072743",
"0.5061319",
"0.50505716",
"0.49473023",
"0.4923785",
"0.4920528",
"0.4904878",
"0.48799494",
"0.48773444",
"0.48637554",
"0.48637554",
"0.48637554",
"0.48637554",
"0.48637554",
"0.48... | 0.8174647 | 0 |
Sets the tax_amount of this PostPurchaseInvoicesPurchaseInvoice. | def tax_amount(self, tax_amount):
self._tax_amount = tax_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_tax_amount(self, base_tax_amount):\n\n self._base_tax_amount = base_tax_amount",
"def base_currency_tax_amount(self, base_currency_tax_amount):\n\n self._base_currency_tax_amount = base_currency_tax_amount",
"def tax_id(self, tax_id):\n\n self._tax_id = tax_id",
"def tax_id(self... | [
"0.7244466",
"0.7051072",
"0.6965588",
"0.6696487",
"0.6545955",
"0.6443793",
"0.64024025",
"0.63806623",
"0.6330282",
"0.6309295",
"0.6260369",
"0.618346",
"0.6069225",
"0.6003286",
"0.5891903",
"0.5859312",
"0.5858483",
"0.57721156",
"0.5747969",
"0.57242626",
"0.5638927",
... | 0.8189939 | 1 |
Sets the total_amount of this PostPurchaseInvoicesPurchaseInvoice. | def total_amount(self, total_amount):
self._total_amount = total_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_charges_amount(self, total_charges_amount):\n\n self._total_charges_amount = total_charges_amount",
"def total_quantity(self, total_quantity):\n\n self._total_quantity = total_quantity",
"def total(self, total):\n\n self._total = total",
"def total(self, total):\n\n self... | [
"0.6557493",
"0.6501971",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6490655",
"0.6475942",
"0.6179905",
"0.6130284",
"0.60660183",
"0.60392946",
"0.60348994",
"0.602849",
"0.5908025",
"0.5854423",
"0.5752895",
"0.5752191",
... | 0.7552586 | 0 |
Sets the exchange_rate of this PostPurchaseInvoicesPurchaseInvoice. | def exchange_rate(self, exchange_rate):
self._exchange_rate = exchange_rate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_exchange_rate(self, exchange_rate):\n self.set_value_into_input_field(self.exchange_rate_textbox_locator, exchange_rate, True)",
"def set_exchange_rate_date(self, exchange_rate_date):\n self.set_value_into_input_field(self.exchange_rate_date_locator, exchange_rate_date)",
"def setExchange... | [
"0.74312675",
"0.6620807",
"0.6552753",
"0.63788575",
"0.628909",
"0.6286801",
"0.6018149",
"0.5635871",
"0.5635871",
"0.55908066",
"0.5581523",
"0.5581523",
"0.54488677",
"0.540264",
"0.52925557",
"0.5268415",
"0.524034",
"0.5176141",
"0.51739997",
"0.5138833",
"0.5089371",
... | 0.79566854 | 0 |
Sets the inverse_exchange_rate of this PostPurchaseInvoicesPurchaseInvoice. | def inverse_exchange_rate(self, inverse_exchange_rate):
self._inverse_exchange_rate = inverse_exchange_rate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exchange_rate(self, exchange_rate):\n\n self._exchange_rate = exchange_rate",
"def set_exchange_rate(self, exchange_rate):\n self.set_value_into_input_field(self.exchange_rate_textbox_locator, exchange_rate, True)",
"def inv(self):\n self.inverse = not self._inverse\n return sel... | [
"0.5884562",
"0.5371441",
"0.5368039",
"0.51503855",
"0.50740457",
"0.50380045",
"0.5009147",
"0.50071853",
"0.49822706",
"0.49477562",
"0.48947874",
"0.48583952",
"0.48527876",
"0.48357448",
"0.4817615",
"0.4816075",
"0.48135805",
"0.48036796",
"0.4765658",
"0.4736537",
"0.4... | 0.8680546 | 0 |
Sets the base_currency_net_amount of this PostPurchaseInvoicesPurchaseInvoice. | def base_currency_net_amount(self, base_currency_net_amount):
self._base_currency_net_amount = base_currency_net_amount | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_currency(self, base_currency):\n\n self._base_currency = base_currency",
"def net_amount(self, net_amount):\n\n self._net_amount = net_amount",
"def base_discount_amount(self, base_discount_amount):\n\n self._base_discount_amount = base_discount_amount",
"def base_currency_tax_a... | [
"0.6843186",
"0.6716799",
"0.6621903",
"0.64772415",
"0.63988847",
"0.6383532",
"0.6354787",
"0.62855136",
"0.6042461",
"0.5972825",
"0.5527415",
"0.52825683",
"0.519028",
"0.5094739",
"0.504295",
"0.50118953",
"0.48772526",
"0.4840591",
"0.4840591",
"0.48045397",
"0.47636214... | 0.8329265 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.