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 |
|---|---|---|---|---|---|---|
Creates n pairs that are pooled, i.e. there are n analytes that are mapped to m analytes, where m < n. The wells in the source container are [A1, B2, ...] | def create_pooled_pairs(self, pool_size):
source_analytes = list()
for i in range(1, pool_size + 1):
source_container = self.get_container_by_name("source{}".format(i), True)
name = "analyte{}".format(i)
analyte = self._create_analyte(True, name, Analyte)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def better_grouper(inputs, n):\n iters = [iter(inputs)] * n\n return zip(*iters)",
"def make_pool(num_snp):\r\n\tc=0\r\n\tpool=[]\r\n\tfor i in xrange(0,num_snp+1):\r\n\t\ts=make_str(i, num_snp)\r\n\t\tpool+=map(\"\".join, itertools.permutations(s, num_snp))\r\n\treturn list(set(pool))",
"def population(... | [
"0.5851569",
"0.58508915",
"0.58006305",
"0.5800084",
"0.57694125",
"0.5760583",
"0.572405",
"0.5617503",
"0.55484885",
"0.5540044",
"0.5537252",
"0.55171174",
"0.5513315",
"0.5509895",
"0.5494006",
"0.54798657",
"0.54587233",
"0.5455391",
"0.5455159",
"0.54095834",
"0.540347... | 0.7510585 | 0 |
Adds an input analyte to the last container added | def add_input_analyte(self, name=None, analyte_id=None, input_container_ref=-1):
last_container = self.input_containers[input_container_ref]
if analyte_id is None:
analyte_id = "analyte_{}-{}".format(last_container.id, len(last_container.occupied))
if name is None:
name =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append(self, inp: I):",
"def add_input(self, sinput):\r\n self.sinputs.append(sinput)\r\n self.variables.append(sinput.variable)",
"def add_input_item(self, entry_container, entry_li):\n new_entry_frame = ttk.Frame(entry_container)\n new_entry_frame.pack(\n side=tk.TO... | [
"0.648325",
"0.6321324",
"0.62645525",
"0.6212761",
"0.6142176",
"0.60023504",
"0.5988617",
"0.5979456",
"0.59611285",
"0.59570605",
"0.5931731",
"0.5866153",
"0.57316816",
"0.5669762",
"0.56648797",
"0.56548285",
"0.56548285",
"0.56506824",
"0.5647834",
"0.55457294",
"0.5515... | 0.731952 | 0 |
Sets the values required for dilution (conc and vol) to the analyte that was added last to the scenario | def dilution_vals(self, conc, vol, analyte_ref=-1):
analyte = self.analytes[analyte_ref]
if analyte.is_input:
analyte.udf_map = UdfMapping({self.conc_source_udf: conc,
"Current sample volume (ul)": vol})
else:
analyte.udf_map = U... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_compartments(self, food_glucose):\n self.g_t, self.m_t = self.new_values(food_glucose, self.get_variables())",
"def set_voltages(): \n #0) set parameters\n from project_parameters import trapFile,multipoleControls,reg,driveFrequency,ax,az,phi,coefs\n import pickle\n with open(trapFile,'... | [
"0.64157164",
"0.5846979",
"0.56650025",
"0.56338984",
"0.55074507",
"0.545579",
"0.5396227",
"0.538296",
"0.52897954",
"0.52607626",
"0.5212678",
"0.5207539",
"0.5206429",
"0.5199712",
"0.5175389",
"0.51715475",
"0.5143191",
"0.5128631",
"0.5117423",
"0.5113306",
"0.5107572"... | 0.66103685 | 0 |
Generate new plans for robot and human, set them in the corresponding trajectories, and return the robot plan. | def plan(self):
opt_r, opt_h = self.optimizer.maximize(bounds=self.bounds) # 1-D
plan_r, plan_h = opt_r, opt_h
# Update optimal control in trajectories
self.traj_r.u = plan_r # numpy robot plan
self.traj_r.u_th = plan_r # Theano robot plan
self.traj_h.u = plan_h # numpy human plan
self.traj_h.u_th = plan_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_plans(robot, plans):\n # make sure the robot is actually in the home position\n # before executing a plan\n robot.mg.set_joint_value_target(\n plans[0].joint_trajectory.points[0].positions)\n robot.mg.go(wait=True)\n print(\"Moved to home, start executing task.\")\n\n # TODO qu... | [
"0.6745649",
"0.6745649",
"0.63215953",
"0.6223812",
"0.5992174",
"0.58272314",
"0.5815968",
"0.57076544",
"0.569448",
"0.56808543",
"0.5656487",
"0.5644022",
"0.56225246",
"0.55637574",
"0.5552039",
"0.555193",
"0.55424327",
"0.53995717",
"0.53913105",
"0.53764516",
"0.53183... | 0.68403876 | 0 |
Close the cursor object and the connection to the database Used when closing the context manager or deleting the object | def close(self):
self.cursor.close()
self.db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close(self):\n# self.cursor.close()\n\tself.db.close()",
"def close(self):\r\n if self.cursor is None:\r\n return\r\n\r\n self.cursor.close()\r\n self.cursor = None\r\n self.app_id = None\r\n self.iden_id = None",
"def close(self):\n self.cursor.c... | [
"0.86554474",
"0.8260736",
"0.8233482",
"0.8230915",
"0.8141959",
"0.8133902",
"0.81295943",
"0.8077434",
"0.80626726",
"0.806266",
"0.8043159",
"0.80188817",
"0.798275",
"0.79796505",
"0.79384774",
"0.79309344",
"0.7913784",
"0.78969324",
"0.7894729",
"0.78856033",
"0.787497... | 0.85049456 | 1 |
Check if rows exist in a table satisfying the given where clauses. | def exists(self, table, **where):
# Format the list of where statements
wheres = ' AND '.join([str(attr) + '=\'' + str(val) + '\'' for attr, val in where.items()])
if where:
query = 'SELECT COUNT(*) FROM "{}" WHERE {}'.format(table, wheres)
else:
query = 'SELECT ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _exists(cursor, table, data):\n cursor.execute('SELECT 1 FROM {} WHERE ({}) = ({})'.format(table, *_query_fields(data)), data)\n return bool(cursor.fetchone())",
"def contains(self, table_name, keys=None, any=False, eids=None):\n table = self.db.table(table_name)\n if eids is not None:\n LOG... | [
"0.6341168",
"0.6322485",
"0.6010342",
"0.60048956",
"0.5916878",
"0.58578634",
"0.58364034",
"0.5764844",
"0.5717923",
"0.56689465",
"0.566596",
"0.5644548",
"0.563038",
"0.5628894",
"0.56232756",
"0.5587086",
"0.55848366",
"0.55557954",
"0.5468923",
"0.5435275",
"0.54281336... | 0.7143307 | 0 |
Constructs a new ``MetropolisHastings`` sampler given a machine and a transition kernel. | def __init__(
self, machine, transition_kernel, n_chains=16, sweep_size=None, batch_size=None
):
self.machine = machine
self.n_chains = n_chains
self.sweep_size = sweep_size
self._kernel = transition_kernel
self.machine_pow = 2.0
super().__init__(machine,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, machine, sample_size=16):\n super().__init__(machine, sample_size)\n if isinstance(machine, AbstractDensityMatrix):\n self.hilbert = DoubledHilbert(machine.hilbert)\n else:\n self.hilbert = machine.hilbert\n self._machine_pow = 2.0\n self.... | [
"0.55491817",
"0.5301399",
"0.5247378",
"0.5165929",
"0.51295394",
"0.50418186",
"0.50210476",
"0.49943802",
"0.496895",
"0.4963485",
"0.49460143",
"0.49008816",
"0.4868726",
"0.4840019",
"0.4829445",
"0.480448",
"0.47790402",
"0.47570053",
"0.47479767",
"0.47438306",
"0.4740... | 0.5745413 | 0 |
The measured acceptance probability. | def acceptance(self):
return _mean(self._accepted_samples) / _mean(self._total_samples) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acceptance_fraction(self):\n return self.sampler.acceptance_fraction",
"def acceptance_fraction(self):\n return float(self._accepted / self.num_iterations)",
"def acceptance_rate(self):\n total = float(self.accepted + self.rejected)\n return self.accepted / total",
"def calcul... | [
"0.7628562",
"0.743475",
"0.73585844",
"0.7314591",
"0.7277298",
"0.68790966",
"0.6674508",
"0.65870154",
"0.6485969",
"0.6444086",
"0.6417493",
"0.640288",
"0.63863665",
"0.63847613",
"0.6376613",
"0.63601047",
"0.6327089",
"0.62772393",
"0.6263895",
"0.6233109",
"0.62091213... | 0.78478295 | 0 |
Snake activation function f(x) = x + sin(x)2 The function is computed used the first terms of the Taylor series decomposition | def snakeh2(x):
return x + (2 * tf.sin(0.5 * x) * tf.sin(0.5 * x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake2(x):\n return x + (0.5 * tf.sin(2 * x) * tf.sin(2 * x))",
"def snake(x):\n return x + (tf.sin(x) * tf.sin(x))\n # return x + (x*x) - (x*x*x/3)",
"def xsin(x):\n return x + tf.sin(x)",
"def f(x):\n return np.tan(x) - np.sin(x) - (m*g)/(2*k*L)",
"def f5(x):\n return 2* sin(x) + si... | [
"0.74907035",
"0.72094464",
"0.6446838",
"0.642657",
"0.641536",
"0.60292315",
"0.59586483",
"0.5953228",
"0.5912857",
"0.5912857",
"0.5912857",
"0.5912857",
"0.5911165",
"0.5909471",
"0.58521044",
"0.58347005",
"0.5800074",
"0.57976747",
"0.5737763",
"0.5684968",
"0.5662542"... | 0.75108135 | 0 |
Snake activation function f(x) = x + sin(x)2 The function is computed used the first terms of the Taylor series decomposition | def snake2(x):
return x + (0.5 * tf.sin(2 * x) * tf.sin(2 * x)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snakeh2(x):\n return x + (2 * tf.sin(0.5 * x) * tf.sin(0.5 * x))",
"def snake(x):\n return x + (tf.sin(x) * tf.sin(x))\n # return x + (x*x) - (x*x*x/3)",
"def xsin(x):\n return x + tf.sin(x)",
"def f(x):\n return np.tan(x) - np.sin(x) - (m*g)/(2*k*L)",
"def f5(x):\n return 2* sin(x) +... | [
"0.75121415",
"0.7210037",
"0.64451027",
"0.64247197",
"0.6414511",
"0.6028212",
"0.59572124",
"0.5951549",
"0.59118545",
"0.59118545",
"0.59118545",
"0.59118545",
"0.5908841",
"0.5908449",
"0.58516365",
"0.5832652",
"0.5799732",
"0.5795505",
"0.5736944",
"0.568189",
"0.56608... | 0.7492419 | 1 |
Swish activation function f(x) = x sigmoid(x) | def swish(x):
return x * tf.sigmoid(x) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swish(x):\n return x * k.activations.sigmoid(x)",
"def sigmoid_activation(x):\n return 1.0 / (1 + np.exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(x):\n return 1 / (1 + exp(-x))",
"def sigmoid(X,W,b):\n preActivation = np.dot(X, W) + b\n return (1.0)/(1.0 + np.... | [
"0.85330546",
"0.80146253",
"0.7924477",
"0.7924477",
"0.7834979",
"0.7768678",
"0.7701341",
"0.76915896",
"0.7679821",
"0.7679821",
"0.7679821",
"0.7679821",
"0.7679821",
"0.7679821",
"0.76798",
"0.7678892",
"0.7670881",
"0.76577955",
"0.76546377",
"0.7654548",
"0.7654548",
... | 0.839208 | 1 |
Parses a textformat proto at the given path into the given message. | def parse_text_proto_file(proto_path: str, output: message.Message) -> None:
with gfile.open(proto_path, 'r') as f:
proto_text = f.read()
text_format.Parse(proto_text, output) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_proto_text(path, model):\n with open(path, 'r') as fp:\n Merge(fp.read(), model)\n\n return model",
"def ParseMessage(message: pubsub_v1.types.PubsubMessage,\n path_type: dicom_path.Type) -> ParsedMessage:\n input_path_str = message.data.decode()\n # Support both 'True' an... | [
"0.6844979",
"0.6006737",
"0.58073485",
"0.56164354",
"0.5543798",
"0.5541691",
"0.55415136",
"0.54542476",
"0.53926635",
"0.5381726",
"0.53776",
"0.5363189",
"0.5357601",
"0.52838975",
"0.52354354",
"0.52132004",
"0.52109766",
"0.52032274",
"0.51620334",
"0.5150542",
"0.5113... | 0.7909062 | 0 |
Read the boot code from the assembly dump. Will return a ``list`` of "instructions", i.e., a 3tuple of ``(instruction_number, opcode, arg)``. | def load_boot_code():
boot_code = []
with open("assembly.txt") as f:
for instruction_number, line in enumerate(f.readlines()):
opcode, arg = line.strip().split()
arg = int(arg)
boot_code.append((instruction_number, opcode, arg))
return boot_code | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_instructions(asm_file):\n instructions = []\n with open(asm_file, 'r') as f:\n \n for line in f:\n instruction = line.split('\\n')\n instruction = remove_comment_white_space(instruction)\n instructions.append(instruction)\n \n return in... | [
"0.567692",
"0.548647",
"0.5426393",
"0.53521407",
"0.52890575",
"0.5280171",
"0.5212975",
"0.5156862",
"0.5150413",
"0.51339287",
"0.5095543",
"0.50785315",
"0.50622296",
"0.5011143",
"0.5004435",
"0.499324",
"0.4986424",
"0.49832225",
"0.49807152",
"0.4960791",
"0.49521333"... | 0.7946444 | 0 |
Execute the program, and return the value of the accumulator. If ``allow_swap`` is ``True``, then we will test the code asis and with the next ``jump`` will be converted to a ``nop`` or the next ``nop`` will be converted to a ``jump``. If we detect a loop, we will return ``None`` to indicate that. >>> instructions = [ ... | def execute(
program, instruction_ptr=0, accumulator=0, instruction_cache=None, allow_swap=True,
):
if instruction_cache is None:
instruction_cache = set()
# I'm pretty sure we just finished the program!
if instruction_ptr == len(program):
print("Finished successfully?")
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(code):\r\n\r\n ip = 0\r\n acc = 0\r\n visited = defaultdict(int)\r\n\r\n while visited[ip] == 0:\r\n visited[ip] = visited[ip] + 1\r\n\r\n if code[ip][0] == \"acc\":\r\n acc = acc + code[ip][1]\r\n ip = ip + 1\r\n elif code[ip][0] == \"nop\":\r\n ... | [
"0.5452323",
"0.5354296",
"0.5239199",
"0.50492615",
"0.5045889",
"0.49206585",
"0.49123326",
"0.48739794",
"0.4843276",
"0.47314465",
"0.4701115",
"0.46656227",
"0.46545118",
"0.45204183",
"0.44879943",
"0.44764823",
"0.44426936",
"0.44405675",
"0.43412063",
"0.4283169",
"0.... | 0.69547534 | 0 |
This is a slightly modified version of matplotlib.colors.LightSource.hillshade, modified to remove the contrast stretching (because that uses local min/max values). Calculates the illumination intensity for a surface using the defined azimuth and elevation for the light source. Imagine an artificial sun placed at infin... | def _hillshade(elevation,
azdeg=315,
altdeg=45,
vert_exag=1,
dx=1,
dy=1,
fraction=1.):
# Azimuth is in degrees clockwise from North. Convert to radians
# counterclockwise from East (mathematical notation).
az = np.radi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shade_hills_onelight(slope, aspect, azimuth, altitude):\n deg2rad = pi/180\n\n shaded = sin(altitude * deg2rad) * numpy.sin(slope) \\\n + cos(altitude * deg2rad) * numpy.cos(slope) \\\n * numpy.cos((azimuth - 90.0) * deg2rad - aspect)\n \n return shaded",
"def hillshade(imag... | [
"0.6779002",
"0.64780915",
"0.60624087",
"0.5751302",
"0.5692389",
"0.56872404",
"0.5574469",
"0.54677826",
"0.5458501",
"0.54022",
"0.5356869",
"0.5345635",
"0.53084964",
"0.53067505",
"0.5223162",
"0.52096456",
"0.5194837",
"0.517947",
"0.5165038",
"0.51335645",
"0.50986654... | 0.74748564 | 0 |
Returns distance in metres two points at a scale in m / pixel. | def distance(a: Point, b: Point, scale: float) -> float:
x_north = a.y - b.y
y_east = b.x - a.x
return scale * math.sqrt(x_north**2 + y_east**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n return np.sqrt(np.sum(np.square(point1 - point2)))",
"def calcMetresDistance(lat1, long1, lat2, long2):\n return (abs(lat1 - lat2) + abs(long1 - long2)) * 100\n # no, like, really badly",
"def dist(a,b): # compute distance bet... | [
"0.69323415",
"0.68888944",
"0.6871156",
"0.6864509",
"0.6789273",
"0.678687",
"0.67551297",
"0.67032665",
"0.6617065",
"0.6612344",
"0.6612344",
"0.6612344",
"0.6612344",
"0.6612344",
"0.6600635",
"0.6595335",
"0.65848386",
"0.6579544",
"0.65792656",
"0.6576208",
"0.65716827... | 0.7553026 | 0 |
The mid point between two points. | def mid_point(a: Point, b: Point) -> Point:
return Point((a.x + b.x) / 2, (a.y + b.y) / 2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def midpoint(point1, point2):\n\n x, y = (int((point1[0] + point2[0]) / 2), int((point1[1] + point2[1]) / 2))\n return (x, y)",
"def midpoint(a, b):\n return ((a[0] + b[0]) / 2, (a[1] + b[1]) / 2)",
"def midpoint(self, other: PointType = None) -> PointType:\n return (self + (other or Point())) ... | [
"0.821167",
"0.80438495",
"0.8003984",
"0.8001825",
"0.791423",
"0.78762877",
"0.7796247",
"0.7753414",
"0.7639547",
"0.76016974",
"0.74891275",
"0.7485448",
"0.743061",
"0.7149305",
"0.7071786",
"0.7034211",
"0.6989378",
"0.68811023",
"0.6808902",
"0.6704547",
"0.6607805",
... | 0.8510186 | 0 |
Returns the error estimate of distance. At +2500m to the threshold this is assumed to be 100m decreasing linearly to 10m at the threshold and thereafter. | def distance_tolerance(distance: float) -> float:
ret = 10.0
if distance < 0:
ret += distance * (100 - ret) / -2500.0
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_error_dist(self):\n pass",
"def raydistance_error(motiontrajectory, ptstart, ptend):\n assert len(motiontrajectory.shape) == 2\n assert motiontrajectory.shape[1] == 2\n \n mv = np.diff(motiontrajectory, axis=0) # motion vector\n md = mv / np.linalg.norm(mv, axis=1)[:, np.newaxis] ... | [
"0.68346655",
"0.59785795",
"0.5899985",
"0.5891643",
"0.58115864",
"0.57261914",
"0.5721195",
"0.5701244",
"0.5672895",
"0.566193",
"0.56211555",
"0.5603761",
"0.5581379",
"0.55801815",
"0.5575662",
"0.55719346",
"0.55618274",
"0.5559863",
"0.5535016",
"0.5530429",
"0.552588... | 0.6669917 | 1 |
Child Key Derivation (CDK) Key derivation is normal if the extended parent key is public or child_index is less than 0x80000000. Key derivation is hardened if the extended parent key is private and child_index is not less than 0x80000000. | def ckd(xparentkey: Octets, index: Union[Octets, int]) -> bytes:
if isinstance(index, int):
index = index.to_bytes(4, 'big')
elif isinstance(index, str): # hex string
index = bytes.fromhex(index)
if len(index) != 4:
raise ValueError(f"a 4 bytes int is required, not {len(index)}")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derive_bip32childkey(parent_key, parent_chain_code, i):\r\n\r\n assert len(parent_key) == 32\r\n assert len(parent_chain_code) == 32\r\n k = parent_chain_code\r\n if (i & BIP32_PRIVDEV) != 0:\r\n key = b'\\x00' + parent_key\r\n else:\r\n key = derive_public_key(parent_key)\r\n d... | [
"0.6473795",
"0.5554731",
"0.5487011",
"0.5386339",
"0.5350222",
"0.5019135",
"0.49849588",
"0.49473682",
"0.4943277",
"0.49162257",
"0.48831654",
"0.4723921",
"0.46557948",
"0.46539286",
"0.46468854",
"0.46114856",
"0.4600268",
"0.4599191",
"0.45962363",
"0.45948598",
"0.457... | 0.7303798 | 0 |
Read input file, calculate its LSH and query it in the LSH database | def check_new_lsh(filename):
filename, text = utils.tokenize_file(filename)
min_hash = MinHash(num_perm=128)
for d in ngrams(text, 3):
min_hash.update(" ".join(d).encode('utf-8'))
return lsh.query(min_hash) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readFromFile(self, inp):\n f = open(inp, \"r\")\n line = f.readline()\n line = line.strip().split(sep=\" \", maxsplit=3)\n self.columns, self.chars, self.pwdLength, _ = line\n self.columns = int(self.columns)\n self.pwdLength = int(self.pwdLength)\n self.func = ... | [
"0.5664375",
"0.5530229",
"0.55073494",
"0.5408199",
"0.53248733",
"0.5314236",
"0.5294092",
"0.5276669",
"0.5273805",
"0.52713186",
"0.5264519",
"0.5258865",
"0.52565265",
"0.52355975",
"0.52187115",
"0.5210549",
"0.51669395",
"0.51668423",
"0.5160041",
"0.51593316",
"0.5135... | 0.6464849 | 0 |
The number of quadrature points in the fixed quadrature | def num_quadrature_points(self) -> int: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Laplace_num_quad_points(self):\n return self.Quadrature_points",
"def getNumQuads(self):\n return len(self._quadrilaterals)",
"def getLength(self):\n flength = 0\n for quad in self._quadrilaterals:\n flength = flength + get_quad_length(quad)\n return flength",
... | [
"0.74669033",
"0.72069114",
"0.6916292",
"0.676549",
"0.6627487",
"0.66093796",
"0.65501547",
"0.65289664",
"0.6480599",
"0.64375657",
"0.6424987",
"0.6387418",
"0.63728285",
"0.63686645",
"0.63304025",
"0.63009214",
"0.6300349",
"0.6264822",
"0.6218786",
"0.6187703",
"0.6183... | 0.90305877 | 0 |
Getter de l'attribut publication | def getPublication(self):
return self.publication | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_published(self):\n return self.__published",
"def ATTRIBUTE():\n return \"author\", \"title\", \"publisher\", \"shelf\", \"category\", \"subject\"",
"def __get__(self, instance, owner):\n if instance is None:\n return self\n val = instance.doc.get(self.slug)\n if ... | [
"0.6725264",
"0.63738686",
"0.63562864",
"0.6310349",
"0.6164285",
"0.60467374",
"0.5982622",
"0.5965325",
"0.5921462",
"0.5921462",
"0.58900225",
"0.58900225",
"0.58791137",
"0.58612615",
"0.5858159",
"0.5836919",
"0.582022",
"0.5793544",
"0.57654566",
"0.57654566",
"0.57654... | 0.6947428 | 0 |
Verify that commas are not touched when url encoding | def test_url_encoding_allows_comma(self):
api = bandcamp.Api(api_key=None)
url = 'http://api.bandcamp.com/api/track/3/info'
parameters = {'track_id': '3257270656,3467313536'}
encoded_url = 'http://api.bandcamp.com/api/track/3/info?track_id=3257270656,3467313536'
self.assertEqua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_dont_percent_encode_safe_chars_query():\n assert (normalize_url(\"http://example.com/a/?face=(-.-)\") ==\n \"http://example.com/a?face=(-.-)\")",
"def test_unreserved_percentencoding():\n assert (normalize_url(\"http://www.example.com/%7Eusername/\") ==\n \"http://www.example... | [
"0.6416633",
"0.639393",
"0.6352351",
"0.6193502",
"0.6170297",
"0.61255467",
"0.61104876",
"0.6065325",
"0.6015308",
"0.58711356",
"0.58701277",
"0.584793",
"0.5835308",
"0.5831245",
"0.5781774",
"0.5759029",
"0.5691587",
"0.5688906",
"0.5687766",
"0.56791794",
"0.5666858",
... | 0.7223181 | 0 |
Device secret_id. secret_id column, if missing then device_id | def secret_id(self):
if self._secret_id:
return self._secret_id
return self.device_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_id(self) -> Optional[str]:\n return self.relay(\"device_id\")",
"def device_id(self):\n return self.unique_id",
"def get_device_id(self):\n\n if self.have_metadata is False:\n self._get_metadata()\n self.have_metadata = True\... | [
"0.57232684",
"0.5540217",
"0.55204743",
"0.5397028",
"0.5349478",
"0.5334807",
"0.5322294",
"0.5251443",
"0.52207476",
"0.519978",
"0.51636624",
"0.5010039",
"0.4954731",
"0.49489248",
"0.4938144",
"0.48896644",
"0.4889212",
"0.4886945",
"0.48573655",
"0.48543474",
"0.484069... | 0.7120494 | 0 |
Get a Device object given its public_id or device_id. | def get_by_id(cls, public_id):
# First check public_id column, if that is not found return
# device that has device_id beginning with public_id.
if len(public_id) < 6:
raise Http404
try:
return cls.objects.get(_public_id=public_id)
except cls.DoesNotExist:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_device_or_None(id):\n try:\n d = Device.objects.get(id=id)\n return d\n except Device.DoesNotExist:\n return None",
"def get_object(self, queryset=None):\n return get_object_or_404(\n models.Device, uuid=self.kwargs[\"uuid\"], user=self.request.user\n )... | [
"0.72584087",
"0.71285784",
"0.71285784",
"0.7126023",
"0.7055196",
"0.70334333",
"0.70126486",
"0.6949385",
"0.69469786",
"0.6763406",
"0.6672897",
"0.6621469",
"0.65824854",
"0.65824854",
"0.65824854",
"0.65824854",
"0.6499191",
"0.64704365",
"0.6426107",
"0.6410981",
"0.63... | 0.7883954 | 0 |
Return the Python class corresponding to this device. | def get_class(self):
return devices.get_class(self.type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_class(self):\n # type: () -> string_types\n return self._device_class",
"def device_class(self):\n return self._device_class",
"def device_class(self):\n return self._device_class",
"def device_class(self):\n return self._device_class",
"def device_class(self):... | [
"0.8236841",
"0.81080234",
"0.81080234",
"0.81080234",
"0.81080234",
"0.81080234",
"0.8098537",
"0.8098537",
"0.8098537",
"0.8081694",
"0.7970818",
"0.7960429",
"0.7768537",
"0.77530825",
"0.7750649",
"0.7747736",
"0.77304596",
"0.77304596",
"0.7726728",
"0.7711223",
"0.76767... | 0.87224925 | 0 |
Create the checkpoint store if it doesn't exist. Do nothing if it does exist. | async def create_checkpoint_store_if_not_exists_async(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_checkpoint(self):\n checkpoint_id = uuid.uuid4()\n self.checkpoints.append(checkpoint_id)\n self.journal_data[checkpoint_id] = {}\n return checkpoint_id",
"async def create_checkpoint_if_not_exists_async(self, partition_id):",
"def create_checkpoint(self, name, path=''):\... | [
"0.70972866",
"0.6645903",
"0.6592704",
"0.6521263",
"0.6488971",
"0.6313787",
"0.6285108",
"0.61896694",
"0.61395836",
"0.6081894",
"0.60799813",
"0.5925777",
"0.5921968",
"0.5907098",
"0.5903792",
"0.5847658",
"0.5831139",
"0.58235127",
"0.5816881",
"0.580975",
"0.57879347"... | 0.8280361 | 0 |
Get the checkpoint data associated with the given partition. Could return null if no checkpoint has been created for that partition. | async def get_checkpoint_async(self, partition_id): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_checkpoint_data(self) -> Dict[str, Any]:\n # get ckpt file path from config.trainer.params.resume_from_checkpoint\n path = self.config.trainer.params.get(\"resume_from_checkpoint\", None)\n if path is not None:\n is_zoo = self.is_zoo_path(path)\n ckpt_filepath = p... | [
"0.5862637",
"0.578481",
"0.5767617",
"0.57472664",
"0.5435252",
"0.54299784",
"0.5424905",
"0.54226506",
"0.5250481",
"0.52406776",
"0.5233411",
"0.5198287",
"0.5172823",
"0.5165977",
"0.51448226",
"0.5066006",
"0.5058966",
"0.50571597",
"0.5037592",
"0.5024804",
"0.5024804"... | 0.631377 | 0 |
Create the given partition checkpoint if it doesn't exist.Do nothing if it does exist. The offset/sequenceNumber for a freshlycreated checkpoint should be set to StartOfStream/0. | async def create_checkpoint_if_not_exists_async(self, partition_id): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_checkpoint(self):\n checkpoint_id = uuid.uuid4()\n self.checkpoints.append(checkpoint_id)\n self.journal_data[checkpoint_id] = {}\n return checkpoint_id",
"def create_checkpoint(self, name, path=''):\n\n\t\tnb_path = self._get_os_path(name, path)\n\t\tself.log.debug('creati... | [
"0.71490896",
"0.67398703",
"0.64255923",
"0.61015904",
"0.5895706",
"0.58586687",
"0.57565933",
"0.5755999",
"0.5695841",
"0.56847334",
"0.5643659",
"0.5631174",
"0.5542495",
"0.5520891",
"0.54894",
"0.54461837",
"0.5420947",
"0.54185545",
"0.5389925",
"0.53736186",
"0.53691... | 0.7512399 | 0 |
Update the checkpoint in the store with the offset/sequenceNumber in the provided checkpoint. | async def update_checkpoint_async(self, lease, checkpoint): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commit(self, checkpoint):\n self._validate_checkpoint(checkpoint)\n self.journal.commit_checkpoint(checkpoint)",
"def checkpoint():",
"def checkpoint(self):\n save()",
"def save(self, checkpoint) -> None:\r\n self.model.save(checkpoint)",
"def checkCheckpoint(self):\n ... | [
"0.6392446",
"0.5900123",
"0.58112854",
"0.57046765",
"0.5625327",
"0.5596966",
"0.55401856",
"0.5539728",
"0.5455546",
"0.54244757",
"0.54103863",
"0.54103607",
"0.5339984",
"0.53249836",
"0.5317054",
"0.52981025",
"0.52906066",
"0.52866733",
"0.52836686",
"0.52573085",
"0.5... | 0.6690265 | 0 |
Delete the stored checkpoint for the given partition. If there is no stored checkpoint for the given partition, that is treated as success. | async def delete_checkpoint_async(self, partition_id): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_partition(self, partition):\n raise NotImplementedError('delete_file')",
"def remove_checkpoint(cls, checkpoint):\n cls.log.info('Removing checkpoint: {}'.format(checkpoint))\n # TODO: remove ckpt\n cls.log.info('Checkpoint successfully removed.')\n raise NotImplemen... | [
"0.69669724",
"0.67575854",
"0.6635984",
"0.66154027",
"0.60740983",
"0.58935225",
"0.5824596",
"0.5600834",
"0.5513917",
"0.54515386",
"0.5400783",
"0.5331493",
"0.52241397",
"0.5146763",
"0.5135621",
"0.51308155",
"0.50677407",
"0.50672567",
"0.50044715",
"0.49693355",
"0.4... | 0.75711375 | 0 |
Return gino db connection. | async def _get_db_connection():
return await gino.Gino(get_database_dsn()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_db():\n if not hasattr(g, 'db_connection'):\n g.db_connection = connect_db()\n return g.db_connection",
"def get_db():\n if ( g.get( 'db' ) is None ):\n g.db = connect_db()\n\n return g.db.connect()",
"def get_connection():\n con = psycopg2.connect(**DB_CONFIG)\n return ... | [
"0.82987297",
"0.81367755",
"0.8045762",
"0.8002333",
"0.7962778",
"0.7813542",
"0.7763936",
"0.7731745",
"0.7711683",
"0.7711683",
"0.76645315",
"0.76272947",
"0.7607147",
"0.75869054",
"0.75868905",
"0.757235",
"0.75476056",
"0.7537825",
"0.7537825",
"0.75252277",
"0.752363... | 0.87911695 | 0 |
Process the products file | def process_products_file(products_df: pd.DataFrame):
products = []
file_size = len(products_df)
logging.info(f"Processing PRODUCTS.csv file... {file_size} rows")
for index, row in products_df.iterrows():
if not pd.isnull(row["NAME"]):
product = Product(sku=row["SKU"], store="Richart... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_products(self, infile):\r\n raise NotImplementedError()",
"def parse_products(self, infile):\r\n self._verify_version(infile)\r\n return self._find_repeated_at_header(infile, 'products')",
"def parse_products_from_path(self, infile_path):\r\n with open(infile_path, 'r') as infile:\r\n ... | [
"0.79124767",
"0.696037",
"0.67617",
"0.66011345",
"0.6108828",
"0.61045",
"0.60991806",
"0.6097894",
"0.603769",
"0.6029704",
"0.5811111",
"0.57986873",
"0.5773931",
"0.5772088",
"0.5757938",
"0.5735328",
"0.5723004",
"0.57182187",
"0.5711612",
"0.56957793",
"0.5692984",
"... | 0.712695 | 1 |
Process the stock prices file | def process_stock(prices_stock_df: pd.DataFrame, sku_id_map: dict):
file_size = len(prices_stock_df)
logging.info(f"Processing PRICES-STOCK file... {file_size} rows")
# cleaning null values, since nullable is false for all columns
if prices_stock_df.isnull().values.sum() > 0:
logging.warning(f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_prices(self):\n temp = dict(self.currencies_and_regions)\n for index, row in self.df.iterrows():\n self.set_journal_name(row[\"Journal Name \"])\n self.set_issn(row[\"ISSN\"])\n self.set_journal()\n self.set_currency(row[\"Currency\"])\n ... | [
"0.6145986",
"0.61268437",
"0.60698384",
"0.60353726",
"0.60279983",
"0.592639",
"0.5907002",
"0.5895361",
"0.589207",
"0.58560973",
"0.58539104",
"0.5800323",
"0.5779686",
"0.5750188",
"0.57472175",
"0.5738437",
"0.57377434",
"0.5728328",
"0.57265234",
"0.5709909",
"0.567141... | 0.6143445 | 1 |
Calculate distance between to earth coordinates. Result is in miles. | def earth_distance(lat1: float, lon1: float, lat2: float, lon2: float)\
-> float:
# R = 6373.0 # earth radius in km
R = 3963.0 # earth radius in miles
lat1 = radians(lat1)
lon1 = radians(lon1)
lat2 = radians(lat2)
lon2 = radians(lon2)
dlon = lon2 - lon1
dlat = lat2 - lat1
a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _earth_distance(time='now'):\n return get_earth(time).radius",
"def delta_lat_miles(self, delta_lat):\n\n return delta_lat.dist_from_radius(EARTH_RADIUS)",
"def compute_distance_to_city_in_km(self, city):\n lat = math.radians(self.latitude - city.latitude)\n long = math.radians(self.lon... | [
"0.74275494",
"0.6892453",
"0.6786982",
"0.67252445",
"0.67228395",
"0.67050934",
"0.66883934",
"0.6661304",
"0.65835005",
"0.6579619",
"0.6579619",
"0.6579619",
"0.6579619",
"0.6579619",
"0.65778446",
"0.65706176",
"0.65483814",
"0.65294033",
"0.6504263",
"0.6497094",
"0.649... | 0.7156023 | 1 |
Function creates a dictionary. the keys are the US zip codes. The data is the earth coordinates of that key. | def create_zip_dict() -> dict:
with open('zip_coordinates.json', 'r') as zip_map:
return json.loads(zip_map.read()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_location_map():\n location_map = {}\n\n with open(INPUT_LOCATIONS_FILE, 'rbU') as csvfile:\n reader = csv.DictReader(csvfile)\n\n for row in reader:\n site_id = row[LOCATION_SITE_ID_COLUMN]\n location_map[site_id] = {\n 'site': site_id,\n ... | [
"0.58341604",
"0.5799127",
"0.5563583",
"0.5539249",
"0.5531852",
"0.55254287",
"0.55228376",
"0.55048984",
"0.5501812",
"0.5482409",
"0.5452615",
"0.5383974",
"0.53178364",
"0.5314",
"0.53053665",
"0.5299839",
"0.52937317",
"0.52866775",
"0.5254251",
"0.5245736",
"0.5233457"... | 0.6728724 | 0 |
Adds user to users_dict where phone_number is the index. | def add_phone_user(users_dict: dict, phone_number: str, radius: int,
user_zip_code: str, state: str, carrier: str,
provider_filter: list) -> None:
if user_zip_code in ZIP_MAP_DICT:
users_dict[phone_number] = {'radius': radius,
'user_z... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_data_to_user(self, user, number):\n self._users_numbers[user]['sum'] += number\n self._users_numbers[user]['counter'] += 1\n self._save_users_data_to_json()",
"def add_email_user(users_dict: dict, receiver_email_id: str, radius: int,\n user_zip_code: str, state: st... | [
"0.6371681",
"0.61536884",
"0.6136527",
"0.6124586",
"0.60745806",
"0.60219324",
"0.591637",
"0.58580947",
"0.58376384",
"0.58247584",
"0.5790983",
"0.57621574",
"0.5639502",
"0.55582273",
"0.5545957",
"0.5539338",
"0.5493719",
"0.548703",
"0.54865056",
"0.54504764",
"0.54406... | 0.78316915 | 0 |
Adds user to users_dict where email is the index. | def add_email_user(users_dict: dict, receiver_email_id: str, radius: int,
user_zip_code: str, state: str, provider_filter: list)\
-> None:
if user_zip_code in ZIP_MAP_DICT:
users_dict[receiver_email_id] = {'radius': radius,
'user_zip_code':... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(self, user):\n\t\tself.users[user.username] = user",
"def update_users_dict(users_dict: dict, start_idx: int) -> int:\n welcome_subj = 'Welcome to Vaccine Notification Bot\\n'\n rows = forms.get_spreadsheet_rows()\n row_num = start_idx\n while row_num < len(rows):\n row = rows[row... | [
"0.64367193",
"0.62758195",
"0.6195993",
"0.615368",
"0.6096906",
"0.60607636",
"0.6013181",
"0.59726024",
"0.5966099",
"0.5815017",
"0.58024555",
"0.57777363",
"0.57641613",
"0.57629716",
"0.5728287",
"0.5720518",
"0.5698041",
"0.568873",
"0.5678198",
"0.5655247",
"0.5648752... | 0.65925413 | 0 |
saves user dict in a json file for backup purposes. | def backup_users_dict(users_dict: dict) -> None:
with open('users.json', 'w') as usrs:
json.dump(users_dict, usrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saveUser(self):\n self.user[\"Video\"] = \"\"\n with open(self.user_file, \"w+\") as json_file:\n json.dump(self.user, json_file, indent=4)",
"def save_user_db(file_path: str, user_db: dict) -> None:\n # In case directory is not yet existed.\n os.makedirs(os.path.dirname(file_p... | [
"0.79160696",
"0.76484644",
"0.75792545",
"0.7564305",
"0.7516156",
"0.74020296",
"0.73266774",
"0.73105067",
"0.73105067",
"0.73105067",
"0.7294279",
"0.7293666",
"0.722183",
"0.7220219",
"0.7195101",
"0.7185052",
"0.7102662",
"0.7087843",
"0.7079798",
"0.7076869",
"0.702014... | 0.83944935 | 0 |
Backups integer in a file | def backup_int_in_fname(num: int, file_name: str) -> None:
with open(file_name, 'w') as fname:
fname.write(str(num)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_id(statefile,id):\r\n last_id = get_last_id(statefile)\r\n\r\n if last_id < id:\r\n debug_print('Saving new ID %d to %s' % (id,statefile))\r\n f = open(statefile,'w')\r\n f.write(str(id)) \r\n f.close()\r\n else:\r\n debug_print('Received smaller ID, not saving.... | [
"0.5879927",
"0.5772266",
"0.5686658",
"0.5646186",
"0.5625953",
"0.56230485",
"0.5605597",
"0.54882634",
"0.5484334",
"0.54524106",
"0.54363966",
"0.53768647",
"0.53646547",
"0.53645605",
"0.53165406",
"0.52719533",
"0.5247665",
"0.52394104",
"0.52319556",
"0.5217797",
"0.52... | 0.79437625 | 0 |
Backups users_dict, start_idx and number of checked emails | def backup_all(users_dict: dict, start_idx: int, num_checked_emails: int)\
-> None:
backup_users_dict(users_dict)
backup_int_in_fname(start_idx, START_IDX_FNAME)
backup_int_in_fname(num_checked_emails, CHECKED_EMAILS_FNAME) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_backup_frequently(start_time: float, users_dict: dict, start_idx: int,\n num_checked_emails: int) -> float:\n if (time.time() - start_time) >= TIME_BTWN_BACKUPS:\n backup_all(users_dict, start_idx, num_checked_emails)\n start_time = time.time()\n return start_time... | [
"0.63424826",
"0.6203582",
"0.5460792",
"0.5445886",
"0.5282476",
"0.52355975",
"0.51880753",
"0.5176431",
"0.50932837",
"0.50871277",
"0.50779337",
"0.50512546",
"0.49792933",
"0.4969923",
"0.49539256",
"0.48801976",
"0.4874053",
"0.48268807",
"0.47646737",
"0.47608447",
"0.... | 0.7707586 | 0 |
Checks if program is connected to the internet | def connected_internet() -> bool:
url = "http://www.google.com"
timeout = 5
try:
requests.get(url, timeout=timeout)
return True
except (requests.ConnectionError, requests.Timeout):
print("\nError: No internet connection!\n")
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def internet_on():\n try:\n urllib.request.urlopen('http://216.58.192.142', timeout=1)\n return True\n except urllib.error.URLError: \n return False",
"def check_internet_connection():\n logging.debug('Checking internet connection')\n try:\n urlopen(config.api_... | [
"0.8402741",
"0.81664187",
"0.81207067",
"0.8028666",
"0.7969387",
"0.7780724",
"0.7601167",
"0.7518803",
"0.7517342",
"0.7461233",
"0.7404457",
"0.7366631",
"0.73552483",
"0.7307919",
"0.730634",
"0.72964805",
"0.726568",
"0.7262994",
"0.7230731",
"0.7223778",
"0.7178904",
... | 0.81923765 | 1 |
If a state is not in the all_states_dict, it will retrive information of the state from api and add them to the dictionary. | def add_to_state_dict(all_states_dict: dict, state: str) -> None:
if state not in all_states_dict:
url = 'https://www.vaccinespotter.org/api/v0/states/' +\
f'{state}.json'
all_states_dict[state] = get_json_dict(url) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_states(state_id=None):\n if request.method == 'GET':\n _states = storage.all(State).values()\n if state_id is None:\n list_states = list()\n for state in _states:\n list_states.append(state.to_dict())\n return jsonify(list_states)\n el... | [
"0.65380174",
"0.639293",
"0.639293",
"0.6252249",
"0.6252249",
"0.6252249",
"0.61788243",
"0.6091751",
"0.6018377",
"0.581677",
"0.5775532",
"0.57612264",
"0.5741486",
"0.57405615",
"0.57304984",
"0.57194334",
"0.56737757",
"0.56712735",
"0.56711644",
"0.56655276",
"0.562790... | 0.81669444 | 0 |
Sends unsubriction messages and updates users_dict accordingly | def remove_users(users_to_remove: list, users_dict: dict,
end_of_service: str) -> None:
for reciever in users_to_remove:
if reciever in users_dict:
send_message(reciever,
'Subscription expired\n',
end_of_service,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate_user_setup():\n\n app.active_users.pop(current_user.get_id(), None)\n try:\n requests.post(\"http://localhost:9090\",\n json={\"active_users\": app.active_users})\n except:\n logger.info('Unable to send updated list of active users.')\n return Respo... | [
"0.6158356",
"0.6118215",
"0.57960594",
"0.5762846",
"0.5744878",
"0.5733173",
"0.57019323",
"0.5699415",
"0.56909066",
"0.5647859",
"0.563224",
"0.5595672",
"0.556919",
"0.5552289",
"0.55147916",
"0.5441478",
"0.5394985",
"0.53779006",
"0.53454936",
"0.5318624",
"0.5312623",... | 0.6206143 | 0 |
Run the module checks. Validate `volumes` against defined rules. | def run(self, args, payload):
if not payload.data or \
"RequestBody" not in payload.data or \
"HostConfig" not in payload.data["RequestBody"] or \
"Binds" not in payload.data["RequestBody"]["HostConfig"] or \
not payload.data["RequestBody"]["HostConfig"]["Bind... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creation_validation(**_):\n\n for property_key in constants.VOLUME_REQUIRED_PROPERTIES:\n utils.validate_node_property(property_key, ctx.node.properties)\n\n volume_object = _get_volumes_from_id(utils.get_resource_id())\n\n if ctx.node.properties['use_external_resource'] and not volume_object:\... | [
"0.6400132",
"0.6099742",
"0.59704447",
"0.5845609",
"0.57023036",
"0.5633817",
"0.55474246",
"0.55471563",
"0.553963",
"0.553679",
"0.5518688",
"0.5439739",
"0.5425041",
"0.530922",
"0.5288537",
"0.5284634",
"0.5239858",
"0.52161574",
"0.5209392",
"0.5207702",
"0.51910925",
... | 0.61402726 | 1 |
Create an ascii chart passing a list of tuples [('label', int)] | def chartify(title, data, auto=False):
if auto == True:
chart = ''
graph = Pyasciigraph(
line_length=8,
min_graph_length=15,
separator_length=2,
titlebar='-',
float_format='{0:.0f}'
)
for line in graph.g... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_hkl(hkl):\n hkl_str= []\n for i in hkl:\n if i<0:\n label = str(int(-i))\n label = r\"$\\bar{\" + label + '}$'\n hkl_str.append(str(label))\n else:\n hkl_str.append(str(int(i)))\n\n return hkl_str",
"def d... | [
"0.6230561",
"0.6230561",
"0.59490335",
"0.58664906",
"0.5854261",
"0.5838542",
"0.5816011",
"0.581446",
"0.5800546",
"0.5789171",
"0.5788838",
"0.5785453",
"0.57789856",
"0.5771287",
"0.57660764",
"0.5761",
"0.5742607",
"0.5727916",
"0.57197857",
"0.5709421",
"0.5708016",
... | 0.65026224 | 0 |
Returns the first ICachableItem in the ICachableSource | def first(self):
# we need to create a new object to insure we don't corrupt the generator count
csvsource = CSVSource(self.source, self.factory, self.key())
try:
item = csvsource.items().next()
return item
except StopIteration:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetFirstVisibleItem(self):\r\n\r\n return self.GetNextVisible(self.GetRootItem())",
"def get_first_item(cls):\n return cls.query.first()",
"def GetFirstVisibleItem(self):\r\n\r\n id = self.GetRootItem()\r\n if not id:\r\n return id\r\n\r\n while id:\r\n ... | [
"0.6724672",
"0.6649137",
"0.6547738",
"0.6443537",
"0.62967414",
"0.6210913",
"0.61514056",
"0.6134868",
"0.6129987",
"0.6128372",
"0.609683",
"0.60472065",
"0.6029116",
"0.6029116",
"0.60171044",
"0.5992828",
"0.5991311",
"0.59837943",
"0.5958937",
"0.5958017",
"0.5931253",... | 0.6728782 | 0 |
Save the pose annotations as pickle files into the parent directory. A pickle file is created for each page in the flipbook with the name of the first image in the flipbook_page list as the base for the pickle file name. | def save_annotations(self):
for fp in self.ris_widget.flipbook_pages:
if len(fp) == 0:
# skip empty flipbook pages
continue
annotations = getattr(fp, 'annotations', {})
pose = annotations.get('pose', (None, None))
if pose is not Non... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_annotations(self):\n for fp in self.ris_widget.flipbook_pages:\n annotations = getattr(fp, 'annotations', {})\n pose = annotations.get('pose')\n if pose in (None, (None, None)):\n annotation_path = pathlib.Path(fp[0].name).with_suffix('.pickle')\n ... | [
"0.6699898",
"0.62856084",
"0.62541544",
"0.6239457",
"0.62388873",
"0.61875534",
"0.6013627",
"0.59702724",
"0.59372914",
"0.59145504",
"0.5901724",
"0.58686095",
"0.5846293",
"0.5817632",
"0.5789043",
"0.57673407",
"0.5764438",
"0.5737751",
"0.5732007",
"0.57259893",
"0.572... | 0.82269835 | 0 |
Loads annotation metadata from a pickle file for each flipbook page. | def load_annotations(self):
for fp in self.ris_widget.flipbook_pages:
annotations = getattr(fp, 'annotations', {})
pose = annotations.get('pose')
if pose in (None, (None, None)):
annotation_path = pathlib.Path(fp[0].name).with_suffix('.pickle')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_annotations(self):\n assert self.ann_file.endswith('.pkl')\n ann_info = hload_pkl(self.ann_file)\n\n video_infos = []\n for i, video_info in enumerate(ann_info):\n frame_dir = video_info['filename']\n video_info['filename'] = osp.join(self.data_prefix, vid... | [
"0.6767046",
"0.6745939",
"0.6745939",
"0.67076623",
"0.6634813",
"0.65608376",
"0.63698596",
"0.6344268",
"0.6300048",
"0.6291199",
"0.6248526",
"0.61156565",
"0.59817755",
"0.5919239",
"0.5848062",
"0.58384204",
"0.578722",
"0.5757954",
"0.5754702",
"0.5747789",
"0.5675426"... | 0.8129906 | 0 |
Sanitizes file list inputs This function checks that the input is a list of files and not a directory. If the input is a directory, then it returns a list of files in the directory which match the desired extension. This is to allow all functions which input filelists to be more flexible by accepting directories instea... | def enf_filelist(filelist, extension = None):
new_filelist = None
if isinstance(filelist, str):
if os.path.isdir(filelist):
new_filelist = list_files(False, filelist, False, False)
elif os.path.isfile(filelist):
new_filelist = [filelist]
elif isinstance(filelist, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_input_type(input_files, p_input):\n if os.path.isfile(p_input):\n log.info(\" {} is a file\".format(p_input))\n input_files.append(os.path.realpath(p_input))\n elif os.path.isdir(p_input):\n log.info(\" {} is a directory\".format(p_input))\n for i in os.listdir(p_inp... | [
"0.6845456",
"0.64987975",
"0.6449319",
"0.6444403",
"0.63895744",
"0.6346652",
"0.6163024",
"0.6152078",
"0.61104137",
"0.6080395",
"0.6044191",
"0.59927666",
"0.59622735",
"0.59470856",
"0.59453946",
"0.59252733",
"0.5914755",
"0.5878536",
"0.58682454",
"0.5827222",
"0.5801... | 0.690099 | 0 |
Outputs a for this set of choice fields. If an id was given to the field, it is applied to the (each item in the list will get an id of `$id_$i`). | def render(self):
id_ = self.attrs.get('id')
output = []
for i, choice in enumerate(self.choices):
choice_value, choice_label = choice
if isinstance(choice_label, (tuple, list)):
attrs_plus = self.attrs.copy()
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, *args, **kwargs):\n super(TaggedContentItemForm, self).__init__(*args, **kwargs)\n wtf = Tag.objects.filter(group__system=False)\n wlist = [w for t, w in self.fields.items() if t.endswith(\"tags\")]\n choices = []\n for choice in wtf:\n choices.appen... | [
"0.6162202",
"0.5937744",
"0.5696218",
"0.55792147",
"0.5560924",
"0.55306536",
"0.5484636",
"0.54479605",
"0.5422105",
"0.53681815",
"0.5343677",
"0.5337337",
"0.5318692",
"0.53109103",
"0.5300496",
"0.5278475",
"0.5266853",
"0.5259888",
"0.52457404",
"0.52238506",
"0.521613... | 0.64582294 | 0 |
Yields all "subwidgets" of this widget. Used only by RadioSelect to allow template access to individual buttons. Arguments are the same as for render(). | def subwidgets(self, name, value, attrs=None, choices=()):
yield SubWidget(self, name, value, attrs, choices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnotebook_get_widgets(self):\n logger.debug(\"Getting subnotebook widgets\")\n for child in self.subnotebook.winfo_children():\n for widget in child.winfo_children():\n yield widget",
"def controls(self):\n for control_name, control in self._controls.items():\... | [
"0.7339657",
"0.6049669",
"0.60192585",
"0.5965529",
"0.580476",
"0.5727371",
"0.5648228",
"0.5619505",
"0.5527141",
"0.5507715",
"0.54807943",
"0.5476447",
"0.5463118",
"0.54614747",
"0.5458937",
"0.54577464",
"0.544296",
"0.5431474",
"0.54081374",
"0.5406699",
"0.5389316",
... | 0.77834576 | 0 |
Initializes the Exception super class. A LicenseError may be thrown in any situation where the license utility is no longer able to function normally. Such a situation may be, for example, a cache miss or a connection timeout. | def __init__(self, message):
self.message = LicenseError.ERROR + message
super(LicenseError, self).__init__(self.message) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, error_msg):\n super(SdkException, self).__init__()\n self.error_msg = error_msg",
"def __init__(self, error_msg):\n super(ConnectionException, self).__init__(error_msg)",
"def __init__(self, message=None):\n if message is not None:\n super(CryptoritoErr... | [
"0.65959734",
"0.6497052",
"0.6321168",
"0.62885094",
"0.62885094",
"0.62500423",
"0.62500423",
"0.62500423",
"0.6239265",
"0.6191645",
"0.61159605",
"0.60947406",
"0.6065064",
"0.60574734",
"0.6050633",
"0.59896815",
"0.5961667",
"0.5956962",
"0.59289414",
"0.58312845",
"0.5... | 0.73440796 | 0 |
if our categorical variable is outside the training range we should get an error | def test_check_X_categorical_prediction_exceeds_training(wage_X_y, wage_gam):
X, y = wage_X_y # last feature is categorical
gam = wage_gam
# get edge knots for last feature
eks = gam.edge_knots_[-1]
# add 1 to all Xs, thus pushing some X past the max value
X[:,-1] = eks[-1] + 1
with pyte... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categorical_error(pred, label):\n pred_label = pred.argmax(1)\n return (pred_label != label.flat).mean()",
"def test_bad_probabilities(self):\n categories = {\"asdfa\": 0.05, 2: 0.2, 3: 0.3, 4: 0.4}\n with pytest.raises(ValueError):\n Categorical(\"yolo\", categories, shape=2)"... | [
"0.66758",
"0.6459396",
"0.62046295",
"0.61935663",
"0.6019165",
"0.59724116",
"0.5962899",
"0.5848276",
"0.5844983",
"0.58389235",
"0.5835288",
"0.581761",
"0.5805156",
"0.5745569",
"0.57159996",
"0.569877",
"0.5692589",
"0.56298006",
"0.5598858",
"0.55951244",
"0.5565085",
... | 0.67997986 | 0 |
y must be int or float, or we should get a value error | def test_check_y_not_int_not_float(wage_X_y, wage_gam):
X, y = wage_X_y
y_str = ['hi'] * len(y)
with pytest.raises(ValueError):
check_y(y_str, wage_gam.link, wage_gam.distribution) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self, y):\n if type(y) is not int:\n raise TypeError(\"y must be an integer\")\n elif y < 0:\n raise ValueError(\"y must be >= 0\")\n else:\n self.__y = y",
"def y(self, value):\n if isinstance(value, int) is False:\n raise TypeError(\... | [
"0.74572945",
"0.74086297",
"0.7302532",
"0.7258615",
"0.7258615",
"0.70641804",
"0.70641804",
"0.7033145",
"0.69622576",
"0.69433475",
"0.66710734",
"0.66480345",
"0.6640732",
"0.66212523",
"0.6571579",
"0.65516764",
"0.6545311",
"0.6501856",
"0.6500798",
"0.64742714",
"0.64... | 0.7629978 | 0 |
check_y will try to cast data to numerical types | def test_check_y_casts_to_numerical(wage_X_y, wage_gam):
X, y = wage_X_y
y = y.astype('object')
y = check_y(y, wage_gam.link, wage_gam.distribution)
assert y.dtype == 'float' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_y_not_int_not_float(wage_X_y, wage_gam):\n X, y = wage_X_y\n y_str = ['hi'] * len(y)\n\n with pytest.raises(ValueError):\n check_y(y_str, wage_gam.link, wage_gam.distribution)",
"def test_cast_y_axis_extrema_invalid_input(self):\r\n self.assertRaises(ValueError, _cast_y_axis... | [
"0.7408277",
"0.66127574",
"0.65909016",
"0.6586264",
"0.6568507",
"0.6526574",
"0.65083545",
"0.64178467",
"0.6367658",
"0.6268803",
"0.6244363",
"0.62148225",
"0.6200416",
"0.6164388",
"0.6150249",
"0.61289793",
"0.612409",
"0.60860646",
"0.60179114",
"0.5984405",
"0.597935... | 0.81521446 | 0 |
check_y expects a minimum number of samples | def test_check_y_not_min_samples(wage_X_y, wage_gam):
X, y = wage_X_y
with pytest.raises(ValueError):
check_y(y, wage_gam.link, wage_gam.distribution, min_samples=len(y)+1, verbose=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_xy(x_train, y_train):\n try:\n x_train = x_train.astype('float64')\n except ValueError:\n raise ValueError('x_train should only contain numerical data.')\n\n if len(x_train.shape) < 2:\n raise ValueError('x_train should at least has 2 dimensions.')\n\n if x_train.shape... | [
"0.6540148",
"0.65400946",
"0.64137685",
"0.63812244",
"0.63784605",
"0.6373528",
"0.6321459",
"0.6227734",
"0.6199862",
"0.61773986",
"0.61525565",
"0.6143732",
"0.61329454",
"0.6128197",
"0.6123675",
"0.61037534",
"0.6081357",
"0.6078173",
"0.60767424",
"0.6049534",
"0.6017... | 0.76851916 | 0 |
if you give labels outide of the links domain, check_y will raise an error | def test_check_y_not_in_domain_link(default_X_y, default_gam):
X, y = default_X_y
gam = default_gam
with pytest.raises(ValueError):
check_y(y + .1, default_gam.link, default_gam.distribution, verbose=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_label_data(y):\n if not isinstance(y, np.ndarray):\n raise TypeError(\"Input must be ndarray.\")\n\n if y.ndim != 1:\n raise ValueError(\"Labels be 1-dimensional, i.e. have shape (N,)\")\n\n true_y = np.array([0,1])\n\n if not _is_disjoint(true_y, y):\n raise ValueErro... | [
"0.6445362",
"0.621761",
"0.6193036",
"0.6139817",
"0.6139772",
"0.6139772",
"0.61275953",
"0.602446",
"0.5981693",
"0.5939011",
"0.59324217",
"0.58408725",
"0.57959235",
"0.57922375",
"0.5778839",
"0.57582897",
"0.57152253",
"0.57118845",
"0.5705958",
"0.56862074",
"0.566765... | 0.6670711 | 0 |
check_X accepts at most 2D inputs | def test_check_X_too_many_dims():
with pytest.raises(ValueError):
check_X(np.ones((5,4,3))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_all(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim):\n\tcheck_dimensions(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim)\n\tcheck_coords(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim)\n\tcheck_consistent(X, x_lat_dim, x_lon_dim, x_sample_dim, x_feature_dim)\n\tcheck_type(X, x_lat_dim, ... | [
"0.713735",
"0.68716365",
"0.6746891",
"0.6664581",
"0.66553605",
"0.662606",
"0.6625996",
"0.66194844",
"0.65605354",
"0.65421766",
"0.6535834",
"0.65288496",
"0.65001637",
"0.6465924",
"0.64487416",
"0.6400444",
"0.63950336",
"0.6392053",
"0.63897413",
"0.63826835",
"0.6381... | 0.74756634 | 0 |
Test that an empty widget has height equal to 0. | def test_empty_widget_height(layout):
l = layout()
# Make sure this measurement does not depend on the width.
assert l.get_content_height(Widget(), Size(80, 24), Size(80, 24), 24) == 0
assert l.get_content_height(Widget(), Size(80, 24), Size(80, 24), 20) == 0
assert l.get_content_height(Widget(), Si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_widget_width(layout):\n l = layout()\n assert l.get_content_width(Widget(), Size(80, 24), Size(80, 24)) == 0",
"def test_empty_tree(height_one_tree):\n assert height_one_tree.root.val is 0",
"def test_empty_tree_size_is_zero(empty_t):\n assert empty_t.size() == 0",
"def test_size_i... | [
"0.77139467",
"0.6491676",
"0.61007786",
"0.60471123",
"0.6012454",
"0.5962576",
"0.59527946",
"0.58478224",
"0.5825735",
"0.5806543",
"0.5773377",
"0.5666229",
"0.56559396",
"0.5650151",
"0.5648924",
"0.5646082",
"0.56412065",
"0.5630848",
"0.5620137",
"0.5615883",
"0.560695... | 0.832431 | 0 |
Test that an empty widget has width equal to 0. | def test_empty_widget_width(layout):
l = layout()
assert l.get_content_width(Widget(), Size(80, 24), Size(80, 24)) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_widget_height(layout):\n l = layout()\n # Make sure this measurement does not depend on the width.\n assert l.get_content_height(Widget(), Size(80, 24), Size(80, 24), 24) == 0\n assert l.get_content_height(Widget(), Size(80, 24), Size(80, 24), 20) == 0\n assert l.get_content_height(Wi... | [
"0.6624659",
"0.652062",
"0.6430783",
"0.62367857",
"0.62327784",
"0.6162643",
"0.61332333",
"0.6047323",
"0.6030988",
"0.6001473",
"0.5983917",
"0.597312",
"0.58988035",
"0.5878145",
"0.58743906",
"0.58470494",
"0.5846612",
"0.5843084",
"0.5843084",
"0.58392036",
"0.5839176"... | 0.858069 | 0 |
Connects to Covid Data API, fits Prophet model on top level of cases, and projects down to all 50 states. | def build_prophet_preds(data_url: str,
changepoint_scale: float,
holidays_scale: float,
seasonality_scale: float,
growth ='logistic') -> DataFrame:
# read in the data
df = pd.read_csv(data_url, parse_dates=['date'])... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_modelling_data():\n # get latest epidemic data from OWID \n\n df = pd.read_json(requests.get(\"https://covid.ourworldindata.org/data/owid-covid-data.json\").content)\n data = pd.DataFrame(df[\"POL\"][\"data\"])\n\n # get latest government restriction data from Oxford tracker\n response =... | [
"0.56420654",
"0.5622741",
"0.56196016",
"0.5558588",
"0.54385155",
"0.5365485",
"0.5285113",
"0.5234567",
"0.5208985",
"0.51655126",
"0.5159388",
"0.51504195",
"0.51398194",
"0.5139508",
"0.5118033",
"0.51103914",
"0.5104452",
"0.51030946",
"0.50953126",
"0.50920737",
"0.507... | 0.58124185 | 0 |
DataSync Agent activation key during resource creation. Conflicts with `ip_address`. If an `ip_address` is provided instead, the provider will retrieve the `activation_key` as part of the resource creation. | def activation_key(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "activation_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gen_activation_hash():\r\n # for now just cheat and generate an api key, that'll work for now\r\n return User.gen_api_key()",
"def activation_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"activation_key\")",
"def pre_instance_ip_create(self, resource_dict):\n pas... | [
"0.62353057",
"0.617561",
"0.6117518",
"0.5778266",
"0.57485443",
"0.56870484",
"0.56066304",
"0.5584704",
"0.5560699",
"0.55584335",
"0.55480146",
"0.5534918",
"0.5482447",
"0.54535335",
"0.54522026",
"0.5446969",
"0.54447156",
"0.53755665",
"0.5341343",
"0.5339166",
"0.5308... | 0.63734895 | 0 |
The ARNs of the security groups used to protect your data transfer task subnets. | def security_group_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "security_group_arns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def security_group_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"security_group_arns\")",
"def subnet_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pul... | [
"0.6874092",
"0.668003",
"0.658642",
"0.658642",
"0.62552905",
"0.58397245",
"0.58397245",
"0.58367765",
"0.5822973",
"0.57905364",
"0.5768845",
"0.57308495",
"0.57002056",
"0.56986207",
"0.5637566",
"0.55986905",
"0.55891085",
"0.55891085",
"0.5579733",
"0.5562755",
"0.55619... | 0.66815764 | 1 |
The Amazon Resource Names (ARNs) of the subnets in which DataSync will create elastic network interfaces for each data transfer task. | def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:
return pulumi.get(self, "subnet_arns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnets(self) -> Sequence[str]:\n return pulumi.get(self, \"subnets\")",
"def subnets(self) -> pulumi.Input[Sequence[pulumi.Input[str]]]:\n return pulumi.get(self, \"subnets\"... | [
"0.6602342",
"0.64548296",
"0.62762284",
"0.61291474",
"0.60777736",
"0.60777736",
"0.601091",
"0.5953753",
"0.5826047",
"0.5806087",
"0.57441294",
"0.57441294",
"0.57441294",
"0.5640168",
"0.55525875",
"0.55525875",
"0.55525875",
"0.55371565",
"0.55371565",
"0.55371565",
"0.... | 0.65944064 | 1 |
The ID of the VPC (virtual private cloud) endpoint that the agent has access to. | def vpc_endpoint_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "vpc_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_endpoint_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"vpc_endpoint_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vpc_id(self) -> str:\n return pulumi... | [
"0.7875883",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7111536",
"0.7111536",
"0.7111536",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.67907846",
"0.6777866",
"0.674632... | 0.75328296 | 1 |
DataSync Agent activation key during resource creation. Conflicts with `ip_address`. If an `ip_address` is provided instead, the provider will retrieve the `activation_key` as part of the resource creation. | def activation_key(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "activation_key") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _gen_activation_hash():\r\n # for now just cheat and generate an api key, that'll work for now\r\n return User.gen_api_key()",
"def activation_key(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"activation_key\")",
"def pre_instance_ip_create(self, resource_dict):\n pas... | [
"0.6234712",
"0.6176199",
"0.6118718",
"0.57782984",
"0.57495034",
"0.56886953",
"0.56063545",
"0.55845433",
"0.5561834",
"0.55597174",
"0.5549204",
"0.5535288",
"0.54819125",
"0.54516864",
"0.5450405",
"0.5447155",
"0.5445438",
"0.5372328",
"0.5339682",
"0.53390735",
"0.5307... | 0.6373504 | 1 |
Get an existing Agent resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None,
activation_key: Optional[pulumi.Input[str]] = None,
arn: Optional[pulumi.Input[str]] = None,
ip_address: Optional[pulumi.Input[str]] = None,
name: Opt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n arn: Optional[pulumi.Input[str]] = None,\n auth_mode: Optional[pulumi.Input[str]] = None,\n default_s3_location: Optional[pulumi.Input[str]] = None,\n ... | [
"0.576372",
"0.5756994",
"0.5646934",
"0.54146105",
"0.5408501",
"0.5401942",
"0.5386253",
"0.53852665",
"0.5383",
"0.5361384",
"0.53558916",
"0.5351404",
"0.5294454",
"0.5294106",
"0.52562416",
"0.5238311",
"0.52045614",
"0.5190243",
"0.51791805",
"0.51777947",
"0.5170941",
... | 0.7135629 | 0 |
The ARNs of the security groups used to protect your data transfer task subnets. | def security_group_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:
return pulumi.get(self, "security_group_arns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def security_group_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"security_group_arns\")",
"def security_group_arns(self) -> Optional[pulu... | [
"0.6681429",
"0.66803855",
"0.66803855",
"0.6587449",
"0.6587449",
"0.625835",
"0.5842866",
"0.5842866",
"0.5839594",
"0.58230954",
"0.5790986",
"0.5768961",
"0.57305783",
"0.57010907",
"0.57010525",
"0.56378984",
"0.5601252",
"0.55892366",
"0.55892366",
"0.55822897",
"0.5565... | 0.6873129 | 0 |
The Amazon Resource Names (ARNs) of the subnets in which DataSync will create elastic network interfaces for each data transfer task. | def subnet_arns(self) -> pulumi.Output[Optional[Sequence[str]]]:
return pulumi.get(self, "subnet_arns") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnet_arns(self) -> Optional[pulumi.Input[Sequence[pulumi.Input[str]]]]:\n return pulumi.get(self, \"subnet_arns\")",
"def subnets(self) -> Sequence[str]:\n retu... | [
"0.659404",
"0.659404",
"0.6453872",
"0.6275332",
"0.6128831",
"0.60768473",
"0.60768473",
"0.6011176",
"0.59524083",
"0.58249974",
"0.58047056",
"0.5743406",
"0.5743406",
"0.5743406",
"0.56398135",
"0.55517274",
"0.55517274",
"0.55517274",
"0.5536056",
"0.5536056",
"0.553605... | 0.6602296 | 0 |
The ID of the VPC (virtual private cloud) endpoint that the agent has access to. | def vpc_endpoint_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "vpc_endpoint_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vpc_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"vpc_endpoint_id\")",
"def vpc_endpoint_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"vpc_endpoint_id\")",
"def vpc_id(self) -> str:\n return pulumi.get(self, \"vpc_id\")",
"def vp... | [
"0.75328296",
"0.75328296",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7150874",
"0.7111536",
"0.7111536",
"0.7111536",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.699527",
"0.67907846",
"0.6777... | 0.7875883 | 0 |
saves a url to the name | def save_config(name, url):
db = dbm.open(config_file, 'c')
db[name] = url
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, url):\n self.database.insert({\n 'url': url,\n 'last_crawled': None,\n 'valid': True,\n 'sub_urls': [],\n })",
"def url_set(self, url):\n self.request('/v1.1/url', 'POST', body={'url': url})",
"def save(self, handler, name):",
"d... | [
"0.725519",
"0.66151965",
"0.6564083",
"0.65193725",
"0.63628507",
"0.6330228",
"0.628097",
"0.6273302",
"0.6251997",
"0.62253827",
"0.6162076",
"0.6142175",
"0.61379576",
"0.61097974",
"0.60739774",
"0.60539067",
"0.5986397",
"0.59858453",
"0.5975642",
"0.5972344",
"0.594764... | 0.6683096 | 1 |
removes the name from configuration if name isnt there throughs a KeyError | def remove_config(name):
db = dbm.open(config_file, 'c')
del db[name]
db.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self, key_name: str):\n pass",
"def test_config_remove(self):\n test_name = sys._getframe().f_code.co_name\n self.env.config.set('project', 'name', 'Test project')\n rv, output = self._execute('config remove project name')\n self.assertEqual(0, rv)\n self.asse... | [
"0.63228136",
"0.6260883",
"0.60877913",
"0.6087198",
"0.60291284",
"0.60200816",
"0.5761726",
"0.57247347",
"0.57240105",
"0.572315",
"0.5709629",
"0.5677372",
"0.56758034",
"0.5675219",
"0.5662053",
"0.5641418",
"0.5618686",
"0.56177264",
"0.5605909",
"0.55837554",
"0.55778... | 0.637895 | 0 |
Receives observation and returns observations with shifted axis | def observation(self, obs):
# import pdb;pdb.set_trace()
return np.moveaxis(obs, 2, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform(self, x):\n if self.mode == 'lag':\n shifted = [x.shift(-abs(o), axis=0) for o in self.offsets]\n return pd.concat(shifted, axis=1)",
"def perfect_shift(y):\n return np.append([y[-1]],y[0:-1])",
"def to_sliding_window(x, y, timesteps, predict_ahead, index=None):\n\... | [
"0.6554428",
"0.6203731",
"0.60984206",
"0.6088289",
"0.5996381",
"0.5991377",
"0.5934671",
"0.59117955",
"0.5803267",
"0.57742065",
"0.5754753",
"0.5701466",
"0.56806606",
"0.5676433",
"0.56746566",
"0.5620584",
"0.5617224",
"0.56023115",
"0.5602183",
"0.5599014",
"0.5578049... | 0.72145534 | 0 |
Add new observation to the bottom of the queue of observations | def observation(self, observation):
# push backward all observations
self.buffer[:-1] = self.buffer[1:]
# add last observation to the end (similar to adding an item to a queue)
self.buffer[-1] = observation
return self.buffer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append ( self , item ) :\n self.cond.acquire()\n try:\n if self.closed :\n raise Exception( \"Trying to append to a closed queue\" )\n else :\n self.weight += int( item['size'] )\n self.push( item )\n self.cond.noti... | [
"0.6762668",
"0.66363573",
"0.654034",
"0.64803696",
"0.6428696",
"0.6428696",
"0.6392402",
"0.6344242",
"0.6338227",
"0.6297308",
"0.6265191",
"0.625431",
"0.6248165",
"0.6248165",
"0.6224092",
"0.6176254",
"0.6175321",
"0.6174006",
"0.6167346",
"0.6155351",
"0.615308",
"0... | 0.7154061 | 0 |
Test urlpatterns is not empty. | def test_urls():
assert len(urlpatterns) > 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_urlpattern_with_options(cls):\n p = re.compile('\\{\\w+\\}')\n for urlpattern in cls.urlpatterns:\n matches = p.findall(urlpattern)\n not_found = copy.copy(matches)\n for match in matches:\n if not cls.urlpattern_options.get(match.strip('{}... | [
"0.6885281",
"0.6488244",
"0.63631237",
"0.63566864",
"0.63373655",
"0.6293202",
"0.62435323",
"0.6177724",
"0.6165472",
"0.61581266",
"0.6152045",
"0.5998634",
"0.599404",
"0.59667355",
"0.5962423",
"0.59366286",
"0.58937687",
"0.58869284",
"0.5864858",
"0.5860892",
"0.58568... | 0.8075284 | 0 |
loads local user's Google Chrome URL istory | def load_chrome_urls():
#path to user's history database (Chrome)
data_path = os.path.expanduser('~')+"/Library/Application Support/Google/Chrome/Default"
files = os.listdir(data_path)
history_db = os.path.join(data_path, 'history')
#querying the db
c = sqlite3.connect(history_db)
cursor = c.cursor()
select_sta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_chrome(url,chrome_path):\r\n webbrowser.register('chrome', None,webbrowser.BackgroundBrowser(chrome_path))\r\n webbrowser.get('chrome').open(url)",
"def test_chrome(chrome_browser):\n chrome_browser.get(\"https://habr.com/ru/\")\n print(chrome_browser.title)\n pass",
"def default_login(... | [
"0.65543824",
"0.6073231",
"0.6053677",
"0.60271287",
"0.5819687",
"0.57510465",
"0.56710464",
"0.56037456",
"0.55292827",
"0.5524949",
"0.55137295",
"0.5450229",
"0.54418397",
"0.5427287",
"0.54155827",
"0.5408933",
"0.5399406",
"0.53921163",
"0.5381433",
"0.5355887",
"0.533... | 0.6531907 | 1 |
process bpr state ready | def process_state_ready(self):
try:
notifier.DEBUG("{0} Processing State Ready".format(self.msg_type))
if FSwiftMLUtils.get_acm_version() >= 2016.4:
ops_doc = FSwiftWriterUtils.CreateOperationsDocument(OperationsDocumentStatus.PENDING_GENERATION,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ready(self):\n pass",
"def ready(self):\n self.update({self.STATE: self.STATE_READY})",
"def ready(cls):\n pass",
"def _ready(cls):\n sync_call(cls.ready)",
"def state_wait_do(cfg, app, win, events):",
"def busy(self):\n pass",
"def ready(self):\n return Tr... | [
"0.6313268",
"0.6121197",
"0.60865843",
"0.60154366",
"0.59800637",
"0.59524584",
"0.5913562",
"0.58884543",
"0.587403",
"0.5858095",
"0.5805283",
"0.5769507",
"0.5723698",
"0.5714407",
"0.5693785",
"0.5682883",
"0.56814677",
"0.56806606",
"0.5678911",
"0.56704426",
"0.566912... | 0.68642116 | 0 |
process bpr state swiftmsggenerated | def process_state_swiftmsggenerated(self):
try:
notifier.DEBUG("{0} Processing State SwiftMsgGenerated".format(self.msg_type))
self.acm_obj = FSwiftMLUtils.get_acm_object_from_bpr(self.business_process)
carbon_copy_swift_path = getattr(self.fsec_lending_borrowing_out_msg_con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_state_ready(self):\n try:\n notifier.DEBUG(\"{0} Processing State Ready\".format(self.msg_type))\n if FSwiftMLUtils.get_acm_version() >= 2016.4:\n ops_doc = FSwiftWriterUtils.CreateOperationsDocument(OperationsDocumentStatus.PENDING_GENERATION,\n ... | [
"0.64260256",
"0.6053004",
"0.585665",
"0.5743554",
"0.57341564",
"0.5694928",
"0.56583196",
"0.55590034",
"0.55037546",
"0.54856837",
"0.5484569",
"0.5462096",
"0.5454165",
"0.5420548",
"0.53284925",
"0.5323496",
"0.5317789",
"0.53137064",
"0.53022933",
"0.528647",
"0.528225... | 0.7475807 | 0 |
Returns a flattened dictionary of all default property assignments visible in the current scope that apply to the current component type. | def get_default_properties(self, comp_type):
# type: (Type[comp.Component]) -> DefaultNSScope
# Flatten out all the default assignments that apply to the current scope
# This does not include any default assignments made within the current
# scope, so exclude those.
props = {}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_object_values() -> Dict[str, AllowedDefaultValueTypes]:\n # TODO(wxy): Cache this as it is accessed many times.\n\n default_object_values: Dict[str, AllowedDefaultValueTypes] = json.loads(\n constants.get_package_file_contents(\n 'extensions', feconf.OBJECT_DEFAULT_VALUES_EX... | [
"0.6066888",
"0.59468824",
"0.5941399",
"0.5932694",
"0.58491874",
"0.5823343",
"0.57963926",
"0.57819486",
"0.5780772",
"0.5744289",
"0.5743921",
"0.5691644",
"0.56908983",
"0.5685753",
"0.56778157",
"0.56726056",
"0.5652493",
"0.5640272",
"0.56331754",
"0.5615772",
"0.56122... | 0.78932494 | 0 |
Export all messages listed in the Locations view to an editor. | def export_locations_to_editor():
categories = {}
# Get all messages
msgs = GPS.Message.list()
# Filter them and organize them by category and file
for m in msgs:
if m.get_flags() & 2:
file = m.get_file()
category = m.get_category()
if category in cat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_messages(self):",
"def show_messages(self):\n for msg in self.messages:\n print msg['text']",
"def outbox():\n with mail.record_messages() as messages:\n yield messages",
"def export_debug(self):\n outpath = tkinter.filedialog.askdirectory()\n if outpath:\n ... | [
"0.5634205",
"0.5439352",
"0.54138184",
"0.5349344",
"0.51836026",
"0.5100124",
"0.5032155",
"0.49391425",
"0.49216416",
"0.49184898",
"0.48646864",
"0.48646864",
"0.4849731",
"0.48466447",
"0.48368335",
"0.48164085",
"0.4813855",
"0.47817117",
"0.4772263",
"0.47714886",
"0.4... | 0.77834123 | 0 |
Export the current contents of the Call Trees view to an editor. | def export_call_trees_to_editor():
def dump_tree_model(model, indent):
values = []
if model:
for row in model:
first = row[0]
if first == 'computing...':
return []
if not row[1] or \
first.endswith(' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def editor():\n pass",
"def view(self):\n from devito.ir.iet.visitors import printAST\n return printAST(self)",
"def printEditor(self, editor):\n if editor:\n editor.printFile()\n else:\n return",
"def newEditorView(self, fn, caller, filetype=\"\", indexes... | [
"0.57501394",
"0.5746306",
"0.5378914",
"0.53503275",
"0.530981",
"0.5293571",
"0.52920216",
"0.52866894",
"0.5244689",
"0.52445114",
"0.5241782",
"0.5221649",
"0.5215768",
"0.52141726",
"0.5173871",
"0.515437",
"0.5149763",
"0.51245195",
"0.50676304",
"0.50348616",
"0.502326... | 0.794899 | 0 |
returns all foreign key related "Education" objects | def get_education(self):
return self.education_set.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fk_associations(cls):\n return cls._fk_associations",
"def get_all_associations(self):\n return",
"def relationships(self):",
"def get_related_objects(self):\n result = []\n if self['name'] != None:\n tmp = ObjectDefinition.objects.filter(use__has_field=self['name']... | [
"0.5946261",
"0.5866776",
"0.5547653",
"0.55203164",
"0.5464811",
"0.5410512",
"0.53972787",
"0.53319305",
"0.5284525",
"0.5271634",
"0.5226311",
"0.5222267",
"0.5211503",
"0.520947",
"0.51888466",
"0.5163862",
"0.5141667",
"0.51315033",
"0.5130809",
"0.51035583",
"0.5077381"... | 0.70091456 | 0 |
returns all foreign key related "Experience" objects | def get_experience(self):
return self.experience_set.all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def experiences(self):\n return self.client.call('GET',\n self.name + 'experiences')",
"def get_queryset(self):\n #print(\"request\", self.request)\n user = self.request.user\n return Experience.objects.filter(person=user)",
"def test_get_experience(se... | [
"0.6236688",
"0.5885861",
"0.5714479",
"0.57142043",
"0.56880885",
"0.5682337",
"0.5635804",
"0.53942037",
"0.5355654",
"0.5292682",
"0.52872795",
"0.5286201",
"0.5253617",
"0.5236416",
"0.52096236",
"0.5207065",
"0.51510584",
"0.5133118",
"0.511934",
"0.51150346",
"0.5081128... | 0.75176424 | 0 |
Perform effect when owner is given a stat mod | def onStatMod(self, owner, degree, messages):
return degree | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proc_status_effect(\n self,\n status_att=None,\n status_val=False,\n resist=None\n ):\n\n # If a resist attribute is passed, the player\n # will attempt to resist... | [
"0.57254",
"0.56868446",
"0.55806035",
"0.5523254",
"0.5502065",
"0.5462021",
"0.5454974",
"0.53463185",
"0.5322893",
"0.5300302",
"0.5267078",
"0.526674",
"0.52480114",
"0.5192884",
"0.51817054",
"0.51704365",
"0.51664585",
"0.51457214",
"0.51200724",
"0.5114616",
"0.5107135... | 0.6730045 | 0 |
Create a unique cache key for the Target. We include the Task source code so that code changes in the Task automatically cause a cache miss | def key(self):
key = self.name
if self.task:
key += getsource(self.task.__class__)
return hashlib.md5(key.encode()).hexdigest() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for(self, target_id, sources):\r\n sha = hashlib.sha1()\r\n actual_srcs = self._sources_hash(sha, sources)\r\n return CacheKey(target_id, sha.hexdigest(), len(actual_srcs), actual_srcs)",
"def cache_key(self):\n return self.__class__.create_cache_key(self.key, **self.get_kwargs())",
"de... | [
"0.7224404",
"0.68715286",
"0.67488205",
"0.64955777",
"0.6480754",
"0.6397825",
"0.63585854",
"0.63507146",
"0.6325684",
"0.6281983",
"0.6177556",
"0.6177438",
"0.6128673",
"0.61172235",
"0.61028457",
"0.610261",
"0.6065786",
"0.5966013",
"0.59391737",
"0.58409697",
"0.58092... | 0.6993543 | 1 |
Retrieves the user's API key from the user record and stores in the API instance. This is done using a session authenticated with username and password, to avoid the user having to specify all three. | def _get_api_key(self):
self.api.apikey = self.api.action.user_show(id=self.username)['apikey'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_authentication():\r\n apikey = request.args.get('api_key', None)\r\n from flask import _request_ctx_stack\r\n if 'Authorization' in request.headers:\r\n apikey = request.headers.get('Authorization')\r\n if apikey:\r\n user = db.session.query(model.user.User... | [
"0.7394983",
"0.7255855",
"0.7149509",
"0.69122607",
"0.68423945",
"0.6838871",
"0.68173265",
"0.6802924",
"0.66542155",
"0.65650326",
"0.65239",
"0.64883554",
"0.6486136",
"0.6421507",
"0.6382293",
"0.6346643",
"0.6336477",
"0.62861747",
"0.6285456",
"0.6222244",
"0.62128776... | 0.76691073 | 0 |
Returns the domain of the server URL for use in filename cache keys. This is used so that a single cache directory can be shared by multiple cached CKAN instances. (`urlparse` behaves inconsistently.) | def server_domain(self):
url = self.api.address
domain_start = url.find('://') + 3 if url.find('://') >= 0 else 0
domain_end = url.find(':', domain_start) if url.find(':', domain_start) >= 0 else \
url.find('/', domain_start) if url.find('/', domain_start) >= 0 else \
url... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_domain():\n domain=\"\"\n for item in re.split(\"\\.\", env.host)[1:]:\n domain = domain + \".\" + item\n return domain.lstrip(\".\")",
"def getDomain(self):\n # ui = UrlInfo(url)\n # urlBytes = [ord(i) for i in url]\n host = self.url[self.host_head:self.host_tail]\n ... | [
"0.7324326",
"0.6910665",
"0.69020057",
"0.68455964",
"0.6841818",
"0.6833477",
"0.6808917",
"0.6749777",
"0.66682583",
"0.66576934",
"0.663891",
"0.66302705",
"0.66163117",
"0.66130763",
"0.6571513",
"0.6540287",
"0.65208185",
"0.6501143",
"0.6494181",
"0.6494075",
"0.647501... | 0.75490314 | 0 |
Searches for a Dataset by title. Used if Dataset title but not ID specified. | def find_package(self, package_title):
metadata = self.get_ckan_metadata()
results = []
for id, resource in metadata.items():
if resource['dataset']['title'] == package_title:
results.append(resource['dataset'])
return results[0] if len(results) == 1 else resu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id_by_title(self, title):\n logging.debug('id_by_title(%s)', title)\n if not self.list_loaded_:\n self.load_shows()\n\n for show_id in self.shows_data:\n next_show = self.shows_data[show_id]\n logging.debug('id_by_title(%s) = %s', next_show['title'], show_i... | [
"0.6222207",
"0.6015734",
"0.5961311",
"0.59549576",
"0.59549576",
"0.59481466",
"0.5901696",
"0.58831525",
"0.58831525",
"0.5861293",
"0.58488744",
"0.5842405",
"0.5801703",
"0.57710254",
"0.5757937",
"0.569659",
"0.56873524",
"0.56804055",
"0.56701803",
"0.56675076",
"0.562... | 0.648268 | 0 |
Searches for a Resource by Resource name and optionally also containing Dataset title. Used if resource_id not specified. | def find_resource(self, resource_name, package_title=None):
metadata = self.get_ckan_metadata()
results = []
for id, resource in metadata.items():
if resource['name'] == resource_name:
if package_title is None or resource['dataset']['title'] == package_title:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_resource(self, identifier, dataset):\n # If some of this item fails, there's an error in file\n # Cancel execution and log error\n try:\n resource = self.es_instance.get_document(identifier, dataset)\n except:\n #log.error('Error in file probably because... | [
"0.7072062",
"0.6525846",
"0.628707",
"0.6153794",
"0.5875458",
"0.57738477",
"0.5750716",
"0.5750716",
"0.5750716",
"0.5750716",
"0.5750716",
"0.5730924",
"0.57202387",
"0.57200927",
"0.56760734",
"0.5652941",
"0.5652941",
"0.5652941",
"0.5646796",
"0.5646796",
"0.5572661",
... | 0.76344246 | 0 |
Delete any cached resources that haven't been accessed for `self.cache_resources_for minutes`, or their custom expiry deadline. This is run each time a resource is downloaded. Nb. Cache pruning is done according to the current `self.cache_resources_for minutes` setting, rather than the setting when the resource was pre... | def _prune_cache(self):
default_expiry = datetime.datetime.utcnow() - datetime.timedelta(minutes=self.cache_resources_for)
for resource_id, resource in self.local_resource_status.items():
if 'cache_until' in resource:
if datetime.datetime.utcnow() > resource['cache_until']:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cache_clean(self):\n\t\tnow = time.time()\n\t\tkeys_for_removal = collections.deque()\n\t\tfor key, (_, expiration) in self.__cache.items():\n\t\t\tif expiration < now:\n\t\t\t\tkeys_for_removal.append(key)\n\t\tfor key in keys_for_removal:\n\t\t\tdel self.__cache[key]",
"def clean_cache(self):\n time... | [
"0.62035143",
"0.6062811",
"0.5945563",
"0.5943547",
"0.5804956",
"0.5765401",
"0.5761235",
"0.5717631",
"0.5710999",
"0.56461257",
"0.5593296",
"0.5590643",
"0.5483326",
"0.5457276",
"0.5437054",
"0.5360331",
"0.53544456",
"0.5345502",
"0.5296357",
"0.5291964",
"0.52600133",... | 0.78558624 | 0 |
Returns the path of a local copy of a resource, downloading into the cache if necessary. | def get_resource(self, resource_id, cache_for=None):
metadata = self.get_resource_metadata(resource_id)
last_updated = self.get_resource_last_updated(resource_id)
if metadata and last_updated > self.local_resource_status.get(resource_id, {})\
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_from_cache(cls, target_filename):\n is_cached = cls.is_remote_cached(target_filename)\n if is_cached:\n cache = cls.CACHE_BACKEND()\n cache.download(is_cached, target_filename)\n logger.debug('File %r was downloaded from %r', target_filename, cls.CACHE_BACKEND... | [
"0.6534977",
"0.6532663",
"0.65193945",
"0.6485964",
"0.64759576",
"0.64759576",
"0.6453478",
"0.6453478",
"0.63670605",
"0.6328386",
"0.63266206",
"0.62402976",
"0.6238801",
"0.6232809",
"0.62229687",
"0.61830413",
"0.6166398",
"0.6164082",
"0.61454654",
"0.61377066",
"0.612... | 0.73065144 | 0 |
Creates a new CKAN Resource with the metadata specified, maintaining a local cache. | def create_resource(self, **kwargs):
results = self.api.action.resource_create(**kwargs)
# TODO: use `results` rather than re-download, using an isolation layer to standardize the re-structure
self.get_ckan_metadata(True)
if 'id' in results:
self._import_resource_to_cache(kwa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_cache(\n cls, node_name: Text, directory: Path, model_storage: ModelStorage\n ) -> Resource:\n logger.debug(f\"Loading resource '{node_name}' from cache.\")\n\n resource = Resource(node_name)\n if not any(directory.glob(\"*\")):\n logger.debug(f\"Cached resource f... | [
"0.5910737",
"0.57297105",
"0.57112503",
"0.56751484",
"0.55941075",
"0.55794674",
"0.5572188",
"0.5559671",
"0.55563194",
"0.5535372",
"0.5519914",
"0.5495928",
"0.54883313",
"0.5469606",
"0.54410577",
"0.54380906",
"0.5423625",
"0.5386247",
"0.5367508",
"0.5359519",
"0.5358... | 0.71899873 | 0 |
Updates an existing CKAN Resource. | def update_resource(self, **kwargs):
logging.warning('Updating a resource removes all existing data. '
'If you wish to keep the existing data, use `CachedCKAN.patch_resource`.')
results = self.api.action.resource_update(**kwargs)
self.get_ckan_metadata(True)
if 'u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateResource(self, authenticationToken, resource):\r\n pass",
"def _update(self, **kwargs):\n\n resource_name = self._get_resource_name(**kwargs)\n config = misc_utils.resolve_config(\n kwargs.pop('config', None),\n kwargs.pop('config_file', None)\n )\n\n ... | [
"0.6712565",
"0.6548439",
"0.63630337",
"0.6345278",
"0.6300543",
"0.6122234",
"0.61037403",
"0.6086627",
"0.60595036",
"0.6029518",
"0.5933154",
"0.5878707",
"0.5872856",
"0.584779",
"0.58324337",
"0.5819039",
"0.5809391",
"0.57167894",
"0.56900346",
"0.5646615",
"0.56354874... | 0.7214952 | 0 |
Irreversibly deletes a CKAN Resource. | def delete_resource(self, resource_id):
results = self.api.action.resource_delete(id=resource_id)
self.get_ckan_metadata(True)
self._delete_cache(resource_id=resource_id)
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(self):\n with CachedCKAN(**self.ckan_kwargs) as ckan:\n ckan.delete_resource(resource_id=self.resource_id)",
"def delete(openstack_resource):\n openstack_resource.delete()",
"def delete(self):\n import labstep.entities.resource.repository as resourceRepository\n\n ... | [
"0.78841305",
"0.72663987",
"0.7055591",
"0.68992174",
"0.68319464",
"0.6770976",
"0.667877",
"0.6602171",
"0.6582345",
"0.6548251",
"0.652039",
"0.64865535",
"0.64722145",
"0.6441432",
"0.64142954",
"0.64098084",
"0.63522196",
"0.63435286",
"0.6316755",
"0.6300765",
"0.62917... | 0.74369836 | 1 |
Deletes a resource permanently from CKAN and the local cache. | def remove(self):
with CachedCKAN(**self.ckan_kwargs) as ckan:
ckan.delete_resource(resource_id=self.resource_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_resource(self, resource_id):\n results = self.api.action.resource_delete(id=resource_id)\n self.get_ckan_metadata(True)\n self._delete_cache(resource_id=resource_id)\n return results",
"def delete(openstack_resource):\n openstack_resource.delete()",
"def delete(self):\... | [
"0.7173071",
"0.7028146",
"0.69309527",
"0.69034004",
"0.6741932",
"0.6604244",
"0.65787506",
"0.65746397",
"0.64998525",
"0.6498341",
"0.64916474",
"0.6384806",
"0.63791025",
"0.63679844",
"0.63679844",
"0.63492805",
"0.6313416",
"0.628853",
"0.6252794",
"0.62339264",
"0.622... | 0.7459023 | 0 |
Prepares input features from California housing data set. | def preprocess_features(california_housing_dataframe):
selected_features = california_housing_dataframe[
["latitude",
"longitude",
"housing_median_age",
"total_rooms",
"total_bedrooms",
"population",
"households",
"median_income"]]
processed... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocess_features(california_housing_dataframe):\r\n #selected_features = california_housing_dataframe[\r\n # [\"latitude\",\r\n # \"longitude\",\r\n # \"housing_median_age\",\r\n # \"total_rooms\",\r\n # \"total_bedrooms\",\r\n # \"population\",\r\n # \"household... | [
"0.6927895",
"0.63496053",
"0.63224953",
"0.5989937",
"0.5973927",
"0.5916404",
"0.57938427",
"0.5718885",
"0.568511",
"0.56766516",
"0.56625456",
"0.55965996",
"0.5534613",
"0.55345005",
"0.55341476",
"0.552737",
"0.5515307",
"0.5508432",
"0.54913116",
"0.548422",
"0.5447491... | 0.6937536 | 0 |
Construct the TensorFlow Feature Columns. | def construct_feature_columns(input_features):
return set([tf.feature_column.numeric_column(my_feature)
for my_feature in input_features]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_feature_columns(params):\n initializer = tf.random_normal_initializer(0., 0.01)\n\n # Create the input columns here, one categorical column per feature.\n # The key should match the key for the feature in the dataset returned by the\n # input function.\n feature_1 = tf.feature_column.categorical_co... | [
"0.7497439",
"0.7309085",
"0.7165997",
"0.71465105",
"0.68282443",
"0.6753671",
"0.6740849",
"0.6519092",
"0.6359374",
"0.628647",
"0.6266852",
"0.6265709",
"0.6183068",
"0.61643267",
"0.61599946",
"0.6144688",
"0.60463005",
"0.59854394",
"0.59702057",
"0.594427",
"0.59340906... | 0.7419302 | 1 |
Test that calling `music_tuple_generator()` returns an iterator over all tuples of the form (group, track_list, track). | def test_music_tuple_generator(self):
group_config = {
"name": "Group 1",
"track_lists": [
{"name": "Track List 1", "shuffle": False, "tracks": ["track_1.mp3"]},
{"name": "Track List 2", "shuffle": False, "tracks": ["track_2.mp3", "track_3.mp3"]},
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_generator_produces_examples(self):\n\n for is_training in [True, False]:\n with TemporaryDirectory() as tmp_dir:\n mock_raw_data(tmp_dir, raw_dim=256, num_images=100)\n for example in allen_brain._generator(tmp_dir, is_training):\n for key in [\"image/encoded\", \"image/form... | [
"0.6053626",
"0.59796274",
"0.59537345",
"0.5840779",
"0.58272153",
"0.5778327",
"0.57235307",
"0.56991637",
"0.56681734",
"0.5628255",
"0.5626962",
"0.5626962",
"0.5594834",
"0.5577997",
"0.5573468",
"0.55538183",
"0.55487645",
"0.5521051",
"0.5520345",
"0.54695624",
"0.5456... | 0.89064723 | 0 |
This test ensures that `get_audio_stream()` uses `pafy` to obtain the best audio stream. | def test_get_audio_stream_uses_pafy(self, monkeypatch):
pafy_mock = MagicMock()
youtube_video_mock = MagicMock()
audio_stream_mock = MagicMock()
audio_stream_mock.url = "some-url"
pafy_mock.new.return_value = youtube_video_mock
youtube_video_mock.getbestaudio.return_value... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_audio_stream_does_not_raise(self):\n youtube_url = \"https://www.youtube.com/watch?v=jIxas0a-KgM\"\n _ = utils.get_audio_stream(youtube_url)\n assert True # No error",
"def test_get_stream(self):\n pass",
"def test_alsa(self):\n report(_(\"Testing ALSA sound out... | [
"0.6672939",
"0.60132486",
"0.5946948",
"0.5871261",
"0.5844977",
"0.5637165",
"0.56250495",
"0.55371845",
"0.5522025",
"0.54812145",
"0.5443048",
"0.5424458",
"0.5415203",
"0.5407774",
"0.53934586",
"0.5383669",
"0.53804624",
"0.5326743",
"0.5286205",
"0.527887",
"0.52781487... | 0.82281053 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.