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 |
|---|---|---|---|---|---|---|
Test Shoppinglist creation without a user fails | def test_create_shoplist_without_user_fails(self):
User.users = {}
result = self.app.create_shoplist()
expected = {1: {'user_id': 1, 'name': 'Apple', 'description': 'Fresh Green Apples'}}
self.assertNotEqual(expected, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_successful_shoplist_creation(self):\n result = self.app.create_shoplist()\n expected = {5: {'user_id': 0, 'name': 'apples', 'description': 'Fresh Green Apples'}}\n self.assertEqual(expected, result)",
"def test_create_new_shopping_list_correct_user(create_user, create_shopping_list)... | [
"0.79067975",
"0.7724857",
"0.74877584",
"0.74201185",
"0.7388282",
"0.73585427",
"0.7208618",
"0.7151508",
"0.70583916",
"0.7045453",
"0.6953688",
"0.68764377",
"0.6793433",
"0.6745461",
"0.6735887",
"0.67269695",
"0.66694874",
"0.6653867",
"0.66537887",
"0.6624037",
"0.6624... | 0.81097955 | 0 |
Test Shoppinglist creation is successful | def test_successful_shoplist_creation(self):
result = self.app.create_shoplist()
expected = {5: {'user_id': 0, 'name': 'apples', 'description': 'Fresh Green Apples'}}
self.assertEqual(expected, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_create_shoplist(self):\n new_shoplist = self.app\n new_shoplist.create_shoplist()\n self.assertEqual(len(new_shoplist.shoplists), 1)",
"def test_shoppinglist_creation(self):\n self.app.post('/register', data=self.user_reg_details)\n self.app.post('/login', data=self.us... | [
"0.81821024",
"0.7965354",
"0.784286",
"0.77807367",
"0.7667245",
"0.74447703",
"0.73277265",
"0.73256046",
"0.7202339",
"0.7178579",
"0.7118226",
"0.7112633",
"0.70901626",
"0.7072848",
"0.7063823",
"0.7033362",
"0.69682866",
"0.6960603",
"0.6932682",
"0.69283473",
"0.684690... | 0.85448605 | 0 |
Test activity's dict is empty at first | def test_activity_dictionary(self):
new_activity = self.app
self.assertEqual(len(new_activity.activities), 0)
new_activity.create_activity(1)
self.assertIsInstance(new_activity, Activity)
self.assertEqual(len(new_activity.activities), 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_builddict_empty(self):\r\n # We don't care _that_ much that execution be silent. Nice if at least\r\n # one test executes the task and doesn't explode, tho.\r\n self.assertEqual('', self.execute_task())",
"def init(self, activity, session):\n return {}",
"def test_cache_null():\n ca... | [
"0.6620643",
"0.63007736",
"0.62150484",
"0.6162532",
"0.606681",
"0.606681",
"0.604985",
"0.59537953",
"0.5953121",
"0.5932054",
"0.58168036",
"0.581649",
"0.58036715",
"0.5788242",
"0.5766684",
"0.5758893",
"0.5755703",
"0.5755703",
"0.5755703",
"0.5739308",
"0.5731855",
... | 0.67997086 | 0 |
Test activity_id starts from one and increments by one | def test_activity_id(self):
new_activity = self.app
self.assertTrue(Activity.activity_id, 0)
new_activity.create_activity(1)
self.assertTrue(new_activity.activity_id, 1)
for key in new_activity.activities:
self.assertEqual(new_activity.activity_id, key) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_crm_activity_next_action(self):\n # Add the next activity (like we set it from a form view)\n lead_model_id = self.env['ir.model']._get('crm.lead').id\n activity = self.env['mail.activity'].with_user(self.user_sales_manager).create({\n 'activity_type_id': self.activity_type... | [
"0.62740666",
"0.609006",
"0.59693253",
"0.59664935",
"0.5893623",
"0.586038",
"0.583556",
"0.5795325",
"0.5753249",
"0.572466",
"0.5705445",
"0.57026875",
"0.56695217",
"0.56664497",
"0.56664497",
"0.56583816",
"0.5605769",
"0.5542561",
"0.55349314",
"0.5509826",
"0.55011",
... | 0.74851114 | 0 |
Generate a segmented array of variablelength, contiguous ranges between pairs of start and endpoints. | def gen_ranges(starts, ends):
if starts.size != ends.size:
raise ValueError("starts and ends must be same size")
if not ((ends - starts) > 0).all():
raise ValueError("all ends must be greater than starts")
lengths = ends - starts
segs = ak.cumsum(lengths) - lengths
totlen = lengths.s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sa_range(start: int, end: int) -> StaticArray:\n forward = True # Declares variable for direction\n # Sets the number of elements to create\n if end > start:\n length = abs((end - start) + 1)\n else:\n length = abs((start - end) + 1)\n forward = False\n arr = StaticArray(le... | [
"0.7105989",
"0.67178863",
"0.6715174",
"0.66361505",
"0.6512398",
"0.6505254",
"0.6505254",
"0.6505254",
"0.6505254",
"0.6452789",
"0.63758105",
"0.6338202",
"0.6336955",
"0.63071066",
"0.6295646",
"0.6254592",
"0.6251713",
"0.6232607",
"0.6185326",
"0.61489207",
"0.61197853... | 0.6791115 | 1 |
Replace characters that are ok for the filesystem but have special meaning in the shell. It is assumed file_path is already passed in double quotes. | def sanitize_file_path_for_shell(file_path):
file_path_sanitized = file_path.replace('\\', '\\\\')
file_path_sanitized = file_path_sanitized.replace('$', '\\$')
file_path_sanitized = file_path_sanitized.replace('"', '\\"')
file_path_sanitized = file_path_sanitized.replace('`', '\\`')
return file_pat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _escape_path(path):\n path = path.strip()\n return '\"{0}\"'.format(path) if _platform_windows else path.replace(\" \", \"\\ \")",
"def sanitize_file_path(file_path, replacement_text=\"\"):\n\n return __RE_INVALID_PATH.sub(replacement_text, file_path.strip())",
"def _escape_filename(self, filename... | [
"0.71783984",
"0.71233505",
"0.7065954",
"0.70276165",
"0.6792996",
"0.667642",
"0.6659069",
"0.65962875",
"0.6565966",
"0.65407276",
"0.6515731",
"0.649737",
"0.647577",
"0.64607286",
"0.6425371",
"0.6413269",
"0.6343448",
"0.62579924",
"0.6134818",
"0.61246663",
"0.61156386... | 0.7965993 | 0 |
Returns all parent regions of this region. | def all_parents(self) -> Iterable[Region]:
if self.parent is not None:
yield self.parent
yield from self.parent.all_parents() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children(self) -> List[Region]:\n return []",
"def getParents(self):\n return self.parents[:]",
"def parent_ids(self):\n return self._parent_ids",
"def region(self):\n return [node.region for node in self]",
"def children(self) -> List[Region]:\n return self._children... | [
"0.7434008",
"0.7339606",
"0.7157085",
"0.7153343",
"0.7056081",
"0.6984813",
"0.6946143",
"0.6928434",
"0.6888119",
"0.6858729",
"0.6857094",
"0.6851539",
"0.68390924",
"0.6822237",
"0.682013",
"0.67900497",
"0.676651",
"0.6735071",
"0.6715634",
"0.6683919",
"0.668044",
"0... | 0.8541655 | 0 |
Initialize the battery's attributes. | def __init__(self, battery_size=40):
self.battery_size = battery_size | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, battery_size=70):\r\n\t\tself.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size = battery_size",
"def __init__(self, battery_size=70):\n self.battery_size =... | [
"0.7373256",
"0.73601586",
"0.73601586",
"0.73601586",
"0.734221",
"0.734221",
"0.7319005",
"0.7316006",
"0.72850525",
"0.7227408",
"0.72071785",
"0.7196292",
"0.6998248",
"0.696277",
"0.69499767",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
"0.6907041",
... | 0.7383211 | 0 |
Function to generate ground truth labels as specified by int_limit. | def generate_true_labels(int_limit, n_obs):
if int_limit > 0:
if int_limit > n_obs:
raise ValueError(f"""Invalid value of int_limit {int_limit}:
greater than the number of sequences""")
else:
true_labels = [1 if idx <=
i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_cut_labels(var, bin_edges, bottom_inclusive=True):\n incl = '=' if bottom_inclusive else ''\n return ['{low:g} <{incl} {var} < {high:g}'.format(var=var, low=bin_low,\n high=bin_high, incl=incl)\n for (bin_low, bin_high) in bin_edges... | [
"0.58891654",
"0.58660847",
"0.58303446",
"0.5694453",
"0.5692392",
"0.5666728",
"0.56513286",
"0.5643508",
"0.5582945",
"0.54308045",
"0.5425018",
"0.5418894",
"0.5386328",
"0.5373158",
"0.5323061",
"0.53213376",
"0.53181946",
"0.53151214",
"0.5308631",
"0.52794737",
"0.5237... | 0.75520366 | 0 |
Create the bucket where all datasets will be stored | def create_bucket() -> None:
try:
client.make_bucket(DATASETS_BUCKET)
except BucketAlreadyOwnedByYou:
logger.debug(f"Not creating bucket {DATASETS_BUCKET}: Bucket already exists")
pass
else:
logger.debug(f"Successfully created bucket {DATASETS_BUCKET}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_buckets():\n s3 = boto.connect_s3()\n s3.create_bucket('mls_data.mls.angerilli.ca')",
"def create_and_fill_bucket(self):\n EmrProcessing.bucket = \\\n self.s3_handle.create_bucket(EmrProcessing.bucket_name)\n key = EmrProcessing.bucket.new_key('input/test.csv')\n i... | [
"0.71161413",
"0.6791009",
"0.67162263",
"0.6680957",
"0.6674802",
"0.6673578",
"0.64413446",
"0.63897455",
"0.63669753",
"0.63237906",
"0.631078",
"0.6286531",
"0.62792015",
"0.6254688",
"0.62064546",
"0.62060267",
"0.61797833",
"0.61677337",
"0.61318856",
"0.61285365",
"0.6... | 0.692468 | 1 |
Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero, or by comparing that the between the two objects is more than the given delta. Note that decimal places (from zero) are usually not the same as significant digits (measu... | def almost_equal(first, second, places=None, delta=0.1):
if first == second:
# shortcut
return True
if delta is not None and places is not None:
raise TypeError("specify delta or places not both")
if delta is not None:
if abs(first - second) <= del... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def almost_equals(self, other, decimal=...): # -> bool:\n ...",
"def assert_almost_equal(self, val1, val2, delta):\n return self.assertTrue(\n 0 <= abs(val1 - val2) <= delta,\n \"Absolute difference of {} and {} ({}) is not within {}\".format(\n val1,\n ... | [
"0.68236005",
"0.6749057",
"0.6739666",
"0.670881",
"0.6466249",
"0.6378507",
"0.6307229",
"0.62476826",
"0.62318397",
"0.62042546",
"0.6183346",
"0.6175197",
"0.61698675",
"0.6129581",
"0.61233366",
"0.61050105",
"0.60785776",
"0.6067823",
"0.60575235",
"0.6055449",
"0.60546... | 0.67849344 | 1 |
Rude check if uuid is in correct uuid1 format. | def validate_uuid(self, uuid):
match = re.match(
r'([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)-([a-z0-9]+)',
uuid
)
if match:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_uuid(uuid):\n try:\n converted = UUID(uuid, version=4)\n except ValueError:\n return False\n\n return str(converted) == uuid",
"def validate_uuid(uuid_string):\n try:\n UUID(uuid_string, version=4)\n return True\n except:\n return False",
"def is_vali... | [
"0.7841857",
"0.756394",
"0.7472721",
"0.739947",
"0.73708713",
"0.73455393",
"0.7301181",
"0.71633416",
"0.71633416",
"0.7073445",
"0.7024794",
"0.6966057",
"0.69361615",
"0.69247895",
"0.6830562",
"0.67718047",
"0.6766432",
"0.67584354",
"0.65963656",
"0.65020233",
"0.64920... | 0.75939476 | 1 |
Checks if the CSV file contains all required columns. | def validate_column_names(self, cols):
self.stdout.write('Verifying CSV header')
csv_cols = set(cols)
if self.required_csv_columns <= csv_cols:
return True
else:
missing_cols = set(self.required_csv_columns).difference(csv_cols)
raise ValidationError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_csv(filename, header, cols, rows):\n\n # open file\n data = pd.read_csv(filename, delimiter='|')\n\n # validate header\n assert header == '|'.join(list(data.columns.values))\n\n # validate column count\n assert data.shape[1] == cols\n\n # validate row count\n assert data.shape[... | [
"0.74219674",
"0.71559626",
"0.7064051",
"0.7044676",
"0.6933204",
"0.6880624",
"0.6842778",
"0.67009544",
"0.6593976",
"0.6554927",
"0.65337193",
"0.64992315",
"0.6493306",
"0.64672685",
"0.6462007",
"0.64533734",
"0.64333785",
"0.6407367",
"0.63730824",
"0.63719225",
"0.636... | 0.77545106 | 0 |
Concatenate observation data into one string. | def concatenate_observation_data(
self, compartment, date, measurementmethod, orig_srid, origx, origy,
parameter, property, quality, sampledevice, samplemethod, unit, value,
):
# Convert to string before joining
data = map(str, [
compartment, date, measurementmethod, orig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def concatenate_data():",
"def __str__(self):\n return ', '.join(str(item) for item in self._data)",
"def obs_to_string(observations):\n str_obs = []\n for obs in observations:\n str_obs.append(obs.reshape(-1).tostring())\n return str_obs",
"def __str__(self):\n lst = [str(i) fo... | [
"0.724462",
"0.6176857",
"0.6093485",
"0.60458475",
"0.5983507",
"0.59311306",
"0.59206545",
"0.58791316",
"0.5874102",
"0.5709245",
"0.57053846",
"0.5704484",
"0.5695554",
"0.5685938",
"0.5673281",
"0.565494",
"0.56044185",
"0.55893093",
"0.5557514",
"0.55474746",
"0.5525495... | 0.78445834 | 0 |
Removes Observations or removes related Environments. | def remove_or_deref_observations(self, processing_job):
cursor = connection.cursor()
env_hash = self.make_env_hash(processing_job)
# Update observations which have the same environment setup.
# Removes these items from the array.
self.stdout.write('Dereference environment {0} in ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_remove(args):\n read_envs = []\n for env_name in args.rm_env:\n env = ev.read(env_name)\n read_envs.append(env)\n\n if not args.yes_to_all:\n answer = tty.get_yes_or_no(\n \"Really remove %s %s?\"\n % (\n string.plural(len(args.rm_env), \"e... | [
"0.62257844",
"0.6080496",
"0.5872701",
"0.58601445",
"0.5766776",
"0.57624966",
"0.5742403",
"0.5738756",
"0.56853753",
"0.5683202",
"0.5669383",
"0.56654215",
"0.5665408",
"0.5649904",
"0.5649904",
"0.5643665",
"0.56427264",
"0.5626603",
"0.5625567",
"0.55980545",
"0.559113... | 0.7031861 | 0 |
Check if concatenated_observation_data is in self.observations | def observation_exists_locally(self, concatenated_observation_data):
local_observation = self.observations.get(
concatenated_observation_data,
None
)
if local_observation:
return local_observation['observation'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def observation_exists(self, concatenated_observation_data):\n local_observation = self.observation_exists_locally(\n concatenated_observation_data\n )\n if local_observation:\n return local_observation\n\n try:\n return Observation.objects.get(\n ... | [
"0.65428954",
"0.626618",
"0.5845177",
"0.5799288",
"0.57642674",
"0.5685769",
"0.55044246",
"0.5491718",
"0.54879206",
"0.5462496",
"0.5368831",
"0.5367507",
"0.5330643",
"0.5304856",
"0.530262",
"0.5287393",
"0.52781326",
"0.52779424",
"0.52746606",
"0.5272336",
"0.52582705... | 0.70318484 | 0 |
Returns False if point does not exist, else return locationpoint id | def point_exists(self, point):
qs = LocationPoint.objects.raw("""
SELECT * FROM script_execution_manager_locationpoint
WHERE st_dwithin(
thegeometry,
st_transform(
st_setsrid(
st_point({point.x}, {point.y}), {point.sri... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isSetId(self):\n return _libsbml.Point_isSetId(self)",
"def check_point(point,points):\n if point in points:\n return True\n else:\n return False",
"def find_point(self, point: Point):\n for internal_point in self.points:\n if internal_point == point:\n ... | [
"0.65851754",
"0.60588527",
"0.59962666",
"0.5944725",
"0.58938813",
"0.5892437",
"0.58379346",
"0.5795499",
"0.57793",
"0.576884",
"0.5735127",
"0.57340264",
"0.5658171",
"0.56532735",
"0.5652695",
"0.56121695",
"0.5558224",
"0.5546083",
"0.5536352",
"0.5525766",
"0.5519552"... | 0.73598516 | 0 |
Make a CarlaSettings object with the settings we need. | def make_carla_settings(args):
settings = CarlaSettings()
settings.set(
SynchronousMode=True,
SendNonPlayerAgentsInfo=True,
NumberOfVehicles=0,
NumberOfPedestrians=0,
SeedVehicles = '00000',
WeatherId=1,
QualityLevel=args.quality_level)
settings.random... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_carla_settings(args):\n settings = CarlaSettings()\n settings.set(\n SynchronousMode=False,\n SendNonPlayerAgentsInfo=True,\n NumberOfVehicles=NUM_VEHICLES,\n NumberOfPedestrians=NUM_PEDESTRIANS,\n WeatherId=random.choice([1, 3, 7, 8, 14]),\n QualityLevel=ar... | [
"0.7046542",
"0.64021003",
"0.6321816",
"0.59555054",
"0.58940154",
"0.5859983",
"0.58227974",
"0.5814349",
"0.5743213",
"0.5712618",
"0.56494814",
"0.563011",
"0.56196254",
"0.56128407",
"0.55752116",
"0.5572938",
"0.5552482",
"0.5540732",
"0.55223477",
"0.5518125",
"0.54987... | 0.8063497 | 0 |
Check whether a color is 'dark'. Currently, this is simply whether the luminance is <50% | def dark_color(color):
rgb = hex_to_rgb(color)
if rgb:
return rgb_to_hls(*rgb)[1] < 128
else: # default to False
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_dark(self):\n\n return self.red() < 125 and self.green() < 125 and self.blue() < 125",
"def dark(r, d):\n return d * 1.0 / (r + d) + d * r * 1.0 / ((r + d) ** 2)",
"def is_monochromatic(self):\n return equal(s.color for s in self.iter_states())",
"def ensureBrightOrDark( nColor, bBrig... | [
"0.8725131",
"0.65368",
"0.65338826",
"0.6522034",
"0.6357333",
"0.63260835",
"0.62616885",
"0.62494576",
"0.62354577",
"0.6234573",
"0.6193287",
"0.6178857",
"0.6167206",
"0.6154868",
"0.6118449",
"0.6047277",
"0.6014609",
"0.59861344",
"0.5977451",
"0.59697956",
"0.5940999"... | 0.81742746 | 1 |
Guess whether the background of the style with name 'stylename' counts as 'dark'. | def dark_style(stylename):
return dark_color(get_style_by_name(stylename).background_color) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_color(style):\n for kw in list(cc.keys()):\n m = re.search(kw, style)\n if m:\n return m.group()\n\n # Return 'b' if nothing has found\n return 'b'",
"def is_dark(self):\n\n return self.red() < 125 and self.green() < 125 and self.blue() < 125",
"def check_them... | [
"0.66091275",
"0.63446206",
"0.6265952",
"0.561835",
"0.5487273",
"0.5460873",
"0.54280055",
"0.5422753",
"0.5419636",
"0.53896165",
"0.5383962",
"0.5319423",
"0.5317914",
"0.5317887",
"0.53108865",
"0.52508605",
"0.5241777",
"0.5228757",
"0.5217556",
"0.52019304",
"0.5188046... | 0.69731295 | 0 |
Preempt all contained states. | def request_preempt(self):
# Set preempt flag
smach.State.request_preempt(self)
# Notify concurrence that it should preempt running states and terminate
with self._done_cond:
self._done_cond.notify_all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preempt(self):\n rospy.logwarn(\"Preempting scan...\")\n self.preempted = True",
"def skip_all_animations(self):\n for child in self.children:\n child.skip_all_animations()\n \n # remove unskippable animations from queue\n unskippables = [anim for anim... | [
"0.554885",
"0.5414512",
"0.5326902",
"0.529442",
"0.5274952",
"0.5222493",
"0.5195873",
"0.51523536",
"0.51299024",
"0.50996476",
"0.5081874",
"0.5050064",
"0.50393015",
"0.50298834",
"0.5028418",
"0.50032896",
"0.49937183",
"0.49687582",
"0.49533314",
"0.49426508",
"0.49423... | 0.7223714 | 0 |
We are going to generate 10 unique characters in the addrs and labels | def generateUniqueAddrs(saveImagePath,numUnique,trainType,addrs_labels):
print("Saving only {} unique characters for {}".format(numUnique,trainType))
train_addrs = addrs_labels[0]
train_labels = addrs_labels[1]
test_addrs = addrs_labels[2]
test_labels = addrs_labels[3]
ge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _generate_id() -> str:\n return \"\".join(sample(\"abcdefghjkmopqrstuvqxyz\", 16))",
"def generate_uuids():\n uuid_start = str(uuid())\n while uuid_start.startswith(\"zzzzzzzz\"):\n uuid_start = str(uuid())\n uuid_end = list(deepcopy(uuid_start))\n \n char_pool = list(string.digits) ... | [
"0.640046",
"0.6369727",
"0.63013107",
"0.6263165",
"0.62521905",
"0.6217594",
"0.62151855",
"0.6057115",
"0.6023755",
"0.6016253",
"0.59843117",
"0.59843117",
"0.5947065",
"0.5907196",
"0.5886632",
"0.5849489",
"0.58435",
"0.58254504",
"0.5823662",
"0.58192736",
"0.5805219",... | 0.7429078 | 0 |
Check if have an modal in the page and close it | def check_modal(client):
modal_close_btn_xpath = "/html/body/div[9]/div[3]/div/button[1]"
try:
modal_close_btn = wait(client, 20).until(
EC.visibility_of_element_located((By.XPATH, modal_close_btn_xpath))
).click()
except TimeoutException:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_until_modal_is_closed(self):\n self.selenium.wait_until_page_does_not_contain_element(\n lex_locators[\"modal\"][\"is_open\"], timeout=15\n )",
"def close_modal(self):\n locator = lex_locators[\"modal\"][\"close\"]\n self._jsclick(locator)",
"def isModal(self) ->... | [
"0.7223902",
"0.6937706",
"0.6832686",
"0.6832686",
"0.6832686",
"0.6832686",
"0.6668967",
"0.6477973",
"0.6467144",
"0.64522135",
"0.6235597",
"0.6161681",
"0.609987",
"0.6045032",
"0.60414016",
"0.6033631",
"0.5973035",
"0.5968023",
"0.5936488",
"0.5881599",
"0.5880967",
... | 0.6974228 | 1 |
Takes in a list of column headers and the Data object and returns a list of the mean values for each column. Use the builtin numpy functions to execute this calculation. | def mean(headers, data):
column_matrix=data.get_data(headers)
mean_values=column_matrix.mean(0)
return mean_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_list(data):\n return sum(data) / len(data)",
"def calculate_mean(data_dir):\n data = ([each for each in os.listdir(data_dir)\n if each.endswith('.h5')])\n all_data = []\n for num_data in data:\n processed_data = os.path.join(data_dir, num_data)\n file = h5py.File(pr... | [
"0.688118",
"0.6788073",
"0.67306453",
"0.6660681",
"0.65742046",
"0.6569169",
"0.6488681",
"0.64012986",
"0.6394433",
"0.6307643",
"0.6307385",
"0.6297519",
"0.6297519",
"0.6287866",
"0.6264603",
"0.6255944",
"0.62483",
"0.6204587",
"0.6190885",
"0.61622494",
"0.6139135",
... | 0.81816053 | 0 |
stdev Takes in a list of column headers and the Data object and returns a list of the standard deviation for each specified column. Use the builtin numpy functions to execute this calculation. | def stdev(headers, data):
column_matrix=data.get_data(headers)
mean_values=column_matrix.std(0)
std_values=mean_values.tolist()
return std_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_std_dev(self, data):\n mean = 0\n data_arr = []\n for i in data:\n data_arr.append(i[1])\n return statistics.stdev(data_arr)",
"def column_stdev(column_values, mean):\n\n try:\n stdev = math.sqrt(\n sum([(mean-x)**2 for x in column_values]) / le... | [
"0.762345",
"0.76011705",
"0.7323709",
"0.71934015",
"0.715191",
"0.7065229",
"0.70174754",
"0.69014233",
"0.6891203",
"0.67621124",
"0.67020977",
"0.6664076",
"0.6664076",
"0.6625717",
"0.65968806",
"0.65932107",
"0.6561748",
"0.65059817",
"0.6488277",
"0.6485756",
"0.648408... | 0.855148 | 0 |
Takes in a list of column headers and the Data object and returns a matrix with each column normalized so its minimum value is mapped to zero and its maximum value is mapped to 1. | def normalize_columns_separately(headers, data):
column_matrix=data.get_data(headers)
column_max=column_matrix.max(1)
column_min=column_matrix.min(1)
range=column_max-column_min
nomalized=(column_matrix-column_min)/range
return nomalized | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_columns_together(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tmax=column_matrix.max()\n\tprint \"The maximum:\t \", max\n\tmin=column_matrix.min()\n\tprint \"The minimum:\t \", min\n\trange=max-min\n\tprint \"range: \", range\n\tcolumn_matrix=column_matrix-min\n\tnormalized=column_matri... | [
"0.7496443",
"0.66081625",
"0.65859145",
"0.6499091",
"0.6407396",
"0.6192507",
"0.6134639",
"0.60927606",
"0.6090253",
"0.60883844",
"0.6063456",
"0.60361797",
"0.59998703",
"0.59998703",
"0.59897834",
"0.5978918",
"0.5962571",
"0.5955856",
"0.5939429",
"0.59259486",
"0.5905... | 0.708409 | 1 |
Takes in a list of column headers and the Data object and returns a matrix with each entry normalized so that the minimum value (of all the data in this set of columns) is mapped to zero and its maximum value is mapped to 1. | def normalize_columns_together(headers, data):
column_matrix=data.get_data(headers)
max=column_matrix.max()
print "The maximum: ", max
min=column_matrix.min()
print "The minimum: ", min
range=max-min
print "range: ", range
column_matrix=column_matrix-min
normalized=column_matrix/range
return normalized | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_columns_separately(headers, data):\n\tcolumn_matrix=data.get_data(headers)\n\tcolumn_max=column_matrix.max(1)\n\tcolumn_min=column_matrix.min(1)\n\trange=column_max-column_min\n\tnomalized=(column_matrix-column_min)/range\n\treturn nomalized",
"def normalize(data):\n # normalize data and return\... | [
"0.6924816",
"0.6368028",
"0.634722",
"0.6282522",
"0.62384415",
"0.6170771",
"0.5904337",
"0.5867747",
"0.58657235",
"0.585182",
"0.5851378",
"0.58379954",
"0.5837087",
"0.5817979",
"0.57913613",
"0.5751155",
"0.5751155",
"0.5748093",
"0.57406265",
"0.5719488",
"0.5708877",
... | 0.73747426 | 0 |
Return the numeric matrices with sorted columns | def sort(headers, data): # extension
column_matrix=data.get_data(headers) # get raw matrix data for numeric values
print "\n before sorting \n "
print column_matrix
column_matrix=column_matrix.tolist()
column_array=np.asarray(column_matrix)
column_array.sort(axis=0)
print "\n \n done sorting here is your m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_for_sorting():\n return RaggedArray([[1, 0], [2, 0], [0, 0]])",
"def _sort_rows(matrix, num_rows):\n tmatrix = array_ops.transpose(matrix, [1, 0])\n sorted_tmatrix = nn_ops.top_k(tmatrix, num_rows)[0]\n return array_ops.transpose(sorted_tmatrix, [1, 0])",
"def Msort(index, arr1, arr2, matrix):\n... | [
"0.6472477",
"0.6157688",
"0.60989267",
"0.6080551",
"0.5776652",
"0.5737888",
"0.56588423",
"0.56309026",
"0.556288",
"0.5534623",
"0.551707",
"0.5514763",
"0.55020404",
"0.5490696",
"0.5472799",
"0.54618865",
"0.5438563",
"0.5436786",
"0.53938407",
"0.53862166",
"0.53718483... | 0.71695834 | 0 |
register_attr(attr, editor, clazz = None) Registers EDITOR as the editor for atrribute ATTR of class CLAZZ, or for any class if CLAZZ is None. EDITOR can be either a Tk widget subclass of editobj.editor.Editor, or None to hide the attribute. MRO is used in order to allow subclasses to use the editor registered for thei... | def register_attr(attr, editor, clazz = None):
for_attr = _attr_editors.get(attr)
if for_attr: for_attr[clazz] = editor
else: _attr_editors[attr] = { clazz : editor } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_children_attr(attr, insert = \"insert\", del_ = \"__delitem__\", clazz = None):\n \n if clazz: _children_attrs[clazz] = (attr, insert, del_)\n else: _children_attrs[None].append((attr, insert, del_))",
"def register_on_edit(func, clazz):\n \n _on_edit[clazz] = func",
"def addEditor(self, ... | [
"0.569334",
"0.52287275",
"0.4944205",
"0.4870793",
"0.477365",
"0.46567985",
"0.46526116",
"0.46501258",
"0.4630243",
"0.4627526",
"0.45808572",
"0.45672143",
"0.4548827",
"0.45476916",
"0.45291042",
"0.4518718",
"0.44888854",
"0.4439509",
"0.4431176",
"0.4427259",
"0.442450... | 0.837206 | 0 |
register_children_attr(attr, insert = "insert", del_ = "__delitem__", clazz = None) Registers ATTR as an attribute that can act as the "content" or the "children" of an object of class CLAZZ (or any class if None). If ATTR is None, the object is used as its own list of children (automatically done for list / dict subcl... | def register_children_attr(attr, insert = "insert", del_ = "__delitem__", clazz = None):
if clazz: _children_attrs[clazz] = (attr, insert, del_)
else: _children_attrs[None].append((attr, insert, del_)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_children(self, children: dict) -> None:\n for child in children:\n self.children[child.move] = child",
"def register_attr(attr, editor, clazz = None):\n \n for_attr = _attr_editors.get(attr)\n if for_attr: for_attr[clazz] = editor\n else: _attr_editors[attr] = { clazz : edito... | [
"0.5429349",
"0.54085225",
"0.53786886",
"0.53273",
"0.51638204",
"0.5120558",
"0.5015715",
"0.50146097",
"0.50063944",
"0.49629942",
"0.48599657",
"0.48443073",
"0.48174873",
"0.47865376",
"0.47392642",
"0.47035292",
"0.47018874",
"0.46887925",
"0.46817335",
"0.4680879",
"0.... | 0.8719397 | 0 |
register_method(method, clazz, args_editor) Registers METHOD as a method that must be displayed in EditObj for instance of CLAZZ. METHOD can be either a method name (a string), or a function (in this case, it is not a method, strictly speaking). ARGS_EDITOR are the editors used for entering the argument, e.g. use edito... | def register_method(method, clazz, *args_editor):
methods = _methods.get(clazz)
if methods: methods.append((method, args_editor))
else: _methods[clazz] = [(method, args_editor)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_method(cls: type) -> Callable:\n\n def decorator(func):\n func.enable = lambda: _method_enable(\n cls, [_plugin_funcname(func)], func\n )\n func.disable = lambda: _method_disable(\n cls, [_plugin_funcname(func)], func\n )\n return func\n\n ret... | [
"0.5905217",
"0.58517236",
"0.5786096",
"0.5741496",
"0.57013345",
"0.561656",
"0.5559318",
"0.55209756",
"0.5503904",
"0.54889995",
"0.53730494",
"0.5337263",
"0.5303383",
"0.5225363",
"0.5225363",
"0.52207655",
"0.5208166",
"0.51892644",
"0.5186976",
"0.5176117",
"0.5170982... | 0.78775865 | 0 |
register_available_children(children_codes, clazz) Register the CHILDREN_CODES that are proposed for addition in an instance of CLAZZ. If CHILDREN_CODES is a list of strings (Python code), EditObj will display a dialog box. If CHILDREN_CODES is a single string, no dialog box will be displayed, and this code will automa... | def register_available_children(children_codes, clazz):
if isinstance(children_codes, list):
try: _available_children[clazz].extend(children_codes)
except: _available_children[clazz] = children_codes
else:
_available_children[clazz] = children_codes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_children(self, *args):\r\n self.children.extend(args)\r\n return self",
"def add_children(self, *args):\r\n self._children.extend(args)\r\n return self",
"def addChildren(self, values):\r\n for i, value in enumerate(values):\r\n newScope = copy(self.scope)\... | [
"0.5452896",
"0.53605896",
"0.5334651",
"0.5284387",
"0.52782434",
"0.5211498",
"0.5191764",
"0.5082743",
"0.50570357",
"0.5024224",
"0.49518868",
"0.49307147",
"0.49156395",
"0.4906171",
"0.48993438",
"0.48965266",
"0.4896071",
"0.48945415",
"0.48457983",
"0.4797419",
"0.479... | 0.79036367 | 0 |
register_values(attr, code_expressions) Registers CODE_EXPRESSIONS as a proposed value for ATTR. | def register_values(attr, code_expressions):
code_expressions = map(unicodify, code_expressions)
try: _values[attr].extend(code_expressions)
except KeyError: _values[attr] = list(code_expressions) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_reg_expressions(self, expressions_update: Dict[str, Any]) -> None:\n expressions = self.base_expressions.copy()\n expressions.update(expressions_update)\n self.reg_expressions = expressions",
"def RegisterValues():\n return get_float64_array(lib.Generators_Get_RegisterValues)",... | [
"0.48745957",
"0.4734857",
"0.46250662",
"0.46225697",
"0.4597566",
"0.45449904",
"0.45448384",
"0.4482638",
"0.44240987",
"0.44201872",
"0.4374772",
"0.4365421",
"0.43483615",
"0.43303338",
"0.43257523",
"0.43160722",
"0.42835793",
"0.42812833",
"0.427737",
"0.42618823",
"0.... | 0.85605466 | 0 |
register_on_edit(func, clazz) Register FUNC as an "on_edit" event for CLAZZ. When an instance of CLAZZ is edited, FUNC is called with the instance and the editor Tkinter window as arguments. | def register_on_edit(func, clazz):
_on_edit[clazz] = func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addEdit( self, cCtrlName, nPositionX, nPositionY, nWidth, nHeight,\n cText=None,\n textListenerProc=None,\n cReadOnly=None,\n cMultiline=None,\n cAutoVScroll=None):\n self.addControl( \"com... | [
"0.5836717",
"0.57678133",
"0.5657995",
"0.5506038",
"0.5439217",
"0.5395581",
"0.53424084",
"0.53140134",
"0.51880944",
"0.51332206",
"0.5114195",
"0.51119095",
"0.509349",
"0.50865626",
"0.5086496",
"0.50285983",
"0.50238705",
"0.5020771",
"0.49626553",
"0.4934645",
"0.4925... | 0.8712736 | 0 |
register_on_children_visible(func, clazz) Register FUNC as an "on_children_visible" event for CLAZZ. When the children of an instance of CLAZZ are shown or hidden, FUNC is called with the instance and the new visibility status (0 or 1) as arguments. | def register_on_children_visible(func, clazz):
_on_children_visible[clazz] = func | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visible(self, show):",
"def register_available_children(children_codes, clazz):\n \n if isinstance(children_codes, list):\n try: _available_children[clazz].extend(children_codes)\n except: _available_children[clazz] = children_codes\n else:\n _available_children[clazz] = children_codes",
"de... | [
"0.5089612",
"0.50880736",
"0.5036541",
"0.5036325",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.4887222",
"0.48733646",
"0.48165864",
"0.47937766",
"0.47393054",
"0.47151053",
"0.4670040... | 0.8832136 | 0 |
This method uses to check if the food name in our database or not. name It is the name of the food from the users. true if food in databases, false othewise | def findFood(self,name):
name = name.lower()
return dictfood.has_key(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __contains__(self, user_name):\n tuples = self._execute(\n \"SELECT name FROM users WHERE name == ?\",\n (user_name,)\n )\n return len(tuples) == 1",
"def player_exists_in_db(name: str):\n with open('db.json') as fo:\n data = loads(fo.read())\n return n... | [
"0.65653473",
"0.63060015",
"0.6292949",
"0.62000495",
"0.6126626",
"0.6053125",
"0.6008738",
"0.5959989",
"0.59151655",
"0.5908109",
"0.58882326",
"0.58628136",
"0.58392847",
"0.5811589",
"0.58058965",
"0.5798567",
"0.57955873",
"0.57936364",
"0.5790114",
"0.5773204",
"0.577... | 0.73230463 | 0 |
IFieldWidget factory for LocationWidget. | def LocationFieldWidget(field, request):
return FieldWidget(field, LocationWidget(request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n self.fields = [ \n \n #plugins.FieldWidget(\"widget\", descr=\"Start from widget\",\n # default=\"/\"),\n #plugins.FieldMarker(\"markersearch\", descr=\"Search for marker\"),\n #plugins.FieldMarker(\"markerreplac... | [
"0.5998817",
"0.5998817",
"0.58848",
"0.5651634",
"0.56191385",
"0.56007206",
"0.5575786",
"0.53905076",
"0.5337973",
"0.5329842",
"0.5285621",
"0.52263105",
"0.52263105",
"0.5196118",
"0.51863796",
"0.5159046",
"0.5151313",
"0.5149169",
"0.5144681",
"0.5127543",
"0.5118616",... | 0.8268078 | 0 |
Save files like the dataset, mask and settings as pickle files so they can be loaded in the ``Aggregator`` | def save_attributes_for_aggregator(self, paths):
# These functions save the objects we will later access using the aggregator. They are saved via the `pickle`
# module in Python, which serializes the data on to the hard-disk.
with open(f"{paths.pickle_path}/dataset.pickle", "wb") as f:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickle_data(self):\n if 'data_sets.pckl' in self.expected_pickles:\n to_file(\n self.data_sets,\n os.path.join(self.logdir, 'data_sets.pckl')\n )\n if 'all_params.pckl' in self.expected_pickles:\n to_file(\n self.all_pa... | [
"0.71841556",
"0.7051201",
"0.6999294",
"0.69657177",
"0.6965532",
"0.67290497",
"0.6701712",
"0.67006266",
"0.66806704",
"0.6629543",
"0.662331",
"0.66160923",
"0.6615659",
"0.66139543",
"0.659722",
"0.65589774",
"0.65515673",
"0.65493506",
"0.6524547",
"0.64821887",
"0.6479... | 0.7810631 | 0 |
Registers new managers with the component manager. Managers are configured and setup before components. | def add_managers(self, managers: Union[List[Any], Tuple[Any]]):
for m in self._flatten(managers):
self.apply_configuration_defaults(m)
self._managers.add(m) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_manager(self) -> None:\n\n #Clean out the process list.\n self.process_list.clear()\n for _ in range(self.num_processes):\n p = Process(target=self.multiprocessing_job,\n args=(self.process_job,))\n self.process_list.append(p)\n sel... | [
"0.61248213",
"0.60335684",
"0.6032508",
"0.5993886",
"0.59699",
"0.58547497",
"0.5809432",
"0.56251633",
"0.56170464",
"0.56035906",
"0.55961794",
"0.5585247",
"0.5480994",
"0.54456997",
"0.53996974",
"0.53993297",
"0.53955936",
"0.5385212",
"0.5380328",
"0.5357524",
"0.5357... | 0.74649 | 0 |
Get all components that are an instance of ``component_type``. | def get_components_by_type(
self, component_type: Union[type, Tuple[type, ...]]
) -> List[Any]:
return [c for c in self._components if isinstance(c, component_type)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_components_by_type(\n self, component_type: Union[type, Tuple[type, ...]]\n ) -> List[Any]:\n return self._manager.get_components_by_type(component_type)",
"def get_components(self, filter_type=None):\n\n if filter_type is None:\n out = self.components\n elif isi... | [
"0.8547184",
"0.6889929",
"0.61937904",
"0.6006221",
"0.59004545",
"0.5866749",
"0.5784385",
"0.57724464",
"0.57717794",
"0.5745258",
"0.57174027",
"0.5656232",
"0.5640331",
"0.5635853",
"0.5634207",
"0.5617102",
"0.5617102",
"0.5615041",
"0.5579383",
"0.5579383",
"0.5561703"... | 0.8519839 | 1 |
Get the component with name ``name``. Names are guaranteed to be unique. | def get_component(self, name: str) -> Any:
for c in self._components:
if c.name == name:
return c
raise ValueError(f"No component found with name {name}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_component(self, name):\n for cmpt in self.components:\n if cmpt['name'] == name:\n return cmpt",
"def get_component(self, name: str) -> Any:\n return self._manager.get_component(name)",
"def get(name):\r\n return componentManager.components[name]",
"def comp... | [
"0.8581954",
"0.8132362",
"0.8047409",
"0.75000876",
"0.6909813",
"0.67308456",
"0.65872496",
"0.6536908",
"0.6505384",
"0.6497451",
"0.64877367",
"0.64358634",
"0.64024574",
"0.63259006",
"0.62867415",
"0.62573177",
"0.6255165",
"0.62408423",
"0.62342554",
"0.6208173",
"0.62... | 0.8775755 | 0 |
Get a mapping of component names to components held by the manager. Returns Dict[str, Any] A mapping of component names to components. | def list_components(self) -> Dict[str, Any]:
return {c.name: c for c in self._components} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_components(self) -> Dict[str, Any]:\n return self._manager.list_components()",
"def _getComponentsInfo(self):\n result = {}\n et = ElementTree()\n components = self.agentCompleteConfig.listComponents_() + \\\n self.agentCompleteConfig.listWebapps_()\n ... | [
"0.75031936",
"0.7189879",
"0.67731893",
"0.6669654",
"0.6528711",
"0.6451407",
"0.6451407",
"0.6361447",
"0.6353952",
"0.6353952",
"0.6349827",
"0.63444376",
"0.62123674",
"0.6171588",
"0.6085922",
"0.60758775",
"0.6042098",
"0.60234123",
"0.60161865",
"0.59968275",
"0.59941... | 0.7947298 | 0 |
Separately configure and set up the managers and components held by the component manager, in that order. The setup process involves applying default configurations and then calling the manager or component's setup method. This can result in new components as a side effect of setup because components themselves have ac... | def setup_components(self, builder: "Builder"):
self._setup_components(builder, self._managers + self._components) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_component(self):\n self.conf, self.context = self._init_component()\n self.initialize()",
"def setup(self, manager):\n self._manager = manager\n self._configured = True",
"def _configure(self):\n pass",
"def _configure(self):\n Component._configure(self)\n s... | [
"0.7187612",
"0.6177336",
"0.6071428",
"0.60488313",
"0.60485494",
"0.60239357",
"0.59740335",
"0.5972695",
"0.59304833",
"0.5877998",
"0.5877998",
"0.5877998",
"0.5877998",
"0.5877996",
"0.5876117",
"0.5864202",
"0.582577",
"0.582577",
"0.57516897",
"0.57322896",
"0.5726736"... | 0.7832467 | 0 |
Get all components that are an instance of ``component_type``. | def get_components_by_type(
self, component_type: Union[type, Tuple[type, ...]]
) -> List[Any]:
return self._manager.get_components_by_type(component_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_components_by_type(\n self, component_type: Union[type, Tuple[type, ...]]\n ) -> List[Any]:\n return [c for c in self._components if isinstance(c, component_type)]",
"def get_components(self, filter_type=None):\n\n if filter_type is None:\n out = self.components\n ... | [
"0.8520174",
"0.6889397",
"0.618709",
"0.59998345",
"0.5893793",
"0.58591384",
"0.57775843",
"0.5769797",
"0.5767334",
"0.5746458",
"0.57118094",
"0.56562984",
"0.56372815",
"0.5633266",
"0.5631094",
"0.56097656",
"0.56097656",
"0.5608077",
"0.5572066",
"0.5572066",
"0.556140... | 0.8547882 | 0 |
Get a mapping of component names to components held by the manager. Returns Dict[str, Any] A dictionary mapping component names to components. | def list_components(self) -> Dict[str, Any]:
return self._manager.list_components() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_components(self) -> Dict[str, Any]:\n return {c.name: c for c in self._components}",
"def _getComponentsInfo(self):\n result = {}\n et = ElementTree()\n components = self.agentCompleteConfig.listComponents_() + \\\n self.agentCompleteConfig.listWebapps_()\... | [
"0.79906577",
"0.7245051",
"0.6733757",
"0.66009647",
"0.6538484",
"0.63692576",
"0.63692576",
"0.6338896",
"0.6323031",
"0.63061506",
"0.6275394",
"0.626935",
"0.626935",
"0.6257535",
"0.60413235",
"0.60004747",
"0.5986872",
"0.5979982",
"0.5975458",
"0.59395707",
"0.5929724... | 0.747328 | 1 |
\ creates gaussian kernel with side length l and a sigma of sig | def gkern(l=5, sig=1.):
ax = np.linspace(-(l - 1) / 2., (l - 1) / 2., l)
xx, yy = np.meshgrid(ax, ax)
kernel = np.exp(-0.5 * (np.square(xx) + np.square(yy)) / np.square(sig))
return kernel | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gkern(l=5, sig=1.):\n\n ax = np.arange(-l // 2 + 1., l // 2 + 1.)\n xx, yy = np.meshgrid(ax, ax)\n\n kernel = np.exp(-(xx**2 + yy**2) / (2. * sig**2))\n\n return kernel / np.sum(kernel)",
"def gkern(l, sig=1.):\n\n ax = np.linspace(-(l - 1) / 2., (l - 1) / 2., l)\n xx, yy = np.meshgrid(ax, ... | [
"0.7510109",
"0.750365",
"0.74863845",
"0.7277165",
"0.7234427",
"0.7157976",
"0.7145621",
"0.7110056",
"0.7061145",
"0.70183206",
"0.69730043",
"0.69548696",
"0.6933574",
"0.6907124",
"0.6884259",
"0.6877862",
"0.6862947",
"0.68579936",
"0.6832131",
"0.6814453",
"0.67858434"... | 0.76391137 | 0 |
Computes the histogram of the input image | def compute_histogram(self, image):
hist = [0] * 256
x, y = image.shape[:2]
#print(image.shape)
for i in range(x):
for j in range(y):
hist[image[i, j]] += 1
return hist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hist(img):\n bottom_half = img[img.shape[0]//2:,:] # 0:img.shape[0]//2 is the top half\n histogram = bottom_half.sum(axis=0) \n \n return histogram",
"def compute_histogram(self, image):\n hist = [0] * 256\n [h, w] = image.shape\n print(h,w)\n i = 0\n while i < ... | [
"0.8064423",
"0.8042533",
"0.8037536",
"0.7930632",
"0.76470864",
"0.7604351",
"0.75007343",
"0.73157203",
"0.7244618",
"0.71898323",
"0.7063043",
"0.6988698",
"0.69718844",
"0.69492954",
"0.6931104",
"0.6850683",
"0.6834464",
"0.6798194",
"0.6795921",
"0.6792963",
"0.6772005... | 0.82736444 | 0 |
Comptues the binary image of the the input image based on histogram analysis and thresholding take as input | def binarize(self, image, threshold):
bin_img = image.copy()
for i in range(image.shape[0]):
for j in range(image.shape[1]):
if image[i, j] >= threshold:
bin_img[i, j] = 0
else:
bin_img[i, j] = 255
return bin_img | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def binarize(self, image, threshold):\n\n bin_img = image.copy()\n [h, w] = bin_img.shape\n opt_threshold = threshold\n print(opt_threshold)\n for row in range(h):\n for col in range(w):\n if bin_img[row, col] > opt_threshold: #greater than threshld whit... | [
"0.7681446",
"0.727308",
"0.7155279",
"0.70369035",
"0.6960089",
"0.6878597",
"0.6873943",
"0.6869752",
"0.6862886",
"0.68430334",
"0.68059856",
"0.67681766",
"0.67679167",
"0.6710474",
"0.66879267",
"0.6674513",
"0.66720676",
"0.666158",
"0.6618548",
"0.6603418",
"0.6565325"... | 0.73140323 | 1 |
Append new animation. If \p _widget exists in animations, then it target will be changed | def _addLinearAnimation(self, _widget, _target):
self._linear_animations[_widget] = _target | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _addPulseAnimation(self, _widget, _target):\n self._pulse_animations[_widget] = _target",
"def add_animation(self, animation, key):\n\t\tif animation.from_value == animation.to_value:\n\t\t\treturn\n\t\tanimation.attribute = key\n\t\tanimation.layer = self\n\t\tself.animations[key] = animation",
"de... | [
"0.7235232",
"0.640118",
"0.60980463",
"0.5986769",
"0.5909382",
"0.57442415",
"0.5643073",
"0.5543253",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5395823",
"0.5262023",
"0.52438366",
... | 0.7617919 | 0 |
Append new animation. If \p _widget exists in animations, then it target will be changed | def _addPulseAnimation(self, _widget, _target):
self._pulse_animations[_widget] = _target | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _addLinearAnimation(self, _widget, _target):\n self._linear_animations[_widget] = _target",
"def add_animation(self, animation, key):\n\t\tif animation.from_value == animation.to_value:\n\t\t\treturn\n\t\tanimation.attribute = key\n\t\tanimation.layer = self\n\t\tself.animations[key] = animation",
"... | [
"0.7618043",
"0.640304",
"0.60984266",
"0.5988012",
"0.591077",
"0.5744295",
"0.5644169",
"0.5541437",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.53966963",
"0.526167",
"0.5243... | 0.7234984 | 1 |
Updates input icons relative to mouse state | def _updateOnMouseState(self, state):
x = state.X.abs
y = state.Y.abs
mscale = self.mouse_icon.getScale()
if (x + mscale[0] + self.mouse_offset) > render_engine.Window.width:
x = x - mscale[0] - 10
else:
x += self.mouse_offset
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.mousePos = pygame.mouse.get_pos()\n self.update_button_hover_status()",
"def update_button_hover_status(self):\n for button in self.playing_buttons:\n button.update(self.mousePos)",
"def update_reset_button(self):\r\n if self.board.hovered_tiles a... | [
"0.63612306",
"0.6020158",
"0.5917613",
"0.5873303",
"0.5816151",
"0.5782121",
"0.57058483",
"0.5668941",
"0.56663585",
"0.56530684",
"0.5630077",
"0.55906516",
"0.5553169",
"0.5495981",
"0.54906726",
"0.5464941",
"0.5448922",
"0.54335225",
"0.5425156",
"0.54172546",
"0.53634... | 0.6588073 | 0 |
This funtion should perform the job of projecting the input pointcloud onto the frame of an image captured by a camera with camera matrix as given, of dimensions as given, in pixels. points is an 3 x N array where the ith entry is an (x, y, z) point in 3D space, in the reference frame of the depth camera. This correspo... | def project_points(points, cam_matrix, trans, rot):
# STEP 1: Transform pointcloud into new reference frame.
points = np.dot(rot, points) + trans[:, None]
# STEP 2: Project new pointcloud onto image frame using K matrix.
# gives a 3 x N array of image plane coordinates in homogenous coordinates.
h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project(points, camera_params, theta):\n \"\"\"\n Function takes input of 3d_points, transformations and Convert 3-D points to 2-D by projecting onto images. \n Input:\n points: 3D points in world frame\n camera_params: parameters of camera corrosponding to the point\n theta: Need... | [
"0.75861025",
"0.73979294",
"0.73724365",
"0.70940655",
"0.7059192",
"0.7011868",
"0.69861317",
"0.6886492",
"0.685968",
"0.6813133",
"0.6795302",
"0.6780843",
"0.6771063",
"0.676563",
"0.6705942",
"0.66217476",
"0.65333843",
"0.6509686",
"0.64969933",
"0.6453741",
"0.6448303... | 0.7957179 | 0 |
Attempts to purchase all goods listed in the dict order, depositing them in the Player's cargo holds. Does not care about max cargo. dryRun simply checks if the purchase is possible. remaining controls if the order should be 100% purchased (True), or only purchase goods the player lacks Returns False if some goods are ... | def buyCargo(self, order, dryRun=False, remaining=True):
ply = self.window.playerShip
shop = self.planet.goods
toBuy = order.copy()
for mat in toBuy:
if remaining and mat in ply.cargo:
toBuy[mat] -= ply.cargo[mat].quantity
if toBuy[mat] > 0:
if mat not in shop: return False
if shop[mat]*toBuy[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete_purchase(self, customer_credit=0):\r\n \r\n #take the products first, then tell customer how many tickets to take\r\n #requires IChat interface to be passed to tell customers how many tickets to take\r\n \r\n #switch to list view in the collection window\r\n print... | [
"0.5479375",
"0.53681403",
"0.5336852",
"0.5133763",
"0.51209956",
"0.50936574",
"0.5068974",
"0.5063557",
"0.4996775",
"0.4974593",
"0.49507624",
"0.494863",
"0.4935163",
"0.49151012",
"0.49076858",
"0.4898226",
"0.4866557",
"0.48556313",
"0.48369843",
"0.48305112",
"0.48296... | 0.70759 | 0 |
Initialize with a QPrinter object and a list of pages. pageList may be a list of twotuples (num, page). Otherwise, the pages are numbered from 1 in the progress message. The pages are copied. | def __init__(self, printer, pageList, parent=None):
super().__init__(parent)
self.printer = printer
self.setPageList(pageList) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPageList(self, pageList):\n self.pageList = []\n for n, page in enumerate(pageList, 1):\n if isinstance(page, tuple):\n pageNum, page = page\n else:\n pageNum = n\n page = page.copy()\n # set zoom to 1.0 so computations ... | [
"0.6433763",
"0.6421175",
"0.5657116",
"0.5523885",
"0.5351193",
"0.5295668",
"0.52508706",
"0.52336335",
"0.5163632",
"0.5067127",
"0.5064911",
"0.50349927",
"0.500849",
"0.49356413",
"0.4856026",
"0.4848449",
"0.48073077",
"0.48051938",
"0.48050612",
"0.48048058",
"0.479167... | 0.7309939 | 0 |
Set the pagelist to print. pageList may be a list of twotuples (num, page). Otherwise, the pages are numbered from 1 in the progress message. The pages are copied. | def setPageList(self, pageList):
self.pageList = []
for n, page in enumerate(pageList, 1):
if isinstance(page, tuple):
pageNum, page = page
else:
pageNum = n
page = page.copy()
# set zoom to 1.0 so computations based on geom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setPageSequence(self, pageSequenceList):\r\n\r\n for index in range(self.pageCount() - 1, -1, -1):\r\n page = self.page(index)\r\n if page:\r\n self.removePage(page)\r\n\r\n count = 0\r\n for pageTitle in pageSequenceList:\r\n self.insertPage... | [
"0.661028",
"0.64478004",
"0.5916455",
"0.56009513",
"0.5516022",
"0.5461271",
"0.54369324",
"0.52646035",
"0.5221855",
"0.51948494",
"0.51564723",
"0.5154594",
"0.503851",
"0.5032567",
"0.49833974",
"0.49527058",
"0.4946429",
"0.49033383",
"0.49002624",
"0.49002624",
"0.4896... | 0.7608234 | 0 |
Paint the pages to the printer in the background. | def work(self):
p = self.printer
p.setFullPage(True)
painter = QPainter(p)
for n, (num, page) in enumerate(self.pageList):
if self.isInterruptionRequested():
self.aborted = True
return p.abort()
self.progress.emit(num, n+1, len(self... | {
"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.6472516",
"0.6322351",
"0.6206114",
"0.61876047",
"0.61129534",
"0.6107652",
"0.60719824",
"0.60593873",
"0.59743327",
"0.59252787",
"0.5870063",
"0.58362466",
"0.5776248",
"0.57747906",
"0.575061",
"0.5728778",
"0.5693118",
"0.5666412",
"0.5624035",
"0.56164974",
"0.55977... | 0.718377 | 0 |
Initializes ourselves with the print job and optional parent widget. | def __init__(self, job, parent=None):
super().__init__(parent)
self._job = job
job.progress.connect(self.showProgress)
job.finished.connect(self.jobFinished)
self.canceled.connect(job.requestInterruption)
self.setMinimumDuration(0)
self.setRange(0, len(job.pageLis... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, printer, parent=None):\n QtGui.QWidget.__init__(self, printer, parent)",
"def __init__(self, printer, pageList, parent=None):\n super().__init__(parent)\n self.printer = printer\n self.setPageList(pageList)",
"def __init__(self, job):\n self.job = job\n\n ... | [
"0.7487978",
"0.67818165",
"0.67569965",
"0.64124125",
"0.6201404",
"0.6139698",
"0.5940359",
"0.5934324",
"0.59159744",
"0.5873766",
"0.5867913",
"0.58311474",
"0.58015513",
"0.5784232",
"0.5742336",
"0.57028717",
"0.57011944",
"0.5694068",
"0.5670847",
"0.56562907",
"0.5598... | 0.7860893 | 0 |
This method will enable delivery confirmations and schedule the first message to be sent to RabbitMQ | def start_publishing(self):
print(f"{self._connection_param}: Issuing consumer related RPC commands")
# self._channel.confirm_delivery(self.on_delivery_confirmation)
self.schedule_next_message(self.SLOW_SEND) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_for_delivery(self, by=None):",
"def prepare_for_delivery(self, by=None):",
"def prepare_for_delivery(self, by=None):",
"def keystone_amq(self):\n\n connection = pika.BlockingConnection(pika.ConnectionParameters(\n host=self.rabbit_host,\n ... | [
"0.6132878",
"0.6132878",
"0.6132878",
"0.6066696",
"0.6043291",
"0.59991413",
"0.59169674",
"0.58299065",
"0.5776203",
"0.5776203",
"0.5776203",
"0.5642102",
"0.56042206",
"0.55661607",
"0.55595404",
"0.5532968",
"0.5508831",
"0.5474107",
"0.5426646",
"0.54043806",
"0.540246... | 0.631214 | 0 |
r""" Computes the chisquare value of the sample data Notes | def _chisquare_value(self):
x2 = np.sum((np.absolute(self.observed - self.expected) - (0.5 * self.continuity_correction)) ** 2 /
self.expected)
return x2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute(real_data, synthetic_data):\n f_obs, f_exp = get_frequencies(real_data, synthetic_data)\n if len(f_obs) == len(f_exp) == 1:\n pvalue = 1.0\n else:\n _, pvalue = chisquare(f_obs, f_exp)\n\n return pvalue",
"def calculate_chi_squared(self):\n chi... | [
"0.6880414",
"0.6825153",
"0.65589476",
"0.63346523",
"0.61934537",
"0.6188989",
"0.61722326",
"0.61393964",
"0.6095299",
"0.6072217",
"0.6061504",
"0.60480016",
"0.6028417",
"0.600268",
"0.59922135",
"0.5937898",
"0.59304774",
"0.59027916",
"0.588849",
"0.5888303",
"0.588665... | 0.760204 | 0 |
r""" Finds the pvalue of the chisquare statistic. Notes | def _p_value(self):
pval = chi2.sf(self.chi_square, self.degrees_of_freedom)
return pval | {
"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 _p_value(self):\n p_value = chi2.sf(self.test_statistic, 2)\n\n return p_value",
"def compute(r... | [
"0.7833191",
"0.7402887",
"0.71125257",
"0.6845936",
"0.6587544",
"0.64726514",
"0.64485335",
"0.6297365",
"0.6246761",
"0.61838526",
"0.61333144",
"0.60871804",
"0.60848254",
"0.60680485",
"0.6063416",
"0.60562605",
"0.59842485",
"0.59655535",
"0.59315586",
"0.59314376",
"0.... | 0.752004 | 1 |
BibTeX comment explaining error | def bibtex(self):
return "@comment{%(id)s: %(message)s}" % \
{'id': self.id, 'message': self.message} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment():",
"def test_doc_with_comments():\n doc = CoNLL.conll2doc(input_str=RUSSIAN_SAMPLE)\n check_russian_doc(doc)",
"def comment(self, content):\n pass",
"def should_add_pr_comment(self):\n pass",
"def test_issue_edit_comment_deprecated(self):\n pass",
"def docstri... | [
"0.74034363",
"0.6712097",
"0.66532767",
"0.63367194",
"0.619787",
"0.61909366",
"0.60946673",
"0.60149664",
"0.59592676",
"0.58991164",
"0.5883395",
"0.58689094",
"0.5825342",
"0.58130735",
"0.5804278",
"0.57896906",
"0.57857484",
"0.5733003",
"0.57277036",
"0.57164663",
"0.... | 0.6803446 | 1 |
Corrects the BibTeX key because the MR API cannot get its act together | def correct_key(goodkey,code):
db = pybtex.database.parse_string(code,"bibtex")
keys = [key for key in db.entries.keys()]
badkey = keys[0]
return code.replace(badkey,goodkey) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mr_request(key):\n\n # reconstructing the BibTeX code block\n inCodeBlock = False\n code = \"\"\n\n # make the request\n payload = {\"fn\": 130, \"fmt\": \"bibtex\", \"pg1\": \"MR\", \"s1\": key}\n r = requests.get(path, params=payload)\n\n # 401 means not authenticated\n if r.status_code == 401:\n ... | [
"0.61262125",
"0.60784906",
"0.58044267",
"0.5669483",
"0.5512459",
"0.549996",
"0.546403",
"0.5428998",
"0.54042065",
"0.5403589",
"0.53428215",
"0.52821094",
"0.52698106",
"0.52677447",
"0.52602893",
"0.52487",
"0.5242598",
"0.52408123",
"0.5232014",
"0.51742405",
"0.515405... | 0.71422005 | 0 |
Fetches citations for keys in key_list into a dictionary indexed by key | def mr2bib_dict(key_list):
keys = []
d = {}
# validate keys
for key in key_list:
if is_valid(key):
keys.append(key)
else:
d[key] = ReferenceErrorInfo("Invalid Mathematical Reviews identifier", key)
if len(keys) == 0:
return d
# make the api call
entries = {}
for key in keys:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_citations_ids_map(id_list):\n create_unverified_context()\n logging.debug('============== IN get_citations_ids_map: ================')\n logging.debug('============== ID LIST: ================')\n logging.debug(id_list)\n linked = {}\n for i in range(0, len(id_list)):\n handle = En... | [
"0.63553035",
"0.6239225",
"0.6104354",
"0.6002555",
"0.58264047",
"0.5761537",
"0.5651292",
"0.5648888",
"0.5609229",
"0.5563336",
"0.5560674",
"0.5547645",
"0.55174834",
"0.5494095",
"0.5494074",
"0.5486462",
"0.5401576",
"0.53930855",
"0.5387903",
"0.53725374",
"0.53647405... | 0.62833595 | 1 |
Given the rates, add noise based on numreg | def add_white_noise(rates, numreg):
rtemp = rates.copy().getA()
sdrates = np.sqrt(rtemp * (1 - rtemp) / numreg) + 1e-10
noise = np.random.normal(0, sdrates)
rtemp += noise
return np.matrix(rtemp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def noise(self, freq: int, /) -> None:",
"def add_uniform_noise(rates, percent):\n raise 0 < percent < 1 or AssertionError\n rtemp = rates.copy().getA()\n noise = np.random.uniform(1 - percent, 1 + percent, np.shape(rtemp))\n rtemp = rtemp * noise\n return np.matrix(rtemp)",
"def add_noise(self,... | [
"0.68984324",
"0.6839585",
"0.67851245",
"0.6750113",
"0.66716886",
"0.66040987",
"0.64807314",
"0.63987464",
"0.6348617",
"0.6240534",
"0.62197",
"0.6102634",
"0.60901725",
"0.60885996",
"0.60824186",
"0.6081778",
"0.6057069",
"0.6057069",
"0.6010699",
"0.6005882",
"0.600388... | 0.8146284 | 0 |
Given the rates, sample new rate uniformly between ((1percent)rates, (1+percent)rates) | def add_uniform_noise(rates, percent):
raise 0 < percent < 1 or AssertionError
rtemp = rates.copy().getA()
noise = np.random.uniform(1 - percent, 1 + percent, np.shape(rtemp))
rtemp = rtemp * noise
return np.matrix(rtemp) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_rate(self):\r\n interval = self.data.iloc[2, 0] - self.data.iloc[1, 0]\r\n self.rate = int(1 / interval)",
"def mutate(chrom, rate=100):\n for i in range(len(chrom)):\n chance = randint(0, 100)\n if chance <= rate:\n chrom[i] = randint(0, 13)\n return chrom",... | [
"0.6379363",
"0.6271895",
"0.6191277",
"0.61757326",
"0.615608",
"0.6149897",
"0.6067622",
"0.6067622",
"0.59839284",
"0.5963225",
"0.59294873",
"0.59209937",
"0.5910566",
"0.5888665",
"0.58422065",
"0.58108896",
"0.5792376",
"0.573272",
"0.57085705",
"0.5676844",
"0.5660222"... | 0.687847 | 0 |
This function runs the estimation procedure for the first time slice for given number of demes and repeats the process reps number of times. The values of mean pop size and mig rates is preset but will be changed in future versions. The third parameter here controls the noise amount in the estimates of coalescent inten... | def run_Over_Grid(numdemes = 2, reps = 10, numreg = 100, t = 1000):
Nmean = 2000
Nsd = 100
migMean = 0.0001
migsd = 1e-06
ndc2 = numdemes * (numdemes - 1) / 2
rows = ndc2 + numdemes + 1
I = np.matrix(np.eye(rows))
Ck = I[0:rows - 1, :]
Dk = I[rows - 1, :]
output = []
for r in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(\n self,\n repetitions,\n nChains=3,\n burnIn=100,\n thin=1,\n convergenceCriteria=0.8,\n variables_of_interest=None,\n DEpairs=2,\n adaptationRate=\"auto\",\n eps=5e-2,\n mConvergence=True,\n mAccept=True,\n ):\n\n ... | [
"0.5957784",
"0.59119064",
"0.5818777",
"0.57929796",
"0.5779033",
"0.57222825",
"0.5718269",
"0.566151",
"0.5655278",
"0.5591914",
"0.5582998",
"0.5532946",
"0.5525634",
"0.55158126",
"0.5478543",
"0.5461477",
"0.54515594",
"0.544741",
"0.5431594",
"0.54281795",
"0.5378584",... | 0.6416229 | 0 |
Given the true and the estimated parameter values this function computes the error in the parameter estimates. The order controls the norm used, by default its the maximum so sup norm | def compute_error(true, estimate, order = np.inf):
print true
print estimate
errs = []
for i in xrange(len(true)):
estError = abs(true[i] - estimate[i])
for j in xrange(len(true[i])):
if true[i][j] != 0:
estError[j] = estError[j] / true[i][j]
errs.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_error(self, params):\n return self.endog - self.predict(params)",
"def OF1_CalcErrorEstimation(param_list, args):\n #return (sum( \\\n #( OF1_SumOfGauss(param_list, classNum, g_lvls) - histogram ) ** 2) / g_lvls.size) + \\\n #(abs(sum(param_list[:classNum]) - 1) * o)\n return (... | [
"0.5976348",
"0.5961685",
"0.59206486",
"0.59203446",
"0.58393806",
"0.58081555",
"0.5629805",
"0.561695",
"0.5568433",
"0.55431527",
"0.5517937",
"0.5446575",
"0.54422283",
"0.5426394",
"0.54178244",
"0.54091245",
"0.54078066",
"0.53778136",
"0.5358041",
"0.53563577",
"0.531... | 0.6888212 | 0 |
This function processes the timestring from PSMC and converts this to list of time slice lengths | def process_time_string(timestr):
timestr = timestr.strip()
toks = timestr.split('+')
timeslices = []
for t in toks:
tm = t.strip()
mobj = re.search('\\*', tm)
if mobj == None:
timeslices += [int(tm)]
else:
tms = tm.split('*')
timeslice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_times(time_str):\n warnings = []\n days, interval = time_str.split(',')\n assert int(days) == float(days)\n days = int(days)\n assert int(interval) == float(interval)\n interval = int(interval)\n if interval < 3:\n warnings.append('Minimum interval is 3 hours')\n if days > ... | [
"0.60004324",
"0.5779885",
"0.56531847",
"0.5637275",
"0.5626897",
"0.5624664",
"0.55409265",
"0.5522083",
"0.54359984",
"0.5405842",
"0.53607774",
"0.5295241",
"0.5267315",
"0.526679",
"0.524625",
"0.52031076",
"0.5193402",
"0.5178458",
"0.5174391",
"0.5154917",
"0.51378095"... | 0.7197089 | 0 |
The coalescence matrix C as a vectorization of the upper triangular matrix and npop, the number of demes. | def mkCoalMatrix(C, npop):
C = np.array(C).flatten()
M = np.zeros((npop, npop))
cnt = 0
for i in range(npop):
for j in range(i, npop):
M[i, j] = C[cnt]
if i != j:
M[j, i] = M[i, j]
cnt += 1
return M | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_C(n_c,CV_matrix):\n C = np.zeros((n_c, n_c), dtype=np.float32)\n for i in range(3):\n C += np.asfortranarray(CV_matrix[:, :, i]) @ np.asfortranarray(CV_matrix[:, :, np.mod(i + 2, 3)].T)\n C = (C != 0).astype(np.int32)\n return C",
"def Cijkl(C):\n c = np.zeros(shape=(3, 3, 3, 3))\n ... | [
"0.69439816",
"0.65459836",
"0.6285086",
"0.6249481",
"0.6161368",
"0.6148797",
"0.6126897",
"0.61106193",
"0.60805976",
"0.60785055",
"0.60363877",
"0.5989471",
"0.59715444",
"0.59453815",
"0.5887798",
"0.58766955",
"0.5835838",
"0.57483953",
"0.57132053",
"0.56960946",
"0.5... | 0.73259985 | 0 |
The rates obtained from PSMC are the prob of coal in that timeslice, not the prob of coal in that timeslice AND not coalescing in any other timeslice. We need the conditional probability of coal in that timeslice given lines have not coalesced in any of the previous timeslices. This function converts the PSMC values in... | def modify_rates(self):
if self.modified:
print 'Already Modified Probabilities'
elif self.varGiven:
print 'You must enter the conditional coalescent probabilties if you want to supply variance of'
print 'the coalescent probabilities. Required since we cannot compute ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proba(c_pred,m_pred,f_pred, dataset):\n p = np.zeros(10)\n if dataset == 'cifar10':\n for i in range(10):\n if i <4:\n if i <2:\n p[i] = c_pred[0]*(m_pred[0]/(m_pred[0]+m_pred[1]))*(f_pred[i]/np.sum(f_pred[0:2]))\n elif i <4:\n ... | [
"0.5494266",
"0.543836",
"0.539172",
"0.5361028",
"0.5348872",
"0.53372526",
"0.53356594",
"0.53264946",
"0.5319149",
"0.5312941",
"0.52899146",
"0.5248596",
"0.5166682",
"0.51662475",
"0.5162503",
"0.5162355",
"0.5160059",
"0.51591235",
"0.51554865",
"0.51400554",
"0.5133518... | 0.5660929 | 0 |
This function collapses the time slices and the coalescent prbabilities using the time string | def collapse_using_timeStr(self):
if self.modified == True:
raise Exception('Probabilities already modified.\nCollapsing after modification will lead to incorrect results.')
timeUnits = np.array(process_time_string(self.timeStr))
if len(self.timeslices) + 1 == np.sum(timeUnits):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_time_slices(time_slices, apt_no, exp_no):\n # Removing the extraneous time slices\n if apt_no == '102A' and exp_no == '3':\n discard_ts = time_slices[\n (time_slices.phase == 'Not Found') & (time_slices.magnitude < 100)]\n time_slices = time_slices.ix[time_slices.index - d... | [
"0.58654743",
"0.557243",
"0.54334253",
"0.5312071",
"0.53107566",
"0.5259074",
"0.5191302",
"0.5137161",
"0.5035805",
"0.49849787",
"0.49590302",
"0.49435392",
"0.4941344",
"0.48714745",
"0.48218355",
"0.48059455",
"0.47934845",
"0.47744334",
"0.47464475",
"0.47226936",
"0.4... | 0.5932365 | 0 |
Authenticate a request. Returns a `User` if a valid token has been supplied using HTTP Basic authentication. Otherwise returns `None`. | def authenticate(self, request):
auth = get_authorization_header(request).split()
if not auth or auth[0].lower() != b"basic":
return None
if len(auth) == 1:
raise AuthenticationFailed(
"Invalid Basic authorization header. No credentials provided."
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def authenticate(self, request):\n\n if \"Authorization\" not in request.headers:\n return\n\n auth = request.headers[\"Authorization\"]\n\n scheme, token = auth.split()\n if scheme.lower() != 'bearer':\n raise AuthenticationError(\n \"Please u... | [
"0.7748496",
"0.7482971",
"0.7319348",
"0.7214823",
"0.69572836",
"0.69473755",
"0.6900045",
"0.68219066",
"0.6816961",
"0.68142855",
"0.6797234",
"0.6780275",
"0.6769279",
"0.67666936",
"0.6727957",
"0.6711529",
"0.66963404",
"0.66865516",
"0.6681249",
"0.6672814",
"0.667254... | 0.791987 | 0 |
Do not enforce CSRF. | def enforce_csrf(self, request):
return # To not perform the csrf check previously happening | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_csrf_validation(event):\n if event.request.method == 'POST':\n token = event.request.POST.get('_csrf')\n if token is None or token != event.request.session.get_csrf_token():\n headers = forget(event.request) # force a log out\n raise HTTPForbidden('CSRF token is missi... | [
"0.77730787",
"0.71921813",
"0.6985222",
"0.68456197",
"0.6827762",
"0.68134195",
"0.6702927",
"0.66973877",
"0.66799164",
"0.66241884",
"0.6571412",
"0.6558275",
"0.65252817",
"0.646873",
"0.645416",
"0.63729364",
"0.63329005",
"0.6296769",
"0.6245508",
"0.6245508",
"0.62453... | 0.85253215 | 0 |
Lists all files below the given folder that match the pattern. | def _list_files(folder, pattern):
for root, folders, files in os.walk(folder):
for filename in files:
if fnmatch.fnmatch(filename, pattern):
yield os.path.join(root, filename) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_and_filter(self, pattern, root_path):\n for path, dirs, files in os.walk(os.path.abspath(root_path)):\n for filename in fnmatch.filter(files, pattern):\n yield os.path.join(path, filename)",
"def find(pattern):\n files = config.index.files(path_glob=\"*%s*\" % pattern)\n print_files... | [
"0.77849257",
"0.7500726",
"0.74775934",
"0.7411119",
"0.74076384",
"0.7355792",
"0.7233464",
"0.71732324",
"0.71499306",
"0.71378464",
"0.71049553",
"0.70946896",
"0.6977931",
"0.69686073",
"0.6965376",
"0.6960672",
"0.69308126",
"0.69025075",
"0.68708056",
"0.6868468",
"0.6... | 0.81099135 | 1 |
Returns a list of files changed for this pull request / push. If running on a public CI like Travis or Circle this is used to only run tests/lint for changed files. | def _get_changed_files():
if not ci_diff_helper:
return None
try:
config = ci_diff_helper.get_config()
except OSError: # Not on CI.
return None
changed_files = ci_diff_helper.get_changed_files('HEAD', config.base)
changed_files = set([
'./{}'.format(filename) for ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_changed_files():\n upstream = \"origin/master\"\n local_commit = subprocess.check_output(\n \"git rev-list HEAD ^{} -- 2>/dev/null | tail -1\".format(upstream),\n shell=True).strip().decode()\n diff_base = subprocess.check_output(\n ['git', 'rev-parse', local_commit +\n ... | [
"0.76511127",
"0.7632489",
"0.73521656",
"0.71647716",
"0.70889413",
"0.70419586",
"0.7040667",
"0.6961542",
"0.69610536",
"0.67889297",
"0.66707456",
"0.66461307",
"0.6640469",
"0.6635299",
"0.651519",
"0.6512538",
"0.65028757",
"0.64318836",
"0.6417526",
"0.6387403",
"0.638... | 0.78147644 | 0 |
Filers the list of sample directories to only include directories that contain files in the list of changed files. | def _filter_samples(sample_dirs, changed_files):
result = []
for sample_dir in sample_dirs:
for changed_file in changed_files:
if changed_file.startswith(sample_dir):
result.append(sample_dir)
return list(set(result)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_filter_files(self):\n expected = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir1/fichier4\", False),\n (\"/subdir1/subsubdir1\", False),\n ]\n files = [\n (\"/subdir1/fichier1\", False),\n (\"/subdir2/fichier2\", False),\n ... | [
"0.638365",
"0.6379942",
"0.6214398",
"0.61015475",
"0.6089934",
"0.6049182",
"0.5995398",
"0.5965479",
"0.5943096",
"0.5874663",
"0.58680815",
"0.5832992",
"0.5808962",
"0.5801182",
"0.57878786",
"0.57864714",
"0.5781348",
"0.5780594",
"0.57367",
"0.57249534",
"0.5714945",
... | 0.80027604 | 0 |
Determines all import names that should be considered "local". This is used when running the linter to insure that import order is properly checked. | def _determine_local_import_names(start_dir):
file_ext_pairs = [os.path.splitext(path) for path in os.listdir(start_dir)]
return [
basename
for basename, extension
in file_ext_pairs
if extension == '.py' or os.path.isdir(
os.path.join(start_dir, basename))
and... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_import_local_methods(self):\n package_foo = determine_package(LocalClass().foo_method)\n package_bar = determine_package(LocalClass().bar_method)\n assert package_foo == package_bar",
"def is_local(self) -> bool:\n if not self.source:\n return False\n\n if s... | [
"0.5883926",
"0.58062863",
"0.57493323",
"0.57031",
"0.56781274",
"0.56347144",
"0.5598635",
"0.5551292",
"0.5530518",
"0.5508783",
"0.55060405",
"0.5462658",
"0.5400261",
"0.5390425",
"0.53739977",
"0.5363772",
"0.53556126",
"0.53410673",
"0.5327128",
"0.5322422",
"0.5312975... | 0.7432707 | 0 |
Installs the App Engine SDK, if needed. | def _setup_appengine_sdk(session):
session.env['GAE_SDK_PATH'] = os.path.join(_GAE_ROOT, 'google_appengine')
session.run('gcp-devrel-py-tools', 'download-appengine-sdk', _GAE_ROOT) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_env():\r\n\r\n # Try to import the appengine code from the system path.\r\n try:\r\n from google.appengine.api import apiproxy_stub_map\r\n except ImportError:\r\n for k in [k for k in sys.modules if k.startswith('google')]:\r\n del sys.modules[k]\r\n\r\n # Not on... | [
"0.7231505",
"0.68327713",
"0.6396035",
"0.61375856",
"0.5877419",
"0.58420604",
"0.5788967",
"0.57099634",
"0.5672816",
"0.56718606",
"0.55840725",
"0.55813754",
"0.5555057",
"0.55090976",
"0.5480833",
"0.54060125",
"0.53963965",
"0.53802866",
"0.5351276",
"0.531847",
"0.529... | 0.7749325 | 0 |
Lists all sample directories that do not have tests. | def missing_tests(session):
print('The following samples do not have tests:')
for sample in set(ALL_SAMPLE_DIRECTORIES) - set(ALL_TESTED_SAMPLES):
print('* {}'.format(sample)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_list_emptydirs(load):\n # TODO - implement this\n _init()\n\n return []",
"def test_matlab_install_dir_absent(self):\n directories = (\"/\", \"/tmp\")\n for dirname in directories:\n with self.subTest(dirname=dirname):\n self.assertNotIn(\"matlab-install\... | [
"0.66200477",
"0.65644187",
"0.6472452",
"0.64620155",
"0.63552594",
"0.6348389",
"0.6269922",
"0.6265887",
"0.6258353",
"0.6112326",
"0.6103435",
"0.61029524",
"0.610135",
"0.60616046",
"0.6050831",
"0.595446",
"0.5950891",
"0.5949775",
"0.594931",
"0.5892177",
"0.5882108",
... | 0.79405457 | 0 |
(Re)generates the readme for a sample. | def readmegen(session, sample):
session.install('jinja2', 'pyyaml')
if os.path.exists(os.path.join(sample, 'requirements.txt')):
session.install('-r', os.path.join(sample, 'requirements.txt'))
in_file = os.path.join(sample, 'README.rst.in')
session.run('python', 'scripts/readme-gen/readme_gen.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readme_md(cls):\n\n template = Helpers.File(Settings.readme_me_template).read()\n\n template = Helpers.Regex(\n template, r\"%%version%%\", replace_with=Settings.version\n ).replace()\n template = Helpers.Regex(\n template, r\"%%lenHosts%%\", replace_with=forma... | [
"0.7287029",
"0.7018073",
"0.6953501",
"0.6933401",
"0.6853328",
"0.6802791",
"0.6781446",
"0.6738891",
"0.6733868",
"0.6717046",
"0.66753453",
"0.66342485",
"0.6618257",
"0.64765066",
"0.644934",
"0.6441836",
"0.6415977",
"0.63786113",
"0.63530713",
"0.63517934",
"0.62726355... | 0.80653775 | 0 |
Returns a paranoid_pb2.TestResultsEntry protobuf ready for the checks. The created paranoid_pb2.TestResultsEntry is appropriate to be used on tests and have the paranoid_pb2.TestResultsEntry.result filled by the Check function (i.e., set as weak or not). | def _CreateTestResult(self) -> paranoid_pb2.TestResultsEntry:
if self.severity is None:
raise KeyError("Please specify self.severity for %s." % self.check_name)
return paranoid_pb2.TestResultsEntry(
severity=self.severity, test_name=self.check_name, result=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_verifier_result(self):\n stat = self.get_verifier_result(self.verification_id)\n try:\n num_executed = stat['num_tests'] - stat['num_skipped']\n try:\n self.result = 100 * stat['num_success'] / num_executed\n except ZeroDivisionError:\n ... | [
"0.5186231",
"0.5027672",
"0.48830792",
"0.4770407",
"0.46957067",
"0.46849295",
"0.46664384",
"0.46516448",
"0.46486202",
"0.4532336",
"0.4530844",
"0.4512337",
"0.44765168",
"0.43914053",
"0.43779433",
"0.43736914",
"0.43657622",
"0.4348417",
"0.43343168",
"0.43205202",
"0.... | 0.7242101 | 0 |
Run the 'program'. 'program' The path to the program to run. 'arguments' A list of the arguments to the program. This list must contain a first argument corresponding to 'argv[0]'. 'stdin' Content of standard input for the program. 'context' A 'Context' giving runtime parameters to the test. 'result' A 'Result' object.... | def RunProgram(self, program, arguments, stdin, context, result):
# Construct the environment.
environment = self.MakeEnvironment(context)
e_stdin = stdin
c = {}
for pair in context.items():
c[pair[0]] = pair[1]
for substitution in c.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RunProgram(self, program, arguments, context, result):\n\n # Construct the environment.\n environment = self.MakeEnvironment(context)\n e_stdin = self.stdin\n c = {}\n for pair in context.items():\n c[pair[0]] = pair[1]\n for substitution in c.keys():\n ... | [
"0.69363123",
"0.63061756",
"0.6056023",
"0.5911862",
"0.5623276",
"0.55638814",
"0.5554909",
"0.5461146",
"0.5455719",
"0.545486",
"0.5423107",
"0.54222107",
"0.5385501",
"0.53396916",
"0.5325689",
"0.5288438",
"0.52590066",
"0.52466375",
"0.5239515",
"0.52368325",
"0.523618... | 0.7962142 | 0 |
Restore a database from a backup file. 'database' A database specification. 'backupfile' A backup file name. 'arguments' A list of the arguments to the GBAK without backup file name and database location. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modif... | def RestoreDatabase(self, database, backupfile, arguments, result):
self.RunProgram("\""+self.__context["gbak_path"]+"\"",
[ self.__context["gbak_path"] ] + [ "-C ", backupfile ]
+ arguments + [ database ],
"", self.__context, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restore_backup(self):\n print \"Restoring backup for database: %s\" % self.database['NAME']\n # Fetch the latest backup if filepath not specified\n if not self.filepath:\n print \" Finding latest backup\"\n filepaths = self.storage.list_directory()\n filep... | [
"0.64738756",
"0.6441385",
"0.6043816",
"0.59941",
"0.59136015",
"0.5861948",
"0.5844177",
"0.5674559",
"0.5635281",
"0.5470779",
"0.54675585",
"0.52948487",
"0.5271796",
"0.52364796",
"0.51926756",
"0.5166014",
"0.5152477",
"0.5145427",
"0.508932",
"0.5002277",
"0.49899507",... | 0.8807153 | 0 |
Run an ISQL script. 'database' A database specification. 'script' An ISQL script. 'arguments' A list of the arguments to the ISQL without database location. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outcomes other th... | def RunScript(self, database, script, arguments, result):
self.RunProgram("\""+self.__context["isql_path"]+"\"",
[ self.__context["isql_path"] ] + [ database ] + arguments,
script, self.__context, result) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Run(self, context, result):\n\n # Was the program not specified?\n\n self.program = context[\"isql_path\"]\n\n if context.has_key(\"database_path\"):\n database = context[\"database_path\"]\n else:\n database = \"\"\n self.RunProgram(self.program,\n\t\t\... | [
"0.63101566",
"0.6261756",
"0.59878993",
"0.57192934",
"0.56583416",
"0.5588258",
"0.5548203",
"0.554179",
"0.54586357",
"0.5448663",
"0.5403661",
"0.5383299",
"0.534008",
"0.53358716",
"0.52607375",
"0.52274305",
"0.5176673",
"0.51720655",
"0.5166656",
"0.51541513",
"0.51159... | 0.8646154 | 0 |
Run an ISQL script. 'script' An (optional) GSEC script. 'arguments' A list of the arguments to the GSEC without ISC4 database location and sysdba username and password. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method is called. The 'result' may be modified by this method to indicate outco... | def RunGsec(self, script, arguments, result):
try:
self.RunProgram("\""+self.__context["gsec_path"]+"\"",
[ self.__context["gsec_path"], "-database", self.__context["server_location"]+ self.__context["isc4_path"], "-user", "SYSDBA", "-password", "masterkey" ]+arguments,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RunScript(self, database, script, arguments, result):\n\n self.RunProgram(\"\\\"\"+self.__context[\"isql_path\"]+\"\\\"\",\n [ self.__context[\"isql_path\"] ] + [ database ] + arguments,\n script, self.__context, result)",
"def execute_script(self, script,... | [
"0.7854742",
"0.61550087",
"0.59776443",
"0.5792648",
"0.5619949",
"0.55894285",
"0.55582255",
"0.5536295",
"0.54101485",
"0.536589",
"0.5349416",
"0.53441995",
"0.5326733",
"0.53031874",
"0.5293181",
"0.529026",
"0.52394783",
"0.5232753",
"0.5228306",
"0.521149",
"0.52065",
... | 0.68645024 | 1 |
Run the 'program'. 'program' The path to the program to run. 'arguments' A list of the arguments to the program. This list must contain a first argument corresponding to 'argv[0]'. 'context' A 'Context' giving runtime parameters to the test. 'result' A 'Result' object. The outcome will be 'Result.PASS' when this method... | def RunProgram(self, program, arguments, context, result):
# Construct the environment.
environment = self.MakeEnvironment(context)
e_stdin = self.stdin
c = {}
for pair in context.items():
c[pair[0]] = pair[1]
for substitution in c.keys():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def RunProgram(self, program, arguments, stdin, context, result):\n\n # Construct the environment.\n environment = self.MakeEnvironment(context)\n e_stdin = stdin\n c = {}\n for pair in context.items():\n c[pair[0]] = pair[1]\n for substitution in c.keys():\... | [
"0.77603376",
"0.6088054",
"0.60775167",
"0.58894455",
"0.5795883",
"0.57625437",
"0.5644391",
"0.5612917",
"0.5577483",
"0.54712975",
"0.54391956",
"0.5397551",
"0.5342152",
"0.53416663",
"0.53210723",
"0.5283056",
"0.5247545",
"0.5224499",
"0.51938117",
"0.51841336",
"0.516... | 0.69340014 | 1 |
Perform substitutions on a body of text. returns The string 'text', processed with the substitutions configured for this test instance. | def __PerformSubstitutions(self, text):
for substitution in self.substitutions:
pattern, replacement = self.SplitValue(substitution)
text = re.compile(pattern,re.M).sub(replacement, text)
return text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postprocess(self, text):\r\n return text",
"def preprocess(self, text):\r\n return text",
"def post_process_text(self, text):\n\t\treturn text",
"def substitution(plainText, key):\n return plainText",
"def apply(self, text):",
"def applyRegularExpressions(strText, substitutionPatternLi... | [
"0.65611976",
"0.6435312",
"0.6424799",
"0.6276254",
"0.6202044",
"0.61083364",
"0.6037628",
"0.6034791",
"0.59750575",
"0.57668275",
"0.5727748",
"0.57236975",
"0.5721389",
"0.5685642",
"0.56766623",
"0.5662096",
"0.5638508",
"0.56205267",
"0.5587311",
"0.55449075",
"0.55417... | 0.7525169 | 0 |
Get articles for a gives news source | def for_source(source, articles=None):
if not articles:
articles = load_articles(nl.read_data())
source_arts = [a for a in articles if a.source == source]
for art in source_arts:
yield art | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listsources():\n\tmain_url = \" https://newsapi.org/v2/sources?apiKey=5f81b593f35d42a8980313250c03d7e7\"\n\n\t# fetching data in json format \n\topen_source = requests.get(main_url).json() \n\n\t# getting all articles in a string sources\n\tsource = open_source[\"sources\"] \n\n\t# empty list which will \n\t# ... | [
"0.7267898",
"0.69831485",
"0.6910983",
"0.6892911",
"0.68473136",
"0.67912644",
"0.6780562",
"0.6722617",
"0.6709383",
"0.6705438",
"0.66801316",
"0.663876",
"0.6628921",
"0.6584156",
"0.6563533",
"0.65245885",
"0.6516218",
"0.65005183",
"0.6477813",
"0.64497817",
"0.6429842... | 0.710921 | 1 |
Huber function. An analytic function that is quadratic around its minimum n and linear in its tails. Its minimum is at offset. Quadratic between offsetdelta and offset + delta and linear outside. | def huber(x, offset, delta):
i = np.abs(x - offset) < delta
return (x-offset)**2/2 * i + (1 - i)*delta*(np.abs(x-offset) - delta/2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def beeston_barlow_root1(a, p, U, d):\n return ((-U*p - U + a*p + d*p -\n np.sqrt(U**2*p**2 + 2*U**2*p + U**2 + 2*U*a*p**2 + 2*U*a*p -\n 2*U*d*p**2 - 2*U*d*p + a**2*p**2 + 2*a*d*p**2 + d**2*p**2))/(2*p*(p + 1)))",
"def trapezium_rule(f, m, x, a, b, n):\n h = (b-a)/float(n)\n... | [
"0.5800495",
"0.57387626",
"0.56889313",
"0.56861275",
"0.56719846",
"0.5661993",
"0.5647246",
"0.56123304",
"0.56039697",
"0.55897033",
"0.55779684",
"0.556688",
"0.5564874",
"0.5559421",
"0.55498475",
"0.5544323",
"0.55239946",
"0.55232066",
"0.5518701",
"0.5500929",
"0.549... | 0.71997106 | 0 |
Adds founder to the project model form, saves the project in the database, calls the generate_matches() function to find & save projectuser matches, and redirects to the newly created project. | def form_valid(self, form):
form.instance.founder = self.request.user
print('Project Create user:', self.request.user)
form.save()
tc_lib.generate_user_matches(form)
return super(ProjectCreate, self).form_valid(form) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_project():\n\n title = request.form.get('title')\n description = request.form.get('description')\n max_grade = request.form.get('max_grade')\n\n hackbright.make_new_project(title, description, max_grade)\n\n flash(\"Successfully added new project.\")\n\n return redirect(\"/project?title=... | [
"0.64061403",
"0.6365428",
"0.6048063",
"0.602952",
"0.5996432",
"0.5994576",
"0.5934493",
"0.5910736",
"0.5836684",
"0.5801637",
"0.5649979",
"0.56395286",
"0.56146103",
"0.56023854",
"0.55345714",
"0.5534347",
"0.5526762",
"0.54719496",
"0.5466361",
"0.5405478",
"0.5380776"... | 0.74070966 | 0 |
Create Glue Dev Endpoint | def create_dev_endpoint(self):
self.dev_endpoint = self.glue_engine.create_dev_endpoint(
EndpointName=self.dev_endpoint_name,
RoleArn=self.dev_endpoint_role,
PublicKey=self.dev_endpoint_pub_rsa,
NumberOfNodes=2,
ExtraPythonLibsS3Path=self.python_libra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_endpoint(EndpointName=None, EndpointConfigName=None, Tags=None):\n pass",
"def create_endpoint(path, workspace):\n client = Client()\n\n client.create_endpoint(path, workspace=workspace)",
"def endpoint_create(self, endpoint_name=None, config=None):\n if config is None:\n ... | [
"0.633509",
"0.6196592",
"0.6004353",
"0.593839",
"0.5891074",
"0.5852167",
"0.58136016",
"0.5763851",
"0.57030064",
"0.562547",
"0.55829406",
"0.55522805",
"0.55486447",
"0.55259037",
"0.5472503",
"0.54074615",
"0.5405777",
"0.5385364",
"0.53611857",
"0.5356907",
"0.5353822"... | 0.73661804 | 0 |
Delete Glue Dev Endpoint | def delete_dev_endpoint(self):
self.glue_engine.delete_dev_endpoint(EndpointName=self.dev_endpoint_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_endpoint(EndpointName=None):\n pass",
"def delete_handler(event, context):\n delete_endpoint_config(event)",
"def delete_endpoint(self):\n logger.warning(f\"Deleting hosting endpoint '{self.endpoint_name}'...\")\n self._realtime_predictor.delete_endpoint()",
"def delete_endpoin... | [
"0.7355473",
"0.7192038",
"0.69872594",
"0.6578153",
"0.6334313",
"0.6297704",
"0.62821496",
"0.61767966",
"0.6053079",
"0.6046499",
"0.60339475",
"0.6027786",
"0.5983133",
"0.59529054",
"0.5951396",
"0.5926549",
"0.5921632",
"0.57891357",
"0.5771835",
"0.576563",
"0.573931",... | 0.7549312 | 0 |
Connect to Glue Dev Endpoint | def connect_dev_endpoint(self):
done = False
while not done:
endpoint = self.glue_engine.get_dev_endpoint(EndpointName=self.dev_endpoint_name)
status = endpoint["DevEndpoint"]["Status"]
done = status == "READY"
if status == "PROVISIONING":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_dev_endpoint(self):\n\n self.dev_endpoint = self.glue_engine.create_dev_endpoint(\n EndpointName=self.dev_endpoint_name,\n RoleArn=self.dev_endpoint_role,\n PublicKey=self.dev_endpoint_pub_rsa,\n NumberOfNodes=2,\n ExtraPythonLibsS3Path=self.... | [
"0.63102233",
"0.6122564",
"0.6047225",
"0.60375047",
"0.5978164",
"0.58321375",
"0.5771107",
"0.573747",
"0.5714928",
"0.5713471",
"0.5713471",
"0.5709945",
"0.57074934",
"0.5687956",
"0.5638669",
"0.56293046",
"0.5627169",
"0.5550863",
"0.5526117",
"0.54849017",
"0.54776275... | 0.6406663 | 0 |
This method support to config the advance option of zd syslog feature | def _set_advance_syslog(zd, **kwargs):
xlocs = LOCATOR_CFG_SYSTEM_NETWORKMGMT
adv_opt = ['zd_facility_name', 'zd_priority_level', 'ap_facility_name', 'ap_priority_level']
adv_cfg = {'pause': 1}
adv_cfg.update(kwargs)
if zd.s.is_element_present(xlocs['syslog_advanced_setting_collapse']):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_enable_syslog(self) -> Union[bool, None]:\n # read the original value passed by the command\n enable_syslog = self.raw_param.get(\"enable_syslog\")\n\n # this parameter does not need dynamic completion\n # this parameter does not need validation\n return enable_syslog",
... | [
"0.6081552",
"0.6067496",
"0.6043397",
"0.5979013",
"0.5853631",
"0.5756815",
"0.5755001",
"0.5656631",
"0.5582538",
"0.5562076",
"0.5491174",
"0.5480679",
"0.5466313",
"0.54245096",
"0.5423763",
"0.5375122",
"0.536843",
"0.53460175",
"0.53303653",
"0.5327427",
"0.53229415",
... | 0.68598795 | 0 |
Configure the country code and related option | def set_country_code(zd, option, **kwargs):
cfg_option = {'country_code': '',
'channel_optimization': '',
'channel_mode':''}
cfg_option.update(option)
xloc = LOCATOR_CFG_SYSTEM_COUNTRY_CODE
xloc_map = {
'country_code': xloc['country_code_listbox'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domain_settings_set_country(self, country):\n return self._request('domain/settings/set_country', inspect_args_func(inspect.currentframe()))",
"def setup_plugins(self):\n super(Site, self).setup_plugins()\n self.plugins.countries.configure(hide_region=True)\n self.plugins.ledger.c... | [
"0.68588054",
"0.667291",
"0.64471006",
"0.63912165",
"0.637591",
"0.63027674",
"0.6246238",
"0.6234282",
"0.6234282",
"0.6234282",
"0.6234282",
"0.6234282",
"0.61908615",
"0.61586636",
"0.6097614",
"0.6056722",
"0.59633374",
"0.5948035",
"0.5808251",
"0.57715803",
"0.5738969... | 0.7575244 | 0 |
clear and reload the menu with a new set of options. valueList list of new options value initial value to set the optionmenu's menubutton to | def SetMenu(self,valueList,value=None):
self['menu'].delete(0,'end')
for item in valueList:
self['menu'].add_command(label=item,
command=_setit(self.variable,item,self.command))
if value:
self.variable.set(value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_values( self, values ):\n #self.listbox.configure( values )\n # clear\n #for",
"def callback_ResetDropdown(window):\n # set values and value to empty to get rid of previously specified answers\n window['changeMod'].update('Change ___:')\n window['changeOptions'].update(value... | [
"0.6825974",
"0.6282686",
"0.6281264",
"0.60528725",
"0.59343994",
"0.58950996",
"0.58235645",
"0.57722116",
"0.5739688",
"0.5734824",
"0.57013357",
"0.56410277",
"0.56107605",
"0.5551239",
"0.5550398",
"0.55394113",
"0.5537057",
"0.543177",
"0.54266053",
"0.54241765",
"0.537... | 0.73797125 | 0 |
Encodings for "Embarked" column 2 == "S" == Southampton == 644 people 0 == "C" == Cherbourg == 168 people 1 == "Q" == Queenstown == 77 people 3 == "Unknown" == 2 people 177 records missing age values set to the average age Missing embark_towns are set to "Other" Encodings for "Class" First class == 0 Second class == 1 ... | def prepare_titanic_data(df):
df.embark_town.fillna('Other', inplace=True)
# Drop deck and embarked_town
df.drop(columns=['deck', 'embark_town'], inplace=True)
# Encoding: Objects (Categorical Variables) to Numeric
# Use sklearn's LabelEncoder
encoder = LabelEncoder()
# Set Unknown and e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_process_data(df):\n # setting `passengerID` as Index since it wont be necessary for the analysis\n df = df.set_index(\"PassengerId\")\n\n # convert 'Sex' values\n df['gender'] = df['Sex'].map({'female': 0, 'male': 1}).astype(int)\n\n # We see that 2 passengers embarked data is missing, we fi... | [
"0.585451",
"0.5384007",
"0.5313047",
"0.53103215",
"0.52985805",
"0.5278899",
"0.522569",
"0.52152556",
"0.520184",
"0.51793325",
"0.5156087",
"0.50948936",
"0.50056297",
"0.49981564",
"0.49954587",
"0.4945608",
"0.4944251",
"0.49428275",
"0.49331096",
"0.49324706",
"0.49301... | 0.58713156 | 0 |
0 == 'setosa' 1 == 'versicolor' 2 == 'virginica' This function will encode the species by default, but can optionally show the species name as a string when the second argument is False. prepare_iris_data(df) returns encoded species name prepare_iris_data(df, False) returns species name | def prepare_iris_data(df, encode=True):
# Drop primary/foreign keys
df = df.drop(columns=["measurement_id", "species_id"])
# Rename "species_name" to species
df = df.rename(columns={"species_name": "species"})
if(encode):
encoder = LabelEncoder()
encoder.fit(df.species)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rawSpecies(df, specie = \"Caenorhabditis elegans OX=6239\"):\n species = df[df[\"PG.Organisms\"] == specie]\n return species",
"def prepare_iris_data(data):\n\n # One-Hot Encode target variable y\n \n X = data.iloc[:, 0:4]\n y = data.iloc[:,-1]\n Y = pd.get_dummies(y)\n \n # Recomb... | [
"0.5924976",
"0.57568926",
"0.55721927",
"0.54730135",
"0.5446134",
"0.5353316",
"0.5202682",
"0.5201156",
"0.515606",
"0.512597",
"0.5125128",
"0.5123189",
"0.5102725",
"0.5086768",
"0.50764376",
"0.50676197",
"0.5054898",
"0.5050417",
"0.5038685",
"0.5023871",
"0.49641922",... | 0.74515724 | 0 |
Gets the snapchat IDs that have already been downloaded and returns them in a set. | def get_downloaded():
result = set()
for name in os.listdir(PATH):
filename, ext = name.split('.')
if ext not in EXTENSIONS:
continue
ts, username, id = filename.split('+')
result.add(id)
return result | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_id_set(self):\n s = set()\n for player in Player.select(Player.player_id):\n s.add(player.player_id)\n return s",
"def filter_seen_messages(self, messages):\n seen_uids = set()\n for uid in messages:\n key = \"%s_%s_%s\" % (self.opt_pop3_server,\n ... | [
"0.61409533",
"0.6138558",
"0.5750224",
"0.56933486",
"0.5687567",
"0.56794363",
"0.5625306",
"0.5603618",
"0.5598983",
"0.5564271",
"0.55617774",
"0.5561327",
"0.55588824",
"0.55514014",
"0.5539512",
"0.5530868",
"0.55293196",
"0.5450162",
"0.5425994",
"0.54205567",
"0.53855... | 0.64585745 | 0 |
Download a specific snap, given output from s.get_snaps(). | def download(s, snap):
id = snap['id']
name = snap['sender']
ts = str(snap['sent']).replace(':', '-')
result = s.get_media(id)
if not result:
return False
ext = s.is_media(result)
filename = '{}+{}+{}.{}'.format(ts, name, id, ext)
path = PATH + filename
with open(path, 'w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_snaps(s):\n\n existing = get_downloaded()\n\n snaps = s.get_snaps()\n for snap in snaps:\n id = snap['id']\n if id[-1] == 's' or id in existing:\n print 'Skipping:', id\n continue\n\n result = download(s, snap)\n\n if not result:\n ... | [
"0.73581344",
"0.6964329",
"0.6664417",
"0.59816575",
"0.58126813",
"0.58090883",
"0.5769466",
"0.56545335",
"0.5624676",
"0.562231",
"0.55915815",
"0.5590657",
"0.5560722",
"0.55601645",
"0.55212283",
"0.55028254",
"0.5490585",
"0.5475541",
"0.5471203",
"0.5432722",
"0.54166... | 0.7079678 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.