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 |
|---|---|---|---|---|---|---|
Sets the actual_reported_desc of this ZacksEPSSurpriseSummary. | def actual_reported_desc(self, actual_reported_desc):
self._actual_reported_desc = actual_reported_desc | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_reported_date(self, actual_reported_date):\n\n self._actual_reported_date = actual_reported_date",
"def actual_reported_time(self, actual_reported_time):\n\n self._actual_reported_time = actual_reported_time",
"def set_desc(self, desc: str):\n self._desc = desc",
"def set_sdes... | [
"0.6053742",
"0.5846319",
"0.56971115",
"0.56720304",
"0.5575189",
"0.55218446",
"0.54972035",
"0.5249525",
"0.5249525",
"0.5241914",
"0.51860005",
"0.51595813",
"0.50734186",
"0.50297785",
"0.5028794",
"0.5005069",
"0.50037324",
"0.49911448",
"0.49659857",
"0.49070513",
"0.4... | 0.87028116 | 0 |
Sets the eps_actual of this ZacksEPSSurpriseSummary. | def eps_actual(self, eps_actual):
self._eps_actual = eps_actual | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setTolerance(self, eps):\n self._simulator_.update(eps=eps)\n return",
"def actual(self, actual):\n\n self._actual = actual",
"def actual(self, actual):\n\n self._actual = actual",
"def eps_std_dev_estimate(self, eps_std_dev_estimate):\n\n self._eps_std_dev_estimate = e... | [
"0.6466235",
"0.61367756",
"0.61367756",
"0.6084746",
"0.595881",
"0.5838524",
"0.58198535",
"0.5746944",
"0.572031",
"0.56509256",
"0.55779433",
"0.53765965",
"0.53148246",
"0.51251",
"0.51141983",
"0.49583092",
"0.49133393",
"0.48819152",
"0.4800654",
"0.4739398",
"0.473750... | 0.85233676 | 0 |
Sets the eps_actual_zacks_adj of this ZacksEPSSurpriseSummary. | def eps_actual_zacks_adj(self, eps_actual_zacks_adj):
self._eps_actual_zacks_adj = eps_actual_zacks_adj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps_actual(self, eps_actual):\n\n self._eps_actual = eps_actual",
"def eps_count_estimate(self, eps_count_estimate):\n\n self._eps_count_estimate = eps_count_estimate",
"def set_z_estimates(self, other):\n if len(other) != self.nz:\n raise RuntimeError('Dimension of vector d... | [
"0.5758268",
"0.46546817",
"0.45786706",
"0.45177358",
"0.44761702",
"0.44715637",
"0.43567526",
"0.4343237",
"0.4342755",
"0.43315008",
"0.42325452",
"0.4216695",
"0.4204794",
"0.41775686",
"0.4161513",
"0.4161513",
"0.41415232",
"0.40295967",
"0.40165812",
"0.40164503",
"0.... | 0.8767773 | 0 |
Sets the eps_mean_estimate of this ZacksEPSSurpriseSummary. | def eps_mean_estimate(self, eps_mean_estimate):
self._eps_mean_estimate = eps_mean_estimate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps_std_dev_estimate(self, eps_std_dev_estimate):\n\n self._eps_std_dev_estimate = eps_std_dev_estimate",
"def mean(self, mean):\n\n self._mean = mean",
"def set_average(self, avg, num_samples):\n self._average = avg * num_samples\n self.num_samples = num_samples",
"def eps_co... | [
"0.7034361",
"0.6388086",
"0.6210367",
"0.6092318",
"0.6018103",
"0.5805943",
"0.5778425",
"0.5768828",
"0.5726578",
"0.5717324",
"0.5717324",
"0.5701782",
"0.55565983",
"0.5543327",
"0.5531376",
"0.5513308",
"0.5512683",
"0.5511079",
"0.5498498",
"0.54949874",
"0.5492254",
... | 0.88085765 | 0 |
Sets the eps_amount_diff of this ZacksEPSSurpriseSummary. | def eps_amount_diff(self, eps_amount_diff):
self._eps_amount_diff = eps_amount_diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps_percent_diff(self, eps_percent_diff):\n\n self._eps_percent_diff = eps_percent_diff",
"def eps_count_estimate(self, eps_count_estimate):\n\n self._eps_count_estimate = eps_count_estimate",
"def eps_actual(self, eps_actual):\n\n self._eps_actual = eps_actual",
"def eps_std_dev_est... | [
"0.72610503",
"0.59410965",
"0.5908103",
"0.58935064",
"0.559176",
"0.54737395",
"0.54237807",
"0.514221",
"0.50822794",
"0.46499398",
"0.46482077",
"0.46025681",
"0.4589694",
"0.45453948",
"0.45320264",
"0.4529747",
"0.4529747",
"0.4529747",
"0.4529747",
"0.4529747",
"0.4529... | 0.8580839 | 0 |
Sets the eps_percent_diff of this ZacksEPSSurpriseSummary. | def eps_percent_diff(self, eps_percent_diff):
self._eps_percent_diff = eps_percent_diff | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps_amount_diff(self, eps_amount_diff):\n\n self._eps_amount_diff = eps_amount_diff",
"def surprise_percent(self, surprise_percent):\n\n self._surprise_percent = surprise_percent",
"def setPercentualeTs(self,percentualeTs):\n self.__percentuale = percentualeTs",
"def eps_actual(self,... | [
"0.6969038",
"0.6168777",
"0.5753362",
"0.5749585",
"0.5665683",
"0.56615984",
"0.56203425",
"0.5616495",
"0.55233514",
"0.5342439",
"0.53285795",
"0.53155327",
"0.5219804",
"0.5219804",
"0.5219804",
"0.5219804",
"0.51659",
"0.51656413",
"0.51298034",
"0.5095822",
"0.5095822"... | 0.87793726 | 0 |
Sets the eps_count_estimate of this ZacksEPSSurpriseSummary. | def eps_count_estimate(self, eps_count_estimate):
self._eps_count_estimate = eps_count_estimate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eps_mean_estimate(self, eps_mean_estimate):\n\n self._eps_mean_estimate = eps_mean_estimate",
"def esxi_host_count(self, esxi_host_count):\n\n self._esxi_host_count = esxi_host_count",
"def set_article_count(cls, count):\n return cls.db.set(\"article_count\", count)",
"def eps_std_de... | [
"0.61652166",
"0.5902981",
"0.5884286",
"0.5620953",
"0.5486185",
"0.53570443",
"0.52857256",
"0.5270576",
"0.52693754",
"0.5226665",
"0.5221407",
"0.52161694",
"0.5169238",
"0.5168896",
"0.51224285",
"0.51224285",
"0.51224285",
"0.51224285",
"0.5118172",
"0.51125413",
"0.507... | 0.8626549 | 0 |
Sets the eps_std_dev_estimate of this ZacksEPSSurpriseSummary. | def eps_std_dev_estimate(self, eps_std_dev_estimate):
self._eps_std_dev_estimate = eps_std_dev_estimate | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_stddev(self):\r\n for i in range(1,len(self.data[0])):\r\n self.stddev.append(np.std(self.data[:,i]))",
"def set_stdeviations(self, sigma):\n stdeviations = np.ones(len(self.phenotypes)) * sigma\n self.data['stdeviations'] = stdeviations\n return self",
"d... | [
"0.60742307",
"0.6068721",
"0.603017",
"0.5816552",
"0.57548743",
"0.5689732",
"0.56560314",
"0.56022733",
"0.55775946",
"0.55485165",
"0.5539166",
"0.5505066",
"0.5477183",
"0.5408408",
"0.53998953",
"0.53989637",
"0.5375006",
"0.5372551",
"0.534882",
"0.53399366",
"0.533617... | 0.8798974 | 0 |
Register a step with Mahiru. This tells Mahiru which function to call to run a step. Maybe one day we'll have more than one step in a container, but for now there's only one, so we don't have to name it. | def register_step(step_function: StepFunction) -> None:
global _step_function
_step_function = step_function | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_step_hook(h):\n add_hook(step, h)",
"def step(step_name, extra_types=None):\n\n def decorator(func):\n # Register the step, other way return the function unchanged\n step_function = StepFunction(func, step_name, extra_types)\n # Check for similar steps, in both directions\n ... | [
"0.72093314",
"0.6811015",
"0.6603875",
"0.6477387",
"0.63986033",
"0.6310614",
"0.6310614",
"0.6284854",
"0.6246809",
"0.616408",
"0.6150986",
"0.6073225",
"0.6049124",
"0.60156363",
"0.59425783",
"0.5941072",
"0.59240633",
"0.59145105",
"0.58411616",
"0.5821641",
"0.5821641... | 0.7780961 | 0 |
Download input files from input data assets. This gets the input files from the input data assets, assuming that they're named data.json and are served by a WebDAV service, and stores them locally for the user's script to read. | def _download_inputs(inputs: Dict[str, str]) -> Dict[str, Path]:
in_paths = dict()
for name, endpoint in inputs.items():
target_dir = _BASE_PATH / name
target_dir.mkdir()
target_file = target_dir / 'data.json'
r = requests.get('{}/data.json'.format(endpoint))
with target_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_models_and_data():\n\n for file in DATA_FILES:\n download_file(file[\"url\"], file[\"path\"])",
"def download_data(self):\r\n \r\n for file in self.__files:\r\n file_to_download = os.path.join(self.__folder, os.path.basename(file))\r\n if not os.path.isf... | [
"0.7088825",
"0.67232937",
"0.6608585",
"0.636465",
"0.6284645",
"0.6278648",
"0.6204893",
"0.62003607",
"0.61364603",
"0.6107125",
"0.6067391",
"0.60669464",
"0.6062756",
"0.60482025",
"0.59929",
"0.59682965",
"0.5945153",
"0.58993334",
"0.5883806",
"0.58835274",
"0.58447576... | 0.7046366 | 1 |
Handle a SQLAlchemy DatabaseError exception nicely. Currently this only takes care of custom INDX exception raised from constraint triggers. It must be invoked from an ``except DatabaseError`` block. | def handle_sqlalchemy_database_error():
exc_class, exc, tb = sys.exc_info()
if exc.orig.pgcode is None or not exc.orig.pgcode.startswith('INDX'):
# not an indico exception
raise
msg = exc.orig.diag.message_primary
if exc.orig.diag.message_detail:
msg += f': {exc.orig.diag.message... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_postgres_error(self,\n metric_name: str,\n exc: Exception) -> typing.Optional[Exception]:\n if isinstance(exc, psycopg2.errors.lookup('P0001')):\n return errors.BadRequest(str(exc).split('\\n')[0])\n super().on_postgres_error(metric_... | [
"0.68104196",
"0.65870243",
"0.6523308",
"0.6505848",
"0.6317467",
"0.63019425",
"0.6291309",
"0.62713736",
"0.6048002",
"0.6048002",
"0.5962407",
"0.5961614",
"0.5913699",
"0.5904233",
"0.58782214",
"0.5855905",
"0.5841002",
"0.5840025",
"0.5832455",
"0.5769023",
"0.5690547"... | 0.8028857 | 0 |
Enable immediate enforcing of deferred constraints. This should be done at the end of normal request processing and exceptions should be handled in a clean way that goes beyond letting the user report an error. If you do not expect a deferred constraint to be violated do not use this the constraints will be checked at ... | def enforce_constraints(self):
self.session.flush()
try:
self.session.execute('SET CONSTRAINTS ALL IMMEDIATE')
except DatabaseError:
handle_sqlalchemy_database_error() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enable_constraint_checking(self):\r\n if self.connection:\r\n cursor = self.connection.cursor()\r\n else:\r\n cursor = self._cursor()\r\n # don't check the data, just turn them on\r\n cursor.execute('EXEC sp_MSforeachtable \"ALTER TABLE ? WITH NOCHECK CHECK CON... | [
"0.6325148",
"0.5674259",
"0.55485064",
"0.55150265",
"0.5427077",
"0.54133576",
"0.54061574",
"0.53616786",
"0.5189054",
"0.5176761",
"0.51580983",
"0.5142313",
"0.5031582",
"0.50157243",
"0.5012075",
"0.49927413",
"0.4991722",
"0.4952122",
"0.4939946",
"0.49328038",
"0.4901... | 0.743627 | 0 |
Provide a contextmanager with a temporary SQLAlchemy session. This allows you to use SQLAlchemy e.g. in a `after_this_request` callback without having to worry about things like implicit commits | def tmp_session(self):
session = db._make_session_factory({'query_cls': IndicoBaseQuery})()
try:
yield session
except Exception:
session.rollback()
raise
finally:
session.close() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temporary_session(engine):\n return scoped_session(sessionmaker(bind=engine))",
"def session(**kwargs) -> typing.ContextManager[Session]:\n new_session = Session(**kwargs)\n try:\n yield new_session\n new_session.commit()\n except Exception:\n new_session.rollback()\n ... | [
"0.75472164",
"0.7315274",
"0.7287995",
"0.72488594",
"0.7232654",
"0.7101006",
"0.70158786",
"0.6933692",
"0.6903318",
"0.68973255",
"0.68316865",
"0.6821561",
"0.680621",
"0.6792339",
"0.6787168",
"0.6775541",
"0.6756411",
"0.6727181",
"0.6720726",
"0.67206407",
"0.6693654"... | 0.7368352 | 1 |
Status handler. Always returns a tuple with the 200 status code and an "OK" message. | def status(self, request):
return (200, 'OK') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status():\n return \"OK\" # defaults to a 200 HTML status return code",
"def status(_):\n return {\"status\": \"ok\"}",
"def status(code=200):\n\treturn jsonify(server.status_data()), code",
"def status_check():\n return {\"status\": \"OK\"}",
"def status():\n return 'OK'",
"def s... | [
"0.7710894",
"0.76517546",
"0.7440712",
"0.74242383",
"0.7419635",
"0.7380551",
"0.7374018",
"0.7267463",
"0.72373027",
"0.7168302",
"0.7077018",
"0.69874835",
"0.6986935",
"0.68780476",
"0.6842267",
"0.67474073",
"0.66987526",
"0.66818",
"0.6651226",
"0.66455394",
"0.6637574... | 0.76727563 | 1 |
Game servers listing handler. | def list_servers(self, request):
token = request.form.get('token')
if token is None:
token = request.args.get('token')
rest_client = RestClient.instance()
if (not rest_client.validate_token(token)):
return (401, 'Unauthorized')
game_servers = GameServers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def list(self, ctx):\n server = ctx.message.server\n if server.id not in self.db:\n self.db[server.id] = {}\n dataIO.save_json(\"data/lootbox/servers.json\", self.db)\n if len(self.db[server.id]) < 1:\n await self.bot.say(\"No boxes have been created for ... | [
"0.7058955",
"0.6930427",
"0.688933",
"0.6815328",
"0.67608035",
"0.6523362",
"0.6496204",
"0.6455543",
"0.6378886",
"0.63612926",
"0.6360358",
"0.6316278",
"0.6289821",
"0.6230246",
"0.6207697",
"0.6172263",
"0.6157241",
"0.613586",
"0.60764813",
"0.6050473",
"0.6006421",
... | 0.73768497 | 0 |
return the size of the reference `ref` | def get_ref_length(self, ref):
tbl = self._get_references_node()
return get_ref_length(tbl, ref) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n_cf(self):\n return np.size(self._ref_ii, 0)",
"def size(self) -> int:",
"def size (self):\n\t\timport struct\n\t\treturn struct.calcsize (self.struct)",
"def size(self):\n count = 0\n current = self.front\n\n while current is not None:\n current = current.getPtr()... | [
"0.65933144",
"0.6547124",
"0.65430045",
"0.65283424",
"0.6422106",
"0.6411523",
"0.63927954",
"0.63888985",
"0.6367139",
"0.6365005",
"0.635135",
"0.6339579",
"0.6336641",
"0.6334914",
"0.63336456",
"0.6308441",
"0.629038",
"0.629038",
"0.629038",
"0.629038",
"0.629038",
"... | 0.87245214 | 0 |
generator function that returns list of references names from the | def get_rnames(self):
for row in self._get_references_node():
yield row['name'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def references_list( self, theWeaver ):\n return [ (c.name, c.seq) \n for c in theWeaver.reference_style.chunkReferencedBy( self ) ]",
"def genReferences( self, aWeb ):\n try:\n for t in self.commands:\n ref= t.ref( aWeb )\n if ref is not None:\n ... | [
"0.7568395",
"0.6809598",
"0.65282106",
"0.652684",
"0.64521325",
"0.6438737",
"0.6380114",
"0.6379816",
"0.6371746",
"0.6287792",
"0.6260314",
"0.61829287",
"0.6179762",
"0.6161059",
"0.6103422",
"0.6086004",
"0.6074679",
"0.60692316",
"0.6068842",
"0.6063732",
"0.6056667",
... | 0.70212173 | 1 |
generator function that returns list of reference lengths from the | def get_lengths(self):
for row in self._get_references_node():
yield row['name'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lens(steps):\n lens = []\n for i in steps:\n lens.append(len(i))\n return lens",
"def lengths(self):\n return tuple(self.__lengths)",
"def _get_item_lengths(self) -> List[int]:\n return [len(x[0]) for x in self.data]",
"def element_length(lst: Iterable[Sequence]) -> List[Tup... | [
"0.6327171",
"0.61252165",
"0.6085158",
"0.5994797",
"0.5994797",
"0.5994797",
"0.59730774",
"0.59532815",
"0.5935144",
"0.59338284",
"0.59037244",
"0.5899237",
"0.5863944",
"0.5863379",
"0.5856182",
"0.5844667",
"0.57771057",
"0.57224256",
"0.57004964",
"0.56720656",
"0.5656... | 0.75089616 | 0 |
Getter for tc meta schema. | def get_meta_schema(self):
return self._tc_meta_schema | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta(self):\n return self.spec.meta",
"def get_schema(self) -> dict:\n return schemas.get_object_schema(self.schema)",
"def get_schema(self):\r\n return self.__schema",
"def get_schema(self) -> dict:",
"def schema(self):\n return _parse_schema_resource(self._properties.get(\... | [
"0.69690114",
"0.6739869",
"0.67340374",
"0.6680721",
"0.66489255",
"0.6580349",
"0.65452003",
"0.6545178",
"0.6545178",
"0.6545178",
"0.64975053",
"0.6461787",
"0.6419915",
"0.63881665",
"0.63832825",
"0.63135153",
"0.62565047",
"0.6224015",
"0.6222329",
"0.6222093",
"0.6221... | 0.8901751 | 0 |
Constructor for IceteaManager. Appends libraries to sys.path, loads the test case metadata schema, parses arguments and initializes logging. | def __init__(self):
self.libpath = os.sep.join(os.path.abspath(__file__).split(os.sep)[:-1])
sys.path.append(self.libpath)
libpath2 = os.sep.join(self.libpath.split(os.sep)[:-1])
sys.path.append(libpath2)
# Initialize TCMetaSchema with correct libpath
TCMetaSchema(self.li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpClass(cls):\n cls.run_mgr = runner(['start', 'execute'], ['stop'])\n cls.load_mgr = loader(verbose=False, recursive=True)\n cls.load_mgr.set_addon_dirs(['./data'])\n cls.load_mgr.load_addons()\n cls.cli_inst = cls.load_mgr.get_instance('CommandLineAddon')\n cls.fi... | [
"0.6916385",
"0.6743923",
"0.6658298",
"0.64140826",
"0.63295776",
"0.63295776",
"0.6242521",
"0.6164647",
"0.61641407",
"0.61402833",
"0.6099692",
"0.60605896",
"0.60552776",
"0.60384613",
"0.60341585",
"0.60253465",
"0.60099554",
"0.5967937",
"0.5954919",
"0.5906475",
"0.58... | 0.8303635 | 0 |
Static method for listing suites from both local source and cloud. Uses PrettyTable to generate the table. | def list_suites(suitedir="./testcases/suites", cloud=False):
suites = []
suites.extend(TestSuite.get_suite_files(suitedir))
# no suitedir, or no suites -> append cloud.get_campaigns()
if cloud:
names = cloud.get_campaign_names()
if names:
suites.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_suites(arn=None, nextToken=None):\n pass",
"def get(self):\n suites = SuiteProvider.get_list(TestSuiteModel)\n return flask.Response(json.dumps(suites), mimetype=\"application/json\")",
"def suite_list(self):\n return ','.join([s.__unicode__() for s in self.suites.all()])",
"... | [
"0.62100184",
"0.5980191",
"0.58507097",
"0.58507097",
"0.5809198",
"0.5543406",
"0.54552805",
"0.534072",
"0.5334217",
"0.5310798",
"0.5258281",
"0.52315",
"0.5219137",
"0.52157015",
"0.5203376",
"0.51504844",
"0.512616",
"0.51086867",
"0.5108601",
"0.5051747",
"0.5048076",
... | 0.71933085 | 0 |
Initialize PluginManager and load run wide plugins. | def _init_pluginmanager(self):
self.pluginmanager = PluginManager(logger=self.logger)
self.logger.debug("Registering execution wide plugins:")
self.pluginmanager.load_default_run_plugins()
self.pluginmanager.load_custom_run_plugins(self.args.plugin_path)
self.logger.debug("Execut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __initialize_plugin_manager(self, args, plugin_dir):\n\n try:\n self.__plugins.initialize(\n plugin_dir,\n args.add_plugin,\n args.enable_rules,\n args.disable_rules,\n self.__properties,\n self.__show_s... | [
"0.79170924",
"0.75931644",
"0.729723",
"0.7272412",
"0.72698796",
"0.72121173",
"0.71590143",
"0.715079",
"0.7106315",
"0.69954133",
"0.697",
"0.6919732",
"0.6917517",
"0.6812515",
"0.67961377",
"0.6722977",
"0.66759086",
"0.66431123",
"0.6564897",
"0.6519847",
"0.6481942",
... | 0.88306737 | 0 |
Calls cleanup for ResourceProvider of this run. | def _cleanup_resourceprovider(self):
# Disable too broad exception warning
# pylint: disable=W0703
self.resourceprovider = ResourceProvider(self.args)
try:
self.resourceprovider.cleanup()
self.logger.info("Cleanup done.")
except Exception as error:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanupResources():\n None",
"def cleanup(self):\n superClass.cleanup(self)\n # TODO Release resources and cleanup stuff here",
"def cleanup(self):\n raise NotImplementedError",
"def cleanup(self):\n self.log.debug('upm - in upm cleanup()')\n # Add resource setup code ... | [
"0.75460374",
"0.73412",
"0.727642",
"0.7222433",
"0.7220895",
"0.7220895",
"0.7211451",
"0.72024626",
"0.7156655",
"0.71370125",
"0.71370125",
"0.71360236",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
"0.7131643",
... | 0.80058503 | 0 |
Initializes Cloud module if cloud_arg is set. | def _init_cloud(self, cloud_arg):
# Disable too broad exception warning
# pylint: disable=W0703
cloud = None
if cloud_arg:
try:
if hasattr(self.args, "cm"):
cloud_module = self.args.cm if self.args.cm else None
self.logg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_cloud_api(self, args=None):\n pass",
"def cloud_init(name, vm_=None, **kwargs):\n init_interface = cloud_init_interface(name, vm_, **kwargs)\n name = init_interface.pop(\"name\", name)\n return init(name, **init_interface)",
"def __init__(self, name):\n self.cloud = name\n ... | [
"0.7901567",
"0.68110573",
"0.6452714",
"0.62836087",
"0.62689507",
"0.62144053",
"0.60829824",
"0.6068401",
"0.60393214",
"0.60393214",
"0.6028541",
"0.59919477",
"0.59845763",
"0.5937679",
"0.5785316",
"0.5760803",
"0.5742604",
"0.5721453",
"0.56646794",
"0.5658206",
"0.563... | 0.84079945 | 0 |
Static method to add artwork class object to database | def create_artwork(**kwargs):
artwork = Artwork(**kwargs)
db.session.add(artwork)
db.session.commit()
db.session.flush()
return artwork | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _add_artwork(self, artwork):\n\n insert_artwork = 'INSERT INTO artworks (artwork, price, artist_id, for_sale) VALUES (?, ?, ?, ?)'\n\n try:\n with sqlite3.connect(db_path) as conn:\n conn.execute(insert_artwork, (artwork.artwork, artwork.price, artwork.artist_id, artwork... | [
"0.68697816",
"0.6467543",
"0.6421321",
"0.5953198",
"0.5903542",
"0.5839906",
"0.5828783",
"0.5758985",
"0.5725918",
"0.5644144",
"0.5586791",
"0.557611",
"0.55721587",
"0.55625147",
"0.5528646",
"0.5444994",
"0.5441205",
"0.54385227",
"0.53892386",
"0.5373638",
"0.5372003",... | 0.74932575 | 0 |
Return the next version number in the given directory | def _next_version(self, dirpath: str) -> int:
try:
version_re = re.compile(r"version_(\d+)")
def is_valid_version(v: str):
return version_re.search(v) is not None
versions = tuple(filter(is_valid_version, os.listdir(dirpath)))
if not versions:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_version(file_):\n split_file = file_.rsplit(\"_\", 1)\n name_file = split_file[0]\n version = split_file[-1]\n padding = len(version)\n\n if version.isdigit():\n next_version = int(version) + 1\n next_version = str(next_version).zfill(padding)\n\n ... | [
"0.7362134",
"0.67544836",
"0.6651429",
"0.6587598",
"0.65575653",
"0.64702445",
"0.63699096",
"0.6343807",
"0.61351645",
"0.6040817",
"0.60335314",
"0.59779316",
"0.59187",
"0.59139484",
"0.59125704",
"0.58602875",
"0.5830443",
"0.5817614",
"0.57912284",
"0.579084",
"0.57680... | 0.8796773 | 0 |
Should not create account if it already exists. | def test_account_already_exists(mocker, api: API):
mocker.patch.object(Account, "does_exist", return_value=True)
login = mocker.patch.object(Account, "login")
create = mocker.patch.object(Account, "create")
Account(api, "USERNAME", "PASSWORD")
login.assert_called_once()
create.assert_not_calle... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_account(self, new_account):\n if User.check_existing_user(new_account['account_holder']):\n user = User(new_account['account_holder'])\n if new_account['account_type'] in user.accounts.keys():\n self.session.output({\n 'error':\n ... | [
"0.70203793",
"0.70152533",
"0.68670267",
"0.6816306",
"0.6736663",
"0.66980433",
"0.6690282",
"0.66847116",
"0.65876156",
"0.65831935",
"0.6544033",
"0.65225756",
"0.6515138",
"0.64476043",
"0.64474624",
"0.64242995",
"0.6407785",
"0.6404531",
"0.64038074",
"0.6397046",
"0.6... | 0.7064065 | 0 |
Should create account with additional params, if requested. | def test_account_accepts_additional_params(
mocker, api: API, first_name: str, last_name: str, email: str
):
mocker.patch.object(Account, "does_exist", return_value=False)
start_refresh = mocker.patch.object(Account, "start_refresh")
accept_all_terms = mocker.patch.object(Account, "accept_all_terms")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_account(firstname, lastname, pin):\n pass",
"def create_account():\n if not request.json or not 'name' in request.json:\n abort(400)\n account = {\n 'id': accounts[-1]['id'] + 1, #last id + 1\n 'name': request.json['name'],\n 'surname': request.json['surname'],\n ... | [
"0.6918769",
"0.68955445",
"0.67684567",
"0.6755833",
"0.66647434",
"0.6650197",
"0.6647377",
"0.6639451",
"0.6608615",
"0.6548829",
"0.64994985",
"0.6494373",
"0.6490122",
"0.6436235",
"0.64031655",
"0.6382623",
"0.6322784",
"0.6289521",
"0.6278284",
"0.6273041",
"0.6271049"... | 0.7110549 | 0 |
Should raise IndexError when no owner or more than one. | def test_no_owner_exception(api: API, owners: list):
api.candlepin.get_owners.return_value = owners
account = Account(api, "USERNAME", "PASSWORD")
with pytest.raises(IndexError):
account.owner_id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_owner(data=None, **kw):\n if data and 'owner_id' in data and not data['owner_id'] == current_user.id:\n raise ProcessingException(description=\"No write privileges\",\n code=401)",
"def test_list_members_with_owner_rights(self):\n url = '/api/v1/communities/4/retrieve_member... | [
"0.63105494",
"0.606564",
"0.60498",
"0.59998184",
"0.5988194",
"0.5969196",
"0.59655756",
"0.59643877",
"0.5904818",
"0.58963203",
"0.58249295",
"0.58106273",
"0.57679254",
"0.5754556",
"0.5741087",
"0.5721135",
"0.5715831",
"0.5684382",
"0.56795704",
"0.5620101",
"0.5575554... | 0.7116809 | 0 |
If Candlepin raises error, login should fail. | def test_login_fails(api: API, account: Account):
api.candlepin.get_owners.side_effect = EthelError("msg", raw_error=HTTPError())
with pytest.raises(EthelError):
account.login() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login():",
"def login():",
"def _login(self, *args, **kwargs):\n pass",
"def login(self):\n\t\treturn",
"def _login(self):\n if User.login(self.session.teller_id, self.session.teller_pin, 'teller'):\n return True\n else:\n self.session.output({'authentication_... | [
"0.6210571",
"0.6210571",
"0.6135381",
"0.60883635",
"0.6018405",
"0.6016187",
"0.5961082",
"0.5953868",
"0.592778",
"0.59227914",
"0.5897784",
"0.5892974",
"0.5879179",
"0.5876196",
"0.5851482",
"0.5847128",
"0.5846565",
"0.5820883",
"0.5804091",
"0.58017606",
"0.5787187",
... | 0.69702506 | 0 |
Should start refresh job track refresh ID. | def test_start_refresh(api: API, account: Account):
api.candlepin.refresh.return_value = {"id": 123456} # type: ignore
account.start_refresh()
api.candlepin.refresh.assert_called_once() # type: ignore
assert account._latest_refresh_job_id == 123456 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start(self):\n super().start()\n self._refresh_job = Job(self._refresh_auth,\n timedelta(seconds=self.authRefresh()),\n True)",
"def run_if_refresh(self):\n if self.is_finished():\n self.status.collect = True\n ... | [
"0.65931195",
"0.5906171",
"0.5892621",
"0.5852466",
"0.5832281",
"0.56878406",
"0.5598884",
"0.5593814",
"0.5554156",
"0.5528242",
"0.55176336",
"0.54991573",
"0.54853755",
"0.5464578",
"0.5462668",
"0.54386467",
"0.5400727",
"0.5399485",
"0.53618455",
"0.53618455",
"0.53618... | 0.67141795 | 0 |
Should accept each of required terms once only. | def test_accept_all_terms_required(api, account, given_terms):
api.terms.get_required_terms.return_value = given_terms
api.terms.accept_terms.reset_mock()
account.accept_all_terms()
api.terms.get_required_terms.assert_called()
api.terms.get_all_terms.assert_not_called()
call_count = custom_st.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_accept_all_terms_optional(api, account, given_terms):\n api.terms.get_all_terms.return_value = given_terms\n api.terms.accept_terms.reset_mock()\n account.accept_all_terms(optional=True)\n api.terms.get_required_terms.assert_not_called()\n api.terms.get_all_terms.assert_called()\n\n call... | [
"0.7163386",
"0.67120165",
"0.6260222",
"0.6186824",
"0.59535503",
"0.58452845",
"0.577484",
"0.57104135",
"0.5701611",
"0.5598531",
"0.5584051",
"0.5556541",
"0.5518508",
"0.55136126",
"0.5484679",
"0.54795736",
"0.54743195",
"0.5469858",
"0.54253584",
"0.541559",
"0.5400992... | 0.71851677 | 0 |
Should accept each of required+optional terms once only. | def test_accept_all_terms_optional(api, account, given_terms):
api.terms.get_all_terms.return_value = given_terms
api.terms.accept_terms.reset_mock()
account.accept_all_terms(optional=True)
api.terms.get_required_terms.assert_not_called()
api.terms.get_all_terms.assert_called()
call_count = cus... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uses_all(word, required):\n pass",
"def test_accept_all_terms_required(api, account, given_terms):\n api.terms.get_required_terms.return_value = given_terms\n api.terms.accept_terms.reset_mock()\n account.accept_all_terms()\n api.terms.get_required_terms.assert_called()\n api.terms.get_all_... | [
"0.66298985",
"0.65544987",
"0.6114878",
"0.6114662",
"0.59999925",
"0.58936405",
"0.5880098",
"0.578707",
"0.57488513",
"0.5735585",
"0.5732099",
"0.5712844",
"0.5598866",
"0.55417496",
"0.5525796",
"0.5513151",
"0.54588765",
"0.5452917",
"0.54474765",
"0.5434479",
"0.541909... | 0.702387 | 0 |
Should list raw pools without mapping. | def test_list_pools_no_filter(api: API, account: Account, raw_pools):
api.candlepin.get_pools.return_value = raw_pools
pools = account.list_pools(filter_attributes={})
assert pools == raw_pools | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_pools(mocker, api: API, account: Account, raw_pools):\n api.candlepin.get_pools.return_value = raw_pools\n\n apply_mapping_spy = mocker.patch(\n \"ethel.account.apply_mapping\", side_effect=apply_mapping\n )\n pools = account.list_pools()\n assert len(pools) == len(raw_pools)\n\... | [
"0.71475285",
"0.7095972",
"0.7052706",
"0.69988286",
"0.6680574",
"0.6640516",
"0.6589479",
"0.6492618",
"0.64684874",
"0.6387693",
"0.63340986",
"0.62916124",
"0.6253335",
"0.623752",
"0.6233473",
"0.6174894",
"0.61408067",
"0.612454",
"0.612353",
"0.60790056",
"0.6071551",... | 0.7372196 | 0 |
Should list future pools. | def test_list_pools_future(api: API, account: Account):
api.candlepin.get_pools.return_value = []
account.list_pools(future=True)
api.candlepin.get_pools.assert_called_with("USERNAME", "PASSWORD", 1234, future=True) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_list_pools_sort(self):\r\n resources = \"pools\"\r\n cmd = pool.ListPool(test_cli20.MyApp(sys.stdout), None)\r\n self._test_list_resources(resources, cmd,\r\n sort_key=[\"name\", \"id\"],\r\n sort_dir=[\"asc\", \"desc\"... | [
"0.62735105",
"0.6202307",
"0.6197126",
"0.6172035",
"0.6150943",
"0.61271",
"0.5968202",
"0.5918214",
"0.5897142",
"0.5842451",
"0.584176",
"0.5840097",
"0.58156615",
"0.58002305",
"0.57723457",
"0.574982",
"0.57491374",
"0.57418287",
"0.57271004",
"0.5710927",
"0.568167",
... | 0.7058781 | 0 |
Associate this county with a city. | def associate(self, city: 'City', reflexive: bool=True):
self._cities.add(city)
if reflexive:
city.associate(self, reflexive=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def city(self, city):\n self._city = city",
"def city(self, city):\n\n self._city = city",
"def city(self, city):\n\n self._city = city",
"def city(self, city):\n\n self._city = city",
"def city(self, city):\n\n self._city = city",
"def city(self, city):\n\n self... | [
"0.7356001",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.7310456",
"0.68881035",
"0.6754609",
"0.66625",
"0.64843994",
"0.64591527",
"0.641158",
"0.6327681",
"0.6327681",
"0.6320447",
"0.63170475",
"0.6268622",
... | 0.73355705 | 1 |
Associate this city with a county. | def associate(self, county: County, reflexive: bool=True):
self._counties.add(county)
if reflexive:
county.associate(self, reflexive=False) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def county(self, county):\n\n self._county = county",
"def county(self, county):\n\n self._county = county",
"def associate(self, city: 'City', reflexive: bool=True):\n self._cities.add(city)\n if reflexive:\n city.associate(self, reflexive=False)",
"def state_province_... | [
"0.7376206",
"0.7376206",
"0.6630254",
"0.6294958",
"0.61939526",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.6146757",
"0.58579504",
"0.58390576",
"0.572571",
"0.5598036",
"0.5564327",
"0.5527765",
"0.55207676",
... | 0.7800345 | 0 |
Get the counties associated with this city. | def counties(self) -> Iterable[County]:
return self._counties | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counties(self) -> Iterable[County]:\n return self._counties.values()",
"def get(self):\n return get_count_by_city()",
"def cities(self) -> Iterable[City]:\n return self._cities.values()",
"def cities(self):\n return [value for value in models.storage.all(City).values()\n ... | [
"0.78233737",
"0.75848836",
"0.6753652",
"0.6636932",
"0.652709",
"0.6514346",
"0.64962095",
"0.63315505",
"0.6212358",
"0.612705",
"0.6122907",
"0.5836777",
"0.5786796",
"0.57865554",
"0.57863617",
"0.5751704",
"0.5748651",
"0.5736104",
"0.5721545",
"0.5714139",
"0.5702682",... | 0.7835852 | 0 |
Get the postal zones associated with this city. | def postal_zones(self) -> Iterable[PostalZone]:
return self._postal_zones.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_zones(self, context):\n # handling zones method in RPC\n response = self.dns_manager.get_zones(context)\n return response",
"def zones(self) -> pulumi.Output[Sequence[str]]:\n return pulumi.get(self, \"zones\")",
"def zones(self) -> Optional[Sequence[str]]:\n return p... | [
"0.6441345",
"0.64288",
"0.6416129",
"0.6416129",
"0.6360754",
"0.6360754",
"0.6105552",
"0.610496",
"0.610496",
"0.610496",
"0.610496",
"0.610496",
"0.6046963",
"0.59901834",
"0.5988816",
"0.5942241",
"0.5901352",
"0.58104646",
"0.58095443",
"0.5808686",
"0.5769542",
"0.57... | 0.7792925 | 0 |
Get the counties that reside within the state | def counties(self) -> Iterable[County]:
return self._counties.values() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def counties(self) -> Iterable[County]:\n return self._counties",
"def StateCounts(self):\r\n\t\treturn self._get_attribute('stateCounts')",
"def get_covid_stats_by_county(state, county):\n url = \"https://corona.lmao.ninja/v2/jhucsse/counties/\" + county\n response = requests.get(url)\n data =... | [
"0.7355823",
"0.65588045",
"0.632723",
"0.6231282",
"0.6230792",
"0.60618126",
"0.6001436",
"0.59895617",
"0.59857917",
"0.5957615",
"0.59291244",
"0.5919867",
"0.58977693",
"0.58530164",
"0.5852207",
"0.5819538",
"0.5800776",
"0.57880116",
"0.5747398",
"0.5744366",
"0.572249... | 0.7303282 | 1 |
Get a county that resides within the state. | def get_county(self, name: str):
key = name.lower()
try:
return self._counties[key]
except KeyError:
county = County(name=name, state=self)
self._counties[key] = county
return county | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def county(self):\n return self._county",
"def get_county_by_name(self, name):\n raise NotImplementedError()",
"def get_covid_stats_by_county(state, county):\n url = \"https://corona.lmao.ninja/v2/jhucsse/counties/\" + county\n response = requests.get(url)\n data = response.json()\n c... | [
"0.80100894",
"0.69557256",
"0.6891885",
"0.68831116",
"0.6766973",
"0.65933836",
"0.64954776",
"0.59639496",
"0.5942816",
"0.5891095",
"0.5881354",
"0.5881354",
"0.5878335",
"0.5871981",
"0.5871981",
"0.5868354",
"0.5854194",
"0.5853973",
"0.5846684",
"0.5815332",
"0.5780161... | 0.75275326 | 1 |
Change the access permissions to readonly for a given file. | def make_readonly(path):
mode = Path.stat(path).st_mode
Path.chmod(path, mode & ~stat.S_IWRITE) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chmod_file ( self, fspath ):\n return",
"def make_writeable(filename):\n if sys.platform.startswith('java'):\n # On Jython there is no os.access()\n return\n if not os.access(filename, os.W_OK):\n stt = os.stat(filename)\n new_permissions = stat.... | [
"0.71928865",
"0.71418756",
"0.7058342",
"0.70293564",
"0.68981755",
"0.68864965",
"0.669291",
"0.667103",
"0.6577456",
"0.6507548",
"0.64928424",
"0.6456014",
"0.6423444",
"0.6388851",
"0.6377315",
"0.63274896",
"0.6301069",
"0.62465864",
"0.6223138",
"0.6217395",
"0.6188794... | 0.7783506 | 0 |
Verify `utils.force_delete` makes files writable. | def test_force_delete(mocker, tmp_path):
ro_file = Path(tmp_path, 'bar')
ro_file.write_text("Test data")
make_readonly(ro_file)
rmtree = mocker.Mock()
utils.force_delete(rmtree, ro_file, sys.exc_info())
assert (ro_file.stat().st_mode & stat.S_IWRITE) == stat.S_IWRITE
rmtree.assert_called_o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ignore_readonly1(tmpdir):\n os.makedirs('%s/foo/bar/baz' % tmpdir)\n os.chmod('%s/foo/bar/baz' % tmpdir, 0o500)\n os.chmod('%s/foo/bar' % tmpdir, 0o500)\n os.chmod('%s/foo' % tmpdir, 0o500)\n\n with pytest.raises(PermissionError):\n sh.remove('%s/foo' % tmpdir, recursive=True)\n a... | [
"0.69417924",
"0.68111134",
"0.66763765",
"0.6518661",
"0.6469494",
"0.6463073",
"0.6406153",
"0.63960063",
"0.63952553",
"0.63904804",
"0.6281313",
"0.61868197",
"0.608475",
"0.6079544",
"0.6027423",
"0.6024343",
"0.60208935",
"0.6019758",
"0.5984224",
"0.59832275",
"0.59816... | 0.7333006 | 0 |
Verify correct True/False response from `utils.make_sure_path_exists`. Should return True if directory exist or created. Should return False if impossible to create directory (for example protected) | def test_make_sure_path_exists(tmp_path):
existing_directory = tmp_path
directory_to_create = Path(tmp_path, "not_yet_created")
utils.make_sure_path_exists(existing_directory)
utils.make_sure_path_exists(directory_to_create)
# Ensure by base system methods.
assert existing_directory.is_dir()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_dir(path, create = True):\n if os.path.exists(path):\n if os.path.isdir(path):\n return path\n else:\n return False\n if create:\n msg = \"Creating directory: '%s'\" % (path)\n print msg\n log.info(msg)\n os.mkdir(path)\n else:\n ... | [
"0.80475706",
"0.7686256",
"0.7646443",
"0.75789744",
"0.7570979",
"0.755175",
"0.7521964",
"0.7485349",
"0.7408341",
"0.73762876",
"0.7372147",
"0.73697877",
"0.73534125",
"0.73439956",
"0.73396397",
"0.732231",
"0.73179424",
"0.7310531",
"0.7292146",
"0.72753286",
"0.725722... | 0.81010544 | 0 |
Verify returning to original folder after `utils.work_in` use. | def test_work_in(tmp_path):
cwd = Path.cwd()
ch_to = tmp_path
assert ch_to != Path.cwd()
# Under context manager we should work in tmp_path.
with utils.work_in(ch_to):
assert ch_to == Path.cwd()
# Make sure we return to the correct folder
assert cwd == Path.cwd() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_work_in_without_path():\n cwd = Path.cwd()\n\n with utils.work_in():\n assert cwd == Path.cwd()\n\n assert cwd == Path.cwd()",
"def test_temporary_cd():\n initial_dir = os.getcwd()\n temporary_dir = \"/\"\n from openforcefield.utils import temporary_cd\n\n with temporary_cd(t... | [
"0.64513046",
"0.58524257",
"0.5820175",
"0.5809573",
"0.57625777",
"0.56772494",
"0.5621491",
"0.5594412",
"0.5552343",
"0.55372983",
"0.5532026",
"0.55189157",
"0.5517291",
"0.55161804",
"0.55148786",
"0.5504237",
"0.54870147",
"0.5459506",
"0.5459012",
"0.54509085",
"0.543... | 0.69581556 | 0 |
In `prompt_and_delete()`, if the user agrees to delete/reclone a \ repo file, the repo should be deleted. | def test_prompt_should_ask_and_rm_repo_file(mocker, tmp_path):
mock_read_user = mocker.patch(
'cookiecutter.utils.read_user_yes_no', return_value=True, autospec=True
)
repo_file = tmp_path.joinpath('repo.zip')
repo_file.write_text('this is zipfile content')
deleted = utils.prompt_and_delet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prompt_should_not_ask_if_no_input_and_rm_repo_file(mocker, tmp_path):\n mock_read_user = mocker.patch(\n 'cookiecutter.prompt.read_user_yes_no', return_value=True, autospec=True\n )\n\n repo_file = tmp_path.joinpath('repo.zip')\n repo_file.write_text('this is zipfile content')\n\n de... | [
"0.694952",
"0.68427336",
"0.68397397",
"0.67588186",
"0.6601343",
"0.65313125",
"0.6505471",
"0.6442524",
"0.63682276",
"0.6318846",
"0.6174742",
"0.61241597",
"0.6046509",
"0.5786137",
"0.5773777",
"0.5765855",
"0.57388747",
"0.569473",
"0.5690514",
"0.56715375",
"0.5656314... | 0.6865955 | 1 |
In `prompt_and_delete()`, if the user wants to keep their old \ cloned template repo, it should not be deleted. | def test_prompt_should_ask_and_keep_repo_on_reuse(mocker, tmp_path):
def answer(question, default):
return 'okay to delete' not in question
mock_read_user = mocker.patch(
'cookiecutter.utils.read_user_yes_no', side_effect=answer, autospec=True
)
repo_dir = Path(tmp_path, 'repo')
re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def djangular_boilerplate():\n git = Repo()\n path = git.absolute_path\n package_name = git.package_name\n clone = git.command\n if not os.path.exists(path):\n os.system(clone)\n rename = prompt(prompt_rename)\n if rename.get(\"rename\", True):\n os.rename(package_nam... | [
"0.639966",
"0.6099238",
"0.6026244",
"0.6004743",
"0.5814314",
"0.5689378",
"0.5615668",
"0.56066704",
"0.5602181",
"0.5559056",
"0.55503213",
"0.5548409",
"0.5543791",
"0.55424356",
"0.5476513",
"0.546356",
"0.5437474",
"0.5433534",
"0.5422055",
"0.53577954",
"0.53326064",
... | 0.62408835 | 1 |
Prompt should not ask if no input and rm dir. In `prompt_and_delete()`, if `no_input` is True, the call to `prompt.read_user_yes_no()` should be suppressed. | def test_prompt_should_not_ask_if_no_input_and_rm_repo_dir(mocker, tmp_path):
mock_read_user = mocker.patch(
'cookiecutter.prompt.read_user_yes_no', return_value=True, autospec=True
)
repo_dir = Path(tmp_path, 'repo')
repo_dir.mkdir()
deleted = utils.prompt_and_delete(str(repo_dir), no_inpu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prompt_should_ask_and_exit_on_user_no_answer(mocker, tmp_path):\n mock_read_user = mocker.patch(\n 'cookiecutter.utils.read_user_yes_no',\n return_value=False,\n )\n mock_sys_exit = mocker.patch('sys.exit', return_value=True)\n repo_dir = Path(tmp_path, 'repo')\n repo_dir.mkdi... | [
"0.68453914",
"0.67989403",
"0.64025265",
"0.6377288",
"0.62900436",
"0.61881745",
"0.61112154",
"0.59390336",
"0.5856855",
"0.57477343",
"0.56844205",
"0.5572902",
"0.5571175",
"0.55530804",
"0.5487513",
"0.5460057",
"0.5443315",
"0.54240924",
"0.53707623",
"0.5367811",
"0.5... | 0.7111035 | 0 |
Prompt should not ask if no input and rm file. In `prompt_and_delete()`, if `no_input` is True, the call to `prompt.read_user_yes_no()` should be suppressed. | def test_prompt_should_not_ask_if_no_input_and_rm_repo_file(mocker, tmp_path):
mock_read_user = mocker.patch(
'cookiecutter.prompt.read_user_yes_no', return_value=True, autospec=True
)
repo_file = tmp_path.joinpath('repo.zip')
repo_file.write_text('this is zipfile content')
deleted = utils... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_prompt_should_not_ask_if_no_input_and_rm_repo_dir(mocker, tmp_path):\n mock_read_user = mocker.patch(\n 'cookiecutter.prompt.read_user_yes_no', return_value=True, autospec=True\n )\n repo_dir = Path(tmp_path, 'repo')\n repo_dir.mkdir()\n\n deleted = utils.prompt_and_delete(str(repo_d... | [
"0.6796446",
"0.67625904",
"0.6365568",
"0.62759453",
"0.6191798",
"0.61189556",
"0.61132824",
"0.6007913",
"0.59007823",
"0.5876507",
"0.5871822",
"0.5777255",
"0.5742828",
"0.56524336",
"0.56169075",
"0.55681574",
"0.5542593",
"0.553175",
"0.54672074",
"0.5465253",
"0.53809... | 0.7059413 | 0 |
Yield items from iterable until a time duration has passed. itime yields items from seq until more time than 'seconds' has passed. It always yields at least one item. This does nothing to stop a longrunning sequence operation; it is possible that itime will take considerably longer than 'seconds' to yield, but it will ... | def itime(iterable, seconds):
items = iter(iterable)
end = time.time() + seconds
yield items.next()
for item in itertools.takewhile(lambda _: time.time() < end, items):
yield item | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sleep(seconds: typing.Union[float, int]):\n if seconds == 0:\n yield\n elif seconds == inf:\n yield from sleepinf()\n else:\n end = monotonic() + seconds\n while end >= monotonic():\n yield",
"def delay(iterator, wait = 1, every = 1):\n for i, photo in enume... | [
"0.6236014",
"0.5961773",
"0.58764493",
"0.58764493",
"0.5751974",
"0.5680032",
"0.56157696",
"0.55930865",
"0.5568368",
"0.5401637",
"0.53974783",
"0.5389004",
"0.5352733",
"0.5337134",
"0.5284676",
"0.5275748",
"0.52442247",
"0.52269316",
"0.522643",
"0.5218658",
"0.5174768... | 0.7524734 | 0 |
Find the number of live neighbors for this cell. | def numOfLiveNeighbors(self):
return len(list(filter(lambda x: x.isAlive(), self._neighbors))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_neighbors(self):\n return self._num_neighbors",
"def get_neighbours_count(self, cell: Position) -> int:\n possible_neighbours = self.get_neighbours(cell)\n return sum(self.is_alive(n) for n in possible_neighbours)",
"def living_neighbors(self):\n neighborCount = 0\n f... | [
"0.8265127",
"0.8051308",
"0.8004217",
"0.7960826",
"0.7694137",
"0.736672",
"0.73642683",
"0.72225994",
"0.7217427",
"0.7076998",
"0.70569396",
"0.70388526",
"0.6959553",
"0.69571733",
"0.69042295",
"0.6901215",
"0.69001985",
"0.6855048",
"0.6787732",
"0.6785865",
"0.6782211... | 0.8158193 | 1 |
Set cell state to dead | def setToDead(self, state=DeadState()):
if len(self._lastStates) > 5:
self._lastStates.pop(0)
self._lastStates.append(self._state)
self._state = state
self._nextState = self._state
return self._state | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dead(self):\n assert self.health < 0, \"Health is not less than 0, Sprite should not be dead\"\n self.is_alive = False",
"def just_died(self):\r\n self.dead = True",
"def die(self, cell: Position):\n self._next_state.remove(cell)",
"def set_dead(self):\n self.is_ali... | [
"0.6897334",
"0.6861752",
"0.6514097",
"0.6496854",
"0.6337879",
"0.6269604",
"0.6216332",
"0.61360943",
"0.60890585",
"0.60878557",
"0.6080306",
"0.6064793",
"0.59831196",
"0.5910582",
"0.5885774",
"0.5854238",
"0.58506596",
"0.5834023",
"0.583125",
"0.5830786",
"0.5807192",... | 0.70010316 | 0 |
Assigns permission with given ``perm`` for an instance ``obj`` and ``user``. | def assign_perm(self, permission, user, obj, ctype=None):
if getattr(obj, 'pk', None) is None:
raise ObjectNotPersisted("Object %s needs to be persisted first" % obj)
if not ctype:
ctype = ContentType.objects.get_for_model(obj)
if not isinstance(permission, Permission):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_permission(\n permission: Permission,\n user_or_group: UserOrGroup,\n obj: models.Model,\n):\n # First perform basic checks on the object itself.\n if not model_has_permissions(obj):\n raise RuntimeError(\n f\"There is no support for permissions on object of type {obj._meta... | [
"0.75383586",
"0.6701406",
"0.6687769",
"0.65345526",
"0.6382633",
"0.621472",
"0.6110097",
"0.6092084",
"0.60551816",
"0.6015213",
"0.6015213",
"0.59731776",
"0.59218913",
"0.59045607",
"0.58804095",
"0.58804095",
"0.58804095",
"0.58488923",
"0.5822346",
"0.5822346",
"0.5820... | 0.79544955 | 0 |
Removes permission ``perm`` for an instance ``obj`` and given ``user``. | def remove_perm(self, perm, user, obj, ctype=None):
if getattr(obj, 'pk', None) is None:
raise ObjectNotPersisted("Object %s needs to be persisted first" % obj)
if not ctype:
ctype = ContentType.objects.get_for_model(obj)
(self.filter(permission__codename=perm,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_permission(cls, perm, user):\n current_permissions = cls.get_permissions(user)\n\n # Verify the user has the given permission\n if perm in current_permissions:\n current_permissions.remove(perm)\n user_perm = cls.objects.get(user_id=user.id)\n\n user... | [
"0.76851505",
"0.7159722",
"0.6510904",
"0.6510904",
"0.61931705",
"0.6033631",
"0.5993142",
"0.59780055",
"0.5943753",
"0.58860075",
"0.58829206",
"0.58670884",
"0.58662367",
"0.57801986",
"0.57542473",
"0.56976366",
"0.56969833",
"0.56798595",
"0.5665141",
"0.5627436",
"0.5... | 0.8272633 | 0 |
Returns an ArgList object containing the function argument information based on the contents of the code variable. If multiple definitions for the same function are found then a list is returned. | def get_f_args(f_name, code):
# get the function definition regex
r='^[ ]*def[ ]+{}[ ]*\((?P<args>.*)\)[ ]*:[ ]*$'.format(f_name)
r="[ ]*def[ ]+{}\((?P<args>.*)\)".format(f_name)
# for line in code
a=[]
for l in code.split("\n"):
res=re.match(r, l)
if res:
test=res.gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments_from_funccode(f):\n fc = fc_or_c(f)\n vnames = fc.co_varnames\n nargs = fc.co_argcount\n # bound method and fake function will be None\n args = vnames[1 if is_bound(f) else 0:nargs]\n if not args:\n raise RuntimeError('Function has variable number of arguments')\n return l... | [
"0.6865862",
"0.62554985",
"0.622395",
"0.5984375",
"0.59802085",
"0.5919584",
"0.5885798",
"0.5815911",
"0.5783337",
"0.5696963",
"0.56705165",
"0.5664965",
"0.56613296",
"0.5607406",
"0.55730593",
"0.5569447",
"0.55466944",
"0.5539961",
"0.55397856",
"0.5516713",
"0.5465533... | 0.75078946 | 0 |
Returns x >> y where x and y are all scalars. | def _right_shift_scalar(x, y):
return inner.bit_right_shift(x, y) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply(x, y):\n if y == 1: return x\n t = multiply(x, y >> 1)\n t *= 2\n if y & 1:\n t += x\n return t",
"def right_shift(lhs, rhs):\n return _make.right_shift(lhs, rhs)",
"def power(x, y):\n\n res = 1\n while y:\n if y & 1:\n res *= x\n x *= x\n y >>= 1\n return... | [
"0.612743",
"0.5691592",
"0.5574025",
"0.5440613",
"0.54001635",
"0.53166384",
"0.52958804",
"0.5287596",
"0.5210474",
"0.5156023",
"0.514828",
"0.5141821",
"0.51273966",
"0.51170754",
"0.50783896",
"0.5072159",
"0.5069235",
"0.5041981",
"0.5032491",
"0.501125",
"0.5008718",
... | 0.7138952 | 0 |
parse raw cnvcaller output format the first 8 columns are [chr, start, end, number, gap, repeat, gc, kmer] the last two columns are [average, sd] the inbetween columns are each individual when chromorder was state, chromsome will be sorted as the given order, contings that not states will be remove, you can use this op... | def loadcnvrfile(cnvfile, chromorder=None):
df = pd.read_csv(cnvfile, sep='\t', low_memory=False)
df['chr'] = df['chr'].astype('str') # chr is always str type
df['chr'] = df['chr'].astype('category', categories=chromorder, ordered=True)
if chromorder:
df.dropna(inplace=True) # contig that not ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample_vcf():\n file_content = b\"\"\"##fileformat=VCFv4.2\n##hailversion=0.2.100-2ea2615a797a\n##INFO=<ID=QUALapprox,Number=1,Type=Integer,Description=\"\">\n##INFO=<ID=SB,Number=.,Type=Integer,Description=\"\">\n##INFO=<ID=MQ,Number=1,Type=Float,Description=\"\">\n##INFO=<ID=MQRankSum,Number=1,Type=Float,... | [
"0.5382465",
"0.5308484",
"0.5243552",
"0.52306145",
"0.52016634",
"0.51058584",
"0.5078236",
"0.50461173",
"0.5033456",
"0.5000725",
"0.49950325",
"0.49894613",
"0.4974927",
"0.49519098",
"0.49268863",
"0.4911633",
"0.49039003",
"0.48950693",
"0.4889307",
"0.48874688",
"0.48... | 0.5399774 | 0 |
load two columns file, save to a dict, with the first as keys the second as values | def loadtwocol(infile):
kvdict = {}
with open(infile) as f:
for nline, line in enumerate(f):
line = line.strip()
if line: # to exclude blank line
k, v = line.split('\t')
kvdict[k] = v
return kvdict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadtwocol_dlist(infile):\n kvdict = defaultdict(list)\n with open(infile) as f:\n for line in f:\n line = line.strip()\n if line:\n k, v = line.split('\\t')\n kvdict[v].append(k)\n return kvdict",
"def file_to_dictionary():\n\n return;",... | [
"0.65423113",
"0.6032707",
"0.5977352",
"0.59716904",
"0.59300816",
"0.5906491",
"0.5882232",
"0.5866085",
"0.5859653",
"0.58306384",
"0.5785957",
"0.578572",
"0.57724285",
"0.57607687",
"0.57563573",
"0.57307786",
"0.5706445",
"0.56938887",
"0.56860656",
"0.5656907",
"0.5655... | 0.7436687 | 0 |
load two columns file, save to a dict, value is list, the second col as k | def loadtwocol_dlist(infile):
kvdict = defaultdict(list)
with open(infile) as f:
for line in f:
line = line.strip()
if line:
k, v = line.split('\t')
kvdict[v].append(k)
return kvdict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loadtwocol(infile):\n kvdict = {}\n with open(infile) as f:\n for nline, line in enumerate(f):\n line = line.strip()\n if line: # to exclude blank line\n k, v = line.split('\\t')\n kvdict[k] = v\n return kvdict",
"def parse_file(file_path): ... | [
"0.7282295",
"0.6156816",
"0.5976536",
"0.59418267",
"0.5919744",
"0.5845628",
"0.583229",
"0.5832102",
"0.5810871",
"0.5802002",
"0.5788738",
"0.5776821",
"0.5772704",
"0.5745477",
"0.57306486",
"0.5685378",
"0.5656776",
"0.56404775",
"0.56403047",
"0.5614664",
"0.5602422",
... | 0.715199 | 1 |
load one columns file, save as a list | def loadonecol(infile):
slist = []
with open(infile) as f:
for line in f:
line = line.strip()
if line: # exclude blank line
slist.append(line)
return slist | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _load_column(filename, col=0):\n with open(filename) as f:\n col = list(zip(*csv.reader(f)))[0]\n return list(col)",
"def load_file(filename):\n f_data = []\n # open the data-set file\n file = open(filename, \"r\")\n for line in file:\n row = line.strip() # a row in the f... | [
"0.6632828",
"0.65333563",
"0.65035623",
"0.65035623",
"0.64961207",
"0.64952815",
"0.6464738",
"0.64624816",
"0.6452922",
"0.6446752",
"0.6360612",
"0.6353894",
"0.6321732",
"0.62752753",
"0.62601805",
"0.62579876",
"0.62463415",
"0.6195157",
"0.6182716",
"0.61602473",
"0.61... | 0.695356 | 0 |
Get the Wall object with the given ID number or the name. | def find(id: Union[int, str]) -> 'Wall':
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getById(posts=None, extended=None, copy_history_depth=None, fields=None):\n params = {\n 'posts': posts,\n 'extended': extended,\n 'copy_history_depth': copy_history_depth,\n 'fields': fields\n }\n result = call('wall.getById', **params)\n return parse_response(result)",... | [
"0.60889184",
"0.59258574",
"0.58933896",
"0.586963",
"0.57609195",
"0.55420715",
"0.5519851",
"0.55070466",
"0.55014825",
"0.54716706",
"0.54705423",
"0.5459441",
"0.5457514",
"0.5394239",
"0.5380505",
"0.537021",
"0.5348216",
"0.5326977",
"0.5295789",
"0.5279634",
"0.524661... | 0.7055651 | 0 |
Get a wall iterator object. | def list() -> Iterator['Wall']:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self) -> object:\n return LinkedListIterator(self)",
"def getIter(object):\n iterator = None\n try:\n iterator = iter(object)\n except TypeError:\n pass\n return iterator",
"def __next__(self):\n return next(self.iterator)",
"def __iter__(self) -> object:\... | [
"0.60317326",
"0.56871676",
"0.56780714",
"0.5581569",
"0.55719656",
"0.556267",
"0.5545944",
"0.55420893",
"0.55420893",
"0.5537623",
"0.5521231",
"0.5521231",
"0.5521231",
"0.5510939",
"0.5422368",
"0.5414866",
"0.5411225",
"0.54066217",
"0.5403787",
"0.53720677",
"0.533234... | 0.671326 | 0 |
Get the maximum wall ID. | def maxid() -> int:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_max_id(self):\r\n max_id = None\r\n for pid in self.players:\r\n if max_id is None or pid > max_id:\r\n max_id = pid\r\n return max_id",
"def get_highest_id(self):\n\n return self.mint.get_highest_id()",
"def _get_maximum(self):\n return self... | [
"0.7164636",
"0.6828692",
"0.67430043",
"0.66698456",
"0.66671455",
"0.6562066",
"0.65358853",
"0.6535704",
"0.6504386",
"0.64872897",
"0.6439271",
"0.64292103",
"0.64139616",
"0.6412086",
"0.6409485",
"0.63780534",
"0.63672423",
"0.6291585",
"0.62881184",
"0.61937326",
"0.61... | 0.71456635 | 1 |
(all=False, type=None) > int. Get number of contacts associated with this Wall. If the optional keyword argument type is given, the count is limited to the contact types specified. | def contact_count(self, *args, **kwargs) -> Any:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_subscribers(self):\n return self.request(\"count:Contact\", [ None ])",
"def voterContactCount(self, user):\n return self.votercontact_set.filter(user=user).count()",
"def contacts_in_route_count(self):\n subprods = SubscriptionProduct.objects.filter(route=self).distinct('subscri... | [
"0.62220955",
"0.57704043",
"0.5468199",
"0.5356011",
"0.53532106",
"0.5276652",
"0.52483857",
"0.5243637",
"0.521632",
"0.51745236",
"0.5168773",
"0.5160311",
"0.5098209",
"0.50924736",
"0.5083204",
"0.5061191",
"0.50260466",
"0.5013287",
"0.49991915",
"0.4966406",
"0.493404... | 0.70425886 | 0 |
() > float. Get the xcomponent of the wall center of rotation. | def rotation_center_x(self, *args, **kwargs) -> Any:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centerx(self):\n return self.left + self.width / 2",
"def x(self) -> int:\n return self.data.x_centre >> 4",
"def center(self):\n return self.pos + self.axis / 2.0",
"def get_x(self):\n\t\treturn self._collision_rect.x + 14",
"def center(self):\n return np.array([0,0,1/self.... | [
"0.7661011",
"0.7114015",
"0.705013",
"0.6861359",
"0.6826616",
"0.6806205",
"0.67809916",
"0.6775746",
"0.6773953",
"0.6752642",
"0.67312646",
"0.6724482",
"0.66996574",
"0.6651359",
"0.66412747",
"0.6631699",
"0.65878785",
"0.65850586",
"0.6578949",
"0.6578949",
"0.6576708"... | 0.7234068 | 1 |
() > float. Get the ycomponent of the wall center of rotation. | def rotation_center_y(self, *args, **kwargs) -> Any:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y(self) -> int:\n return self.data.y_centre >> 4",
"def center(self):\n return self.pos + self.axis / 2.0",
"def get_y(self):\n\t\treturn self._collision_rect.y + 25",
"def center(self):\n return (self.upper_right + self.lower_left) * 0.5",
"def get_ly(self):\r\n return self... | [
"0.7139358",
"0.6812508",
"0.67421776",
"0.66988766",
"0.66586465",
"0.65992194",
"0.6565008",
"0.65630996",
"0.6554871",
"0.65501976",
"0.6548346",
"0.6530891",
"0.6529784",
"0.6529784",
"0.64847934",
"0.6480366",
"0.64669913",
"0.6447535",
"0.6439091",
"0.6434639",
"0.64346... | 0.7037135 | 1 |
() > float. Get the wall servo gain relaxation factor. | def servo_gainfactor(self, *args, **kwargs) -> Any:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_power(self) -> float:\n\n #:READ[n][:CHANnel[m]][:SCALar]: POWer[:DC]?\n return float(self._inst.query(\":READ:POW?\"))",
"def airfoilEffW(self):\n return float(Importer(Component='Evaluations',\n VariableName='Wing airfoil efficiency factor',\n ... | [
"0.64952695",
"0.6259763",
"0.6251172",
"0.62235373",
"0.61812836",
"0.61571604",
"0.61465895",
"0.61406857",
"0.6087643",
"0.6075686",
"0.60585713",
"0.60520655",
"0.6050756",
"0.6045536",
"0.6037657",
"0.6019244",
"0.60169923",
"0.60165817",
"0.5993766",
"0.5989632",
"0.597... | 0.62894994 | 1 |
Split a string on null characters. | def zsplit(s: str) -> List[str]:
s = s.strip("\0")
if s:
return s.split("\0")
else:
return [] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_split_string_empty_string(self):\n self.assertFalse(split_string(\"\"))",
"def try_split(text, chars=(u'—', '-')):\n for c in chars:\n segments = text.split(c)\n if len(segments) > 1:\n return [s.strip() for s in segments]",
"def split_or_none(fld):\n if fld i... | [
"0.6682414",
"0.6545063",
"0.63807505",
"0.6359497",
"0.62307394",
"0.6226817",
"0.6053231",
"0.601666",
"0.60003495",
"0.59911466",
"0.594573",
"0.59279126",
"0.59255487",
"0.58801824",
"0.587283",
"0.5721435",
"0.56918263",
"0.56338483",
"0.5610692",
"0.56016564",
"0.557036... | 0.6647786 | 1 |
inserts a the beginning a checksum | def addChecksum(s):
if len(s) < 1:
raise ValueError, "The provided string needs to be atleast 1 byte long"
return (_calcChecksum(s) + s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepend_zeros(data: bytes, length: int):\n print(\"prepend \" + str(length))\n return length * b\"0\" + data",
"def adjust_checksum(self) -> None:\n self._csum = 0\n # TODO improve that (it's not really efficient)\n self._csum = socket.htons(ip_checksum(self.encode()[:20]))",
"de... | [
"0.61127853",
"0.6060215",
"0.5978933",
"0.59151894",
"0.5813891",
"0.5802595",
"0.57736826",
"0.57538444",
"0.57378954",
"0.56799406",
"0.5644961",
"0.5545719",
"0.5506814",
"0.5485345",
"0.54680055",
"0.5452924",
"0.5444897",
"0.54236454",
"0.5419797",
"0.54073125",
"0.5393... | 0.62705135 | 0 |
Saves the game's next player and state of specified squares to file using randomaccess. | def update(self, game, squares):
try:
with open(self.filename, mode='r+') as file:
# Update the next player
file.seek(0)
file.write(game.next_player)
# Update for each square
for square in squares:
co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, game):\n try:\n with open(self.filename, mode='w+') as file:\n # First char in the file is the next player\n file.write(game.next_player)\n # Then the board as a string of 64 characters\n file.write(str(game.board))\n\n ... | [
"0.7299363",
"0.61066735",
"0.61021924",
"0.6040499",
"0.6038504",
"0.5995273",
"0.59265184",
"0.5878293",
"0.5820163",
"0.5763086",
"0.5760167",
"0.57505494",
"0.56682235",
"0.5662813",
"0.56511456",
"0.5601729",
"0.5592377",
"0.55736125",
"0.5571078",
"0.55666244",
"0.55540... | 0.7294467 | 1 |
Return True if it is not worth expanding the parent/comb_class if this rule is found. | def ignore_parent(self) -> bool:
return self._strategy.ignore_parent | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_parent(self):\n return False",
"def is_parent(self):\n return not self.children",
"def has_parent(self):\n return self.parent != None",
"def orphaned(self):\n return (self.parent is None)",
"def is_parent(self):\n if self.parent is not None:\n return False\... | [
"0.6450891",
"0.6346001",
"0.6291494",
"0.6104243",
"0.6081182",
"0.600316",
"0.59742105",
"0.587621",
"0.5849688",
"0.580424",
"0.5796392",
"0.5765549",
"0.57427096",
"0.57366127",
"0.5722057",
"0.5721774",
"0.5692602",
"0.56668365",
"0.56636834",
"0.56597716",
"0.56480587",... | 0.63915926 | 1 |
In general a rule comes in the context of a set of rules, e.g. in a CombinatorialSpecification. In order to count, generate, etc using the rule we must set the subfunctions that the children refer to. | def set_subrecs(
self,
get_subrule: Callable[
[CombinatorialClassType],
"AbstractRule[CombinatorialClassType, CombinatorialObjectType]",
],
) -> None:
self.subrecs = tuple(
get_subrule(child).count_objects_of_size for child in self.children
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, left_rule, right_rule):\n Rule.__init__(self)\n self.__subrules = [left_rule, right_rule]",
"def passivize(rule):\n rule[\"mother\"][\"subcat\"] = {\n \"obj\": None,\n \"preps\": {\n \"by\": [[\"*Subj\"]]}}\n\n rule[\"mother\"][\"hooks\"] = {\n ... | [
"0.62682927",
"0.61411846",
"0.5717428",
"0.5687272",
"0.5605524",
"0.54482126",
"0.53681564",
"0.5282314",
"0.52760327",
"0.5263033",
"0.52585113",
"0.52585113",
"0.52585113",
"0.52585113",
"0.52585113",
"0.52206826",
"0.52142066",
"0.52066123",
"0.51921666",
"0.51611924",
"... | 0.65440214 | 0 |
Return the tuple of CombinatorialClass that are found by applying the decomposition function of the strategy to the parent. | def children(self) -> Tuple[CombinatorialClassType, ...]:
if self._children is None:
self._children = self._strategy.decomposition_function(self.comb_class)
if self._children is None:
raise StrategyDoesNotApply("{} does not apply".format(self._strategy))
return se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def C ( self ) :\n lst = [ i for i in self.__nums_components ]\n if not lst : return () ## extended fit? no other components?\n elif 1 == len(lst) : return lst[0] ## single component?\n return tuple ( lst )",
"def C ( self ) :\n lst = [ i for i in self.__nums_comp... | [
"0.5593074",
"0.5593074",
"0.53523445",
"0.5344555",
"0.5318304",
"0.53086734",
"0.51776594",
"0.51702356",
"0.5166356",
"0.51628405",
"0.5134139",
"0.507927",
"0.5053816",
"0.50447744",
"0.50073385",
"0.50073385",
"0.49760872",
"0.49449152",
"0.4922327",
"0.49005347",
"0.489... | 0.7192809 | 0 |
Returns True if the rule is an equivalence. | def is_equivalence(self) -> bool: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, o: object) -> bool:\n if not isinstance(o, Rule):\n return NotImplemented\n return self._antecedent == o._antecedent",
"def is_equals(self):\n return self.prop.is_equals()",
"def __eq__(self, other):\n if type(other) == type(self):\n if other.t... | [
"0.7113403",
"0.685854",
"0.6491469",
"0.6361603",
"0.62336963",
"0.6118478",
"0.60504156",
"0.60381025",
"0.6034907",
"0.6014055",
"0.5998129",
"0.59963405",
"0.5972052",
"0.5961518",
"0.5958827",
"0.59518135",
"0.5951043",
"0.5929016",
"0.59237415",
"0.59180236",
"0.5910075... | 0.7032349 | 1 |
The function count the objects with respect to the parameters. The result is cached. | def count_objects_of_size(self, n: int, **parameters: int) -> int: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_count(self, args):\n args = shlex.split(args)\n if len(args) < 1:\n return\n _nb_objects = 0\n items = storage.all()\n for key in items:\n if items[key].__class__.__name__ == args[0]:\n _nb_objects += 1\n print(_nb_objects)",
"... | [
"0.76066256",
"0.75749004",
"0.7414378",
"0.7414378",
"0.7414378",
"0.7414378",
"0.720742",
"0.7202337",
"0.7125929",
"0.7065806",
"0.70627666",
"0.70532167",
"0.70130396",
"0.69652444",
"0.69615006",
"0.6880982",
"0.6813709",
"0.6755989",
"0.67009604",
"0.66775364",
"0.66693... | 0.77346903 | 0 |
Return a random objects of the give size. | def random_sample_object_of_size(
self, n: int, **parameters: int
) -> CombinatorialObjectType: | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sample(self, size=1):\n return np.array([self.obj_] * size)",
"def set_generator(random, args):\n representation = args.get('representation')\n indices = list(range(len(representation)))\n max_size = args.get('max_size', 9)\n variable_size = args.get('variable_size', True)\n if variable... | [
"0.7280827",
"0.7222369",
"0.6973182",
"0.6943986",
"0.69349366",
"0.6852631",
"0.6832455",
"0.6813416",
"0.67957175",
"0.67938197",
"0.6782145",
"0.67747283",
"0.6769758",
"0.673426",
"0.67189604",
"0.669486",
"0.66634214",
"0.66625655",
"0.66381705",
"0.6594787",
"0.6553516... | 0.7460415 | 0 |
Return the reverse rule. At this stage, reverse rules can only be created for equivalence rules. | def to_reverse_rule(self) -> "ReverseRule":
assert (
self.is_equivalence()
), "reverse rule can only be created for equivalence rules"
return ReverseRule(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reversed_edge(self):\n reverse = Edge(id=self.id,\n start_node=self.end_node,\n end_node=self.start_node,\n cost=self.reverse_cost,\n reverse_cost=self.cost,\n reversed=not self.reversed)\n ... | [
"0.701795",
"0.6923783",
"0.68340147",
"0.68269473",
"0.66056406",
"0.65946716",
"0.6501034",
"0.6430362",
"0.64122367",
"0.64060086",
"0.6389224",
"0.63062704",
"0.623758",
"0.6226799",
"0.6149912",
"0.61382943",
"0.6093404",
"0.60657674",
"0.60492027",
"0.6012407",
"0.60054... | 0.8749442 | 0 |
Returns the list of (parent, rule) pairs that make up the equivalence path. | def eqv_path_rules(self) -> List[Tuple[CombinatorialClassType, Rule]]:
eqv_path_rules = []
curr = self.comb_class
for rule in self.rules:
eqv_path_rules.append((curr, rule))
curr = rule.children[0]
return eqv_path_rules | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_parents(graph, node):\n return list(graph.pred[node].keys())",
"def parents(self):\n return tuple(self._parents)",
"def _get_parents(self):\n parents = []\n parent = self.parent\n while(parent):\n parents.append(parent)\n parent = parent.parent\n ... | [
"0.65403485",
"0.6518198",
"0.6480634",
"0.6452033",
"0.64144146",
"0.63879454",
"0.63574994",
"0.634863",
"0.63458383",
"0.634206",
"0.63148856",
"0.63081074",
"0.62856746",
"0.62150604",
"0.62063134",
"0.6184409",
"0.6184409",
"0.6147428",
"0.6136117",
"0.6076137",
"0.60500... | 0.7277757 | 0 |
Test the Cell neighbor() function | def test_neighbor():
UP = (0, -1)
LEFT = (-1, 0)
DOWN_RIGHT = (1, 1)
HERE = (0, 0)
c1 = Cell(2, 6, 100)
c1_up = c1.neighbor(UP)
c1_left = c1.neighbor(LEFT)
c1_down_right = c1.neighbor(DOWN_RIGHT)
c1_here = c1.neighbor(HERE)
assert c1_up == (2, 5)
assert c1_up[0] == 2
as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors(self, cell):\n x = cell.x\n y = cell.y\n for new_x, new_y in [(x, y - 1), (x, y + 1), (x - 1, y), (x + 1, y)]:\n neighbor = self[new_x, new_y]\n if neighbor is not None:\n yield neighbor",
"def checkNumNeighbors():",
"def neighbors(self, x... | [
"0.7226675",
"0.68292683",
"0.6815512",
"0.68028873",
"0.679085",
"0.67738384",
"0.67545164",
"0.6737276",
"0.67228717",
"0.66747546",
"0.6659354",
"0.658226",
"0.654135",
"0.65255225",
"0.6481466",
"0.6476568",
"0.64367855",
"0.64222825",
"0.6408698",
"0.639581",
"0.63459176... | 0.808065 | 0 |
Create a new instance of SubmitRunOp from a json specification. | def from_json_spec(cls,
name: str = None,
k8s_name: str = None,
run_name: str = None,
json_spec: str = None):
spec = json.loads(json_spec)
return cls(name=name, k8s_name=k8s_name, run_name=run_name, spec=spec) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_dict(cls, dikt) -> 'POSTExecution':\n return util.deserialize_model(dikt, cls)",
"def from_json(cls, cfg):\n params = json.loads(json.dumps(cfg), object_hook=HelperObject)\n return cls(params.data, params.train, params.model)",
"def from_json_spec(cls,\n name... | [
"0.5410818",
"0.5403714",
"0.533109",
"0.5303939",
"0.51946723",
"0.5144199",
"0.51327837",
"0.5102564",
"0.5072273",
"0.5028828",
"0.4907732",
"0.48714176",
"0.4852858",
"0.47837102",
"0.47812846",
"0.4730974",
"0.47170222",
"0.469197",
"0.46737915",
"0.46732256",
"0.4671291... | 0.61600524 | 0 |
Create a new instance of SubmitRunOp from a file with a json specification. | def from_file_name(cls,
name: str = None,
k8s_name: str = None,
run_name: str = None,
file_name: str = None):
with open(file_name) as json_file:
spec = json.loads(json_file.read())
return cls(name=na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_json_file(cls, json_file):\n with tf.io.gfile.GFile(json_file, \"r\") as reader:\n text = reader.read()\n return cls(**json.loads(text))",
"def from_json_file(cls, json_file):\n with tf.io.gfile.GFile(json_file, \"r\") as reader:\n text = reader.read()\n return cls.fr... | [
"0.5926887",
"0.58758265",
"0.5862825",
"0.5826701",
"0.5760575",
"0.5645204",
"0.55995166",
"0.5560667",
"0.5548965",
"0.5535648",
"0.54247415",
"0.5409875",
"0.5407139",
"0.5399236",
"0.53801626",
"0.5378191",
"0.5366033",
"0.5341915",
"0.5323628",
"0.53227663",
"0.5317291"... | 0.6491938 | 0 |
Method transform the intermediate ports data frame to select only valid codes to create ports dim | def dim_ports(ports_df):
ports_dim = (
ports_df
.filter(~F.col("ports").contains("No PORT Code"))
)
ports_dim.show()
return ports_dim | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_port_group_by_moid(self):\n pass",
"def get_unused_ports(self, unused_port_str):\n # if empty sting is passed then return empty DataFrame\n if unused_port_str == '':\n return pd.DataFrame()\n\n ports = []\n date_time = get_date_time()\n for line i... | [
"0.5224369",
"0.51842445",
"0.51842445",
"0.5164048",
"0.51144636",
"0.497465",
"0.49057245",
"0.48911804",
"0.48890904",
"0.48084402",
"0.47575676",
"0.47434652",
"0.47418183",
"0.47414732",
"0.47408682",
"0.47242212",
"0.47073317",
"0.46896997",
"0.46886498",
"0.46762082",
... | 0.6692107 | 0 |
This method does following transformations on immigration data to get data for date dimension This dimension would be useful when any analysis needs to be performed w.r.t specific date, month, year or quarter There are other ways to create time dim but for this specific use case get all the arrival and departure dates ... | def dim_time(immigration_data_df):
time_df_a = (
immigration_data_df
.select(
F.col("arrdate").alias("date"))
.where(F.col("arrdate").isNotNull())
)
time_df_d = (
immigration_data_df
.select(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def immigration_data(spark, input_path=\"immigration_data_sample.csv\", output_data = \"s3a://data-capstone-final/\",\n partitionBy = [\"i94yr\", \"i94mon\"], header=True):\n \n # Loads the immigration dataframe using Spark\n immigration_df = read_data(spark, input_path=input_path,... | [
"0.62761635",
"0.58783156",
"0.5856214",
"0.57771146",
"0.5653239",
"0.5628229",
"0.56036097",
"0.5444593",
"0.54076153",
"0.536781",
"0.53643715",
"0.53050953",
"0.528974",
"0.52692986",
"0.5262323",
"0.52607703",
"0.5237568",
"0.52365655",
"0.5235097",
"0.5222664",
"0.52021... | 0.7101579 | 0 |
This method derives non immigrant information from immigration records This data is retrieved from I94 immigration event data Data that is relevant to immigrant like cicid, birth year, gender, occup, country of residence that is not going to change frequently can be put in separate dimension for analysis on immigrants ... | def dim_non_imm(immigration_data_df):
non_imm_dim = (
immigration_data_df
.select(
F.col("cicid").cast(IntegerType()),
F.col("biryear").alias("birth_year").cast(IntegerType()),
F.col("i94bir").cast(IntegerType()).alias("age_in_years"),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def metadata(filename):\n import numpy as np\n import pandas as pd\n\n infos = \"\"\"IGRAID 1- 11 Character\nWMOID 13- 17 Integer\nNAME 19- 48 Character\nNAMFLAG 50- 50 Character\nLATITUDE 52- 60 Real\nLATFLAG 62- 62 Character\nLONGITUDE 64- 72 R... | [
"0.5357622",
"0.5185365",
"0.5023878",
"0.50123936",
"0.49788377",
"0.4976602",
"0.49515256",
"0.4951011",
"0.49313566",
"0.4923122",
"0.4910067",
"0.4891492",
"0.48640996",
"0.48605734",
"0.48469463",
"0.484345",
"0.48242292",
"0.48084018",
"0.47907692",
"0.477829",
"0.47468... | 0.5709914 | 0 |
Returns a dictionary of networks with the relevant years as keys. | def create_network_dict(df, years):
networks = {}
for year in years:
print('Creating network for %d...' % year)
networks[year] = create_dot_network(df, str(year))
return networks | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_networks() -> dict:\n nets_rq = request(\n method=\"GET\", url=app.config[\"NETWORKS_REF\"], headers=build_header()\n )\n\n if not nets_rq:\n raise HTTPError(nets_rq.status_code)\n\n return nets_rq.json()",
"def networks(self) -> dict:\n return self.data[\"networks\"]",
... | [
"0.5918655",
"0.5785738",
"0.5735893",
"0.5478706",
"0.5440453",
"0.54196286",
"0.5414066",
"0.5338114",
"0.5322642",
"0.53099847",
"0.5297664",
"0.5261716",
"0.5258119",
"0.52575487",
"0.5245076",
"0.5234335",
"0.5227715",
"0.52235824",
"0.5198523",
"0.51982",
"0.51978654",
... | 0.7744364 | 0 |
Creates a dictionary of country names with country codes as keys from the passed in dataframe. | def create_country_code_dict(df):
code_dict = {}
# check both country and counterpart country columns for unique country codes
for col in ['Country', 'Counterpart Country']:
for code in df[col + ' Code'].unique():
code_dict[int(code)] = df.loc[df[col + ' Code'] == code][col + ' Name'].... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dict(df):\n df = df[['ISO3166A2',\n 'ISOen_ro_name',\n 'minlongitude',\n 'maxlongitude',\n 'minlatitude',\n 'maxlatitude',\n 'land_total',\n ]]\n df.ISOen_ro_name = df.ISOen_ro_name.str.strip()\n df.set_inde... | [
"0.6602226",
"0.6411995",
"0.6244173",
"0.6040808",
"0.60223204",
"0.59788436",
"0.5916327",
"0.58432454",
"0.5804787",
"0.5735152",
"0.5732541",
"0.5732514",
"0.57046205",
"0.5682515",
"0.5653929",
"0.5643544",
"0.56393325",
"0.56392324",
"0.56308895",
"0.5614485",
"0.558078... | 0.8194847 | 0 |
Finds network communities through modularity maximization and returns dictionary of community members by country name with community numbers as keys. | def find_and_print_network_communities(G, code_dict=None):
comm_dict = partition(G)
comm_members = {}
for comm in set(comm_dict.values()):
countries = [node for node in comm_dict if comm_dict[node] == comm]
if code_dict is not None:
countries = [code_dict[code] for code in coun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def infomap_communities(G):\n name_map = {}\n name_map_inverted = {}\n for n in G.nodes():\n id_ = hash(n) % 100000\n name_map_inverted[id_] = n\n name_map[n] = id_\n \n infomapSimple = infomap.Infomap(\"--two-level\")\n network = infomapSimple.network()\n \n for n1... | [
"0.6545982",
"0.6533479",
"0.649946",
"0.6381628",
"0.62922066",
"0.62431467",
"0.62060195",
"0.6114465",
"0.6099855",
"0.6081837",
"0.5900444",
"0.58542734",
"0.5840907",
"0.58016866",
"0.5791301",
"0.578559",
"0.57353455",
"0.5671412",
"0.56538",
"0.5622006",
"0.55906487",
... | 0.7682199 | 0 |
Returns dictionary of network characteristics obtained from networkx.info method. | def get_network_info_dict(network):
info_str = nx.info(network)
lines = info_str.split('\n')
info_dict = {}
for line in lines:
pair = line.split(':')
info_dict[pair[0]] = pair[1].strip()
return info_dict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def device_info(self):\n info = {\n \"connections\": {(CONNECTION_NETWORK_MAC, self._data[\"port-mac-address\"])},\n \"manufacturer\": self._ctrl.data[\"resource\"][\"platform\"],\n \"model\": self._ctrl.data[\"resource\"][\"board-name\"],\n \"name\": f\"{self._in... | [
"0.657443",
"0.6464078",
"0.6432058",
"0.6369912",
"0.63309944",
"0.62337625",
"0.6212752",
"0.61890197",
"0.61596024",
"0.6125705",
"0.60829103",
"0.60822463",
"0.5974782",
"0.59662074",
"0.5943988",
"0.59175324",
"0.5910978",
"0.58939266",
"0.58811927",
"0.58801174",
"0.583... | 0.7208542 | 0 |
Finds communities in each network and saves modularity, network info, and community members to file. | def save_all_community_information(networks, code_dict=None, filename='data/communities.pkl'):
save_dict = {}
for year, network in networks.items():
print('Finding communities for %d network...' % year)
comms, mod = find_and_print_network_communities(network, code_dict)
info_dict = get_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_community(network_path, network_name, output_path):\n net = network.network()\n net.from_file(network_path)\n output_prefix = output_path + '/{}_recursive_Louvain_{}_{}'.format(network_name, len(net.nodes), len(net.edges))\n logging.info('{} network: {} nodes and {} edges were loaded.'.forma... | [
"0.6578781",
"0.60120696",
"0.58955145",
"0.58343714",
"0.57502663",
"0.574814",
"0.56971574",
"0.54765326",
"0.5439292",
"0.53530926",
"0.535146",
"0.53266996",
"0.5296538",
"0.5294297",
"0.5267778",
"0.5256871",
"0.5241026",
"0.523762",
"0.52356154",
"0.52289706",
"0.522742... | 0.6888274 | 0 |
Register the given email address and link it to this user. | def register(email, display_name=None): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_register(\n email=None, password=None, name=None, gender=None, birthyear=None,\n image_url=None):\n email=email.lower()\n user = User.get_byemail(email)\n if user:\n return \"User already exists\", 409\n\n # primary user doesn't exists, creating it\n user = User.add_us... | [
"0.69371265",
"0.69116277",
"0.68284756",
"0.6817465",
"0.6808898",
"0.67441785",
"0.6735468",
"0.67019457",
"0.6670609",
"0.6669019",
"0.6659498",
"0.6611427",
"0.6597374",
"0.6594575",
"0.65331316",
"0.65330935",
"0.6519735",
"0.6443037",
"0.6440223",
"0.6435567",
"0.641892... | 0.7507758 | 0 |
slot which calls the table's update feature when the user attempts a question. | def callUpdateTable(self):
self.updateTable() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_invalid_question_button_callback(\n update: Update, context: CallbackContext\n) -> None:\n update.callback_query.answer()\n update.effective_message.edit_text(\n \"Sorry, I could not process this button click 😕 Please send /n to get a new question.\"\n )",
"def updateQTable( self, ... | [
"0.6182054",
"0.592034",
"0.5720887",
"0.56749755",
"0.56656134",
"0.56232846",
"0.56084996",
"0.5552781",
"0.55521333",
"0.5551119",
"0.54402304",
"0.5439777",
"0.5438625",
"0.54364103",
"0.53862476",
"0.5374336",
"0.53735185",
"0.53722304",
"0.5347497",
"0.5326284",
"0.5321... | 0.61068475 | 1 |
Updates the table for questions solved when the user completes a question. | def updateQuestionsSolved(self):
self.questionsCompletedLabel.setText("Questions completed: {}".format(save.getProblemsSolved())) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complete_questionnaire(self):\n logger.info(\"Complete questionnaire.\")\n difficulty = self.driver.find_element(\"id\", \"difficulty\")\n difficulty.value = \"4\"\n engagement = self.driver.find_element(\"id\", \"engagement\")\n engagement.value = \"3\"",
"def mark_quiz_co... | [
"0.6435131",
"0.59985226",
"0.58488333",
"0.5768069",
"0.5673158",
"0.5662116",
"0.56580716",
"0.55668026",
"0.55162627",
"0.5508816",
"0.54402316",
"0.5390171",
"0.53619075",
"0.5336135",
"0.5333832",
"0.5323319",
"0.5320811",
"0.5320458",
"0.5241203",
"0.5236728",
"0.522042... | 0.71269053 | 0 |
uncertainty on the QF due to the angle spread | def QF_uncertainty_angle(trials, En, angle, sigma_angle, Eee, QF_angle):
for i in range(0, trials):
theta = gauss(angle, sigma_angle)
Enr = Recoil_energy_nr(En, theta)
QF = Eee/Enr
QF_angle.Fill(QF) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sigma_xx_to_a_to_ff(self, Q, f):\n if f == \"e\":\n mf = me\n # gall = self.gaee\n elif f == \"mu\":\n mf = mmu\n # gall = self.gamumu\n mx = self.mx\n if Q >= 2.0 * mf and Q >= 2.0 * mx:\n # gaxx = self.gaxx\n # ma =... | [
"0.6171356",
"0.60792583",
"0.6044611",
"0.6009832",
"0.59207815",
"0.589989",
"0.58797526",
"0.58577037",
"0.5852545",
"0.5823915",
"0.5798571",
"0.5789787",
"0.5751386",
"0.5742443",
"0.57414937",
"0.57127064",
"0.5681714",
"0.5655557",
"0.56540686",
"0.564607",
"0.56397015... | 0.708686 | 0 |
uncertainty on the QF due to Eee spread | def QF_uncertainty_Eee(trials, En, angle, Eee, Eee_error, QF_Eee):
Enr = Recoil_energy_nr(En, angle)
for i in range(0, trials):
mean = gauss(Eee, Eee_error)
QF = mean/Enr
QF_Eee.Fill(QF) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def QF_uncertainty_En(trials, En, En_sigma, angle, Eee, QF_En):\n for i in range(0, trials):\n n = gauss(En, En_sigma)\n Enr = Recoil_energy_nr(n, angle)\n QF = Eee/Enr\n QF_En.Fill(QF)",
"def q_from_ea(ea, p):\n return 0.622 * ea / (p - 0.378 * ea)",
"def uncertainty_ee(self,... | [
"0.6090903",
"0.60665745",
"0.6047565",
"0.5859619",
"0.5786032",
"0.57753265",
"0.5767021",
"0.575127",
"0.574488",
"0.5732999",
"0.57321084",
"0.5726483",
"0.56986094",
"0.56885755",
"0.5684658",
"0.5684049",
"0.564164",
"0.56386465",
"0.5624253",
"0.5615442",
"0.5611019",
... | 0.6565848 | 0 |
Request a single response string. The first time the wavemeter receives this command, it will switch from broadcast to query mode. | def query(self):
self.bus.write('@\x51\r\n')
response = self.bus.read(23)
return response | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_cmd_rd_response ( self,\r\r\n cmd_str=r'AT',\r\r\n rsp_str ='ok'):\r\r\n loggerModem = logging.getLogger(__name__ + 'send_cmd_rd_response')\r\r\n text_str = \"AT command\"\r\r\n loggerModem.debug(\"%-15s:\\t%s\" %(text_str... | [
"0.62608135",
"0.6065739",
"0.60369277",
"0.59457356",
"0.5923049",
"0.59158695",
"0.5915071",
"0.5900167",
"0.587924",
"0.5875554",
"0.5813888",
"0.58050066",
"0.58040977",
"0.5790787",
"0.56602407",
"0.5650988",
"0.5645943",
"0.5642822",
"0.5638236",
"0.56322384",
"0.563018... | 0.6732922 | 0 |
Method to sum two or more densities. | def add_densities(densities):
return {spin: sum(np.array(dens[spin]) for dens in densities)
for spin in densities[0].keys()} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def combine_sd_ratios(data1: DataSeries, data2: DataSeries) -> DataSeries:\n return (data1.pow(2) + data2.pow(2)).pow(0.5)",
"def sumsquares(self):\n return np.dot((self.demeaned ** 2).T, self.weights)",
"def sum(self):\n return np.dot(self.data.T, self.weights)",
"def SSD(x,y):\n return ... | [
"0.5899113",
"0.5825757",
"0.5764213",
"0.57012993",
"0.56441665",
"0.55960506",
"0.55745065",
"0.5528037",
"0.55048966",
"0.54055303",
"0.540393",
"0.5387241",
"0.5375348",
"0.5357986",
"0.53428555",
"0.5293197",
"0.52856773",
"0.52588594",
"0.5248578",
"0.520819",
"0.520006... | 0.64396524 | 0 |
Downloads all files to the outputFolder, starting at the current position of the downloadFileParser. | def downloadFiles (downloadFileParser, outputFolder):
counter = 0
errorCounter = 0
url = downloadFileParser.getNextUrl()
while (url != None):
outputPath = FileDownloader.getOutputPath(url, outputFolder)
LogfileIO.writeLogfile(downloadFileParser._filePath, counter, outputFolder, outp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_data(self):\r\n \r\n for file in self.__files:\r\n file_to_download = os.path.join(self.__folder, os.path.basename(file))\r\n if not os.path.isfile(file_to_download):\r\n self.__download_file(file)",
"def download_files(self) -> None:\n\n for... | [
"0.7073223",
"0.7064665",
"0.6912946",
"0.68186545",
"0.66369015",
"0.6604578",
"0.65948755",
"0.6589549",
"0.6502933",
"0.64584124",
"0.6441611",
"0.63896453",
"0.63171864",
"0.63155955",
"0.6265888",
"0.62077",
"0.62020046",
"0.6201863",
"0.6199959",
"0.6198137",
"0.6188990... | 0.7238086 | 0 |
Test if '_connect' is called when retrieving new object from registry. | def test_connect_called_once():
config = {"listeners": "localhost:8080"}
registry = Registry()
registry.new(name="test", backend="dummy", **config)
dummy = registry["test"]
dummy._connect.assert_called_once() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connect_not_called():\n config = {\"listeners\": \"localhost:8080\"}\n registry = Registry()\n registry.new(name=\"test\", backend=\"dummy\", **config)\n\n dummy = registry[\"test\"]\n dummy.publish(topic=\"mytopic\", message=\"howl1\")\n dummy.publish(topic=\"mytopic\", message=\"howl2\... | [
"0.7223868",
"0.65071195",
"0.636814",
"0.63305",
"0.6312133",
"0.62849206",
"0.61374235",
"0.613014",
"0.61259615",
"0.6092771",
"0.60851395",
"0.60769415",
"0.6059029",
"0.6029122",
"0.59995604",
"0.59952307",
"0.596707",
"0.5966943",
"0.5934161",
"0.5914528",
"0.5907466",
... | 0.7222853 | 1 |
Test if '_connect' is only called once even after publish. | def test_connect_not_called():
config = {"listeners": "localhost:8080"}
registry = Registry()
registry.new(name="test", backend="dummy", **config)
dummy = registry["test"]
dummy.publish(topic="mytopic", message="howl1")
dummy.publish(topic="mytopic", message="howl2")
dummy.publish(topic="my... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connect_called_once():\n config = {\"listeners\": \"localhost:8080\"}\n registry = Registry()\n registry.new(name=\"test\", backend=\"dummy\", **config)\n\n dummy = registry[\"test\"]\n dummy._connect.assert_called_once()",
"def onConnect(self, connection:MQTTConnection) -> bool:\n\t\tret... | [
"0.69085246",
"0.6565114",
"0.651519",
"0.63622814",
"0.6328395",
"0.6166792",
"0.61527866",
"0.61427027",
"0.6099423",
"0.6078156",
"0.607101",
"0.6065646",
"0.6032939",
"0.60139424",
"0.601343",
"0.59882927",
"0.59836936",
"0.5959263",
"0.59579563",
"0.5950175",
"0.5920075"... | 0.7046906 | 0 |
Test if '_connect' is called when instantiating subscriber | def test_connect_subscriber():
config = {"listeners": "localhost:8080"}
registry = Registry()
registry.new(name="test", backend="dummy", **config)
dummy = registry["test"]
subscriber = dummy.subscribe(["mytopic"])
message = subscriber.listen()
assert message == "Dummy Message"
subscrib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_connect_not_called():\n config = {\"listeners\": \"localhost:8080\"}\n registry = Registry()\n registry.new(name=\"test\", backend=\"dummy\", **config)\n\n dummy = registry[\"test\"]\n dummy.publish(topic=\"mytopic\", message=\"howl1\")\n dummy.publish(topic=\"mytopic\", message=\"howl2\... | [
"0.75786585",
"0.7102073",
"0.6949429",
"0.6942935",
"0.6742659",
"0.66856194",
"0.65958434",
"0.6585595",
"0.65741205",
"0.6523454",
"0.6521784",
"0.65057415",
"0.64954215",
"0.6444445",
"0.6444445",
"0.6444445",
"0.64346516",
"0.6407566",
"0.6407434",
"0.63956976",
"0.63881... | 0.78352237 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.