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
Formats the input of a whisper post and converts all values to HEX
def inputPostFormatter(post): post["ttl"] = from_decimal(post["ttl"]) post["workToProve"] = from_decimal(post.get("workToProve", 0)) post["priority"] = from_decimal(post["priority"]) if not is_array(post.get("topics")): post["topics"] = [post["topics"]] if post.get("topics") else [] post[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def outputPostFormatter(post):\n\n post[\"expiry\"] = to_decimal(post[\"expiry\"])\n post[\"sent\"] = to_decimal(post[\"sent\"])\n post[\"ttl\"] = to_decimal(post[\"ttl\"])\n post[\"workProved\"] = to_decimal(post[\"workProved\"])\n\n if not post.get(\"topics\"):\n post[\"topics\"] = []\n\n ...
[ "0.6161056", "0.6024747", "0.5889979", "0.5726662", "0.5721067", "0.5715071", "0.5712564", "0.56954545", "0.56508905", "0.5574359", "0.5507912", "0.5491416", "0.5455812", "0.543887", "0.54006004", "0.537959", "0.536963", "0.5341674", "0.5320729", "0.5312651", "0.5311158", "...
0.6506106
0
Formats the output of a received post message
def outputPostFormatter(post): post["expiry"] = to_decimal(post["expiry"]) post["sent"] = to_decimal(post["sent"]) post["ttl"] = to_decimal(post["ttl"]) post["workProved"] = to_decimal(post["workProved"]) if not post.get("topics"): post["topics"] = [] post["topics"] = [decode_hex(topi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(self, message):", "def inputPostFormatter(post):\n\n post[\"ttl\"] = from_decimal(post[\"ttl\"])\n post[\"workToProve\"] = from_decimal(post.get(\"workToProve\", 0))\n post[\"priority\"] = from_decimal(post[\"priority\"])\n\n if not is_array(post.get(\"topics\")):\n post[\"topics\"]...
[ "0.6517435", "0.6332223", "0.6274383", "0.6151796", "0.6082813", "0.60550827", "0.5994535", "0.580875", "0.58030015", "0.57783115", "0.5777758", "0.57161885", "0.56622404", "0.5656379", "0.56329155", "0.5609236", "0.5584325", "0.5571311", "0.55095625", "0.5502143", "0.5492511...
0.71348196
0
Tests the import from local file for cities works fine
def test_csv_import_city(self): from django.contrib.messages import get_messages path = reverse("import-csv") user = mixer.blend(User, is_staff=True, is_superuser=True) file = open("city.csv") client = Client() client.force_login(user) r = client.post(path, {"titl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetWorldCities():\n return GetDataFromCsvFile('world_cities.csv')", "def _import_insee_city(self, cr, uid, ids, data_dir, context=None):\n if context is None:\n context = {}\n filepath = os.path.abspath(os.path.join(data_dir, 'comsimp2011.csv'))\n city_obj = self.pool.get('in...
[ "0.6581644", "0.64106566", "0.6348623", "0.6177727", "0.59844106", "0.58887535", "0.58847845", "0.5876422", "0.58704174", "0.5821457", "0.5782551", "0.57631767", "0.5752825", "0.573229", "0.5729731", "0.5711235", "0.56939304", "0.5689702", "0.5689702", "0.5689702", "0.5674587...
0.656946
1
Log control data at each step during evaluation.
def _log_control_data(self, action, global_reward): action_r = ','.join(['%d' % a for a in action]) cur_control = {'episode': self.cur_episode, 'step': self.t, 'action': action_r, 'reward': global_reward} self.control_data.appe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log(self, data):\n if self.log_data is not None:\n self.log_data(data)", "def on_eval_batch_begin(self, step, logs=None):", "def on_eval_begin(self, logs=None):", "def log_eval(self, epoch, dataset_name):\n pass", "def record(self, step):", "def on_log(self):\n monito...
[ "0.6422396", "0.6307403", "0.6306143", "0.6290289", "0.6281441", "0.6219549", "0.61849844", "0.61498964", "0.6084978", "0.6076392", "0.60656595", "0.60503274", "0.5975851", "0.597538", "0.59376127", "0.5935147", "0.5904615", "0.58918566", "0.5876711", "0.5858225", "0.58474666...
0.65032554
0
Get actions of each agents neighbour in the graph.
def get_neighbor_action(self, action): naction = [] for i in range(self.n_agent): naction.append(action[self.neighbor_mask[i] == 1]) return naction
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions(self) -> list:\n if self.debug: print(f\"StateNode.actions()\")\n if not self._examined:\n if self.debug: print(f\"\\tExamining...\")\n self._edges = self.state.actions()\n for e in self._edges:\n e: Action\n e.source = self\n...
[ "0.7049442", "0.6467031", "0.643074", "0.6362425", "0.62686896", "0.6207406", "0.6155371", "0.6118249", "0.6094078", "0.6003385", "0.59684646", "0.59684646", "0.59386194", "0.5927922", "0.5917781", "0.58938307", "0.58807933", "0.5880295", "0.5880295", "0.5880295", "0.5880295"...
0.71311367
0
! resources object of Resources class contain resources from config file options object of MergeOptions class contain merge options from config file str_name default value same as the class name "SynsetsSUMOMerger2"
def __init__(self, resources, options, str_name = 'SynsetsSUMOMerger2'): super(SynsetsSUMOMerger2, self).__init__(resources, options, str_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resources(self):", "def register_resources(self, resources):\n from tw.api import merge_resources\n merge_resources(self.request_local.resources, resources)", "def MergeLogic(self) -> str:", "def _merge_resource(self, resource, desired, unmanaged):\n unmanaged_resource = unmanaged[re...
[ "0.5547208", "0.54064465", "0.5403034", "0.53563666", "0.53249174", "0.5320973", "0.53159565", "0.5253915", "0.5152775", "0.51470643", "0.5145946", "0.5095782", "0.50935775", "0.5056793", "0.501863", "0.50170356", "0.49941415", "0.4964399", "0.49395525", "0.4936977", "0.49245...
0.82576424
0
! Create dictionary based on mapping PLWN on SUMO ontology file. Dictionary format and mapping PLWN on SUMO ontology file format are presented below.
def get_plwn2sumo_dict(self): if not os.path.exists(self.resources().mapping_sumo_file()): raise IOError( "%s file not found!" % \ self.resources().mapping_sumo_file() ) plwn2sumo_dict = defaultdict(set) with open(self.resources().mapping_sumo_file()) as sumofile: n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mapping_stratum(download_files =True):\r\n # get code description _index \r\n ix_= AGSO_PROPERTIES['props_codes'].index('name')\r\n def mfunc_(d): \r\n \"\"\" Set individual layer in dict of properties \"\"\"\r\n _p= {c: k.lower() if c not in ('code', 'label', 'name') else k \r\n ...
[ "0.61954165", "0.5963542", "0.5888741", "0.5863957", "0.58637106", "0.58131486", "0.5805316", "0.57554185", "0.5731265", "0.57232267", "0.5722358", "0.5715003", "0.5702462", "0.5668924", "0.56644607", "0.5656563", "0.56421024", "0.56056917", "0.55921763", "0.558435", "0.55836...
0.6826442
0
! Merge two given graphs, namely synsets graph and SUMO graph. The final graph contain one type of nodes, namely synsets nodes. Each synset node has an attribute named "synset",
def merge(self, g1, g2): logger = logging.getLogger(__name__) g = BaseGraph() g.copy_graph_from(g1) plwn2sumo_dict = defaultdict(set) plwn2sumo_dict = self.get_plwn2sumo_dict() synset_on_vertex_dict = {} for node in g.all_nodes(): synset_id = node.synset.synset_id if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_graph(self, other):\n self.add_nodes( (nLabel,nInfo) for nLabel,nInfo in other.nodes() )\n \n for nLabel,nInfo in other.nodes():\n for edgeLabel,edgeInfo in other.edgesFrom(nLabel):\n self.add_edge(edgeLabel,edgeInfo)", "def merge(self, other: \"GraphSet\")...
[ "0.6905344", "0.6667315", "0.66233647", "0.654952", "0.6426134", "0.6303256", "0.63004285", "0.6278962", "0.6188941", "0.6159831", "0.61385214", "0.60857415", "0.60827035", "0.59966093", "0.5975047", "0.58856934", "0.5844211", "0.58405745", "0.58178586", "0.57996076", "0.5799...
0.77939695
0
Builds and returns (in the form returned by decoderawtransaction) a transaction that spends the given utxo, pays CHI to some output
def build_tx (self, utxo, chiOut, name, nameAddr, value): nameData = self.nodes[0].name_show (name) inputs = [nameData, utxo] outputs = {nameAddr: Decimal ('0.01')} outputs.update (chiOut) tx = self.nodes[0].createrawtransaction (inputs, outputs) nameOp = { "op": "name_update", "na...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sochain_utxo_to_xchain_utxo(utxo):\n hash = utxo['txid']\n index = utxo['output_no']\n \n value = round(float(utxo['value']) * 10 ** 8)\n script = bytearray.fromhex(utxo['script_hex']) #utxo['script_hex']\n witness_utxo = Witness_UTXO(value, script)\n return UTXO(hash, index, witness_utxo...
[ "0.65796894", "0.630716", "0.62986237", "0.6173014", "0.60841966", "0.5914946", "0.5743247", "0.5731016", "0.5521235", "0.55083513", "0.5494718", "0.5486861", "0.54759413", "0.54701596", "0.54108584", "0.54077893", "0.53893286", "0.5363596", "0.5303798", "0.52935517", "0.5290...
0.70295274
0
Signs a transaction (in format of build_tx) with the given node, and returns the decoderawtransactiontype result again.
def sign (self, node, tx): signed = node.signrawtransactionwithwallet (tx["hex"]) res = node.decoderawtransaction (signed["hex"]) res.update (signed) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_transaction():\n data = request.get_json()\n\n try:\n tx = Transaction.from_dict(data)\n except TypeError:\n response = dict(message='Improper transaction json provided.')\n status_code = 400\n return jsonify(response), status_code\n\n signature = tx.sign(node.walle...
[ "0.6919308", "0.6778266", "0.6380237", "0.627283", "0.61029476", "0.6083491", "0.5987487", "0.58167666", "0.57365465", "0.5712428", "0.56981504", "0.56660604", "0.56095326", "0.55846405", "0.55624753", "0.5552044", "0.54918426", "0.5468147", "0.54531074", "0.54221904", "0.536...
0.77226585
0
Pick section of signal
def pick_section(signal, section=None): len_noise = signal.shape[-1] if section is None: len_sig = len_noise ii = 0 elif isinstance(section, int): len_sig = section ii = np.random.randint(0, len_noise - len_sig) else: len_sig = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phasing_signal(self, phasing, r, c):\r\n def signal():\r\n value = phasing.currentIndex()\r\n if value >= 0 and value <= 2:\r\n globals.sections[r, c] = value\r\n return signal", "def onPick(self, event):\n\n modifiers = QtWidgets.QApplication.keyboar...
[ "0.6373907", "0.6050952", "0.5974559", "0.54288924", "0.54075724", "0.5390018", "0.5377656", "0.5331255", "0.5308175", "0.5240958", "0.5233869", "0.51971555", "0.5189088", "0.5158308", "0.5147491", "0.5136177", "0.51356614", "0.50236404", "0.49819353", "0.49715742", "0.492783...
0.6796413
0
Calculate the average level across all sentences. The levels are calculated according to the toolbox's reference level. Returns
def average_level(self): spl = [utils.dbspl(x) for x in self.load_files()] return np.mean(spl), np.std(spl)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rouge_l_sentence_level(eval_sentences, ref_sentences):\n\n f1_scores = []\n for eval_sentence, ref_sentence in zip(eval_sentences, ref_sentences):\n m = float(len(ref_sentence))\n n = float(len(eval_sentence))\n lcs = _len_lcs(eval_sentence, ref_sentence)\n f1_scores.append(_f_lcs(lcs, m, n))\n ...
[ "0.69772524", "0.61759144", "0.61583227", "0.61080706", "0.6031079", "0.59640235", "0.57921195", "0.5750104", "0.57479537", "0.5734042", "0.5672754", "0.5670753", "0.566068", "0.5644736", "0.5632639", "0.5631451", "0.5594872", "0.559045", "0.5566701", "0.55663264", "0.5546832...
0.6812981
1
Instantiate a new TypeDefer
def __init__(self, raw_defer: Dict): self.kind = raw_defer.get("kind") self.name = raw_defer.get("name") self.of_type: TypeDefer = TypeDefer(raw_defer.get("ofType")) if raw_defer.get("ofType") is not None else None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instantiate():\n d = defer.Deferred()", "def __init__(self, type_):\n\n self.type = type_", "def Instance(self) -> TypeManager:", "def __call__(self, *args):\n return TypeCall(self, args)", "def _make_constructor(name, type_, attrs, kwargs):\n d = dict(attrs)\n d['_sumtype_attrib...
[ "0.64138234", "0.54614604", "0.54489744", "0.54139173", "0.5383102", "0.5300838", "0.52134734", "0.5191931", "0.5120031", "0.50648534", "0.49831468", "0.49792293", "0.49551898", "0.49469346", "0.49264267", "0.49214688", "0.48970965", "0.48778772", "0.48720497", "0.48700586", ...
0.7597686
0
Create a new Schema instance. Firstly the schema will be loaded synchronously from the endpoint and stored as raw json for further processing. Then the request types will be parsed. Those are "Query", "Mutation" and "Subscription". After that the schema types and directives are parsed.
def __init__(self, endpoint: str, transporter: Transporter, settings: Settings, cache: Optional[Cache]): self.endpoint = endpoint self.transport = transporter self.settings = settings self.cache = cache if self.cache is not None: schema_introspection = self.cache.ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, raw_type: Dict):\n\n self.kind = raw_type.get(\"kind\")\n self.name = raw_type.get(\"name\")\n self.description = raw_type.get(\"description\")\n self.fields: List[SchemaTypeField] = [SchemaTypeField(f) for f in raw_type.get(\"fields\") or [] if f]\n self.input...
[ "0.62221414", "0.6016679", "0.5968359", "0.5946103", "0.5910788", "0.59025574", "0.5863402", "0.58183753", "0.5814539", "0.57973915", "0.57765687", "0.5719145", "0.57047343", "0.5694497", "0.565712", "0.56565285", "0.56380844", "0.56073123", "0.55723673", "0.5570385", "0.5504...
0.67564994
0
Parse the query type from the root schema. This can either return a string or None. The latter when the endpoint does not support queries.
def parse_query_type(raw_schema: Dict) -> Union[str, None]: return Schema.parse_operation_type(raw_schema, "queryType")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]:\n query_type = raw_schema.get(op_type, {})\n if not query_type:\n return None\n return query_type.get(\"name\")", "def _schema_type(self) -> Optional[type]:\n return SearchMetaSchema", "def _sch...
[ "0.70593387", "0.5939255", "0.5924762", "0.5911261", "0.5840816", "0.57200265", "0.57065624", "0.5640995", "0.5613772", "0.5587588", "0.55517954", "0.54139596", "0.53744495", "0.5370533", "0.53518116", "0.5295712", "0.52832526", "0.5279426", "0.52663785", "0.52663785", "0.526...
0.8196511
0
Parse the mutation type from the root schema. This can either return a string or None. The latter when the endpoint does not support mutations.
def parse_mutation_type(raw_schema: Dict) -> Union[str, None]: return Schema.parse_operation_type(raw_schema, "mutationType")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]:\n query_type = raw_schema.get(op_type, {})\n if not query_type:\n return None\n return query_type.get(\"name\")", "def set_mutation_type(self, mut_type=''):\n if mut_type:\n # specified...
[ "0.6133898", "0.5771993", "0.55856854", "0.55424494", "0.55416554", "0.5471137", "0.52651036", "0.52617633", "0.5190931", "0.5140541", "0.50858825", "0.5052965", "0.5041517", "0.5041517", "0.50238866", "0.50197643", "0.49824637", "0.4972244", "0.4961925", "0.49438107", "0.494...
0.80457693
0
Parse the subscription type from the root schema. This can either return a string or None. The latter when the endpoint does not support subscriptions.
def parse_subscription_type(raw_schema: Dict) -> Union[str, None]: return Schema.parse_operation_type(raw_schema, "subscriptionType")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscription_type(self) -> str:\n return pulumi.get(self, \"subscription_type\")", "def typ(self) -> Optional[str]:\n return self.get(\"/Type\")", "def get_type_from_doc(doc):\n try:\n return doc.replace('\\n',' ').split('-> ')[1].split(' ')[0]\n except:\n return None", ...
[ "0.660987", "0.5427683", "0.5366075", "0.5344622", "0.531378", "0.5235341", "0.52084655", "0.514429", "0.514082", "0.5107135", "0.5022559", "0.4995361", "0.4984606", "0.49678668", "0.49628568", "0.49607036", "0.49584213", "0.4956243", "0.49261507", "0.49177787", "0.49068826",...
0.8100664
0
Parse an operation type from the root schema. This can either return a string or None. The latter when the endpoint does not support the passed by operation.
def parse_operation_type(raw_schema: Dict, op_type: str) -> Union[str, None]: query_type = raw_schema.get(op_type, {}) if not query_type: return None return query_type.get("name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operation_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"operation_type\")", "def get_operation_type(self, operation_name):\n # type: (Optional[str]) -> Optional[str]\n operations_map = self.operations_map\n if not operation_name and len(operations_map) ==...
[ "0.67735726", "0.6728999", "0.6351823", "0.63367105", "0.59829354", "0.59829354", "0.59829354", "0.59829354", "0.5836189", "0.5831232", "0.5829081", "0.5590442", "0.5587668", "0.55367893", "0.5521317", "0.55096656", "0.5479498", "0.5452105", "0.5383543", "0.5341075", "0.53038...
0.79709095
0
Parse all operations for a given operation type.
def parse_operations(self, operation_type: str) -> Tuple[Operation]: if operation_type is None: return tuple() query_type: SchemaType = self.types.get(operation_type) if query_type is None: return tuple() return tuple([Operation(f, self.settings) for f in query_ty...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_operation(self, data, ip):\n json_decoded = json.loads(data)\n op = json_decoded['OPERATION']\n if op in self._callbacks:\n self.logger.info(\"Got Operation: \" + op)\n self._callbacks[op](json_decoded, ip)\n else:\n self.logger.error(\"Unknown...
[ "0.6407225", "0.5742777", "0.56923646", "0.5603622", "0.55325913", "0.54617524", "0.5408668", "0.5370978", "0.5358051", "0.5347028", "0.5345967", "0.53198713", "0.52810514", "0.5279077", "0.5233153", "0.5233153", "0.5233153", "0.5233153", "0.52281266", "0.52163815", "0.520678...
0.7862727
0
Parse a list of arguments into a dictionary where the key is the name of the argument and the argument itself is the value.
def parse_arguments(args: List[Dict]) -> 'Dict[str, Argument]': if not args: return {} result = {} for a in args: if not a: continue arg = Argument(a) result[arg.name] = arg return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def arglist2dict(args):\n arg_dict = {}\n\n if len(args) == 0:\n return arg_dict\n\n if not args[0].startswith('--'):\n raise ValueError(f\"Positional keywords are not supported: {args[0]}\")\n\n i = 0\n while i < len(args):\n arg = args[i]\n ...
[ "0.75726336", "0.7397223", "0.7325528", "0.71652824", "0.7037274", "0.6999478", "0.6991102", "0.69558775", "0.69498295", "0.69380295", "0.6924944", "0.69120455", "0.6848294", "0.6756323", "0.6723195", "0.66975105", "0.6656867", "0.6617072", "0.6584447", "0.6567549", "0.653636...
0.85187536
0
Parse a list of directives into a dictionary where the key is the name of the directive and the value is the directive itself.o
def parse_directives(schema_directives: List[Dict]) -> Dict[str, Directive]: result = {} for schema_directive in schema_directives: new_directive = Directive(schema_directive) result[new_directive.name] = new_directive return result
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def directives():\n cmd = \"{} -L\".format(_detect_os())\n ret = {}\n out = __salt__[\"cmd.run\"](cmd)\n out = out.replace(\"\\n\\t\", \"\\t\")\n for line in out.splitlines():\n if not line:\n continue\n comps = line.split(\"\\t\")\n desc = \"\\n\".join(comps[1:])\n ...
[ "0.6590887", "0.60470355", "0.60470355", "0.58491236", "0.5815651", "0.57697064", "0.57697064", "0.5671237", "0.5338338", "0.52868664", "0.52477413", "0.5196038", "0.51685214", "0.51405686", "0.5023584", "0.49965042", "0.4984144", "0.49639156", "0.4882775", "0.4877682", "0.48...
0.77479357
0
Given a Unity Environment and a QNetwork, this method will generate a buffer of Experiences obtained by running the Environment with the Policy derived from the QNetwork.
def generate_trajectories( env: BaseEnv, q_net: VisualQNetwork, buffer_size: int, epsilon: float ): # Create an empty Buffer buffer: Buffer = [] # Reset the environment env.reset() # Read and store the Behavior Name of the Environment behavior_name = list(env.behavior_specs)[0] # Read...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_experiences(self):\n for i in range(self.num_frames_per_proc):\n # Do one agent-environment interaction\n\n preprocessed_obs0 = self.preprocess_obss(self.obs0, device=self.device)\n \n preprocessed_obs1 = self.preprocess_obss(self.obs1, device=self.dev...
[ "0.5506977", "0.5496875", "0.514291", "0.5113934", "0.49886903", "0.4943921", "0.49165386", "0.49162146", "0.48796564", "0.48758185", "0.48588508", "0.48554084", "0.4835768", "0.48339865", "0.4816758", "0.48112303", "0.47756678", "0.47557953", "0.47492647", "0.4732167", "0.47...
0.63224953
0
Performs an update of the QNetwork using the provided optimizer and buffer
def update_q_net( q_net: VisualQNetwork, optimizer: torch.optim, buffer: Buffer, action_size: int ): BATCH_SIZE = 1000 NUM_EPOCH = 3 GAMMA = 0.9 batch_size = min(len(buffer), BATCH_SIZE) random.shuffle(buffer) # Split the buffer into batches batches = [ buffer[batc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_optimizer(self, context, optimizer, host):\n pass", "def learn(self):\n ## obtain sample batch using priority based sampling.\n states, actions, rewards, next_states, dones, weights, sample_inds = self.buffer.sample_batch(BETA)\n \n ## obtain the discounted sum of re...
[ "0.6433153", "0.5484779", "0.5369425", "0.53328884", "0.52981716", "0.52732706", "0.5266272", "0.521479", "0.5200708", "0.51710343", "0.5088552", "0.50860375", "0.50787526", "0.507192", "0.507192", "0.50715756", "0.505829", "0.5000706", "0.4999721", "0.4979605", "0.496521", ...
0.62525785
1
Search for lback index self._in_loop becomes true in the second state of the loop
def _get_lback_index(self, model, last) -> int: assert last > 0 # last state cannot be loop-back. assert model.get_value(self.totime(self._in_loop, last)).is_true() assert model.get_value(self.totime(self._in_loop, 0)).is_false() idx = last - 1 while model.get_value(self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def detect_loop(self):\n tortoise = self.head\n hare = self.head\n while hare:\n tortoise = tortoise.next\n hare = hare.next.next\n if tortoise == hare:\n return True\n return False", "def bookkeep(self) :\n\t\tself.loopiter += 1", "def KeepAdvancingSolutionLoop(self):\n ...
[ "0.6223293", "0.6218441", "0.6189063", "0.6179153", "0.608254", "0.59855604", "0.5839952", "0.58170766", "0.57790136", "0.57635117", "0.5739355", "0.57139474", "0.57138425", "0.5695078", "0.56928277", "0.56292295", "0.5568077", "0.55579966", "0.55414546", "0.55264825", "0.551...
0.684357
0
Stores in a random location in the Linked list
def add(self, item): if self.count == 0: random_location = 0 else: random_location = random.randint(0, self.count - 1) self.insert(Node(item), random_location)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_location(self):\n return random.choice(self.locations_list)", "def random_pos(self, ):\n self.pos_item['needle'] = self.shuffle_pos()\n self.pos_item['ether'] = self.shuffle_pos()\n self.pos_item['tube'] = self.shuffle_pos()", "def randVacantPoint(L):\n pliste = vacant...
[ "0.6553104", "0.6297904", "0.6075966", "0.5918239", "0.58364403", "0.5792438", "0.57132536", "0.57105196", "0.56871873", "0.56744456", "0.56678665", "0.56591904", "0.5640225", "0.5628301", "0.5613032", "0.5598745", "0.5593619", "0.5581534", "0.5567704", "0.55652964", "0.55643...
0.7000383
0
Returns true if c is a printable character. We do this by checking for ord value above 32 (space), as well as CR (\r), LF (\n) and tab (\t)
def is_printable(c): return ord(c)>=32 or c in ['\r','\n', '\t']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_printable(s):\n for c in s:\n if c not in PRINTABLE_CHARACTERS:\n return False\n return True", "def is_printable(b):\n return b in e(string.printable)", "def is_p4d_printable(c):\n if ord(c) < 0x20:\n return False\n if ord(c) == 0x7F:\n return False\n re...
[ "0.77798957", "0.7536381", "0.7419245", "0.7221991", "0.718354", "0.7084998", "0.7084998", "0.70768076", "0.70703983", "0.6941782", "0.6763601", "0.66158307", "0.66158307", "0.6564988", "0.6561958", "0.6391701", "0.6390051", "0.6385484", "0.63393587", "0.63295555", "0.6323699...
0.89795405
0
Filter control characters out of the string buf, given a list of control codes that represent backspaces, and a regex of escape sequences. backspaces are characters emitted when the user hits backspace. This will probably vary from terminal to terminal, and this list should grow as new terminals are encountered. escape...
def sanitize(buf, backspaces=['\x08\x1b[K', '\x08 \x08'], escape_regex=re.compile(r'\x1b(\[|\]|\(|\))[;?0-9]*[0-9A-Za-z](.*\x07)?')): # Filter out control characters # First, handle the backspaces. for backspace in backspaces: try: while True: i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def escape(self, text, escape_chars):\n _bs = \"\\\\\"\n # backslash is always escaped\n text = text.replace(_bs, _bs * 2)\n for _el in escape_chars:\n assert _el != _bs, \"Backslash has been already escaped\"\n text = text.replace(_el, _bs + _el)\n return t...
[ "0.49353287", "0.49150157", "0.49105355", "0.46912605", "0.4635989", "0.4623271", "0.4604767", "0.4595183", "0.45459825", "0.4540293", "0.45323464", "0.450759", "0.44997773", "0.44368735", "0.44090384", "0.44047463", "0.43948525", "0.43837532", "0.43768844", "0.43508714", "0....
0.6139948
0
Tells the child process to resize its window
def resize_child_window(self): s = struct.pack('HHHH', 0, 0, 0, 0) x = fcntl.ioctl(0,termios.TIOCGWINSZ,s) fcntl.ioctl(self.child_fd,termios.TIOCSWINSZ,x)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(self):\r\n Win.resize(self)\r\n self.write(\"### console has been resized\")", "def __window_resizeTo(self, iWidth, iHeight):\n pass", "def resizeEvent(self, event):\n self.resized.emit()\n return super(PiWndow, self).resizeEvent(event)", "def signal_handler(self...
[ "0.6948274", "0.6908833", "0.67389023", "0.6696905", "0.6490529", "0.6470183", "0.6419227", "0.64030665", "0.6388671", "0.63874537", "0.6313409", "0.6285529", "0.6282814", "0.62690467", "0.62603426", "0.62542343", "0.6253225", "0.6249994", "0.62148416", "0.61682737", "0.61676...
0.7933913
0
Launch the appropriate shell as a login shell It will be either bash or tcsh depending on what the user is currently running. It checks the SHELL variable to figure it out.
def run_shell(): shell = get_shell() if shell not in ['bash','tcsh']: raise ValueError, "Unsupported shell (only works with bash and tcsh)" os.execvp(shell,(shell,"-l"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loginShell(self, shell=None):\n\n\t\tif shell is None:\n\t\t\traise exceptions.BadArgumentError(\n\t\t\t\t_(u'You must specify a shell'))\n\n\t\tif shell not in LMC.configuration.users.shells:\n\t\t\t\traise exceptions.BadArgumentError(_(u'Invalid shell \"{0}\". '\n\t\t\t\t\t'Valid shells are {1}.').format(sty...
[ "0.6784456", "0.6614977", "0.6381293", "0.6362046", "0.6199895", "0.6197317", "0.6101484", "0.60623527", "0.60271186", "0.59255606", "0.58501774", "0.5833172", "0.5826648", "0.5798579", "0.57554454", "0.56577605", "0.5635898", "0.56230944", "0.55727273", "0.55245143", "0.5498...
0.69821674
0
Retrieve the name of the directory that will store the logfiles. If the SHELLLOGGERDIR environment variable is set, use that. Otherwise, default to ~/.shelllogger
def get_log_dir(): env_var = "SHELLLOGGERDIR" if os.environ.has_key(env_var): return os.environ[env_var] else: return os.path.expanduser('~/.shelllogger')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_log_directory(self):\n\n return self.__config_parser__.get('SETTINGS', 'LOGFILE_DIRECTORY')", "def log_dir():\r\n if LogOptions._LOG_DIR is None:\r\n LogOptions._LOG_DIR = app.get_options().twitter_common_log_log_dir\r\n return LogOptions._LOG_DIR", "def get_logging_dir(self):\n ...
[ "0.7954862", "0.7615036", "0.75734735", "0.7549197", "0.7508237", "0.74224484", "0.7221798", "0.71972513", "0.7154093", "0.7087117", "0.706262", "0.6988383", "0.6986975", "0.69751024", "0.68904305", "0.6860191", "0.6823196", "0.67315704", "0.6727358", "0.6695155", "0.6671013"...
0.88646066
0
Convert the .raw file, with illegal characters and escape keys, to a proper XML version. Returns the name of the XML file
def raw_to_xml(self): xmlfilename = self.logfilename.replace('.raw','.xml') fout = codecs.open(xmlfilename, encoding="utf-8", mode="w") for line in codecs.open(self.logfilename,encoding="utf-8"): fout.write(sanitize(line)) fout.close() return xmlfilename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitizeXML(filename):\n #we have to remove all illegal characters from crossref xml\n full_path = os.path.abspath(filename)\n path, filename = os.path.split(full_path)\n with open(full_path, 'r') as in_file:\n with open(os.path.join(path,\"tmp\"+filename), 'w') as out_file:\n for...
[ "0.63195187", "0.59571916", "0.590457", "0.5790034", "0.56660265", "0.5458497", "0.53709275", "0.5369985", "0.5312219", "0.5296952", "0.5284404", "0.52644795", "0.52433074", "0.5239629", "0.5220292", "0.5200755", "0.5199187", "0.51793045", "0.5175041", "0.51562613", "0.514544...
0.76060027
0
get the report template
def _report_template(): current_dir = Path(__file__).parent with open(current_dir / "report_template.html", "r") as f: template = f.read() template = re.sub(r"\s{2,}", " ", template) template = re.sub(r"\n", "", template) template = re.sub(r"> <", "><", template) return temp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_template(self):\n try:\n template_path = current_app.config.get('REPORT_TEMPLATE_PATH')\n template_code = Path(f'{template_path}/{self._get_template_filename()}').read_text()\n # substitute template parts\n template_code = self._substitute_template_parts(...
[ "0.76926655", "0.73982304", "0.7120592", "0.70143956", "0.6962399", "0.6962399", "0.6962399", "0.6943154", "0.68456966", "0.6840729", "0.6796202", "0.6777228", "0.67390454", "0.6727346", "0.6701621", "0.6578594", "0.6480725", "0.6409205", "0.6401734", "0.63737816", "0.6356212...
0.74037963
1
Render exception_data as an html report
def render_exception_html(exception_data, report_template=None): report_template = report_template or _report_template() jinja_env = jinja2.Environment(loader=jinja2.BaseLoader(), extensions=["jinja2.ext.autoescape"]) exception_data["repr"] = repr return jinja_env.from_string(report_template).render(exc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_exception(self, exception_trace=''):\n txt = [80 * '*', '\\n', BANNER, '\\n', 80 * '*', '\\n', '\\n', '\\n']\n txt.extend(exception_trace)\n cherrypy.response.headers['Content-Type'] = 'text/plain'\n return as_bytes(txt)", "def create_exception_report(exc_type, exc_value, ...
[ "0.6812304", "0.6662681", "0.6421623", "0.6406252", "0.6321645", "0.63113713", "0.61840075", "0.6142265", "0.6085713", "0.6048839", "0.59619063", "0.5947996", "0.5916094", "0.5889431", "0.58686614", "0.5866581", "0.5849284", "0.58273417", "0.5797272", "0.57954353", "0.5734677...
0.7821494
0
Render exception_data as a json object
def render_exception_json(exception_data): return json.dumps(exception_data, default=_json_serializer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exceptionhandler(e):\n response = e.get_response()\n response.data = json.dumps({\n \"code\" : e.code,\n \"name\": e.name,\n \"description\": e.description\n })\n response.content_type = \"application/json\"\n\n return response", "def jsonif...
[ "0.72541064", "0.67585784", "0.6713111", "0.6690408", "0.66427636", "0.66312206", "0.65327764", "0.65234625", "0.6517418", "0.6510992", "0.64126235", "0.6402634", "0.63840944", "0.63827544", "0.63217765", "0.6246733", "0.62432253", "0.61892617", "0.6140482", "0.6116676", "0.6...
0.9000337
0
Returns context_lines before and after lineno from file. Returns (pre_context_lineno, pre_context, context_line, post_context).
def get_lines_from_file(filename, lineno, context_lines, loader=None, module_name=None): source = None if loader is not None and hasattr(loader, "get_source"): with suppress(ImportError): source = loader.get_source(module_name) if source is not None: source = source.split...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_lines_from_file(filename, lineno, context_lines):\n\n try:\n source = open(filename).readlines()\n lower_bound = max(0, lineno - context_lines)\n upper_bound = lineno + context_lines\n\n pre_context = \\\n [line.strip('\\n') for line in source[lower_bound:lineno]]...
[ "0.7550956", "0.66815025", "0.635524", "0.60288763", "0.56448764", "0.5592623", "0.55494016", "0.55332536", "0.5494302", "0.5492887", "0.5485184", "0.5472898", "0.5435706", "0.54235774", "0.54235774", "0.54235774", "0.54235774", "0.54235774", "0.54235774", "0.5400774", "0.539...
0.68244785
1
Create an exception report and return its location
def create_exception_report(exc_type, exc_value, tb, output_format, storage_backend, data_processor=None, get_full_tb=False): exception_data = get_exception_data(exc_type, exc_value, tb, get_full_tb=get_full_tb) if data_processor: exception_data = data_processor(exception_data) if output_format == ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_exception(self, msg: str):", "def formatReport(cls, instance, trcback, context=1):\n\n\theader = []\n\theader.append(\"Exception in '{0}'.\".format(getInnerMostFrame(trcback).f_code.co_name))\n\theader.append(\"Exception class: '{0}'.\".format(cls.__name__))\n\theader.append(\"Exception description: '...
[ "0.61463684", "0.5946372", "0.59041274", "0.577588", "0.57041526", "0.569233", "0.5647634", "0.56435865", "0.5620892", "0.5555634", "0.54271317", "0.5426168", "0.5407387", "0.5407387", "0.538084", "0.53600556", "0.53557533", "0.533768", "0.5310631", "0.5296912", "0.5202553", ...
0.6724956
0
Publish a registration to the core, listing the API commands.
def register_to_core(self): self.channel.basic_publish(exchange='', routing_key='peripheral_register', body=json.dumps({self.name: api}))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _cli(ctx, input, output):\n print(\"Registering...\")\n ctx.obj = dict(\n component=Registration,\n input=input,\n output=output,\n stack=ImageStack.from_path_or_url(input),\n )", "def register_routes(self, api):\n # Device Registration\...
[ "0.6083113", "0.6011665", "0.59751356", "0.5912697", "0.5612715", "0.55548126", "0.5551435", "0.5506128", "0.54874337", "0.53894794", "0.5374884", "0.5348596", "0.5333862", "0.53083724", "0.52938396", "0.52787286", "0.52458644", "0.5237489", "0.5214423", "0.52052796", "0.5195...
0.6798816
0
Subscribe to the queue matching the instance's name. Pass the command to the process_command function.
def subscribe_to_commands(self): self.basic_consume(self.process_command, queue=self.name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_command(self, cmd):\n self.command_queue.put(cmd)", "def Enqueue(self, command):\n\n self.queue.put(command)", "def command(self, command_string):\n self.__command_queue.append(command_string)", "def subscribe(self, queue, action):\n self.channel.queue_declare(queue=queue)...
[ "0.63098824", "0.62418693", "0.6216443", "0.6078142", "0.6037645", "0.5994807", "0.59508395", "0.5937547", "0.5917672", "0.5872839", "0.58456135", "0.58215594", "0.5785163", "0.5764144", "0.5762315", "0.5658088", "0.55472076", "0.55459744", "0.5537582", "0.5512194", "0.550374...
0.75445706
0
Run the chat client application loop. When this function exists, the application will stop
def run_chat_client(): while must_run: print_menu() action = select_user_action() perform_user_action(action) print("Thanks for watching. Like and subscribe! 👍")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def MainLoop(self):\n self.pleaseQuit=0\n\n self.logger.info(\"Starting main eventloop\")\n try:\n self.irc.process_forever(1)\n except KeyboardInterrupt:\n self.logger.warn(\"Received interrupt, disconnecting from irc\")\n #self.irc.disconnect_all(\"^C ...
[ "0.6931434", "0.688994", "0.68419933", "0.6826242", "0.6802301", "0.67320764", "0.6727489", "0.668575", "0.6628602", "0.6600071", "0.656014", "0.6525707", "0.6512084", "0.6486234", "0.6479219", "0.64297473", "0.6423571", "0.64088786", "0.6408701", "0.6398141", "0.6387875", ...
0.78608006
0
Print the menu showing the available options
def print_menu(): print("==============================================") print("What do you want to do now? ") print("==============================================") print("Available options:") i = 1 for a in available_actions: if current_state in a["valid_states"]: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _print_menu(self):\n # Create header line.\n header = \"%s Menu:\" % (self.__name)\n header = header.title()\n print(header)\n\n # Show the iterations counter.\n iterations = self._status.get_value(\"iterations\")\n print(\"(Iteration %d)\" % (iterations))\n\n ...
[ "0.83484006", "0.80100524", "0.79167485", "0.79120266", "0.7911782", "0.7821441", "0.7816", "0.7809606", "0.7785762", "0.77756435", "0.77276397", "0.7672742", "0.7655172", "0.75879997", "0.7581685", "0.7477574", "0.74568194", "0.73829365", "0.73222256", "0.7274187", "0.722757...
0.828377
1
Ask the user to choose and action by entering the index of the action
def select_user_action(): number_of_actions = len(available_actions) hint = "Enter the number of your choice (1..%i):" % number_of_actions choice = input(hint) # Try to convert the input to an integer try: choice_int = int(choice) except ValueError: choice_int = -1 i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_action(self):\r\n pass", "def get_action(player):\n print_action(player)\n chosen_action_index = int(input('Please indicate your selection from the following list by inputting the number: '))\n return player.available_actions[chosen_action_index]", "def select_action(self):\n ...
[ "0.77464926", "0.7433682", "0.72635955", "0.7202781", "0.71235913", "0.70796835", "0.70719695", "0.70426613", "0.69958633", "0.69911724", "0.69026655", "0.69006485", "0.68855083", "0.6853275", "0.68034893", "0.67918736", "0.67697215", "0.6714882", "0.6669915", "0.66696125", "...
0.77177477
1
Input `text` into the text field on the page.
def enter_text(self, text): self.q(css='#fixture input').fill(text)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generic_input_text(self, element_id, text):\n self._generic_input(element_id, text)", "def input(self, text):\n self.element.clear()\n self.element.send_keys(text)", "def input_text(self, element: Union[WebElement, Tuple[By, str]], text: str):\n element = self.find_element(eleme...
[ "0.7562028", "0.74759895", "0.74647695", "0.7401078", "0.73765755", "0.7364279", "0.7364279", "0.7364279", "0.7364279", "0.7364279", "0.7364279", "0.7331148", "0.72840446", "0.72499853", "0.72281253", "0.7209747", "0.7139128", "0.7137083", "0.7108322", "0.70740104", "0.703111...
0.78288025
0
Select the car with ``car_value`` in the dropdown list.
def select_car(self, car_value): self.q(css=u'select[name="cars"] option[value="{}"]'.format(car_value)).first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_car_selected(self, car):\n return self.q(css=u'select[name=\"cars\"] option[value=\"{}\"]'.format(car)).selected", "def the_option_with_value(value: str) -> \"SelectByValue\":\n return SelectByValue(value)", "def select_option(self, selector, value):\n from selenium.webdriver.common...
[ "0.6586301", "0.6283673", "0.624815", "0.5832125", "0.5829928", "0.56058097", "0.55932057", "0.5486654", "0.5476527", "0.54241836", "0.54193985", "0.5406573", "0.5401394", "0.52843726", "0.5263898", "0.52331984", "0.51806915", "0.5153212", "0.5153212", "0.5153212", "0.5129445...
0.8951591
0
Return ``True`` if the given ``car`` is selected, ``False`` otherwise.
def is_car_selected(self, car): return self.q(css=u'select[name="cars"] option[value="{}"]'.format(car)).selected
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_selected(self) -> bool:\n return self.proto.is_selected", "def _is_selected ( self, object ):\n if hasattr(object, 'model_selection') \\\n and object.model_selection is not None:\n return True\n return False", "def is_selected(self) -> bool:\r\n retu...
[ "0.6459931", "0.64561963", "0.64533645", "0.5970567", "0.5970567", "0.5941123", "0.59283936", "0.5885889", "0.58118576", "0.5765825", "0.57478505", "0.5745376", "0.55844533", "0.5575426", "0.5548363", "0.5547362", "0.5532758", "0.5526049", "0.55059886", "0.5495182", "0.548899...
0.86627126
0
Toggle the box for the pill with `pill_name` (red or blue).
def toggle_pill(self, pill_name): self.q(css=u"#fixture input#{}".format(pill_name)).first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def toggle_color_picker(self, wid, color_name='square_fill_ink'):\n print(\"TOGGLE COLOR PICKER\", getattr(wid, color_name), self.color_picker)\n is_open = self.color_dropdown and self.color_dropdown.attach_to\n if is_open:\n self.color_dropdown.dismiss()\n ...
[ "0.5491586", "0.5272434", "0.51687783", "0.5140479", "0.5102771", "0.50949675", "0.49874344", "0.49179575", "0.48726612", "0.4838384", "0.4801307", "0.47595447", "0.47443792", "0.47273305", "0.4704383", "0.4703406", "0.46984416", "0.4670263", "0.46450222", "0.46340665", "0.46...
0.8160374
0
Click the ``Confirm`` button and confirm the dialog.
def confirm(self): with self.handle_alert(confirm=True): self.q(css='button#confirm').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_dialog(self, title, message):\n return self._impl.confirm_dialog(title, message)", "def _tap_on_confirm_button(self, yes=True, msg=\"Confirm dialog button\"):\n btn = self.UTILS.element.getElement(DOM.DownloadManager.download_confirm_yes if\n y...
[ "0.7253925", "0.7246785", "0.72352403", "0.7205", "0.716402", "0.7038067", "0.70259655", "0.700242", "0.6850886", "0.6840978", "0.682001", "0.6809211", "0.6784496", "0.67724127", "0.6758107", "0.6704055", "0.65794057", "0.6546828", "0.65444165", "0.6512818", "0.6483923", "0...
0.85760707
0
Click the ``Confirm`` button and cancel the dialog.
def cancel(self): with self.handle_alert(confirm=False): self.q(css='button#confirm').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm(self):\n with self.handle_alert(confirm=True):\n self.q(css='button#confirm').first.click()", "def confirm_action(message):\n if not click.confirm(message + \" Continue?\"):\n logger.info(\"User cancels action. Exiting...\")\n exit(0)\n else: return", "def ask_...
[ "0.80490994", "0.7658619", "0.75887465", "0.718055", "0.7045372", "0.6991206", "0.6899526", "0.6881284", "0.6846061", "0.683484", "0.681738", "0.68133414", "0.6789782", "0.6765807", "0.6764634", "0.6748562", "0.6728313", "0.67058414", "0.6674141", "0.66671133", "0.6665826", ...
0.8330856
0
Count the number of div.test elements.
def num_divs(self): return len(self.q(css='div.test').results)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_number_of_testcase_elements(self):\n testcases = self.root.findall('testcase')\n self.assertEqual(len(testcases), 4)", "def test_count(self):\n return len(self.tests) + sum(suite.test_count for suite in self.suites)", "def test_element_count(self):\n\t\ts = Student_Analytics()\n\t...
[ "0.72423947", "0.6702707", "0.66566426", "0.6639454", "0.6568075", "0.6378697", "0.6344244", "0.6308958", "0.6286621", "0.62182474", "0.61914384", "0.61866164", "0.617343", "0.6128987", "0.6103108", "0.6089674", "0.60860085", "0.60737354", "0.6061457", "0.604047", "0.6024079"...
0.83748364
0
Return list of text for each div.test element.
def div_text_list(self): return self.q(css='div.test').text
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_html_list(self):\n return self.q(css='div.test').html", "def texts(self):\n return [elem.text for elem in self.web_elements]", "def _get_text(self, element):\n # for text in element.itertext():\n for text in self.iter_main_text(element):\n yield text.strip()", "...
[ "0.7000479", "0.6322341", "0.61989576", "0.6173835", "0.6019634", "0.59161645", "0.5873848", "0.58302426", "0.57565117", "0.5753218", "0.57449764", "0.57032067", "0.56822264", "0.5670111", "0.5669928", "0.56666976", "0.5641307", "0.5638164", "0.5599844", "0.55976945", "0.5587...
0.8607301
0
Return list of values for each div.test element.
def div_value_list(self): return self.q(css='div.test').attrs('value')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_text_list(self):\n return self.q(css='div.test').text", "def div_html_list(self):\n return self.q(css='div.test').html", "def get_individual_performance(self):\n\n divs = self.page.find_all(\"span\", {\"class\":\"value\"})\n values = [div.text for div in divs]\n retur...
[ "0.74490196", "0.68997157", "0.64932024", "0.61540717", "0.6152504", "0.6152504", "0.5885815", "0.58685976", "0.5835421", "0.58142436", "0.57759404", "0.5746933", "0.56337065", "0.5621383", "0.5567706", "0.5559967", "0.55586827", "0.55545664", "0.5553262", "0.5503301", "0.548...
0.7983814
0
Return list of html for each div.test element.
def div_html_list(self): return self.q(css='div.test').html
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_text_list(self):\n return self.q(css='div.test').text", "def test_html(self):\n tags = (('<input', 3),\n ('<span', 1),\n ('<button', 1))\n\n for text, count in tags:\n with self.subTest():\n self.assertContains(self.resp, text, ...
[ "0.7729957", "0.62460953", "0.62029403", "0.601013", "0.597623", "0.5949348", "0.58157754", "0.5773843", "0.56723", "0.5651943", "0.5582805", "0.5582524", "0.5579697", "0.55494183", "0.5474166", "0.54684716", "0.5461556", "0.5445097", "0.5445097", "0.54369843", "0.54336387", ...
0.8394743
0
Return a list of the ids of outer divs with the specified text in a child element.
def ids_of_outer_divs_with_inner_text(self, child_text): return self.q(css='div.outer').filter( lambda el: child_text in [inner.text for inner in el.find_elements_by_css_selector('div.inner')] ).attrs('id')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self):\n page = r.get(self.url)\n tree = html.fromstring(page.content)\n ids_elements = tree.xpath(\"//div[@id='selectedcontent']/div/ul/li/a\")\n return [self._e_to_id(e) for e in ids_elements]", "def get_child_ids(id,conn):\n\n child_ids = ('WITH RECURSIVE children AS '\n ...
[ "0.55548036", "0.5479126", "0.54318756", "0.54250884", "0.53954", "0.5378344", "0.5358235", "0.532862", "0.53090286", "0.52930194", "0.5247154", "0.5223819", "0.5181133", "0.51650614", "0.5156875", "0.51566947", "0.512827", "0.5109152", "0.5081774", "0.5059653", "0.5021192", ...
0.877173
0
Wait for click handlers to be installed, then click a button and retrieve the output that appears after a delay.
def trigger_output(self): EmptyPromise(self.q(css='div#ready').is_present, "Click ready").fulfill() self.q(css='div#fixture button').first.click() EmptyPromise(self.q(css='div#output').is_present, "Output available").fulfill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def trigger_output(self):\n self.q(css='div#fixture button').first.click()", "def wait_for_click():\r\n global _canvas\r\n global _cue\r\n if _canvas == None:\r\n raise RuntimeError(\"Canvas is not open ...
[ "0.6465646", "0.6465646", "0.6274144", "0.62248296", "0.6096584", "0.6029719", "0.5998305", "0.5964109", "0.5912692", "0.58695084", "0.5805828", "0.5800075", "0.5798295", "0.5771682", "0.5740042", "0.5727599", "0.5700866", "0.56949717", "0.56949717", "0.56891507", "0.5687063"...
0.66481423
0
Make a promise that will not be fulfilled. Should raise a `BrokenPromise` exception.
def make_broken_promise(self): return EmptyPromise( self.q(css='div#not_present').is_present, "Invalid div appeared", try_limit=3, try_interval=0.01 ).fulfill()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def promise_forced(promise):\n require_type(isa(promise,Promise),\n 'the parameter of promise_forced must be a Promise')\n return promise.exprs.env.find(Symbol('already-run?'))['already-run?']", "async def test_task_not_awaitable(arg):\n with pytest.raises(OSError):\n async with Scope(...
[ "0.5204269", "0.5157995", "0.5118575", "0.50748104", "0.5045879", "0.50228643", "0.48635247", "0.48367554", "0.48231182", "0.48055142", "0.48020154", "0.4710334", "0.4705783", "0.47007585", "0.4683378", "0.4586624", "0.45848158", "0.45210996", "0.45157987", "0.449673", "0.449...
0.7172702
0
Load the page named `page_name` after waiting for `delay_sec`.
def load_next(self, page, delay_sec): time.sleep(delay_sec) page.visit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page_content(self, url, delay):\r\n\r\n # if browser cannot connect to the server, repeat it infinitely.\r\n while True:\r\n try:\r\n # load the page\r\n self.sel_driver.get(url)\r\n\r\n # if the page is loaded, wait for delay seconds un...
[ "0.6076569", "0.60745835", "0.5974487", "0.5962621", "0.589742", "0.58021855", "0.5790462", "0.5778986", "0.5760904", "0.5742551", "0.55892485", "0.555522", "0.55303234", "0.550315", "0.5468579", "0.54579824", "0.54159063", "0.5409639", "0.53982323", "0.53721374", "0.5353541"...
0.7595584
0
Give focus to the element with the ``maincontent`` ID.
def focus_on_main_content(self): self.browser.execute_script("$('#main-content').focus()")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetFocus(self):\r\n \r\n self._main_win.SetFocus()", "def onMnemoToMain(self):\n self.second_main_text.SetFocus()", "def _focus(self, element):\n actions = ActionChains(self.selenium.driver)\n actions.move_to_element(element).click().perform()\n self.selenium.set_f...
[ "0.68469656", "0.64330465", "0.62243736", "0.5957323", "0.5938014", "0.59248924", "0.59248924", "0.59248924", "0.59248924", "0.58128226", "0.56373054", "0.5598049", "0.5598049", "0.5598049", "0.5598049", "0.55663764", "0.555354", "0.55340254", "0.5431309", "0.5403516", "0.537...
0.8871579
0
Reload the page, wait for JS, then trigger the output.
def reload_and_trigger_output(self): self.browser.refresh() self.wait_for_js() # pylint: disable=no-member self.q(css='div#fixture button').first.click()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refresh_page(self):\n self.m_driver.refresh()\n time.sleep(30)", "def refresh(self):\n self.log_info(f\"Browser.refresh: Refreshing the page\")\n self.CORE.refresh()\n return", "def refresh_page(self, callback=None):\n if callback is not None:\n callback...
[ "0.61143285", "0.6020823", "0.5730542", "0.5707968", "0.5650479", "0.5597226", "0.5587973", "0.5548144", "0.55204254", "0.55047655", "0.54316336", "0.53578436", "0.5348964", "0.5344503", "0.52896523", "0.5284119", "0.5284119", "0.5281825", "0.52662414", "0.5262159", "0.524401...
0.77481604
0
Click button and wait until playing class disappeared from DOM
def is_class_absent(self): self.q(css='#spinner').first.click() self.wait_for_element_absence('.playing', 'Animation Stopped')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll(self):\n\tself.met = self.button.poll()", "def wait_for_button(self, button, message=True):\n if message:\n rospy.loginfo(\"Waiting for xbox button: \" + button)\n \n wait_for(lambda: not self.get_button(button) == 0)", "def _check_play_button(self, mouse_pos):\n ...
[ "0.6262264", "0.6247249", "0.6172894", "0.6123498", "0.6084997", "0.6075153", "0.60310066", "0.6026245", "0.60012144", "0.5995387", "0.5967095", "0.59577924", "0.5948899", "0.59429574", "0.592757", "0.5881039", "0.5876616", "0.5875502", "0.58591527", "0.5838041", "0.58163005"...
0.6424565
0
Click button and wait until spinner is disappeared.
def is_spinner_invisible(self): self.q(css='#spinner').first.click() self.wait_for_element_invisibility('#anim', 'Button Output is Visible')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_spinner_disappear(self):\n self.wait_for_element_disappear(loadings_catalog.LOADING_SPINNER)\n self.wait_for_element_disappear(loadings_catalog.LOADING)", "def wait_for_button(self, button, message=True):\n if message:\n rospy.loginfo(\"Waiting for xbox button: \" + butto...
[ "0.7126271", "0.6884283", "0.66924036", "0.65854484", "0.654948", "0.64384645", "0.63156706", "0.62573993", "0.62523603", "0.6224479", "0.61823416", "0.61524755", "0.6134778", "0.61076003", "0.6089265", "0.6077746", "0.6075494", "0.606039", "0.6058926", "0.6032544", "0.603163...
0.69422036
1
Check if value is prime
def is_prime(value: int) -> bool: if value == 1: return False if value <= 0: raise ValueError("Value must be greater than zero") for i in range(2, int(value**(1/2)) + 1): if value % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime(value):\n\n if value < 2: raise ValueError\n\n for i in range(2, value):\n if value % i == 0:\n return False\n\n return True", "def is_prime(self):\n pass", "def is_prime(value):\n if value < 4:\n return True\n \n lower_bound = 2\n upper_bound = value-1\n...
[ "0.8251294", "0.7981401", "0.794535", "0.78773165", "0.7870162", "0.7779645", "0.77755505", "0.77661145", "0.77396506", "0.77324396", "0.77158386", "0.77105474", "0.7694114", "0.7672864", "0.7660135", "0.7650814", "0.76269066", "0.76167756", "0.7599302", "0.75861603", "0.7584...
0.81013525
1
Get all prime factors of the given value
def factors(value: int) -> list: prime_factors: list = [] for i in range(2, value + 1): if i > 2 and i % 2 == 0 or not is_prime(i): continue while value % i == 0: value = int(value / i) prime_factors.append(i) if value == 1: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime_factors_of(value):\n\n # Okay, so we need to \"solve\" two problems here:\n # is a given number a factor of `value`?\n # and\n # is a given number PRIME?\n\n # I think the simplest non-stupid approach is to generate all \n # FACTORS OF VALUE, and then check to see which are prime!\n ...
[ "0.8195275", "0.8172038", "0.78768766", "0.78615814", "0.78161514", "0.7815678", "0.78074765", "0.7803163", "0.7796986", "0.7784412", "0.77701026", "0.7747795", "0.77219456", "0.7687131", "0.766128", "0.76611435", "0.76522994", "0.7594097", "0.75423145", "0.7516391", "0.75087...
0.85676354
0
Sets up the connection. Will optionally accept a size or else will use a chunked TransferEncoding.
def setup(self, size=None): if size: self.size = size if not self.size: self.size = UNKNOWN_LENGTH self.body.length = self.size req = self.conn.make_request('PUT', self.url, headers=self.headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def _send_connection_init(self, request: Request) -> None:\n # Need to set these manually here instead of manipulating via\n # __setitem__() otherwise the H2Connection will emit SettingsUpdate\n # frames in addition to sending the undesired defaults.\n self._h2_state.local_setting...
[ "0.5874525", "0.58596337", "0.57424444", "0.57155627", "0.571499", "0.5675915", "0.566236", "0.5662341", "0.56123924", "0.5471748", "0.5447842", "0.5433867", "0.5358979", "0.53248644", "0.53098845", "0.52834433", "0.5279242", "0.5220655", "0.5175288", "0.51495194", "0.5126971...
0.7370442
0
Sends a chunk of data.
def send_chunk(self, chunk): print "ChunkedTwistedConnection: send chunk" return self.body.send(chunk)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_chunk(chunk, send_socket):\n length = len(chunk)\n data = str(length).zfill(MAX_CHUNK_SIZE).encode() + chunk\n send_socket.send(data)", "def send_chunk(chnk, sock):\n length = len(chnk)\n data = str(length).zfill(MAX_CHUNK_SIZE).encode() + chnk\n sock.send(data)...
[ "0.78114295", "0.7532161", "0.7232472", "0.71928585", "0.7086782", "0.7002679", "0.6989813", "0.69814444", "0.69016576", "0.68666893", "0.68550235", "0.6853498", "0.67988867", "0.6783611", "0.67816645", "0.67800605", "0.6746048", "0.6729257", "0.6725598", "0.67044735", "0.670...
0.7723083
1
Calculate the distance and rotation to the edge of the desk
def getDistanceAndRotationToEdge(l, f, r): if DEBUG: print "lfr:", l,",",f,",",r # Maths help from: http://xaktly.com/MathNonRightTrig.html # - Specfically the law of cosines, but at least one of their # examples is wrong, but methods are correct... sigh. # # For triangle with forwar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getEdgeAngle():\n '''\n returns angle a\n a\n ◿\n b c\n '''\n ANGLE_OFFSET = 8 # How far off the angle measurements are in degrees.\n THRESHOLD = 220 # How much light must be reflected to 'notice' the desk.\n angle = 0\n while angle < panTilt.TLT_RANGE:\n ...
[ "0.6792521", "0.67125314", "0.6442544", "0.6154413", "0.5941092", "0.5854384", "0.58526313", "0.5838844", "0.58166885", "0.5809942", "0.57968384", "0.5790198", "0.5733752", "0.57309914", "0.5662172", "0.5659722", "0.5644403", "0.5641197", "0.5620599", "0.55770284", "0.5569615...
0.6808179
0
Given a value break it down by the ilk of node (usb or pci), the vendor, and the device or product.
def parse_value(value: str) -> Tuple[str, str, str]: value_pattern = r'^(usb|pci)\(([^:]{4}):([^:]{4})\)$' matches = re.match(value_pattern, value) assert matches, value ilk, vendor, device = matches.group(1), matches.group(2), matches.group(3) return ilk, vendor, device
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vendor_list():\n return ['nxos', 'eos', 'cumulus']", "def get_vendor(mac):\r\n return p.get_manuf(mac) or 'None'", "def bios_vendor(self):\n\t\treturn self.__info_dict['info']['bios_vendor']['value']", "def device_catalog_path_value_converter(value):\n paths = []\n for path in value:\n ...
[ "0.57974625", "0.5661134", "0.56355417", "0.55662423", "0.5533631", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5503334", "0.5413959", "0.53457385", "0.5296801", "0.52907497", "0.52587706", "0.52237445", "0.52177995", "0.52067405", "0.517088", "0.51611...
0.6276907
0
I have some docs
def docs():
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document(self):\n ...", "def get_docs(self):\n return self.retrieve_docstring()", "def get_docs(self):\n return self.retrieve_docstring()", "def get_docs(self):\n return self.retrieve_docstring()", "def docs(self):\n self._doc_info = DocumentationURL()\n self._...
[ "0.7454927", "0.7446354", "0.7446354", "0.7446354", "0.73413706", "0.7109946", "0.71089756", "0.7055562", "0.70452785", "0.69460195", "0.68773216", "0.6874397", "0.6845154", "0.6833291", "0.67916155", "0.66953266", "0.6682665", "0.66622543", "0.66396433", "0.66306525", "0.656...
0.87407255
0
Grava objetos em formato texto no arquivo de Indices.
def gravarArquivoIndices(indices): arq = open("arquivoIndices.txt", "w") for i in indices.indices: linha = i.codigo + "," + str(i.indice) + "," + str(i.excluido) + "\n" arq.write(linha) arq.close() return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj_index(self) -> str:\n return str(self._data[\"index\"])", "def WriteIndexContent(indexList, formatindex, fpindex):#{{{\n if formatindex == FORMAT_TEXT:\n numRecord = len(indexList[0])\n idList = indexList[0]\n v1 = indexList[1]\n v2 = indexList[2]\n v3 = index...
[ "0.56216776", "0.5584734", "0.55089396", "0.5442182", "0.53701806", "0.53672534", "0.5365042", "0.5347537", "0.53458637", "0.5334542", "0.5304593", "0.52780014", "0.52368265", "0.52331924", "0.5230119", "0.52129966", "0.51751065", "0.51676047", "0.5156888", "0.5112448", "0.51...
0.6343497
0
Return all row and column groups.
def get_regular_groups(self, grid, min=3): row_groups = self._get_row_groups(grid.grid, models.patterns.RowPattern, min) col_groups = self._get_row_groups(grid.grid.T, models.patterns.ColumnPattern, min) return row_groups + col_groups
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def groups(self, *columns):\n # TODO: This really needs to just use Pandas.MultiIndex, stack(),\n # and pivot(). I just need to rework the FactorExprNode stuff\n # to produce a MultiIndex; then, this DataCube can just pass\n # in self._expr.\n raise NotImplementedError", "def ...
[ "0.61957633", "0.6163433", "0.6040524", "0.5894949", "0.58843005", "0.58239186", "0.58054775", "0.5755542", "0.56944263", "0.56619304", "0.56394035", "0.56309", "0.56161165", "0.56100893", "0.55997294", "0.55897653", "0.5586745", "0.5579677", "0.55577207", "0.55577207", "0.55...
0.68432385
0
Delete acl in a secret.
def delete_acls_for_secret(cls, secret, session=None): session = cls.get_session(session=session) for entity in secret.secret_acls: entity.delete(session=session)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_acls_for_secret_model(cls, secret, session=None):\n cls.db_repo.delete_acls_for_secret(secret, session)", "def delete_acl(self, sg):\n self.security_group_driver.delete_acl(sg)", "def delete_secret_link(link_id):\n\n Secret_Link.objects.filter(link_id=link_id).delete()", "def dele...
[ "0.7304661", "0.7133021", "0.6473207", "0.6455759", "0.6440277", "0.6435884", "0.64185977", "0.6405398", "0.63174623", "0.6266833", "0.6206975", "0.6191693", "0.61805665", "0.6168148", "0.6163188", "0.60189515", "0.59845203", "0.5972625", "0.59346336", "0.5915101", "0.5906380...
0.72501093
1
Updates a torch model so that input minibatches are parallelized across the batch dimension to utilise multiple gpus. If model parallel is set to True and execution is in test mode, then model is partitioned to perform full volume inference. This assumes the model has been created, that the optimizer has not yet been c...
def _adjust_for_gpus(cls, model: DeviceAwareModule, config: ModelConfigBase, model_execution_mode: ModelExecutionMode) -> DeviceAwareModule: if config.use_gpu: model = model.cuda() logging.info("Adjusting the model to use mixed precision training.") #...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_model_parallel(self, global_rank: int, world_size: int) -> None:\n app_state = AppState()\n\n # we initialize megatron-lm model parallel and data parallel groups\n # after initializing DDP with PTL.\n if app_state.model_parallel_size is not None:\n # destroy groups i...
[ "0.5936191", "0.56602675", "0.56224686", "0.5621566", "0.55595684", "0.54760945", "0.54551095", "0.54427326", "0.54231954", "0.54035556", "0.5396976", "0.53836715", "0.5365184", "0.53514045", "0.5305904", "0.5280321", "0.5267586", "0.5260385", "0.525179", "0.5249681", "0.5188...
0.70964164
0
Creates a model (with temperature scaling) according to the config given.
def create_model(self) -> None: self._model = create_model_with_temperature_scaling(self.config)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model_with_temperature_scaling(config: ModelConfigBase) -> Any:\n # wrap the model around a temperature scaling model if required\n model = config.create_model()\n if isinstance(config, SequenceModelBase) and config.temperature_scaling_config:\n model = ModelWithTemperature(model, config...
[ "0.8444309", "0.65563035", "0.637411", "0.6288527", "0.62518233", "0.622743", "0.622743", "0.6217139", "0.6207316", "0.6149929", "0.6077935", "0.6031471", "0.6030025", "0.6021649", "0.5992696", "0.59753346", "0.5956578", "0.5916777", "0.5907874", "0.5907593", "0.58919555", ...
0.8335938
1
Generates the model summary, which is required for model partitioning across GPUs, and then moves the model to GPU with data parallel/model parallel by calling adjust_model_for_gpus.
def create_summary_and_adjust_model_for_gpus(self) -> None: if self._model is None: raise ValueError("Model must be created before it can be adjusted.") if self.config.is_segmentation_model: summary_for_segmentation_models(self.config, self._model) # Prepare for mixed pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_and_print_model_summary(config: ModelConfigBase, model: DeviceAwareModule) -> None:\n random_state = RandomStateSnapshot.snapshot_random_state()\n # There appears to be a bug in apex, where previous use (in training for example) causes problems\n # when another model is later built on the CPU...
[ "0.7002343", "0.62532896", "0.62355524", "0.6192523", "0.61289847", "0.6088246", "0.59602416", "0.5950651", "0.59498066", "0.5881187", "0.588016", "0.5873111", "0.58373106", "0.5834648", "0.58186084", "0.58035755", "0.57857174", "0.57534796", "0.5750009", "0.5738947", "0.5732...
0.7819205
0
Creates an optimizer and loads its state from a checkpoint.
def try_create_optimizer_and_load_from_checkpoint(self) -> bool: self.create_optimizer() if self.checkpoint_path: return self.try_load_checkpoint_for_optimizer() return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_checkpoint(self, checkpoint: Dict[str, OrderedDict]):\n self.model.load_state_dict(checkpoint[\"model_state_dict\"])\n self.optimizer.load_state_dict(checkpoint[\"optimizer_state_dict\"])\n return self", "def create_optimizer(self) -> None:\n # Make sure model is created befo...
[ "0.7107619", "0.70649505", "0.7064646", "0.69969", "0.6977983", "0.6892563", "0.6793151", "0.67687976", "0.673699", "0.6716268", "0.65814966", "0.650589", "0.64456534", "0.64456534", "0.6368876", "0.632732", "0.6312547", "0.6301847", "0.62795025", "0.6267788", "0.623797", "...
0.71238905
0
Generates a human readable summary of the present segmentation model, writes it to logging.info, and stores the ModelSummary object inside the argument `model`.
def summary_for_segmentation_models(config: ModelConfigBase, model: DeviceAwareModule) -> None: assert isinstance(model, BaseModel) crop_size = config.crop_size if isinstance(crop_size, int): crop_size = (crop_size, crop_size, crop_size) try: model.generate_model_summary(crop_size, log_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_and_print_model_summary(config: ModelConfigBase, model: DeviceAwareModule) -> None:\n random_state = RandomStateSnapshot.snapshot_random_state()\n # There appears to be a bug in apex, where previous use (in training for example) causes problems\n # when another model is later built on the CPU...
[ "0.73806274", "0.7147296", "0.6999165", "0.6930897", "0.68741435", "0.6732777", "0.67200786", "0.6702313", "0.6616318", "0.65155643", "0.6488972", "0.6480176", "0.6442557", "0.64185977", "0.6416413", "0.6397906", "0.6342395", "0.63167113", "0.63136315", "0.6211133", "0.620451...
0.7225569
1
Create a model with temperature scaling by wrapping the result of config.create_model with ModelWithTemperature, if temperature scaling config has been provided, otherwise return the result of config.create_model
def create_model_with_temperature_scaling(config: ModelConfigBase) -> Any: # wrap the model around a temperature scaling model if required model = config.create_model() if isinstance(config, SequenceModelBase) and config.temperature_scaling_config: model = ModelWithTemperature(model, config.temperat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_model(self) -> None:\n self._model = create_model_with_temperature_scaling(self.config)", "def do_create_model(**kwargs):\n model_params = {\n 'name': kwargs['dag_run'].conf.get('model_name'),\n 'description': 'A custom DNN regressor model',\n 'regions': [REGION]\n }\n\n ...
[ "0.73296446", "0.57077694", "0.570612", "0.57056636", "0.56610817", "0.55574673", "0.54785675", "0.5419638", "0.53965676", "0.53905576", "0.538604", "0.538604", "0.5313637", "0.52842414", "0.52818054", "0.5228253", "0.5218954", "0.5209238", "0.52031755", "0.5201383", "0.51910...
0.8471851
0
Load twine from a .json filename, filelike or a json string and validates twine contents.
def _load_twine(self, source=None): if source is None: # If loading an unspecified twine, return an empty one rather than raising error (like in _load_data()) raw_twine = {} logger.warning("No twine source specified. Loading empty twine.") else: raw_twine ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_tweets(filename):\n\n try:\n with open(filename, 'r') as f:\n data = json.loads(f.read())\n except:\n print('ERROR in load_tweets.')\n\n return data", "def test_loader_loads_from_file():\n base_json = 'tests/test_json.json'\n json_test = {\"foo\": \"bar\"}\n as...
[ "0.64222986", "0.61474323", "0.6144654", "0.61129427", "0.6093864", "0.6074711", "0.6030403", "0.59984696", "0.59946185", "0.59418505", "0.59320986", "0.58631575", "0.5842694", "0.5824927", "0.57905143", "0.5786703", "0.5777964", "0.57755256", "0.5758631", "0.57461494", "0.57...
0.7133785
0
Get the schema for the given strand.
def _get_schema(self, strand): if strand == "twine": # The data is a twine. A twine *contains* schema, but we also need to verify that it matches a certain # schema itself. The twine schema is distributed with this packaged to ensure version consistency... schema_path = "sche...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_schema(self):\n self._pick()\n return Schema()", "def _get_schema_using_query(self, query: str) -> sch.Schema:\n return sch.Schema.from_tuples(self._metadata(query))", "def schema(self):\n return _parse_schema_resource(self._properties.get(\"schema\", {}))", "def get_sche...
[ "0.66698045", "0.6518725", "0.6390867", "0.6313399", "0.6210594", "0.62096435", "0.61262435", "0.61096203", "0.6025287", "0.5981262", "0.5939648", "0.5933518", "0.5902661", "0.58778864", "0.5872866", "0.58726424", "0.58520615", "0.58372164", "0.58244634", "0.5824207", "0.5819...
0.8233626
0
Validate that the installed version is consistent with an optional version specification in the twine file.
def _validate_twine_version(self, twine_file_twined_version): installed_twined_version = pkg_resources.get_distribution("twined").version logger.debug( "Twine versions... %s installed, %s specified in twine", installed_twined_version, twine_file_twined_version ) if (twine_fil...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_version(self):\n pass", "def validate_configurator_version():\n if settings.CONFIGURATOR_MODULE == \"bootmachine.contrib.configurators.salt\":\n pkgver = settings.SALT_AUR_PKGVER\n pkgrel = settings.SALT_AUR_PKGREL\n response = urllib2.urlopen(\"https://aur.archlinux.o...
[ "0.6902856", "0.6780541", "0.67345285", "0.6424998", "0.6407822", "0.64057225", "0.6383413", "0.6376578", "0.6337082", "0.6273863", "0.6264896", "0.62600714", "0.6233149", "0.62270665", "0.6219592", "0.61668104", "0.61236084", "0.6105264", "0.60952014", "0.60824794", "0.60168...
0.7964266
0
Check that all nonoptional datasets specified in the corresponding manifest strand in the twine are present in the given manifest.
def _validate_all_expected_datasets_are_present_in_manifest(self, manifest_kind, manifest): # This is the manifest schema included in the `twine.json` file, not the schema for `manifest.json` files. manifest_schema = getattr(self, manifest_kind) for expected_dataset_name, expected_dataset_schem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_manifest(manifest):\n if not manifest:\n raise Exception('manifest is null')\n\n for key in ['dublin_core', 'checking', 'projects']:\n if key not in manifest:\n raise Exception('manifest missing key \"{0}\"'.format(key))\n\n # check checking\n ...
[ "0.68781096", "0.5914848", "0.5894921", "0.58664596", "0.5797446", "0.5790559", "0.575301", "0.57257426", "0.56155634", "0.5589998", "0.55779296", "0.5571627", "0.55710405", "0.5568376", "0.55295604", "0.5499033", "0.5491544", "0.5466877", "0.54596764", "0.5446938", "0.542575...
0.7935964
0
Get the names of strands that are found in this twine.
def available_strands(self): return self._available_strands
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iter_strands(self):\n return iter(self.strand_list)", "def getStationsName(self) :\n names = []\n for sts in self._stations :\n names.append(sts.getName())\n\n return names", "def get_well_aliases(self):\n return self.info_wells['well'].unique()", "def list_a...
[ "0.6584263", "0.65621185", "0.63851863", "0.62019277", "0.61951375", "0.60891676", "0.60425985", "0.6007916", "0.59496164", "0.59036535", "0.5884974", "0.58607626", "0.57966846", "0.57783294", "0.5773814", "0.5770074", "0.57655287", "0.5721144", "0.5684944", "0.5684944", "0.5...
0.71010107
0
Get the names of the manifest strands that are found in this twine.
def available_manifest_strands(self): return self._available_manifest_strands
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_strands(self):\n return self._available_strands", "def list_manifests():\n import enaml\n with enaml.imports():\n from .pulses.manifest import PulsesManagerManifest\n from .tasks.manifest import PulsesTasksManifest\n from .measure.manifest import PulsesMeasureManif...
[ "0.6490598", "0.61462444", "0.6061251", "0.6059069", "0.59545153", "0.59168273", "0.5911148", "0.5903504", "0.5897712", "0.5851716", "0.58406675", "0.5829558", "0.58154243", "0.5781835", "0.57704556", "0.57661283", "0.57341903", "0.56977165", "0.56977165", "0.56939626", "0.56...
0.7861807
0
Validate that the children values, passed as either a file or a json string, are correct.
def validate_children(self, source, **kwargs): # TODO cache this loaded data keyed on a hashed version of kwargs children = self._load_json("children", source, **kwargs) self._validate_against_schema("children", children) strand = getattr(self, "children", []) # Loop the childr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_json(self):\n pass", "def validate_data(self, data):\n # TODO use schema\n assert \"file_contents\" in data, data\n assert \"type\" in data, data", "def _validate(self, path, obj):\r\n if isinstance(obj, str):\r\n if path[-1] != \"pattern\":\r\n ...
[ "0.6158009", "0.6144193", "0.5932691", "0.5760641", "0.56944185", "0.56927955", "0.5685668", "0.56744194", "0.56555223", "0.5653026", "0.5635682", "0.559688", "0.55957067", "0.5592181", "0.5564809", "0.5561077", "0.55481446", "0.55238324", "0.551551", "0.5502962", "0.5483416"...
0.6725077
0
Validate that all credentials required by the twine are present. Credentials must be set as environment variables, or defined in a '.env' file. If stored remotely in a secrets manager (e.g. Google Cloud Secrets), they must be loaded into the environment before validating the credentials strand. If not present in the en...
def validate_credentials(self, *args, dotenv_path=None, **kwargs): if not hasattr(self, "credentials"): return set() # Load any variables from the .env file into the environment. dotenv_path = dotenv_path or os.path.join(".", ".env") load_dotenv(dotenv_path) for cre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _validate_credentials(self):\n\n # There should be a client_id and client secret\n return \"client_id\" in self.credentials.keys() and \"client_secret\" in self.credentials.keys() \\\n and self.credentials[\"client_id\"] and self.credentials[\"client_secret\"]", "def check_credent...
[ "0.661287", "0.64161855", "0.6251266", "0.61858857", "0.61782354", "0.6148377", "0.61406416", "0.6052758", "0.6034112", "0.6033556", "0.60107875", "0.60107875", "0.60083914", "0.6002498", "0.5968834", "0.59106755", "0.5909878", "0.5885369", "0.585459", "0.5849183", "0.5843529...
0.7446492
0
Validate monitor message against the monitor message schema strand.
def validate_monitor_message(self, source, **kwargs): return self._validate_values(kind="monitor_message", source=source, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self):\n\n # Check if motherboard record exists\n motherboard_record_exists = False\n board_info_records = self.groups[constants.RecordType.BASEBOARD_RECORD]\n for handle_id in board_info_records:\n record = self.records[handle_id]\n if 'Type' in record.props and record.props['Ty...
[ "0.6137711", "0.60649383", "0.60399437", "0.60151976", "0.5827821", "0.5748296", "0.5649671", "0.56458515", "0.550159", "0.54282165", "0.5421623", "0.54128164", "0.54105055", "0.5404401", "0.5385656", "0.5354246", "0.53523284", "0.5333825", "0.5331712", "0.53300637", "0.53206...
0.73682123
0
Validate the output manifest, passed as either a file or a json string.
def validate_output_manifest(self, source, **kwargs): return self._validate_manifest("output_manifest", source, **kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_manifest(manifest_json):\n manifest_json = copy.deepcopy(manifest_json)\n for field in [\"schemes\", \"host\", \"basePath\", \"info\"]:\n if field not in manifest_json:\n raise exceptions.ValidationError(\n click.style(\"Field '{}' is missing from the manifest fi...
[ "0.689081", "0.67470354", "0.6491389", "0.6478711", "0.64743024", "0.6428948", "0.642016", "0.6391841", "0.63199776", "0.6262872", "0.5994585", "0.59788805", "0.5946266", "0.5936269", "0.5893858", "0.58807135", "0.58602494", "0.5850808", "0.5838025", "0.5832804", "0.5797433",...
0.7151388
0
Getter that will return cls[name] if cls is a dict or cls otherwise
def _get_cls(name, cls): return cls.get(name, None) if isinstance(cls, dict) else cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(cls, name):\n cls.initialize()\n if isinstance(name, cls):\n return name\n else:\n return cls.mapping[name]", "def getInstacefromcls(cls, clsname, valuedict=None):\n for i in range(len(clslist)):\n if clsname == clslist[i]:\n ret...
[ "0.7089814", "0.68150103", "0.6775328", "0.6689568", "0.65000015", "0.6219528", "0.6086408", "0.60403633", "0.6031711", "0.6026237", "0.5955669", "0.5954231", "0.5952677", "0.5952677", "0.59358865", "0.5935747", "0.59133816", "0.5905671", "0.58998924", "0.5898058", "0.5878466...
0.8500315
0
Validate a single strand by name.
def validate_strand(self, name, source, **kwargs): return self.validate({name: source}, **kwargs)[name]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(name):\n return bool(name)", "def validated_name(cls, name):\n if (name[:5] == 'hive-'\n and name[5] in ['1', '2', '3']\n and re.match(r'^hive-[123]\\d{4,6}$', name)):\n return name\n return None", "def check_schema_name(name: str):\n if...
[ "0.62414205", "0.6123533", "0.60466254", "0.59945595", "0.5968563", "0.5950491", "0.5935591", "0.5917729", "0.5904584", "0.58871233", "0.5855124", "0.5852563", "0.58318865", "0.5813858", "0.5813858", "0.58076316", "0.57668716", "0.576247", "0.5755813", "0.57409114", "0.573586...
0.67900914
0
Ensure that the nonce is correct, less than one hour old, and not more than two minutes in the future Callers should also store used nonces and reject messages with previouslyused ones.
def verify_and_burn_nonce(nonce): ret = re.match(r'^001[2-9][0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])' r'T([01][0-9]|2[0-3])(:[0-5][0-9]){2}Z[A-Za-z0-9]{6}$', nonce) if ret: date = parser.parse(nonce[3:-6]) now = datetime.utcnow().replace(tzinfo=tz.tzutc()) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validateNonce(lastNonce, lastHash, nonce):\n sha = hashlib.sha256(f'{lastNonce}{lastHash}{nonce}'.encode())\n return sha.hexdigest()[:4] == '0000'", "def nonce():\n return random.randint(0, 4294967295)", "def nonce():\n return random.randint(0, 4294967295)", "def _nonce():\n re...
[ "0.65487677", "0.6318106", "0.6318106", "0.63045347", "0.623894", "0.618787", "0.61794573", "0.6055988", "0.59781826", "0.59658813", "0.59374857", "0.59365934", "0.59196234", "0.5910003", "0.5893382", "0.5891976", "0.58326024", "0.5790357", "0.5772316", "0.5751489", "0.573236...
0.694894
0
Map Juniper SRX Policy Object into xml config element
def to_xml(self): policy_element = create_element('policy') create_element('name', text=self.name, parent=policy_element) match_element = create_element('match', parent=policy_element) for s in self.src_addresses: create_element('source-address', text=s.name, parent=match_el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _wrap_policy(policy_doc):\n return {\"IAMPolicy\": policy_doc}", "def get_config(self):\n config = super(Sc2Policy, self).get_config()\n config['eps'] = self.eps\n config['testing'] = self.testing\n return config", "def translate_policy(policy: dict):\n if 'PolicyN...
[ "0.58459353", "0.57357043", "0.52592963", "0.52169687", "0.5177298", "0.5132841", "0.5117141", "0.5053394", "0.50252014", "0.50223446", "0.5019244", "0.50055027", "0.49536827", "0.4945237", "0.49375263", "0.49065456", "0.49007678", "0.48749763", "0.48602158", "0.48564184", "0...
0.6687791
0
Creates a new ColumnInfo and update the size
def update(self, size) -> 'ColumnInfo': return ColumnInfo( size, self.directive, self.period )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AddColumnInfo(self, colInfo):\r\n \r\n self._columns.append(colInfo)\r\n self._total_col_width += colInfo.GetWidth()\r\n self._owner.AdjustMyScrollbars()\r\n self._owner._dirty = True", "def AddColumnInfo(self, colInfo):\r\n\r\n self._header_win.AddColumnInfo(colInfo...
[ "0.6953581", "0.6563744", "0.63662314", "0.62849265", "0.6020931", "0.5901503", "0.5833289", "0.58037275", "0.5675224", "0.5647959", "0.56247205", "0.5617577", "0.55949396", "0.5576177", "0.55671567", "0.5556555", "0.5535544", "0.55261594", "0.55159014", "0.5498711", "0.54230...
0.76685566
0
Simply copy metadata from source to target
def copy_stock_metas( meta_source, target, copy_columns_info=True, ) -> None: set_attr( target, KEY_ALIAS_MAP, copy(getattr(meta_source, KEY_ALIAS_MAP)) ) if copy_columns_info: set_attr( target, KEY_COLUMNS_INFO_MAP, deepcopy(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _copy_metadata(from_dir, to_dir):\n if not FLAGS.dry_run:\n tf.io.gfile.makedirs(to_dir)\n for fname in tfds.core.utils.list_info_files(from_dir):\n from_path = os.path.join(from_dir, fname)\n to_path = os.path.join(to_dir, fname)\n logging.info('cp %s %s', from_path, to_path)\n if not FLAGS.d...
[ "0.7023326", "0.6726561", "0.65834624", "0.6537077", "0.64390403", "0.62709254", "0.62083226", "0.61535376", "0.60626066", "0.60160655", "0.60077727", "0.59770507", "0.59708804", "0.5922094", "0.5846591", "0.57966024", "0.57608265", "0.57467353", "0.56573725", "0.56544816", "...
0.7013717
1
Get list of all public modules relative to a path.
def get_public_modules(path, base_package=None): result = [] for subdir, _, files in os.walk(path): # Skip folders that start with _. if any([part.startswith('_') for part in subdir.split(os.path.sep)]): continue _, rel_dir = subdir.split(path) rel_dir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moduleList(path):\n\n if os.path.isdir(path):\n folder_list = os.listdir(path)\n elif path.endswith('.egg'):\n try:\n folder_list = [f for f in zipimporter(path)._files]\n except:\n folder_list = []\n else:\n folder_list = []\n #folder_list = glob.g...
[ "0.68155396", "0.6617278", "0.6521537", "0.6507804", "0.64241713", "0.6303963", "0.62988365", "0.62711245", "0.6268034", "0.62417346", "0.62394094", "0.61733466", "0.61073136", "0.60500586", "0.60428715", "0.6029033", "0.60251296", "0.600245", "0.59671587", "0.5930028", "0.59...
0.81640553
0
Get losses of last computation if existing
def get_losses(self): if self.loss is not None: return [self.loss] else: return []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def losses(self):\n pass", "def compute_loss(self):", "def build_losses(self):\n self.batch_losses = tf.squared_difference(self.predicted_rv, self.label)\n self.total_loss = tf.reduce_mean(self.batch_losses)", "def build_losses(self):\n self.batch_losses = tf.squared_difference(se...
[ "0.7297349", "0.69542986", "0.6948095", "0.6948095", "0.68919253", "0.6775551", "0.665083", "0.66488665", "0.6633766", "0.6528974", "0.6520181", "0.65189093", "0.6494421", "0.64789355", "0.64417124", "0.64047754", "0.6394247", "0.639117", "0.6388315", "0.631335", "0.62982076"...
0.7003179
1
Compute any branch of the stable or unstable submanifolds of a saddle. Accepts fixed point instances of class fixedpoint_2D.
def find_saddle_manifolds(fp, xname, ds=None, ds_gamma=None, ds_perp=None, tmax=None, max_arclen=None, ic=None, eps=None, ev_dirn=1, ic_ds=None, max_pts=1000, directions=(1,-1), which=('s', 'u'), other_pts=None, rel_scale=None, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exact_saddle(V,X,Y,Z,dim,Z0=None):\n #from all_functions import find_saddle,sum_of_e_field\n if dim==3:\n print \"here\"\n print find_saddle(V,X,Y,Z,3)\n [I,J,K]=find_saddle(V,X,Y,Z,3) # guess saddle point; Z0 not needed\n print I,J,K\n r0=[X[I],Y[J],Z[K]]\n if I...
[ "0.58253855", "0.56931674", "0.54437244", "0.5257577", "0.52070004", "0.51921296", "0.5183743", "0.5179858", "0.51775", "0.51654345", "0.5148147", "0.51285076", "0.51230913", "0.5090722", "0.5089123", "0.50647557", "0.5053416", "0.5052067", "0.50175494", "0.50117624", "0.4977...
0.57671916
1
Returned data frame should have trading_pair as index and include usd volume, baseAsset and quoteAsset
async def get_active_exchange_markets(cls) -> pd.DataFrame: async with aiohttp.ClientSession() as client: trading_pairs_response = await client.get(ASSET_PAIRS_URL) trading_pairs_response: aiohttp.ClientResponse = trading_pairs_response if trading_pairs_response.status != 2...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_df(self, typ='trades', improve=False):\n cols = ['date_open', 'date_close', 'symbol', 'style', 'volume', 'price_open', 'price_stop', 'price_limit', 'price_close', 'comment', 'magic', 'order_id_master', 'order_id_stop', 'order_id_limit', 'direction', 'price_diff', 'price_diff', 'price_diff_d', 'p...
[ "0.5413317", "0.5374446", "0.5327119", "0.5326608", "0.52844787", "0.5255842", "0.52381635", "0.52032465", "0.51819", "0.5160164", "0.5140268", "0.5139721", "0.5139721", "0.51213753", "0.50929576", "0.50690424", "0.50472456", "0.50343525", "0.501496", "0.49923664", "0.4983564...
0.56753194
0
Read a string from standard input, but prompt to standard error. The trailing newline is stripped.
def stderr_input(prompt: str = '', file: IO = sys.stdout) -> str: # pragma: no cover if file is sys.stdout: return input(prompt) try: stdin = sys.stdin except AttributeError: raise RuntimeError("stderr_input: lost sys.stdin") file.write(prompt) try: flush = file.flush except AttributeError: pass e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_input(prompt=\"\"):\n\n\ttry:\n\t\tresult = input(prompt)\n\t\treturn result\n\texcept KeyboardInterrupt:\n\t\tsys.exit()\n\texcept:\n\t\treturn \"\"", "def get_input(prompt):\n try:\n try:\n return raw_input(prompt)\n except NameError:\n return input(prompt)\n ...
[ "0.7439654", "0.723748", "0.70752895", "0.6913516", "0.68963534", "0.6866671", "0.68438375", "0.6834515", "0.67756915", "0.6763464", "0.6721034", "0.6602405", "0.65703905", "0.65552646", "0.65077746", "0.64992315", "0.64948124", "0.64894426", "0.64843607", "0.64575666", "0.64...
0.76236886
0
Return canonical form for control state.
def canonical_ctrl_state(ctrl_state, num_qubits): if not num_qubits: return '' if isinstance(ctrl_state, CtrlAll): if ctrl_state == CtrlAll.One: return '1' * num_qubits return '0' * num_qubits if isinstance(ctrl_state, int): # If the user inputs an integer, conv...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_state(self):\n return self.cleaned_data['state'].upper()", "def state(self) -> str:", "def native_value(self) -> str:\n if isinstance(self._state, Enum):\n return self._state.name.lower()\n return self._state.lower()", "def reflect_state(self, s):\n s[2:8] = r...
[ "0.6335245", "0.5661792", "0.56419164", "0.56038505", "0.55594033", "0.55442035", "0.5506558", "0.54213786", "0.54014575", "0.5394251", "0.5330471", "0.5314586", "0.52940786", "0.5290036", "0.52667534", "0.5218633", "0.5182664", "0.5157008", "0.5146271", "0.511659", "0.511659...
0.61829215
1
Return True if command cmd has a compute/uncompute tag.
def _has_compute_uncompute_tag(cmd): for tag in cmd.tags: if tag in [UncomputeTag(), ComputeTag()]: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _isCmdStandalone(tgen):\n features = getattr(tgen, 'features', [])\n otherFeatures = set(features) - set(('runcmd', ))\n return not otherFeatures and getattr(tgen, 'rule', None) is None", "def isOp(self):\n return True", "def is_cmd(self, name):\n \n return name in self.cmds",...
[ "0.581931", "0.5786073", "0.57732224", "0.5759559", "0.5728099", "0.5650557", "0.5638925", "0.5607169", "0.56052583", "0.55509794", "0.5506383", "0.55021065", "0.5499619", "0.54725796", "0.54692024", "0.546461", "0.5463064", "0.5448807", "0.5434303", "0.5420862", "0.5408913",...
0.9016012
0
Receive a list of commands.
def receive(self, command_list): for cmd in command_list: self._handle_command(cmd)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(self, command_list):\n for cmd in command_list:\n self._send_cmd_with_mapped_ids(cmd)", "def receive(self, command_list):\n for cmd in command_list:\n if not cmd.gate == FlushGate():\n self._add_cmd(cmd)\n\n # (try to) send on\n ...
[ "0.7666051", "0.7365854", "0.6984754", "0.69481695", "0.6923602", "0.6804654", "0.6704374", "0.6583639", "0.6574708", "0.6483976", "0.6443524", "0.6436", "0.64315933", "0.64236295", "0.6422955", "0.63806427", "0.63790524", "0.6377476", "0.63279116", "0.6277306", "0.62516063",...
0.8273917
0
Return the number of control qubits of the command object cmd.
def get_control_count(cmd): return len(cmd.control_qubits)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_commands(self):\n return len(self.commands)", "def count(self):\n return len(self._commands)", "def __len__(self):\n return len(self.commands)", "def length(self):\n return len(self._commands)", "def get_count_of_controls(self, recurse: bool) -> int:\n return len(...
[ "0.71016645", "0.7081369", "0.659699", "0.63224685", "0.6274492", "0.6267259", "0.6065778", "0.5953152", "0.59503293", "0.59498817", "0.5925458", "0.58802515", "0.5851433", "0.58106935", "0.5802685", "0.5787972", "0.57744926", "0.57360053", "0.5724881", "0.5709863", "0.569576...
0.91298246
0