query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Add a set of nodes to a role. The ROLE argument specify the role which the nodes will be added. | def role_add(role, nodes, node, node_vars, host_vars, extra):
role_manager = get_role_manager()
node += nodes
nodes, node_vars, host_vars, extra_args = _split_vars(
node, node_vars, host_vars, extra)
if not nodes:
raise ArgumentError('No nodes informed')
added_nodes = role_manager.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_adding_node_multiple_roles(self):\n Nodes().nodes_discovered[0].checkbox.click()\n with RolesPanel() as r:\n r.controller.click()\n r.cinder.click()\n r.ceph_osd.click()\n Nodes().apply_changes.click()\n time.sleep(1)\n with Nodes() as n:... | [
"0.68646795",
"0.6732058",
"0.6718173",
"0.63641965",
"0.6343155",
"0.6333133",
"0.63255256",
"0.6093537",
"0.60662687",
"0.6046124",
"0.5994745",
"0.59777933",
"0.5960202",
"0.595892",
"0.58962196",
"0.58676285",
"0.57872",
"0.57861674",
"0.5776835",
"0.5765455",
"0.5741388"... | 0.7983592 | 0 |
Perform an group action at a set of nodes. The ROLE argument specify the role which the action will be performed. | def role_action(role, action, nodes, node, node_vars, host_vars, extra):
role_manager = get_role_manager()
node += nodes
nodes, node_vars, host_vars, extra_args = _split_vars(
node, node_vars, host_vars, extra)
if not nodes:
nodes = role_manager.get_all_role_nodes_hosts(role)
else:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_adding_node_multiple_roles(self):\n Nodes().nodes_discovered[0].checkbox.click()\n with RolesPanel() as r:\n r.controller.click()\n r.cinder.click()\n r.ceph_osd.click()\n Nodes().apply_changes.click()\n time.sleep(1)\n with Nodes() as n:... | [
"0.542813",
"0.54093146",
"0.5217608",
"0.514884",
"0.51022536",
"0.50641006",
"0.5063021",
"0.49907935",
"0.4959319",
"0.49530065",
"0.4937757",
"0.49216166",
"0.4792276",
"0.4791709",
"0.47832346",
"0.47490916",
"0.47359744",
"0.47330654",
"0.4713322",
"0.46839148",
"0.4647... | 0.6100199 | 0 |
Print roles in role path. The ROLE argument filter specific roles. | def role_list(role, detailed, indent, quiet):
if quiet and detailed:
raise ValueError(f"Options `detailed` and `quiet` are mutually exclusive")
role_manager = get_role_manager()
roles = role_manager.roles if not role else {
rname: r
for rname, r in role_manager.roles.items() if rnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_roles(role):",
"async def command_rolecall(self, context):\n print(self._fetch_category_roles(context))\n print(self._fetch_category_roles(context, COSMETIC_CATEGORY_NAME))",
"def test_list_roles(self):\n pass",
"async def roles(self, ctx, *, role: Fuzzy[Selfrole] = None):\n\n ... | [
"0.6430919",
"0.633462",
"0.61451775",
"0.60598814",
"0.60481584",
"0.5967613",
"0.59049743",
"0.58852696",
"0.5871352",
"0.5838742",
"0.58185387",
"0.5815103",
"0.57983583",
"0.5796137",
"0.5789229",
"0.57704955",
"0.5754722",
"0.5742902",
"0.57375866",
"0.5691435",
"0.56904... | 0.6729608 | 0 |
Explicitly set identity and claims for jwt. | def add_claims_to_access_token(identity):
if identity == 'admin':
roles = 'admin'
else:
roles = 'peasant'
now = datetime.utcnow()
return {
'exp': now + current_app.config['JWT_EXPIRES'],
'iat': now,
'nbf': now,
'sub': identity,
'roles': roles
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_claims_to_jwt(identity):\n user = UserModel.find_by_id(identity)\n if user.is_admin:\n return {\"is_admin\": True}\n return {\"is_admin\": False}",
"def remember(self, response, request, identity):\n extra_claims = identity.as_dict()\n userid = extra_claims.p... | [
"0.65983707",
"0.65081966",
"0.61748314",
"0.6009898",
"0.59909314",
"0.5906171",
"0.58335584",
"0.5824592",
"0.58182263",
"0.57838553",
"0.5780166",
"0.55363196",
"0.55278736",
"0.55009097",
"0.5463044",
"0.54460394",
"0.5442401",
"0.54184085",
"0.5409769",
"0.5373524",
"0.5... | 0.6664418 | 0 |
Search list for device name and retrieve address | def get_address(self,device_list):
for device in device_list:
if device.name == self.NAME:
self.ADDR = device.address
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(self,name=None):\n\t\taddresses = discover_devices()\n\t\t#if len(addresses) == 0:\n\t\t#\treturn None\n\t\tnames = []\n\t\tfor adr in addresses:\n\t\t\tnames.append(lookup_name(adr))\n\t\t\tif name != None and name == names[-1]:\n\t\t\t\treturn adr\n\n\t\treturn zip(addresses,names)",
"def _find_devi... | [
"0.753403",
"0.6893208",
"0.6690935",
"0.6621304",
"0.6455121",
"0.64122295",
"0.63889885",
"0.6303021",
"0.61488307",
"0.6101672",
"0.60946697",
"0.6088623",
"0.606284",
"0.6058179",
"0.60379183",
"0.6000065",
"0.5980085",
"0.592712",
"0.59264034",
"0.5920494",
"0.59175026",... | 0.7269385 | 1 |
Connect button press callback, retrieves device name from text box and sets flag | def get_device(self):
self.connect_button = 1
self.device_name = self.deviceEntry.text() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_connect(self):\n pass",
"def connect(self):\n def f():\n com_port = self.ports_listbox.get(tk.ACTIVE)\n ser = serial.Serial(com_port)\n print(\"connected to :\" + ser.name)\n self.connect_msg = tk.Label(self.connect_frame, text=\"Connected to :... | [
"0.66811657",
"0.6662639",
"0.6400079",
"0.63588834",
"0.6315138",
"0.62960154",
"0.62502056",
"0.62403375",
"0.60962975",
"0.606808",
"0.60387564",
"0.59946436",
"0.5988977",
"0.59868294",
"0.59591913",
"0.5915835",
"0.58743566",
"0.5867381",
"0.5817054",
"0.581208",
"0.5810... | 0.7825053 | 0 |
Check that the options and value positional arguments are working for RadioItems. | def test_dbpa002_radio_items(dash_duo):
app = Dash()
options = {
"OptionA": "Option 1",
"OptionB": "Option 2",
"OptionC": "Option 3",
}
value = "OptionB"
with_keywords = RadioItems(
options=options,
value=value,
id="with-keywords",
)
without... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_radioselect_field():",
"def check_argument(self, struct_class, item, keyword, value):\n pass",
"def _validate_options(self):\r\n valid_choices = ('correct', 'partially-correct', 'incorrect')\r\n for option in self.options:\r\n choice = option['choice']\r\n if... | [
"0.63287705",
"0.59502095",
"0.5938727",
"0.5835922",
"0.5808001",
"0.57984513",
"0.5779106",
"0.56867117",
"0.56511545",
"0.5647488",
"0.5631126",
"0.551938",
"0.5463903",
"0.54584664",
"0.5452936",
"0.54190683",
"0.5414275",
"0.54088724",
"0.539896",
"0.539767",
"0.5382266"... | 0.6168521 | 1 |
Test draw two (nondeterministic(. | def test_draw_two(self):
f = txn_oracle.draw_two
for _ in range(1000):
max_n = random.randint(4, 20)
i, j = f(max_n)
assert i != j | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_simulate_draw():\n # TODO: Use a proper testing framework\n TESTS = [\n ([], []),\n (['A'], []),\n (['A', 'B', 'C', 'D'], [('A', 'C'), ('D', 'B'), ('A', 'B'), ('C', 'D'), ('A', 'D'), ('B', 'C')]),\n (['A', 'B', 'C', 'D', 'E'], [('A', 'E'), ('B', 'C'), ('A', 'D'), ('E', 'C... | [
"0.701766",
"0.6821074",
"0.64297235",
"0.637359",
"0.6368454",
"0.62849975",
"0.61145186",
"0.60920817",
"0.608275",
"0.6082548",
"0.60510737",
"0.60502326",
"0.5988041",
"0.5981341",
"0.5977884",
"0.5976905",
"0.5951073",
"0.5951073",
"0.5951073",
"0.5949259",
"0.592096",
... | 0.76903397 | 0 |
Checks for differences between ActivityType instance and upstream version | def _diff(self) -> ModelDiff:
try:
description = self.connection.describe_activity_type(self.domain.name, self.name, self.version)
except SWFResponseError as err:
if err.error_code == "UnknownResourceFault":
raise DoesNotExistError("Remote ActivityType does not ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__ActivityMetadataBase__eq():\n activity_metadata = ActivityMetadataBase()\n \n vampytest.assert_eq(activity_metadata, activity_metadata)\n vampytest.assert_ne(activity_metadata, object())",
"def type(self, type):\n allowed_values = [\"android\", \"ios\"]\n if type.lower() not i... | [
"0.5724631",
"0.55525714",
"0.5368454",
"0.5284736",
"0.5281542",
"0.5276441",
"0.52265596",
"0.5200576",
"0.5189388",
"0.5187152",
"0.5167561",
"0.5157312",
"0.51186454",
"0.5118532",
"0.5112942",
"0.5107356",
"0.5081232",
"0.50169253",
"0.4989162",
"0.49855864",
"0.49466124... | 0.58819556 | 0 |
Checks if the ActivityType exists amazonside | def exists(self) -> bool:
self.connection.describe_activity_type(self.domain.name, self.name, self.version)
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exists_intent_action(self, intent_keyword):\n pass",
"def is_start(self, activity) -> bool:\n return activity == self.activity_concept_name(TRACE_START)",
"def is_asset_based_activity(self):\n return bool(self._my_map['assetIds'])",
"def check_action_type_exists(\n action_type... | [
"0.62097484",
"0.56517756",
"0.55855805",
"0.55750483",
"0.55431366",
"0.5327626",
"0.5315846",
"0.5300829",
"0.5234638",
"0.52015376",
"0.51873296",
"0.5181711",
"0.5171451",
"0.5164309",
"0.51637644",
"0.5154588",
"0.5144253",
"0.51424676",
"0.51396215",
"0.512979",
"0.5112... | 0.6902263 | 0 |
Tests updating aesthetic fields on Tenant | def test_tenant_update(sample_identity):
access_token, tenant, tenant_user, tc = sample_identity
tenant.name = "ilovebeansllc"
headers = {"Authorization": "Bearer " + access_token}
updated_tenant_request = id_schemas.TenantSchema().dump(tenant)
updated_tenant = tc.put(
f"api/v1/identity/tena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tenant_user_aesthetic_update(sample_identity):\n access_token, tenant, tenant_user, tc = sample_identity\n headers = {\"Authorization\": \"Bearer \" + access_token}\n new_email = f\"{uuid.uuid4()}@c1.com\"\n new_first_name = str(uuid.uuid4())\n new_last_name = str(uuid.uuid4())\n updated... | [
"0.74706066",
"0.70539707",
"0.70173454",
"0.6784828",
"0.66443217",
"0.6637554",
"0.6588656",
"0.6583764",
"0.6583764",
"0.6583764",
"0.6574935",
"0.6535326",
"0.6534278",
"0.65183234",
"0.6483002",
"0.64679134",
"0.6450146",
"0.6431829",
"0.6415476",
"0.64035213",
"0.639738... | 0.7749024 | 0 |
Tests aesthetic updates for tenant_user | def test_tenant_user_aesthetic_update(sample_identity):
access_token, tenant, tenant_user, tc = sample_identity
headers = {"Authorization": "Bearer " + access_token}
new_email = f"{uuid.uuid4()}@c1.com"
new_first_name = str(uuid.uuid4())
new_last_name = str(uuid.uuid4())
updated_tenant_user = {"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_update_user(self):\n pass",
"def test_tenant_update(sample_identity):\n access_token, tenant, tenant_user, tc = sample_identity\n tenant.name = \"ilovebeansllc\"\n headers = {\"Authorization\": \"Bearer \" + access_token}\n updated_tenant_request = id_schemas.TenantSchema().dump(tenan... | [
"0.73280764",
"0.73153883",
"0.72682774",
"0.71767485",
"0.6941097",
"0.6702267",
"0.6653942",
"0.6599848",
"0.6599473",
"0.6586029",
"0.6533386",
"0.65045184",
"0.6487314",
"0.64579034",
"0.6445055",
"0.64442503",
"0.64317745",
"0.64147985",
"0.6383129",
"0.63338864",
"0.632... | 0.8055346 | 0 |
Tests authorization around limiting reassignment of TenantUsers by nonadministrators | def test_tenant_user_change_tenant(sample_identity):
access_token, tenant, tenant_user, tc = sample_identity
# Create a new Tenant
new_tenant = identity.Tenant()
new_tenant.name = "Aperture Science"
db.session.add(new_tenant)
db.session.commit()
# Create a Tenant Specific admin role
new_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_can_change_superuser(self):\n self.assertTrue(self.story.user_can_change(self.superuser))",
"def test_user_can_change_admin(self):\n self.assertTrue(self.story.user_can_change(self.admin_user))",
"def test_admin_get(self, *args, **kwargs):\n self.request.user.is_active = True... | [
"0.6481255",
"0.6474486",
"0.642696",
"0.642696",
"0.6413336",
"0.6392763",
"0.6392763",
"0.6359528",
"0.6330002",
"0.6308295",
"0.6306587",
"0.627981",
"0.627981",
"0.627981",
"0.627981",
"0.6235596",
"0.62184274",
"0.62184274",
"0.62184274",
"0.62184274",
"0.62169385",
"0... | 0.7147109 | 0 |
get score ranging from [0, 100] from gender, grate, test_name and test_result. | def get_score_from_test(gender, grade, test_name, test_result):
score_map = TestSports[test_name.upper()] \
.value \
[Constants.SCORE_MAP] \
[Gender[gender.upper()]] \
[Grade[grade.upper()]]
print(score_map)
score = Student.get_score(score_map, te... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_score(score_map, test_result):\n if test_result < score_map[20]:\n return int((test_result / score_map[20]) * 20)\n elif test_result < score_map[40]:\n return int(20 + (test_result - score_map[20]) / (score_map[40] - score_map[20]) * 20)\n elif test_result < score... | [
"0.68614393",
"0.6568922",
"0.64610434",
"0.61989254",
"0.6156589",
"0.6151049",
"0.6018301",
"0.60071886",
"0.6000255",
"0.59969515",
"0.5904228",
"0.58880126",
"0.5869166",
"0.5790369",
"0.5775762",
"0.5764602",
"0.57628024",
"0.575975",
"0.5730284",
"0.5727392",
"0.5714177... | 0.7776665 | 0 |
Calculate the overlay polygon based on the selection and the location of the source and destination plots. | def calculate_points(self, component):
# find selection range on source plot
x_start, x_end = self._get_selection_screencoords()
if x_start > x_end:
x_start, x_end = x_end, x_start
y_end = self.source.y
y_start = self.source.y2
left_top = np.array([x_start, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_points(self, component):\n # find selection range on source plot\n x_start, x_end = self._get_selection_screencoords()\n if x_start > x_end:\n x_start, x_end = x_end, x_start\n\n y_end = self.source.y\n y_start = self.source.y2\n\n left_top = np.ar... | [
"0.66302127",
"0.6113158",
"0.5918895",
"0.5812843",
"0.5737684",
"0.57315946",
"0.55679476",
"0.5533929",
"0.55014855",
"0.54703",
"0.5465126",
"0.54649836",
"0.5447356",
"0.54321885",
"0.5431229",
"0.5395844",
"0.53884107",
"0.53771347",
"0.5351133",
"0.5337138",
"0.5334806... | 0.66462404 | 0 |
Returns a tuple of (x1, x2) screen space coordinates of the start and end selection points. If there is no current selection, then returns None. | def _get_selection_screencoords(self):
selection = self.source.index.metadata["selections"]
if (selection is not None) and (len(selection) == 2):
mapper = self.source.index_mapper
return mapper.map_screen(np.array(selection))
else:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_selection(self):\n if not len(self.GetSelectionBlockTopLeft()):\n selected_columns = self.GetSelectedCols()\n selected_rows = self.GetSelectedRows()\n if selected_columns:\n start_col = selected_columns[0]\n end_col = selected_columns[-1... | [
"0.7141307",
"0.69176507",
"0.689422",
"0.6854982",
"0.65557784",
"0.65557784",
"0.655157",
"0.6543182",
"0.6430244",
"0.6377898",
"0.6370149",
"0.6288393",
"0.6245805",
"0.62029105",
"0.6114205",
"0.60794985",
"0.60788393",
"0.6052775",
"0.6035539",
"0.6032607",
"0.6031879",... | 0.7626898 | 0 |
Calculate the overlay polygon based on the selection and the location of the source and destination plots. | def calculate_points(self, component):
# find selection range on source plot
x_start, x_end = self._get_selection_screencoords()
if x_start > x_end:
x_start, x_end = x_end, x_start
y_end = self.source.y
y_start = self.source.y2
left_top = np.array([x_start, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_points(self, component):\n # find selection range on source plot\n x_start, x_end = self._get_selection_screencoords()\n if x_start > x_end:\n x_start, x_end = x_end, x_start\n\n y_end = self.source.y\n y_start = self.source.y2\n\n left_top = np.ar... | [
"0.66459286",
"0.6113643",
"0.5918995",
"0.581146",
"0.5736627",
"0.57313544",
"0.55649126",
"0.5532528",
"0.5501249",
"0.5472025",
"0.5466082",
"0.5463649",
"0.54483116",
"0.543107",
"0.5429053",
"0.5395462",
"0.5387459",
"0.53762674",
"0.53500515",
"0.5334074",
"0.5333486",... | 0.662988 | 1 |
Display error messages and exit if no lore environment can be found. | def validate():
if not os.path.exists(os.path.join(ROOT, APP, '__init__.py')):
message = ansi.error() + ' Python module not found.'
if os.environ.get('LORE_APP') is None:
message += ' $LORE_APP is not set. Should it be different than "%s"?' % APP
else:
message += ' $L... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_environment():\n\n if \"MROPATH\" not in os.environ:\n raise EnvironmentError(\n \"MROPATH is not in the environment. You probably need to source \"\n \"sourceme.bash in cellranger before running this tool.\")\n\n try:\n import martian\n except ImportError:\n... | [
"0.61916924",
"0.6157401",
"0.60019594",
"0.57859117",
"0.5725944",
"0.5690237",
"0.56561863",
"0.5636664",
"0.5628953",
"0.5622101",
"0.5586993",
"0.558566",
"0.5548352",
"0.5535722",
"0.552629",
"0.5431093",
"0.54161894",
"0.541161",
"0.5392171",
"0.5378731",
"0.5378731",
... | 0.6898733 | 0 |
Reboot python in the Lore virtualenv | def reboot(*args):
args = list(sys.argv) + list(args)
if args[0] == 'python' or not args[0]:
args[0] = BIN_PYTHON
elif os.path.basename(sys.argv[0]) in ['lore', 'lore.exe']:
args[0] = BIN_LORE
try:
os.execv(args[0], args)
except Exception as e:
if args[0] == BIN_LORE ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def launch():\n if launched():\n check_version()\n os.chdir(ROOT)\n return\n\n if not os.path.exists(BIN_LORE):\n missing = ' %s virtualenv is missing.' % APP\n if '--launched' in sys.argv:\n sys.exit(ansi.error() + missing + ' Please check for errors during:\\n ... | [
"0.7200766",
"0.6681993",
"0.64902824",
"0.6444445",
"0.6389589",
"0.6350412",
"0.6226529",
"0.620856",
"0.6193457",
"0.61873376",
"0.6184521",
"0.6169208",
"0.61558735",
"0.61380976",
"0.6134002",
"0.61229736",
"0.61192197",
"0.61192197",
"0.6106537",
"0.61041933",
"0.608945... | 0.7048641 | 1 |
Sanity check version information for corrupt virtualenv symlinks | def check_version():
if sys.version_info[0:3] == PYTHON_VERSION_INFO[0:3]:
return
sys.exit(
ansi.error() + ' your virtual env points to the wrong python version. '
'This is likely because you used a python installer that clobbered '
'the system inst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def virtualenvwrapper_check():\n compare_result = False\n try:\n output = subprocess.check_output(shlex.split(\"virtualenv --version\"), stderr=subprocess.STDOUT)\n lines = output.split(\"\\n\")\n version_string = re.compile(\"(\\d)+.(\\d)+.(\\d)\")\n line0_result = version_string... | [
"0.7584612",
"0.7228096",
"0.6507939",
"0.6470493",
"0.6291816",
"0.6286967",
"0.62677675",
"0.6260375",
"0.6246277",
"0.6246277",
"0.62108517",
"0.61992663",
"0.6196206",
"0.6093963",
"0.6093267",
"0.60822755",
"0.60623604",
"0.59810627",
"0.59753",
"0.59671587",
"0.5955721"... | 0.7871301 | 0 |
Attempts to read a python version string from a runtime.txt file | def read_version(path):
version = None
if os.path.exists(path):
version = open(path, 'r', encoding='utf-8').read().strip()
if version:
return re.sub(r'^python-', '', version)
return version | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_version():\n # code parts were taken from here https://stackoverflow.com/a/67692\n\n path2setup = os.path.dirname(__file__)\n version_file = os.path.abspath(\n os.path.join(path2setup, \"diffusion_maps\", \"version.py\"))\n\n spec = importlib.util.spec_from_file_location(\"version\", ve... | [
"0.7306961",
"0.6943205",
"0.6914566",
"0.6862325",
"0.6823303",
"0.6819166",
"0.6711935",
"0.67099226",
"0.6701405",
"0.66575587",
"0.66575587",
"0.66575587",
"0.66559863",
"0.66173005",
"0.6604965",
"0.65997416",
"0.6592785",
"0.6542442",
"0.65181917",
"0.64456487",
"0.6434... | 0.73625326 | 0 |
Idempotently caches the list of packages installed in the virtualenv. Can be run safely before the virtualenv is created, and will be rerun afterwards. | def set_installed_packages():
global INSTALLED_PACKAGES, REQUIRED_VERSION
if INSTALLED_PACKAGES:
return
if os.path.exists(BIN_PYTHON):
pip = subprocess.Popen(
(BIN_PYTHON, '-m', 'pip', 'freeze'),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_installed_packages():\n global INSTALLED_PACKAGES\n chk = Popen(\"{} -m pip freeze\".format(sys.executable),\n shell=True, stdout=PIPE)\n installed = chk.communicate()[0].decode().splitlines()\n for pkg in installed:\n item = pkg.split(\"==\")\n INSTALLED_PACKAGES[i... | [
"0.688422",
"0.64512485",
"0.612748",
"0.61209935",
"0.61056507",
"0.60841095",
"0.60402966",
"0.60189337",
"0.5927029",
"0.5900896",
"0.58980316",
"0.587823",
"0.58747333",
"0.587424",
"0.5825978",
"0.581681",
"0.57706964",
"0.5763765",
"0.56364876",
"0.5628184",
"0.56278956... | 0.72177386 | 0 |
Given two matching sets of coordinates on detector and sky, compute the WCS. Fits a WCS object to matched set of input detector and sky coordinates. Optionally, a SIP can be fit to account for geometric distortion. Returns an `~astropy.wcs.WCS` object with the best fit parameters for mapping between input pixel and sky... | def fit_wcs_from_points(xy, world_coords, proj_point='center',
projection='TAN', sip_degree=None): # pragma: no cover
from astropy.coordinates import SkyCoord # here to avoid circular import
import astropy.units as u
from astropy.wcs import Sip
from scipy.optimize import least_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WCS(imname, outname, astronet=False, timeout=None):\n\n print_cmd_line(\"STAP_WCS.py\", imname, outname,\n astronet=astronet, timeout=timeout)\n\n if astronet:\n cmd = \"solve-mosaic_single.py {0} {1}\".format(imname,outname)\n else:\n cmd = \"{0}/bin/SM-WCS-perchip.py ... | [
"0.5859561",
"0.5762514",
"0.56438285",
"0.56424916",
"0.5291895",
"0.5234622",
"0.5210285",
"0.5084179",
"0.50814235",
"0.50549525",
"0.49854365",
"0.49420464",
"0.49419275",
"0.4907917",
"0.49040973",
"0.48516577",
"0.48470798",
"0.48208737",
"0.4797842",
"0.47903037",
"0.4... | 0.7024653 | 0 |
The function creates an new dictionary entry 'AUX' that includes starting values of each parameter and the number of covariates. | def auxiliary(dict_):
dict_['AUX'] = {}
if dict_['DIST']['coeff'] == [0.0] * len(dict_['DIST']['coeff']):
is_deterministic = True
else:
is_deterministic = False
for key_ in ['UNTREATED', 'TREATED', 'COST', 'DIST']:
if key_ in ['UNTREATED', 'TREATED', 'COST']:
dict_[k... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _defineNAAuxVars(self, aux_vars):\n # Initialise aux var itesms as empty lists unless already defined when\n # setting up independent variables\n for item in (\"ANAME\", \"AMISS\", \"ASCAL\", \"A\"):\n if not item in self.na_dict:\n self.na_dict[item] = [] \n\n ... | [
"0.6057564",
"0.5864776",
"0.5754266",
"0.5638249",
"0.5591831",
"0.5581381",
"0.5527932",
"0.54958975",
"0.547379",
"0.54407537",
"0.5427459",
"0.5399545",
"0.53982776",
"0.5394155",
"0.5391664",
"0.5377814",
"0.536098",
"0.53573656",
"0.53436345",
"0.53409773",
"0.53394157"... | 0.7014374 | 0 |
Train hotel cluster embeddings model on data saved in ../processed. | def main(input_filepath, output_model_filepath):
logger = logging.getLogger(__name__)
logger.info('training hotel cluster embeddings models')
input_file = os.path.join(input_filepath, 'sentences.pkl')
output_model_file = os.path.join(output_model_filepath, 'hotelcluster2vec.bin')
train(input_file,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data_and_embedding():\n\n # Load data\n df_data = pd.read_csv('../new_data/train_ids_and_labels_1400.txt',nrows=10000)\n y = df_data['class'] - 1 # class (0 ~ 18)\n X = df_data.drop(['class'], axis=1).values\n\n # Transform to binary class matrix\n y = to_categorical(y.values)\n\n # ... | [
"0.6813423",
"0.67908955",
"0.6574832",
"0.65220845",
"0.65132666",
"0.64946496",
"0.64639014",
"0.6463797",
"0.6428264",
"0.6420494",
"0.6386705",
"0.6360645",
"0.6349112",
"0.6337634",
"0.6322277",
"0.6321008",
"0.6292582",
"0.6291619",
"0.6290588",
"0.62819844",
"0.6276907... | 0.7133405 | 0 |
Create an unresolved Entry for this builder. Calls `_CONTEXT.on_entry` to register/check dependencies etc. | def __call__(self, config):
entry = Entry(self.name, make_key(config), config, None, None, None)
if not hasattr(_CONTEXT, "on_entry"):
return entry
on_entry = _CONTEXT.on_entry
if on_entry:
on_entry(entry)
return entry | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_entry(entry):\n Entry.create(**entry)\n return entry",
"def get_entry(self):\n # Filter out any fields that are invalid for the type of a new entry.\n properties = {\n field: value\n for field, value in self.properties.items()\n if field in self.typ... | [
"0.62241614",
"0.57561404",
"0.57318985",
"0.5663275",
"0.56416744",
"0.55154335",
"0.53690875",
"0.5359811",
"0.53573525",
"0.52931273",
"0.5256571",
"0.52439976",
"0.5211755",
"0.52079546",
"0.51699185",
"0.5136273",
"0.5114029",
"0.50949085",
"0.5077293",
"0.50508136",
"0.... | 0.5899941 | 1 |
Convert from mjd utc to et using tempo2 out put tt2tdb | def mjd2et(mjd,tt2tdb):
mjdJ2000 = mp.mpf("51544.5")
secDay = mp.mpf("86400.0")
mjdTT = tc.mjd2tdt(mp.mpf(mjd))
# Convert mjdutc to mjdtdt using HP time convert lib
# print "python ",mjdTT
et = (mp.mpf(mjdTT)-mjdJ2000)*mp.mpf(86400.0)+mp.mpf(tt2tdb)
return et | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mjd2et(self, time):\n time=time+2400000.5\n return (sp.str2et('JD '+repr(time)))",
"def jd_ut2tt(jd_ut):\n return jd_ut + (tt_utc_diff(jd_ut) / SECS_PER_DAY)",
"def mjd2et(self, time):\n\n time=time+2400000.5\n return (sp.str2et('JD '+repr(time)))",
"def tt(self):\n ... | [
"0.6171598",
"0.6124459",
"0.6097692",
"0.60189444",
"0.58888805",
"0.5768944",
"0.5681068",
"0.56782854",
"0.56636965",
"0.5663579",
"0.5656989",
"0.5644563",
"0.5634823",
"0.5623353",
"0.5617294",
"0.5596455",
"0.55814743",
"0.55583227",
"0.5466163",
"0.53965133",
"0.538057... | 0.7648814 | 0 |
Suggest a default file name for a results (dac) file. If the file is in a '/femdata' folder, will suggest the respective '/results' folder. Otherwise the file is simply renamed from '.fem' to '.dac'. | def suggest_dac_filename(self, relative=False):
fempath = os.path.abspath(self.doc.getProblemPath())
folders = os.path.dirname(fempath).split(os.path.sep)
if folders[-1] == "femdata":
folders[-1] = "results"
folder = os.path.sep.join(folders)
dacpath = folder ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_default_file_path(file_name: str) -> str:\n return join(SOURCE_PATH, 'data', file_name)",
"def set_result_file(self, file_name):\n if file_name is not None:\n self.opts[\"result_file_name\"] = file_name\n else:\n self.opts[\"result_file_name\"] = \"\"",
"def guess... | [
"0.5992798",
"0.56903106",
"0.5443243",
"0.54410255",
"0.54301697",
"0.5357587",
"0.5340983",
"0.53233373",
"0.5294057",
"0.524858",
"0.5244192",
"0.52249396",
"0.51978284",
"0.5184426",
"0.51652",
"0.51495284",
"0.5128286",
"0.512668",
"0.50775504",
"0.5075263",
"0.5066384",... | 0.73746794 | 0 |
Load the first time step after the time step provided by time | def load_first_ts_after(self, time):
# get time step list
df_ts = self.doc.c.sim.df.time_steps()
if type(time) in [float, int]:
if len(df_ts[df_ts.simulation_time > time]) == 0:
raise RuntimeError("{} contains no timestep after {} d".format(self.doc.c.or... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_first_machine_time_step(self, first_machine_time_step):",
"def onTimeStepStart(self, timeStep):\n pass",
"def next_step(self):\n if self.time_point + 1 >= len(self.data):\n print(\"Error: at last time point\")\n else:\n self.time_point = self.time_point + 1\n ... | [
"0.71698123",
"0.6915467",
"0.6753831",
"0.661643",
"0.6487823",
"0.6473755",
"0.64649963",
"0.6445686",
"0.6356552",
"0.6292669",
"0.609172",
"0.607975",
"0.59767365",
"0.5927678",
"0.58358914",
"0.58277494",
"0.58078086",
"0.5761383",
"0.57262194",
"0.5708094",
"0.5700845",... | 0.76748043 | 0 |
Converts a calendar time (datetime) to simulation time (in hours). Requires that the Reference Time is set in the model. | def calendar_to_simtime(self, calendar_time):
time_ref = self.doc.getReferenceTime()
if time_ref is None:
raise (RuntimeError("Reference time not set in model"))
return (calendar_time - time_ref).total_seconds() / (24 * 60 * 60) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simtime_to_calendar(self, sim_time):\n time_ref = self.doc.getReferenceTime()\n if time_ref is None:\n raise (RuntimeError(\"Reference time not set in model\"))\n\n return time_ref + timedelta(sim_time)",
"def getAbsoluteSimulationTimeCalendar(self):\n if self.doc.getRe... | [
"0.68510634",
"0.56945",
"0.56266",
"0.5587167",
"0.5559629",
"0.54573816",
"0.54573816",
"0.54573816",
"0.54573816",
"0.5355372",
"0.531853",
"0.5231836",
"0.52008826",
"0.519405",
"0.5153251",
"0.5136625",
"0.5122477",
"0.5098299",
"0.5098221",
"0.503388",
"0.5017425",
"0... | 0.66940224 | 1 |
Converts a simulation time (in unit days since reference time) into a calendar date (datetime.datetime). Requires that the Reference Time is set in the model. | def simtime_to_calendar(self, sim_time):
time_ref = self.doc.getReferenceTime()
if time_ref is None:
raise (RuntimeError("Reference time not set in model"))
return time_ref + timedelta(sim_time) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getAbsoluteSimulationTimeCalendar(self):\n if self.doc.getReferenceTime() is None:\n raise ValueError(\"Reference Time not set in FEFLOW model.\")\n\n self.doc.getReferenceTime() + datetime.timedelta(days=self.doc.getAbsoluteSimulationTime())",
"def calendar_to_simtime(self, calendar... | [
"0.715675",
"0.6405978",
"0.55148673",
"0.54061246",
"0.5035797",
"0.5000875",
"0.49441096",
"0.49226648",
"0.49099126",
"0.48785847",
"0.4797319",
"0.47609946",
"0.47559208",
"0.47478265",
"0.4734923",
"0.47134128",
"0.47104707",
"0.47017756",
"0.46849194",
"0.46693674",
"0.... | 0.7452497 | 0 |
Augments the image by rotating the image by max_angle in the axial plane in both directions Also flips the image from left to right and rotates by max_angle in both directions | def augment_image(image,max_angle):
angles = [-max_angle,max_angle]
axes = [(0,1),(0,2),(1,2)]
images_aug = [image,image[::-1]]
for angle in angles:
for axis in axes:
images_aug.append(aug.rotate(image, angle, axes=axis, reshape=False, order=0))
images_aug.append(aug.rota... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_augmentation(img):\n return np.fliplr(img)",
"def _augment(img):\r\n return flip(img, axis=2)",
"def _augment(img):\n return flip(img, axis=2)",
"def get_opt_rotate(obj_img, back_img,\n back_center_x, back_center_y,\n obj_center_x, obj_center_y,\... | [
"0.68872035",
"0.6749438",
"0.6689302",
"0.65078604",
"0.6465042",
"0.63611543",
"0.63405776",
"0.63356954",
"0.6331301",
"0.62980765",
"0.6275488",
"0.624571",
"0.6139461",
"0.6121177",
"0.6092224",
"0.60787594",
"0.60602623",
"0.60586965",
"0.6043328",
"0.60368246",
"0.6028... | 0.83135 | 0 |
Creates a survival class label list from a list of survival days categories are 0 for under 10 month survival, 1 for 1015 months and 2 for 15+ months | def categorize(y):
y_out = []
for yi in y:
if int(yi)<(365*10.0)/12.0:
y_out.append(0)
elif int(yi)<(365*15.0)/12.0:
y_out.append(1)
else:
y_out.append(2)
return np.array(y_out) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cvpr2018_labels():\n\n return {\n 0: 'others',\n 33: 'car',\n 34: 'motorcycle',\n 35: 'bicycle',\n 36: 'pedestrian',\n 38: 'truck',\n 39: 'bus',\n 40: 'tricycle'\n }",
"def _labels_for_historical_data(days: int, lang: str) -> List[str]:\n label... | [
"0.58232903",
"0.54263556",
"0.5314535",
"0.5298069",
"0.52912474",
"0.52161705",
"0.52161705",
"0.5207141",
"0.51999825",
"0.5147364",
"0.51438856",
"0.5126135",
"0.511763",
"0.51065487",
"0.50985366",
"0.50954306",
"0.5069807",
"0.5069807",
"0.5069807",
"0.50318503",
"0.503... | 0.587338 | 0 |
returns all provas >>> self._getAllProvas() | def _getAllProvas(self):
return self.execSql("select_all_provas") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paquetes(self):\n\n paquetes = []\n\n for propietario in self.propietarios:\n for casa in propietario.casas:\n for paquete_de_casa in casa.paquetes_de_casa:\n paquetes.append(paquete_de_casa)\n for dormitorio in casa.dormitorios:\n ... | [
"0.6424439",
"0.61300254",
"0.5836489",
"0.5585282",
"0.5564049",
"0.544887",
"0.5441835",
"0.5334608",
"0.5263509",
"0.5240838",
"0.5235551",
"0.52304024",
"0.52212775",
"0.5186363",
"0.518535",
"0.5140931",
"0.5085166",
"0.5077748",
"0.5069945",
"0.5028898",
"0.49414274",
... | 0.8105716 | 0 |
returns all provas from conteudo >>> self._getConteudoProvas() | def _getConteudoProvas(self, id_conteudo):
return self.execSql("select_conteudo_provas",
id_conteudo=int(id_conteudo)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getAllProvas(self):\n return self.execSql(\"select_all_provas\")",
"def paquetes(self):\n\n paquetes = []\n\n for propietario in self.propietarios:\n for casa in propietario.casas:\n for paquete_de_casa in casa.paquetes_de_casa:\n paquetes.ap... | [
"0.7646942",
"0.66558737",
"0.62366885",
"0.6154832",
"0.59434545",
"0.5830311",
"0.5807141",
"0.5712288",
"0.55908936",
"0.55568075",
"0.55074483",
"0.54849684",
"0.54467976",
"0.54265547",
"0.5366095",
"0.5328654",
"0.5267592",
"0.525496",
"0.5244163",
"0.5236238",
"0.52306... | 0.8148251 | 0 |
returns all cadastros from conteudo >>> self._getConteudoCadastros() | def _getConteudoCadastros(self, id_conteudo):
return self.execSql("select_conteudo_cadastros",
id_conteudo=int(id_conteudo)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listar_cadastros():\n return cadastro_alunos.listar_aluno()",
"def _getConteudoCadastrosSelecionados(self, id_conteudo):\n return self.execSql(\"select_conteudo_cadastros_selecionados\",\n id_conteudo=int(id_conteudo))",
"def carregar_contatos(self):\r\n self.cl... | [
"0.78284174",
"0.7825673",
"0.7200778",
"0.7105828",
"0.67812115",
"0.6602772",
"0.6459946",
"0.6330621",
"0.63059235",
"0.6274711",
"0.6226249",
"0.6196035",
"0.61312944",
"0.59542704",
"0.5948513",
"0.5909978",
"0.5889182",
"0.57821816",
"0.57669735",
"0.5753354",
"0.568547... | 0.8525138 | 0 |
returns all cadastros selecionados from conteudo >>> self._getConteudoCadastrosSelecionados() | def _getConteudoCadastrosSelecionados(self, id_conteudo):
return self.execSql("select_conteudo_cadastros_selecionados",
id_conteudo=int(id_conteudo)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getConteudoCadastros(self, id_conteudo):\n return self.execSql(\"select_conteudo_cadastros\",\n id_conteudo=int(id_conteudo))",
"def listar_cadastros():\n return cadastro_alunos.listar_aluno()",
"def _getCadastroCursos(self, id_cadastro):\n return self.execSql(... | [
"0.7286904",
"0.7140278",
"0.674005",
"0.6571689",
"0.65568024",
"0.6380306",
"0.6226275",
"0.6122682",
"0.6118822",
"0.6110704",
"0.60445625",
"0.603889",
"0.59635156",
"0.5894455",
"0.58356327",
"0.58334166",
"0.5807106",
"0.5766607",
"0.5716018",
"0.570755",
"0.56913656",
... | 0.8558676 | 0 |
returns all cursos superiores from cadastro >>> self._getCadastroCursosSuperiores() | def _getCadastroCursosSuperiores(self, id_cadastro):
return self.execSql("select_cadastro_cursos_superiores",
id_cadastro=int(id_cadastro)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def super_categories(self):\n R = self.base().base_ring()\n category = GradedHopfAlgebrasWithBasis(R)\n return [Realizations(self.base()), category.Quotients()]",
"def sucursales(self):\n\n return Sucursal.objects.filter(id__in=self.horarios_atencion.values_list('sucursal'))",
"def ... | [
"0.624646",
"0.5991194",
"0.5920284",
"0.5828413",
"0.58202296",
"0.57951957",
"0.5728039",
"0.57278585",
"0.56486577",
"0.5621824",
"0.5589727",
"0.5585636",
"0.54832244",
"0.54572535",
"0.5445204",
"0.53770113",
"0.5349885",
"0.527543",
"0.527543",
"0.5256881",
"0.52321404"... | 0.8686882 | 0 |
returns all idiomas from cadastro >>> self._getCadastroIdiomas() | def _getCadastroIdiomas(self, id_cadastro):
return self.execSql("select_cadastro_idiomas",
id_cadastro=int(id_cadastro)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getCadastroEmpregos(self, id_cadastro):\n return self.execSql(\"select_cadastro_empregos\",\n id_cadastro=int(id_cadastro))",
"def _getCadastroCursos(self, id_cadastro):\n return self.execSql(\"select_cadastro_cursos\",\n id_cadastro=int(... | [
"0.6638407",
"0.6615875",
"0.6518311",
"0.63684267",
"0.6315263",
"0.62116504",
"0.61529374",
"0.6018137",
"0.5997833",
"0.59039795",
"0.589317",
"0.5857431",
"0.5828872",
"0.5719018",
"0.57138324",
"0.569726",
"0.5658001",
"0.5619028",
"0.55859584",
"0.5571677",
"0.55598164"... | 0.8564768 | 0 |
returns all cursos from cadastro >>> self._getCadastroCursos() | def _getCadastroCursos(self, id_cadastro):
return self.execSql("select_cadastro_cursos",
id_cadastro=int(id_cadastro)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getCadastroCursosSuperiores(self, id_cadastro):\n return self.execSql(\"select_cadastro_cursos_superiores\",\n id_cadastro=int(id_cadastro))",
"def listar_cadastros():\n return cadastro_alunos.listar_aluno()",
"def get_cursos(request):\n if request.method == 'GET':... | [
"0.73462015",
"0.6953587",
"0.66569704",
"0.641626",
"0.6390572",
"0.6291141",
"0.61828154",
"0.6040256",
"0.59803355",
"0.5945287",
"0.5939955",
"0.5931112",
"0.59067345",
"0.5881739",
"0.58784807",
"0.58678705",
"0.5852543",
"0.5841695",
"0.58370304",
"0.57984644",
"0.57929... | 0.8433589 | 0 |
returns all estagios from cadastro >>> self._getCadastroEstagios() | def _getCadastroEstagios(self, id_cadastro):
return self.execSql("select_cadastro_estagios",
id_cadastro=int(id_cadastro)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def escobas(self):\n return self._escobas",
"def get_escobas(self):\n return self.escobas",
"def get_resultados(self):\n return self.__resultados",
"def getSituacaoAeroporto(self):\n soup = BeautifulSoup(self.getContent(url_direct.get('dash-aero-situacao')))\n list_situatio... | [
"0.6319616",
"0.6259798",
"0.61760014",
"0.59320027",
"0.58920735",
"0.5871899",
"0.57897377",
"0.57393724",
"0.57185704",
"0.57155216",
"0.5697578",
"0.5683173",
"0.5638902",
"0.56373924",
"0.56075317",
"0.556858",
"0.5567548",
"0.5533924",
"0.54867834",
"0.54842824",
"0.548... | 0.81034905 | 0 |
returns all empregos from cadastro >>> self._getCadastroEmpregos() | def _getCadastroEmpregos(self, id_cadastro):
return self.execSql("select_cadastro_empregos",
id_cadastro=int(id_cadastro)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_employees(self):\n from Employee import Employee\n cursor = self.dbconnect.get_cursor()\n cursor.execute('select * from employee')\n\n employees = list()\n for row in cursor:\n employee = Employee(row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], ... | [
"0.71649987",
"0.69541067",
"0.69509244",
"0.6686057",
"0.6627273",
"0.6490655",
"0.64192116",
"0.6373798",
"0.6273055",
"0.6254344",
"0.61355954",
"0.6130747",
"0.61046684",
"0.60459995",
"0.60410386",
"0.5918352",
"0.5901199",
"0.5899546",
"0.58882326",
"0.58859956",
"0.581... | 0.8396344 | 0 |
Converts the CSS shortcut string into a valid innertag. | def process_shortcut(s):
if s.count('[') != s.count(']'):
raise MismatchedGrouping('Invalid grouping of brackets, %s' % s)
if s.count('"') % 2 != 0 or s.count("'") % 2 != 0:
raise MismatchedGrouping('Quotation groupings are mismatched, %s' % s)
ret_dict = {}
# find the classes and id
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_css_identifier(s):\n return re.sub(r'[^a-z0-9-]', '-', s, flags=re.IGNORECASE)",
"def parse_rule(rule_string):\n count, _, color_bags = rule_string.partition(\" \")\n return color_bags.rpartition(\" bag\")[0], int(count)",
"def category2url(cat):\n return remove_diacritics(cat).replace(\... | [
"0.49875832",
"0.4964536",
"0.48959762",
"0.48508155",
"0.48253295",
"0.47944248",
"0.47622633",
"0.46999708",
"0.46071175",
"0.45776024",
"0.45625073",
"0.44926435",
"0.44823688",
"0.44580403",
"0.4448435",
"0.4416446",
"0.4413485",
"0.4408352",
"0.44072515",
"0.43934834",
"... | 0.5314905 | 0 |
Generates a new password reset code returns user | def get_reset_code(self, email):
try:
user = self.get(email__iexact=email)
user.reset_code = self.make_random_password(length=20)
user.reset_code_expire = timezone.now() + timedelta(days=2)
user.save()
return user
except get_user_model().Does... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_password_reset():",
"def get_reset_code(self, email):\n\n try:\n user = self.get(email__iexact=email)\n user.reset_code = self.make_random_password(length=20)\n user.reset_code_expire = timezone.now() + timedelta(days=2)\n user.save()\n\n ... | [
"0.71952367",
"0.71164334",
"0.7102545",
"0.70755523",
"0.68331474",
"0.6816541",
"0.68077534",
"0.67629087",
"0.6724371",
"0.6711852",
"0.6694719",
"0.66374165",
"0.6595471",
"0.6518255",
"0.6481541",
"0.6472153",
"0.645154",
"0.64254034",
"0.64150655",
"0.6381783",
"0.63705... | 0.7360784 | 0 |
Adds a ramp to the specified ramp parameter. | def add_ramp(self, parameter, start_time, ramp_duration, delta, clear_existing=False):
if clear_existing:
self.parameters[parameter] = [[],[],[]]
self.parameters[parameter][0].append(start_time)
self.parameters[parameter][1].append(ramp_duration)
self.parameters[parameter][2]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setRampDuration(self, ramp_duration):\r\n\t\tself.RampDuration = ramp_duration\r\n\t\tself.OutputValueIncrement = (self.MaxValue - self.MinValue)/(self.RampDuration/self.Ts)",
"def setRampDuration(self, ramp_duration):\r\n\t\tself.RampDuration = ramp_duration\r\n\t\tself.OutputValueIncrement = (self.MaxValue... | [
"0.6292615",
"0.6292615",
"0.618963",
"0.6015142",
"0.58060014",
"0.5775534",
"0.5737288",
"0.5722807",
"0.55971915",
"0.5569704",
"0.5560601",
"0.53862077",
"0.526049",
"0.5222054",
"0.51991385",
"0.51792717",
"0.51688516",
"0.5064401",
"0.5030468",
"0.5009544",
"0.49850935"... | 0.70723915 | 0 |
Evaluate file cadence to see if it is daily or greater than daily. | def is_daily_file_cadence(file_cadence):
is_daily = True
if hasattr(file_cadence, 'days'):
if file_cadence.days > 1:
is_daily = False
else:
if not (hasattr(file_cadence, 'microseconds')
or hasattr(file_cadence, 'seconds')
or hasattr(file_cadence, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_filedates(config, data, filename):\n\n min_file_date = re.match(config[\"min_file_date_regex\"], filename)\n max_file_date = re.match(config[\"max_file_date_regex\"], filename)\n\n # Try and convert to date time\n if min_file_date and max_file_date:\n min_file_date = pd.to_datetime(\n ... | [
"0.6441482",
"0.6316295",
"0.6255487",
"0.5723394",
"0.57095486",
"0.5651001",
"0.55116266",
"0.5480839",
"0.5454888",
"0.5430491",
"0.54286057",
"0.5423096",
"0.5411704",
"0.53888714",
"0.53809935",
"0.53465474",
"0.5339659",
"0.53350204",
"0.53264946",
"0.5325297",
"0.53252... | 0.7852443 | 0 |
sum the total of weighted cells in each polygon, compute the unit value (where possible), and write to raster vect = input vector map val = vector map attribute with desired value weights = input rast map with cell weights out = output raster map wcol = weight column in vect (default=name of output raster) deleted prio... | def calcUnitWeight(vect, val, weights, out, wcol=None):
if not wcol:
wcol = out
grass.run_command('v.rast.sum', zones=vect, _input=weights, column=wcol)
grass.run_command('v.db.update', column=wcol, value=val+'/'+wcol,
where='wcol>0')
grass.run_command('v.to.rast', _input=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcweighted(store):\n nobs = store['yvec'].shape[0]\n store['Upper'].put(-store['rho'], range(0, nobs - 1), range(1, nobs))\n store['Upper'].matvec(store['yvec'], store['yvectil'])\n for i in xrange(store['xmat'].shape[1]):\n store['Upper'].matvec(store['xmat'][:, i], store['xmattil'][:, i]... | [
"0.637614",
"0.5914817",
"0.5691052",
"0.56579494",
"0.5562731",
"0.55098605",
"0.548975",
"0.54792434",
"0.5427453",
"0.54175353",
"0.54081774",
"0.54019856",
"0.5401473",
"0.539906",
"0.5365114",
"0.5355184",
"0.5343921",
"0.53425604",
"0.5322546",
"0.5273757",
"0.51998305"... | 0.7656683 | 0 |
Gets all paths from input to symbol | def get_paths_from(self, symbol):
to_return = []
visitation_queue = [self.head]
while len(visitation_queue) != 0:
visiting = visitation_queue.pop(0)
for elem in visiting.children:
visitation_queue.append(elem)
if symbol in visiting.inputs:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_paths(symbol: Union[str, int]) -> str:\n if isinstance(symbol, str):\n return {\n 'circle':\n '\"M\"+b1+\",0A\"+b1+\",\"+b1+\" 0 1,1 0,-\"+b1+\"A\"+b1+\",\"+b1+\" 0 0,1 \"+b1+\",0Z\"',\n 'square':\n '\"M\"+b1+\",\"+b1+\"H-\"+b1+\"V-\"+b1+\"H\"+b1+\"Z\"... | [
"0.6845581",
"0.6428056",
"0.63166505",
"0.6227308",
"0.6226829",
"0.6221099",
"0.6219737",
"0.60980934",
"0.6054122",
"0.6047832",
"0.60343784",
"0.6013765",
"0.5980628",
"0.5938047",
"0.5872366",
"0.5864859",
"0.5860468",
"0.58514625",
"0.5807138",
"0.5789408",
"0.57541513"... | 0.8160578 | 0 |
Test surf on regularly spaced coordinates like MayaVi. | def test_surf():
def f(x, y):
sin, cos = numpy.sin, numpy.cos
return sin(x + y) + sin(2 * x - y) + cos(3 * x + 4 * y)
x, y = numpy.mgrid[-7.:7.05:0.1, -5.:5.05:0.05]
s = surf(x, y, f)
mlab.show()
#cs = contour_surf(x, y, f, contour_z=0)
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawRegularSurface(matrix, nx, ny, xinterp, yinterp):\n dislin.surmat(matrix, nx, ny, xinterp, yinterp)",
"def surfcut_points(**kwargs):\n npoints = kwargs.get( 'npoints', 240 )\n origin = kwargs.get( 'origin', vec3(0.,0.,0.)) \n normal = kwargs.get( 'normal', (np.pi/2., 0.) ) \n lims0 = kw... | [
"0.63351434",
"0.5809967",
"0.5588674",
"0.5506265",
"0.54521286",
"0.5335231",
"0.52462965",
"0.5227828",
"0.522159",
"0.52122545",
"0.5200661",
"0.51747805",
"0.5165662",
"0.51652",
"0.51571435",
"0.51357627",
"0.5126349",
"0.5109323",
"0.5098706",
"0.5086226",
"0.50475496"... | 0.69315696 | 0 |
Initializes the data taken from the completeData.csv and the formattedXValues.csv. Note that these must be the names of the arrays in your folder. | def initializeData():
# Read in the CSV
allX = pd.read_csv('completeData.csv', keep_default_na=False)
xValues = pd.read_csv('formattedXValues.csv')
filename = "completeData.csv and formattedXValues.csv"
# Separate the CSV columns into array variables and numpy vars to store new categorical variabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_input(self):\n path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'data'))\n if not os.path.isfile('{0}/{1}.csv'.format(path, self.data_file)):\n print 'Error: Dataset file is not exist.'\n exit()\n # Uplead Dataset.csv file.\n f = open('... | [
"0.63987756",
"0.60396355",
"0.6033745",
"0.6007925",
"0.5936185",
"0.5930858",
"0.59216917",
"0.5916312",
"0.59140754",
"0.5901727",
"0.5890288",
"0.58721507",
"0.5862617",
"0.5855333",
"0.5845277",
"0.5844009",
"0.58408755",
"0.5811851",
"0.5779655",
"0.57742786",
"0.575892... | 0.71311456 | 0 |
For the given datasize from the .csv file generates a set of random indices to use for the training set. Uses a user defined percentage of the data for training and testing. | def generaterandomindices(dataSize, percentTest):
TrainIndices = np.array([])
while TrainIndices.__len__() < int(percentTest * dataSize):
# Randomly select an index value and store it. If it has already been chosen, pick again.
index = int(random.random() * dataSize)
if not TrainIndices... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(input_file, test_size, random_seed ):\n ratings = np.genfromtxt(input_file, delimiter=',')\n #ratings = ratings[:200,:]\n train_masks = np.zeros_like(ratings)\n test_masks = np.zeros_like(ratings)\n pairs = list()\n for i in range(ratings.shape[0]):\n for j in range(ratings.s... | [
"0.6406667",
"0.6314212",
"0.62506485",
"0.6096988",
"0.6061452",
"0.5996755",
"0.5953733",
"0.5914187",
"0.5883699",
"0.5882433",
"0.5846584",
"0.5827348",
"0.58264536",
"0.57857716",
"0.5761794",
"0.573058",
"0.5699392",
"0.5697324",
"0.5695694",
"0.5686362",
"0.5678938",
... | 0.6647869 | 0 |
Generate an example dask HighLevelGraph. | def dask_highlevelgraph() -> HighLevelGraph:
@dask.delayed(pure=True) # type: ignore
def create_dataframe(num_rows: int, num_cols: int) -> pd.DataFrame:
print('Creating DataFrame...')
return pd.DataFrame(data=[range(num_cols)] * num_rows)
@dask.delayed(pure=True) # type: ignore
def cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_graph(self):",
"def test_highleveldag(dask_highlevelgraph: HighLevelGraph) -> None:\n with dask.config.set(scheduler='sync'):\n result = dask_highlevelgraph.compute()\n assert result == 2045952000.0",
"def test_highlevelgraph(dask_highlevelgraph: HighLevelGraph) -> None:\n with dask.con... | [
"0.6500455",
"0.6189144",
"0.61473995",
"0.6083819",
"0.6010887",
"0.595251",
"0.5880676",
"0.5839304",
"0.5770262",
"0.5770068",
"0.57431555",
"0.5741383",
"0.57074356",
"0.5654323",
"0.5578547",
"0.5577143",
"0.5572333",
"0.55684257",
"0.5562661",
"0.5557265",
"0.5539527",
... | 0.67145634 | 0 |
Since the bcbio object does not retain all the information necessary for some of the templates, this finds and adds the additional information and then fills the template file and writes as the output file. | def __fill_template__(self,template_file,output_fname):
dictionary = {}
for k,v in self.__dict__.iteritems():
if k == 'sample_key':
try:
int(v)
new_sample_key = "Sample_" + str(v)
dictionary.update({k:new_sample_key}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write(self):\n template_mappings = {}\n\n template_file = os.path.join(self._l2tdevtools_path, self._TEMPLATE_FILE)\n file_content = self._GenerateFromTemplate(template_file, template_mappings)\n\n file_content = file_content.encode('utf-8')\n\n with open(self.PATH, 'wb') as file_object:\n ... | [
"0.6611633",
"0.62254953",
"0.6149684",
"0.61076134",
"0.6078601",
"0.60680085",
"0.60608476",
"0.6021166",
"0.6015032",
"0.6012825",
"0.59981674",
"0.59652746",
"0.59523976",
"0.59220034",
"0.5841677",
"0.58407724",
"0.58137214",
"0.58121264",
"0.5810166",
"0.5808299",
"0.58... | 0.6777061 | 0 |
Multiple templates are used for the bcbio process. This wraps filling all templates. | def __fill_all_templates__(self,configs):
template_dir = configs['system'].get('Common_directories','template')
sample_template = os.path.join(template_dir,configs['pipeline'].get('Template_files','sample'))
system_template = os.path.join(template_dir,configs['pipeline'].get('Template_files','sy... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_base_templates(outdir, templateEnv):\n for file in ME_TEMPLATES:\n filename = os.path.join(outdir, ME_FILENAME.format(file))\n template = templateEnv.get_template(file + '.go.jinja')\n\n with open(filename, 'w') as f:\n output = template.render(copyright=COPYRIGHT,\n ... | [
"0.6271193",
"0.60885066",
"0.5877966",
"0.58509237",
"0.579428",
"0.57877594",
"0.5783016",
"0.5646136",
"0.5645704",
"0.55866253",
"0.55848837",
"0.55395776",
"0.55178434",
"0.5510485",
"0.5486276",
"0.54843503",
"0.54778534",
"0.5457643",
"0.5452079",
"0.54400253",
"0.5436... | 0.74359393 | 0 |
Normalizes the inputs JSONRPC endpoints that take a 2tuple of `(ContentKey, bytes)` | def content_key_and_content_munger(
module: Any, content_key: ContentKey, content: bytes,
) -> Tuple[HexStr, HexStr]:
return (
encode_hex(content_key),
encode_hex(content),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_transfer_result(cls, result: JSON) -> JSON:\n ...",
"def decompose_from_json(cls, key, val):\n key = (key or '').strip()\n val = (val or '').strip()\n\n if not key:\n raise EndpointError('The key must be specified')\n\n endpoint = '%s=' % key\n s... | [
"0.5036987",
"0.49513078",
"0.48808864",
"0.48493755",
"0.48394534",
"0.48311353",
"0.48286295",
"0.47968972",
"0.47826153",
"0.47802904",
"0.47756737",
"0.4758542",
"0.4749534",
"0.47471386",
"0.47257885",
"0.47162017",
"0.47141236",
"0.4703763",
"0.47019362",
"0.46930027",
... | 0.50820345 | 0 |
Load weights from snapshot file | def load_weights(net, optimizer, scheduler, snapshot_file, restore_optimizer_bool=False):
logging.info("Loading weights from model %s", snapshot_file)
net, optimizer, scheduler, epoch, mean_iu = restore_snapshot(net, optimizer, scheduler, snapshot_file,
restore_optimizer_bool)
return epoch, mean... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weights(self, filepath):\n self.model.load_weights(filepath)",
"def _load_weights(self):\n self.npz_weights = np.load(self._weight_file)\n self._load_byte_embedding()\n self._load_cnn_weights()\n self._load_highway()\n self._load_projection()",
"def load_weigh... | [
"0.7100965",
"0.7099289",
"0.70770496",
"0.69538385",
"0.69538385",
"0.6940326",
"0.6940326",
"0.6904215",
"0.686968",
"0.68578506",
"0.68147826",
"0.6770877",
"0.6694163",
"0.6670967",
"0.66293234",
"0.6612041",
"0.6583617",
"0.6533964",
"0.65129817",
"0.6429854",
"0.6425971... | 0.7182239 | 0 |
Checks if claims user belongs to Tenant or has override permissions to edit other Tenants | def check_tenant_authorization(tenant_id, override_permission=None):
claims = get_jwt_claims()
if "id" in list(claims.keys()):
tenant_user = identity.TenantUser.query.filter_by(id=claims["id"]).first()
if (
tenant_user.tenant_id == tenant_id
or override_permission in tena... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_object_permission(self, request, view, user):\n return user == request.user or request.user.is_superuser",
"def has_object_permission(self, request, view, obj):\n\n #check if method is get i.e user only want to view\n if request.method in permissions.SAFE_METHODS:\n return... | [
"0.6689976",
"0.66579235",
"0.6575025",
"0.6559304",
"0.65221727",
"0.64526767",
"0.64456385",
"0.64339375",
"0.64206105",
"0.64158726",
"0.63980037",
"0.6397329",
"0.63969445",
"0.6390685",
"0.6379953",
"0.6357644",
"0.6335498",
"0.63311714",
"0.6319886",
"0.6311173",
"0.630... | 0.7168181 | 0 |
Given a tenant schema, create a tenant | def create_tenant(tenant):
exists = identity.Tenant.query.filter_by(name=tenant.name).first()
if exists:
abort(409, "Tenant Already Exists")
db.session.add(tenant)
db.session.commit()
return tenant.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tenant(tenant_name, description, enabled, auth_admin_url, admin_token):\n keystone = get_client(auth_admin_url, admin_token)\n tenant = keystone.tenants.create(tenant_name=tenant_name, description=description, enabled=enabled)\n print tenant\n return tenant.to_dict()",
"def createOrcaTenan... | [
"0.7171252",
"0.7079633",
"0.6954982",
"0.69242764",
"0.6792502",
"0.679099",
"0.6785639",
"0.6658359",
"0.6618145",
"0.65157557",
"0.6450535",
"0.61557657",
"0.6074168",
"0.5968671",
"0.5956721",
"0.5930699",
"0.58401793",
"0.5772303",
"0.5763112",
"0.5693228",
"0.56806386",... | 0.77065414 | 0 |
Given tenant_id and tenant object, update a Tenant | def update_tenant(tenant_id, new_tenant):
check_tenant_authorization(tenant_id)
new_tenant.id = tenant_id
updated_tenant = db.session.merge(new_tenant)
db.session.commit()
return updated_tenant | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_tenant_update(sample_identity):\n access_token, tenant, tenant_user, tc = sample_identity\n tenant.name = \"ilovebeansllc\"\n headers = {\"Authorization\": \"Bearer \" + access_token}\n updated_tenant_request = id_schemas.TenantSchema().dump(tenant)\n updated_tenant = tc.put(\n f\"ap... | [
"0.7870008",
"0.7024336",
"0.67325",
"0.67026174",
"0.67026174",
"0.66391766",
"0.6499703",
"0.6490579",
"0.64027005",
"0.61180586",
"0.5987017",
"0.59784436",
"0.5906629",
"0.5844687",
"0.5634975",
"0.5622623",
"0.5615344",
"0.548632",
"0.54852045",
"0.54754204",
"0.54738",
... | 0.7556466 | 1 |
Given a tenant id, fetch the tenant for that id | def get_tenant_by_id(tenant_id):
tenant = identity.Tenant.query.filter_by(id=tenant_id).first()
if tenant:
return tenant
abort(404, f"Unable to find tenant with id: {tenant_id}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tenant_config(tenant_id):\n for tenant in tenants:\n if tenant['tenant_id'] == tenant_id:\n return tenant\n raise errors.BaseTapisError(\"invalid tenant id.\")",
"def get_tenant(key, tenant_name):\n for tenant in key.tenants.list():\n if tenant.name == tenant_name:\n ... | [
"0.8102193",
"0.78376037",
"0.76502275",
"0.7277747",
"0.7269845",
"0.71548605",
"0.7004045",
"0.7004045",
"0.7004045",
"0.7004045",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6898316",
"0.6854349",
... | 0.86720824 | 0 |
Provides list of all Tenants | def get_all_tenants():
tenants = identity.Tenant.query.all()
return tenants | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tenants(self):",
"def list_tenants(self):\n _url = \"http://\" + self.host_ip + \":35357/v2.0/tenants\"\n _headers = {'x-auth-token': self.cloud_admin_info['token_project']}\n _body = None\n\n response = self.request(\"GET\", _url, _headers, _body)\n if response is None... | [
"0.7311913",
"0.7217978",
"0.7035775",
"0.68330145",
"0.6654493",
"0.6465175",
"0.62954146",
"0.6177893",
"0.61654216",
"0.6148272",
"0.604497",
"0.6009238",
"0.59118146",
"0.5889167",
"0.5887195",
"0.58863044",
"0.5854088",
"0.5853019",
"0.5846821",
"0.58389825",
"0.5838873"... | 0.7834845 | 0 |
Mark this track as missed (no association at the current time step). | def mark_missed(self):
if self.state == TrackState.Tentative:
self.state = TrackState.Deleted
elif self.time_since_update > self._max_age:
self.state = TrackState.Deleted | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests_missed(self, num):\n self.missing_tests = num",
"def tick_skipped(self):\n pass",
"def mark_as_not_done(self):\n grade_event = {'value': 0, 'max_value': self.points}\n self.runtime.publish(self, 'grade', grade_event)",
"def check_miss(self):\n if self.ball.center.... | [
"0.62534416",
"0.60326207",
"0.5580928",
"0.55340266",
"0.5485797",
"0.5452688",
"0.5398362",
"0.5377762",
"0.53379023",
"0.52324027",
"0.52234924",
"0.52053666",
"0.5157145",
"0.5115357",
"0.510468",
"0.50325304",
"0.5029975",
"0.5010918",
"0.5010119",
"0.5003667",
"0.500113... | 0.73827064 | 1 |
Returns True if this track is confirmed. | def is_confirmed(self):
return self.state == TrackState.Confirmed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_confirmed(self) -> bool:\n return self._is_confirmed",
"def is_confirmed(self, is_confirmed: bool):\n\n self._is_confirmed = is_confirmed",
"def is_confirmation_mode_enabled(self):\n\t\treturn bool(call_sdk_function('PrlSrv_IsConfirmationModeEnabled', self.handle))",
"def confirmed(self,... | [
"0.814605",
"0.64437556",
"0.6437853",
"0.6334783",
"0.62049437",
"0.61790836",
"0.61653703",
"0.61243564",
"0.61206985",
"0.6007849",
"0.59947276",
"0.59857404",
"0.5919182",
"0.5889163",
"0.58517134",
"0.57956177",
"0.5776833",
"0.57404286",
"0.57015604",
"0.5700138",
"0.56... | 0.86330813 | 1 |
WYpisuje informacje o samochodzie | def wypisz_info(self):
print(f"Samochód: {self.producent} {self.model}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def info(self):",
"def info(self):",
"def get_details(self):",
"def manage_info():",
"def mezclar_bolsa(self):",
"def dane_profilu(imie, nazwisko, **inne_informacje):\r\n inne_informacje['imie'] = imie\r\n inne_informacje['nazwisko'] = nazwisko\r\n return inne_informacje",
"def show_data():",
... | [
"0.5897859",
"0.5897859",
"0.5885302",
"0.57649606",
"0.56881845",
"0.56734383",
"0.56343335",
"0.56061435",
"0.5544123",
"0.5528234",
"0.5506979",
"0.5506014",
"0.5506014",
"0.5506014",
"0.5501805",
"0.5500297",
"0.5481597",
"0.54327404",
"0.54267657",
"0.5403266",
"0.539135... | 0.6628599 | 0 |
Load all images in the specified file and returns an array with all of them. | def loadImages(loadPath):
img_array = []
for filename in glob.glob(loadPath):
img = cv2.imread(filename)
height, width, layers = img.shape
size = (width, height)
img_array.append(img)
return img_array | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_images(self, file_path: str) -> Iterable[Image]:\n return []",
"def load_images(filename):\n images = _load(filename)\n #_info_image(image, title=os.path.basename(filename))\n return images",
"def load_images(filelist):\n # pixel value range 0-255\n if not isinstance(filelist, lis... | [
"0.77775574",
"0.76499426",
"0.7614241",
"0.7502157",
"0.7476571",
"0.7434772",
"0.7387218",
"0.723891",
"0.7111967",
"0.7106821",
"0.7099478",
"0.70800775",
"0.7056213",
"0.7026734",
"0.7012313",
"0.7003299",
"0.7000063",
"0.6955172",
"0.69508356",
"0.6920103",
"0.6912523",
... | 0.7798019 | 0 |
Take some English text and return a Pirateish version thereof. | def translate(english):
# Normalise a list of words (remove whitespace and make lowercase)
words = [w.lower() for w in english.split()]
# Substitute some English words with Pirate equivalents.
result = [_PIRATE_WORDS.get(word, word) for word in words]
# Capitalize words that begin a sentence and pot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PigToEnglish(str):\r\n\r\n # TODO: Your code here\r\n\r\n\r\n # Change the return to return the converted string\r\n return(\"\")",
"def process_text(self, text, language):",
"def translate_leet(phrase):",
"def translateText(text):\r\n\treturn translator.translate(text, src='en', dest='ro')",
... | [
"0.6459648",
"0.64266783",
"0.63837487",
"0.627986",
"0.6264807",
"0.62109566",
"0.6168315",
"0.609901",
"0.6076689",
"0.5986559",
"0.596572",
"0.5964802",
"0.5929831",
"0.5909267",
"0.5906561",
"0.5884695",
"0.58724725",
"0.57658005",
"0.5745845",
"0.5740056",
"0.57296085",
... | 0.67300105 | 0 |
Advice Create Advice lines in Payment Advice and compute Advice lines. | def compute_advice(self):
for advice in self:
old_lines = self.env['hr.payroll.advice.line'].search([('advice_id', '=', advice.id)])
if old_lines:
old_lines.unlink()
payslips = self.env['hr.payslip'].search([('date_from', '<=', advice.date), ('date_to', '>=', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_advice():\n json_response = random_adviceslip()\n advice = parse_advice(json_response=json_response)\n return advice",
"def make_decision_with_policy(self, policy_type, *args):\n if policy_type == 1: # ADP\n assert len(args) == 2, 'args should be exactly 2'\n cur_... | [
"0.6020763",
"0.5660076",
"0.5593123",
"0.5584313",
"0.5442596",
"0.53608656",
"0.52971053",
"0.5259828",
"0.5237223",
"0.5174569",
"0.5148661",
"0.5143547",
"0.5119266",
"0.5117248",
"0.511444",
"0.503214",
"0.5009339",
"0.5003946",
"0.4954846",
"0.4921185",
"0.49066684",
... | 0.7590411 | 0 |
`check_for_fit` wraps a method that validates if `self._is_fitted` is `True`. | def check_for_fit(cls, method):
@wraps(method)
def _check_for_fit(self, *args, **kwargs):
klass = type(self).__name__
if not self._is_fitted:
raise PipelineNotYetFittedError(
f"This {klass} is not fitted yet. You must fit {klass} before callin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_for_fit(cls, method):\n\n @wraps(method)\n def _check_for_fit(self, X=None, y=None):\n klass = type(self).__name__\n if not self._is_fitted and self.needs_fitting:\n raise ComponentNotYetFittedError(\n f\"This {klass} is not fitted yet... | [
"0.78038114",
"0.72576225",
"0.6834544",
"0.67376643",
"0.6695705",
"0.6651157",
"0.63908255",
"0.6336527",
"0.61963433",
"0.61222386",
"0.6119558",
"0.6119558",
"0.60666823",
"0.6043454",
"0.6026785",
"0.6026702",
"0.6005541",
"0.5910402",
"0.5892558",
"0.5877655",
"0.585539... | 0.7731085 | 1 |
Set the title and title size of the figure. | def set_title(self):
plt.title(label=self.title, fontsize=self.titlesize) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setFigureTitle(self, title: str):\n self.fig.text(0.5, 0.99, title,\n horizontalalignment='center',\n verticalalignment='top',\n fontsize='small')\n self.draw()",
"def __draw_title(self):\n if self.title is not None:\n ... | [
"0.76607907",
"0.73051995",
"0.7003987",
"0.69982874",
"0.69768006",
"0.69515336",
"0.68642354",
"0.68269694",
"0.67809445",
"0.6734112",
"0.6646728",
"0.659959",
"0.6583342",
"0.65374035",
"0.6534296",
"0.64808226",
"0.6479378",
"0.644033",
"0.644033",
"0.6433921",
"0.643053... | 0.7859415 | 0 |
Output the figure, either as an image on the screen or to the harddisk as a .png or .fits file. | def to_figure(self, structure):
if not self.bypass:
if self.format is "show":
plt.show()
elif self.format is "png":
plt.savefig(self.path + self.filename + ".png", bbox_inches="tight")
elif self.format is "fits":
if structure is... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_figure(self, data):\n\n\t\tsizes = np.shape(data)\n\t\tfig = plt.figure()\n\t\tfig.set_size_inches(1, 1. * sizes[0]/sizes[1], forward = False)\n\t\tax = plt.Axes(fig, [0., 0., 1., 1.])\n\t\tax.set_axis_off()\n\t\tfig.add_axes(ax)\n\t\tax.imshow(data, \"gray\")\n\n\t\t#plt.show()\n\t\tself.plotfile = os.pa... | [
"0.7005608",
"0.68900794",
"0.67705536",
"0.66974014",
"0.6684906",
"0.6641125",
"0.65727204",
"0.65119344",
"0.6449455",
"0.6446146",
"0.644137",
"0.6423629",
"0.6375041",
"0.63690364",
"0.6357464",
"0.6352964",
"0.6331186",
"0.6325431",
"0.63066924",
"0.630663",
"0.62953204... | 0.7381266 | 0 |
Test that all test data can be converted back to a FITS header. | def test_fitsheader():
extensions = ('fts', 'fits')
for ext in extensions:
for ffile in Path(testpath).glob(f"*.{ext}*"):
fits_file = fits.open(ffile)
fits_file.verify("fix")
data, header = fits_file[0].data, fits_file[0].header
meta_header = MetaDict(Orde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_header (filename, htypes=None):\n\n # dictionary\n dict_head = {\n # raw header\n # commenting out SIMPLE, BSCALE and BZERO - basic keywords\n # that will be present in images but not in binary fits tables\n #'SIMPLE': {'htype':'raw', 'dtype':bool, 'DB':False, 'None_... | [
"0.6470424",
"0.6407262",
"0.6279246",
"0.6262113",
"0.62359947",
"0.62172025",
"0.61920476",
"0.6178004",
"0.6162437",
"0.61546427",
"0.613669",
"0.6111256",
"0.6099731",
"0.60726297",
"0.6065509",
"0.60646486",
"0.6034603",
"0.60217834",
"0.6021296",
"0.58954805",
"0.589187... | 0.71362966 | 0 |
Given a pandas Series, generate a descriptive visualisation with a boxplot and a histogram with a kde. By default, this function drops `nan` values. If you desire to handle them differently, you should do so beforehand and/or specify dropna=False. | def dist_plot(series: pd.core.series.Series, dropna: bool = True) -> NoReturn:
if dropna:
series = series.dropna()
quarts = scipy.stats.mstats.mquantiles(series, [0.001, 0.25, 0.5, 0.75, 0.975])
f, (ax_box, ax_hist) = plt.subplots(
2, sharex=True, gridspec_kw={"height_ratios": (0.25, 0.75... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def visualization(data):\n\t# preview top 5 row of data\n\tprint(\"\\n--------Data preview--------\\n{0}\"\n\t\t .format(data.head()))\n\tprint(\"\\nNull value status as follow:\\n{0}\".format(data.isnull().sum()))\n\tcols = [col for col in data.columns]\n\tprint(\"\\nNumber of original features: {0}\".format(len... | [
"0.60901725",
"0.57481736",
"0.57227015",
"0.56605124",
"0.56474423",
"0.5628243",
"0.5616306",
"0.5595369",
"0.5566381",
"0.5519587",
"0.543396",
"0.54185474",
"0.5369447",
"0.5367123",
"0.53473914",
"0.5331595",
"0.53172815",
"0.53153265",
"0.52583396",
"0.52550906",
"0.523... | 0.7083116 | 0 |
Store wavelengths for a spectrum | def storeWavelengths(self, nm):
pre = "w,0"
d = {"wavelength_nm": list(nm)}
self._writeline(pre, str(d)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength_ex(hdulist):\n wave = hdulist[1].data['loglam']\n wave = 10**wave\n\n return wave",
"def GetWavelengths (self) :\n\t\treturn self.run(\"GetWavelengths\")",
"def wavelength(self):\n return self.getparam(\"WAVELENGTH\")",
"def wavelength(self):\n return self.getparam(\"WAV... | [
"0.6924619",
"0.6861172",
"0.6594982",
"0.6594982",
"0.6565899",
"0.65652096",
"0.64793146",
"0.6433606",
"0.6409465",
"0.6385471",
"0.63177145",
"0.6312307",
"0.62819123",
"0.62664",
"0.624952",
"0.6237457",
"0.613862",
"0.61133295",
"0.6061152",
"0.60237616",
"0.6014794",
... | 0.7788513 | 0 |
Pop n oldest experiences from buffer | def _popN(self, n):
for _ in range(n):
self._buffer.popleft() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cull_oldest(self, n=1):\n for msg_id in self.get_history()[:n]:\n self.log.debug(\"Culling record: %r\", msg_id)\n self._culled_ids.add(msg_id)\n self.drop_record(msg_id)",
"def pop(self, n):\n try:\n self._load(False)\n except KeyError:\n ... | [
"0.7055855",
"0.64302206",
"0.6242361",
"0.57871646",
"0.5730102",
"0.5669438",
"0.56686395",
"0.56471443",
"0.5638041",
"0.5636604",
"0.55627507",
"0.55513936",
"0.55501497",
"0.54806334",
"0.54579717",
"0.54518086",
"0.542837",
"0.5424907",
"0.5424907",
"0.5424588",
"0.5402... | 0.7242431 | 0 |
output_isochrone. Writes isochrone as file. Used to save best fit isochrone. | def output_isochrone(self, file_to_name):
N = len(self.color) # length of data points
color = self.color
abs_mag = self.abs_mag
metallicity = self.metallicity
best_fit = int(self.best_fit)*np.ones(N)
age = self.age*np.ones(N)
df_out = pd.DataFrame({'color' : col... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_output(self, output_path, output_filename):\n self.output_file = output_path + '/' + output_filename\n if os.path.isfile(self.output_file + '.txt'): # Creación del archivo txt de salida.\n os.remove(self.output_file + '.txt')\n file = open(self.output_file + '.txt', \"x\"... | [
"0.5922966",
"0.5694775",
"0.5694682",
"0.5676266",
"0.56761366",
"0.5656583",
"0.56536025",
"0.5648889",
"0.564605",
"0.56394976",
"0.5599014",
"0.55966353",
"0.5595966",
"0.559232",
"0.55898625",
"0.5571064",
"0.55685383",
"0.5543788",
"0.5543578",
"0.5533917",
"0.55298513"... | 0.6751746 | 0 |
Usually removing constant columns gives improvement in model's quality. | def drop_const_columns(df, drop_columns=True, print_columns=True):
# 1. report
SingleValueCols = []
for col in df.columns:
unique_count=df[col].nunique()
if unique_count < 2:
SingleValueCols.append(col)
if print_columns:
print(col, unique_count)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_static_cols(df):\n for col in df.columns:\n if len((df[col]).unique()) == 1:\n df.drop(columns=[col], inplace=True)\n return df",
"def _remove_redundant_columns(self):\n self.dataframe.drop(['letter', 'sentiment'], axis=1, inplace=True)",
"def eliminateRedundantInfo(sel... | [
"0.6315389",
"0.62467325",
"0.62432563",
"0.6171818",
"0.61261225",
"0.601501",
"0.600602",
"0.5981777",
"0.59378827",
"0.58547854",
"0.57989967",
"0.5787804",
"0.5746577",
"0.5736866",
"0.5727179",
"0.5697473",
"0.5691183",
"0.56775194",
"0.56136245",
"0.55742145",
"0.556686... | 0.6415829 | 0 |
1. Find date columns automatically 2. Convert them to datetime format | def find_date_columns(df):
def look_to_date(s):
dates = {date: pd.to_datetime(date) for date in s.unique()}
return s.apply(lambda v: dates[v])
date_cols = []
for col in df.select_dtypes(include=['object']).columns:
try:
df[col] = look_to_date(df[col])
print(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recognize_dates(dframe):\n for i, dtype in enumerate(dframe.dtypes):\n if dtype.type == np.object_:\n column = dframe.columns[i]\n new_column = _convert_column_to_date(dframe, column)\n\n if not new_column is None:\n dframe[column] = new_column\n\n r... | [
"0.692748",
"0.69037545",
"0.67863965",
"0.67673683",
"0.67539966",
"0.6692597",
"0.6667349",
"0.66223633",
"0.65745556",
"0.6555922",
"0.6553615",
"0.65185064",
"0.64774036",
"0.6430655",
"0.6345287",
"0.63288176",
"0.63201207",
"0.62785125",
"0.6272471",
"0.6249522",
"0.624... | 0.7120016 | 0 |
Displays recieved messages. This ensures that recieved messages dont get lost by the time this display takes. | def display_messages(self):
while self.joined:
if len(self.messages) != 0:
for msg in self.messages:
#: If the message is empty, ignore it.
if msg == "":
continue
#: If the message is close", then the server has told the client
#: to shut down, so it will. This is not an issue, as u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_messages(self):\n for msg in self.messages:\n print msg['text']",
"def show_messages(self):\n if not self.messages:\n u_print(\" Queue.show_messages() ERR - There is no messages or malformed messages on queue. \")\n u_print(json.dumps(self.messages, indent=... | [
"0.7500149",
"0.70102125",
"0.68906677",
"0.6661795",
"0.6626118",
"0.66245234",
"0.65538955",
"0.6548553",
"0.6502435",
"0.6483911",
"0.6469836",
"0.64564407",
"0.64451647",
"0.63219106",
"0.6284495",
"0.62636817",
"0.62636817",
"0.6240366",
"0.62241864",
"0.6174454",
"0.616... | 0.7889956 | 0 |
Generates a list of accessible reciprocal lattice vectors. To be accessible, the magnitude of a rlv's wavevector must be less than twice that of the input radiation's wavenumber. | def find_accessible_rlvs(crystal, wavelength):
# The wavenumber of the input wavelength
nu = 2*n.pi/wavelength
# Now we find the shortest distance to a wall of a
# parallelogram "shell" in the reciprocal lattice
min_step = min(abs(n.dot(
(crystal.rlattice[0]+crystal.rlattice[1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def R(self,v):\n R=sparse.lil_matrix((len(v),self.N_win),dtype='complex128')\n b=v*self.N_win\n b_rounded=np.round(b).astype('int')\n b_frac=b_rounded-b\n # Figure out what bins are worth looking up\n lobe_radii=self.lobe_radius_interp(v)\n lu_bins=[np.arange(-lr,lr... | [
"0.60902166",
"0.5821111",
"0.5767367",
"0.5698596",
"0.5697524",
"0.5608284",
"0.56012243",
"0.5584463",
"0.5564152",
"0.55254877",
"0.5486465",
"0.54747415",
"0.54615265",
"0.54448056",
"0.54020214",
"0.5399121",
"0.5389129",
"0.53405744",
"0.53344333",
"0.5328175",
"0.5309... | 0.6662302 | 0 |
Generates a powder XRD spectrum for radiation with the given wavelength (in angstroms) | def powder_XRD(crystal,wavelength, get_mults=False):
# The wavenumber of the input wavelength
nu = 2*n.pi/wavelength
# Make a list of the accessible rlvs
rlvs = find_accessible_rlvs(crystal,wavelength)
# Now we calculate the scattering intensity from each rlv
intensities = {
t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wavelength_ex(hdulist):\n wave = hdulist[1].data['loglam']\n wave = 10**wave\n\n return wave",
"def wavelength(energy):\r\n return 2 * np.pi * PLANCK_CONSTANT * SPEED_OF_LIGHT / energy",
"def GetWavelengths (self) :\n\t\treturn self.run(\"GetWavelengths\")",
"def spectrum(self, wl: Union[floa... | [
"0.64374226",
"0.6167109",
"0.6059381",
"0.6053003",
"0.59999365",
"0.5970338",
"0.59206903",
"0.58600605",
"0.5800283",
"0.57909775",
"0.57907706",
"0.57897896",
"0.5705752",
"0.5701563",
"0.5603155",
"0.56020117",
"0.5589162",
"0.5587772",
"0.557587",
"0.5571971",
"0.556261... | 0.6727283 | 0 |
This is just a nice function to turn the raw scattering data into a humanreadable scattering spectrum | def spectrumify(scattering_data, instr_broadening=0.1):
graph_angles = n.linspace(0,180,10000)
graph_intensities = n.zeros(graph_angles.shape)
for angle, intensity in sorted(scattering_data.items()):
graph_intensities += intensity * \
n.exp(-(graph_angles - angle)**... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convertToSpectroGram(self):",
"def create_data(self) -> str:\r\n s = self.scale\r\n mini, maxi = self.get_min_max()\r\n diff = maxi - mini\r\n\r\n output = \"const data = {\\n\"\r\n\r\n # Create the data for the scatters\r\n # TODO: If it's not interactive, labels sh... | [
"0.58403826",
"0.5734011",
"0.5645727",
"0.5622272",
"0.5570202",
"0.556081",
"0.5543349",
"0.5482549",
"0.5461118",
"0.5426467",
"0.5399718",
"0.53791714",
"0.53609496",
"0.5282781",
"0.52763706",
"0.5257553",
"0.51904374",
"0.51811427",
"0.5170123",
"0.5169117",
"0.5167688"... | 0.6065294 | 0 |
yield each group of choices with replacement. | def bootstrap(items, choices, repeats):
for i in range(repeats):
yield sample(items, choices, replace=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle_choices(self, choices, rng):\r\n # Separate out a list of the stuff to be shuffled\r\n # vs. the head/tail of fixed==true choices to be held back from the shuffle.\r\n # Rare corner case: A fixed==true choice \"island\" in the middle is lumped in\r\n # with the tail group of... | [
"0.5570695",
"0.5404692",
"0.5384516",
"0.5351762",
"0.53155327",
"0.5287687",
"0.5285",
"0.52001417",
"0.5197755",
"0.51410365",
"0.51231086",
"0.5089644",
"0.5087817",
"0.50691915",
"0.5068467",
"0.5063193",
"0.5062266",
"0.5049467",
"0.5021306",
"0.50199336",
"0.50183135",... | 0.564822 | 0 |
return a matrix of words ~ genera word_prob_provided_genus. use total_seqs as int, genus_seqs as int 1darray. | def _get_word_posteriors(self, seq_counts, genus_seqs, total_seqs):
# n(wi) as a col vector
word_seqs = c_[seq_counts.sum(1)]
# p(wi) as a col vector
word_priors = (word_seqs + 0.5) / (total_seqs + 1)
# p(wi|G)
word_posteriors = (seq_counts + word_priors) / (genus_seqs + ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_matrix_of_vectors(wv_from_bin, required_words=['softball', 'technology','street','project','fellow','maps','view','fuel','summer','clubhouse','ball','steal','soccer','driving','motor','comedy']):\n import random\n words = list(wv_from_bin.vocab.keys())\n print(\"Shuffling words ...\")\n random.... | [
"0.5885148",
"0.5827227",
"0.58017194",
"0.57225364",
"0.5393069",
"0.5331855",
"0.53210473",
"0.53188634",
"0.5291317",
"0.52824926",
"0.5277673",
"0.5267698",
"0.52600175",
"0.5247408",
"0.5245951",
"0.52345306",
"0.52255493",
"0.52097064",
"0.52083904",
"0.5207958",
"0.519... | 0.657779 | 0 |
Raise a ValidationError if data does not match the author format. | def __call__(self, data):
if self.required and len(data) <= 0:
raise ValidationError('An author is required')
if not isinstance(data, list):
# Convert single instance to a list
data = [data]
AUTHOR_TYPES = {'author', 'photographer', 'illustrator', 'videograp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _validate_author_id(cls, item):\n if (\n item.author_id and\n not user_services.is_user_or_pseudonymous_id(item.author_id)\n ):\n cls._add_error(\n 'final %s' % (\n base_model_validators.ERROR_CATEGORY_AUTHOR_CHECK),\n ... | [
"0.6855748",
"0.66630197",
"0.6189032",
"0.60399836",
"0.6025009",
"0.59523976",
"0.5834141",
"0.580403",
"0.5802128",
"0.57902837",
"0.5752016",
"0.5670109",
"0.5639969",
"0.56111646",
"0.55745125",
"0.5572385",
"0.55602807",
"0.55434805",
"0.5539788",
"0.5521505",
"0.548785... | 0.7580519 | 0 |
Makes a cue ball with a starting velocity of (0,0,0) at the right end of the map | def make_cueball(starting_position = vec(15,0,0), starting_vel = vec(0,0,0)):
cueball = sphere(size = 1.0*vec(1,1,1), pos = starting_position)
cueball.vel = starting_vel
isMoving = False
return cueball | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bomb_vector(self):\n\n\t\tif self.b_offset == 0:\n\t\t\top = sin\n\t\telse:\n\t\t\top = cos\n\n\t\tself.y -= self.speed\n\t\tself.rect.y = self.y\n\t\t# MMMMMMMMMMMMMMMMMMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATHS\... | [
"0.6513015",
"0.63712394",
"0.6334853",
"0.6243784",
"0.62388325",
"0.62215716",
"0.6183578",
"0.6173977",
"0.6141188",
"0.60439825",
"0.60349804",
"0.598072",
"0.5956398",
"0.5952032",
"0.5942249",
"0.5923052",
"0.59218514",
"0.58929884",
"0.58900994",
"0.5872543",
"0.584848... | 0.6539402 | 0 |
Makes a new moving blackHole with a starting position and default velocity with vec(0,0,0) | def make_blackHole(starting_position, starting_vel = vec(0,0,0)):
blackHole = helix(size = 1.0*vec(1, 1, 1), pos = starting_position, color = color.black) # ball is an object of class helix
blackHole.vel = starting_vel # This is the initial velocity
return blackHole | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createBouncingPixel():\n height = width = 16\n empty = numpy.zeros((height, width), dtype=numpy.int32)\n x = 0\n y = 0\n x_diff = 1\n y_diff = 1\n frames = []\n for i in xrange(61): # Comes back to starting position in 60 steps\n copy = numpy.array(empty)\n if x + x_diff not in range(0, width):\n... | [
"0.57895917",
"0.56245697",
"0.56215173",
"0.55915743",
"0.5580983",
"0.5520519",
"0.5514952",
"0.54837316",
"0.5476015",
"0.5460184",
"0.5457634",
"0.54353166",
"0.542367",
"0.54190814",
"0.54180855",
"0.54020005",
"0.5399414",
"0.5391632",
"0.5374892",
"0.5359748",
"0.53548... | 0.74914 | 0 |
Implements Python's choice using the random() function. | def choice(L):
LEN = len(L) # Get the length
randomindex = int(LEN*random()) # Get a random index
return L[randomindex] # Return that element
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choice(seq):\r\n i = int(random() * len(seq))\r\n return seq[i]",
"def my_random_choice(choices):\n def getKey(x):\n return x[0] + 0.001 * x[1]\n\n return min(choices, key=getKey)\n\n # for actual random selection, we may replace the above with this:\n #return random.choice(choices)"... | [
"0.80179393",
"0.73609155",
"0.73578393",
"0.7326621",
"0.72457415",
"0.7187231",
"0.71675736",
"0.7123166",
"0.7090522",
"0.70814466",
"0.7080028",
"0.7080028",
"0.7074489",
"0.706705",
"0.70160604",
"0.70116484",
"0.70015615",
"0.698032",
"0.69781715",
"0.69609964",
"0.6958... | 0.7396507 | 1 |
Implements Python's randint using the random() function. returns an int from low to hi _inclusive_ (so, it's not 100% Pythonic) | def randint(low, hi):
if hi < low:
low, hi = hi, low # Swap if out of order!
LEN = int(hi) - int(low) + 1. # Get the span and add 1
randvalue = LEN*random() + int(low) # Get a random value
return int(randvalue) # Return the integer part of it
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mt_rand (low = 0, high = sys.maxint):\n return random.randint (low, high)",
"def random_randint(lower_bound, upper_bound):\r\n return random_randrange(lower_bound, upper_bound+1)",
"def random_int(low: int, high: int, seed=None):\n random.seed(seed)\n return random.randint(low, high)",
... | [
"0.8181219",
"0.7950442",
"0.7925715",
"0.7910221",
"0.7900935",
"0.7869978",
"0.7862936",
"0.78217626",
"0.7807758",
"0.7801138",
"0.7768885",
"0.77118933",
"0.76688373",
"0.76688373",
"0.7663735",
"0.76537967",
"0.7641981",
"0.75275236",
"0.7524197",
"0.747597",
"0.7453642"... | 0.8425401 | 0 |
Returns a vec of (r, g, b) random from 0.0 to 1.0. | def randcolor():
r = random(0.0, 1.0)
g = random(0.0, 1.0)
b = random(0.0, 1.0)
return vec(r, g, b) # A color is a three-element vec
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_color_gen():\n r = randint(0, 255)\n g = randint(0, 255)\n b = randint(0, 255)\n return [r, g, b]",
"def get_random_color():\n def get_random_value():\n \"\"\" Return a random value between 0.0 and 1.0 \"\"\"\n return randint(0, 255) / 256.0\n return Vec... | [
"0.78245014",
"0.7490951",
"0.74682033",
"0.7444328",
"0.7442808",
"0.73355055",
"0.7088772",
"0.7078341",
"0.7064664",
"0.7050868",
"0.7014214",
"0.6991338",
"0.6988401",
"0.69807917",
"0.68873507",
"0.686652",
"0.6838748",
"0.67905116",
"0.6724731",
"0.6675243",
"0.6661542"... | 0.7952764 | 0 |
Corral collisions! Ball must have a .vel field and a .pos field. | def corral_collide(ball):
# If the ball hits wallA
if ball.pos.z < wallA.pos.z: # Hit -- check for z
ball.pos.z = wallA.pos.z # Bring back into bounds
ball.vel.z *= -1.0 # Reverse the z velocity
# If the ball hits wallB
if ball.pos.x < wallB.pos.x: # Hit -- check for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkBallCollision(self, ball):\n\t\tres, cornx, corny = ball.collWithRect(self.bbox)\n\t\t# print res,cornx, corny\n\t\tif res==0:\n\t\t\treturn False\n\n\t\tleft = self.x-self.length/2\n\t\tif ball.x >= left and ball.x <= self.x+self.length/2:\n\t\t\t#bounce normally\n\t\t\tmagnitude = math.sqrt(ball.vx**2+b... | [
"0.6752811",
"0.673313",
"0.67180336",
"0.66739434",
"0.6579822",
"0.6557391",
"0.64670503",
"0.64647895",
"0.6444945",
"0.64384305",
"0.6435668",
"0.6405922",
"0.639538",
"0.6363032",
"0.63621885",
"0.63595736",
"0.6239505",
"0.6206427",
"0.6186919",
"0.6175984",
"0.6161149"... | 0.7226013 | 0 |
Paints a square on the grid at a particular (int, int) position. Color is given as an RGB triple (of floats between 0 and 1); cr is the Cairo context. Used only in the expose methods of Board and NextPieceDisplay | def paint_square(self, pos, color, cr):
cr.set_source_rgb(*color)
i, j = pos
cr.rectangle(i*DOT_SIZE+1, j*DOT_SIZE-1, DOT_SIZE-2, DOT_SIZE-2)
cr.fill() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw_square(self, surface, color, position):\n rect = pygame.Rect(position, (50, 50))\n pygame.draw.rect(surface, color, rect)",
"def draw_square(display, coord, box_size, color, bg_color):\n left, top = coord\n half = int(box_size * 0.5)\n quarter = int(box_size * 0.25)\n pygame.dr... | [
"0.7065544",
"0.67776066",
"0.637372",
"0.6360873",
"0.6332401",
"0.63036317",
"0.6284072",
"0.6204069",
"0.61639875",
"0.60808086",
"0.6073086",
"0.6061461",
"0.60506696",
"0.6016593",
"0.5891857",
"0.5889505",
"0.5847315",
"0.5842801",
"0.58213603",
"0.5807137",
"0.58049685... | 0.7957317 | 0 |
Drop (and lock) curr_piece as far as possible, granting points equal to the distance of the drop. | def drop_curr_piece(self):
if self.over: return
delta = (0, 0) # now make this as big as possible
while True:
new_delta = tuple_add(delta, (0, 1))
if self.can_move_curr_piece(new_delta):
delta = new_delta
else:
break
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_curr_piece(self, delta, point=False):\n if self.over: return\n elif self.can_move_curr_piece(delta):\n self.curr_piece.confirm_move(delta)\n if point: self.increment_score(1)\n elif delta == (0,1): # \"illegal\" down move\n self.lock_curr_piece()\n ... | [
"0.65945",
"0.64016134",
"0.59951985",
"0.5804648",
"0.57469374",
"0.57464397",
"0.573787",
"0.5701909",
"0.5693444",
"0.566303",
"0.5634835",
"0.5607702",
"0.5607433",
"0.5579537",
"0.5576645",
"0.5542439",
"0.55122036",
"0.54979587",
"0.54958576",
"0.548495",
"0.5484019",
... | 0.8361154 | 0 |
Add squares of current piece to the collection of locked squares. Make calls to clear full rows, generate another piece, and check whether the game should end. | def lock_curr_piece(self):
for pos in self.curr_piece.occupying():
self.locked_squares[pos] = self.curr_piece.color
self.clear_rows()
self.curr_piece = self.next_piece_display.get_piece()
if any(pos in self.locked_squares
for pos in self.curr_piece.occupying... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_piece(self, piece: Model):\n new_piece_coordinates = piece.get_block_positions()\n for coordinates in new_piece_coordinates:\n if not self.piece_encompasses_coordinates(coordinates):\n continue\n else:\n print('GAME OVER')\n r... | [
"0.6908374",
"0.6561864",
"0.62816846",
"0.6172833",
"0.61137444",
"0.6108231",
"0.60665935",
"0.5999639",
"0.59820265",
"0.5963833",
"0.5893313",
"0.588994",
"0.57835466",
"0.57342786",
"0.5715649",
"0.5707915",
"0.56976265",
"0.56739694",
"0.56672215",
"0.56570166",
"0.5649... | 0.70793056 | 0 |
Clear any full rows, modifying the variables locked_squares, level, lines, and score as appropriate. | def clear_rows(self):
### Previous version had a bug, in that it assumed the set of ###
### indices of full rows had to be a contiguous sequence! ###
full_rows = [j for j in range(ROWS) if all(
(i, j) in self.locked_squares for i in range(COLS))]
if not full_rows... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_rows(self):\n ...",
"def erase_scores(self):\n self.database.erase_scores(self.difficulty)",
"def reset(self):\n self.rows = deepcopy(self.empty_rows)\n self._update_max_row_info()",
"def dirty_squares(self) -> None:\n row = ran(0, self.__squares.__len__() - 1)\n ... | [
"0.6815103",
"0.6737937",
"0.6626234",
"0.6478328",
"0.63999295",
"0.62693805",
"0.625021",
"0.6215124",
"0.62023664",
"0.61826193",
"0.61183906",
"0.6101011",
"0.6049277",
"0.60386187",
"0.6013733",
"0.5997911",
"0.599455",
"0.59881616",
"0.5986746",
"0.5986746",
"0.5968666"... | 0.82794744 | 0 |
Increment lines by d, and change the label. | def increment_lines(self, d):
self.lines += d
styled_set_label_text(self.lines_display, "Lines: "+str(self.lines)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_counter(self, event=None):\n try:\n text_area = self.get_current()\n self.canvas.delete('all')\n i = text_area.index(\"@0,0\")\n while True:\n dline = text_area.dlineinfo(i)\n if dline is None: break\n y = dlin... | [
"0.64690274",
"0.6017067",
"0.5998562",
"0.587672",
"0.5860527",
"0.5846188",
"0.5840155",
"0.5809756",
"0.57616186",
"0.57600725",
"0.57464296",
"0.5722578",
"0.5712588",
"0.5707973",
"0.5702293",
"0.57016605",
"0.5681828",
"0.5676111",
"0.5673482",
"0.56705654",
"0.56421065... | 0.87534755 | 0 |
Increment score by x, and change the label. | def increment_score(self, x=1):
self.score += x
styled_set_label_text(self.score_display, "Score: "+str(self.score)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increase_score(self):\n self.score += 1",
"def updateScore(score):\n return score + 1",
"def augmenter_score():\n\n global label_score\n global score\n\n score += 1\n label_score.config(text= \"score : \" + str(score))",
"def updateScore(self, score):\n self.__score += score",
... | [
"0.7557804",
"0.73200655",
"0.7297284",
"0.72214425",
"0.70572585",
"0.70543677",
"0.69891006",
"0.694322",
"0.6930679",
"0.6875506",
"0.68736583",
"0.68078065",
"0.68063426",
"0.6762595",
"0.67082787",
"0.6703826",
"0.6693392",
"0.66802347",
"0.6653046",
"0.6616634",
"0.6605... | 0.9048463 | 0 |
Increment level by 1, and change the label. Also call make_timer and hook up the resulting function with glib.timeout_add, to be called every 2.0/(level+3) seconds. | def increment_level(self):
self.level += 1
styled_set_label_text(self.level_display, "Level: "+str(self.level))
glib.timeout_add(2000//(self.level+3), self.make_timer(self.level)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_state(self, level: int, timed: int = 0) -> None:\n self._pilothouse.queue_change(level, timed)",
"def timer_callback(self):\n # There're 5 logger-level in ROS 2 get_logger() System.\n # Try out and watch whats difference.\n self.get_logger().debug(f'==== Hello ROS 2 : {self... | [
"0.58169186",
"0.5782551",
"0.57647955",
"0.57608676",
"0.5739205",
"0.5662492",
"0.5624032",
"0.5617376",
"0.5608305",
"0.5559562",
"0.5549147",
"0.55384463",
"0.5514774",
"0.5487441",
"0.54303175",
"0.54259276",
"0.5405828",
"0.53985447",
"0.5396091",
"0.53815854",
"0.53790... | 0.8231671 | 0 |
Creates a callback function on_timer, which moves current piece down (without granting a point). If the current level moves beyond lev, then on_timer will stop working, and will need to be replaced. | def make_timer(self, lev):
def on_timer():
if (lev == self.level) and not self.over: # finds lev in scope
self.move_curr_piece((0, 1))
return True
else:
return False # kills on_timer
return on_timer | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timed_callback(self, dx, dy):\n def _timed_callback():\n # self.move_it(dx, dy)\n if self.timed_tick_counter == 3:\n GEvent.post_event(\n GEvent.ENGINE,\n GEvent.LOGGER,\n self,\n GEvent.SCEN... | [
"0.547525",
"0.54469144",
"0.5425048",
"0.5416489",
"0.54151726",
"0.54000765",
"0.53114885",
"0.53095424",
"0.5265004",
"0.5257605",
"0.51930314",
"0.51930314",
"0.51743674",
"0.5133805",
"0.51006556",
"0.5099005",
"0.5094788",
"0.508105",
"0.5074436",
"0.50398487",
"0.49785... | 0.75402504 | 0 |
Generates a new piece and shows it; returns the old piece. Analogous to next() operation for iterators. | def get_piece(self):
old = self.next_piece
new = self.create_piece()
self.next_piece = new
self.queue_draw()
return old | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spawn_new_piece(self):\n\n del self.active_piece\n\n new_x = self.WIDTH // 2 - 1\n self.active_piece = Figure(random.choice(PIECE_TYPES), new_x, 0)",
"def update_next_piece(self, board):\n # next piece\n if board.next_shape:\n for preview_row_offset in range(4):\... | [
"0.6434271",
"0.6405382",
"0.58710295",
"0.56589395",
"0.5634714",
"0.5630031",
"0.5568397",
"0.5532417",
"0.551113",
"0.54950935",
"0.54757816",
"0.5345696",
"0.5345064",
"0.5302938",
"0.5273212",
"0.52669513",
"0.5223759",
"0.52072686",
"0.5190134",
"0.51814973",
"0.5171587... | 0.7066668 | 0 |
Set the text of a gtk.Label with the preferred markup scheme. (Simple enough not to be worth extending gtk.Label just for this method.) | def styled_set_label_text(label, text):
front = "<b><span foreground='#AAAAAA' size='large'>"
end = "</span></b>"
label.set_markup(front+text+end) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_label_text (self, text):\n if text: self.label.set_label(text)",
"def set_text(self, text: str) -> Label:\n self.setText(text)\n return self",
"def set_label_text(self, text: str) -> None:\n self._label_text.set(text)\n self.update_label_text()",
"def set_label(self... | [
"0.6827273",
"0.67186964",
"0.6487902",
"0.64215046",
"0.6359941",
"0.61352456",
"0.61226773",
"0.60732174",
"0.60162574",
"0.6002159",
"0.5993437",
"0.5968697",
"0.59637225",
"0.59441745",
"0.59131277",
"0.58569264",
"0.5849551",
"0.58246344",
"0.5805955",
"0.5805955",
"0.57... | 0.8151647 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.