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 |
|---|---|---|---|---|---|---|
Runs compute_c_max with isotope H and checks that the correct value is produced | def test_compute_c_max_h():
# build
T = np.array([600, 500])
E_ion = np.array([20, 10])
E_atom = np.array([30, 40])
angles_ion = np.array([60, 60])
angles_atom = np.array([60, 60])
ion_flux = np.array([1e21, 1e20])
atom_flux = np.array([2e21, 2e20])
# run
c_max = divHretention.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compute_c_max_output():\n # build\n T = np.array([600, 500])\n E_ion = np.array([20, 10])\n E_atom = np.array([30, 40])\n angles_ion = np.array([60, 60])\n angles_atom = np.array([60, 60])\n ion_flux = np.array([1e21, 1e20])\n atom_flux = np.array([2e21, 2e20])\n\n # run\n ou... | [
"0.7804228",
"0.7230941",
"0.71904975",
"0.6807927",
"0.64462936",
"0.6286616",
"0.6217312",
"0.6186257",
"0.6168397",
"0.6108435",
"0.61060095",
"0.6064953",
"0.6030965",
"0.5990423",
"0.59639454",
"0.5931527",
"0.59088767",
"0.5885161",
"0.58844084",
"0.5855641",
"0.5847799... | 0.7624501 | 1 |
Runs compute_c_max with isotope D and checks that the correct value is produced | def test_compute_c_max_D():
# build
T = np.array([600, 500])
E_ion = np.array([20, 10])
E_atom = np.array([30, 40])
angles_ion = np.array([60, 60])
angles_atom = np.array([60, 60])
ion_flux = np.array([1e21, 1e20])
atom_flux = np.array([2e21, 2e20])
# run
c_max = divHretention.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_compute_c_max_output():\n # build\n T = np.array([600, 500])\n E_ion = np.array([20, 10])\n E_atom = np.array([30, 40])\n angles_ion = np.array([60, 60])\n angles_atom = np.array([60, 60])\n ion_flux = np.array([1e21, 1e20])\n atom_flux = np.array([2e21, 2e20])\n\n # run\n ou... | [
"0.7668764",
"0.7432257",
"0.70756537",
"0.6916304",
"0.66039973",
"0.633388",
"0.6233156",
"0.6231558",
"0.62197894",
"0.6086765",
"0.6010786",
"0.59821117",
"0.595326",
"0.5884363",
"0.58655345",
"0.5859344",
"0.5851879",
"0.5801701",
"0.5789719",
"0.5774218",
"0.5764772",
... | 0.7500105 | 1 |
Runs compute_c_max and checks that the correct output | def test_compute_c_max_output():
# build
T = np.array([600, 500])
E_ion = np.array([20, 10])
E_atom = np.array([30, 40])
angles_ion = np.array([60, 60])
angles_atom = np.array([60, 60])
ion_flux = np.array([1e21, 1e20])
atom_flux = np.array([2e21, 2e20])
# run
output = divHreten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cmax(self):\n cbca_obj = aggregation.AbstractAggregation(**{'aggregation_method': 'cbca',\n 'cbca_intensity': 5., 'cbca_distance': 3})\n\n cv_aggreg = cbca_obj.cost_volume_aggregation(self.ref, self.sec, self.cv)\n\n # Check if the cal... | [
"0.71956396",
"0.6706909",
"0.6666093",
"0.6654545",
"0.6497787",
"0.64847076",
"0.6446621",
"0.64427555",
"0.6440773",
"0.63409734",
"0.6231431",
"0.6216798",
"0.62037325",
"0.6184099",
"0.6173182",
"0.6159964",
"0.61472124",
"0.6138057",
"0.61080885",
"0.6080764",
"0.605942... | 0.81507987 | 0 |
Return a dict for our Ansible facts. | def _facts(facts):
return {'swift_facts': facts} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def provides_facts():\n return {\n \"domain\": \"The domain name configured at the [edit system \"\n \"domain-name] configuration hierarchy.\",\n \"fqdn\": \"The device's hostname + domain\",\n }",
"def facts(self): # pylint: disable=invalid-overridden-method\n return {}",
"d... | [
"0.72143894",
"0.6945958",
"0.6938341",
"0.6432432",
"0.62723744",
"0.61998487",
"0.6169367",
"0.61409837",
"0.60772204",
"0.59841335",
"0.5809634",
"0.57634574",
"0.5564063",
"0.55350655",
"0.5498731",
"0.5497586",
"0.5489451",
"0.5477204",
"0.54573256",
"0.54452604",
"0.538... | 0.75194734 | 0 |
Load environment or sourced credentials. If the credentials are specified in either environment variables or in a credential file the sourced variables will be loaded IF the not set within the ``module.params``. | def _env_vars(self, cred_file=None, section='default'):
if cred_file:
parser = ConfigParser.SafeConfigParser()
parser.optionxform = str
parser.read(os.path.expanduser(cred_file))
for name, value in parser.items(section):
if name == 'OS_AUTH_URL':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadenv(self):\n logging.debug('Loading OpenStack authentication information from environment')\n # Grab any OS_ found in environment\n for var in os.environ:\n if var[0:3] == 'OS_':\n value = os.environ[var]\n # Don't print out password or token to... | [
"0.6508687",
"0.6438341",
"0.6277127",
"0.6266207",
"0.6249797",
"0.618712",
"0.615878",
"0.61461294",
"0.6112473",
"0.6100724",
"0.5858952",
"0.58386284",
"0.57719797",
"0.57441735",
"0.57082015",
"0.5674215",
"0.56662875",
"0.5662995",
"0.5652891",
"0.56504303",
"0.5598469"... | 0.656147 | 0 |
Upload an object to a swift object store. | def _upload(self, variables):
required_vars = ['container', 'src', 'object']
variables_dict = self._get_vars(variables, required=required_vars)
container_name = variables_dict.pop('container')
object_name = variables_dict.pop('object')
src_path = variables_dict.pop('src')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _put_object(self, sha: str) -> None:\n data = git.encode_object(sha)\n path = self._object_path(sha)\n self._trace(\"writing: %s\" % path)\n retries = 0\n mode = dropbox.files.WriteMode.overwrite\n\n if len(data) <= CHUNK_SIZE:\n while True:\n ... | [
"0.6730462",
"0.6696284",
"0.66696876",
"0.6654185",
"0.6636817",
"0.6436489",
"0.63662285",
"0.6357225",
"0.63389313",
"0.63029313",
"0.6297057",
"0.6283346",
"0.62567437",
"0.6248196",
"0.62060946",
"0.61957824",
"0.61772907",
"0.6157573",
"0.6127972",
"0.6127851",
"0.61256... | 0.67648774 | 0 |
Ensure a container exists. If it does not, it will be created. | def _create_container(self, container_name):
try:
container = self.swift.head_container(container_name)
except client.ClientException:
self.swift.put_container(container_name)
else:
return container | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_container_if_missing(container, swift_conn, options):\n try:\n swift_conn.head_container(container)\n except swift_client.ClientException, e:\n if e.http_status == httplib.NOT_FOUND:\n add_container = config.get_option(options,\n 'swift_store... | [
"0.73393464",
"0.71082866",
"0.6982969",
"0.69364905",
"0.6810107",
"0.6559245",
"0.65530443",
"0.63620865",
"0.6323742",
"0.62845564",
"0.6264618",
"0.6248145",
"0.6152857",
"0.61038315",
"0.60116714",
"0.5990125",
"0.59747225",
"0.59611005",
"0.5951962",
"0.59108293",
"0.59... | 0.72043264 | 1 |
Build a dictionary of numbers from zero to fifteen and the hexadecimal equivalent | def DictFunction2():
print "Create Second Dictionary"
NumberDict = dict(zip((i for i in range(16)), (hex(i) for i in range(16))))
print NumberDict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hex_probabilities(self):\n return {hex(key): value for key, value in self.items()}",
"def int2hex(n: int) -> str:",
"def test_int_to_hex():\n hex_values = ['61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f',\n '70', '71', '72', '73', '74', '7... | [
"0.6906895",
"0.662318",
"0.6495815",
"0.62746984",
"0.62481356",
"0.6218296",
"0.6171378",
"0.61579126",
"0.6128711",
"0.6069626",
"0.60268325",
"0.60072726",
"0.5870963",
"0.5868089",
"0.5852337",
"0.580648",
"0.5801199",
"0.5781645",
"0.57676095",
"0.57466954",
"0.57459706... | 0.7334854 | 0 |
create a few sets with numbers divisible by 2, 3, 4 and test if they're subsets of each other | def SetFunction():
s2 = []
s3 = []
s4 = []
s2 = { i for i in range(21) if i%2 == 0}
s3 = { i for i in range(21) if i%3 == 0}
s4 = { i for i in range(21) if i%4 == 0}
s2 = set(s2)
s3 = set(s3)
s4 = set(s4)
print s3.issubset(s2)
print s4.issubset(s2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_example(self):\n\n solution = Solution()\n\n nums = [1, 2, 3]\n\n expected_output = [\n (3,),\n (1,),\n (2,),\n (1, 2, 3),\n (1, 3),\n (2, 3),\n (1, 2),\n ()\n ]\n actual_output = sol... | [
"0.69097584",
"0.64683",
"0.6412315",
"0.6408911",
"0.62525964",
"0.62090695",
"0.6167503",
"0.6090646",
"0.6082563",
"0.60608363",
"0.60449654",
"0.60165566",
"0.59783715",
"0.5973267",
"0.5971005",
"0.5965851",
"0.59292936",
"0.5929147",
"0.59095657",
"0.5892798",
"0.586843... | 0.6884488 | 1 |
This strategy always tries to steer the hunter directly towards where the target last said it was and then moves forwards at full speed. This strategy also keeps track of all the target measurements, hunter positions, and hunter headings over time, but it doesn't do anything with that information. | def next_move(hunter_position, hunter_heading, target_measurement, max_distance, OTHER = None):
# This function will be called after each time the target moves.
# The OTHER variable is a place for you to store any historical information about
# the progress of the hunt (or maybe some localization informati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def warm_up(self):\n self.velocity = self.steering_behaviours.calculate()\n self.pos += self.velocity\n self.pos = Point(int(self.pos.x), int(self.pos.y))\n if not self.is_moving():\n if self.steering_behaviours.target == self.soccer_field.ball.pos:\n # let's g... | [
"0.7139936",
"0.7001866",
"0.697465",
"0.65336674",
"0.65109694",
"0.6359429",
"0.60754806",
"0.60304415",
"0.59477687",
"0.5936428",
"0.5919734",
"0.5891667",
"0.5789955",
"0.5778767",
"0.57660544",
"0.5735114",
"0.5714579",
"0.5646112",
"0.5636291",
"0.5635955",
"0.56281716... | 0.7422416 | 0 |
Returns True if your next_move_fcn successfully guides the hunter_bot to the target_bot. This function is here to help you understand how we will grade your submission. | def demo_grading(hunter_bot, target_bot, next_move_fcn, OTHER = None):
max_distance = 0.97 * target_bot.distance # 0.98 is an example. It will change.
separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target
caught = False
ctr = 0
# We will use your n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def demo_grading(hunter_bot, target_bot, next_move_fcn, OTHER=None):\n max_distance = 0.98 * target_bot.distance # 0.98 is an example. It will change.\n separation_tolerance = 0.02 * target_bot.distance # hunter must be within 0.02 step size to catch target\n caught = False\n ctr = 0\n\n # We will... | [
"0.68620497",
"0.61089545",
"0.60718143",
"0.60501325",
"0.6016241",
"0.6005791",
"0.5993357",
"0.59653",
"0.5931018",
"0.591706",
"0.5897315",
"0.58952403",
"0.5891687",
"0.58798397",
"0.581872",
"0.5814012",
"0.5781461",
"0.5760628",
"0.5734404",
"0.57288635",
"0.57284474",... | 0.700028 | 0 |
Returns the angle, in radians, between the target and hunter positions | def get_heading(hunter_position, target_position):
hunter_x, hunter_y = hunter_position
target_x, target_y = target_position
heading = atan2(target_y - hunter_y, target_x - hunter_x)
heading = angle_trunc(heading)
return heading | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_to(self, target_pos):\n return angle_to(self.tonp(), target_pos.tonp())",
"def _angle_of_attack(self, rel_wind, blade_chord):\n # blade_chord_vector - (relative_wind + pi)\n # rel_oposite = rel_wind.rotated(math.pi)\n aoa_rad = rel_wind.theta - blade_chord.theta\n aoa... | [
"0.70849824",
"0.7078092",
"0.69498146",
"0.68233067",
"0.6816026",
"0.6716919",
"0.6716865",
"0.66994107",
"0.6624106",
"0.66036713",
"0.6584936",
"0.6542871",
"0.651355",
"0.6493879",
"0.6482985",
"0.6479435",
"0.64647853",
"0.6453982",
"0.6453617",
"0.6434811",
"0.64185977... | 0.7280507 | 1 |
Gets the stress_test_number param from user params. Gets the stress_test_number param. If absent, returns default 100. | def get_stress_test_number(self):
return int(self.user_params.get("stress_test_number", 100)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trial_param(self, trial_id: int, param_name: str) -> float:\n raise NotImplementedError",
"def getintparam(name, default=None, stash=None, params=None):\n v = getparamlist(name, stash=stash, params=params)\n if len(v) > 0: return int(v[0])\n return default",
"def param_num(self, *, incl... | [
"0.5574652",
"0.54855615",
"0.54105365",
"0.5292212",
"0.5292212",
"0.52149796",
"0.51648545",
"0.5153553",
"0.51269835",
"0.51085144",
"0.509756",
"0.5092859",
"0.50264287",
"0.50162494",
"0.49809265",
"0.49752045",
"0.49556142",
"0.49453557",
"0.49236017",
"0.49203673",
"0.... | 0.83593583 | 0 |
Given a sequence (let's say from a context window), extract its components under the assumption that each "word" in the sequence is a triplet, and triplets may overlap on the last base | def get_triplet_composition(seq):
out = []
for i in range(len(seq)):
if i+3 > len(seq):
break
out.append(seq[i:i+3])
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clts(sequence):\n return [_token2clts(segment)[1] for segment in sequence]",
"def bipa(sequence):\n return [_token2clts(segment)[0] for segment in sequence]",
"def get_complementary_sequence(sequence):\n\n complementary_sequence = ''\n for char in sequence:\n complementary_sequence = com... | [
"0.64476144",
"0.5610308",
"0.5590001",
"0.55161774",
"0.5455728",
"0.5424268",
"0.5388733",
"0.5383343",
"0.5379006",
"0.5371296",
"0.53479505",
"0.5318797",
"0.5318797",
"0.52970743",
"0.5292962",
"0.5259284",
"0.52484095",
"0.5230913",
"0.52165705",
"0.52094585",
"0.520305... | 0.7335 | 0 |
Opens marker file and adds all markers to dictionary with | def open_markers(filename):
markers = {}
try:
with open(filename, "r") as f:
lines = f.readlines()
cur_marker = ""
cur_marker_name = ""
for i in range(len(lines)):
if i >= 7:
cur_line = lines[i]
if cu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readMarkers(self,markerfile):\n with open(markerfile,'r') as fin:\n count = 0\n for line in fin:\n if line.startswith('#'): continue\n l = line.strip().split()\n if len(l) == 0: continue\n if len(l) == 6: chrom,name,distan... | [
"0.6890485",
"0.6529261",
"0.59296936",
"0.56526536",
"0.564885",
"0.5543642",
"0.5540649",
"0.5503927",
"0.54962057",
"0.5492501",
"0.5430475",
"0.5408602",
"0.5362851",
"0.5325515",
"0.5323305",
"0.532094",
"0.52844286",
"0.5238507",
"0.5233728",
"0.52186966",
"0.5215181",
... | 0.73693407 | 0 |
Calculates chisquared values based on amount of a and b in the marker data. Markers with chisquared value > 3.84 are discarded. | def chi_squared(markers):
new_markers = {}
for marker in markers:
line = markers[marker][0]
a = line.count("a")
b = line.count("b")
length = a + b
expect_a = length / 2
expect_b = length / 2
chisq = pow((a - expect_a), 2) / expect_a + pow((b - expect_b),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _chisquare_value(self):\n x2 = np.sum((np.absolute(self.observed - self.expected) - (0.5 * self.continuity_correction)) ** 2 /\n self.expected)\n\n return x2",
"def f(a):\n b = a * 2\n while b.norm().asscalar() < 1000:\n b = b * 2\n if b.sum().... | [
"0.56620073",
"0.56429327",
"0.558835",
"0.5531059",
"0.546065",
"0.5427781",
"0.53272873",
"0.53119254",
"0.527172",
"0.52057266",
"0.51861894",
"0.517939",
"0.51749146",
"0.5146191",
"0.51202285",
"0.51165134",
"0.50929654",
"0.50773597",
"0.50755304",
"0.5072139",
"0.50703... | 0.7073684 | 0 |
Calculates recombination frequency between all combinations of two markers. | def rec_freq(markers):
keys = list(markers.keys())
rf_pairs = {}
for i in range(len(markers)):
for j in range(i + 1, len(markers)):
m1 = markers[keys[i]][0]
m2 = markers[keys[j]][0]
tot_len = 0
score = 0
if len(m1) != len(m2):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derive_count(freq1: typing.List[int], freq2: typing.List[int]) -> int:\n count = 0\n for i in range(26):\n count += min(freq1[i], freq2[i])\n return count",
"def joint_frequencies_combo(self, alleles):\n\n representations = [1 << i for i in range(len(alleles))]\n\n intrenal_hap_... | [
"0.64678943",
"0.592945",
"0.58793336",
"0.5876366",
"0.5795837",
"0.5719026",
"0.5665673",
"0.5658172",
"0.56559056",
"0.56537145",
"0.5625105",
"0.55932873",
"0.5565763",
"0.55539304",
"0.5537769",
"0.55084366",
"0.5466326",
"0.543985",
"0.54315937",
"0.5410862",
"0.5395903... | 0.64783263 | 0 |
Calculates the distances between a list of markers from the first marker. | def calc_distances(marker_list, rf_pairs):
final_distance = [[marker_list[0], 0]]
for i in range(1, len(marker_list)):
cur_markers = [marker_list[i-1], marker_list[i]]
for rf_pair in rf_pairs:
if rf_pair[0] in cur_markers and rf_pair[1] in cur_markers:
final_distance... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_distances(coords: List[Tuple[float, float]]) -> List[Dict]:\n miles = 0\n od = []\n for idx in range(len(coords)):\n if idx == 0:\n continue\n dist = distance(coords[idx], coords[idx - 1]).miles\n miles = miles + dist\n od.append(\n {\n ... | [
"0.6635253",
"0.6633621",
"0.6571341",
"0.6439199",
"0.62930983",
"0.62800103",
"0.61445427",
"0.6096219",
"0.60502046",
"0.5957475",
"0.5946086",
"0.5938248",
"0.5932937",
"0.5882029",
"0.5876757",
"0.5874259",
"0.5873279",
"0.5872944",
"0.58673966",
"0.5867383",
"0.5850922"... | 0.72004944 | 0 |
Should index a batch in the form of a list of (id,url,other_data) | def index_batch(self,batch):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_index(data):\n\n def bulk_api_string(item):\n return f\"{{\\\"index\\\":{{}}\\n{json.dumps(item)}\"\n\n body = '\\n'.join([bulk_api_string(item) for item in data]) + '\\n'\n\n return make_request(\n requests.post,\n url=f\"{connection.hostname}:{connection.port}/{connection.i... | [
"0.6773513",
"0.67076516",
"0.647827",
"0.6319573",
"0.6210303",
"0.6172807",
"0.61597866",
"0.612366",
"0.61061996",
"0.61003715",
"0.61003715",
"0.60762066",
"0.607391",
"0.607391",
"0.6039906",
"0.59697026",
"0.5969402",
"0.59238076",
"0.5890065",
"0.5853608",
"0.5772766",... | 0.74032223 | 0 |
Test case for add_provisioning_request Add a provisioning request | def test_add_provisioning_request(self):
body = PortProvisionRequest()
response = self.client.open('/api/provisioning/port',
method='POST',
data=json.dumps(body),
content_type='application/json')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_provisioning_request():\n if connexion.request.is_json:\n discovery = PortProvisionRequest.from_dict(connexion.request.get_json())\n return discovery.save()",
"async def test_create(self):\n expected = {\n 'id': 'id'\n }\n profile = {\n 'name': ... | [
"0.7253028",
"0.6238011",
"0.61264265",
"0.5709561",
"0.563654",
"0.5516715",
"0.54224616",
"0.5400144",
"0.5395249",
"0.53915054",
"0.53854346",
"0.5357447",
"0.534008",
"0.53295773",
"0.5326414",
"0.5318304",
"0.53048795",
"0.5283525",
"0.5275277",
"0.52693397",
"0.5260181"... | 0.75894356 | 0 |
Test case for delete_provisioning_request Deletes a port provisioning request | def test_delete_provisioning_request(self):
response = self.client.open('/api/provisioning/port/{requestId}'.format(requestId='requestId_example'),
method='DELETE')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_provisioning_request(requestId):\n doc = PortProvisionRequest.get(id=requestId)\n\n if doc:\n print(doc)\n doc.delete()\n return {\"status\": \"deleted\"}\n else:\n return 'Not Found', 404",
"async def test_delete(self):\n rsps = respx.delete(f'{PROVISIONING... | [
"0.8210428",
"0.6664818",
"0.6417803",
"0.6305171",
"0.6026843",
"0.6005614",
"0.60023606",
"0.5943052",
"0.5932378",
"0.59317976",
"0.59317976",
"0.5874001",
"0.58608633",
"0.57793397",
"0.57621557",
"0.57589376",
"0.57544667",
"0.57511425",
"0.5744601",
"0.5734947",
"0.5723... | 0.8789912 | 0 |
Test case for get_provisioning_request_by_id get provisioning request by ID | def test_get_provisioning_request_by_id(self):
response = self.client.open('/api/provisioning/port/{requestId}'.format(requestId='requestId_example'),
method='GET')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_provisioning_request_by_id(requestId):\n doc = PortProvisionRequest.get(id=requestId)\n if doc:\n return doc\n else:\n return 'Not Found', 404",
"async def test_retrieve_one(self):\n expected = {\n '_id': 'id',\n 'name': 'name',\n 'version': ... | [
"0.750531",
"0.6248161",
"0.61184204",
"0.5848939",
"0.577084",
"0.57675457",
"0.5723609",
"0.5676751",
"0.5654506",
"0.5619345",
"0.5601689",
"0.55897456",
"0.55897456",
"0.55712306",
"0.5539029",
"0.5444288",
"0.54233503",
"0.54105175",
"0.5407941",
"0.53651434",
"0.5340627... | 0.8449092 | 0 |
Test case for get_requests List server connectivity requests | def test_get_requests(self):
response = self.client.open('/api/provisioning/port',
method='GET')
self.assert200(response, "Response body is : " + response.data.decode('utf-8')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_servers(self):\n response = self.client.open(\n '/v1/servers',\n method='GET')\n self.assert200(response,\n 'Response body is : ' + response.data.decode('utf-8'))",
"def test_http_request(self):\n\n response = requests.get(self.live_se... | [
"0.6687752",
"0.6559068",
"0.64146256",
"0.62880325",
"0.62294745",
"0.61838835",
"0.6169326",
"0.61663264",
"0.6153799",
"0.6117643",
"0.6065051",
"0.6059946",
"0.6022924",
"0.60025907",
"0.5994368",
"0.5990659",
"0.5976886",
"0.59657145",
"0.5963672",
"0.5962847",
"0.595164... | 0.6894288 | 0 |
Get mean/std and optional min/max of scalar x across MPI processes. | def statistics_scalar(x, with_min_and_max=False):
x = np.array(x, dtype=np.float32)
global_sum, global_n = np.sum(x), len(x)
mean = global_sum / global_n
global_sum_sq = np.sum((x - mean) ** 2)
std = np.sqrt(global_sum_sq / global_n) # compute global std
if with_min_and_max:
global_mi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_mean_and_log_std(self, x):\n mean = self._mean_module(x)\n return mean, self._log_std",
"def xminmax ( self ) :\n return self.xvar.minmax()",
"def statistics_from_array(x: numpy.ndarray):\n try:\n return x.mean(), x.std(), x.max(), x.min()\n except AttributeError:\n ... | [
"0.6554827",
"0.6272912",
"0.61888236",
"0.61567163",
"0.6144852",
"0.6117041",
"0.6077917",
"0.60632807",
"0.60149676",
"0.59918183",
"0.5950541",
"0.5950353",
"0.59191823",
"0.59150267",
"0.5868738",
"0.58552974",
"0.58083874",
"0.5788024",
"0.5781067",
"0.5763779",
"0.5750... | 0.6846514 | 0 |
parse a kallisto abundance.tsv file, return dict transcriptId > est_tpm Does not return a value for transcripts where est_tpm is 0 | def parseKallisto(fname):
logging.debug("parsing %s" % fname)
ifh = open(fname)
ifh.readline()
d = {}
for line in ifh:
fs = line.rstrip("\n").split("\t")
if fs[tpmColumnIndex]=="0" and not addZeros:
continue
d[fs[0]] = float(fs[tpmColumnIndex])
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_trflp(lines):\r\n\r\n sample_ids = []\r\n otu_ids = []\r\n data = []\r\n non_alphanum_mask = re.compile('[^\\w|^\\t]')\r\n # not sure why the above regex doesn't cover the following regex...\r\n dash_space_mask = re.compile('[_ -]')\r\n\r\n for i, line in enumerate(lines):\r\n ... | [
"0.576154",
"0.5523585",
"0.54649943",
"0.54580283",
"0.5412821",
"0.5332087",
"0.52648944",
"0.52553064",
"0.52298635",
"0.5176947",
"0.5138724",
"0.5133539",
"0.5120489",
"0.5109864",
"0.50941163",
"0.5062895",
"0.5057512",
"0.50502867",
"0.5025302",
"0.50223887",
"0.501085... | 0.62047464 | 0 |
given a list of cellNames and a list of transcript > count dictionaries, write out a matrix with transcript > counts in columns | def outputBigMatrix(cellNames, results, outFname, isGene=False):
logging.info("Writing data to file %s" % outFname)
ofh = open(outFname, "w")
# write header
if isGene:
ofh.write("#gene\t%s\n" % "\t".join(cellNames))
else:
ofh.write("#transcript\t%s\n" % "\t".join(cellNames))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_count_matrix(filename, output_dir):\n\n import os\n import json\n\n word_tag_output = \"tag_word_count.json\"\n bigram_matrix_name = \"bigram_count.json\"\n unigram_matrix_name = \"unigram_count.json\"\n trigram_matrix_name = \"trigram_count.json\"\n\n sub_dir = os.path.join(output_... | [
"0.6228252",
"0.5873816",
"0.58383214",
"0.57617635",
"0.54583514",
"0.54458195",
"0.54176295",
"0.54138976",
"0.53219235",
"0.5272027",
"0.5245677",
"0.5184741",
"0.5132777",
"0.5129691",
"0.51268375",
"0.5118446",
"0.511654",
"0.5109872",
"0.510377",
"0.50655836",
"0.504090... | 0.63610333 | 0 |
given a list of dict transcript > tpm, and a map transcript > gene, map all transcripts to genes and return a list of gene > sum of tpms If we have no gene ID, drop the transcript entirely. | def sumTransToGene(transDictList, transFile):
transToGene = parseDict(transFile, stripDot=True)
logging.info("Mapping %d transcript IDs to gene IDs" % len(transToGene))
newRes = []
noMapTransIds = set()
for transCounts in transDictList:
geneCounts = defaultdict(float)
for transId, c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_GO_TPM_data(self, TPM_dict, *filtered_GO_dicts):\n\n dictionary = {}\n for i in filtered_GO_dicts:\n tmp_dict = {}\n for k, v in i.iteritems():\n tmp_dict[k] = map(\n lambda x: x + ':{0}'.format(TPM_dict[k] / len(v)), v\n ... | [
"0.59052914",
"0.5718111",
"0.57166183",
"0.5713127",
"0.5624114",
"0.55903983",
"0.5565028",
"0.5310848",
"0.53084624",
"0.5292143",
"0.5210532",
"0.5177025",
"0.514381",
"0.51284915",
"0.5062096",
"0.5026479",
"0.5016952",
"0.5011995",
"0.49969754",
"0.49333945",
"0.4902291... | 0.69606656 | 0 |
Records a param measurement and returns it. | def measure(self, timestamp, param):
if param in self.faulty:
value = random.randint(*self.FAULTY[param])
else:
value = self.patient.measure(param)
self.__buffer[param].append(Measurement(timestamp, value))
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_trial_param(self, trial_id: int, param_name: str) -> float:\n raise NotImplementedError",
"def get_last_measurement(self, param):\n return self.__buffer[param][-1]",
"def get_measurements(self, param):\n return tuple(self.__buffer[param])",
"def log_param(self, name: str, value):... | [
"0.64668816",
"0.61866486",
"0.61315846",
"0.5945125",
"0.59324706",
"0.579286",
"0.578003",
"0.5778229",
"0.57359004",
"0.5732038",
"0.57237446",
"0.5661884",
"0.5656225",
"0.5632293",
"0.56025463",
"0.5585704",
"0.55407315",
"0.5513971",
"0.5506482",
"0.5504652",
"0.5486406... | 0.64251155 | 1 |
Gets param last measurment. | def get_last_measurement(self, param):
return self.__buffer[param][-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_percept(self):\n return self.percept",
"def last_fmeasure(self):\n return self.get_fvalue(self.last_position())",
"def param(self):\n return self._param",
"def getLatestMeasurement(self): \n return self.measurement[len(self.measurement)-1]",
"def get_output(self, las... | [
"0.69294596",
"0.6815849",
"0.67619956",
"0.673588",
"0.67033076",
"0.66313666",
"0.6617073",
"0.6605436",
"0.65295345",
"0.648252",
"0.6449733",
"0.64441687",
"0.6424671",
"0.6354086",
"0.63483137",
"0.6319382",
"0.63120097",
"0.62854356",
"0.62735873",
"0.6260872",
"0.62413... | 0.83966666 | 0 |
Initial profanity check using profanity_check | def profanityCheck(text):
return predict_prob([text])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_tokens_with_profanity():\n list_responses = ['test this code', ' for bad words', 'such as shit']\n check = edurate_gensim.create_tokens(list_responses)\n assert check == [['test', 'code'], ['bad', 'words']]\n assert (\"shit\" in check) is False",
"def verify():",
"def main():\n f... | [
"0.5606062",
"0.54521835",
"0.5415538",
"0.5389216",
"0.53835446",
"0.53203183",
"0.52006304",
"0.51796556",
"0.512445",
"0.51217043",
"0.5049988",
"0.49923262",
"0.496746",
"0.4898047",
"0.48900947",
"0.48552576",
"0.48544675",
"0.4842774",
"0.48151883",
"0.48013282",
"0.480... | 0.60663515 | 0 |
Returns a DrsClient. This will delete any documents, aliases, or users made by this client after the test has completed. Currently the default user is the admin user Runs once per test. | def drs_client(indexd_server):
try:
user = create_user("user", "user")
except Exception:
user = ("user", "user")
client = DrsClient(baseurl=indexd_server.baseurl, auth=user)
yield client
clear_database() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_drf_client(admin_user):\n client = APIClient()\n client.force_authenticate(user=admin_user)\n return client",
"def client(self):\n\n if self._client is None:\n self._client = self._get_client()\n return self._client",
"def get_client(self):\n return self.clien... | [
"0.62618375",
"0.5801828",
"0.57856905",
"0.57658434",
"0.5730438",
"0.5724532",
"0.56575555",
"0.5643841",
"0.5600832",
"0.5596945",
"0.5596945",
"0.5586577",
"0.55524814",
"0.55345035",
"0.55280924",
"0.55232245",
"0.5517509",
"0.5496027",
"0.54853994",
"0.545057",
"0.54008... | 0.61927664 | 1 |
send 200 OK response, and set server.stop to True | def do_QUIT(self):
self.send_response(200)
self.end_headers()
self.server.stop = True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serve(self):\n\t\tself.keep_running=1\n\t\tif self.debug:\n\t\t\tprint \"server started\"\n\t\ttry:\n\t\t\twhile self.keep_running:\n\t\t\t\tself.handle_request()\n\t\tfinally:\n\t\t\tif self.debug:\n\t\t\t\tprint \"server finished\"\n\t\t\tself.keep_running=0\n\t\t\tself.close()",
"def send_200_resp(self, r... | [
"0.6593527",
"0.6580389",
"0.65228635",
"0.6458139",
"0.6449098",
"0.62513536",
"0.6202599",
"0.6198447",
"0.6197758",
"0.6183017",
"0.6144795",
"0.61393744",
"0.6138087",
"0.6123219",
"0.61206925",
"0.6105918",
"0.61005306",
"0.60456544",
"0.6036564",
"0.60222226",
"0.601354... | 0.71259165 | 0 |
emulate post request with get handler, we don't need the data | def do_POST(self):
self.do_GET() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(self, request, *args, **kwargs):\n return self.get(request, *args, **kwargs)",
"def get(self):\n self.post()",
"def post(self, *args, **kwargs):\n return self.handle_post_request()",
"def post(self, request):\n pass",
"def get(self):\n self.post()",
"def get(self):... | [
"0.78131866",
"0.7791229",
"0.7586552",
"0.7522953",
"0.7506268",
"0.7506268",
"0.74753666",
"0.7460196",
"0.7440879",
"0.73348796",
"0.7301347",
"0.7189343",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
"0.7170561",
... | 0.81476486 | 0 |
Parse a request (internal). The request should be stored in self.raw_requestline; the results are in self.command, self.path, self.request_version and self.http_request_headers. Return True for success, False for failure; on failure, an error is sent back. | def parse_request(self):
self.command = None # set in case of error on the first line
self.request_version = version = self.default_request_version
self.close_connection = 1
requestline = self.raw_requestline
# hack: quick and dirty fix for doubled request with bad data
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_request(self):\r\n # HTTP/1.1 connections are persistent by default. If a client\r\n # requests a page, then idles (leaves the connection open),\r\n # then rfile.readline() will raise socket.error(\"timed out\").\r\n # Note that it does this based on the value given to settime... | [
"0.6622271",
"0.64777374",
"0.63694507",
"0.60598505",
"0.59718955",
"0.590743",
"0.57738644",
"0.5756934",
"0.5742927",
"0.555604",
"0.55017346",
"0.5494741",
"0.54922587",
"0.5484244",
"0.5446223",
"0.54096335",
"0.53933066",
"0.5307045",
"0.5289728",
"0.52803946",
"0.52673... | 0.7992387 | 0 |
Handle one request at a time until stopped. | def serve_forever(self, unused_parameter=0.5):
self.stop = False
while not self.stop:
self.handle_request() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n while self.running:\n self.handle_request()",
"def run(self):\n while True:\n req = self._requests.get()[1]\n req.start()\n logging.info('Running request %s', req)",
"def process_request_thread(self):\n while True:\n t... | [
"0.7609261",
"0.71269566",
"0.69555724",
"0.6718361",
"0.6676004",
"0.6669508",
"0.6668242",
"0.6592521",
"0.657124",
"0.65122896",
"0.65122896",
"0.65122896",
"0.6483223",
"0.6456908",
"0.6451984",
"0.6424715",
"0.6336171",
"0.6316808",
"0.6310098",
"0.63058025",
"0.629759",... | 0.7465852 | 1 |
Generate machine id based on default adapters mac address. | def _generate_machine_id(self):
mach_id = "machine_"
try:
gws = netifaces.gateways() # get all gateways
default = gws['default'] # get the default gw
adapter = default[2][1] # get the adapter identifier
real_adapter = netifaces.ifaddresses(adapter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_mac(topology_id):\n tid = int(topology_id)\n global mac_counter\n global used_macs\n base = '52:54:00:00:00:00'\n ba = base.split(':')\n ba[2] = '%02x' % int(tid / 256)\n ba[3] = '%02x' % int(tid % 256)\n ba[4] = '%02x' % int(len(used_macs[topology_id]) / 256)\n ba[5] = '%0... | [
"0.6963345",
"0.6941117",
"0.6941117",
"0.6683865",
"0.6677888",
"0.6657878",
"0.6549006",
"0.65344495",
"0.6532284",
"0.6504228",
"0.6499489",
"0.64969695",
"0.6482017",
"0.64627934",
"0.645557",
"0.6432604",
"0.6382546",
"0.6377715",
"0.63437086",
"0.63416886",
"0.6336635",... | 0.86592156 | 0 |
Push a file to cnc server with optional rc4 encryption. | def push_file_to_server(cnc_bot, filename, content, encryption_key=None):
c = content
if encryption_key is not None:
c = rc4.encrypt(c, encryption_key, salt_length=0) # encrypt content via rc4
cfg = {'filename': filename, 'content': c}
cnc_bot.host_orders(cPickle.dumps(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def swift_push_file(job_log_dir, file_path, swift_config):\n with open(file_path, 'r') as fd:\n name = os.path.join(job_log_dir, os.path.basename(file_path))\n con = swiftclient.client.Connection(\n authurl=swift_config['authurl'],\n user=swift_config['user'],\n ke... | [
"0.61895895",
"0.6184544",
"0.56849754",
"0.56627935",
"0.56338185",
"0.55360377",
"0.55232894",
"0.5497455",
"0.5397069",
"0.5368183",
"0.530934",
"0.530456",
"0.5285475",
"0.5281322",
"0.52686185",
"0.52633834",
"0.5241551",
"0.5230669",
"0.5227321",
"0.52060777",
"0.518867... | 0.73508626 | 0 |
Given a short_lineage, return the full lineage required to find exact lineage match within ID3C. | def get_full_lineage(short_lineage):
lineage_map = {
'h1n1pdm': 'Influenza.A.H1N1',
'h3n2': 'Influenza.A.H3N2',
'vic': 'Influenza.B.Vic',
'yam': 'Influenza.B.Yam'
}
return lineage_map[short_lineage] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_similarity(long, short):\n similarity1 = 0\n similarity2 = 0\n for i in range(len(long)-len(short)+1):\n a = 0\n part = long[i:i+len(short)]\n for j in range(len(part)):\n if part[j] == short[j]:\n a += 1\n if a == len(short):\n sim... | [
"0.53577715",
"0.5188768",
"0.49944058",
"0.4973644",
"0.49226177",
"0.48873967",
"0.48870274",
"0.4741497",
"0.4731417",
"0.47129855",
"0.46796983",
"0.46796364",
"0.4671364",
"0.46615598",
"0.46497273",
"0.46433398",
"0.45880193",
"0.45723385",
"0.45651704",
"0.45559737",
"... | 0.77502173 | 0 |
Generate the full URL for the API endpoint to get sequences of a specific lineage and segment | def generate_full_url(base_url, lineage, segment):
params = "/".join([lineage, segment])
return urljoin(base_url, params) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_api_request_uri(self, http_method=\"GET\"):\n return self.urlobject_single.format(self._cb.credentials.org_key, self._model_unique_id)",
"def _build_api_request_uri(self, http_method=\"GET\"):\n return self.urlobject_single.format(self._cb.credentials.org_key, self._model_unique_id)",
... | [
"0.6077605",
"0.6077605",
"0.60385835",
"0.5938474",
"0.5882254",
"0.58656865",
"0.584668",
"0.58432865",
"0.58013654",
"0.5792573",
"0.5782247",
"0.5776951",
"0.5737987",
"0.5737983",
"0.56899506",
"0.56754565",
"0.56720304",
"0.5663998",
"0.56569654",
"0.56523454",
"0.56231... | 0.70681363 | 0 |
GET sequences from ID3C server with provided lineage and segment | def get_sequences_from_id3c(url, username, password, lineage, segment, output):
r = requests.get(url, auth=(username,password), stream=True)
r.raise_for_status()
with open(output, 'w+') as fasta_file:
for line in r.iter_lines():
if line:
sequence = json.loads(line)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_genomic_data(lineage, segment, session):\n LOG.debug(f\"Exporting genomic data for lineage <{lineage}> and segment <{segment}>\")\n\n sequences = datastore.fetch_genomic_sequences(session, lineage, segment)\n\n return Response((row[0] + '\\n' for row in sequences), mimetype=\"application/x-ndjson\... | [
"0.6074918",
"0.59999114",
"0.57448626",
"0.5712717",
"0.5657642",
"0.5515684",
"0.5482543",
"0.527945",
"0.52410114",
"0.52103394",
"0.5157792",
"0.51533157",
"0.514769",
"0.51354444",
"0.51207256",
"0.511246",
"0.50718766",
"0.5018996",
"0.5016804",
"0.4998077",
"0.49922892... | 0.75697505 | 0 |
Write the unique IDs to a file, but add a self.prefix to each element of the array. For example, if self.unique_ids is ['image_1.jpg', 'image_2.jpg'] then if the self.prfix is './folder/', then out_file would be written as ./folder/image_1.jpg ./folder/image_2.jpg | def write_unique_ids(self, out_file):
with open(out_file,'w') as f:
f.writelines([self.prefix+x+'\n' for x in self.unique_ids])
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_ID_files(self):\n for file, IDs in [(self._trn_IDs_file, self._trn_IDs), (self._val_IDs_file,\n self._val_IDs), (self._tst_IDs_file, self._tst_IDs)]:\n with open(file, 'w') as f:\n f.write('\\n'.join('{}###{... | [
"0.69445384",
"0.64533186",
"0.6405879",
"0.6318872",
"0.5901129",
"0.57555485",
"0.57474875",
"0.5697831",
"0.55670774",
"0.5564222",
"0.55620843",
"0.55135316",
"0.54920965",
"0.54119766",
"0.5354059",
"0.5347817",
"0.5346361",
"0.53412336",
"0.53253436",
"0.5306415",
"0.52... | 0.826794 | 0 |
Read the unique IDs from in_file, but remove a self.prefix from each element of the array. For example, if the in_file is ./folder/image_1.jpg ./folder/image_2.jpg and the self.prefix is './folder/', then self.unique_ids would be written as ['image_1.jpg', 'image_2.jpg'] | def read_unique_ids(self, in_file, prefix=None):
if prefix is None:
prefix = self.prefix
with open(in_file) as f:
self.unique_ids = [x.strip().replace(prefix, '') for x in f]
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_unique_ids(self, out_file):\n with open(out_file,'w') as f:\n f.writelines([self.prefix+x+'\\n' for x in self.unique_ids])\n return",
"def load_uids_from_file():\n uids = io.load_file(io.UIDS_FILE)\n if not uids:\n save_uids_to_file(DEFAULT_UIDS)\n return lo... | [
"0.6857764",
"0.59046537",
"0.5876727",
"0.5724553",
"0.5643143",
"0.560151",
"0.5585564",
"0.55011547",
"0.54623485",
"0.5456302",
"0.5420213",
"0.53884214",
"0.5385816",
"0.5367136",
"0.53472537",
"0.53333265",
"0.5323998",
"0.52856857",
"0.52816784",
"0.5269871",
"0.525752... | 0.88484704 | 0 |
Randomly select images from the CCD dataset to be included in the experiments. Make sure that there are at least CAP number of images in each intersection for age, gender, lighting condition, and skin groups. | def select_unique_ids(self):
ccd = self.metadata
ccd_ids = []
for dg in set(ccd['isDark']):
for gg in set(ccd['Gender']):
for sg in set(ccd['Skin']):
for ag in set(ccd['Age']):
try:
intersection_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randomly_select_images():\r\n global images_a, images_b, images_total\r\n images_a = random.sample(images_a, int(number_of_images_a.get()))\r\n if number_of_images_b.get() != \"\": #check if images_b empty\r\n images_b = random.sample(images_b, int(number_of_images_b.get()))\r\n else:\r\n ... | [
"0.6372832",
"0.5899854",
"0.58285266",
"0.58255917",
"0.5720729",
"0.5693634",
"0.5607028",
"0.55150485",
"0.5467195",
"0.5396391",
"0.5383312",
"0.5382062",
"0.53393257",
"0.53032136",
"0.5301093",
"0.5289086",
"0.52777845",
"0.5268686",
"0.52449733",
"0.523275",
"0.5193581... | 0.65822405 | 0 |
First only select those MIAP images that have 1 object in them. Then randomly select images to be included in the experiments. Make sure that there are at least CAP number of images in each intersection for age and gender groups. | def select_unique_ids(self):
miap = self.metadata
miap_single = miap[miap.ImageID.isin(list(miap_single[miap_single == 1].index))]
miap_ids = []
for gp in set(miap_single['GenderPresentation']):
for ap in set(miap_single['AgePresentation']):
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_unique_ids(self):\n ccd = self.metadata\n ccd_ids = []\n for dg in set(ccd['isDark']):\n for gg in set(ccd['Gender']):\n for sg in set(ccd['Skin']):\n for ag in set(ccd['Age']):\n try:\n i... | [
"0.6107763",
"0.6104834",
"0.60473615",
"0.5822715",
"0.5687118",
"0.5592082",
"0.55718535",
"0.5563342",
"0.5562081",
"0.5492943",
"0.5483507",
"0.54614764",
"0.54502845",
"0.54063916",
"0.5379569",
"0.5375134",
"0.53729117",
"0.53599495",
"0.5322199",
"0.532211",
"0.5309846... | 0.6976405 | 0 |
The metadata for the UTK dataset are in the file names, so pass a list of utk files | def load_metadata(self, utkface_filenames):
def utk_resolve_age_label(file):
x = file.split('_')
if len(x) != 4:
return -1
age = int(file.split('_')[0])
if age in range(18):
age_id = 0
elif age in range(18,45):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, utkface_filenames = 'utkface_images.txt'):\n self.metadata = self.load_metadata(utkface_filenames)\n self.prefix = ''\n return",
"def load_sotu_data():\n sotu_files = glob.glob(\"sotu-data/*.txt\")\n path_desc = re.compile(r\"sotu-data/([A-Za-z]+)_([0-9]{4})\\.txt\")... | [
"0.6503858",
"0.5745298",
"0.56453",
"0.5499407",
"0.531591",
"0.5222382",
"0.5202782",
"0.5201199",
"0.51858264",
"0.51849985",
"0.51831937",
"0.5131584",
"0.51163554",
"0.51074165",
"0.50857013",
"0.5076598",
"0.50594175",
"0.5055774",
"0.5037375",
"0.5024851",
"0.50070727"... | 0.638878 | 1 |
Return the total receptive field of this model as of frames. | def receptive_field(self):
frames = 0
for f in self.pad:
frames += f
return 1 + 2 * frames | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receptive_field(self):\n return self.LocalLayer_Torso.receptive_field()",
"def total_rewards(self) -> float:\n return self.__total_rewards",
"def fields(self):\n return (self._total + self._mean + self._variance\n + self._skew + self._kurtosis)",
"def patrimony_total(self)... | [
"0.6807186",
"0.6247257",
"0.6151634",
"0.6062826",
"0.60195196",
"0.60095304",
"0.6005246",
"0.5999161",
"0.5976631",
"0.5976631",
"0.5976631",
"0.5976631",
"0.5954339",
"0.5918959",
"0.590753",
"0.589701",
"0.5859162",
"0.5844734",
"0.5844734",
"0.5828635",
"0.5827173",
"... | 0.70493305 | 0 |
Function to get coordinates of given films | def get_location_coordinates(films_set, film_number=0):
if not film_number:
film_number = len(films_set)
films_list = sorted(list(films_set))
print(f'List has {len(films_list)} films with specified year. '
f'\nAmount of films to analyze: {film_number} '
f'\n---------------------... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_film_coordinates(film_dict):\n coordinate_dict = dict()\n for location in film_dict.keys():\n try:\n locator = geopy.Nominatim(user_agent=\"filmGeocoder\", timeout=10)\n coordinates = locator.geocode(location)\n\n coordinate_dict[coordinates.latitude, coordinat... | [
"0.6283534",
"0.59644246",
"0.58434176",
"0.5780984",
"0.55411386",
"0.55378103",
"0.55216914",
"0.5519904",
"0.55140954",
"0.5485288",
"0.5386026",
"0.53777754",
"0.53692013",
"0.5347572",
"0.53261596",
"0.5300548",
"0.5293786",
"0.5275657",
"0.52662235",
"0.5232054",
"0.522... | 0.663994 | 0 |
Function finds the nearest films near user specified location | def get_nearest_films(films_list, number, input_location):
output_list = []
for film_data in films_list:
film_dist = int(distance.distance(film_data[1], input_location).km)
film_data.append(film_dist)
output_list.append(film_data)
output_list.sort(key=lambda x: x[-1])
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nearest_films_filming_from_file(path, user_coordinates):\n data = pandas.read_csv(path, sep=';\\t', engine='python')\n locations, films = data['location'], data['films']\n lat, long = data['latitude'], data['longitude']\n\n distance_list = []\n for location, x, y, film in zip(locations, lat,... | [
"0.734112",
"0.6164199",
"0.60423326",
"0.5946243",
"0.59105843",
"0.57418096",
"0.5691708",
"0.5665888",
"0.5598716",
"0.5578369",
"0.5567686",
"0.5564117",
"0.5545929",
"0.5539266",
"0.55250674",
"0.55057204",
"0.5500532",
"0.54814434",
"0.54331714",
"0.5421165",
"0.5420543... | 0.7052365 | 1 |
If East is in the same guild, Talos will ask them a favor... Otherwise, Talos isn't doing it | async def favor(self, ctx):
east = ctx.guild.get_member(339119069066297355)
if not east or east.status != discord.Status.online:
await ctx.send(f"I'm afraid I can't do that, {ctx.author.display_name}.")
return
await ctx.send("&East, could I ask you for a favor? I need som... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def omartrifacta(self, ctx):\n user_member1 = await ctx.guild.fetch_member(\"142084729674399745\")\n user_member2 = await ctx.guild.fetch_member(\"197784087476305921\")\n user_member3 = await ctx.guild.fetch_member(\"219969018369409024\")\n if user_member1 is not None and user_mem... | [
"0.59104276",
"0.5812901",
"0.5811559",
"0.57705164",
"0.568164",
"0.56639165",
"0.5625076",
"0.55851394",
"0.5549394",
"0.5538837",
"0.54885685",
"0.5444899",
"0.54436094",
"0.5433115",
"0.5410844",
"0.54084325",
"0.53876704",
"0.5387098",
"0.53671765",
"0.5336776",
"0.53303... | 0.7293132 | 0 |
Gets an XKCD comic with the given number, or the current one if one isn't specified, and displays it. | async def xkcd(self, ctx, comic: int = 0):
if comic < 0:
await ctx.send("Requested XKCD can't be negative")
return
data = await self.bot.session.get_xkcd(comic or None)
if data is None:
await ctx.send(f"No comic for ID `{comic}` found")
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_xkcd(self, ctx, number = \"random\"):\n if not self.module_check(ctx): return\n if number == \"latest\":\n r = requests.get('https://xkcd.com/info.0.json')\n elif number == \"random\":\n r = requests.get('https://xkcd.com/info.0.json')\n r = json.loads(r.text)\n random_xk... | [
"0.68028086",
"0.61957276",
"0.59368753",
"0.5861915",
"0.56918675",
"0.55075777",
"0.53484565",
"0.5283768",
"0.52726424",
"0.51808345",
"0.51591676",
"0.50742537",
"0.50456804",
"0.50456804",
"0.5033829",
"0.5017756",
"0.5013748",
"0.50132114",
"0.49857825",
"0.49768993",
"... | 0.64772284 | 1 |
Sets up the JokeCommands extension. Adds the JokeCommands cog to the bot | def setup(bot):
bot.add_cog(JokeCommands(bot)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup(bot):\n new_cog = Commands(bot)\n bot.add_cog(new_cog)",
"def setup(bot):\n bot.logger.debug(\n 'Registering extension \"Quiz\"'\n )\n bot.add_cog(QuizCog(bot))",
"def setup(bot):\n bot.add_cog(AdminCommands(bot))",
"def setup(bot):\n @bot.event\n async def on_command... | [
"0.69343936",
"0.68088084",
"0.66989225",
"0.65883654",
"0.65673536",
"0.65430915",
"0.65312517",
"0.64955974",
"0.64893925",
"0.6323563",
"0.63162094",
"0.6146145",
"0.6126287",
"0.6121231",
"0.6090291",
"0.60819864",
"0.60638237",
"0.60156745",
"0.5999061",
"0.59527",
"0.59... | 0.7969974 | 0 |
A method to get interpolated weight spectrumn for a given spw and row id Should be implemented in child class | def _get_interpolated_wtsp(self, *args, **kwargs):
raise NotImplementedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_weight_row(self, i):\n return self.weights[i]",
"def get_spec_weight(self, i, j):\n return self.weights[i][j]",
"def update_weight(wij, yj, tj, xi, lr = 0.25):\n\n new_wij = wij - lr * ((yj - tj) * xi)\n new_wij = round(new_wij, 3)\n #print(\"\\t\", wij, \"-\", lr, \"* (\", yj, \... | [
"0.6086211",
"0.54288447",
"0.5354366",
"0.534022",
"0.5280534",
"0.52703285",
"0.52215284",
"0.5198095",
"0.5197607",
"0.5134318",
"0.51240146",
"0.5096904",
"0.50929785",
"0.5077011",
"0.50710326",
"0.501282",
"0.49915385",
"0.49869552",
"0.49808988",
"0.49808666",
"0.49461... | 0.6111145 | 0 |
Returns True if the column exists in the table | def _column_exists(self, tbname, colname):
self._check_file(tbname)
tb = tbtool()
tb.open(tbname)
cols = tb.colnames()
tb.close()
return (colname in cols) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_exists(self, column_name):\n return column_name in self.columns",
"def tableHasColumn(self, schema, table, column):\r\n res = self.fetchSqlRecords(\r\n \"select count(*) from information_schema.columns c where c.table_schema = '{}' and c.table_name='{}' and c.column_name='{}'\... | [
"0.83644086",
"0.8292885",
"0.82175887",
"0.81018114",
"0.81018114",
"0.8073049",
"0.8035705",
"0.7999258",
"0.78273046",
"0.7082933",
"0.70003563",
"0.6905545",
"0.68490213",
"0.6835957",
"0.6805615",
"0.6759569",
"0.67382336",
"0.6727789",
"0.6726648",
"0.6660846",
"0.66534... | 0.833071 | 1 |
Generates a polynomial array of length nchan. The polynomial coefficients should be given in ascending order, i.e., when coeff = [1.0, 2.0, 3.0] elements of the return array will be polyarr[ichan] = 1.0 + 2.0ichan + 3.0ichan2 (ichan=0~nchan1) | def _generate_poly_array(self, nchan, coeff=[]):
if nchan < 0:
raise ValueError, "nchan should be >=0"
if len(coeff)==0:
if nchan ==0: return []
else: raise ValueError, "No valid coefficient given."
polyarr = numpy.zeros(nchan)
for iorder in range(len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_ploynomial_array(self, coeff, x):\n xarr = numpy.array(x)\n yarr = numpy.zeros(len(xarr))\n for idim in range(len(coeff)):\n ai = coeff[idim]\n yarr += ai*xarr**idim\n return yarr",
"def generate_polynomial():\n degree = numpy.random.choice(range(3... | [
"0.68056685",
"0.6573853",
"0.6233045",
"0.6194051",
"0.6190378",
"0.6133814",
"0.61265975",
"0.60940784",
"0.6003684",
"0.59296507",
"0.5928541",
"0.59085226",
"0.5857575",
"0.5854614",
"0.5853316",
"0.58489704",
"0.584802",
"0.5847538",
"0.5844446",
"0.58300024",
"0.579835"... | 0.9005255 | 0 |
Compares two arrays and returns True if they are within a tolerance. checks shapes | def _compare_arrays(self, data, reference, atol=1.e-5, rtol=1.e-5):
if not (data.shape==reference.shape): return False
ret=numpy.allclose(data,reference, atol=atol, rtol=rtol)
return ret | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_equal(a, b, unit_tol=1e-4, total_tol=1e-4, with_sign=True):\n\n a = to_nparray(a)\n b = to_nparray(b)\n\n if len(a) == 0 and len(b) == 0:\n return True\n\n if not with_sign:\n a, b = np.abs(a), np.abs(b)\n res = (np.sum(np.abs(a - b) > unit_tol)) / a.size < total_tol\n ret... | [
"0.7049362",
"0.6753018",
"0.6666613",
"0.6650952",
"0.66391",
"0.65610904",
"0.6543794",
"0.65330875",
"0.641461",
"0.63840634",
"0.63636976",
"0.63067174",
"0.6305565",
"0.62804353",
"0.627131",
"0.6226086",
"0.62086785",
"0.620447",
"0.6167091",
"0.6160811",
"0.61569476",
... | 0.7189442 | 0 |
Convert interpolation string to a list of interpolations in time (should be defined) and frequency (default is 'linear') E.g. 'linear,cspline' > ['linear', 'cpline'] 'nearest' > ['nearest', 'linear' (using the default)] | def interpolation_to_list(self, interpolation):
interplist = interpolation.split(',')
if len(interplist) == 0:
interplist = ['linear', 'linear']
elif len(interplist) == 1:
interplist += ['linear']
return interplist[0:2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def interpolateCubicPeriodic() :\n\n S = []\n\n # for all parameters\n for i in range(11):\n y = []\n # get i-th parameter\n for k in range(len(keyframe)):\n y.append(keyframe[k][i])\n\n interpolants = interpolatePeriodicSpline(keytime, y)\n S.append(interpola... | [
"0.56173795",
"0.5576247",
"0.55391693",
"0.53756726",
"0.5346058",
"0.50850666",
"0.5063842",
"0.5045507",
"0.49662524",
"0.49306107",
"0.49246454",
"0.49028924",
"0.48939764",
"0.48712966",
"0.48580346",
"0.4848678",
"0.48370945",
"0.48291197",
"0.4823621",
"0.48156068",
"0... | 0.74464566 | 0 |
Array comparison. Duplicate reference for pol if necessary, i.e., If cell.shape==reference.shape, this method compares cell and reference directly if cell.shape!=reference.shape (e.g., cell.shape=[npol, nchan] while reference.shape=[nchan]), | def _testCell(self, cell, reference, atol=1.e-5, rtol=1.e-5):
cellarr = numpy.array(cell)
refarr = numpy.array(reference)
if cellarr.ndim != refarr.ndim:
# pol loop
for ipol in range(cellarr.shape[0]):
testarr = cellarr[ipol]
self._testCell... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _compare_arrays(self, data, reference, atol=1.e-5, rtol=1.e-5):\n if not (data.shape==reference.shape): return False\n ret=numpy.allclose(data,reference, atol=atol, rtol=rtol)\n return ret",
"def test_reference_to_array(self):\n arr = numpy.arange(0.0, 10.0, 0.1)\n arr = n... | [
"0.65500224",
"0.5869078",
"0.5757813",
"0.53636265",
"0.5318079",
"0.530859",
"0.52684",
"0.52240014",
"0.5221366",
"0.5194449",
"0.51814866",
"0.51687014",
"0.5168295",
"0.51641154",
"0.515756",
"0.51557255",
"0.5147352",
"0.5133151",
"0.51277983",
"0.5117408",
"0.5087433",... | 0.6374898 | 1 |
returns an array of 1./in_arr^2 This corresponds to WEIGHT_SPECTRUM by 1./Tsys^2 in case input is Tsys spectrum | def tsysweightsp_from_tsysarr(self, in_arr):
return 1./(numpy.array(in_arr)**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weight_from_meantsys(self, in_arr):\n return 1./(numpy.mean(in_arr)**2)",
"def comp_output_spectra(self):\n assert(hasattr(self,'r'))\n \n self.nx=int(self.nx)\n \n r_mat=self.r.T.reshape(self.nx,self.nx,self.N)\n\n in_allfreqs = np.fft.fftshift(np.fft.fftfreq(self.nx,d=self.L/self.n... | [
"0.62197316",
"0.5731945",
"0.561864",
"0.55723643",
"0.5519251",
"0.54838157",
"0.5463326",
"0.5450829",
"0.5421233",
"0.5408736",
"0.53334206",
"0.5332715",
"0.52982306",
"0.528176",
"0.5272986",
"0.5269713",
"0.5269713",
"0.52356917",
"0.52283984",
"0.5218861",
"0.5218008"... | 0.65089893 | 0 |
returns 1./mean(in_arr)^2 This corresponds to WEIGHT by 1./Tsys^2 in case WEIGH_SPECTRUM does not exists. | def weight_from_meantsys(self, in_arr):
return 1./(numpy.mean(in_arr)**2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tsysweightsp_from_tsysarr(self, in_arr):\n return 1./(numpy.array(in_arr)**2)",
"def normalizing_constant(self):\n\t\tdim = self.train_data.shape[1]\n\t\treturn 1 / (2 * np.pi * ((self.bandwidth) ** 2)) ** (dim / 2)",
"def wo_mean(arr):\n\n return np.array(arr) - np.mean(arr, axis=0)",
"def sig... | [
"0.62368584",
"0.5754579",
"0.57493305",
"0.5643843",
"0.56121606",
"0.56033355",
"0.55805826",
"0.5527867",
"0.55130255",
"0.54666394",
"0.54532003",
"0.54035026",
"0.5393957",
"0.53300005",
"0.5329847",
"0.5320016",
"0.53127503",
"0.52882606",
"0.52683395",
"0.52547145",
"0... | 0.7573409 | 0 |
Returns a median value of an array. if takeEvenMean, middle two values are average if the number of elements in in_array is even. if not sort in_array in ascending order and returns an (n1)/2th element. | def _median(self, in_arr, takeEvenMean):
if takeEvenMean:
return numpy.median(in_arr)
else:
return numpy.sort(in_arr, axis=None)[(in_arr.size-1)/2] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def median(array):\n sorted = [x for x in array]\n sorted.sort()\n middle = len(sorted)/2 #Gets the middle element, if present\n if len(sorted) % 2 == 0: #Even, so need to average together the middle two values\n return float((sorted[middle]+sorted[middle-1]))/2\n else:\n return sorted... | [
"0.8438568",
"0.78152245",
"0.7581761",
"0.7321425",
"0.72606057",
"0.7259399",
"0.71910405",
"0.71609664",
"0.7081089",
"0.70748556",
"0.70470303",
"0.7038986",
"0.701688",
"0.6998141",
"0.69936776",
"0.69832367",
"0.6974105",
"0.6971682",
"0.6944141",
"0.69430286",
"0.69371... | 0.8658704 | 0 |
Test wtmode='tsys', interp='nearest,nearest', dowtsp=True | def testTsysNNSp(self):
self._runTest('tsys', True, self.tsys_funcs.keys(), 'nearest,nearest') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysNNSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysLCSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysLLSp(self):\n self._runTest('tinttsys', True, self.tsys_fu... | [
"0.69159997",
"0.6296606",
"0.6176141",
"0.6069002",
"0.5954954",
"0.5914424",
"0.58652925",
"0.57686806",
"0.5644779",
"0.5482096",
"0.5315107",
"0.5299039",
"0.52878356",
"0.5247621",
"0.5207398",
"0.5188795",
"0.5156379",
"0.5139908",
"0.51383054",
"0.5126579",
"0.51224476... | 0.6856138 | 1 |
Test wtmode='tinttsys', interp='nearest,nearest', dowtsp=True | def testTinttsysNNSp(self):
self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTsysNNSp(self):\n self._runTest('tsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysLCSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysLLSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys... | [
"0.64893264",
"0.6471385",
"0.63866085",
"0.6262443",
"0.6248298",
"0.57996994",
"0.5792964",
"0.57056886",
"0.56932837",
"0.55488276",
"0.5546918",
"0.5420293",
"0.5406579",
"0.5366721",
"0.5271492",
"0.52703965",
"0.5220601",
"0.5171412",
"0.5167025",
"0.51180923",
"0.51011... | 0.7156723 | 0 |
Test wtmode='tinttsys', interp='linear,cspline', dowtsp=True | def testTinttsysLCSp(self):
self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysNNSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysLLSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTinttsysMapLCSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,... | [
"0.6915214",
"0.6593633",
"0.6186842",
"0.6147206",
"0.6009761",
"0.5953264",
"0.5819722",
"0.56637067",
"0.56173426",
"0.560701",
"0.558406",
"0.54812276",
"0.5471691",
"0.5468226",
"0.5444616",
"0.5434842",
"0.5378455",
"0.5334122",
"0.528345",
"0.51883113",
"0.5174286",
... | 0.6803435 | 1 |
Test spwmap wtmode='tinttsys', interp='nearest,nearest' | def testTinttsysMapNN(self):
self._runTest('tinttsys', False, [1,3,5,7,15], 'nearest,nearest',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysMapNNSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysNNSp(self):\n self._runTest('tinttsys', True, self.tsys_funcs.keys(), 'nearest,nearest')",
"def testTsysMapNNSp(self):\n self._runTest('tsys', True, [1,3,5,7,9... | [
"0.7464721",
"0.694387",
"0.6688153",
"0.6513818",
"0.6375435",
"0.6351056",
"0.62163407",
"0.5984313",
"0.59639287",
"0.59157306",
"0.582448",
"0.56327325",
"0.5543462",
"0.54693025",
"0.54282254",
"0.540566",
"0.53477836",
"0.53318286",
"0.5310574",
"0.52897173",
"0.5219775... | 0.7247381 | 1 |
Test spwmap wtmode='tinttsys', interp='linear,cspline' | def testTinttsysMapLC(self):
self._runTest('tinttsys', False, [1,3,5,7,9,11,13,15], 'linear,cspline',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysMapLCSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,11,13,15], 'linear,cspline',self.spwmap)",
"def testTinttsysMapNNSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysMapLLSp(self):\n self._runTest('tinttsy... | [
"0.7193978",
"0.68954045",
"0.67678285",
"0.645622",
"0.64222103",
"0.6354744",
"0.63472885",
"0.62745875",
"0.6229267",
"0.6142785",
"0.61396414",
"0.5909097",
"0.56487125",
"0.5501776",
"0.54098845",
"0.53817445",
"0.53567433",
"0.52819806",
"0.5244804",
"0.5152128",
"0.515... | 0.6927376 | 1 |
Test spwmap wtmode='tsys', interp='nearest,nearest', dowtsp=True | def testTsysMapNNSp(self):
self._runTest('tsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysMapNNSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTsysMapNN(self):\n self._runTest('tsys', False, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTsysNNSp(self):\n self._runTest('tsys', True, self.tsys_funcs... | [
"0.72670513",
"0.71550035",
"0.6951513",
"0.6920037",
"0.6804798",
"0.64883035",
"0.6429448",
"0.63238674",
"0.62219316",
"0.61764634",
"0.60540795",
"0.60352385",
"0.6020373",
"0.5842893",
"0.5733396",
"0.5580416",
"0.5545951",
"0.5537896",
"0.55318445",
"0.54686",
"0.545312... | 0.7532484 | 0 |
Test spwmap wtmode='tinttsys', interp='nearest,nearest', dowtsp=True | def testTinttsysMapNNSp(self):
self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTsysMapNNSp(self):\n self._runTest('tsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysMapNN(self):\n self._runTest('tinttsys', False, [1,3,5,7,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysNNSp(self):\n self._runTest('tinttsys', True, self.tsys... | [
"0.7297252",
"0.726566",
"0.71029043",
"0.7018207",
"0.6625115",
"0.6614049",
"0.6548781",
"0.64842147",
"0.62953097",
"0.6115125",
"0.6074345",
"0.6069492",
"0.5952319",
"0.5844141",
"0.57873845",
"0.56899405",
"0.55286527",
"0.55151045",
"0.54746234",
"0.54596645",
"0.54242... | 0.76174855 | 0 |
Test spwmap wtmode='tinttsys', interp='linear,linear', dowtsp=True | def testTinttsysMapLLSp(self):
self._runTest('tinttsys', True, [1,3,5,7,9,11,15], 'linear,linear',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysMapNNSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTsysMapNNSp(self):\n self._runTest('tsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysMapNN(self):\n self._runTest('tinttsys', False, [1,3... | [
"0.7476452",
"0.7114421",
"0.69962686",
"0.6957557",
"0.69043505",
"0.6739348",
"0.6736017",
"0.6734121",
"0.67266977",
"0.6684998",
"0.6584073",
"0.64497477",
"0.64235175",
"0.63057137",
"0.62779695",
"0.5956183",
"0.5637475",
"0.5566264",
"0.5442669",
"0.5413177",
"0.535959... | 0.71439976 | 1 |
Test spwmap wtmode='tinttsys', interp='linear,cspline', dowtsp=True | def testTinttsysMapLCSp(self):
self._runTest('tinttsys', True, [1,3,5,7,9,11,13,15], 'linear,cspline',self.spwmap) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testTinttsysMapNNSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,15], 'nearest,nearest',self.spwmap)",
"def testTinttsysMapLLSp(self):\n self._runTest('tinttsys', True, [1,3,5,7,9,11,15], 'linear,linear',self.spwmap)",
"def testTinttsysMapLC(self):\n self._runTest('tinttsys', Fa... | [
"0.7282748",
"0.7065426",
"0.7024528",
"0.6905034",
"0.6886287",
"0.67218274",
"0.6720227",
"0.66895956",
"0.66394633",
"0.66167086",
"0.6601417",
"0.638492",
"0.6343307",
"0.6111405",
"0.6106252",
"0.58812624",
"0.57545495",
"0.55924857",
"0.54666066",
"0.5418006",
"0.524664... | 0.74198663 | 0 |
Return a darker color. | def darken(color):
hue, saturation, value = rgb_to_hsv(color.red, color.green, color.blue)
value /= 1.5
saturation /= 1.25
return hsv_to_rgb(hue, saturation, value) + (color.alpha,) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def darken(hex_color: str) -> str:\n amount = 0.2\n hex_color = hex_color.replace(\"#\", \"\")\n red = max(0, int(hex_color[0:2], 16) - int(255 * amount))\n green = max(0, int(hex_color[2:4], 16) - int(255 * amount))\n blue = max(0, int(hex_color[4:6], 16) - int(255 * amount))\n darker_color = (\... | [
"0.7454738",
"0.7330892",
"0.69382864",
"0.68706894",
"0.6669197",
"0.6634606",
"0.64649427",
"0.6458235",
"0.64072514",
"0.6381072",
"0.6364707",
"0.6326756",
"0.6304574",
"0.6232114",
"0.6199844",
"0.6146135",
"0.61369884",
"0.6134376",
"0.6109642",
"0.6106515",
"0.6088504"... | 0.7346637 | 1 |
Draw the given PageBox. | def draw_page(page, stream):
bleed = {
side: page.style[f'bleed_{side}'].value
for side in ('top', 'right', 'bottom', 'left')}
marks = page.style['marks']
stacking_context = StackingContext.from_page(page)
draw_background(
stream, stacking_context.box.background, clip_box=False, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _draw(self, frame, boxes, probs, landmarks, name):\n try:\n print('drawing')\n for box, prob, ld, id in zip(boxes, probs, landmarks, name):\n # Draw rectangle on frame\n\n cv2.putText(frame, id, (200, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, c... | [
"0.6347439",
"0.63203573",
"0.62022114",
"0.6174339",
"0.6136849",
"0.6121753",
"0.60829866",
"0.6076081",
"0.594833",
"0.5891543",
"0.58463913",
"0.58332574",
"0.574836",
"0.5743358",
"0.57408214",
"0.57265896",
"0.57255423",
"0.5719865",
"0.56654084",
"0.5649143",
"0.562817... | 0.69499445 | 0 |
Draw a ``stacking_context`` on ``stream``. | def draw_stacking_context(stream, stacking_context):
# See https://www.w3.org/TR/CSS2/zindex.html
with stacked(stream):
box = stacking_context.box
stream.begin_marked_content(box, mcid=True)
# apply the viewport_overflow to the html box, see #35
if box.is_for_root_element and (... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stacked(stream):\n stream.push_state()\n try:\n yield\n finally:\n stream.pop_state()",
"def stack(self, *args, **kwargs):\n return self._block(*args, container=\"stack\", **kwargs)",
"def build_stream(\n self,\n tag,\n manifest,\n synthetic_image_i... | [
"0.617012",
"0.5554513",
"0.5277841",
"0.5274168",
"0.5218626",
"0.51678014",
"0.5144608",
"0.5100139",
"0.5036429",
"0.4926174",
"0.4897954",
"0.48235258",
"0.47874787",
"0.47840837",
"0.476707",
"0.47404984",
"0.46945328",
"0.46772468",
"0.4641723",
"0.462906",
"0.462906",
... | 0.74125075 | 0 |
Draw the background color and image to a ``document.Stream``. If ``clip_box`` is set to ``False``, the background is not clipped to the border box of the background, but only to the painting area. | def draw_background(stream, bg, clip_box=True, bleed=None, marks=()):
if bg is None:
return
with stacked(stream):
if clip_box:
for box in bg.layers[-1].clipped_boxes:
rounded_box_path(stream, box)
stream.clip()
stream.end()
# Backgrou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_page(page, stream):\n bleed = {\n side: page.style[f'bleed_{side}'].value\n for side in ('top', 'right', 'bottom', 'left')}\n marks = page.style['marks']\n stacking_context = StackingContext.from_page(page)\n draw_background(\n stream, stacking_context.box.background, clip... | [
"0.50916755",
"0.50457513",
"0.47716227",
"0.46886986",
"0.45910823",
"0.45242292",
"0.45099384",
"0.4491094",
"0.44542804",
"0.4447981",
"0.44441408",
"0.44344813",
"0.43993294",
"0.4392615",
"0.43871245",
"0.43814042",
"0.43637508",
"0.43514937",
"0.4329039",
"0.43201867",
... | 0.6876859 | 0 |
Draw the box border to a ``document.Stream``. | def draw_border(stream, box):
# We need a plan to draw beautiful borders, and that's difficult, no need
# to lie. Let's try to find the cases that we can handle in a smart way.
def get_columns_with_rule():
"""Yield columns that have a rule drawn on the left."""
skip_next = True
for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_page(page, stream):\n bleed = {\n side: page.style[f'bleed_{side}'].value\n for side in ('top', 'right', 'bottom', 'left')}\n marks = page.style['marks']\n stacking_context = StackingContext.from_page(page)\n draw_background(\n stream, stacking_context.box.background, clip... | [
"0.5705386",
"0.5639399",
"0.5570043",
"0.556558",
"0.55434954",
"0.5383438",
"0.53265554",
"0.53187335",
"0.52529013",
"0.52422464",
"0.5228069",
"0.52273524",
"0.52140033",
"0.52086645",
"0.51901776",
"0.5178869",
"0.5124615",
"0.5115901",
"0.5094592",
"0.50910413",
"0.5090... | 0.69521314 | 0 |
Yield columns that have a rule drawn on the left. | def get_columns_with_rule():
skip_next = True
for child in box.children:
if child.style['column_span'] == 'all':
skip_next = True
elif skip_next:
skip_next = False
else:
yield child | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_columnrules(self, index, M):\n return list(itertools.chain.from_iterable(\n [[[self.strip(index[0], index[1], i), self.strip(index[0], x, i)]\n for x in range(1, M+1) if x != index[1]]\n for i in range(1, M+1)]\n ))",
"def collect_columns():\n retur... | [
"0.645149",
"0.6057414",
"0.586089",
"0.56928515",
"0.5675787",
"0.5641196",
"0.5573644",
"0.55316836",
"0.552581",
"0.5522299",
"0.54805315",
"0.5416425",
"0.53937966",
"0.539047",
"0.52966505",
"0.52788615",
"0.527391",
"0.5270788",
"0.52541006",
"0.52484876",
"0.52372336",... | 0.7647242 | 0 |
Return the length of the half of one ellipsis corner. Inspired by [Ramanujan, S., "Modular Equations and Approximations to pi" Quart. J. Pure. Appl. Math., vol. 45 (19131914), pp. 350372], wonderfully explained by Dr Rob. | def corner_half_length(a, b):
x = (a - b) / (a + b)
return pi / 8 * (a + b) * (
1 + 3 * x ** 2 / (10 + sqrt(4 - 3 * x ** 2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sq_footage(length, width):\n return length * width",
"def pointlength(x):\n return 0.0",
"def len_square(bound):\n\treturn (8 - 2 * bound)",
"def dots_left(self):\n return (len(self.top_row) +\n len(self.bottom_row) +\n len(self.left_col) +\n len... | [
"0.57467",
"0.57435304",
"0.56325287",
"0.55781907",
"0.54365695",
"0.54319966",
"0.5429056",
"0.5394755",
"0.53694063",
"0.5361059",
"0.53427887",
"0.53427887",
"0.5335277",
"0.5334549",
"0.5322909",
"0.5317182",
"0.53119785",
"0.5297855",
"0.529538",
"0.5269954",
"0.5258615... | 0.65680283 | 0 |
Draw borders of table cells when they collapse. | def draw_collapsed_borders(stream, table):
row_heights = [
row.height for row_group in table.children
for row in row_group.children]
column_widths = table.column_widths
if not (row_heights and column_widths):
# One of the list is empty: don’t bother with empty tables
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tile_border(draw, r_s, r_e, c_s, c_e, color, border_size=TILE_BORDER_SIZE):\n for x in range(0, border_size):\n draw.rectangle([(c_s + x, r_s + x), (c_e - 1 - x, r_e - 1 - x)], outline=color)",
"def _handle_border(self, i_row, i_col, adj_opp_cells, check_func, loc):\n check_func(i_row, i_col, adj_... | [
"0.61329514",
"0.61080414",
"0.6092054",
"0.6007161",
"0.5973623",
"0.59045523",
"0.5830328",
"0.58236414",
"0.577159",
"0.57643205",
"0.5728255",
"0.5599663",
"0.55689305",
"0.5513478",
"0.54590344",
"0.5346918",
"0.53133273",
"0.5308185",
"0.5281155",
"0.5266912",
"0.518911... | 0.6858842 | 0 |
Draw textdecoration of ``textbox`` to a ``document.Stream``. | def draw_text_decoration(stream, textbox, offset_x, offset_y, thickness,
color):
draw_line(
stream, textbox.position_x, textbox.position_y + offset_y,
textbox.position_x + textbox.width, textbox.position_y + offset_y,
thickness, textbox.style['text_decoration_style']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_text(stream, textbox, offset_x, text_overflow, block_ellipsis):\n # Pango crashes with font-size: 0\n assert textbox.style['font_size']\n\n if textbox.style['visibility'] != 'visible':\n return\n\n text_decoration_values = textbox.style['text_decoration_line']\n text_decoration_color... | [
"0.71900946",
"0.61658967",
"0.56317216",
"0.56239617",
"0.5589885",
"0.5569843",
"0.54945374",
"0.53644043",
"0.53160083",
"0.52535385",
"0.524488",
"0.5234661",
"0.52239835",
"0.5214129",
"0.5204475",
"0.5171991",
"0.51597446",
"0.5150328",
"0.51423484",
"0.5134784",
"0.513... | 0.8075535 | 0 |
Instantiate the scope by keys. e.g. PullRequest.init_by_keys(organization='octocat', repository='HelloWorld', number=1) > PullRequest(organization='octocat', repository='HelloWorld', number=1) | def init_by_keys(cls, **query):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(self, keys: List[str]):",
"def build(keys: List[str]):\n api = API()\n api.build(*keys)",
"def __init__(self, keys_to_track):\r\n self.keys_to_track = keys_to_track\r\n self.tracker = {}\r\n for key_to_track in self.keys_to_track:\r\n self.tracker[key_to_tra... | [
"0.6308261",
"0.60055834",
"0.55877304",
"0.55266637",
"0.54057276",
"0.5345015",
"0.52308273",
"0.5219602",
"0.5178745",
"0.5178331",
"0.51643896",
"0.51558304",
"0.51527977",
"0.5145405",
"0.5113519",
"0.50983435",
"0.5097046",
"0.50778776",
"0.50524044",
"0.50505924",
"0.5... | 0.6373544 | 0 |
Return whether this endpoint scope is a singleton or not. | def is_singleton_scope(cls):
return not cls.primary_keys | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_Singleton(self):\n return self.size == 1",
"def valid_endpoint(cls):\n\t\treturn cls.__subclasses__() == []",
"def has_request_scope(self):\n return self.request_scope",
"def private_instance(self) -> bool:\n return pulumi.get(self, \"private_instance\")",
"def is_shared(self):\... | [
"0.7000542",
"0.64485866",
"0.6180424",
"0.61669946",
"0.6114246",
"0.60283005",
"0.60228246",
"0.5933381",
"0.5918585",
"0.5906537",
"0.5830943",
"0.58295834",
"0.58278096",
"0.5807388",
"0.57512015",
"0.5715974",
"0.5711425",
"0.56972426",
"0.5690803",
"0.5667977",
"0.56553... | 0.77170163 | 0 |
Return the hash for the event using ID only | def hash_by_id(cls, event_id):
return '{}::{}'.format(cls.Endpoint.key, event_id) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def existing_hash(self, id):\r\n return self._read_sha_by_id(id)",
"def _calculate_hash(self, entry):\n entry.pop('id', None)\n return hashlib.sha224(json.dumps(\n entry, cls=DjangoJSONEncoder).encode('utf-8')).hexdigest()",
"def id_to_hash(self, id):\n mm = hashlib.sha256(st... | [
"0.7319287",
"0.707525",
"0.70566404",
"0.6818503",
"0.67281663",
"0.6721193",
"0.6599954",
"0.65424097",
"0.64546216",
"0.64048505",
"0.6393958",
"0.6373491",
"0.63731545",
"0.63528925",
"0.6342936",
"0.6342936",
"0.6342936",
"0.6342936",
"0.6318093",
"0.63149315",
"0.630519... | 0.82204044 | 0 |
Build new_events This factory method is actually the events factory. | def build_events(self) -> list:
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_event(self):\n pass",
"def handle_new_events(self, events):\n for event in events:\n self.events.append(\n self.create_event_object(\n event[0],\n event[1],\n int(event[2])))",
"def create_event(self... | [
"0.7068018",
"0.6923349",
"0.6733583",
"0.6481142",
"0.6407484",
"0.63098305",
"0.6274381",
"0.62523794",
"0.61910576",
"0.61229914",
"0.601929",
"0.6007083",
"0.6007083",
"0.6007083",
"0.60045576",
"0.597696",
"0.595828",
"0.593561",
"0.5929939",
"0.5923887",
"0.5875728",
... | 0.6995154 | 1 |
Collecting new events and push them into the events buffer | def collect_new_events(self) -> list:
self.logger.debug('Collecting new events...')
events = self.build_events()
if not events:
self.logger.debug('No new events.')
for event in events:
self.logger.info('A new event has been detected: {}'.format(event))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_events(self):\n while 1:\n try:\n self.events_local.append(self._q.get(False))\n except queue.Empty:\n break",
"def slurp_events(self):\n while self.has_event():\n self.get_event()",
"def _store_events(self, c, e):\n ... | [
"0.7208618",
"0.69300455",
"0.67458445",
"0.6702277",
"0.64130634",
"0.6407206",
"0.6382773",
"0.63692826",
"0.6364064",
"0.6345537",
"0.6214517",
"0.6210405",
"0.61788917",
"0.61758673",
"0.6163426",
"0.6151569",
"0.6115069",
"0.6052047",
"0.6035892",
"0.6028083",
"0.6023511... | 0.81267637 | 0 |
Return the conditional tasks of this bot. | def get_conditional_tasks(self, scope: EndpointScope=None):
from nudgebot.tasks import ConditionalTask
conditional_tasks = [task for task in self._tasks if issubclass(task, ConditionalTask)]
if scope:
static_hierarchy = [ps.__class__ for ps in scope.hierarchy]
conditional... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_created_tasks(self):\n tasks = []\n for task_config in get_task_configs(self.context):\n task = task_config.get_created_task(self.context)\n if not task:\n continue\n matched, not_matched = task.start_conditions_status()\n if not not_... | [
"0.651819",
"0.6293233",
"0.62041074",
"0.61520755",
"0.6030803",
"0.60058683",
"0.59421945",
"0.59181774",
"0.58944106",
"0.5864872",
"0.5841039",
"0.57834464",
"0.57781357",
"0.57735986",
"0.5766781",
"0.5705261",
"0.5684001",
"0.5660684",
"0.5619601",
"0.5606973",
"0.56057... | 0.7749001 | 0 |
If the bot is pollable, performing a poll, collecting all the scopes from the scopes collectors, updating statistics and handling tasks. | def poll(self):
if not self.pollable:
self.logger.warning('Poll has been triggered but the bot is not pollable! Return;')
return
self._busy_mutext.acquire()
try:
self.logger.info('Stating poll')
for scope in self.ScopeCollector.collect_all():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def poll(self, ctx, choice=None):\n\n if choice is None or choice.lower() in (\"online\", \"voice\"):\n suggestions = get_suggestions(get_users(ctx, choice))\n\n if suggestions:\n poll_id = create_strawpoll(\"What to play?\", suggestions)\n\n if poll... | [
"0.54762065",
"0.53788805",
"0.53186905",
"0.53170043",
"0.5184612",
"0.5109608",
"0.5096446",
"0.50746995",
"0.50663227",
"0.5019184",
"0.5006015",
"0.4936928",
"0.4913336",
"0.4876137",
"0.48729563",
"0.48675004",
"0.4866862",
"0.48607504",
"0.48592043",
"0.48447618",
"0.48... | 0.8014664 | 0 |
Pulling new events from the event factory, collecting statistics and handling tasks | def handle_events(self):
self._busy_mutext.acquire()
try:
event = self.EventsFactory.pull_event()
while event:
self.logger.debug('Handling new event: {}'.format(event.id))
event_endpoint_scope_classes = event.EndpointScope.get_static_hierarchy()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_new_events(self, events):\n for event in events:\n self.events.append(\n self.create_event_object(\n event[0],\n event[1],\n int(event[2])))",
"def collect_new_events(self) -> list:\n self.logger.debug('Co... | [
"0.6928928",
"0.66840243",
"0.65027535",
"0.64619464",
"0.6460602",
"0.6405665",
"0.635793",
"0.6357241",
"0.6314258",
"0.62627983",
"0.62376845",
"0.6235711",
"0.62312156",
"0.62292194",
"0.6201306",
"0.61748487",
"0.61748487",
"0.61693776",
"0.61435163",
"0.61425567",
"0.61... | 0.75559413 | 0 |
Return feature complexity value | def complexity(self):
raise NotImplementedError() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_complexity(self):\n if self.layer_type() == nn.Conv2d:\n return pow(self.layer_type.get_sub_value(\"conv_window_size\"), 2) * self.layer_type.get_sub_value(\n \"out_features\")\n elif self.layer_type() == nn.Linear:\n return self.layer_type.get_sub_value(\... | [
"0.6790964",
"0.66218597",
"0.641455",
"0.6044887",
"0.60209787",
"0.5925947",
"0.591959",
"0.5895237",
"0.58917314",
"0.5765962",
"0.56985533",
"0.567084",
"0.567084",
"0.567084",
"0.567084",
"0.567084",
"0.565596",
"0.564267",
"0.56411445",
"0.5639347",
"0.5630512",
"0.56... | 0.7181252 | 0 |
r"""compute amplitude phase error compute amplitude phase error of two complex valued matrix | def ampphaerror(orig, reco):
amp_orig = np.abs(orig)
amp_reco = np.abs(reco)
pha_orig = np.angle(orig)
pha_reco = np.angle(reco)
# print(np.abs(amp_orig - amp_reco))
# print(np.abs(pha_orig - pha_reco))
# print(np.mean(np.abs(amp_orig - amp_reco)))
# print(np.mean(np.abs(pha_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_phase_amplitude_damping_error_noncanonical(self):\n error = phase_amplitude_damping_error(0.25, 0.5, 0.3, canonical_kraus=False)\n circ, p = error.error_term(0)\n self.assertEqual(p, 1, msg=\"Kraus probability\")\n self.assertEqual(circ[0][\"qubits\"], [0])\n self.assert... | [
"0.57301235",
"0.5672069",
"0.5634887",
"0.55991733",
"0.5460378",
"0.5439556",
"0.5384441",
"0.53555703",
"0.53211105",
"0.53139055",
"0.53101045",
"0.5309513",
"0.5285496",
"0.5270891",
"0.5257104",
"0.5252667",
"0.5211097",
"0.5206943",
"0.52064764",
"0.519271",
"0.5184854... | 0.63241947 | 0 |
Print 6 power 3 | def six_cubed():
print(math.pow(6, 3)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def six_cubed():\n print(math.pow(6,3))",
"def print_pow():\n a = get_inp_pow()\n n = get_inp_pow('power')\n print(a, \"^\", n, \" = \", pow(a, n), sep='')",
"def print_power(x):\r\n if(type(x)!=int):\r\n if(power(x)==1 or power(x)==0):\r\n print(calc_power(x))\r\n else:... | [
"0.80794406",
"0.739419",
"0.66700226",
"0.6589733",
"0.6485324",
"0.638416",
"0.6293852",
"0.62722826",
"0.61774296",
"0.61550194",
"0.61198187",
"0.59969866",
"0.5990775",
"0.59640026",
"0.59278244",
"0.59264386",
"0.59198284",
"0.5873405",
"0.5873405",
"0.5857948",
"0.5857... | 0.80480736 | 1 |
Print the hypotenuse of straight angled triangle with 3 and 5 rib lengths | def hypotenuse():
print(math.sqrt(5*5 + 3*3)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def triangular_area():\n print(1*1/2, 2*2/2, 3*3/2, 4*4/2, 5*5/2, 6*6/2, 7*7/2, 8*8/2, 9*9/2,\n 10*10/2)",
"def hypotenuse():\n print(math.sqrt(5**2 +3**2))",
"def triangle(self):\n \n R = Householder.triangle_operation(self)[0] \n \n return(R.round(10))",
"de... | [
"0.716252",
"0.69258684",
"0.68606097",
"0.68530416",
"0.6835748",
"0.67376614",
"0.66448975",
"0.66325754",
"0.65477556",
"0.65080655",
"0.6503776",
"0.64483434",
"0.64430314",
"0.6440897",
"0.6418103",
"0.6221835",
"0.6206969",
"0.6188036",
"0.6169473",
"0.6046872",
"0.6028... | 0.70707786 | 1 |
Removes the citations that consist of a pair of brackets having a substring containing at least one digit inside them. | def remove_citations(text: str) -> str:
text = re.sub("\[[a-zA-Z]\]", "", text)
return re.sub(r"\[(\s|\w)*\d+(\s|\w)*\]", "", text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _remove_between_square_brackets(text):\n return re.sub('\\[[^]]*\\]', '', text)",
"def clean_all_brackets(text):\n if \"[\" in text and \"]\" in text:\n text = delete_first_brackets(text)\n return clean_all_brackets(text)\n else:\n return text",
"def clean_newick_string(self, ... | [
"0.627086",
"0.6270785",
"0.605527",
"0.5885382",
"0.58816636",
"0.5716584",
"0.55261326",
"0.54964125",
"0.5492156",
"0.5491435",
"0.54455703",
"0.5420037",
"0.54059094",
"0.5369905",
"0.5256885",
"0.52483344",
"0.5220134",
"0.51920635",
"0.51877683",
"0.51309067",
"0.512497... | 0.6384374 | 0 |
Generates a JSON Web Token that stores this user's ID and has an expiry date set to 60 days into the future. | def _generate_jwt_token(self):
import jwt
from datetime import datetime, timedelta
from django.conf import settings
dt = datetime.now() + timedelta(days=60)
token = jwt.encode({
'id': self.pk,
'username': self.username,
'exp': int(dt.strftime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_jwt_token(self):\n dt = datetime.now() + timedelta(days=60)\n\n token = jwt.encode({\n 'id': self.pk,\n 'exp': int(dt.strftime('%s'))\n }, settings.SECRET_KEY, algorithm='HS256')\n\n return token.decode('utf-8')",
"def generate_auth_token(self, expi... | [
"0.793682",
"0.77396196",
"0.77252686",
"0.7569785",
"0.7550483",
"0.7504947",
"0.74958557",
"0.74798924",
"0.745215",
"0.7271606",
"0.72704905",
"0.7229112",
"0.7227402",
"0.71781677",
"0.7081612",
"0.69910264",
"0.69628245",
"0.69411725",
"0.69014037",
"0.6862004",
"0.68561... | 0.8095364 | 0 |
Validates if all ConfigurationOption names are unique in the ConfigurationOptions instance. | def configuration_options_object_processor(configuration_options):
option_names = [option.name for option in configuration_options.configuration_options]
for option_name in option_names:
if option_names.count(option_name) > 1:
raise WashError(f'Configuration option with the name {option_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_options(self):\r\n valid_choices = ('correct', 'partially-correct', 'incorrect')\r\n for option in self.options:\r\n choice = option['choice']\r\n if choice is None:\r\n raise ValueError('Missing required choice attribute.')\r\n elif choic... | [
"0.66978174",
"0.6242515",
"0.6204667",
"0.61873025",
"0.6138533",
"0.60712093",
"0.6030964",
"0.598881",
"0.5862973",
"0.5836668",
"0.5816893",
"0.5737586",
"0.5737399",
"0.57218176",
"0.570948",
"0.5619496",
"0.55831975",
"0.55713516",
"0.55708873",
"0.5567247",
"0.55379665... | 0.7466442 | 0 |
Validates if all ConfigurationOptionParameter names are unique in the ConfigurationOption instance. Also validates if at least one required parameter is specified in the ConfigurationOption instance. | def configuration_option_object_processor(configuration_option):
parameter_names = [parameter.name for parameter in configuration_option.parameters]
for parameter_name in parameter_names:
if parameter_names.count(parameter_name) > 1:
raise WashError(f'Parameter with the name {parameter_name}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate(self):\n for p in self.parameters:\n #Check for missing required parameters:\n if p.is_required and not(p.is_set):\n raise ValueError(\"Parameter %s is not set.\" \\\n % p.names[-1])\n #Also repeat the parameter va... | [
"0.6902311",
"0.6522125",
"0.6513697",
"0.64732",
"0.64559853",
"0.6451961",
"0.6323427",
"0.6316556",
"0.6186604",
"0.6156855",
"0.6142861",
"0.612921",
"0.60664105",
"0.6061574",
"0.6059569",
"0.60359025",
"0.5982344",
"0.59677446",
"0.5965603",
"0.59638935",
"0.5913237",
... | 0.7193669 | 0 |
Return a marker's initial pose if it was passed in. | def initial_pose(self):
return self._initial_pose | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_init_pose(self):\n return self.init_pose_R, self.init_pose_t",
"def start_pose():\n global start_pose\n while start_pose is None:\n pass\n return start_pose",
"def _set_init_pose(self):\n raise NotImplementedError()",
"def _set_init_pose(self):\n ... | [
"0.6584604",
"0.6367691",
"0.6337681",
"0.6337681",
"0.6337681",
"0.6199046",
"0.6134793",
"0.60044897",
"0.5989717",
"0.5986071",
"0.59107316",
"0.5883016",
"0.58752507",
"0.58548284",
"0.57934",
"0.5782603",
"0.57810706",
"0.5780764",
"0.5670274",
"0.5653202",
"0.56078744",... | 0.7495326 | 0 |
Get the interactive marker map of this marker template. | def marker_map(self):
return self._marker_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_map(self):\n return self.map",
"def get_map(self):\n return self.parent.controller.get_map()",
"def mappable(self):\n return self._mappable.get(self._plotid, None)",
"def markers (self):\n return self._markers",
"def get_map(self):\n return self._locmap",
"def G... | [
"0.6520739",
"0.64780396",
"0.63716984",
"0.6316054",
"0.6315033",
"0.6121316",
"0.60842246",
"0.59842247",
"0.5905344",
"0.5881036",
"0.5847196",
"0.57981193",
"0.5774668",
"0.5716302",
"0.569977",
"0.56583416",
"0.55513626",
"0.5545483",
"0.5514279",
"0.5488387",
"0.5481627... | 0.77108824 | 0 |
Get the callback map of this marker template. | def callback_map(self):
return self._callback_map | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def marker_map(self):\n return self._marker_map",
"def get_map(self):\n return self.map",
"def get_map(self):\n return self.parent.controller.get_map()",
"def MAP(self):\n return self.__map",
"def get_map(self):\n return self._locmap",
"def get_callback(self):\n ... | [
"0.7049451",
"0.6784116",
"0.6679001",
"0.6338827",
"0.6203012",
"0.6103992",
"0.6036267",
"0.58860934",
"0.58419704",
"0.5811328",
"0.571724",
"0.5705887",
"0.5624895",
"0.54811853",
"0.5466417",
"0.5464931",
"0.54548174",
"0.5448449",
"0.5445454",
"0.54268634",
"0.5374627",... | 0.78254753 | 0 |
Get the menu handler of this marker template. | def menu_handler(self):
return self._menu_handler | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_menu ( self, object ):\n return self.menu",
"def menu(self):\n return self._menu",
"def get_menu ( self, object, row ):\n return self.menu",
"def GetMenu(self):\n return self._menu",
"def menu(self):\n try:\n return get_template('{}/menu.html'.format(se... | [
"0.687998",
"0.6734362",
"0.66681284",
"0.6660644",
"0.6325513",
"0.630204",
"0.6267521",
"0.608892",
"0.60468376",
"0.60233533",
"0.60089546",
"0.59873855",
"0.5929736",
"0.5915794",
"0.5880168",
"0.58781844",
"0.5877921",
"0.5829185",
"0.58093506",
"0.5780745",
"0.5773996",... | 0.8167384 | 0 |
Returns dictionary for CDP neighbor phone | def phone_parse(neighbor):
mgmt_ip = neighbor[mgmt_ip_s]
hostname = neighbor[hostname_s].split('.')[0]
if nxos:
sysname = neighbor['sysname']
if sysname != '':
hostname = sysname
if mgmt_ip == '':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Neighbors(vendor):\n neighbors = {\"cisco\" : \"\", \"juniper\" : \"\", \"vyatta\" : \"\" }\n cisco_neighbors = {}\n juniper_neighbors = {}\n vyatta_neighbors = {}\n while True:\n print \"***\\t\\t%s NEIGHBORS***\" % (vendor)\n n = raw_input(\"\\t\\tNeighbor information (Press any ... | [
"0.6110668",
"0.6060373",
"0.59975594",
"0.58959544",
"0.5839219",
"0.57849395",
"0.56733996",
"0.5624407",
"0.56165946",
"0.5539645",
"0.546498",
"0.5460354",
"0.5419926",
"0.54115295",
"0.53951436",
"0.5389832",
"0.5381396",
"0.5365169",
"0.53650045",
"0.5330386",
"0.531964... | 0.6916648 | 0 |
Returns dictionary for CDP neighbor router or switch | def router_sw_parse(neighbor):
mgmt_ip = neighbor[mgmt_ip_s]
hostname = neighbor[hostname_s].split('.')[0]
if hostname.__contains__('('):
hostname = hostname.split('(')[0]
if nxos:
sysname = neighbor['sysname']
if sysname !=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Neighbors(vendor):\n neighbors = {\"cisco\" : \"\", \"juniper\" : \"\", \"vyatta\" : \"\" }\n cisco_neighbors = {}\n juniper_neighbors = {}\n vyatta_neighbors = {}\n while True:\n print \"***\\t\\t%s NEIGHBORS***\" % (vendor)\n n = raw_input(\"\\t\\tNeighbor information (Press any ... | [
"0.63590497",
"0.6126241",
"0.61201745",
"0.60082996",
"0.5985307",
"0.59344363",
"0.5915709",
"0.586581",
"0.5772417",
"0.5727852",
"0.57097715",
"0.5701715",
"0.569434",
"0.5683343",
"0.564236",
"0.56369084",
"0.56235886",
"0.5598898",
"0.55868256",
"0.5574442",
"0.5525679"... | 0.6161124 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.