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 |
|---|---|---|---|---|---|---|
Add another energy to this list, if it does not already appear | def append(self, other: Energy) -> None:
for item in self:
if other == item:
logger.debug(
f"Not appending {other} to the energies - "
f"already present. Moving to the end"
)
self.append(self.pop(self.index(item... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(self, other):\n self._check_item(other)\n self._set.add(other)",
"def add_food_to_bag(self):\n self.food_eaten.set(sum([species.food.get() for species in self.ecosystem]))",
"def insert(self, e): \r\n if not e in self.vals:\r\n self.vals.append(e)",
"def add_emp... | [
"0.6018507",
"0.58812314",
"0.5868007",
"0.5867971",
"0.5844892",
"0.5844892",
"0.58324164",
"0.5831349",
"0.5710135",
"0.5612554",
"0.5605979",
"0.5589302",
"0.5580694",
"0.5553437",
"0.55023265",
"0.547094",
"0.54544955",
"0.54309386",
"0.54252434",
"0.54248476",
"0.5424733... | 0.8224246 | 0 |
Next type of energy in a list of energies | def _next(energies: Any, energy_type: Type):
try:
return next(
energy
for energy in energies
if isinstance(energy, energy_type)
)
except StopIteration:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_gene(self):\n pass",
"def get_energies(element, emin, emax, fwhm_ev=1e-4, eedge = None, num=100,\n verbose=True):\n assert emax>emin, \"emax must be larger than emin.\"\n assert emin>0, \"emin must be larger than 0.\"\n fwhm_ev = max(abs(fwhm_ev), 1e-6)\n try: Z = i... | [
"0.5584452",
"0.55778396",
"0.55379206",
"0.5503189",
"0.53969455",
"0.53937525",
"0.52943987",
"0.5256195",
"0.52244025",
"0.51933527",
"0.51186323",
"0.5109311",
"0.510101",
"0.507008",
"0.50647604",
"0.5024243",
"0.5023732",
"0.5019781",
"0.50194985",
"0.50194985",
"0.5016... | 0.7282912 | 0 |
Return the last instance of a particular energy type in these list of energies | def last(self, energy_type: Type[Energy]) -> Optional[TypeEnergy]:
return self._next(reversed(self), energy_type=energy_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_potential(self) -> Optional[PotentialEnergy]:\n return self.last(energy_type=PotentialEnergy)",
"def first(self, energy_type: Type[Energy]) -> Optional[TypeEnergy]:\n return self._next(self, energy_type=energy_type)",
"def _next(energies: Any, energy_type: Type):\n try:\n ... | [
"0.5844338",
"0.57997316",
"0.57918596",
"0.579013",
"0.579013",
"0.564285",
"0.56220055",
"0.5543191",
"0.54995537",
"0.5407254",
"0.5406865",
"0.53862196",
"0.53142536",
"0.52956074",
"0.5285999",
"0.52826333",
"0.5281912",
"0.52701145",
"0.5253901",
"0.5227907",
"0.5227135... | 0.747538 | 0 |
First potential energy in this list | def first_potential(self) -> Optional[PotentialEnergy]:
return self.first(energy_type=PotentialEnergy) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Find_Lowest_Energy_Structure_Electrostatics(self):\n n_Na = self.structure.composition['Na']\n n_S = self.structure.composition['S']\n n_O = self.structure.composition['O']\n n_N = self.structure.composition['N']\n n_Fe = self.structure.composition['Fe']\n\n n_Fe_reduc... | [
"0.6356888",
"0.63422793",
"0.6259444",
"0.62230945",
"0.6178721",
"0.61448246",
"0.61430293",
"0.61257744",
"0.6122524",
"0.6119538",
"0.61162287",
"0.6005787",
"0.5982684",
"0.5972741",
"0.5967977",
"0.5964171",
"0.5946202",
"0.5941178",
"0.5941178",
"0.5917383",
"0.5910133... | 0.729227 | 0 |
Create a method string for a method and the keywords | def method_string(
method: Optional["Method"],
keywords: Optional["Keywords"],
) -> str:
method_str = f"{method.name} " if method is not None else "unknown"
method_str += keywords.bstring if keywords is not None else ""
return method_str | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_method__(self) -> str:\n out = \"\"\n for imp in self.__base_imports__:\n out += imp + \"\\n\"\n return out + self.__method + \"\\n\" + self.__return__",
"def create_method(self):\n n_indents = 1 if self.target_language in ['java', 'js',\n ... | [
"0.68925625",
"0.6824487",
"0.6761391",
"0.6511592",
"0.6501163",
"0.63532287",
"0.63100505",
"0.62753904",
"0.6219015",
"0.62178266",
"0.6014524",
"0.5941727",
"0.59056807",
"0.58589065",
"0.5819852",
"0.5815077",
"0.58026254",
"0.5781839",
"0.577291",
"0.5759939",
"0.572568... | 0.8314435 | 0 |
Convert spec (string or filename) to ConfigObj | def convert_spec(spec):
config = configobj.ConfigObj(configspec=spec)
return config.configspec | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_SpecConfig_class_minimal():\n res = SpecConfig(path=PATH_SPECS_2_YAML)\n assert res.path_out == PATH_SPECS_2_YAML_MODIFIED",
"def test_SpecConfig_class():\n res = SpecConfig(**SPEC_CONFIG)\n assert res.path_out == SPEC_CONFIG['path_out']",
"def from_string(cls, s, file_name='<from_str>', r... | [
"0.6122218",
"0.60373",
"0.5997091",
"0.59742665",
"0.5920772",
"0.5902488",
"0.5837935",
"0.57691735",
"0.575629",
"0.5665951",
"0.5658186",
"0.5650844",
"0.5640031",
"0.562541",
"0.56246024",
"0.5616644",
"0.5514646",
"0.5507901",
"0.54983425",
"0.54776603",
"0.5477411",
... | 0.8264163 | 0 |
Converts a configobj to an OrderedHierarchicalMapping | def conf_to_ohm(conf, ohm=None, section_name=''):
if conf is None:
return HierarchicalOrderedDict()
if ohm is None:
ohm = HierarchicalOrderedDict()
for key, value in conf.items():
if not section_name == '':
new_key = (section_name +
HierarchicalOr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _yaml_ordering_support():\n _mapping_tag = yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG\n\n def dict_representer(dumper, data):\n return dumper.represent_dict(data.iteritems())\n\n def dict_constructor(loader, node):\n return OrderedDict(loader.construct_pairs(node))\n\n yaml.add_representer(Ordere... | [
"0.544892",
"0.5213907",
"0.5102985",
"0.5088008",
"0.5076551",
"0.5028765",
"0.49974805",
"0.487398",
"0.4856787",
"0.4842391",
"0.48349428",
"0.48275626",
"0.48045927",
"0.4799253",
"0.47916543",
"0.47860214",
"0.4770686",
"0.4766165",
"0.4732122",
"0.47197267",
"0.4717724"... | 0.6112502 | 0 |
Convert OrderedHierarchicalMapping to specification list The value_transform argument should be a function that transforms the values of the ohm to the entries of the spec list. | def ohm_to_spec_list(ohm, value_transform=lambda x: x):
spec = []
level_start = "["
level_stop = "]"
for key, value in ohm.items():
split_key = key.split(ohm.SECTION_SEPARATOR)
index = None
if len(split_key) > 1:
for level, part in zip(count_up(1), split_key[:-1]):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ohm_to_spec(ohm):\n spec_type = defaultdict(lambda: \"string\",\n [(type(3), \"integer\"),\n (type(\"bla\"), \"string\"),\n (type(True), \"boolean\"),\n (type(3.14), \"float\")])\n\n value_trans... | [
"0.56990355",
"0.49802056",
"0.49607325",
"0.4958282",
"0.478868",
"0.47621927",
"0.47572643",
"0.47059765",
"0.46522152",
"0.46313077",
"0.45960438",
"0.45576534",
"0.45403522",
"0.45154354",
"0.45099482",
"0.44802138",
"0.44673726",
"0.4449032",
"0.44112006",
"0.43960056",
... | 0.7487226 | 0 |
Yields a range of date. | def daterange(start_date, end_date):
for n in range(int ((end_date - start_date).days)+1):
yield start_date + timedelta(n) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _drange(start: Date, end: Date) -> Iterator[Date]:\n while start <= end:\n yield start\n start = start + TimeDelta(days=1)",
"def date_range(start_date, end_date):\n for ordinal in range(start_date.toordinal(), end_date.toordinal() + 1):\n yield datetime.date.fromordina... | [
"0.79065007",
"0.7856384",
"0.782684",
"0.7684314",
"0.7676284",
"0.76115507",
"0.73396736",
"0.72326285",
"0.71314",
"0.70551497",
"0.6972664",
"0.68760073",
"0.6860516",
"0.68444",
"0.67850965",
"0.67071176",
"0.6696449",
"0.66264206",
"0.6557971",
"0.653187",
"0.65138125",... | 0.78794074 | 1 |
API to get temperature data. Gets maximum temperatures and dates from database. | def get_temperature_data(zone):
zone = zone[1:len(zone)-1]
temp_response = {}
conn = sqlite3.connect(os.path.abspath('database.db'))
# get temperatures data
query = "Select temp_date, temp_max From temperature Left join fire_danger_zone on temperature.temp_station=fire_danger_zone.fdz_station Wher... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_temperature(self):\n return self._maximum_temperature",
"def temperatures():\n hi_act= session.query(measurements.tobs,measurements.date,measurements.station).\\\n filter(measurements.station == 'USC00519281').\\\n filter(measurements.date >last_12).\\... | [
"0.6742724",
"0.6714561",
"0.66957074",
"0.66860193",
"0.6636561",
"0.66118413",
"0.659942",
"0.65909106",
"0.6582313",
"0.6525075",
"0.64948773",
"0.64865696",
"0.64700174",
"0.6443616",
"0.6357671",
"0.6352053",
"0.6332496",
"0.6297344",
"0.6292233",
"0.621399",
"0.61860037... | 0.6815108 | 0 |
API to get rainfall data. Gets rainfall amount and dates from database. | def get_rainfall_data(zone):
zone = zone[1:len(zone)-1]
rain_response = {}
conn = sqlite3.connect(os.path.abspath('database.db'))
# get rainfall data
query = "Select rain_date, rain_rainfall From rainfall Left join fire_danger_zone on rainfall.rain_station=fire_danger_zone.fdz_station Where fire_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_restaurants(term, lat=\"37.788744\", lon=\"-122.411587\", radius=\"805\"):\n\n # Create OAuth2 token and store in session (we don't need to get a new one\n # for every API request)\n\n access_token = get_access_token()\n\n if not SEEDING:\n if \"access_token\" not in session:\n ... | [
"0.5593989",
"0.552641",
"0.5460731",
"0.54313976",
"0.54146874",
"0.5402018",
"0.5394335",
"0.53652924",
"0.5327426",
"0.5324704",
"0.52748305",
"0.5254373",
"0.5211894",
"0.520732",
"0.5184047",
"0.51771295",
"0.51644343",
"0.513423",
"0.51291585",
"0.5099018",
"0.5073745",... | 0.6906911 | 0 |
API to get humidity data. Gets humidity and dates from database. | def get_humidity_data(zone):
zone = zone[1:len(zone)-1]
humidity_response = {}
conn = sqlite3.connect(os.path.abspath('database.db'))
# get humidity data
query = "Select humidity_date, humidity_relative From humidity Left join fire_danger_zone on humidity.humidity_station=fire_danger_zone.fdz_stat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humidity(self):\r\n self._read_temperature()\r\n hum = self._read_register(_BME280_REGISTER_HUMIDDATA, 2)\r\n #print(\"Humidity data: \", hum)\r\n adc = float(hum[0] << 8 | hum[1])\r\n #print(\"adc:\", adc)\r\n\r\n # Algorithm from the BME280 driver\r\n # https:... | [
"0.69744045",
"0.6937078",
"0.68488884",
"0.67979234",
"0.6728959",
"0.6714723",
"0.67003644",
"0.6682476",
"0.6644111",
"0.6592747",
"0.6583904",
"0.65398103",
"0.6486941",
"0.6485543",
"0.64734477",
"0.63962704",
"0.63393676",
"0.6299811",
"0.6275802",
"0.62552905",
"0.6157... | 0.72812444 | 0 |
Calculate Forest Fire. Gets FFDI and dates from databse. | def forest_fire_calculator(zone):
drought_factor = 2
drought_factor = int(drought_factor)
ffdi_response = {}
conn = sqlite3.connect(os.path.abspath('database.db'))
# get FFDI data
query = "Select ffdi_date, ffdi_value From forest_fire_danger_index Left join fire_danger_zone on forest_fire_dang... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FFDI_calculator(zone, drought_factor):\n zone = zone[1:len(zone)-1]\n drought_factor = int(drought_factor[1:len(drought_factor)-1])\n ffdi_response = {}\n conn = sqlite3.connect(os.path.abspath('database.db'))\n\n # get FFDI data\n query = \"Select ffdi_date, ffdi_value From forest_fire_dange... | [
"0.7350793",
"0.63725746",
"0.6159966",
"0.6158723",
"0.5972709",
"0.59677756",
"0.5883856",
"0.5672022",
"0.5615295",
"0.5517001",
"0.5490369",
"0.5485677",
"0.5438114",
"0.54036915",
"0.53957546",
"0.53857374",
"0.53710824",
"0.5364924",
"0.5363915",
"0.5363278",
"0.534405"... | 0.77337533 | 0 |
Calculate for McAthur's FFFDI based on drought factor. Get FFDI and dates | def FFDI_calculator(zone, drought_factor):
zone = zone[1:len(zone)-1]
drought_factor = int(drought_factor[1:len(drought_factor)-1])
ffdi_response = {}
conn = sqlite3.connect(os.path.abspath('database.db'))
# get FFDI data
query = "Select ffdi_date, ffdi_value From forest_fire_danger_index Left ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_FFDI(weather_df: DataFrame, wind_red: int = 3, flank=False) -> Series:\n if flank:\n wind_speed = 0\n else:\n wind_speed = weather_df[WIND_SPEED]\n\n ffdi = 2.0*np.exp(\n -0.450 + 0.987*np.log(weather_df[DF])\n -0.0345*weather_df[RH]\n +0.0338*weather_df[TEMP]\n ... | [
"0.6599279",
"0.59670067",
"0.58986616",
"0.58979964",
"0.56108844",
"0.56076616",
"0.55887705",
"0.5548626",
"0.5544971",
"0.5544971",
"0.552023",
"0.5502173",
"0.5500862",
"0.54974276",
"0.54740745",
"0.547163",
"0.546788",
"0.54529107",
"0.54411364",
"0.5368491",
"0.536581... | 0.67845595 | 0 |
Test that the notification schedule loads properly. | def test_notification_schedule(self):
response = self.client.get(self.dashboard_url)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_schedules(self):\n pass",
"def test_retrieve_instances_schedule_state(self):\n pass",
"def test_add_recurring_schedule(self):\n pass",
"def test_get_schedule(self):\n response = self.client.open('/v1/schedule/{id}'.format(id=56),\n ... | [
"0.728816",
"0.7002754",
"0.6986097",
"0.6801271",
"0.66766363",
"0.6590055",
"0.654931",
"0.65091",
"0.6435035",
"0.6418627",
"0.6399343",
"0.6395851",
"0.63772243",
"0.6323958",
"0.6322522",
"0.6301275",
"0.6275439",
"0.6269038",
"0.62119776",
"0.6180873",
"0.61451757",
"... | 0.76916444 | 1 |
Test retriving the edit notification schedule form. | def test_get_edit_page(self):
data = self.get_valid_data()
notification = reminders.Notification.objects.create(**data)
url = reverse('edit-notification', args=[notification.pk])
response = self.client.get(url)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_edit_task(self):\n self.login()\n # Task to edit\n fakeName = fake.text()[0:100]\n date = datetime.now()\n isComplete = False\n self.create_task(fakeName, date, isComplete)\n time.sleep(2)\n\n self.driver.get(self.live_server_url)\n self.asser... | [
"0.66891277",
"0.659394",
"0.6570313",
"0.6461351",
"0.6437993",
"0.6296748",
"0.62893915",
"0.6274927",
"0.62601584",
"0.62245184",
"0.6205192",
"0.6202205",
"0.6180957",
"0.6177918",
"0.61699116",
"0.6166156",
"0.6146741",
"0.6133122",
"0.61271113",
"0.6127048",
"0.61074907... | 0.71123064 | 1 |
Test retriving the delete notification schedule form. | def test_get_delete_page(self):
data = self.get_valid_data()
notification = reminders.Notification.objects.create(**data)
url = reverse('delete-notification', args=[notification.pk])
response = self.client.get(url)
self.assertEqual(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_schedule(self):\n response = self.client.open('/v1/schedule/{id}'.format(id=56),\n method='DELETE',\n content_type='application/json')\n self.assert200(response, \"Response body is : \" + response.data.decode('utf-8... | [
"0.7377989",
"0.7307511",
"0.7120723",
"0.69862735",
"0.69808066",
"0.6941616",
"0.68841267",
"0.68841267",
"0.6727669",
"0.6714243",
"0.67076236",
"0.6706653",
"0.6653221",
"0.6653221",
"0.6545335",
"0.6538275",
"0.6533982",
"0.6521764",
"0.6517957",
"0.650611",
"0.6498307",... | 0.75008494 | 1 |
test the response from a registered user without any notifications | def test_registered_no_notifications(self):
msg = self._send(self.reg_conn, '1')
self.assertEqual(len(msg.responses), 1)
self.assertEqual(msg.responses[0].text,
self.app.no_reminders) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_users_eligible_for_fist_notification_with_no_result(self):\n # Given:\n self.batch_setup()\n # When:\n response = self.client.get(\"/api/batch/account/users/eligible-for-first-notification\", headers=self.headers)\n # Then:\n self.assertTrue(200, response.stat... | [
"0.7118141",
"0.70651925",
"0.6934865",
"0.6903008",
"0.687871",
"0.68710613",
"0.6859126",
"0.68548864",
"0.684918",
"0.6847692",
"0.6778017",
"0.67711556",
"0.6721232",
"0.66992897",
"0.6687563",
"0.6683272",
"0.6680155",
"0.6676037",
"0.66688275",
"0.6665045",
"0.66582763"... | 0.7157373 | 1 |
Unconfirmed patients returned should be distinct. | def test_multiple_notifications_unconfirmed(self):
appt_date = datetime.date.today()
self.create_unconfirmed_notification(self.test_patient, appt_date)
self.create_unconfirmed_notification(self.test_patient, appt_date)
qs = Patient.objects.unconfirmed_for_date(appt_date)
self.ass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getUnconfirmedVolunteers(self, query):\n query = Volunteer.query(Volunteer.confirmed == False)\n return query",
"def test_multiple_notifications_unconfirmed(self):\n appt_date = datetime.date.today()\n self.test_patient.next_visit = appt_date\n self.test_patient.save()\n ... | [
"0.64172614",
"0.63088095",
"0.60964715",
"0.5902392",
"0.58619136",
"0.5844432",
"0.571327",
"0.5614164",
"0.54594237",
"0.5436904",
"0.54283357",
"0.53992647",
"0.5375697",
"0.5329799",
"0.53190863",
"0.5318473",
"0.5296074",
"0.5281178",
"0.52699715",
"0.52699715",
"0.5269... | 0.6328466 | 1 |
Test email contains info for the appointment date. | def test_appointment_date(self):
# Default for email
appt_date = datetime.date.today() + datetime.timedelta(days=7)
self.create_confirmed_notification(self.test_patient, appt_date)
self.create_unconfirmed_notification(self.other_patient, appt_date)
# run email job
from ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appointment_date(self):\n appt_date = datetime.date.today() + datetime.timedelta(days=7) # Default for email\n reminders.Patient.objects.filter(\n pk__in=[self.test_patient.pk, self.other_patient.pk]\n ).update(next_visit=appt_date)\n confirmed = self.create_confirme... | [
"0.7582645",
"0.6586703",
"0.63925105",
"0.6034676",
"0.60278475",
"0.5973405",
"0.5911942",
"0.59074324",
"0.5906279",
"0.589881",
"0.5782579",
"0.57598144",
"0.574372",
"0.57308054",
"0.57273966",
"0.5721106",
"0.5701328",
"0.5687777",
"0.5651434",
"0.5646606",
"0.5638029",... | 0.7763582 | 0 |
Test changing appointment date via callback kwarg. | def test_changing_date(self):
days = 2
appt_date = datetime.date.today() + datetime.timedelta(days=days)
confirmed = self.create_confirmed_notification(self.test_patient,
appt_date)
unconfirmed = self.create_unconfirmed_notification(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_appointment_date(self):\n # Default for email\n appt_date = datetime.date.today() + datetime.timedelta(days=7) \n self.create_confirmed_notification(self.test_patient, appt_date)\n self.create_unconfirmed_notification(self.other_patient, appt_date)\n\n # run email job\n ... | [
"0.64121145",
"0.6358772",
"0.6354636",
"0.6178278",
"0.59145427",
"0.5859335",
"0.57601607",
"0.56903553",
"0.5631755",
"0.5558915",
"0.5529351",
"0.5473219",
"0.5458964",
"0.54537046",
"0.5441712",
"0.5425601",
"0.54108906",
"0.54076266",
"0.5394993",
"0.5393353",
"0.537394... | 0.6419636 | 0 |
Skip sending the email if there are not patients for this date. | def test_skip_if_no_patients(self):
appt_date = datetime.date.today() + datetime.timedelta(days=5)
confirmed = self.create_confirmed_notification(self.test_patient, appt_date)
# run email job
from aremind.apps.reminders.app import daily_email_callback
daily_email_callback(self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_skip_if_no_patients(self):\n\n appt_date = datetime.date.today() + datetime.timedelta(days=5)\n reminders.Patient.objects.filter(\n pk__in=[self.test_patient.pk, self.other_patient.pk]\n ).update(next_visit=appt_date)\n confirmed = self.create_confirmed_notification(... | [
"0.7413296",
"0.67731655",
"0.6487428",
"0.6419432",
"0.5946799",
"0.5899274",
"0.5825877",
"0.5713737",
"0.56436443",
"0.5628631",
"0.56148994",
"0.5583826",
"0.55692875",
"0.5552227",
"0.55509424",
"0.5547094",
"0.5484103",
"0.54322237",
"0.5425559",
"0.5416514",
"0.5389924... | 0.739835 | 1 |
Test manually confirming a patient reminder. | def test_manually_confirm(self):
data = {}
response = self.client.post(self.url, data)
self.assertRedirects(response, reverse('reminders_dashboard'))
reminder = reminders.SentNotification.objects.get(pk=self.unconfirmed.pk)
self.assertEqual(reminder.status, 'manual')
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simple_confirmed(self):\n appt_date = datetime.date.today()\n reminders.Patient.objects.filter(\n pk__in=[self.test_patient.pk, self.other_patient.pk]\n ).update(next_visit=appt_date)\n confirmed = self.create_confirmed_notification(self.test_patient, appt_date)\n ... | [
"0.7132489",
"0.71205854",
"0.7068401",
"0.69571435",
"0.6854439",
"0.6818445",
"0.6656326",
"0.6613488",
"0.65836877",
"0.65734375",
"0.65642715",
"0.6516952",
"0.6467731",
"0.6428601",
"0.63626695",
"0.6263337",
"0.6243778",
"0.61735356",
"0.6168098",
"0.61207914",
"0.61087... | 0.7576037 | 1 |
Given a string representing a single command, open a process, and return the Popen process object. | def process_run(cmd_string, stdin=None):
process_object=subprocess.Popen(shlex.split(cmd_string),
stdin=stdin,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
return process_object | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def popen(command, cwd=None, check=False, detach=False):\n\tif detach:\n\t\treturn spawn(command, cwd)\n\telse:\n\t\tcmd = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd)\n\t\tstatus = cmd.wait()\n\t\tres, err = cmd.communicate()\n\t\tif status == 0:\n\t\t\tret... | [
"0.6200064",
"0.61410177",
"0.61166304",
"0.6090243",
"0.60840464",
"0.60401714",
"0.5995351",
"0.5958186",
"0.59153825",
"0.58661795",
"0.5864674",
"0.5825268",
"0.5760893",
"0.5756459",
"0.57439095",
"0.57330394",
"0.5687861",
"0.56498647",
"0.562502",
"0.5604148",
"0.55838... | 0.7248456 | 0 |
Given a process object, wait for it to complete then return a tuple with stdout and stderr | def process_results(process_object):
(stdout, stderr)=process_object.communicate()
return (process_object.returncode, stdout, stderr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_output(process, outputs):\n state = type(\"State\",\n (object, ),\n {\n \"printed_message\": False,\n \"read_first_byte\": False\n })\n\n def output_printer(file_handle):\n \"\"\"Thread that prints the ... | [
"0.6738659",
"0.65954405",
"0.6586263",
"0.65297383",
"0.64363354",
"0.61585087",
"0.6140569",
"0.6130091",
"0.6122885",
"0.60457695",
"0.6009304",
"0.59681475",
"0.5920165",
"0.59052765",
"0.5879942",
"0.5860761",
"0.5859846",
"0.5822416",
"0.58011544",
"0.5763239",
"0.57412... | 0.7253342 | 0 |
Pipe a python string to standard input for cmd_string >>> pipestring_process('grep 2', '1\n2\n3\n')[1] '2\n' | def pipestring_process(cmd_string, stdin_string=''):
f=SpooledTemporaryFile()
f.write(stdin_string)
f.seek(0)
results=process(cmd_string, stdin=f)
f.close()
return results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(cmd_string, stdin=None):\n return process_results(process_run(cmd_string, stdin=stdin))",
"def pipe_string(engine: str, format: str, input_string: str,\n *, encoding: str,\n renderer: typing.Optional[str] = None,\n formatter: typing.Optional[str] = None,... | [
"0.70950663",
"0.6617287",
"0.6222607",
"0.6105096",
"0.59365886",
"0.590385",
"0.5827824",
"0.56502867",
"0.5570991",
"0.55688727",
"0.5551994",
"0.5493889",
"0.5488081",
"0.54856205",
"0.5428494",
"0.53447515",
"0.53329563",
"0.53053576",
"0.5291117",
"0.5289028",
"0.527123... | 0.7914945 | 0 |
Convert a dictionary generated by crm2dict into a format compatible with the haresources2 library. There are a few key format differences. Instead of a key map, there is a list with 'name' fields. The "members" field is dropped, as this information is implied from the other fields. Finally, the loadbalancers are placed... | def crmdict2haresources(anydict):
lst=[]
for k in anydict.keys():
d={}
for subkey in anydict[k].keys() + ['name']:
if subkey == 'name':
d.setdefault(subkey, k)
elif subkey == 'loadbalancers':
numbalancers=len(anydict[k][subkey].keys())
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _transform_loadbalancer(loadbalancer, haproxy_base_dir):\n listeners = [_transform_listener(x, haproxy_base_dir)\n for x in loadbalancer.listeners if x.admin_state_up]\n pools = [_transform_pool(x) for x in loadbalancer.pools]\n return {\n 'name': loadbalancer.name,\n 'vip_address... | [
"0.60647875",
"0.5885079",
"0.5569334",
"0.55612016",
"0.5406802",
"0.53614926",
"0.5238466",
"0.5236129",
"0.51718503",
"0.51540256",
"0.5139991",
"0.5139153",
"0.5133009",
"0.5023839",
"0.50062007",
"0.5004075",
"0.49959046",
"0.4943309",
"0.4940011",
"0.48812443",
"0.48803... | 0.74160194 | 0 |
Given a candidate filename, returns (candidate_config, live_config) | def get_configs(candidate_filename):
return (sortby('name')(haresources2.load(haresources2_file)),
sortby('name')(crmdict2haresources(crm2dict(configure_parse())))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_merge_candidate(self, filename=None, config=None):\n raise NotImplementedError",
"def load_replace_candidate(self, filename=None, config=None):\n raise NotImplementedError",
"def _get_config_parsser(config_file):\n config_parser = Parser()\n # read() return a list of file name that... | [
"0.60768074",
"0.5637599",
"0.5609756",
"0.54985374",
"0.5472634",
"0.5450289",
"0.54391307",
"0.5385578",
"0.53662056",
"0.5331849",
"0.5318676",
"0.5301815",
"0.52968186",
"0.5295002",
"0.5253908",
"0.52388936",
"0.52345043",
"0.52314883",
"0.51812303",
"0.5171164",
"0.5169... | 0.67396903 | 0 |
Initialize with the attr name | def __init__(self, attr=None):
self.attr = attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, attr=None):\n self.name = name\n self.propertiesstr = attr",
"def __init__(self, val):\n self.attr = val",
"def __init__(self, **attrs):\n \n # set given attributes\n for name, value in attrs.items():\n if hasattr(self, name):\n ... | [
"0.7400829",
"0.7124522",
"0.7119747",
"0.6828582",
"0.6738255",
"0.6710395",
"0.6679803",
"0.6661321",
"0.66600895",
"0.66531485",
"0.6636822",
"0.65896916",
"0.6570362",
"0.65700203",
"0.65620553",
"0.6506172",
"0.6473171",
"0.64358",
"0.6432599",
"0.64123034",
"0.64123034"... | 0.7472793 | 0 |
Return the attr name | def getAttrName(self, context):
return self.attr if self.attr is not None else context.attr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAttrName(self, *args):\n return _libsbml.XMLToken_getAttrName(self, *args)",
"def __id_attr_name(self):\n return self._attr_name()",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name(self) -> \"str\":\n return self._attrs.get(\"name\")",
"def name... | [
"0.7928906",
"0.76384246",
"0.7598586",
"0.7598586",
"0.7598586",
"0.74672866",
"0.7455118",
"0.7415886",
"0.7358015",
"0.7319255",
"0.7319255",
"0.7288041",
"0.7282783",
"0.7209946",
"0.7199718",
"0.7176864",
"0.71578926",
"0.71425116",
"0.70462674",
"0.70126534",
"0.6978423... | 0.79991966 | 0 |
Returns an iterator that repeats until a timeout is reached timeout is in seconds | def until_timeout(timeout, value=None):
start = time.time()
while True:
if time.time() - start >= timeout:
raise Exception("timed out before success!")
yield value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def itime(iterable, seconds):\n items = iter(iterable)\n\n end = time.time() + seconds\n yield items.next()\n\n for item in itertools.takewhile(lambda _: time.time() < end, items):\n yield item",
"async def with_timeout(self, duration=-1):\n if duration == -1:\n duration = se... | [
"0.6775248",
"0.66121465",
"0.6311623",
"0.63081664",
"0.6170886",
"0.61414266",
"0.60604566",
"0.59776926",
"0.59395814",
"0.59281915",
"0.58985025",
"0.5865048",
"0.5825151",
"0.5788233",
"0.5786408",
"0.5785512",
"0.57587737",
"0.5738569",
"0.5738569",
"0.57077885",
"0.569... | 0.6986537 | 0 |
Check if any actuator message is available. | def _IsActuatorMessageAnyValid(mode, node_labels, node_label_helper,
max_no_update_count, *attributes):
if mode == common.SPARSE_COMMS_MODE:
# Check the `valid` variable for TetherDown.
if attributes[1]:
for label in node_labels:
idx = node_label_helper.Value(label... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_message_available(self):\n return not self.feedback_log.empty()",
"def has_messages(self) -> bool:\n return self._has_messages",
"def _check(self):\n\t\tif not self._raven:\n\t\t\traise NoDeviceFoundException",
"def check_message(self, msg):\n pass",
"def is_msg_inited(self):\n... | [
"0.6573523",
"0.607177",
"0.58057594",
"0.5793598",
"0.5789556",
"0.5757219",
"0.5735036",
"0.57295525",
"0.57204515",
"0.5718905",
"0.5718905",
"0.57085115",
"0.5620772",
"0.56162846",
"0.56004626",
"0.5600159",
"0.5591218",
"0.55856496",
"0.55701226",
"0.55650187",
"0.55419... | 0.6136332 | 1 |
Check if all actuator message are available. | def _IsActuatorMessageAllValid(mode, node_labels, node_label_helper,
max_no_update_count, *attributes):
if mode == common.SPARSE_COMMS_MODE:
# Check the `valid` variable for TetherDown.
if attributes[1]:
for label in node_labels:
idx = node_label_helper.Value(label... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_all_systems_ready(self):\n self._check_all_sensors_ready()\n return True",
"def _check_all_systems_ready(self):\n self._check_all_sensors_ready()\n return True",
"def _check_all_systems_ready(self):\n \n self._check_all_sensors_ready()\n #self._check_... | [
"0.64295155",
"0.64295155",
"0.6339862",
"0.6267608",
"0.6213421",
"0.61329013",
"0.60967404",
"0.6090387",
"0.60848254",
"0.6069265",
"0.6068108",
"0.6047221",
"0.6001827",
"0.5984566",
"0.59333414",
"0.5902161",
"0.58341473",
"0.58302736",
"0.57313895",
"0.56948656",
"0.569... | 0.6453309 | 0 |
Check status flags per node and set stoplight accordingly. Normal if all nodes have the expected statuses, warning otherwise. | def _CheckStatusFlags(self, raw_node_status, status_helper,
expected_statuses, failed_stoplight):
if self._mode == common.FULL_COMMS_MODE:
filtered_nodes = checks.GetActuatorsWithStatus(
raw_node_status, status_helper, expected_statuses)
node_status = {key: 1 if key in... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_status(self):\n num_nbrs = len(self.neighbors)\n if not 2 <= num_nbrs <= 3:\n self.status = 0\n elif num_nbrs == 3:\n self.status = 1",
"def iteration(self, node_status=True):\n self.clean_initial_status(list(self.available_statuses.values()))\n ... | [
"0.62542987",
"0.6170322",
"0.5967763",
"0.5795591",
"0.55259746",
"0.551759",
"0.5454568",
"0.5423219",
"0.5371892",
"0.5359797",
"0.5313068",
"0.526013",
"0.5248048",
"0.52376634",
"0.5230429",
"0.5224323",
"0.52236444",
"0.5220974",
"0.5219837",
"0.51968366",
"0.5194832",
... | 0.6724137 | 0 |
Get the stoplight according to the values. | def _GetStoplight(self, values, any_values, missing_values, flight_mode):
if not any_values:
stoplight = stoplights.STOPLIGHT_UNAVAILABLE
elif missing_values:
stoplight = stoplights.STOPLIGHT_ERROR
else:
stoplight = stoplights.STOPLIGHT_NORMAL
if values and flight_mode in self._limits... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getStop(self, i):\n stopID = self.trip_update.stop_time_update[i].stop_id\n stop = self.stops[stopID]\n return stop",
"def process_traffic_lights(self):\n light = None\n\n #some plausability checks before starting the processing\n if None is self.waypoints:\n ... | [
"0.6568446",
"0.6470049",
"0.6453219",
"0.6447635",
"0.6315743",
"0.615388",
"0.60639215",
"0.5985654",
"0.5903597",
"0.5898259",
"0.5858546",
"0.5830951",
"0.5813489",
"0.5775211",
"0.5766934",
"0.57570225",
"0.56688577",
"0.56385446",
"0.5631723",
"0.559969",
"0.5554254",
... | 0.8069425 | 0 |
Extract avionics monitor data fields. | def GetMonitorFields(message, monitor_field, monitor_type, monitor_helper,
warning_helper, error_helper, monitor_names, aio_node,
read_error_name):
monitor = getattr(message, monitor_field)
populated = getattr(monitor, monitor_type + '_populated')
warning = False
error ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def get_monitor_data(self):\n json = await self._api_call(\"app/monitors/%s/overview\" % self.sense_monitor_id)\n if \"monitor_overview\" in json and \"monitor\" in json[\"monitor_overview\"]:\n self._monitor = json[\"monitor_overview\"][\"monitor\"]\n return self._monitor",
... | [
"0.5811916",
"0.57171804",
"0.5547663",
"0.54687154",
"0.544975",
"0.5382764",
"0.5351633",
"0.5350509",
"0.533733",
"0.5311389",
"0.52909607",
"0.52851623",
"0.5284421",
"0.52601755",
"0.52594566",
"0.5258998",
"0.5258486",
"0.5254695",
"0.5252972",
"0.5205593",
"0.5197636",... | 0.5817519 | 0 |
Return default blank user extra data | def extra_data(self, user, uid, response, details):
try:
return self.get_steam_profile(response)
except:
return "" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_settings_user_attributes():\n return ['fullname', 'email', 'groups']",
"def default_userinfo(claims, user):\n return claims",
"def extract_user_short(data):\n user_pk = data.get(\"id\", data.get(\"pk\"))\n assert user_pk, 'User without pk \"%s\"' % data\n return {\n \"pk\": in... | [
"0.706236",
"0.62205917",
"0.6096386",
"0.6091269",
"0.603374",
"0.60060894",
"0.59606296",
"0.5945396",
"0.59436375",
"0.59436375",
"0.59113467",
"0.59113467",
"0.5901338",
"0.58638096",
"0.5814673",
"0.581423",
"0.581423",
"0.57832414",
"0.5762691",
"0.5744342",
"0.5728879"... | 0.6505745 | 1 |
Return Steam OpenID service url | def openid_url(self):
return STEAM_OPENID_URL | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_openid_url( email ):\n return os.path.join( CONFIG.SYNDICATE_OPENID_TRUSTROOT, \"id\", email )",
"def GenerateUrl():\n params = {}\n params['client_id'] = Constants.USER['CLIENT_ID']\n params['redirect_uri'] = Constants.AUTH['REDIRECT']\n params['scope'] = Constants.AUTH['SCOPE']\n params['respo... | [
"0.6728354",
"0.6388604",
"0.6276407",
"0.62681794",
"0.62229884",
"0.61129653",
"0.6107954",
"0.607025",
"0.60649353",
"0.6012954",
"0.5987453",
"0.597369",
"0.59613717",
"0.59520805",
"0.59470385",
"0.5945639",
"0.5931356",
"0.5905604",
"0.59039706",
"0.5884694",
"0.5858835... | 0.7847024 | 0 |
Initialize a new linked list containing the given items. The first node in the linked list contains the first item in . | def __init__(self, items):
if len(items) == 0: # No items, and an empty list!
self._first = None
else:
self._first = _Node(items[0])
curr = self._first
for item in items[1:]:
curr.next = _Node(item)
curr = curr.next | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, items):\n if len(items) == 0:\n self._first = None\n self._rest = None\n else:\n self._first = items[0]\n self._rest = LinkedListRec(items[1:])",
"def __init__(self, items: list) -> None:\n if items == []:\n self._firs... | [
"0.77780277",
"0.7514045",
"0.74844074",
"0.7438117",
"0.70560646",
"0.6919856",
"0.67227983",
"0.6710322",
"0.6697007",
"0.66781634",
"0.6622026",
"0.65524465",
"0.65173554",
"0.6469273",
"0.6463215",
"0.64528155",
"0.64364386",
"0.64092153",
"0.6385144",
"0.63465625",
"0.63... | 0.83739454 | 0 |
Builds and runs a model given a dictionary of hyperparameters | def model(self, hyperparams, test_mode=False):
run_doc = OrderedDict() # Document important hyperparameters
run_start_time = time.time()
run_id = str(uuid4())
# TODO: Not ideal: Loads from memory every time. Use generator?
train_data, train_targets, test_data, test_targets = \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_model(train_inputs,train_labels,model_params,model_mode='classification',\n model_type='naive_bayes'):\n if model_mode == \"classification\":\n if model_type == \"naive_bayes\":\n model = GaussianNB()\n if model_type == \"knn\":\n model = KNeighbo... | [
"0.6664377",
"0.6500016",
"0.6416057",
"0.63725674",
"0.6363783",
"0.6220619",
"0.62196374",
"0.6176619",
"0.6174007",
"0.617128",
"0.61672944",
"0.6163508",
"0.6161274",
"0.61565685",
"0.609071",
"0.6068283",
"0.60627574",
"0.6054463",
"0.6046044",
"0.60401225",
"0.60380805"... | 0.6538095 | 1 |
Return the iSCSI initiator node name IQN | def get_initiator(self):
out, err = self.execute('/usr/sbin/iscsiadm', 'list', 'initiator-node')
# Sample first line of command output:
# Initiator node name: iqn.1986-03.com.sun:01:e00000000000.4f757217
initiator_name_line = out.splitlines()[0]
return initiator_name_line.rsplit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_iqn(self, port, hostgroup):\n hba_iscsis = self.client.get_hba_iscsis_by_name(port, hostgroup)\n return hba_iscsis[0]['iscsiName']",
"def initiator_group_name(self):\n return self._initiator_group_name",
"def get_initiator_host_name(self, connector):\n name = connector.get(... | [
"0.6521978",
"0.64331645",
"0.59817016",
"0.575337",
"0.5699478",
"0.56942457",
"0.5663213",
"0.5625326",
"0.5612892",
"0.5612892",
"0.5612109",
"0.5597099",
"0.5536864",
"0.5536864",
"0.55132073",
"0.55042726",
"0.54842967",
"0.548274",
"0.54112566",
"0.5398066",
"0.5398066"... | 0.769304 | 0 |
Use a Fibonacci spiral to distribute points uniformly on a sphere. | def fib_sphere_grid(npoints):
phi = (1.0 + np.sqrt(5.0)) / 2.0
i = np.arange(npoints, dtype=float)
i2 = 2*i - (npoints-1)
theta = (2.0*np.pi * i2/phi) % (2.*np.pi)
sphi = i2/npoints
phi = np.arccos(sphi)
return theta, phi | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fibonacci_sphere(nr_points, R=1):\n assert nr_points % 2 == 1, \"The number of points must be odd\"\n points = []\n # The golden ratio\n phi = (1 + math.sqrt(5)) / 2.\n N = int((nr_points - 1)/2)\n for i in range(-N, N+1):\n lat = math.asin(2 * i / nr_points)\n lon = 2 * math.pi... | [
"0.78947026",
"0.75181514",
"0.6479582",
"0.6417272",
"0.6395811",
"0.6304712",
"0.6266597",
"0.62059444",
"0.61742026",
"0.6131441",
"0.61240923",
"0.6113509",
"0.60475546",
"0.6034688",
"0.60316795",
"0.6026368",
"0.6010045",
"0.59203523",
"0.59094846",
"0.5851908",
"0.5836... | 0.7621979 | 1 |
Divide el tileset en tiles que pueden ser accedidos mediante una fila y una columna. | def split_tileset(self, tileset):
tiles = self.tiles
firstgid = tileset.firstgid
tilewidth = self.tilewidth
tileheight = self.tileheight
margin = tileset.margin
# carga la imagen del tileset y obtiene sus dimensiones
image = pygame.image.load(tileset.image_path)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_tiles(self, x: torch.Tensor):\n tiles, self._coords, self._overlap = self._get_tiles_and_coords(x)\n self._num_tiles = tiles.shape[0]\n return tiles",
"def arrange_tiles(self, layer):\n\n # número de tiles en 'x'\n width = self.width\n arranged_tiles = lay... | [
"0.59098536",
"0.5779611",
"0.57285625",
"0.55863816",
"0.5580728",
"0.55606526",
"0.5510597",
"0.5501661",
"0.54624385",
"0.5448654",
"0.5412254",
"0.5410151",
"0.53344417",
"0.53270924",
"0.5325173",
"0.53223264",
"0.5307833",
"0.52885395",
"0.5285274",
"0.52790445",
"0.527... | 0.7453442 | 0 |
Ordena una lista de tiles en un diccionario donde pueden ser accedidos mediante una fila y una columna. | def arrange_tiles(self, layer):
# número de tiles en 'x'
width = self.width
arranged_tiles = layer.arranged_tiles
row = -1
# convierte una lista en un diccionario
for col, tile in enumerate(layer.tiles):
# calcula la ubicación en dos dimensiones (fila y col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tiles(self):\n\n tiles = []\n for x in range(self.position[0],\n self.position[0] + CAR_LENGTH if self.is_horizontal else self.position[0] + CAR_WIDTH):\n for y in range(self.position[1],\n self.position[1] + CAR_WIDTH if self.is_hori... | [
"0.6678496",
"0.6630207",
"0.6557136",
"0.65312195",
"0.6426528",
"0.6223165",
"0.61086667",
"0.6080225",
"0.60731256",
"0.60001016",
"0.5878228",
"0.5664136",
"0.56525993",
"0.5641407",
"0.5634587",
"0.56290716",
"0.56286156",
"0.5628193",
"0.5623876",
"0.55987686",
"0.55888... | 0.72410774 | 0 |
Access graph generated by covariance | def graph(self):
assert self._modeled, "Need to do calc_covariance"
return self._graph | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_covariance(self):\n ...",
"def covariance(self):\n return self._covariance",
"def covariance(G, variables = [], conditionants = []):\n return parameters(G, variables = variables, \n conditionants = conditionants )[\"cov\"]",
"def get_covariance_copy(self):\n ... | [
"0.7707081",
"0.69640446",
"0.6739613",
"0.65576565",
"0.6422102",
"0.62213385",
"0.621935",
"0.61581093",
"0.61396927",
"0.6061193",
"0.60534066",
"0.6034158",
"0.6028108",
"0.5958604",
"0.5945119",
"0.59284335",
"0.5877712",
"0.58746344",
"0.57802016",
"0.5779166",
"0.57791... | 0.7625186 | 1 |
Send a string message to the C2 server and get the decrypted result. | def send_to_c2(msg: str) -> str:
msg_as_ord = [ord(c) for c in msg]
msg_encrypted = crypt1(msg_as_ord)
resp = requests.post(C2_URL, data=str(msg_encrypted))
if resp.status_code != 200:
print('Got status code', resp.status_code)
return None
raw_resp = resp._content.decode('utf-8')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(self, msg):\n if self.security_type is not None and self.security_type != 0:\n res, used, _ = gss.unwrap(self.ctx, msg)\n isconf = self.security_type == gss.RequirementFlag.confidentiality\n if (not used and isconf):\n raise GSSClientError('User re... | [
"0.6334714",
"0.6302504",
"0.6178412",
"0.61392576",
"0.60899776",
"0.60193545",
"0.60098565",
"0.6008894",
"0.59508586",
"0.5944665",
"0.59226185",
"0.5879768",
"0.58382493",
"0.58330107",
"0.5825843",
"0.5794851",
"0.5752901",
"0.57374704",
"0.5730375",
"0.57150155",
"0.571... | 0.77378964 | 0 |
Init pylirc and connect to the mainloop. | def init(appname = None, cfg = None):
global _dispatcher
if _dispatcher:
# already running
return False
if not pylirc:
# not installed
return False
if cfg == None:
cfg = os.path.expanduser("~/.lircrc")
if appname == None:
appname = "kaa"
try:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init():\n\tglobal settings\n\t\n\tsettings = settings_manager.Singleton()\n\t\n\tsettings._telnet = False\n\tsettings._counters = { 'send': 0, 'recv': 0, 'flush': 0 }\n\tsettings._seqSave = {}\n\t\n\tif settings.skip_shutdown == False:\n\t\tsignal.signal(signal.SIGINT, gracefullShutdown)\n\t\tatexit.register(g... | [
"0.62116736",
"0.62013304",
"0.60876703",
"0.60578394",
"0.59903425",
"0.5952219",
"0.5952219",
"0.59381413",
"0.5890135",
"0.5846897",
"0.5821148",
"0.5792678",
"0.57801735",
"0.5772876",
"0.57502556",
"0.57403415",
"0.57403415",
"0.57340026",
"0.57305837",
"0.572107",
"0.56... | 0.71899086 | 0 |
Utility function to create an agent set with tasks, impostors | def create_agents(game_map, km, num_crew, num_imp, num_tasks, num_visuals, cooldown, stat_thres):
agents = [Crewmate(x, num_crew, num_imp, game_map, km, num_tasks, num_visuals) for x in range(num_crew)]
# noinspection PyTypeChecker
[agents.append(Impostor(num_crew + x, num_crew, num_imp, game_map, km, coold... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_tasks(self) -> Sequence[AbstractExecutorTask]:\n return [AEAInstanceTask(agent) for agent in self._agents]",
"def _init_agents(self):\n self.agents = [Agent(e=0.1, a=0.1, row=self.row, col=self.col) for i in range(2)]",
"def form_agents(n, r, a, b, agents):\n for a_ind, b_ind in izip... | [
"0.6510037",
"0.60347915",
"0.592975",
"0.5873572",
"0.5723034",
"0.5687922",
"0.56801754",
"0.56436276",
"0.56043786",
"0.5541275",
"0.5516603",
"0.5485046",
"0.5467421",
"0.54472566",
"0.5412219",
"0.5412182",
"0.5405739",
"0.53863955",
"0.53293234",
"0.5317456",
"0.5310022... | 0.6363386 | 1 |
Crewmates vote for an agent if they're sure they are the impostor. Otherwise, they have a chance of either voting an agent that they still suspect, or passing. | def vote(self, agents):
suspects = []
known_impostor = -1
# Check which agents the current agent still suspects
for a in agents:
if self.km.knows_imp(self.agent_id, a.agent_id):
known_impostor = a.agent_id
self.logger.log(f"Crewmate {self.agen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vote(self, agents):\n\n # If the impostors have a set target, vote that\n if self.target != -1:\n vote = self.target\n else: # Vote a random living agents\n vote = random.sample([a.agent_id for a in agents if not a.agent_id == self.agent_id and a.alive and not a.is_im... | [
"0.7749093",
"0.59564734",
"0.58818376",
"0.5820537",
"0.5737596",
"0.5597006",
"0.55939364",
"0.5562229",
"0.55429405",
"0.55132025",
"0.5509967",
"0.5457228",
"0.5437934",
"0.53872633",
"0.53853065",
"0.5380882",
"0.5368445",
"0.53520364",
"0.53447217",
"0.53299826",
"0.532... | 0.7737502 | 1 |
The impostor chooses a target to vote off. It chooses the crewmate that suspects the least number of people, e.g. the one that is most onto the impostors. | def choose_target(self, agents):
number_of_suspects = [0]*(len(agents))
number_of_suspects_per_agent = []
index = 0
for a1 in agents:
if not a1.is_impostor():
for a2 in agents:
if self.km.suspects(a1.agent_id, a2.agent_id):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vote(self, agents):\n\n # If the impostors have a set target, vote that\n if self.target != -1:\n vote = self.target\n else: # Vote a random living agents\n vote = random.sample([a.agent_id for a in agents if not a.agent_id == self.agent_id and a.alive and not a.is_im... | [
"0.66481984",
"0.6096803",
"0.59673357",
"0.59673357",
"0.59096104",
"0.5844936",
"0.5713903",
"0.5673187",
"0.5669155",
"0.5568003",
"0.5551677",
"0.5546894",
"0.5491641",
"0.5482978",
"0.54644454",
"0.54063976",
"0.5404933",
"0.5384071",
"0.53642523",
"0.5317128",
"0.530718... | 0.6493369 | 1 |
The impostor votes the agents that are closest to finding them. If there is no such agent, vote for a random living agent that is not an impostor. | def vote(self, agents):
# If the impostors have a set target, vote that
if self.target != -1:
vote = self.target
else: # Vote a random living agents
vote = random.sample([a.agent_id for a in agents if not a.agent_id == self.agent_id and a.alive and not a.is_impostor()], ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vote(self, agents):\n\n suspects = []\n known_impostor = -1\n # Check which agents the current agent still suspects\n for a in agents:\n if self.km.knows_imp(self.agent_id, a.agent_id):\n known_impostor = a.agent_id\n self.logger.log(f\"Crewm... | [
"0.6971406",
"0.5951045",
"0.5771504",
"0.5673423",
"0.55882704",
"0.55701625",
"0.5514064",
"0.5483708",
"0.5427261",
"0.5420447",
"0.54176253",
"0.5396009",
"0.53874993",
"0.5363692",
"0.5351745",
"0.5349156",
"0.533731",
"0.527437",
"0.52639854",
"0.52635944",
"0.5258469",... | 0.81985414 | 0 |
String representation of the BoutDataset. Accessed by print(ds.bout) | def __str__(self):
styled = partial(prettyformat, indent=4, compact=True)
text = (
"<xbout.BoutDataset>\n"
+ "Contains:\n{}\n".format(str(self.data))
+ "Metadata:\n{}\n".format(styled(self.metadata))
)
if self.options:
text += "Options:\n{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n\n styled = partial(prettyformat, indent=4, compact=True)\n text = \"<xbout.BoutDataset>\\n\" + \\\n \"Contains:\\n{}\\n\".format(str(self.data)) + \\\n \"Metadata:\\n{}\\n\".format(styled(self.metadata))\n if self.options:\n text += \... | [
"0.7738638",
"0.68448293",
"0.6820169",
"0.6812283",
"0.6772967",
"0.6755283",
"0.67315626",
"0.66959274",
"0.66763437",
"0.6670186",
"0.6663785",
"0.66437835",
"0.658378",
"0.6578823",
"0.65750813",
"0.65570045",
"0.6543551",
"0.653589",
"0.6528994",
"0.6528994",
"0.6521988"... | 0.76001686 | 1 |
Get a fieldaligned version of a variable, calculating (and caching in the Dataset) if necessary | def get_field_aligned(self, name, caching=True):
aligned_name = name + "_aligned"
try:
result = self.data[aligned_name]
if result.direction_y != "Aligned":
raise ValueError(
aligned_name + " exists, but is not field-aligned, it "
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFieldAligned(self, name, caching=True):\n aligned_name = name + '_aligned'\n try:\n result = self.data[aligned_name]\n if result.direction_y != 'Aligned':\n raise ValueError(aligned_name + \" exists, but is not field-aligned, it \"\n ... | [
"0.67085123",
"0.61507255",
"0.5795061",
"0.5353258",
"0.53250104",
"0.53083676",
"0.5264778",
"0.52195203",
"0.5200996",
"0.5198052",
"0.5187579",
"0.5183718",
"0.5181325",
"0.5162378",
"0.51259124",
"0.5062785",
"0.50295717",
"0.49923342",
"0.49811924",
"0.49661848",
"0.492... | 0.68883395 | 0 |
Integrate using the midpoint rule for spatial dimensions, and trapezium rule for time. The quantity being integrated is assumed to be a scalar variable. When doing a 1d integral in the 'y' dimension, the integral is calculated as a poloidal integral if the variable is on the standard grid (``direction_y`` attribute is ... | def integrate_midpoints(self, variable, *, dims=None, cumulative_t=False):
ds = self.data
if isinstance(variable, str):
variable = ds[variable]
location = variable.cell_location
suffix = "" if location == "CELL_CENTRE" else f"_{location}"
tcoord = ds.metadata["bout... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integrate(x, y, xmin, xmax):\n indexes = get_interval(x, xmin, xmax)\n integral = np.trapz(y[indexes], x[indexes])\n\n return integral",
"def integrate_quantity(self, q, mask=None, layer=None):\n if type(q) == str:\n qarr = self.get_scalar_quantity(q)\n else:\n qa... | [
"0.6382099",
"0.59577996",
"0.57978356",
"0.5709865",
"0.564082",
"0.5568304",
"0.55649954",
"0.5563294",
"0.5465039",
"0.54029584",
"0.53548735",
"0.53206986",
"0.53073025",
"0.5295405",
"0.52623844",
"0.5237101",
"0.5219668",
"0.52120626",
"0.5197901",
"0.518972",
"0.516770... | 0.63629687 | 1 |
Interpolate the Dataset to a regular Cartesian grid. This method is intended to be used to produce data for visualisation, which normally does not require doubleprecision values, so by default the data is converted to `numpy.float32`. Pass ``use_float32=False`` to retain the original precision. | def interpolate_to_cartesian(
self, nX=300, nY=300, nZ=100, *, use_float32=True, fill_value=np.nan
):
ds = self.data
ds = ds.bout.add_cartesian_coordinates()
if not isinstance(use_float32, bool):
raise ValueError(f"use_float32 must be a bool, got '{use_float32}'")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_interpolate_to_grid_pandas():\n df = pd.DataFrame({\n 'lat': [38, 39, 31, 30, 41, 35],\n 'lon': [-106, -105, -86, -96, -74, -70],\n 'tmp': [-10, -16, 13, 16, 0, 3.5]\n }, index=[1, 2, 3, 4, 5, 6])\n interpolate_to_grid(\n df['lon'], df['lat'], df['tmp'],\n inter... | [
"0.5606788",
"0.53919816",
"0.5123987",
"0.5074931",
"0.5069266",
"0.5061946",
"0.5059369",
"0.50380826",
"0.50291497",
"0.49987197",
"0.49886507",
"0.49671483",
"0.49597093",
"0.49591473",
"0.49470276",
"0.49186033",
"0.4908981",
"0.4886567",
"0.4886055",
"0.4871353",
"0.484... | 0.6481106 | 0 |
Add Cartesian (X,Y,Z) coordinates. Returns Dataset with new coordinates added, which are named 'X_cartesian', 'Y_cartesian', and 'Z_cartesian' | def add_cartesian_coordinates(self):
return _add_cartesian_coordinates(self.data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_cartesian(self, coordinates, *axes):",
"def cartesian_coordinates(self, *axes):",
"def from_cartesian(self, cartesian): # TODO\n pass",
"def to_cartesian(self):\n\n if self.cartesian is None:\n theta = math.radians(self.lat)\n phi = math.radians(self.long)\n ... | [
"0.6711812",
"0.6346187",
"0.6281566",
"0.61917114",
"0.605604",
"0.59752685",
"0.5831589",
"0.57925475",
"0.56936985",
"0.5659338",
"0.56373507",
"0.5553509",
"0.54993534",
"0.54703844",
"0.54405624",
"0.5420852",
"0.52921927",
"0.5256684",
"0.52273154",
"0.52031684",
"0.518... | 0.7595386 | 0 |
Remove yboundary points, if present, from the Dataset | def remove_yboundaries(self, **kwargs):
variables = []
xcoord = self.data.metadata["bout_xdim"]
ycoord = self.data.metadata["bout_ydim"]
new_metadata = None
for v in self.data:
if xcoord in self.data[v].dims and ycoord in self.data[v].dims:
variables.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_none_from_arrays(self):\r\n\r\n is_nan = numpy.isnan(self.y_values) # array of booleans, element is True if the corresponding element in\r\n # self.y_values is None\r\n\r\n self.x_values = self.x_values[numpy.logical_not(is_nan)]\r\n self... | [
"0.5992924",
"0.5969578",
"0.58907396",
"0.58851814",
"0.58851814",
"0.5799895",
"0.5770106",
"0.57697684",
"0.5757143",
"0.5622611",
"0.5622102",
"0.5605699",
"0.55546165",
"0.55406183",
"0.55341536",
"0.5486058",
"0.5471142",
"0.54682815",
"0.54652053",
"0.5457789",
"0.5457... | 0.7006094 | 0 |
Get bounding surfaces. Surfaces are returned as arrays of points describing a polygon, assuming the third spatial dimension is a symmetry direction. | def get_bounding_surfaces(self, coords=("R", "Z")):
return _get_bounding_surfaces(self.data, coords) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_surfaces(idf):\n surfaces = idf.getsurfaces() + idf.getshadingsurfaces() + idf.getsubsurfaces()\n return surfaces",
"def surfaces(self):\n return self._surfaces",
"def surfaces(self):\n surfaces = []\n for i in range(1000):\n surface = self.surfaceInfo(i)\n ... | [
"0.6530279",
"0.6434113",
"0.6411715",
"0.6280182",
"0.6126913",
"0.5993448",
"0.57987916",
"0.57056105",
"0.56974256",
"0.56121373",
"0.556502",
"0.55179393",
"0.5502502",
"0.5479062",
"0.54683447",
"0.54181874",
"0.54075956",
"0.5395107",
"0.53748316",
"0.53256476",
"0.5316... | 0.704489 | 0 |
Save data variables to a netCDF file. | def save(
self,
savepath="./boutdata.nc",
filetype="NETCDF4",
variables=None,
save_dtype=None,
separate_vars=False,
pre_load=False,
):
if variables is None:
# Save all variables
to_save = self.data
else:
to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_to_netCDF(nc_filename, data,\n ncformat='NETCDF4_CLASSIC',\n all_variables=False,\n verbose=True):\n ncfile = Dataset(nc_filename,'w', format=ncformat, clobber=True)\n for dd,dim in enumerate(data['dims']):\n ncfile.createDimension(dat... | [
"0.77604604",
"0.74669206",
"0.7397448",
"0.7206549",
"0.71815324",
"0.70918006",
"0.7076918",
"0.69555724",
"0.6915677",
"0.69000775",
"0.68512446",
"0.68471926",
"0.6764292",
"0.67503494",
"0.6702369",
"0.66910315",
"0.66819125",
"0.6663821",
"0.6652764",
"0.6592476",
"0.65... | 0.7525839 | 1 |
Write out a timestep as a set of netCDF BOUT.restart files. If processor decomposition is not specified then data will be saved using the decomposition it had when loaded. | def to_restart(
self,
variables=None,
*,
savepath=".",
nxpe=None,
nype=None,
tind=-1,
prefix="BOUT.restart",
overwrite=False,
):
if isinstance(variables, str):
variables = [variables]
# Set processor decomposition ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bwrite_restart2(part,ppart,pparti,qi,kpic,kipic,iur,ntime,ntime0,\n irc):\n global i1, i2\n# write out basic restart file for electrostatic code\n idimp = numpy.size(part,0)\n iur.seek(0,0)\n# write out current and initial time\n i2[0] = ntime; i2[1] = ntime0\n i2.tofile(iur)\n# wr... | [
"0.59185416",
"0.5744597",
"0.5687877",
"0.55774593",
"0.5489489",
"0.54680973",
"0.5467822",
"0.5444093",
"0.54016024",
"0.53534144",
"0.5327416",
"0.5313884",
"0.5296571",
"0.52915955",
"0.52676725",
"0.5216562",
"0.5199472",
"0.5174116",
"0.5146257",
"0.51194954",
"0.51110... | 0.5896776 | 1 |
Construct wowdburl for given filter settings. | def construct_wowdb_url(itype, slot, expansion, source):
#url = f"https://www.wowdb.com/items/{itype}?filter-bind={bind}&filter-expansion={xpac_filt}&filter-slot={slot_filt}&filter-source={sour_filt}"
url = f'https://www.wowhead.com/{itype}'
if itype == "armor" or itype == "weapons":
url += f'/slot:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_query_url(self):\n self.__log('Starting to create the query URL.')\n query_url = self.config['API_URI']\n for key, value in self.options.items():\n if value:\n if query_url == self.config['API_URI']:\n query_url = query_url + str(key) + \... | [
"0.5853847",
"0.5509402",
"0.5490879",
"0.54825324",
"0.5392755",
"0.53008115",
"0.52985835",
"0.5158107",
"0.51489013",
"0.510917",
"0.504464",
"0.5031474",
"0.5011303",
"0.50104153",
"0.49949825",
"0.49811515",
"0.4967093",
"0.49351695",
"0.49062383",
"0.49018353",
"0.48737... | 0.66933805 | 0 |
Retrieve the forecasted streamflow as CSV | def get_forecast_streamflow_csv(params):
try:
# retrieve statistics
forecast_statistics, watershed_name, subbasin_name, river_id, units = \
get_ecmwf_forecast_statistics(params)
# prepare to write response for CSV
si = StringIO()
writer = csv_writer(si)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response_to_df_csv():\n results = api.call_api()\n df = t.get_dataframe(results)\n t.save_csv(df)\n return df",
"def export_sensor_data_to_csv(self):\n df = pd.read_sql('SELECT * FROM sensor_data', self.conn)\n df.to_csv('output/sensor_data.csv', index=False)",
"def _pipe(content)... | [
"0.6023504",
"0.5924914",
"0.58590114",
"0.57644004",
"0.57519144",
"0.5670613",
"0.5655407",
"0.56502205",
"0.56495583",
"0.55874765",
"0.5582105",
"0.5577872",
"0.5563917",
"0.554165",
"0.552366",
"0.5498462",
"0.54918885",
"0.5491812",
"0.5479355",
"0.54736406",
"0.5469388... | 0.76494205 | 0 |
Moves n disks from A to C. | def do_hanoi(A, B, C, n):
# TODO: IMPLEMENT THIS FUNCTION.
if n == 1:
# TODO: 1. Initial case - only one disk will be moved from A to C.
pass
else:
# TODO: 2. General case - All disks must be moved from A to C.
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def towers(n: int, from_pile=1, to_pile=2):\n if n == 1:\n print(\"Remove 1 disk from {} pile to {} pile\"\n .format(from_pile, to_pile))\n else:\n tmp = 6 - from_pile - to_pile\n towers(n-1, from_pile, tmp)\n print(\"Remove {} disk from {} pile to {} pile\"\n ... | [
"0.65945226",
"0.65249664",
"0.6085075",
"0.5749312",
"0.5676841",
"0.5595829",
"0.55845743",
"0.556843",
"0.54991084",
"0.5460064",
"0.5455655",
"0.542318",
"0.5389853",
"0.53455055",
"0.5298701",
"0.52472997",
"0.5229179",
"0.52062523",
"0.51896346",
"0.51513433",
"0.514595... | 0.71183276 | 0 |
Draw cross at p | def draw_point(self, p):
length = 3
self.set_line_width(0.1)
self.set_source_rgba(0, 0, 1, 1)
self.move_to(p.x + length, p.y)
self.line_to(p.x - length, p.y)
self.stroke()
self.move_to(p.x, p.y + length)
self.line_to(p.x, p.y - length)
self.stroke(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawCross(self, coord, color):\n for n in range(-2, 3):\n self._drawPoint(color, (coord[0] + n, coord[1] + n))\n self._drawPoint(color, (coord[0] + n, coord[1] - n))\n self.zoomMap(self.scale)",
"def draw_cross(self, cut_coords=None, **kwargs):\n return",
"def _dr... | [
"0.6558362",
"0.65311545",
"0.65285534",
"0.6497934",
"0.6493567",
"0.6244876",
"0.61536306",
"0.6064431",
"0.60444117",
"0.60263395",
"0.59330165",
"0.5904333",
"0.58620644",
"0.5848732",
"0.5829977",
"0.58260655",
"0.58235955",
"0.581553",
"0.5806245",
"0.5797918",
"0.57779... | 0.71613365 | 0 |
Draw line between p and q... later | def draw_line(self,
p,
q,
line_width=0.8,
line_cap=cairo.LINE_CAP_ROUND,
procrastinate=1000):
if procrastinate == 0:
self.set_line_width(line_width)
self.set_line_cap(line_cap)
self.move... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawPoints(self, qp):\n\n# pen = self.pen\n\n\n size = self.size()\n self.yOffset = [size.height()*0.2 + size.height()*0.618/self.NUM_CHANNEL * y for y in xrange(self.NUM_CHANNEL) ]\n\n for ix in xrange(self.NUM_CHANNEL):\n self.pen.setStyle(Qt.SolidLine)\n sel... | [
"0.7515969",
"0.71693134",
"0.7076229",
"0.7023031",
"0.687339",
"0.68398696",
"0.6728852",
"0.6715737",
"0.67081326",
"0.6694993",
"0.6668623",
"0.6655206",
"0.66504383",
"0.6649325",
"0.6522204",
"0.6499562",
"0.64854527",
"0.64538586",
"0.6440059",
"0.64291716",
"0.6401296... | 0.7585317 | 0 |
Draw a cube and some adjacent lines. (Lines which cannot be drawn without knowledge of edges.) | def draw_cube(self, middle, edges, coloring=None, explain=False):
# edges = set(e - 2 for e in edges)
top = middle - Point(0, self.edge)
# No comment would help you. Draw it (with explain=True).
if explain:
self.set_source_rgb(1, 0, 0)
for i in [0, 2, 4]:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_cube(self, points, color=(255, 0, 0)):\n\n # draw front\n self.draw_line(points[0], points[1], color)\n self.draw_line(points[1], points[2], color)\n self.draw_line(points[3], points[2], color)\n self.draw_line(points[3], points[0], color)\n\n # draw back\n ... | [
"0.70276123",
"0.68475175",
"0.6743233",
"0.66442275",
"0.6584108",
"0.6521665",
"0.6505683",
"0.64314955",
"0.63990635",
"0.63661325",
"0.62538546",
"0.62471414",
"0.62392014",
"0.62088",
"0.6025039",
"0.60101235",
"0.5996221",
"0.5973417",
"0.5973192",
"0.5954744",
"0.59397... | 0.68829364 | 1 |
List all registered stores with postal_code relation | def get(self):
return StoreModel.with_postal_code().all() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_zip_codes(self, zip_code):\n zip_code = str(zip_code).strip()\n cursor = self.households.find({\"addresses.zip_code\":zip_code})\n results = [Household.from_dict(dct) for dct in cursor]\n\n cursor = self.businesses.find({\"address.zip_code\":zip_code})\n results += [Busi... | [
"0.6617824",
"0.60827667",
"0.57788986",
"0.57293546",
"0.57178175",
"0.5682164",
"0.56532544",
"0.5649994",
"0.5608533",
"0.5594942",
"0.5572109",
"0.5532357",
"0.5516685",
"0.5516685",
"0.5417449",
"0.53987354",
"0.53240204",
"0.52937925",
"0.51975673",
"0.5187178",
"0.5172... | 0.7859172 | 0 |
Delete a store given its identifier | def delete(self, store_id):
store = StoreModel.query.filter_by(id=store_id).first()
if not store:
store_api.abort(404, "Store {} not found".format(store_id))
store.delete()
return '', 204 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_store(request, store_name):\n # Search for store: if doesn't exist, return different message\n\n storedb = redis.Redis(host=HOST, db=STOREDB)\n\n if store_name not in get_store(request):\n return {\"msg\": store_name + \" does not exist in the database\"}\n \n\n store_docs = stored... | [
"0.742896",
"0.6779621",
"0.67687804",
"0.65303797",
"0.6485785",
"0.62740797",
"0.62400824",
"0.6204889",
"0.6132283",
"0.60748327",
"0.6040998",
"0.60385203",
"0.59810966",
"0.59146565",
"0.58733934",
"0.5872545",
"0.58013636",
"0.57930464",
"0.5787214",
"0.57854605",
"0.57... | 0.79674953 | 0 |
Associate product to the given store with the intermediate table 'stocks' | def post(self, store_id):
store = StoreModel.query.filter_by(id=store_id).first()
if not store:
store_api.abort(404, "Store {} not found".format(store_id))
data = request.json
product = ProductModel.query.filter_by(id=data['product_id']).first()
if not product:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_store(self, product, store):\n self.db.query(\"\"\"\n INSERT IGNORE INTO product_store(product_id, store_id)\n VALUES (:product_id, :store_id)\n \"\"\", product_id=product.id, store_id=store.id)",
"def add_product(self, store, product):\n self.db.query(\"\"\"\n ... | [
"0.68032104",
"0.64854527",
"0.64698213",
"0.5975366",
"0.58538634",
"0.57653624",
"0.573931",
"0.5709792",
"0.57026035",
"0.5676848",
"0.56041026",
"0.55653584",
"0.55257595",
"0.54852957",
"0.5472724",
"0.54477",
"0.5373242",
"0.53698784",
"0.53662187",
"0.5338059",
"0.5331... | 0.65619427 | 1 |
Instantiate a dictionary of child nodes of actions as keys. | def create_child(self, actions, probs):
games = [copy(self.game) for a in actions]
for action, game in zip(actions, games):
game.move(action)
self.child = {tuple(a): Node(g, self, p)
for a, g, p in zip(actions, games, probs)} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, child_type = None):\r\n super().__init__()\r\n self.__child_dict = collections.OrderedDict()\r\n self.__child_type = child_type\r\n self.__mykeys = ()\r\n self.__parent = None",
"def expansion(self, actions):\n for action in actions: \n self... | [
"0.6502148",
"0.63490796",
"0.633704",
"0.6307876",
"0.6121037",
"0.5994401",
"0.5864908",
"0.5864908",
"0.5864908",
"0.5864908",
"0.58106875",
"0.5803559",
"0.57712287",
"0.5771172",
"0.5711726",
"0.5696167",
"0.5678274",
"0.56714916",
"0.5654343",
"0.56209743",
"0.5598513",... | 0.6946218 | 0 |
OverSampling dataset augmentation The main function will augment the given dataset with synthetic instances associated to the less representative target class, through a variant of SMOTE that allows categorical features | def augment_dataset(
data: pd.DataFrame,
categorical_features: list,
target_feature: str = 'target',
k_parameter: int = 3
) -> pd.DataFrame:
categorical_mask = [True if feature in categorical_features else False for feature in data.columns]
smote_obj = SMOTENC(
categori... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_augmentation(data_start, bootstrapping = 1, epurate = 1, shuffle = True):\n data = data_start\n for ii in range(bootstrapping):\n data = data.append(data_start.apply(bootstrap_sample, axis=1), ignore_index=True)\n\n#Bugged version that weirdly works well....\n# for ii in range(bootstrap... | [
"0.65131444",
"0.6334391",
"0.6332209",
"0.6084675",
"0.60128325",
"0.5974864",
"0.59706366",
"0.59543204",
"0.5912447",
"0.5906446",
"0.59053683",
"0.5873833",
"0.5782313",
"0.57742",
"0.5709994",
"0.5664604",
"0.5655073",
"0.56528074",
"0.56390184",
"0.56336075",
"0.5630984... | 0.68285483 | 0 |
Poll the state of the desired object or function. If it has satisfied the conditions then set self.met = True | def poll(self):
self.met = self.button.poll() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_waiting(self):\n if self.variant(map(lambda x: x is not None, self.get_value(0, True))):\n values = list(filter(lambda x: x is not None, self.get_value(0, True)))\n if self.name == \"and\":\n self.set_value(all(values), 0)\n elif self.name == \"or\"... | [
"0.66824806",
"0.62724024",
"0.5977828",
"0.59290147",
"0.58938897",
"0.5846778",
"0.5832903",
"0.5807848",
"0.5762693",
"0.57616085",
"0.5733542",
"0.5675724",
"0.5674254",
"0.5666325",
"0.5660967",
"0.5660771",
"0.5655862",
"0.5641411",
"0.56305623",
"0.563001",
"0.5622941"... | 0.6363389 | 1 |
Extract the cell and previous output tensors from the given state. | def _extract_states(self, state):
conf = self._config
# c_prev is `m` (cell value), and
# m_prev is `h` (previous output) in the paper.
# Keeping c and m here for consistency with the codebase
c_prev = [None] * conf.num_dims
m_prev = [None] * conf.num_dims
# for LSTM : state = memory cel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_hidden_states(self, output):\n # Intermediate hidden states\n output_fw_intermediate = output[:,:-1,0:self._hidden_size]\n output_bw_intermediate = output[:,1:,self._hidden_size:] \n \n # Last hidden states\n output_fw = output[:,-1,0:self._hidden_size]\n ... | [
"0.6254729",
"0.621857",
"0.62071514",
"0.60771316",
"0.60678285",
"0.603823",
"0.5995742",
"0.59708154",
"0.5964992",
"0.59554535",
"0.5947492",
"0.59370697",
"0.5930274",
"0.58716804",
"0.58503854",
"0.58397615",
"0.5837682",
"0.5797076",
"0.5784501",
"0.5777019",
"0.577603... | 0.77416164 | 0 |
Fills in c_prev and m_prev with projected input, for input dimensions. | def _project_input(self, inputs, c_prev, m_prev, with_c):
conf = self._config
if (inputs is not None and inputs.get_shape().with_rank(2)[1].value > 0 and
conf.inputs):
if isinstance(inputs, tuple):
if len(conf.inputs) != len(inputs):
raise ValueError('Expect inputs as a tuple of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _fill_input(self):\n for sc in self.initial:\n if sc not in self.litter:\n self.litter[sc] = [0., 0., 0., 0., 0., 0.,\n 0., 0., 0., 0., 0., 0.]\n for sc in self.litter:\n if sc not in self.initial:\n self.initia... | [
"0.5634379",
"0.54966336",
"0.5421961",
"0.5361681",
"0.5354127",
"0.5279189",
"0.52652067",
"0.5243889",
"0.51665807",
"0.5126918",
"0.505492",
"0.50408214",
"0.50399375",
"0.5025519",
"0.5015747",
"0.4957982",
"0.4923652",
"0.49223214",
"0.49137396",
"0.48995847",
"0.489251... | 0.65848684 | 0 |
Total size of the state of the inner cell used in this grid. | def _cell_state_size(self):
state_sizes = self._cells[0].state_size
if isinstance(state_sizes, tuple):
return sum(state_sizes)
return state_sizes | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_size(self):\n raise NotImplementedError(\"Please implement this method\")",
"def size(self):\n\n # Replace by correct code\n if self.right and self.left:\n return self.left.height() + self.right.height()\n elif not self.right:\n return self.left.size()\... | [
"0.74167323",
"0.7394969",
"0.7364005",
"0.72789454",
"0.7233926",
"0.72176397",
"0.7182249",
"0.7145923",
"0.714297",
"0.7078754",
"0.70768565",
"0.706027",
"0.7049083",
"0.69589293",
"0.69470435",
"0.6859403",
"0.68581504",
"0.68440723",
"0.68406284",
"0.6830058",
"0.681499... | 0.8483224 | 0 |
Propagates through all the cells in dim_indices dimensions. | def _propagate(dim_indices, conf, cells, c_prev, m_prev, new_output, new_state,
first_call):
if len(dim_indices) == 0:
return
# Because of the way RNNCells are implemented, we take the last dimension
# (H_{N-1}) out and feed it as the state of the RNN cell
# (in `last_dim_output`).
# The i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def iterate_indices(self, indices):\n for iD in reversed(range(self.get_n_dimensions())):\n indices[iD] += 1\n if indices[iD] < self.get_n_points_of_dim(iD): return True\n indices[iD] = 0\n return False",
"def flattened_indices_from_row_col_indices(row_indices, col_... | [
"0.57592505",
"0.5570539",
"0.5558024",
"0.5444846",
"0.53574795",
"0.5317625",
"0.530076",
"0.5242168",
"0.5230099",
"0.52238643",
"0.5221276",
"0.52102256",
"0.5180341",
"0.5174899",
"0.5166367",
"0.51390105",
"0.51300037",
"0.51170236",
"0.5116153",
"0.5102122",
"0.5083281... | 0.5909939 | 0 |
open log system by the specified outputs | def open(
self,
stdout = True,
outputs = {
"fulltrace": logging.INFO,
"error": logging.ERROR,
}
):
# create logger
self.__logger = logging.getLogger("log-{0}".format(self.case))
self.__logger.setLevel(logging.INFO)
# create st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def os_open_comm_log( self, ):\r\n AppGlobal.os_open_txt_file( self.parameters.comm_logging_fn )",
"def open_logs():\n\treturn log, action_log, error_log",
"def os_open_logfile( self, ):\r\n# from subprocess import Popen, PIPE # since infrequently used ??\r\n# try:\r\n# proc... | [
"0.67284155",
"0.6485244",
"0.636459",
"0.6248124",
"0.5992473",
"0.5959826",
"0.5808679",
"0.58042496",
"0.57708997",
"0.5702396",
"0.5680487",
"0.5680422",
"0.5667048",
"0.5660056",
"0.5642496",
"0.563012",
"0.5624527",
"0.5568184",
"0.55524683",
"0.5546289",
"0.55246276",
... | 0.66932267 | 1 |
close log system, flush all messages to log file, and clear message counters | def close(self):
if not self.__closed:
self.counters = { "error": 0, "warning": 0, "success": 0, "failure": 0 }
try:
self.__flush_count = 0
for handler in self.__filehandlers:
handler.flush()
self.__logger.removeHan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_logs(self):\n\n _now = time.time()\n\n for _id in self.open_logs.keys():\n try:\n if _now > (self.open_logs[_id]['last_time'] + self.FILE_ACTIVITY_TIMEOUT):\n # Flush and close the log file, and pop this element from the dictionary.\n ... | [
"0.72784734",
"0.68769825",
"0.6847598",
"0.67756563",
"0.6773409",
"0.6747613",
"0.667187",
"0.66417915",
"0.6624585",
"0.65101445",
"0.65043885",
"0.6474237",
"0.64684594",
"0.6466261",
"0.6453563",
"0.64351887",
"0.6401699",
"0.6381342",
"0.6367956",
"0.63657",
"0.6359584"... | 0.7468183 | 0 |
Go to gmail, with account number arg | def gmail(arg):
if not arg:
return GOOGLE_MAIL
search_content = arg
account_num = '0'
ret_url = GOOGLE_MAIL + account_num + (('/#search/' + search_content) if search_content else '')
print('returning url {}'.format(ret_url))
return ret_url | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n #Gmail2TelegramClient(\"1234\") -- a person\n #Gmail2TelegramClient(\"-1234\") -- group chat",
"def go():\n # Authenticate\n print('****************** Authenticate ******************')\n\n creds = None\n\n if os.path.exists('token.pickle'):\n with open('token.pickle', 'rb')... | [
"0.56608653",
"0.53547925",
"0.52833456",
"0.5283291",
"0.5270684",
"0.5269856",
"0.5201767",
"0.5170543",
"0.5168845",
"0.5124337",
"0.5095251",
"0.50902385",
"0.50887936",
"0.50762486",
"0.5065629",
"0.49647686",
"0.4942289",
"0.49299094",
"0.49123013",
"0.4907412",
"0.4903... | 0.7079969 | 0 |
Check inventory for `parameters.component_versions`. Raise an error if the parameter has any contents. | def check_parameters_component_versions(cluster_parameters):
cvers = cluster_parameters.get("component_versions", {})
if len(cvers.keys()) > 0:
raise click.ClickException(
"Specifying component versions in parameter `component_versions` "
+ "is no longer suppported. Please migrat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_versions(context, num=0, versions='', ecosystem='', package=''):\n versions = split_comma_separated_list(versions)\n vrsns = context.response.json()['items']\n assert len(vrsns) == num\n for v in vrsns:\n assert v['ecosystem'] == ecosystem\n assert v['package'] == package\n ... | [
"0.66057485",
"0.5989785",
"0.5859694",
"0.58123887",
"0.5766892",
"0.5640826",
"0.5549726",
"0.5457705",
"0.5453765",
"0.5416766",
"0.5403869",
"0.53832746",
"0.53551334",
"0.5340889",
"0.53105223",
"0.5248438",
"0.5226558",
"0.52160615",
"0.5213269",
"0.5205904",
"0.5196453... | 0.74392253 | 0 |
Convert time to localized time | def toLocalizedTime(self, time, long_format=None, time_only = None):
util = getToolByName(self.context, 'translation_service')
try:
return util.ulocalized_time(time, long_format, time_only, self.context,
domain='plonelocales')
except TypeError:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def localize_time(self, apitime):\n return self.feedzone.localize(apitime).astimezone(self.localzone)",
"def standardTime(time):\n time = localize(time)\n return time.strftime('%m/%d/%Y').lstrip('0') + ' @ ' + time.strftime('%I:%M%p').lstrip('0') if time is not None else ''",
"def localize_time_ut... | [
"0.703785",
"0.6615765",
"0.6577593",
"0.6577593",
"0.635431",
"0.6297248",
"0.6270653",
"0.62315124",
"0.6193654",
"0.61101365",
"0.60992676",
"0.60587406",
"0.6055114",
"0.6006707",
"0.6003571",
"0.5984953",
"0.59257454",
"0.5897985",
"0.5889264",
"0.5858623",
"0.5852011",
... | 0.7369995 | 0 |
Dynamically collect class inherited from Quiz. | def _collect_quizzes():
data_path = join(dirname(abspath(__file__)), 'data')
for _, _, filenames in os.walk(data_path):
for filename in filenames:
if filename.endswith('.yml'):
quiz_type = filename.replace('.yml', '').capitalize()
QUIZ_DICT[quiz_type] = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def derived_classes(self, what: Union[GDScriptClass, str, int]):\n base_cls: Optional[GDScriptClass] = None\n if isinstance(what, GDScriptClass):\n base_cls = what\n else:\n base_cls = self.get_class(what)\n\n for cls in self._classes_by_type_id.values():\n ... | [
"0.63427395",
"0.57012355",
"0.56704605",
"0.56692797",
"0.5649789",
"0.5625043",
"0.55808693",
"0.5465082",
"0.54380417",
"0.5428275",
"0.541787",
"0.5366975",
"0.5366287",
"0.5360078",
"0.5358948",
"0.53288174",
"0.5323924",
"0.53231007",
"0.53199655",
"0.5303679",
"0.52709... | 0.6018465 | 1 |
Initializes the DataGrid. Iterates over all rows and columns, preparing cell structures. Cells then contain a graph and data queries to leaf processors. Upon providing data to a leaf, the leaf processor is calculated and propagated up the graph to the cell level. | def initialize(self) -> None:
all_queries: List[Union[DataQueryInfo, MeasureQueryInfo]] = []
entity_cells: List[DataCell] = []
current_row_group = None
# Loop over rows, columns
for row_index, row in enumerate(self.rows):
if isinstance(row, RowSeparator):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_grid(self):\r\n for i in range(self.height):\r\n for j in range(self.width):\r\n self.grid[i][j] = 0\r\n \r\n # fill up unvisited cells\r\n for r in range(self.height):\r\n for c in range(self.width):\r\n if r % ... | [
"0.6875408",
"0.68509495",
"0.68069303",
"0.65123975",
"0.6441067",
"0.61626345",
"0.61555016",
"0.61388314",
"0.61033964",
"0.608208",
"0.60392445",
"0.60288984",
"0.59860337",
"0.5957897",
"0.5954847",
"0.59387654",
"0.5915335",
"0.5914669",
"0.59136945",
"0.5899957",
"0.58... | 0.7138373 | 0 |
Poll the data queries required to process this grid. Set the results at the leaf processors | def poll(self) -> None:
self._resolve_rdates()
self._resolve_queries()
self._process_special_cells()
self._fetch_queries() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\r\n self.collect_data()",
"def execute_queries():\n fetch_job_listings(engine)\n update_job_listing(engine)",
"def fetch_data():\n data.fetch_data()\n data.start_updating()",
"def run(self):\n\n import time\n LOGGER.info(\"Caching thread started !\")\n\n ... | [
"0.61636525",
"0.6151769",
"0.5917222",
"0.58368677",
"0.5788536",
"0.57568854",
"0.57138926",
"0.56979024",
"0.5688257",
"0.5617467",
"0.5611516",
"0.5585752",
"0.55766773",
"0.5563649",
"0.55532974",
"0.5550569",
"0.5539961",
"0.55218184",
"0.5519797",
"0.551745",
"0.549569... | 0.73168904 | 0 |
Saves the DataGrid. If the DataGrid has already been created, the DataGrid will be updated. If the DataGrid has not been created it will be added to the DataGrid service. | def save(self) -> str:
datagrid_json = self.__as_json()
if self.id_:
response = GsSession.current._put(f'{API}/{self.id_}', datagrid_json, request_headers=DATAGRID_HEADERS)
else:
response = GsSession.current._post(f'{API}', datagrid_json, request_headers=DATAGRID_HEADERS)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n if self.id_:\n GsSession.current._delete(f'{API}/{self.id_}', request_headers=DATAGRID_HEADERS)\n else:\n raise MqValueError('DataGrid has not been persisted.')",
"def save_data(self):\n db.session.add(self)\n db.session.commit( )",
"def cre... | [
"0.6187653",
"0.60737556",
"0.60129654",
"0.5870143",
"0.5790092",
"0.57797855",
"0.5779276",
"0.5763803",
"0.5661602",
"0.5656854",
"0.56475914",
"0.5622995",
"0.5618377",
"0.56170213",
"0.56170213",
"0.56170213",
"0.56170213",
"0.561614",
"0.561614",
"0.561614",
"0.561614",... | 0.70972776 | 0 |
Creates a new DataGrid even if the DataGrid already exists. If the DataGrid has already been persisted, the DataGrid id will be replaced with the newly persisted DataGrid. | def create(self):
datagrid_json = self.__as_json()
response = GsSession.current._post(f'{API}', datagrid_json, request_headers=DATAGRID_HEADERS)
self.id_ = response['id']
return response['id'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self) -> str:\n datagrid_json = self.__as_json()\n if self.id_:\n response = GsSession.current._put(f'{API}/{self.id_}', datagrid_json, request_headers=DATAGRID_HEADERS)\n else:\n response = GsSession.current._post(f'{API}', datagrid_json, request_headers=DATAGRI... | [
"0.6025521",
"0.5763397",
"0.575753",
"0.5500374",
"0.53916675",
"0.5337155",
"0.5181364",
"0.5127632",
"0.5127632",
"0.5127632",
"0.49467427",
"0.49176842",
"0.4912926",
"0.48753095",
"0.48178405",
"0.48100233",
"0.48089635",
"0.47999093",
"0.47999093",
"0.47948393",
"0.4791... | 0.66579413 | 0 |
Deletes the DataGrid if it has been persisted. | def delete(self):
if self.id_:
GsSession.current._delete(f'{API}/{self.id_}', request_headers=DATAGRID_HEADERS)
else:
raise MqValueError('DataGrid has not been persisted.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n if Model.data_connector:\n with Model.data_connector.u_lock:\n Model.data_connector.remove_object(self)",
"def delete_grid(self):\n\n\t\tself.a_grid = None\t\t# Deletes the object from memory",
"def delete(self):\n if not self.isNew:\n #We ... | [
"0.67800015",
"0.64969146",
"0.64883953",
"0.64842826",
"0.63459814",
"0.63309866",
"0.63012457",
"0.62367415",
"0.62367415",
"0.62184536",
"0.6206068",
"0.61883914",
"0.61383134",
"0.6135124",
"0.6120536",
"0.610956",
"0.610956",
"0.6082637",
"0.6075714",
"0.6075714",
"0.607... | 0.82767075 | 0 |
Opens the DataGrid in the default browser. | def open(self):
if self.id_ is None:
raise MqValueError('DataGrid must be created or saved before opening.')
domain = GsSession.current.domain.replace(".web", "")
if domain == 'https://api.gs.com':
domain = 'https://marquee.gs.com'
url = f'{domain}/s/markets/grids... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_in_browser(self):\n webbrowser.open(self.url)",
"def on_OpenExplorer_clicked(self):\n # TODO: not implemented yet\n #raise NotImplementedError\n\n url=\"http://kfc.matrix.io\"\n\n self.browser.openurl(url)\n self.OnlyDisplay(f\"start {url}\")\n #MATRIXWeb... | [
"0.6684423",
"0.6295892",
"0.60630506",
"0.6011398",
"0.5945774",
"0.5920018",
"0.5900473",
"0.58411974",
"0.5792295",
"0.57660633",
"0.57613224",
"0.57578784",
"0.5740384",
"0.5725768",
"0.5719649",
"0.5717693",
"0.56893307",
"0.5677102",
"0.5672921",
"0.56497353",
"0.563292... | 0.77590376 | 0 |
Processes Coordinate and Entity cells | def _process_special_cells(self) -> None:
# fetch entity cells
for cell in self._entity_cells:
try:
cell.value = cell.processor.process(cell.entity)
except Exception as e:
cell.value = f'Error Calculating processor {cell.processor.__class__.__name_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_cell(self, neighbourhood: List[Cell], old_cell: Cell) -> Cell:",
"def _process_unknown_entity(self, entity):\n is_complex_agent = False\n complex_agent_x, complex_agent_y = None, None\n if len(entity.get(\"children\")) > 1: # entities separeted by .\n is_complex_agent... | [
"0.6397536",
"0.6131805",
"0.61076164",
"0.5984226",
"0.5973159",
"0.58404166",
"0.5821357",
"0.5820955",
"0.5820068",
"0.5778048",
"0.5722136",
"0.56217426",
"0.56162345",
"0.55035067",
"0.5484876",
"0.5481517",
"0.54765755",
"0.5463816",
"0.5458055",
"0.5457311",
"0.5445281... | 0.7494057 | 0 |
Handles filtering the dataframe | def __handle_filters(self, df) -> DataFrame:
if not len(df):
return df
starting_df = df.copy()
running_df = df
for filter_ in self.filters:
filter_value = filter_.value
if filter_value is None:
continue
filter_condition = fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_data(self):\n self.data = filter_pandas(self.data, self.filters)",
"def _apply_filters(self, df):\n df = df[(df['Date'] >= self.start_date) &\n (df['Date'] <= self.end_date)]\n return df",
"def _filter(self, col: str, val: Any) -> pd.DataFrame:\n return sel... | [
"0.75450116",
"0.7527067",
"0.7106207",
"0.70941275",
"0.69099504",
"0.6835638",
"0.668364",
"0.65766865",
"0.6532806",
"0.65164167",
"0.6494677",
"0.6437026",
"0.6422723",
"0.6367083",
"0.634997",
"0.63448846",
"0.6331199",
"0.6329497",
"0.6315315",
"0.62829185",
"0.62284046... | 0.76785743 | 0 |
Sets the primary column index which affects which row will expand to fill any additional horizontal space. | def set_primary_column_index(self, index: int):
self._primary_column_index = index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetMainColumn(self, column):\r\n \r\n if column >= 0 and column < self.GetColumnCount():\r\n self._main_column = column",
"def set_column_width(self, index, width):\n self.colwid[index] = width",
"def new_column( self, delta = 1, ):\n self.ix_row = 0\n sel... | [
"0.6253068",
"0.622601",
"0.56428146",
"0.56349957",
"0.55795515",
"0.5508506",
"0.5491382",
"0.5443108",
"0.5424253",
"0.54185617",
"0.5400645",
"0.53756493",
"0.5370024",
"0.53142226",
"0.5314012",
"0.5308569",
"0.52956295",
"0.52930385",
"0.5281541",
"0.5235786",
"0.523185... | 0.75562984 | 0 |
initialize the parent class and the face_mesh model. | def __init__(self):
am.AbstractMeasurement.__init__(self)
self.face_mesh = mp_face_mesh.FaceMesh(
min_detection_confidence=0.5, min_tracking_confidence=0.5)
self.drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mesh):\n self._mesh = mesh",
"def __init__(self, facePredictor = None):\n self.detector = dlib.get_frontal_face_detector()\n if facePredictor != None:\n self.predictor = dlib.shape_predictor(facePredictor)\n else:\n self.predictor = None",
"d... | [
"0.7453505",
"0.6851489",
"0.6842294",
"0.6824078",
"0.6807889",
"0.6781852",
"0.6758116",
"0.66532725",
"0.66532314",
"0.66333944",
"0.644714",
"0.64381653",
"0.6411551",
"0.63970214",
"0.63875043",
"0.6386501",
"0.6369439",
"0.6361478",
"0.6348545",
"0.63335305",
"0.6315081... | 0.71858 | 1 |
run the face detector algorithm on the given frame | def run(self, frame, dict_results):
run_result = {repr(self): False}
try:
# flip the image in order to represent a true self of the person not mirror of it
# and convert its colors.
image = cv2.cvtColor(cv2.flip(frame, 1), cv2.COLOR_BGR2RGB)
# make it read... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect(self, frame): \n return self.__detect_faces(frame)",
"def detector(videoframe, facedetection, maskdetection):\n (h, w) = videoframe.shape[:2]\n blobimage = cv2.dnn.blobFromImage(videoframe, 1.0, (224, 224), (104.0, 177.0, 123.0))\n\n facedetection.setInput(blobimage)\n ffinding = fac... | [
"0.7424859",
"0.73879576",
"0.7330744",
"0.6976193",
"0.6969981",
"0.6937916",
"0.6927771",
"0.6901357",
"0.6865962",
"0.6861393",
"0.6795289",
"0.67905176",
"0.6743164",
"0.6726301",
"0.67228127",
"0.67023045",
"0.6678555",
"0.6610478",
"0.659994",
"0.65542203",
"0.6540022",... | 0.76632166 | 0 |
draw face annotations on the image. | def draw_annotations(self, image, results):
image.flags.writeable = True
image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
for face_landmarks in results.multi_face_landmarks:
# draw face landmark net
mp_drawing.draw_landmarks(
image=image,
lan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highlight_faces(image, faces, output_filename, terminal_print=True):\n im = Image.open(image)\n draw = ImageDraw.Draw(im)\n\n for (face_ind, face) in enumerate(faces):\n\n # compute emotions\n list_emotion_scores = [face.sorrow_likelihood,\n face.joy_likelih... | [
"0.674381",
"0.64639515",
"0.6455256",
"0.6397378",
"0.6365749",
"0.62797916",
"0.6194046",
"0.6157156",
"0.6145342",
"0.61066806",
"0.6093688",
"0.60922325",
"0.6092027",
"0.6053211",
"0.6005659",
"0.59828454",
"0.5963635",
"0.59635484",
"0.59366",
"0.59176415",
"0.5884032",... | 0.7613264 | 0 |
test the faceDetector measurement by static labeled images and print the test results. | def test_measurement_on_images(file_list):
test_details_list = []
for idx, file in enumerate(file_list):
dict_results = {}
image = cv2.imread(file)
FaceDetector().run(image, dict_results)
file_name = ntpath.basename(file)
is_there_face = "True" in file_name
test_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_all_result(self, image):\r\n for facebox, conf in self.detection_result:\r\n cv2.rectangle(image, (facebox[0], facebox[1]),\r\n (facebox[2], facebox[3]), (0, 255, 0))\r\n label = \"face: %.4f\" % conf\r\n label_size, base_line = cv2.getTextS... | [
"0.66228527",
"0.659431",
"0.64895236",
"0.6478676",
"0.6398069",
"0.62773156",
"0.62493277",
"0.62150615",
"0.6189936",
"0.6179945",
"0.61758375",
"0.61259943",
"0.6108551",
"0.60936356",
"0.6090827",
"0.60888547",
"0.6081325",
"0.60809964",
"0.6080578",
"0.60498834",
"0.604... | 0.6968366 | 0 |
Return raw labels and training data(numpy) | def get_raw_data():
with open('train_label.pkl', 'rb') as f:
train_label = pickle.load(f)
with open('train_image.pkl', 'rb') as f:
train_data = pickle.load(f)
print(np.unique(np.asarray(train_label)))
return (train_label, np.asarray(train_data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_raw_data(self):\n\t\tfilter = self.predictions.max(1) > self.confidence\n\t\tdata = self.test_data[filter, :]\n\t\tlabels = self.predictions[filter, :].argmax(1).astype(uint16) + 1\n\t\treturn data, labels",
"def _read_train_datas(self):\r\n with open(self.train_label_path, 'r') as fb:\r\n ... | [
"0.75021726",
"0.749079",
"0.7386946",
"0.7299602",
"0.7225183",
"0.7085237",
"0.7025032",
"0.70176214",
"0.7006498",
"0.6999984",
"0.69948584",
"0.6989723",
"0.69697154",
"0.6964406",
"0.69023204",
"0.6843882",
"0.6831457",
"0.68127894",
"0.68122244",
"0.68002385",
"0.675603... | 0.802378 | 0 |
Get minimum cycle counter in AI CPU. | def min_cycle_counter(self):
return self._min_cycle_counter | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_count(self) -> pulumi.Input[int]:\n return pulumi.get(self, \"minimum_count\")",
"def cpu(self) -> int:\n return pulumi.get(self, \"cpu\")",
"def min_network_performance(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"min_network_performance\")",
"def data_f... | [
"0.63637954",
"0.62593216",
"0.6257146",
"0.6253457",
"0.6237119",
"0.61412126",
"0.61412126",
"0.61412126",
"0.61412126",
"0.6113138",
"0.6090414",
"0.6066499",
"0.60524917",
"0.60461205",
"0.6015589",
"0.6015589",
"0.6014585",
"0.6010536",
"0.60010546",
"0.59938896",
"0.598... | 0.8085388 | 0 |
To be used in constant folding. If this expression is folded as part of a declaration/assignment, returns the type of the variable. Otherwise, returns the 'default' expression type. | def result_type(self):
anc = self.find_ancestor(ASTDeclarationNode) or self.find_ancestor(ASTAssignmentNode)
if anc:
return anc.type()
return get_expression_type(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _infer_type(var, code_chunk, context):\n\n # Get all the assignments in the code chunk.\n visitor = let_statement_visitor(var)\n code_chunk.accept(visitor)\n\n # Look at each assignment statement and check out the ones where the current\n # variable is assigned.\n str_funcs = [\"cstr(\", \"ch... | [
"0.6519886",
"0.62009716",
"0.6042512",
"0.57902503",
"0.57106084",
"0.56543374",
"0.5565833",
"0.5468178",
"0.5373417",
"0.53604025",
"0.5339699",
"0.5315203",
"0.52742463",
"0.52240497",
"0.51767826",
"0.5173928",
"0.51497954",
"0.5110091",
"0.50905895",
"0.50885314",
"0.50... | 0.6263858 | 1 |
Calculates the branching ratio for the generalised decay constant. This ratio must be multiplied by 1/tau to get the generalised decay constant in Grad/s. This is then used for evaluating vertical coherences. | def generalisedDecayConstant(ep, epp, g, G, Q_decay):
# Calculate the total branching from the excited state to all ground states
sum_decay_channels_epg = 0
sum_decay_channels_eppg = 0
for gp in G:
for q in Q_decay:
sum_decay_channels_epg += abs(coupling(ep, gp, q)*coupling(ep, gp, q... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adv_ratio(self): # XXX\r\n bw = StatsRouter.global_bw_mean\r\n if bw == 0.0: return 0\r\n else: return self.bw/bw",
"def golden_ratio():\n return 1.61803398875",
"def golden_ratio():\n print((1+math.sqrt(5))/2)",
"def test_GBL_tau_star():\n z = 1.0\n\n # Fully ionized H and He\n x... | [
"0.59775317",
"0.59181684",
"0.5764655",
"0.57501674",
"0.57006925",
"0.5673774",
"0.56445265",
"0.55199826",
"0.5463409",
"0.5456587",
"0.5454166",
"0.5435765",
"0.5433648",
"0.5407084",
"0.5347989",
"0.5288943",
"0.5280281",
"0.5246976",
"0.52277154",
"0.5210331",
"0.520709... | 0.6258796 | 0 |
Given an array of numbers arr. A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same.Return true if the array can be rearranged to form an arithmetic progression, otherwise, return false. >>> canMakeArithmeticProgression([3,5,1]) True >>> canMakeAri... | def canMakeArithmeticProgression(arr):
new_arr = sorted(arr)
diff = new_arr[1] - new_arr[0]
for idx, num in enumerate(new_arr):
if idx == 0:
pass
elif num - new_arr[idx - 1] != diff:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Progression(arr):\n\n # Check if array is with at least 3 elements\n if len(arr) < 3: return 0\n\n # Calculate difference between numbers in list\n diffAr = arr[1] - arr[0]\n diffGeo = arr[1] / arr[0]\n\n # Temp vars to check if list is in progression\n isA = True\n isG = True\n\n fo... | [
"0.66149616",
"0.647907",
"0.6376644",
"0.6320006",
"0.62170225",
"0.62060744",
"0.60170907",
"0.5871938",
"0.5855737",
"0.5823819",
"0.5690678",
"0.5627322",
"0.5579443",
"0.5552384",
"0.55418354",
"0.5513993",
"0.5461593",
"0.54601616",
"0.5458909",
"0.5411442",
"0.5406272"... | 0.864427 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.