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 |
|---|---|---|---|---|---|---|
Updates hardware_control based on the widget being checked | def _update_hardware_control_from_gui(self):
self._under_hardware_control = self.widgets['hardware_control'].isChecked() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_hardware_control(self, value):\n self.widgets['hardware_control'].setChecked(value)\n self._under_hardware_control = value",
"def update(self):\n #update checkboxes\n self.average_check_box.SetValue(self.parent.fftsink.average)\n self.use_persistence_check_box.SetValue(... | [
"0.7537354",
"0.6053899",
"0.6034029",
"0.59560686",
"0.5829578",
"0.5829035",
"0.57404166",
"0.5730444",
"0.57228154",
"0.5716257",
"0.571111",
"0.5706572",
"0.5669908",
"0.56695765",
"0.56612366",
"0.56506187",
"0.56427896",
"0.56363565",
"0.5615632",
"0.56057274",
"0.55408... | 0.87057966 | 0 |
Updates the power reading text on the GUI | def _update_power_label(self):
#Checks if > 0.5s has elapsed since the last change to the power reading label
#I do this since otherwise the text label updates too quickly and it's annoying
#to read.
currTime = time.time()
if currTime - self._last_power_text_update > 0.5:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Update(self, mode = UPDATE_MODE.all):\r\n aux_versions = dstore.Get(\"versions\")\r\n \r\n if(aux_versions['hw'] != None): \r\n Ui().lineHwVersion.setText(str(aux_versions['hw'])) \r\n else:\r\n Ui().lineHwVersion.setText... | [
"0.66568124",
"0.6600302",
"0.63396484",
"0.63212717",
"0.626569",
"0.62451917",
"0.62050587",
"0.61857045",
"0.61414963",
"0.6130439",
"0.61217785",
"0.6098589",
"0.606162",
"0.6019479",
"0.6007645",
"0.59969217",
"0.5988557",
"0.595387",
"0.5938942",
"0.59360445",
"0.591033... | 0.79688066 | 0 |
Updates the output voltage label to the current voltage being outputted. This is called when the laser is "locked" and the PID loop is actively changing the output voltage | def _update_output_voltage_label(self):
self.widgets['p_outputVoltage'].setValue((self._curr_output_voltage)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_output_voltage_from_label(self):\n if (~self._is_stabilizing): #Only updates value if we are not stabilizing, otherwise the PID loop will be driving the output voltage\n #as opposed to the user.\n self._curr_output_voltage = self.widgets['p_outputVoltag... | [
"0.86768293",
"0.75235605",
"0.73683",
"0.6901445",
"0.6560296",
"0.6503128",
"0.6420002",
"0.64133865",
"0.6375068",
"0.6369727",
"0.636416",
"0.63497466",
"0.63417727",
"0.6259403",
"0.61915195",
"0.6165251",
"0.61429423",
"0.6125383",
"0.5998575",
"0.5986245",
"0.59737235"... | 0.87312424 | 0 |
Updates the output control voltage based on the text in the output voltage text box. This method is automatically run when the user changes the value in the text box, allowing the user to control the output voltage directly when the laser power is not "locked". | def _set_output_voltage_from_label(self):
if (~self._is_stabilizing): #Only updates value if we are not stabilizing, otherwise the PID loop will be driving the output voltage
#as opposed to the user.
self._curr_output_voltage = self.widgets['p_outputVoltage'].valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_output_voltage_label(self):\n self.widgets['p_outputVoltage'].setValue((self._curr_output_voltage))",
"def set_control_voltage(self, value):\n self._curr_output_voltage = value\n self._update_output_voltage_label()",
"def set_output_voltage(self, output_voltage, output_port = o... | [
"0.8174182",
"0.75136",
"0.6978042",
"0.69540447",
"0.6786127",
"0.678343",
"0.67531073",
"0.66309124",
"0.66028297",
"0.655654",
"0.6517861",
"0.64178216",
"0.6394018",
"0.6364048",
"0.6340842",
"0.6326381",
"0.6299824",
"0.6291961",
"0.6254012",
"0.6247799",
"0.6165654",
... | 0.77287716 | 1 |
Allows an external program to directly set the control/output voltage in use by the stabilizer | def set_control_voltage(self, value):
self._curr_output_voltage = value
self._update_output_voltage_label() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _set_output_voltage_from_label(self):\n if (~self._is_stabilizing): #Only updates value if we are not stabilizing, otherwise the PID loop will be driving the output voltage\n #as opposed to the user.\n self._curr_output_voltage = self.widgets['p_outputVoltag... | [
"0.7024224",
"0.6937911",
"0.6917821",
"0.6887441",
"0.6882729",
"0.68348175",
"0.6834041",
"0.676967",
"0.676372",
"0.66738194",
"0.66340613",
"0.6613438",
"0.64863926",
"0.6474095",
"0.64466125",
"0.6388839",
"0.6372111",
"0.6298631",
"0.6152904",
"0.6147114",
"0.6120982",
... | 0.71725106 | 0 |
Update the voltage setpoint to whatever value is currently in the setpoint spin box | def _update_voltageSetpoint_fromGUI(self):
self.voltageSetpoint = self.widgets['p_setpoint'].value()/self.gain | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_setpoint(self, value):\n self.voltageSetpoint = value/self.gain\n self.widgets['p_setpoint'].setValue(value)\n #Need to reset the PID loop with this new setpoint value\n self._update_PID()",
"def on_spinBox_valueChanged(self, p0):\n self.nbr_pts_caracterisation = self.s... | [
"0.7551044",
"0.7197047",
"0.7195143",
"0.70570076",
"0.69075614",
"0.67191017",
"0.66816556",
"0.66758114",
"0.66145205",
"0.65183496",
"0.6517884",
"0.6512107",
"0.65120155",
"0.6421457",
"0.6389189",
"0.63613814",
"0.6354926",
"0.63446605",
"0.63266104",
"0.6318307",
"0.62... | 0.836005 | 0 |
Updates the power setpoint, for use by external programs wishing to interface with this one. | def set_setpoint(self, value):
self.voltageSetpoint = value/self.gain
self.widgets['p_setpoint'].setValue(value)
#Need to reset the PID loop with this new setpoint value
self._update_PID() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _update_voltageSetpoint_fromGUI(self):\n self.voltageSetpoint = self.widgets['p_setpoint'].value()/self.gain",
"def set_setpoint(self, value):\n value = value * self.conf['PSICONV']\n log.debug(\"Set pressure regulator %d to %f\", self.id_, value)\n self.synth.cbox.set_dac(self.id... | [
"0.67093927",
"0.6139946",
"0.59940267",
"0.5886405",
"0.58322847",
"0.58322847",
"0.57975775",
"0.57975775",
"0.57975775",
"0.57480216",
"0.5733487",
"0.5705446",
"0.5703208",
"0.56821555",
"0.56507874",
"0.5611109",
"0.55992657",
"0.5586657",
"0.5575267",
"0.5563422",
"0.55... | 0.6482329 | 1 |
Creates a new PID object based on the current PID member variables to be used for power feedbacking | def _update_PID(self):
self.pid = PID(p=self.paramP, i=self.paramI, d=self.paramD, setpoint=self.voltageSetpoint, memory=self.paramMemory) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ppid(self):",
"def dynamic_pid(self):\n pass",
"def __init__(self, pvID, pvP, pvQ, pvDescriptor):\n\n # TODO: implement this",
"def create_entity(self):\n \n if self.ORION_CB.get_entity(self.params['name']) is None:\n \n print('[INFO]: Create new PID enti... | [
"0.6403323",
"0.6256226",
"0.6253684",
"0.60611475",
"0.6023733",
"0.6017484",
"0.5905685",
"0.5836553",
"0.5782644",
"0.5770235",
"0.5732038",
"0.569442",
"0.56593156",
"0.5647622",
"0.5630679",
"0.5549715",
"0.5549715",
"0.5472046",
"0.5453043",
"0.5441365",
"0.53801626",
... | 0.72997856 | 0 |
Test api Get all the users | def test_api_can_get_all_users(self):
response = self.client().get('/api/v1/user/')
self.assertTrue(response.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_fetch_all_user(self):\n\n payload = self.get_req('api/v1/users')\n self.assertEqual(payload.status_code, 200)\n self.assertEqual(payload.json['users'], [])",
"def test_get_all_users(self):\n created_30_days_ago = datetime.datetime.utcnow() + datetime.timedelta(-30)\n a... | [
"0.869498",
"0.83159864",
"0.82164174",
"0.82077795",
"0.81848764",
"0.81795245",
"0.8039775",
"0.80138654",
"0.8011747",
"0.8011747",
"0.80085105",
"0.80024284",
"0.7985461",
"0.79505664",
"0.7949807",
"0.79328257",
"0.7802099",
"0.7719796",
"0.77042687",
"0.7688526",
"0.765... | 0.89917773 | 0 |
Test api can get a users by id | def test_api_can_get_users_by_id(self):
rv = self.client().post('/api/v1/user/',
data = self.req)
res = self.client().get('/api/v1/user/3')
self.assertEquals(res.status_code, 200) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_api_user_get(self):\n pass",
"def test_getUser(self):\n\t\turl = \"/users/2/\"\n\t\tresponse = self.client.get(url, format='json')\n\t\tself.assertEqual(response.status_code, status.HTTP_200_OK)\n\t\tself.assertEqual(response.data[\"id\"], 2)\n\t\tself.assertEqual(response.data[\"username\"], \"t... | [
"0.81065226",
"0.7816911",
"0.7776593",
"0.7776593",
"0.7746049",
"0.76905054",
"0.7634237",
"0.7584148",
"0.75766575",
"0.755071",
"0.7522896",
"0.748282",
"0.7374766",
"0.7249184",
"0.7234273",
"0.72244555",
"0.72155386",
"0.716782",
"0.7155042",
"0.71496236",
"0.71312124",... | 0.8959683 | 0 |
Test api can create a users | def test_api_can_create_users(self):
res = self.client().post('/api/v1/user/', data = self.req)
self.assertEquals(res.status_code, 200)
self.assertIn('mary', str(res.data)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_able_to_create_a_user():\n response = api_helper.create_user(pytest.test_user)\n assert response.status_code == 201\n check_user_data_in_response(response.json()[\"data\"])",
"def test_create_user(self):\n pass",
"def test_create_user(self):\n pass",
"def test_create_user(self... | [
"0.82718086",
"0.82564837",
"0.82564837",
"0.82564837",
"0.82460296",
"0.8224692",
"0.80256295",
"0.8014462",
"0.80112034",
"0.79581463",
"0.7924439",
"0.7820544",
"0.78131205",
"0.7799",
"0.7794324",
"0.778519",
"0.778519",
"0.7776685",
"0.7764455",
"0.7756855",
"0.7754141",... | 0.8786353 | 0 |
Generate a commanded position, velocity and yaw based on the trajectory | def trajectory_control(self,position_trajectory,
yaw_trajectory,
time_trajectory,
current_time):
ind_min = np.argmin(np.abs(np.array(time_trajectory)-current_time))
time_ref = time_trajectory[ind_min]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_trajectory(t, v, waypoints, coeff_x, coeff_y, coeff_z):\n global yaw\n global current_heading\n yawdot = 0.0\n pos = np.zeros(3)\n acc = np.zeros(3)\n vel = np.zeros(3)\n jerk = np.zeros(3)\n snap = np.zeros(3)\n yawddot = 0.0\n\n # distance vector array, represents each ... | [
"0.7423539",
"0.66624177",
"0.6440654",
"0.62494177",
"0.62406516",
"0.62399036",
"0.6076807",
"0.6071118",
"0.59952617",
"0.59462184",
"0.59445816",
"0.5938334",
"0.5935856",
"0.59122837",
"0.5894206",
"0.5880433",
"0.58785534",
"0.5867887",
"0.5834048",
"0.58334523",
"0.582... | 0.7049658 | 1 |
Generate vertical acceleration (thrust) command | def altitude_control(self, altitude_cmd,
vertical_velocity_cmd,
altitude,
vertical_velocity,
attitude,
acceleration_ff=0.0):
hdot_cmd = self.Kp_alt * (altitude_cmd - altitude) + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acceleration(v,u,t):\n return ((v-u)/t)",
"def cmd_velocity(self, vn, ve, vd, heading):\n pass",
"def computeTrajectoryWithDecceleration(self, cmd_vel, current_speed, delay_time, time_applied, time_decc):\n accs = [self.robot.acc_x, self.robot.acc_th, self.robot.dacc_x,self.robot.dacc_th ]... | [
"0.6242462",
"0.60378283",
"0.5884421",
"0.57984126",
"0.5753355",
"0.56302655",
"0.5609823",
"0.5575565",
"0.55670893",
"0.5563418",
"0.5552017",
"0.55361015",
"0.553391",
"0.5465061",
"0.54566216",
"0.5452906",
"0.5438225",
"0.54032683",
"0.5359112",
"0.5345518",
"0.5334337... | 0.619276 | 1 |
Generate the rollrate and pitchrate commands in the body frame | def roll_pitch_controller(self, acceleration_cmd, attitude, thrust_cmd):
#Calculate rotation matrix
R = euler2RM(attitude[0], attitude[1], attitude[2])
c_d = thrust_cmd/DRONE_MASS_KG
if thrust_cmd > 0.0:
target_R13 = -np.clip(acceleration_cmd[0].item()/c_d, -... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_roll_pitch_yaw_rate(self):\n return np.asarray([self._robot_state.roll_rate, self._robot_state.pitch_rate, self._robot_state.yaw_rate])",
"def base_roll_pitch_yaw(self):\n #raise NotImplementedError('Not yet implemented!')\n return np.asarray([self._robot_state.roll, self._robot_state.pitch, se... | [
"0.600574",
"0.56870914",
"0.56655145",
"0.5648231",
"0.5631809",
"0.5598063",
"0.54620904",
"0.5438023",
"0.54291433",
"0.5419752",
"0.53822625",
"0.53808784",
"0.5375544",
"0.5347447",
"0.5311933",
"0.52853644",
"0.52546924",
"0.5252692",
"0.5225191",
"0.52118427",
"0.52004... | 0.6305453 | 0 |
Generate the target yawrate | def yaw_control(self, yaw_cmd, yaw):
# Ensure the target is within range of 0 to 2*pi
yaw_cmd = np.mod(yaw_cmd, 2.0*np.pi)
yaw_error = yaw_cmd - yaw
if yaw_error > np.pi:
yaw_error = yaw_error - 2.0*np.pi
elif yaw_error < -np.pi:
yaw_erro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def yaw_rate(self) -> float:\n return self._state[5]",
"def base_roll_pitch_yaw_rate(self):\n return np.asarray([self._robot_state.roll_rate, self._robot_state.pitch_rate, self._robot_state.yaw_rate])",
"def ROT(self):\n # The maximum update amount for these element\n # no dt since YawR... | [
"0.7615613",
"0.7032515",
"0.67301184",
"0.6561178",
"0.6524339",
"0.6409428",
"0.6381721",
"0.6186662",
"0.6064866",
"0.60448754",
"0.5987767",
"0.5842089",
"0.58199275",
"0.5816168",
"0.58009934",
"0.5781943",
"0.577507",
"0.57193905",
"0.5700633",
"0.565812",
"0.5622117",
... | 0.7520038 | 1 |
derive flask app based on the combination of commandline options and the contents of the .ini files | def app(self):
## set flask specific things that are non-optional
error = lambda k: 'Fatal: You need to specify a "flask" section ' + \
'with an entry like "'+k+'=..." in your .ini file'
try: app_name = self['flask.app']
except KeyError: raise SystemExit(error('app'))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app(\n config_file: str = typer.Option(..., '--config','-c', help='Config file')\n):\n config = Config(config_file)\n if config.mode == 'server':\n server = Server(config)\n server.start()\n elif config.mode == 'client':\n client = Client(config)\n client.start()",
"de... | [
"0.7129765",
"0.6890105",
"0.6876767",
"0.6762991",
"0.661767",
"0.659027",
"0.6555113",
"0.6488689",
"0.6371736",
"0.6314148",
"0.6302245",
"0.6280655",
"0.62723935",
"0.6235607",
"0.62289125",
"0.6226812",
"0.6221567",
"0.62200433",
"0.62091607",
"0.62004334",
"0.6199967",
... | 0.71354246 | 0 |
A function that creates a decorator which will use "cachefile" for caching the results of the decorated function "fn". | def cached():
def decorator(fn): # define a decorator for a function "fn"
cache_name = fn.func_name
def wrapped(*args, **kwargs): # define a wrapper that will finally call "fn" with all arguments
if os.path.exists(cache_name):
with gzip.GzipFile(cache_name, 'rb') as ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cached(cachefile):\n def decorator(fn): # define a decorator for a function \"fn\"\n def wrapped(*args, **kwargs): # define a wrapper that will finally call \"fn\" with all arguments \n # if cache exists -> load it and return its content\n if os.path.exists(cachefi... | [
"0.8379626",
"0.8379626",
"0.8296271",
"0.8254688",
"0.82139444",
"0.7880328",
"0.78647965",
"0.76926875",
"0.765407",
"0.7627374",
"0.7599777",
"0.75677496",
"0.754151",
"0.7532163",
"0.75206435",
"0.75165445",
"0.7485244",
"0.74727625",
"0.744931",
"0.7416763",
"0.7397632",... | 0.84935564 | 0 |
returns an agent's resource url The resource will be looked for in the agent's properties. If it isn't found, it will look for it in the default location. | def get_agent_resource_url(ctx, agent_config, resource):
if agent_config.get(resource):
origin = utils.get_manager_file_server_blueprints_root_url() + \
'/' + ctx.blueprint.id + '/' + agent_config[resource]
else:
resource_path = DEFAULT_AGENT_RESOURCES.get(resource)
if not re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_resource_local_path(ctx, agent_config, resource):\n if agent_config.get(resource):\n origin = agent_config[resource]\n else:\n resource_path = DEFAULT_AGENT_RESOURCES.get(resource)\n if not resource_path:\n raise NonRecoverableError('no such resource: {0}'.format... | [
"0.7100387",
"0.67178667",
"0.6693364",
"0.6693364",
"0.66524416",
"0.6572719",
"0.6500711",
"0.6478797",
"0.6478797",
"0.6478797",
"0.6478797",
"0.6375834",
"0.62469697",
"0.62379724",
"0.61198115",
"0.606946",
"0.6031326",
"0.6013786",
"0.5982946",
"0.5896016",
"0.58576375"... | 0.81056666 | 0 |
returns an agent's resource path The resource will be looked for in the agent's properties. If it isn't found, it will look for it in the default location. | def get_agent_resource_local_path(ctx, agent_config, resource):
if agent_config.get(resource):
origin = agent_config[resource]
else:
resource_path = DEFAULT_AGENT_RESOURCES.get(resource)
if not resource_path:
raise NonRecoverableError('no such resource: {0}'.format(resource))... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_agent_resource_url(ctx, agent_config, resource):\n if agent_config.get(resource):\n origin = utils.get_manager_file_server_blueprints_root_url() + \\\n '/' + ctx.blueprint.id + '/' + agent_config[resource]\n else:\n resource_path = DEFAULT_AGENT_RESOURCES.get(resource)\n ... | [
"0.7533681",
"0.6860353",
"0.6840019",
"0.6802987",
"0.67962813",
"0.6623386",
"0.6526511",
"0.6402395",
"0.6402395",
"0.63555926",
"0.6345799",
"0.6345799",
"0.6267637",
"0.62424225",
"0.620157",
"0.6197518",
"0.6171627",
"0.61677915",
"0.61616135",
"0.61616135",
"0.61616135... | 0.7694797 | 0 |
Parses the source file to return the packages with their current versions. | def parse_versions(self, source):
config = VersionsConfigParser()
has_read = config.read(source)
if not has_read:
logger.warning("'%s' cannot be read.", source)
return []
try:
versions = config.items('versions')
except NoSectionError:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_version_info():\n version = None\n if os.path.exists('.version'):\n with open('.version') as f:\n line = f.read().rstrip()\n log.info('.version contains \"%s\"', line)\n if line.startswith('openafs-'):\n # Extract version from the git tag name.\n ... | [
"0.61708677",
"0.6103998",
"0.57891846",
"0.57264787",
"0.5717269",
"0.5679652",
"0.56734043",
"0.56328624",
"0.5631887",
"0.5610238",
"0.5577528",
"0.55663425",
"0.55570847",
"0.5550549",
"0.55372876",
"0.5530389",
"0.5517335",
"0.5509466",
"0.54764056",
"0.54277015",
"0.542... | 0.6358742 | 0 |
Includes and excludes packages to be checked in the default dict of packages with versions. | def include_exclude_versions(self, source_versions,
includes=[], excludes=[]):
versions = source_versions.copy()
packages_lower = [x.lower() for x in versions.keys()]
excludes_lower = [x.lower() for x in excludes]
for include in includes:
if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_extras_require() -> Dict[str, List[str]]:\n extras = {\n \"testing\": [\n \"pytest==6.1.2\",\n \"pytest-cov==2.10.1\",\n ],\n \"linting\": [\n \"pylint==2.6.0\",\n \"flake8==3.8.4\",\n \"black>=20.8b1\",\n \"darglint=... | [
"0.61390465",
"0.61268306",
"0.6111778",
"0.5894769",
"0.5857268",
"0.58489394",
"0.5845743",
"0.58031565",
"0.57330775",
"0.5704154",
"0.56850886",
"0.56834555",
"0.56450295",
"0.5621943",
"0.5613174",
"0.5603382",
"0.5574903",
"0.5570474",
"0.55632347",
"0.555067",
"0.54861... | 0.67187184 | 0 |
Fetch the latest versions of a list of packages with specifiers, in a threaded manner or not. | def fetch_last_versions(self, packages, allow_pre_releases,
service_url, timeout, threads):
versions = []
if threads > 1:
with futures.ThreadPoolExecutor(
max_workers=threads
) as executor:
tasks = [
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(\n req_files,\n verbose=False,\n outdated=False,\n latest=False,\n verbatim=False,\n repo=None,\n path=\"requirements.txt\",\n token=None,\n branch=\"master\",\n url=None,\n delay=None,\n):\n requirements = []\n\n if repo:\n github_url = build_github_url(repo,... | [
"0.6130742",
"0.6022223",
"0.598399",
"0.59458536",
"0.58944225",
"0.5817369",
"0.57562554",
"0.5738081",
"0.57167447",
"0.5690409",
"0.5682631",
"0.5644309",
"0.5641783",
"0.5640585",
"0.5601502",
"0.5571681",
"0.5530789",
"0.5515461",
"0.55109876",
"0.55059534",
"0.5485498"... | 0.6876928 | 0 |
Compare the current versions of the packages with the last versions to find updates. | def find_updates(self, versions, last_versions):
updates = []
for package, current_version in versions.items():
last_version = last_versions[package]
if last_version != current_version:
logger.debug(
'=> %s current version (%s) and last '
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_updates(package_name, latest_version_str, our_version_str=VERSION):\n our = dict()\n latest = dict()\n for version, suffix in ((our, our_version_str), (latest, latest_version_str)):\n for part in ['major', 'minor', 'patch']:\n version[part], _, suffix = suffix.partition('.'... | [
"0.72568524",
"0.68499315",
"0.67050654",
"0.66041917",
"0.6572279",
"0.65208465",
"0.6417936",
"0.641462",
"0.6412614",
"0.6402912",
"0.63977844",
"0.63609093",
"0.63354707",
"0.63339275",
"0.63038474",
"0.62751496",
"0.62681097",
"0.6237268",
"0.62309456",
"0.6142296",
"0.6... | 0.78968257 | 0 |
returns a dictionary with 'variable' > 'domain' mappings | def vdict(self, variables=None):
if variables is None:
return { self.vp_node[v].name: self.vp_node[v].domain for v in self.variables }
return { v.name: v.domain for v in variables } | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_domain_mappings(domain_to_intents: Dict) -> Dict:\n domain2id = {}\n domains = list(domain_to_intents)\n for index, domain in enumerate(domains):\n domain2id[domain] = index\n return domain2id",
"def order_domain_values(var,assignment,csp):\n #right now it works... | [
"0.65483457",
"0.6292216",
"0.6283033",
"0.623878",
"0.62214243",
"0.61496407",
"0.61425346",
"0.6082981",
"0.60341144",
"0.60192126",
"0.59888387",
"0.59511423",
"0.5947151",
"0.5796901",
"0.57882506",
"0.5723775",
"0.57043797",
"0.56787944",
"0.56731504",
"0.5666347",
"0.56... | 0.71076834 | 0 |
Check to see if the network encoded by the input GeneGraph has a valid shape. A shape can be invalid if (1) the final shape is <= 0 along any axis, or (2) if the end of any encoder convblock has an odd shape along any axis. | def shape_check(graph: mt.GeneGraph,
min_size: Union[int, Sequence[int]]=0) -> Tuple[bool, bool]:
# True if the shape goes <= 0
too_small = False
# True if any encoder blocks have odd output shape
odd_output = False
# If the min acceptable size is an int, make into a list of ints
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _check_shape(placeholder_shape, data_shape):\n\n return True",
"def is_valid(self) -> bool:\r\n try:\r\n self.shape\r\n return True\r\n except ValueError:\r\n return False",
"def _check_shape(self, X):\n return all([X.shape[i] == self.train_shape[i] ... | [
"0.74824107",
"0.7270184",
"0.7125569",
"0.6997042",
"0.6988682",
"0.68868434",
"0.6845374",
"0.6727434",
"0.6715909",
"0.6706594",
"0.668039",
"0.6535564",
"0.651072",
"0.6506139",
"0.6424306",
"0.6356764",
"0.6340228",
"0.6319391",
"0.62358725",
"0.6234697",
"0.6223679",
... | 0.7861982 | 0 |
Create a queue buffer. One adds items by calling the put(item) method. One can wait for new items to be added by using the blocking pop() method which returns the index and the item that have been added. One can read items that have been added previously using the read(index) method. The constructor takes one optional ... | def __init__(self,size=10):
self.inbound = Queue() #an internal queue to manage the class properly in a thread safe manner.
self.index = Value('i',0) #index of next item to be added.
self.manager = Manager()
self.buffer = self.manager.list() #the buffer we will store th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, size):\n self.queue = collections.deque(maxlen=size)",
"def __init__(self, size):\n self.queue = collections.deque(maxlen = size)",
"def __init__(self, size):\n self.q = deque( maxlen=size)",
"def __init__(self, size):\n self.size = size\n self.queue = []... | [
"0.7055755",
"0.7002627",
"0.68083966",
"0.6783001",
"0.6552732",
"0.64187753",
"0.63499993",
"0.63266903",
"0.63185835",
"0.6228891",
"0.62085295",
"0.6208389",
"0.61978066",
"0.61875516",
"0.6185742",
"0.6173956",
"0.6154561",
"0.6149934",
"0.6100217",
"0.6100217",
"0.60910... | 0.77845526 | 0 |
Return the number of items still to pop | def unpopped(self):
return self.newitem.qsize() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def popsize(self):\r\n return self.sp.popsize",
"def size(self):\n return self.N # Number of items in the stack",
"def size(self): #returns the size or number of items in the stack\n if self.is_empty():\n return 0\n else:\n return self.num_items"... | [
"0.77036655",
"0.72722363",
"0.71897376",
"0.7007627",
"0.7007627",
"0.69321567",
"0.6887765",
"0.6875599",
"0.6849064",
"0.6831568",
"0.68283343",
"0.68271565",
"0.6726608",
"0.6707557",
"0.6681107",
"0.6639482",
"0.6617566",
"0.6606565",
"0.6603618",
"0.6535069",
"0.6535069... | 0.82157266 | 0 |
Helper function, internally blocks until an item is added to the internal queue, this is then added into our buffer, and various indices are sorted. | def worker(self):
while True:
item,index = self.inbound.get()
if index is None:
self.buffer.append(item)
self.index.value = self.index.value + 1 #index of next item for buffer
if len(self.buffer)>self.size:
del self.buff... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,size=10):\n \n self.inbound = Queue() #an internal queue to manage the class properly in a thread safe manner.\n self.index = Value('i',0) #index of next item to be added.\n self.manager = Manager()\n \n self.buffer = self.manager.list() #the buffer we wi... | [
"0.69142944",
"0.6775045",
"0.6572859",
"0.6417179",
"0.6393169",
"0.6383432",
"0.63217866",
"0.6306395",
"0.6299939",
"0.6282621",
"0.6255991",
"0.62280786",
"0.6193022",
"0.61870414",
"0.61837673",
"0.6095415",
"0.60823333",
"0.6045565",
"0.6034187",
"0.60179716",
"0.599956... | 0.7502149 | 0 |
Read item at index getindex. Returns the item. Fails if item no longer exists. | def read(self,getindex):
if getindex<0:
#print("Indicies are non-negative")
return None
try:
bufinx = len(self.buffer)+(getindex - self.index.value)
if bufinx<0:
#print("This item has been deleted, try increasing the queue size")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_by_index(self, index):\n if index > self.length - 1:\n return None\n else:\n return self.items[index]",
"def get_item(self, index: int) -> _T:\n return self.index_to_item[index]",
"def get_item(self, index):\n if index == 0:\n raise IndexErro... | [
"0.7535031",
"0.7388097",
"0.7387124",
"0.73721397",
"0.7266759",
"0.72450334",
"0.71537787",
"0.7090138",
"0.702019",
"0.7002688",
"0.69995654",
"0.6852183",
"0.68299997",
"0.68008107",
"0.6783352",
"0.67813903",
"0.67672634",
"0.67473143",
"0.6732041",
"0.66635954",
"0.6663... | 0.75241035 | 1 |
Blocks until a new item is added. Returns the index and the item. !Item remains in the QueueBuffer, so 'pop' is slightly misleading. It will return (index,None) if the item has already been lost from the buffer. | def pop(self):
self.newitem.get() #blocks until an item is added, using a queue for this to ensure that only one worker is triggered.
#if self.newitemindex+1==self.index: self.newitem.clear()
index = self.newitemindex
item = self.read(index)
self.newitemindex += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop(self) -> int:\n cur = None\n if(not self.empty()):\n cur = self.queue[0] \n self.queue = self.queue[1:] \n return cur",
"def read(self,getindex):\n if getindex<0:\n #print(\"Indicies are non-negative\")\n return None\n try:\n ... | [
"0.69388396",
"0.68256915",
"0.68198776",
"0.67803955",
"0.6718834",
"0.67103136",
"0.6671482",
"0.6626551",
"0.661111",
"0.6601476",
"0.6587418",
"0.6587418",
"0.6583516",
"0.6570004",
"0.65641826",
"0.6547664",
"0.653801",
"0.6529275",
"0.65275687",
"0.6526335",
"0.65049285... | 0.83028567 | 0 |
Performs majority votes over the given attributes, which are assumed to be `CategoricalAttribute`s. A separate vote is performed for attributes of each name. If a list of AttributeContainers is provided, all attributes are combined into a single vote. | def majority_vote_categorical_attrs(attrs, confidence_weighted=False):
if not isinstance(attrs, list):
attrs = [attrs]
accums = defaultdict(etan.Accumulator)
for _attrs in attrs:
for attr in _attrs:
accums[attr.name].add(attr.value, weight=attr.confidence or 0.0)
voted_attr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self, clfs, dataset):\n if len(clfs)==0:\n return [] # to don't even bother\n\n all_label_counts = None\n for clf in clfs:\n # Lets check first if necessary conditional attribute is enabled\n if not clf.ca.is_enabled(\"predictions... | [
"0.530733",
"0.5292166",
"0.51155865",
"0.5054365",
"0.5016916",
"0.5009911",
"0.4980732",
"0.49682903",
"0.495229",
"0.4946295",
"0.4930192",
"0.4910622",
"0.4899093",
"0.489731",
"0.48556",
"0.47941115",
"0.47523022",
"0.47461033",
"0.47104993",
"0.46908027",
"0.4684973",
... | 0.7125202 | 0 |
Filters the attribute by the given schema. | def filter_by_schema(self, schema):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_by_schema(self, schema, constant_schema=None):\n if constant_schema is None:\n constant_schema = schema\n\n get_schema = lambda attr: constant_schema if attr.constant else schema\n\n # Remove attributes with invalid names\n filter_fcn = lambda attr: get_schema(attr... | [
"0.75847036",
"0.6768858",
"0.62234396",
"0.62064046",
"0.59790224",
"0.58667177",
"0.5720148",
"0.5491392",
"0.52851987",
"0.528129",
"0.5225991",
"0.5172035",
"0.51716125",
"0.51716125",
"0.51716125",
"0.51563376",
"0.5155657",
"0.51186794",
"0.50850403",
"0.50318366",
"0.5... | 0.8063648 | 0 |
Creates a CategoricalAttribute instance. | def __init__(
self,
name,
value,
confidence=None,
top_k_probs=None,
constant=False,
tags=None,
):
super(CategoricalAttribute, self).__init__(
name, value, confidence=confidence, constant=constant, tags=tags
)
self.top_k_prob... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, name, categories=None, exclusive=False, default=None):\n super(CategoricalAttributeSchema, self).__init__(\n name, exclusive=exclusive, default=default\n )\n self.categories = set(categories or [])\n self.validate_default_value()",
"def set_categorical(se... | [
"0.6384755",
"0.6279566",
"0.62452924",
"0.6244721",
"0.5907963",
"0.58979803",
"0.5890514",
"0.5843316",
"0.58307725",
"0.58294404",
"0.58147645",
"0.58140194",
"0.58103013",
"0.5786111",
"0.57816666",
"0.57790756",
"0.5774232",
"0.575643",
"0.5720464",
"0.5631398",
"0.56268... | 0.6910468 | 0 |
Parses the attribute value. | def parse_value(cls, value):
return value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parseAttributeString(self, line):\n attribute, value = line.partition(' ')[::2]\n self._setAttribute(attribute, value)",
"def parse(self, value):\n raise NotImplementedError(\"Please implement the Class\")",
"def extractValue(line, attribute):\n\t\n\tmyValue = ''\n\n\t#to avoid attrib... | [
"0.70519006",
"0.65825087",
"0.6487424",
"0.64370435",
"0.6392208",
"0.6368744",
"0.62816554",
"0.6264809",
"0.6242067",
"0.62218463",
"0.6188011",
"0.61878055",
"0.6172431",
"0.6101577",
"0.60859686",
"0.6055087",
"0.6045903",
"0.60443044",
"0.6021183",
"0.6009539",
"0.59448... | 0.689424 | 1 |
Whether this attribute is exclusive. | def is_exclusive(self):
return self.exclusive | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_exclusive_attribute(self, name):\n return self.get_attribute_schema(name).is_exclusive",
"def has_exclusive_attributes(self):\n return any(schema.is_exclusive for schema in itervalues(self.schema))",
"def set_exclusive(self, exclusive):\n self.widget.setExclusive(exclusive)",
"def... | [
"0.81824136",
"0.740527",
"0.68166596",
"0.6737781",
"0.6495307",
"0.6457551",
"0.6457551",
"0.6457551",
"0.6457551",
"0.64246213",
"0.640931",
"0.6389615",
"0.63834655",
"0.6336614",
"0.6336614",
"0.63310194",
"0.62956697",
"0.62916607",
"0.62916607",
"0.6222839",
"0.6222839... | 0.80982614 | 1 |
Whether this attribute has a default value. | def has_default_value(self):
return self.default is not None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_default_value(self, name):\n return self.get_attribute_schema(name).has_default_value",
"def is_attr_value_default(self, attr_name):\n try:\n attr_value = self.field_attrs[attr_name]\n except KeyError:\n return True\n\n return attr_value == self.get_attr_... | [
"0.85349417",
"0.82452166",
"0.82452166",
"0.81859136",
"0.80237293",
"0.80165124",
"0.7748865",
"0.7633698",
"0.7621697",
"0.76085377",
"0.7557479",
"0.75521266",
"0.75233644",
"0.75227034",
"0.7517625",
"0.74916875",
"0.74916875",
"0.74916875",
"0.7448208",
"0.74473214",
"0... | 0.8726552 | 0 |
Gets the Attribute class associated with this schema. | def get_attribute_class(self):
return self._attr_cls | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_class(self, name):\n self.validate_attribute_name(name)\n return self.schema[name].get_attribute_class()",
"def get_attribute_class(self, attr_name):\n return self.attrs.get_attribute_class(attr_name)",
"def get_class_attribute(self):\n return self.class_attr",
"... | [
"0.8190385",
"0.79435694",
"0.7145243",
"0.69960994",
"0.6341953",
"0.6313961",
"0.6174065",
"0.6074287",
"0.60729676",
"0.59743506",
"0.58819413",
"0.5792457",
"0.57806647",
"0.56970257",
"0.5666237",
"0.5620442",
"0.5617537",
"0.5617366",
"0.553197",
"0.55195576",
"0.550445... | 0.87033117 | 0 |
Validates that the given AttributeSchema has the same class and `name` as this schema. | def validate_schema(self, schema):
if type(schema) is not type(self):
raise AttributeSchemaError(
"Expected schema to have type '%s'; found '%s'"
% (type(self), type(schema))
)
if schema.name != self.name:
raise AttributeSchemaError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_subset_of_schema(self, schema):\n self.validate_schema_type(schema)\n\n if self.name != schema.name:\n raise AttributeSchemaError(\n \"Expected name '%s'; found '%s'\" % (schema.name, self.name)\n )\n\n if self.exclusive != schema.exclusive:\n ... | [
"0.65096617",
"0.63164973",
"0.6119396",
"0.60405695",
"0.58915716",
"0.5889611",
"0.58063215",
"0.5773859",
"0.5740706",
"0.57290673",
"0.56869334",
"0.5677395",
"0.5620335",
"0.56038564",
"0.5588101",
"0.5586749",
"0.55687493",
"0.5541297",
"0.55256647",
"0.54847336",
"0.54... | 0.7815782 | 0 |
Validates that the Attribute is of the correct class. | def validate_type(self, attr):
if not isinstance(attr, self._attr_cls):
raise AttributeSchemaError(
"Expected attribute '%s' to have type '%s'; found '%s'"
% (attr.name, self.type, etau.get_class_name(attr))
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_attribute(self, attr):\n self.attrs.validate_attribute(attr)",
"def validate_attribute(self, attr):\n self.validate(attr)",
"def is_valid(self, attribute: Attribute) -> bool:\n return self.get_data_type() == attribute.type",
"def validate_attribute(self, attr):\n self... | [
"0.70458794",
"0.69427705",
"0.66600865",
"0.6646065",
"0.6621674",
"0.654256",
"0.6537403",
"0.6460707",
"0.63829124",
"0.6350043",
"0.6295183",
"0.6271765",
"0.62120336",
"0.62120336",
"0.6199839",
"0.61158985",
"0.6080903",
"0.6077219",
"0.6073006",
"0.60484755",
"0.600156... | 0.7480556 | 0 |
Validates that the Attribute is compliant with the schema. | def validate(self, attr):
if attr.name != self.name:
raise AttributeSchemaError(
"Expected name '%s'; found '%s'" % (self.name, attr.name)
)
self.validate_type(attr)
if not self.is_valid_value(attr.value):
raise AttributeSchemaError(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_attribute(self, attr):\n self.validate_attribute_name(attr.name)\n self.schema[attr.name].validate_attribute(attr)",
"def validate_attribute(self, attr):\n self.validate(attr)",
"def validate_attribute(self, attr):\n self.attrs.validate_attribute(attr)",
"def validate... | [
"0.84634745",
"0.8003326",
"0.79975826",
"0.74881256",
"0.73158926",
"0.73158926",
"0.7129263",
"0.70151407",
"0.6967542",
"0.6961131",
"0.6935066",
"0.69347423",
"0.69187576",
"0.682446",
"0.6820103",
"0.67508584",
"0.6711849",
"0.6581434",
"0.65688425",
"0.6534537",
"0.6480... | 0.8203012 | 1 |
Validates that this schema is a subset of the given schema. | def validate_subset_of_schema(self, schema):
self.validate_schema_type(schema)
if self.name != schema.name:
raise AttributeSchemaError(
"Expected name '%s'; found '%s'" % (schema.name, self.name)
)
if self.exclusive != schema.exclusive:
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_subset_of_schema(self, schema):\n self.validate_schema_type(schema)\n\n for name, attr_schema in iteritems(self.schema):\n if not schema.has_attribute(name):\n raise AttributeContainerSchemaError(\n \"Attribute '%s' does not appear in schema\"... | [
"0.81938004",
"0.80990547",
"0.8020877",
"0.79472554",
"0.7687689",
"0.7619746",
"0.6748884",
"0.66119224",
"0.64827746",
"0.6362671",
"0.63433886",
"0.62965935",
"0.6293175",
"0.61685395",
"0.6159616",
"0.6158576",
"0.6087979",
"0.6073577",
"0.5879684",
"0.58497864",
"0.5847... | 0.8153359 | 1 |
Validates that the schema's default value (if any) is compliant with the schema. | def validate_default_value(self):
if self.has_default_value:
if not self.is_valid_value(self.default):
raise AttributeSchemaError(
"Default value '%s' is not compliant with the schema"
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_default(self, value):\n return self.__validate(value, self.validate_default_element)",
"def validate_default(self, value):\n return self.__validate(value, self.validate_default_element)",
"def validate(self, value):\r\n if value is None:\r\n if self.has_default:\r\n ... | [
"0.76519585",
"0.75321203",
"0.6860783",
"0.6860783",
"0.680885",
"0.6804212",
"0.675413",
"0.668234",
"0.6521006",
"0.6421395",
"0.640982",
"0.63684344",
"0.6358686",
"0.6273223",
"0.62184685",
"0.6020462",
"0.6019303",
"0.60110074",
"0.6001693",
"0.59867406",
"0.59839046",
... | 0.8765054 | 0 |
Constructs an AttributeSchema from a JSON dictionary. Note that this function reflectively parses the schema type from the dictionary, so subclasses do not need to implement this method. | def from_dict(cls, d):
attr_cls = etau.get_class(d["type"])
schema_cls = attr_cls.get_schema_cls()
name = d["name"]
exclusive = d.get("exclusive", False)
default = d.get("default", None)
return schema_cls(
name,
exclusive=exclusive,
de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, d):\n schema = d.get(\"schema\", None)\n if schema is not None:\n schema = {\n attr_name: AttributeSchema.from_dict(asd)\n for attr_name, asd in iteritems(schema)\n }\n\n return cls(schema=schema)",
"def from_json(cls, js... | [
"0.7644983",
"0.6328274",
"0.62916005",
"0.62879604",
"0.61576164",
"0.61387366",
"0.5965841",
"0.5962421",
"0.5904961",
"0.58912",
"0.58775073",
"0.58033687",
"0.5785732",
"0.5724698",
"0.57203984",
"0.57162833",
"0.5660964",
"0.5597983",
"0.55465",
"0.55423206",
"0.54708445... | 0.7123541 | 1 |
Creates a CategoricalAttributeSchema instance. | def __init__(self, name, categories=None, exclusive=False, default=None):
super(CategoricalAttributeSchema, self).__init__(
name, exclusive=exclusive, default=default
)
self.categories = set(categories or [])
self.validate_default_value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_active_schema(cls, attr):\n return cls(attr.name, categories={attr.value})",
"def attributes(self):\n attrs_ = super(CategoricalAttributeSchema, self).attributes()\n attrs_.append(\"categories\")\n return attrs_",
"def test_categorical_constraint():\n categories = [\"Bl... | [
"0.64069116",
"0.6404652",
"0.5585234",
"0.5555363",
"0.5546677",
"0.5528087",
"0.5460727",
"0.54497313",
"0.5369751",
"0.5369751",
"0.5369751",
"0.53172123",
"0.53150636",
"0.5212389",
"0.5207569",
"0.51688194",
"0.5150824",
"0.5136213",
"0.5080584",
"0.5065041",
"0.50454825... | 0.6922686 | 0 |
Builds a CategoricalAttributeSchema that describes the active schema of the CategoricalAttribute. | def build_active_schema(cls, attr):
return cls(attr.name, categories={attr.value}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self):\n attrs_ = super(CategoricalAttributeSchema, self).attributes()\n attrs_.append(\"categories\")\n return attrs_",
"def build_active_schema(cls, attr):\n return cls(attr.name, values={attr.value})",
"def __init__(self, name, categories=None, exclusive=False, def... | [
"0.6653668",
"0.61256295",
"0.6016856",
"0.59066474",
"0.580082",
"0.5568534",
"0.54435915",
"0.51423573",
"0.5096481",
"0.5034082",
"0.5005395",
"0.48591545",
"0.48311645",
"0.48297423",
"0.48297423",
"0.48297423",
"0.48248908",
"0.48134267",
"0.47964922",
"0.47401783",
"0.4... | 0.7176708 | 0 |
Merges the given CategoricalAttributeSchema into this schema. | def merge_schema(self, schema):
super(CategoricalAttributeSchema, self).merge_schema(schema)
self.categories.update(schema.categories) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_attribute_schema(self, attr_schema):\n name = attr_schema.name\n if name not in self.schema:\n self.schema[name] = attr_schema\n else:\n self.schema[name].merge_schema(attr_schema)",
"def merge_schema(self, schema):\n for _, attr_schema in schema.iter_a... | [
"0.66761893",
"0.6562346",
"0.5620021",
"0.5591604",
"0.53152627",
"0.5303806",
"0.50917417",
"0.47311455",
"0.45369187",
"0.4431705",
"0.4395007",
"0.43437606",
"0.4324432",
"0.43148988",
"0.42817253",
"0.42398593",
"0.42169097",
"0.42113233",
"0.41836387",
"0.41354522",
"0.... | 0.8113991 | 0 |
Creates a NumericAttributeSchema instance. | def __init__(self, name, range=None, exclusive=False, default=None):
super(NumericAttributeSchema, self).__init__(
name, exclusive=exclusive, default=default
)
self.range = tuple(range or [])
self.validate_default_value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(\n self, dtype: str, name: str, index: Optional[int] = 0,\n label: Optional[str] = None, help: Optional[str] = None,\n default: Optional[Union[int, float]] = None, required: Optional[bool] = False,\n group: Optional[str] = None, constraint: Optional[RangeConstraint] = None\... | [
"0.5549439",
"0.550502",
"0.52814686",
"0.49523935",
"0.49471354",
"0.49455547",
"0.48985994",
"0.48495618",
"0.4763161",
"0.47305086",
"0.4647385",
"0.4579941",
"0.45615834",
"0.45446146",
"0.45197606",
"0.45111766",
"0.4476501",
"0.44345817",
"0.4382006",
"0.43748778",
"0.4... | 0.63034064 | 0 |
Builds a NumericAttributeSchema that describes the active schema of the NumericAttribute. | def build_active_schema(cls, attr):
return cls(attr.name, range=(attr.value, attr.value)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self):\n attrs_ = super(NumericAttributeSchema, self).attributes()\n attrs_.append(\"range\")\n return attrs_",
"def __init__(self, name, range=None, exclusive=False, default=None):\n super(NumericAttributeSchema, self).__init__(\n name, exclusive=exclusive, ... | [
"0.5745743",
"0.5220101",
"0.51414",
"0.510134",
"0.50879943",
"0.50192666",
"0.48779523",
"0.47359407",
"0.46691066",
"0.46501595",
"0.46292365",
"0.45427948",
"0.45160258",
"0.43934676",
"0.4364968",
"0.43548426",
"0.43459022",
"0.43127623",
"0.42895886",
"0.4248163",
"0.42... | 0.5373601 | 1 |
Merges the given NumericAttributeSchema into this schema. | def merge_schema(self, schema):
super(NumericAttributeSchema, self).merge_schema(schema)
if not self.range:
self.range = schema.range
else:
self.range = (
min(self.range[0], schema.range[0]),
max(self.range[1], schema.range[1]),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_schema(self, schema):\n for _, attr_schema in schema.iter_attributes():\n self.merge_attribute_schema(attr_schema)",
"def merge_attribute_schema(self, attr_schema):\n name = attr_schema.name\n if name not in self.schema:\n self.schema[name] = attr_schema\n ... | [
"0.613379",
"0.6076565",
"0.56533253",
"0.55631006",
"0.53362817",
"0.50358003",
"0.49248102",
"0.47552547",
"0.47158542",
"0.46539938",
"0.46114725",
"0.45533928",
"0.454039",
"0.4514584",
"0.44801235",
"0.44582006",
"0.44557527",
"0.43551463",
"0.42997453",
"0.42904726",
"0... | 0.72852665 | 0 |
Creates a BooleanAttributeSchema instance. | def __init__(self, name, values=None, exclusive=False, default=None):
super(BooleanAttributeSchema, self).__init__(
name, exclusive=exclusive, default=default
)
self.values = set(values or [])
self.validate_default_value() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema():\n return vol.Schema({\"venus\": cv.boolean, \"mars\": cv.boolean, \"jupiter\": cv.boolean})",
"def form_Boolean(request):\n schema = schemaish.Structure()\n schema.add('myBooleanField', schemaish.Boolean())\n form = formish.Form(schema, 'form')\n return form",
"def __init__(\n ... | [
"0.608737",
"0.5819675",
"0.566594",
"0.5590935",
"0.5580326",
"0.55594844",
"0.55293834",
"0.55084515",
"0.5463669",
"0.5422187",
"0.54039186",
"0.532823",
"0.53129405",
"0.52992815",
"0.5292598",
"0.52653176",
"0.5248311",
"0.51945597",
"0.5185645",
"0.5181672",
"0.5181354"... | 0.6226163 | 0 |
Merges the given BooleanAttributeSchema into this schema. | def merge_schema(self, schema):
super(BooleanAttributeSchema, self).merge_schema(schema)
self.values.update(schema.values) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_schema(self, schema):\n self.validate_schema(schema)\n\n if self.exclusive is False:\n self.exclusive = schema.exclusive\n\n if self.default is None:\n self.default = schema.default",
"def merge_schema(self, schema):\n for _, attr_schema in schema.iter_... | [
"0.61939293",
"0.58525634",
"0.57368326",
"0.50372493",
"0.5014537",
"0.5005869",
"0.49757817",
"0.49018866",
"0.46996504",
"0.46879697",
"0.46091363",
"0.45477447",
"0.4533857",
"0.4531039",
"0.45263448",
"0.4515642",
"0.45118606",
"0.4507055",
"0.4490799",
"0.44091803",
"0.... | 0.78415316 | 0 |
Returns whether or not the container contains an Attribute with the given name. | def has_attr_with_name(self, name):
for attr in self:
if attr.name == name:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attribute(self, name):\n return name in self.schema",
"def hasAttribute(self, attrib):\n return self._dqa(attrib) in self.attributes",
"def has_attribute(self, name):\n\n pass",
"def has_attr(self, name):\n return name in self and not self[name] in EMPTY_VALUES",
"def ha... | [
"0.79942447",
"0.77154106",
"0.76591486",
"0.7382911",
"0.733944",
"0.73309386",
"0.7262436",
"0.7184343",
"0.71637976",
"0.71544474",
"0.71544474",
"0.71331775",
"0.71263033",
"0.7110779",
"0.7050013",
"0.69409716",
"0.69250476",
"0.6889576",
"0.68727183",
"0.6751156",
"0.66... | 0.8376568 | 0 |
Gets all `Attribute`s with the given name. | def get_attrs_with_name(self, name):
return self.get_matches([lambda attr: attr.name == name]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attr_values_with_name(self, name):\n return [attr.value for attr in self.get_attrs_with_name(name)]",
"def queryAttributeNames(name):\n\n header, rows = querySciDB(\"attributes(%s)\" % name)\n return [row[1].translate(None, \"\\\"\") for row in rows]",
"def getAttributeByName(self, name):\... | [
"0.7516274",
"0.72581846",
"0.70912445",
"0.69646543",
"0.6895492",
"0.68367636",
"0.6494162",
"0.6411804",
"0.63663906",
"0.6317672",
"0.62741804",
"0.6262732",
"0.62604016",
"0.6198323",
"0.60872364",
"0.6051567",
"0.59799707",
"0.59614956",
"0.59420294",
"0.5920864",
"0.59... | 0.77114695 | 0 |
Gets a list of values for all `Attribute`s with the given name. | def get_attr_values_with_name(self, name):
return [attr.value for attr in self.get_attrs_with_name(name)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def values(self):\n return [getattr(self, a.name) for a in self.__attrs_attrs__]",
"def queryAttributeNames(name):\n\n header, rows = querySciDB(\"attributes(%s)\" % name)\n return [row[1].translate(None, \"\\\"\") for row in rows]",
"def get_attrs_with_name(self, name):\n return self.get_m... | [
"0.7520641",
"0.7162945",
"0.705591",
"0.7045606",
"0.7021155",
"0.6939452",
"0.6783374",
"0.6768759",
"0.66577613",
"0.66454077",
"0.6569157",
"0.6465251",
"0.6424673",
"0.6266206",
"0.6243621",
"0.6228554",
"0.6223528",
"0.61864316",
"0.61479187",
"0.61479187",
"0.6135107",... | 0.90423757 | 0 |
Pops constant attributes from this container. | def pop_constant_attrs(self):
return self.pop_elements([lambda attr: attr.constant]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop_attributes(self):\n attrs = self.attrs\n self.clear_attributes()\n return attrs",
"def clear_attributes(self):\n self.attrs = etad.AttributeContainer()",
"def unsetConstant(self):\n return _libsbml.Compartment_unsetConstant(self)",
"def popFrameVariables(self):\n ... | [
"0.6409805",
"0.6064282",
"0.6012825",
"0.59316134",
"0.5912364",
"0.5777581",
"0.5755103",
"0.57506615",
"0.5728127",
"0.5702524",
"0.5696803",
"0.5662745",
"0.55867356",
"0.55519366",
"0.55496734",
"0.55287945",
"0.55287945",
"0.55287945",
"0.5513677",
"0.55119723",
"0.5482... | 0.77252495 | 0 |
Removes attributes from this container that are not compliant with the given schema. Only the first observation of each exclusive attribute is kept (if applicable). | def filter_by_schema(self, schema, constant_schema=None):
if constant_schema is None:
constant_schema = schema
get_schema = lambda attr: constant_schema if attr.constant else schema
# Remove attributes with invalid names
filter_fcn = lambda attr: get_schema(attr).has_attrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_attributes(self, remove_attrs):\n remove = []\n for attr in self.data:\n for prefix in remove_attrs:\n if attr.startswith(prefix):\n remove.append(attr)\n break\n\n self.data = self.data.drop(remove, axis=1)",
"def re... | [
"0.63107795",
"0.63107795",
"0.6131333",
"0.6119389",
"0.60960937",
"0.6045111",
"0.6032735",
"0.60116005",
"0.5976104",
"0.58545375",
"0.5839931",
"0.5834085",
"0.5815676",
"0.5787223",
"0.5742111",
"0.57354367",
"0.5733125",
"0.5728372",
"0.57195425",
"0.5669524",
"0.563688... | 0.6831719 | 0 |
Returns a dictionary mapping attribute names to their counts in this container. | def get_attribute_counts(self):
counts = defaultdict(int)
for attr in self:
counts[attr.name] += 1
return dict(counts) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counts(self) -> dict:\n return Counter(self.sequence)",
"def _attrs_map(self) -> \"dict[int, str]\":\n return {i: attr.name for i, attr in enumerate(self._attrs())}",
"def _get_as_dict_count(self):\n counter = Counter()\n for product in self.products:\n counter[produc... | [
"0.70180696",
"0.69050837",
"0.6903133",
"0.6848671",
"0.6753199",
"0.6742087",
"0.67376226",
"0.67350996",
"0.66511387",
"0.6624211",
"0.6598114",
"0.6584916",
"0.65632945",
"0.65021485",
"0.65013814",
"0.6492559",
"0.6492349",
"0.64813375",
"0.64399755",
"0.6438868",
"0.643... | 0.90069354 | 0 |
Whether this schema contains at least one exclusive attribute. | def has_exclusive_attributes(self):
return any(schema.is_exclusive for schema in itervalues(self.schema)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_exclusive_attribute(self, name):\n return self.get_attribute_schema(name).is_exclusive",
"def hasOptionalAttributes(self):\n return _libsbml.SBase_hasOptionalAttributes(self)",
"def hasRequiredAttributes(self):\n return _libsbml.AlgebraicRule_hasRequiredAttributes(self)",
"def has... | [
"0.78752255",
"0.71905404",
"0.682085",
"0.6818547",
"0.6817014",
"0.6751183",
"0.67473763",
"0.67394555",
"0.6737406",
"0.67252415",
"0.67246854",
"0.6719147",
"0.67022294",
"0.6700692",
"0.66953605",
"0.66911525",
"0.6690814",
"0.6671049",
"0.6651599",
"0.66337264",
"0.6605... | 0.8674501 | 0 |
Returns an iterator over the (name, AttributeSchema) pairs in this schema. | def iter_attributes(self):
return iteritems(self.schema) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self) -> Tuple[str, Any]:\n for attr_name, attr_val in self.__dict__.items():\n yield attr_name, attr_val",
"def iter_attributes(self) -> Iterator[AttributeNode]:\n status: Any\n\n if isinstance(self.item, AttributeNode):\n status = self.axis\n s... | [
"0.6245281",
"0.61062413",
"0.60659826",
"0.5949053",
"0.5913689",
"0.5893057",
"0.5817822",
"0.58118874",
"0.5766706",
"0.57579017",
"0.5689008",
"0.5654089",
"0.56415623",
"0.56186086",
"0.5611452",
"0.5560966",
"0.5550918",
"0.54651785",
"0.5452331",
"0.5448329",
"0.544449... | 0.74640673 | 0 |
Whether the schema has an Attribute with the given name. | def has_attribute(self, name):
return name in self.schema | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attr_with_name(self, name):\n for attr in self:\n if attr.name == name:\n return True\n\n return False",
"def has_attribute(self, name):\n\n pass",
"def hasAttribute(self, attrib):\n return self._dqa(attrib) in self.attributes",
"def attribute_exi... | [
"0.8269132",
"0.7991501",
"0.7659555",
"0.74895906",
"0.74583995",
"0.7421857",
"0.7392836",
"0.7271526",
"0.726393",
"0.71954143",
"0.7174027",
"0.70955116",
"0.70955116",
"0.705711",
"0.7055704",
"0.69954616",
"0.6912138",
"0.69118476",
"0.68898445",
"0.6820372",
"0.6804414... | 0.8838361 | 0 |
Gets the AttributeSchema for the Attribute with the given name. | def get_attribute_schema(self, name):
self.validate_attribute_name(name)
return self.schema[name] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_schema(self, name):\n return Schema(self, name)",
"def get_schema(self, name, namespace=None):\n avro_name = self.get_name(name=name, namespace=namespace)\n return self._names.get(avro_name.fullname, None)",
"def schema(self, name):\n return model.Schema(self, name)",
"def... | [
"0.64486235",
"0.6430363",
"0.62171483",
"0.5857013",
"0.5799322",
"0.57704204",
"0.5766579",
"0.57060593",
"0.5699009",
"0.5678361",
"0.5433262",
"0.5315926",
"0.5253417",
"0.52411157",
"0.5234161",
"0.5197639",
"0.51942366",
"0.50964564",
"0.5081106",
"0.5077334",
"0.503183... | 0.87385505 | 0 |
Gets the class of the Attribute with the given name. | def get_attribute_class(self, name):
self.validate_attribute_name(name)
return self.schema[name].get_attribute_class() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attribute_class(self, attr_name):\n return self.attrs.get_attribute_class(attr_name)",
"def get_attribute_class(self):\n return self._attr_cls",
"def get_attribute_by_name(self, name):\n if name in self._attributes:\n return self._attributes[name]",
"def attribute(self... | [
"0.8641372",
"0.7024071",
"0.6980088",
"0.65067154",
"0.64325404",
"0.6407288",
"0.6280768",
"0.62770015",
"0.6250951",
"0.6186854",
"0.6100665",
"0.6097087",
"0.6080639",
"0.6073486",
"0.6052716",
"0.595313",
"0.5910228",
"0.59096617",
"0.5879764",
"0.5867442",
"0.58294636",... | 0.8838273 | 0 |
Whether the Attribute with the given name is exclusive. | def is_exclusive_attribute(self, name):
return self.get_attribute_schema(name).is_exclusive | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attr(self, name):\n return name in self and not self[name] in EMPTY_VALUES",
"def has_attribute(self, name):\n\n pass",
"def has_attr_with_name(self, name):\n for attr in self:\n if attr.name == name:\n return True\n\n return False",
"def has_excl... | [
"0.7593362",
"0.703136",
"0.694037",
"0.68999416",
"0.6891211",
"0.6605466",
"0.6590984",
"0.639892",
"0.63264763",
"0.6316299",
"0.6309909",
"0.6309658",
"0.6299827",
"0.6285345",
"0.62298197",
"0.62032163",
"0.61965716",
"0.61603713",
"0.6154692",
"0.61544764",
"0.61313874"... | 0.8701278 | 0 |
Whether the Attribute with the given name has a default value. | def has_default_value(self, name):
return self.get_attribute_schema(name).has_default_value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_attr_value_default(self, attr_name):\n try:\n attr_value = self.field_attrs[attr_name]\n except KeyError:\n return True\n\n return attr_value == self.get_attr_default(attr_name)",
"def is_attr_value_default(self, attr_name):\n try:\n attr_value ... | [
"0.87237966",
"0.87237966",
"0.76137537",
"0.71896803",
"0.7098916",
"0.7040826",
"0.70077074",
"0.69972944",
"0.6970349",
"0.69686097",
"0.6951363",
"0.69084203",
"0.69084203",
"0.69084203",
"0.68482715",
"0.67959493",
"0.6778438",
"0.6778438",
"0.675506",
"0.6701785",
"0.66... | 0.8926538 | 0 |
Gets the default value for the Attribute with the given name. | def get_default_value(self, name):
return self.get_attribute_schema(name).default | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_attr_value_with_name(self, name, default=no_default):\n try:\n attr = self.get_attr_with_name(name)\n return attr.value\n except ValueError:\n if default is not no_default:\n return default\n\n raise",
"def get_attr_default(self, at... | [
"0.8517897",
"0.84372294",
"0.84372294",
"0.8239614",
"0.8107409",
"0.78475",
"0.7844098",
"0.7844098",
"0.7844098",
"0.77803206",
"0.7375202",
"0.7375202",
"0.73467994",
"0.7339083",
"0.7134643",
"0.71048343",
"0.70601207",
"0.70501745",
"0.70332193",
"0.70332193",
"0.691895... | 0.8850165 | 0 |
Incorporates the given Attribute into the schema. | def add_attribute(self, attr):
name = attr.name
if name not in self.schema:
schema_cls = attr.get_schema_cls()
self.schema[name] = schema_cls(name)
self.schema[name].add_attribute(attr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_attribute_schema(self, attr_schema):\n name = attr_schema.name\n if name not in self.schema:\n self.schema[name] = attr_schema\n else:\n self.schema[name].merge_schema(attr_schema)",
"def add_attribute(self, attr):\n self.attrs.add_attribute(attr)",
"... | [
"0.6663215",
"0.60491776",
"0.5928776",
"0.58562344",
"0.5797518",
"0.574551",
"0.5701491",
"0.55894977",
"0.558921",
"0.55785716",
"0.5549905",
"0.5527866",
"0.5522455",
"0.5517122",
"0.5517122",
"0.5517122",
"0.5500225",
"0.54813933",
"0.5440213",
"0.5405617",
"0.52933156",... | 0.7208039 | 0 |
Whether the Attribute is compliant with the schema. | def is_valid_attribute(self, attr):
try:
self.validate_attribute(attr)
return True
except etal.LabelsSchemaError:
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid(self, attribute: Attribute) -> bool:\n return self.get_data_type() == attribute.type",
"def has_attribute(self, name):\n return name in self.schema",
"def is_valid_attribute(self, attr):\n return self.is_valid(attr)",
"def isValidForSchema(schema):\n\n return True",
... | [
"0.7286637",
"0.72063947",
"0.7186152",
"0.71108377",
"0.6968952",
"0.6960972",
"0.69131577",
"0.67958045",
"0.671763",
"0.66995484",
"0.6684665",
"0.6680829",
"0.6679944",
"0.66204864",
"0.6618594",
"0.65400356",
"0.6493107",
"0.64581275",
"0.64008856",
"0.6380986",
"0.63800... | 0.75508046 | 0 |
Validates that the schema has an Attribute with the given name. | def validate_attribute_name(self, name):
if not self.has_attribute(name):
raise AttributeContainerSchemaError(
"Attribute '%s' is not allowed by the schema" % name
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_attribute(self, attr):\n self.validate_attribute_name(attr.name)\n self.schema[attr.name].validate_attribute(attr)",
"def is_valid_attribute_name(self, name):\n try:\n self.validate_attribute_name(name)\n return True\n except etal.LabelsSchemaError:\... | [
"0.77677214",
"0.76652",
"0.7619264",
"0.75500405",
"0.73856294",
"0.7114656",
"0.6867957",
"0.6837161",
"0.6732875",
"0.6634328",
"0.65856785",
"0.65856785",
"0.65780014",
"0.6362414",
"0.63355386",
"0.6302873",
"0.6245351",
"0.62054867",
"0.61891484",
"0.6172528",
"0.612135... | 0.8732103 | 0 |
Validates that the Attribute is compliant with the schema. | def validate_attribute(self, attr):
self.validate_attribute_name(attr.name)
self.schema[attr.name].validate_attribute(attr) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate(self, attr):\n if attr.name != self.name:\n raise AttributeSchemaError(\n \"Expected name '%s'; found '%s'\" % (self.name, attr.name)\n )\n\n self.validate_type(attr)\n\n if not self.is_valid_value(attr.value):\n raise AttributeSchem... | [
"0.8203361",
"0.8005601",
"0.80000144",
"0.74886554",
"0.73177165",
"0.73177165",
"0.71307045",
"0.701625",
"0.69656026",
"0.6961678",
"0.6932738",
"0.6932649",
"0.6918583",
"0.68263227",
"0.6823013",
"0.67536736",
"0.67139626",
"0.6583246",
"0.65653574",
"0.6533311",
"0.6480... | 0.8464728 | 0 |
Validates that the AttributeContainer is compliant with the schema. | def validate(self, attrs):
# Validate attributes
for attr in attrs:
self.validate_attribute(attr)
# Enforce attribute exclusivity, if necessary
if self.has_exclusive_attributes:
counts = attrs.get_attribute_counts()
for name, count in iteritems(counts... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_subset_of_schema(self, schema):\n self.validate_schema_type(schema)\n\n for name, attr_schema in iteritems(self.schema):\n if not schema.has_attribute(name):\n raise AttributeContainerSchemaError(\n \"Attribute '%s' does not appear in schema\"... | [
"0.7271944",
"0.70180625",
"0.7017623",
"0.6986532",
"0.6902823",
"0.67330015",
"0.6720441",
"0.6674313",
"0.6657943",
"0.66326123",
"0.64983755",
"0.64881223",
"0.6440674",
"0.6394842",
"0.63349223",
"0.6258516",
"0.61419076",
"0.6141416",
"0.6073022",
"0.60543233",
"0.60319... | 0.7024046 | 1 |
Validates that this schema is a subset of the given schema. | def validate_subset_of_schema(self, schema):
self.validate_schema_type(schema)
for name, attr_schema in iteritems(self.schema):
if not schema.has_attribute(name):
raise AttributeContainerSchemaError(
"Attribute '%s' does not appear in schema" % name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_subset_of_schema(self, schema):\n self.validate_schema_type(schema)\n\n if self.name != schema.name:\n raise AttributeSchemaError(\n \"Expected name '%s'; found '%s'\" % (schema.name, self.name)\n )\n\n if self.exclusive != schema.exclusive:\n ... | [
"0.8153359",
"0.80990547",
"0.8020877",
"0.79472554",
"0.7687689",
"0.7619746",
"0.6748884",
"0.66119224",
"0.64827746",
"0.6362671",
"0.63433886",
"0.62965935",
"0.6293175",
"0.61685395",
"0.6159616",
"0.6158576",
"0.6087979",
"0.6073577",
"0.5879684",
"0.58497864",
"0.58471... | 0.81938004 | 0 |
Merges the given AttributeSchema into the schema. | def merge_attribute_schema(self, attr_schema):
name = attr_schema.name
if name not in self.schema:
self.schema[name] = attr_schema
else:
self.schema[name].merge_schema(attr_schema) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_schema(self, schema):\n for _, attr_schema in schema.iter_attributes():\n self.merge_attribute_schema(attr_schema)",
"def merge_schema(self, schema):\n self.validate_schema(schema)\n\n if self.exclusive is False:\n self.exclusive = schema.exclusive\n\n ... | [
"0.83535683",
"0.6661252",
"0.64205706",
"0.63567936",
"0.5432936",
"0.5387347",
"0.530836",
"0.52937627",
"0.52555555",
"0.5190755",
"0.5190755",
"0.5190755",
"0.5179762",
"0.5135182",
"0.51190615",
"0.5019401",
"0.50025386",
"0.49863493",
"0.4966378",
"0.49458146",
"0.48388... | 0.85706264 | 0 |
Merges the given AttributeContainerSchema into the schema. | def merge_schema(self, schema):
for _, attr_schema in schema.iter_attributes():
self.merge_attribute_schema(attr_schema) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_attribute_schema(self, attr_schema):\n name = attr_schema.name\n if name not in self.schema:\n self.schema[name] = attr_schema\n else:\n self.schema[name].merge_schema(attr_schema)",
"def merge_schema(self, schema):\n super(CategoricalAttributeSchema, s... | [
"0.78481984",
"0.6505774",
"0.6218267",
"0.62063813",
"0.54526615",
"0.54215837",
"0.53956157",
"0.528516",
"0.5258999",
"0.51798785",
"0.5173846",
"0.51475376",
"0.51475376",
"0.51475376",
"0.5113156",
"0.5090977",
"0.50859594",
"0.5082441",
"0.50775105",
"0.5067844",
"0.503... | 0.7980561 | 0 |
Builds an AttributeContainerSchema that describes the active schema of the given AttributeContainer. | def build_active_schema(cls, attrs):
schema = cls()
schema.add_attributes(attrs)
return schema | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __build_schema(meta_data):\n \n # Builds the dictionary that represents the schema.\n temporary_dictionary = {'$schema': None, '$id': None, 'title': None, 'type': None, 'properties': []}\n for x in meta_data:\n temporary_dictionary['properties'].append({\n ... | [
"0.5810922",
"0.55912894",
"0.55674845",
"0.5503729",
"0.530108",
"0.52915776",
"0.52851915",
"0.5175618",
"0.5157794",
"0.5129213",
"0.51003456",
"0.5094893",
"0.50896853",
"0.5078276",
"0.50685155",
"0.50472176",
"0.5033845",
"0.50164914",
"0.5008662",
"0.5008367",
"0.50000... | 0.6336021 | 0 |
Constructs an AttributeContainerSchema from a JSON dictionary. | def from_dict(cls, d):
schema = d.get("schema", None)
if schema is not None:
schema = {
attr_name: AttributeSchema.from_dict(asd)
for attr_name, asd in iteritems(schema)
}
return cls(schema=schema) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, d):\n attr_cls = etau.get_class(d[\"type\"])\n schema_cls = attr_cls.get_schema_cls()\n\n name = d[\"name\"]\n exclusive = d.get(\"exclusive\", False)\n default = d.get(\"default\", None)\n return schema_cls(\n name,\n exclusive=exc... | [
"0.67771685",
"0.63776934",
"0.62418735",
"0.6074002",
"0.6064018",
"0.60208553",
"0.587389",
"0.5806087",
"0.5778693",
"0.57692313",
"0.57473946",
"0.5735322",
"0.5715946",
"0.5680771",
"0.56228805",
"0.5593468",
"0.5558336",
"0.5556168",
"0.5556168",
"0.5556168",
"0.5556168... | 0.7527382 | 0 |
Gets the attribute for the given mask value. | def get_attr(self, value):
return self.index[value] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _MaskedImage_get(self, x, y):\n return (self.getImage().get(x, y),\n self.getMask().get(x, y),\n self.getVariance().get(x, y))",
"def getattribute(self, name):\n return self.attributes[name]",
"def with_mask(self, mask):\n return self[mask]",
"def getAtt... | [
"0.6186562",
"0.60222083",
"0.59830433",
"0.5904889",
"0.5858861",
"0.5842193",
"0.5794798",
"0.5771632",
"0.5712678",
"0.5712663",
"0.56443495",
"0.562588",
"0.56038415",
"0.5592644",
"0.55911195",
"0.557782",
"0.5570431",
"0.555515",
"0.5530427",
"0.55128914",
"0.55091274",... | 0.6249164 | 0 |
Returns a MaskIndex for the given labels map. | def from_labels_map(cls, labels_map):
mask_index = cls()
for index, value in iteritems(labels_map):
mask_index[index] = CategoricalAttribute("label", value)
return mask_index | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def label_to_mask(labels):\n # get the image size\n h, w = labels.shape\n\n # build a color to label map\n idx_to_color = {}\n for label in class_info:\n idx_to_color[class_info[label].id] = class_info[label].color\n\n # generate label matrix\n mask = np.zeros((h, w, 3), dtype=np.uint8)... | [
"0.67572516",
"0.6358951",
"0.6177919",
"0.60563976",
"0.6012035",
"0.5983042",
"0.5929131",
"0.58174324",
"0.5817323",
"0.57576334",
"0.5706275",
"0.56616384",
"0.5649061",
"0.56425726",
"0.5634829",
"0.56325567",
"0.5567068",
"0.5558785",
"0.55503845",
"0.55488545",
"0.5539... | 0.80756646 | 0 |
Constructs a MaskIndex from a JSON dictionary. | def from_dict(cls, d):
index = d.get("index", None)
if index is not None:
index = {
int(value): Attribute.from_dict(ad)
for value, ad in iteritems(index)
}
return cls(index=index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, mapping=None, **kwargs):\n\n masked_kwargs = {}\n if len(kwargs) > 0:\n masked_kwargs = self._mask_dict(kwargs)\n\n if isinstance(mapping, MaskedDict):\n super().__init__(self._unify(mapping, masked_kwargs))\n\n elif isinstance(mapping, (dict, He... | [
"0.5478897",
"0.5297613",
"0.52694786",
"0.5240679",
"0.51570094",
"0.5151151",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
"0.50982904",
... | 0.5821097 | 0 |
Creates a DataFileSequence instance for the given sequence. | def __init__(self, sequence, immutable_bounds=True):
self.sequence = sequence
self.immutable_bounds = immutable_bounds
self._extension = os.path.splitext(self.sequence)[1]
self._lower_bound, self._upper_bound = etau.parse_bounds_from_pattern(
self.sequence
)
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(cls: Type[Sequence], sequence: bytes, alphabet: Alphabet) -> Sequence:\n return cls(lib.imm_seq_create(sequence, alphabet.imm_abc), alphabet)",
"def sequence_to_biopython_record(\n sequence, id=\"<unknown id>\", name=\"<unknown name>\", features=()\n):\n if has_dna_alphabet:\n seq ... | [
"0.6637892",
"0.6181747",
"0.6043447",
"0.6024799",
"0.6001478",
"0.599184",
"0.59164035",
"0.5851341",
"0.5843446",
"0.58333296",
"0.5832064",
"0.5780453",
"0.5718229",
"0.56897944",
"0.56620103",
"0.55939054",
"0.5567729",
"0.55158764",
"0.549222",
"0.5492118",
"0.5480412",... | 0.619707 | 1 |
Checks if the index is within the bounds for this sequence. | def check_bounds(self, index):
if index < self.lower_bound or index > self.upper_bound:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __verify_index(self, index):\n if not isinstance(index, int):\n raise TypeError(\"Index must be of type int\")\n elif index >= self.length or index < -self.length:\n raise IndexError(\"Index out of bounds\")\n return True",
"def __is_valid(self, subscript):\n ... | [
"0.7743756",
"0.7266645",
"0.71771103",
"0.712753",
"0.7123661",
"0.7049638",
"0.69962424",
"0.6915459",
"0.68826395",
"0.68442345",
"0.6773398",
"0.67721176",
"0.67416173",
"0.6729419",
"0.67009795",
"0.668903",
"0.6605921",
"0.6588083",
"0.65783405",
"0.6572464",
"0.6539587... | 0.8669091 | 0 |
Generates the path for the file with the given sequence index. If the sequence has mutable bounds, the index can extend the sequence consecutively (i.e., by one index) above or below the current bounds. | def gen_path(self, index):
if self.immutable_bounds:
if not self.check_bounds(index):
raise DataFileSequenceError(
"Index %d out of bounds [%d, %d]"
% (index, self.lower_bound, self.upper_bound)
)
elif index < 0:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_seq_filename(self):\n fnd = self._get_session_dir()\n self.seq_number += 1\n fn = os.path.join(fnd, 'S%4.4d.tif' % self.seq_number)\n return fn",
"def filenum_index( # noqa: F811\n index: Optional[int], seq: \"FileSequence\"\n) -> Optional[int]:\n if index is None:\n ... | [
"0.5923429",
"0.58115065",
"0.5772479",
"0.5749777",
"0.5673819",
"0.5670448",
"0.561562",
"0.560478",
"0.55820173",
"0.55788344",
"0.5571164",
"0.5543174",
"0.55321175",
"0.5524482",
"0.55151856",
"0.55108917",
"0.5443332",
"0.54330754",
"0.5406386",
"0.54018956",
"0.5397607... | 0.8406517 | 0 |
Adds the records in the JSON file to the container. | def add_json(self, json_path, record_cls=None):
rc = record_cls or self._ELE_CLS
self.add_container(self.from_json(json_path, record_cls=rc))
return len(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_record():\n if 'json' not in request.files:\n # use an HTML record that seems appropriate\n return \"no json file in the request!\", 400\n try:\n # can't assume that JSON file is valid\n _record = json.loads(request.files['json'].read())\n except ValueError:\n re... | [
"0.65498114",
"0.64974004",
"0.64236826",
"0.6339578",
"0.6130468",
"0.59746075",
"0.59578854",
"0.5907128",
"0.5892819",
"0.58659583",
"0.58485895",
"0.5736148",
"0.57177305",
"0.5664405",
"0.5654199",
"0.5602515",
"0.559988",
"0.55985063",
"0.5575644",
"0.5556617",
"0.55430... | 0.69737047 | 0 |
Builds a lookup dictionary indexed by `field` whose values are lists of indices of the records whose `field` attribute matches the corresponding key. | def build_lookup(self, field):
lud = defaultdict(list)
for i, r in enumerate(self.__elements__):
lud[getattr(r, field)].append(i)
return dict(lud) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lookups_for_field(field):\n field_class = type(field)\n return [\n (lookup, LOOKUP_TYPES[lookup]) \\\n for lookup in FIELDS_TO_LOOKUPS[INV_FIELD_TYPES[field_class]]\n ]",
"def build_lookup_index(item: Resource, index_string: str):\n index = defaultdict(dict)\n if index_string... | [
"0.64730227",
"0.5716295",
"0.551497",
"0.5492499",
"0.5463954",
"0.53340346",
"0.53127265",
"0.53011155",
"0.5170127",
"0.5150985",
"0.5149047",
"0.5119388",
"0.51165813",
"0.5076202",
"0.50119376",
"0.4994829",
"0.49922776",
"0.49909088",
"0.49796864",
"0.4969731",
"0.49391... | 0.7838401 | 0 |
Builds a dictionary indexed by `field` whose values are lists of records whose `field` attribute matches the corresponding key. | def build_subsets(self, field):
sss = defaultdict(list)
for r in self.__elements__:
sss[getattr(r, field)].append(r)
return dict(sss) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_lookup(self, field):\n lud = defaultdict(list)\n for i, r in enumerate(self.__elements__):\n lud[getattr(r, field)].append(i)\n return dict(lud)",
"def record_to_dict(f_record, key_name: str):\n return_dict = {}\n for record in f_record:\n key = ''\n ... | [
"0.6895315",
"0.61138445",
"0.57409555",
"0.56086946",
"0.55212",
"0.54991513",
"0.5478987",
"0.54692143",
"0.5454076",
"0.54103667",
"0.5346098",
"0.5315012",
"0.52935874",
"0.5275915",
"0.52585053",
"0.5243504",
"0.52341795",
"0.5225069",
"0.5221858",
"0.52113163",
"0.52037... | 0.65679175 | 1 |
Cull records from the container based on `field`. | def cull(self, field, keep_values=None, remove_values=None):
lud = self.build_lookup(field)
# Determine values to keep
if remove_values:
keep_values = set(lud.keys()) - set(remove_values)
if not keep_values:
raise DataRecordsError(
"Either keep_va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cull_with_function(self, field, func):\n lud = self.build_lookup(field)\n\n # Cull records\n inds = set()\n for v in lud:\n if func(v):\n inds.update(lud[v])\n self.keep_inds(inds)\n\n return len(self)",
"def remove_filter_field(self, field)... | [
"0.61030185",
"0.54195553",
"0.5323119",
"0.4986233",
"0.49818215",
"0.49595803",
"0.48766378",
"0.48577824",
"0.48449743",
"0.4799145",
"0.4787641",
"0.47857893",
"0.47811604",
"0.47460705",
"0.46765202",
"0.46490967",
"0.4638372",
"0.46370828",
"0.46361995",
"0.46234384",
"... | 0.5545093 | 1 |
Cull records from the container for which `field` returns something that evaluates to False when passed through func. | def cull_with_function(self, field, func):
lud = self.build_lookup(field)
# Cull records
inds = set()
for v in lud:
if func(v):
inds.update(lud[v])
self.keep_inds(inds)
return len(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(self, func):\r\n\r\n d = self.data\r\n f = []\r\n for i in d:\r\n if func(i):\r\n f.append(i)\r\n return Records(f)",
"def reject(self, func=bool):\n return self.filter(lambda x: not func(x))",
"def wholeFieldPredicate(field):\n\n if fi... | [
"0.6246021",
"0.59056026",
"0.5561669",
"0.5532213",
"0.54449373",
"0.54386085",
"0.52966136",
"0.5288926",
"0.5282799",
"0.52240276",
"0.5167315",
"0.5153407",
"0.5135682",
"0.505053",
"0.5041102",
"0.5027123",
"0.5005287",
"0.49946797",
"0.49810916",
"0.49740827",
"0.495770... | 0.6549046 | 0 |
Creates a new DataRecords instance containing only the subset of records in this container with the specified indices. | def subset_from_indices(self, indices):
return self.extract_inds(indices) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _subset(self, idxs):\n vertices = [self.vertices[i] for i in idxs]\n if hasattr(self, \"data\"):\n data = Table(data=[self.data._data[i] for i in idxs], fields=self.data.fields)\n return type(self)(vertices, properties=self.properties, data=data, crs=self.crs)\n else:... | [
"0.59688765",
"0.5935681",
"0.5567602",
"0.5546546",
"0.5529566",
"0.5520367",
"0.5479978",
"0.5464802",
"0.5424255",
"0.53562534",
"0.53429353",
"0.5326171",
"0.5291528",
"0.52882534",
"0.5271028",
"0.52346957",
"0.5224938",
"0.51865077",
"0.5113216",
"0.5099608",
"0.5077727... | 0.6700164 | 0 |
Constructs a DataRecords instance from a dictionary. | def from_dict(cls, d, record_cls=None):
if record_cls is None:
record_cls_str = d.get(cls._ELE_CLS_FIELD, None)
if record_cls_str is None:
raise DataRecordsError(
"Your DataRecords does not have its '%s' attribute "
"populated, so y... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dicts(self, records, fieldnames=None):\n generator = _from_dicts(records, fieldnames=fieldnames)\n return Reader(generator)",
"def from_dict(cls, record, _id=None):\n # copy dict\n record = dict(record)\n\n # get record id and remove it from record\n record_id =... | [
"0.7356026",
"0.7138957",
"0.71198374",
"0.70284396",
"0.70236653",
"0.6950481",
"0.6917223",
"0.6891114",
"0.6885126",
"0.6884123",
"0.68505895",
"0.6840841",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",
"0.6824809",... | 0.7742329 | 0 |
Returns the list of attributes of the data record that are to be serialized. All private attributes (those starting with "_") and attributes in `excluded()` are omitted from this list. | def attributes(self):
attr = super(BaseDataRecord, self).attributes()
return [a for a in attr if a not in self.excluded()] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getDataAttributes(self):\n asRet = [];\n asAttrs = dir(self);\n for sAttr in asAttrs:\n if sAttr[0] == '_' or sAttr[0] == 'k':\n continue;\n if sAttr in self.kasInternalAttributes:\n continue;\n oValue = getattr(self, sAttr);... | [
"0.7105229",
"0.70813924",
"0.7015696",
"0.6925821",
"0.6905669",
"0.688247",
"0.68791455",
"0.6837716",
"0.67589146",
"0.6555124",
"0.65252256",
"0.6523603",
"0.64901346",
"0.641182",
"0.6391025",
"0.6391025",
"0.63747823",
"0.63747823",
"0.63747823",
"0.6345987",
"0.6328713... | 0.793529 | 0 |
Deletes any optional attributes from the data record that are not set, i.e., those that are `no_default`. Note that `None` is a valid value for an attribute. | def clean_optional(self):
for o in self.optional():
if hasattr(self, o) and getattr(self, o) is no_default:
delattr(self, o) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _none(self, attrs):\n\n [self.__setattr__(nm, None) if nm[0] == '_' else\n self._data.pop(nm, None) for nm in attrs]",
"def reinitToNull(self):\n for sAttr in self.getDataAttributes():\n setattr(self, sAttr, None);\n return self;",
"def _remove_none(self, data):\r\... | [
"0.7082738",
"0.658809",
"0.6563625",
"0.6503828",
"0.64280677",
"0.63774556",
"0.62657505",
"0.62206036",
"0.6208545",
"0.6182857",
"0.6078976",
"0.60499203",
"0.6038751",
"0.60058826",
"0.59697735",
"0.5966007",
"0.5949277",
"0.5938485",
"0.5923254",
"0.59182173",
"0.591341... | 0.73840094 | 0 |
Return a list of attributes that should always be excluded when the data record is serialized. By default, an empty list is returned. | def excluded(cls):
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attributes(self):\n attr = super(BaseDataRecord, self).attributes()\n return [a for a in attr if a not in self.excluded()]",
"def clean_attributes(self):\n attrs = {}\n\n # Only fetch the fields we need.\n for a in self.attributes.only('name', 'value', 'attribute').iterator... | [
"0.8822823",
"0.6527074",
"0.6519765",
"0.6508539",
"0.6495695",
"0.64912015",
"0.64014137",
"0.6366201",
"0.63595825",
"0.62454665",
"0.62342465",
"0.6213601",
"0.6187153",
"0.6184186",
"0.6173262",
"0.61586994",
"0.612149",
"0.6110278",
"0.6095926",
"0.6071295",
"0.60674345... | 0.68170273 | 1 |
Creates a new LabeledFileRecord instance. | def __init__(self, file_path, label):
self.file_path = file_path
self.label = label
super(LabeledFileRecord, self).__init__() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_record(filepath, linear=True, name=\"unnamed\", file_format=\"auto\"):\n if file_format != \"auto\":\n record = SeqIO.read(filepath, file_format)\n elif filepath.lower().endswith((\"gb\", \"gbk\")):\n record = SeqIO.read(filepath, \"genbank\")\n elif filepath.lower().endswith((\"fa\... | [
"0.60124975",
"0.5927857",
"0.57211214",
"0.53448856",
"0.5313057",
"0.5285396",
"0.52336323",
"0.5231617",
"0.5209988",
"0.5197654",
"0.5194985",
"0.5130312",
"0.5118215",
"0.5106813",
"0.50936395",
"0.5091654",
"0.50895816",
"0.50687593",
"0.5065505",
"0.50498515",
"0.50431... | 0.6933694 | 0 |
Creates a LabeledVideoRecord instance. | def __init__(self, video_path, label, group=no_default):
super(LabeledVideoRecord, self).__init__(video_path, label)
self.group = group | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _new_record():\n nonlocal key\n nonlocal value_list\n nonlocal record\n nonlocal origin\n nonlocal field_offset_map\n key = None\n value_list = None\n if source is not None:\n origin = Origin(source, None, None)\n field_offset_map = {}\n... | [
"0.5313232",
"0.5147112",
"0.51127493",
"0.5046695",
"0.49939334",
"0.49845952",
"0.4954849",
"0.4920668",
"0.48525804",
"0.48499542",
"0.481874",
"0.4812749",
"0.47554517",
"0.47434902",
"0.47304296",
"0.47288856",
"0.47284198",
"0.47124922",
"0.47115338",
"0.46898627",
"0.4... | 0.7032111 | 0 |
Given the code return the corresponding rules. | def find_rules_by_code(self, code):
try:
if(len(code)):
self.all_result = self.join_field_rule(ret_all=True).next()
if(self.all_result):
try:
return self.all_result.get(code)
except KeyError as error:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _score_code(self, code):\n # Get list of 2-tuples, each containing an input sequence and an output\n # sequence.\n io_seqs = self.task.make_io_set()\n terminal_reward = 0.0\n results = []\n reason = 'correct'\n for input_seq, output_seq in io_seqs:\n eval_result = bf.evaluate(\n ... | [
"0.64189136",
"0.5745816",
"0.5704152",
"0.5697134",
"0.5655006",
"0.56392395",
"0.5623657",
"0.5576453",
"0.5572982",
"0.55443037",
"0.5520338",
"0.55185455",
"0.5490856",
"0.5308763",
"0.52806115",
"0.52776045",
"0.52774376",
"0.52757066",
"0.52686936",
"0.5263126",
"0.5260... | 0.7306868 | 0 |
Given the field return the rule. | def get_rule_by_field(self, field):
try:
if(len(field)):
self.all_result = self.join_field_rule(ret_all=True).next()
if(self.all_result):
for code in self.all_result.values():
try:
return code.get... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")",
"def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")",
"def rule(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"rule\")",
"def rule(self) -> Optional[pulumi.Input[str]]:\n retu... | [
"0.6452631",
"0.6452631",
"0.6452631",
"0.6184227",
"0.6184227",
"0.6184227",
"0.6184227",
"0.6184227",
"0.6184227",
"0.6184227",
"0.6102919",
"0.6000917",
"0.59157825",
"0.59157825",
"0.59157825",
"0.5800254",
"0.5708165",
"0.5688316",
"0.54578036",
"0.5444998",
"0.54006064"... | 0.68929523 | 0 |
Get geocode results from Google Maps Geocoding API. Note, that in the case of multiple google geocode reuslts, this function returns details of the FIRST result. | def get_google_results(address, api_key=None, return_full_response=False):
# Set up your Geocoding url
geocode_url = "https://maps.googleapis.com/maps/api/geocode/json?address={}".format(address) + "&sensor=false"
# if api_key is not None:
# geocode_url = geocode_url + "&key={}".format(api_key)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_google_results(address):\n\t# Set up your Geocoding url\n\tlogging.info(\"[GOOGLE URL]: init\")\n\tparams = {\n\t\"address\":address,\n\t\"key\":GEOPY.get('AQUEDUCT_GOOGLE_PLACES_PRIVATE_KEY')\n\t}\n\t\n\t# Ping google for the reuslts:\n\ttry:\n\t\twith requests.Session() as s:\n\t\t\ts.mount('https://',HT... | [
"0.75825644",
"0.7065095",
"0.69788176",
"0.6944597",
"0.68306345",
"0.6712675",
"0.66840744",
"0.66496253",
"0.65347934",
"0.6481211",
"0.6473336",
"0.6473213",
"0.64647895",
"0.64577734",
"0.6385589",
"0.6328624",
"0.6250599",
"0.6218072",
"0.6167225",
"0.6133725",
"0.61009... | 0.7563831 | 1 |
Shortcut for a module of dense layer, batch normalization and possibly adding of Gaussian noise. | def dense_bn_act(inputs, units, activation, kernel_init, noise=False, noise_std=0.5):
_tmp = tf.layers.dense(inputs=inputs, units=units, activation=None, kernel_initializer=kernel_init)
_tmp = tf.contrib.layers.batch_norm(_tmp, center=True, scale=True, is_training=phase)
_tmp = activation(_tmp)
if noise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dense_block(X, neurons_per_layer, add_noise, hidden_activation):\n Y = Dense(neurons_per_layer)(X)\n\n if add_noise:\n Y = GaussianDropout(0.005)(Y)\n\n Y = LayerNormalization()(Y)\n Y = hidden_activation(Y)\n return Concatenate()([X, Y])",
"def __init__(self, hidden_units, act_fn=activ... | [
"0.6515949",
"0.6381442",
"0.6347507",
"0.62334216",
"0.6144226",
"0.6126199",
"0.6119312",
"0.6050492",
"0.6039742",
"0.5975316",
"0.5937367",
"0.5920974",
"0.58605415",
"0.5844079",
"0.58208776",
"0.58104813",
"0.57957095",
"0.5795613",
"0.5778775",
"0.576105",
"0.5750413",... | 0.6406165 | 1 |
Tests aborting a task without using an event. In theory once the future is cancelled, the dask worker shall 'forget' the task. Sadly this does not work in distributed mode where an Event is necessary. | def test_task_is_aborted(dask_client: distributed.Client):
# NOTE: this works because the cluster is in the same machine
future = dask_client.submit(_some_long_running_task)
_wait_for_task_to_start()
future.cancel()
assert future.cancelled()
with pytest.raises(concurrent.futures.CancelledError):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_cancel(self) -> None:\n context: Dict[str,ArtifactDescriptor] = dict()\n cmd = pycell.python_cell(\n source='import time\\ntime.sleep(5)',\n validate=True\n )\n controller = FakeWorkflowController()\n self.backend.execute_async(\n task=Ta... | [
"0.67319435",
"0.6726781",
"0.6667438",
"0.6589503",
"0.6548635",
"0.6491699",
"0.6402465",
"0.6327161",
"0.6293195",
"0.6251757",
"0.6241168",
"0.6227773",
"0.6225861",
"0.62026316",
"0.61707467",
"0.61396015",
"0.6129849",
"0.6107896",
"0.61020535",
"0.60851115",
"0.6073518... | 0.7703924 | 0 |
Returns the successor state after the specified agent takes the action. | def generateSuccessor( self, agentIndex, action):
# Check that successors exist
if self.isWin() or self.isLose(): raise Exception('Can\'t generate a successor of a terminal state.')
# Copy current state
state = GameState(self)
# Let agent's logic deal with its action's effects ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next(self, state, turn, greedy_strategy):\n return self.agent_action",
"def agent_start(self, state):\n self.sum_rewards = 0\n self.episode_steps = 0\n self.last_state = np.array(state)\n self.last_action = self.policy(self.last_state)\n return self.last_action",
"... | [
"0.6769947",
"0.66912377",
"0.66013414",
"0.6584788",
"0.65628904",
"0.65581864",
"0.6526788",
"0.6497395",
"0.6473691",
"0.6469876",
"0.6434387",
"0.6432849",
"0.63574517",
"0.63170356",
"0.6308071",
"0.628067",
"0.6278178",
"0.624061",
"0.6201841",
"0.6152078",
"0.6146595",... | 0.7010531 | 0 |
Returns an AgentState object for pacman (in game.py) state.pos gives the current position state.direction gives the travel vector | def getPacmanState( self ):
return self.data.agentStates[0].copy() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_agent(self, state):\n m = self.m\n n = self.n\n\n cur_env = deepcopy(state.grid)\n cur_env[m, n] = 0\n action = self.choose_action(state)\n\n if action == 'Right':\n if n + 1 >= grid_size or cur_env[m][n+1] != 0:\n Rew = -2 # Reward -5 if... | [
"0.67357004",
"0.6304223",
"0.62236255",
"0.6187711",
"0.59295386",
"0.59182173",
"0.58750075",
"0.58393127",
"0.58230054",
"0.57619905",
"0.56301194",
"0.5618911",
"0.5592257",
"0.5557571",
"0.55485815",
"0.55370945",
"0.5535987",
"0.55244625",
"0.5482656",
"0.5482656",
"0.5... | 0.68078905 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.