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
Update the navigation property services in print. Update the navigation property services in print.
def update_services( self, print_service_id, # type: str body, # type: "models.MicrosoftGraphPrintService" **kwargs # type: Any ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthentication...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateScptRefs(self):\n for scpt in self.refs_scpt.keys():\n self.refs_scpt[scpt] = scpt.getRef()\n self.scptRefs = set(self.refs_scpt.values())", "def update(self):\n for object in reversed(self.addList):\n self.objects.append(object)\n ...
[ "0.52056175", "0.477599", "0.47441873", "0.4714739", "0.4714739", "0.47057602", "0.46874425", "0.46425647", "0.4608528", "0.46006417", "0.45826253", "0.4568615", "0.45354888", "0.45163587", "0.45129082", "0.44720852", "0.44717228", "0.44637182", "0.4438183", "0.44319624", "0....
0.5060978
1
Create new navigation property to shares for print. Create new navigation property to shares for print.
def create_shares( self, body, # type: "models.MicrosoftGraphPrinterShare" **kwargs # type: Any ): # type: (...) -> "models.MicrosoftGraphPrinterShare" cls = kwargs.pop('cls', None) # type: ClsType["models.MicrosoftGraphPrinterShare"] error_map = { 401:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_printer_shares(\n self,\n body, # type: \"models.MicrosoftGraphPrinterShare\"\n **kwargs # type: Any\n ):\n # type: (...) -> \"models.MicrosoftGraphPrinterShare\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"models.MicrosoftGraphPrinterShare\"]\n erro...
[ "0.52861536", "0.4686309", "0.46358755", "0.4605899", "0.45465153", "0.44421157", "0.44043243", "0.43372124", "0.43215021", "0.43174458", "0.4293261", "0.42837772", "0.4281874", "0.4281099", "0.4248604", "0.4245299", "0.42270178", "0.42220512", "0.41977164", "0.41643992", "0....
0.51828396
1
Create new navigation property to taskDefinitions for print. Create new navigation property to taskDefinitions for print.
def create_task_definitions( self, body, # type: "models.MicrosoftGraphPrintTaskDefinition" **kwargs # type: Any ): # type: (...) -> "models.MicrosoftGraphPrintTaskDefinition" cls = kwargs.pop('cls', None) # type: ClsType["models.MicrosoftGraphPrintTaskDefinition"] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_task_definitions(\n self,\n print_task_definition_id, # type: str\n select=None, # type: Optional[List[Union[str, \"models.Enum101\"]]]\n expand=None, # type: Optional[List[Union[str, \"models.Enum102\"]]]\n **kwargs # type: Any\n ):\n # type: (...) -> \"mod...
[ "0.5145057", "0.49115032", "0.48497966", "0.47197276", "0.46801388", "0.46516716", "0.46328866", "0.46023238", "0.45812285", "0.45470607", "0.4543493", "0.45232767", "0.45073426", "0.45030543", "0.44968712", "0.442651", "0.44144627", "0.4407998", "0.4406115", "0.43957642", "0...
0.5671165
0
Get taskDefinitions from print. Get taskDefinitions from print.
def get_task_definitions( self, print_task_definition_id, # type: str select=None, # type: Optional[List[Union[str, "models.Enum101"]]] expand=None, # type: Optional[List[Union[str, "models.Enum102"]]] **kwargs # type: Any ): # type: (...) -> "models.MicrosoftGrap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_ecs_task_definitions():\n tasks = ECS_MANAGER.list_ecs_task_definitions()\n if tasks:\n print(str_sep)\n print(\"Listing task definitions available in {}\".format(SESSION.region_name.upper()))\n print(\"{:50}{:20}\".format('Task', 'Version'))\n print(str_sep)\n\n f...
[ "0.6234582", "0.5776305", "0.57495385", "0.53581464", "0.5335625", "0.524848", "0.52329326", "0.52250206", "0.50932235", "0.5088548", "0.5087793", "0.5024729", "0.50170135", "0.49958098", "0.498683", "0.49760514", "0.49682623", "0.49366823", "0.48528007", "0.48422137", "0.478...
0.6272089
0
Update the navigation property taskDefinitions in print. Update the navigation property taskDefinitions in print.
def update_task_definitions( self, print_task_definition_id, # type: str body, # type: "models.MicrosoftGraphPrintTaskDefinition" **kwargs # type: Any ): # type: (...) -> None cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 40...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _update_tasks(self, tasks):\n\n self._print('Updating tasks {} with {} ...'.format(self._tasks, tasks))\n\n self._tasks.update(tasks)", "def _update_all_tasks(self) -> None:\n for task in self.tasks:\n task.update()", "def print_tasks(self):\n unformatted_rows = self....
[ "0.55822045", "0.5341378", "0.506771", "0.4881783", "0.48147187", "0.47885615", "0.47800353", "0.47464103", "0.4661839", "0.4654326", "0.4625851", "0.4544588", "0.4529572", "0.4522049", "0.44964138", "0.4496017", "0.44956166", "0.4487072", "0.44400227", "0.44370252", "0.44046...
0.55890465
0
Dump data to YAML, which supports OrderedDict.
def _yaml_dump(data): return yaml.dump(data, Dumper=_OrderedDumper, allow_unicode=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_dump(\n data, Dumper=None, allow_unicode: bool = True, **kwargs\n): # pylint: disable=invalid-name\n if Dumper is None:\n Dumper = OrderedDumper\n return yaml.dump(\n data, Dumper=Dumper, allow_unicode=allow_unicode, **kwargs\n )", "def dump_yaml(self, data, output):\n ...
[ "0.7798169", "0.76470315", "0.7642571", "0.74547535", "0.7164397", "0.7115349", "0.7076506", "0.69675344", "0.69375503", "0.68800414", "0.6765619", "0.6618539", "0.6607386", "0.6579059", "0.6579059", "0.6558913", "0.6419908", "0.6392849", "0.63374376", "0.63331854", "0.632608...
0.8192204
0
Return True if an attribute has a valid type, otherwise False. This will apply recursively to an attribute's attributes.
def is_valid_type(self, attr: Optional[str] = None) -> bool: try: self.validate_type(attr) except TypeError: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(self, attribute: Attribute) -> bool:\n return self.get_data_type() == attribute.type", "def has_attribute_type(self, attribute: str, typ: Optional[Type]) -> bool:\n if not self.has_attribute(attribute):\n return False\n\n attr_node = self.get_attribute(attribute).yaml...
[ "0.78103995", "0.72813314", "0.71222246", "0.71222246", "0.70933825", "0.70055455", "0.693027", "0.6914144", "0.6783055", "0.67419726", "0.6683708", "0.6474715", "0.6436015", "0.64046496", "0.62558943", "0.62339306", "0.6220854", "0.61872816", "0.61867917", "0.6105975", "0.60...
0.7928803
0
Adjust the timing of timestamped objects. This will apply recursively to an attribute's attributes.
def adjust_time( self: BaseType, func: Callable[[int], int], attr: Optional[str] = None ) -> BaseType: if attr is None: for attribute in self._attributes: self._adjust_time(func, attribute) else: self._adjust_time(func, attr) return self
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measure_time(target, attribute, func, *args, **kwargs):\n attributes = attribute.split(\".\")\n attribute = attributes.pop()\n target = reduce(getattr, attributes, target)\n start = timer()\n try:\n return func(*args, **kwargs)\n finally:\n value = getattr(target, attribute)\n ...
[ "0.57737684", "0.5632862", "0.5494352", "0.54923177", "0.5389393", "0.5389393", "0.53798777", "0.53486305", "0.53441674", "0.5340016", "0.531751", "0.53039336", "0.53033215", "0.52547175", "0.52139795", "0.5203053", "0.5201817", "0.5197925", "0.51893145", "0.51817805", "0.515...
0.71409726
0
Remove invalid items from list attributes, others left unchanged.
def remove_invalid( self: ComplexBaseType, attr: Optional[str] = None, recursive: bool = True, ) -> ComplexBaseType: if attr is None: for attribute in self._list_attributes: self._remove_invalid(attribute, recursive) elif attr in self._list_attribu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_remove_values(cls, cleaned_input, instance):\n remove_values = cleaned_input.get(\"remove_values\", [])\n for value in remove_values:\n if value.attribute != instance:\n msg = \"Value %s does not belong to this attribute.\" % value\n raise Validation...
[ "0.6361349", "0.62838423", "0.61892545", "0.61239946", "0.6072532", "0.5990588", "0.596005", "0.5902809", "0.5895732", "0.5884456", "0.58520967", "0.58251566", "0.576699", "0.57666254", "0.57666254", "0.5766544", "0.57514393", "0.57415366", "0.5735838", "0.5734968", "0.571747...
0.6328438
1
Gets list of available taxon slugs for given attributes
def _get_available_attrs_taxon_slugs(cls, attributes: List[FdqModelAttribute]) -> List[str]: available_taxon_slugs: List[str] = [] for attr in attributes: available_taxon_slugs.extend(attr.field_map) return available_taxon_slugs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_taxa(self, **kwargs):\n if \"oids\" not in kwargs and \"labels\" not in kwargs:\n raise TypeError(\"Need to specify taxa oid's or labels\")\n oids = kwargs.get(\"oids\", [])\n labels = kwargs.get(\"labels\", [])\n taxa = []\n for oid in oids:\n t = s...
[ "0.62560797", "0.5843211", "0.5672292", "0.5521571", "0.5469094", "0.545953", "0.5435174", "0.5418336", "0.53971124", "0.52830404", "0.5206721", "0.52039826", "0.51855385", "0.51622546", "0.51615846", "0.5142129", "0.5132997", "0.5125577", "0.5045392", "0.5040304", "0.5011136...
0.83314764
0
Validate that each taxon slug is used at most once in the list of attributes
def validate_unique_taxon_slugs(cls, values): if 'attributes' in values: # count occurrence of each taxon slug in attributes attributes: List[FdqModelAttribute] = values['attributes'] taxon_slugs = cls._get_available_attrs_taxon_slugs(attributes) taxon_slugs_coun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_identifiers_correct_taxons(cls, values):\n if 'attributes' in values and 'identifiers' in values:\n attributes: List[FdqModelAttribute] = values['attributes']\n identifiers: List[str] = values['identifiers']\n\n # get set of available taxon slugs\n av...
[ "0.65743077", "0.5968016", "0.59334886", "0.593111", "0.5927378", "0.58089435", "0.5805196", "0.57898086", "0.5663472", "0.5587259", "0.55410296", "0.54817975", "0.547004", "0.5464735", "0.5454236", "0.5441391", "0.5432406", "0.5395761", "0.53333473", "0.5292971", "0.528695",...
0.80330855
0
Validates that model attributes contain correct TEL expressions without cyclic dependencies
def validate_model_attributes_tel(cls, values): if 'attributes' in values: attributes: List[FdqModelAttribute] = values['attributes'] # get set of available taxon slugs available_taxon_slugs = set(cls._get_available_attrs_taxon_slugs(attributes)) # our TEL visito...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_attributes(self, attrs):\n self.attrs.validate(attrs)", "def validate_attribute(self, attr):\n self.attrs.validate_attribute(attr)", "def validate_attribute(self, attr):\n self.validate(attr)", "def _obj_attr_validator( # pylint: disable=too-many-arguments\n object_name:...
[ "0.6086189", "0.5710481", "0.5692824", "0.559506", "0.5571307", "0.548958", "0.54329455", "0.54117227", "0.53911394", "0.53899544", "0.53848624", "0.53848624", "0.5369892", "0.5343006", "0.53288186", "0.53233105", "0.52718973", "0.5271803", "0.5263592", "0.5230621", "0.522486...
0.6568899
0
Check list of fields in joins against all available taxons on model.
def validate_joins_correct_taxons(cls, values): if 'attributes' in values and 'joins' in values: attributes: List[FdqModelAttribute] = values['attributes'] joins: List[FdqModelJoin] = values['joins'] # get set of available taxon slugs available_taxon_slugs = set(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available(self):\n fields = self._meta.get_fields()\n\n for field in fields:\n if isinstance(field, models.ManyToManyRel):\n attr = field.get_accessor_name()\n\n if getattr(self, attr).count() > 0:\n return False\n\n elif isin...
[ "0.5716577", "0.5690752", "0.5353701", "0.53401566", "0.5238511", "0.52149445", "0.515485", "0.51326126", "0.5096266", "0.5083344", "0.5073783", "0.5030737", "0.50157", "0.49969763", "0.49925125", "0.496842", "0.4958986", "0.49469942", "0.4899754", "0.48933235", "0.48739576",...
0.7003824
0
Check list of identifiers against all available taxons on model.
def validate_identifiers_correct_taxons(cls, values): if 'attributes' in values and 'identifiers' in values: attributes: List[FdqModelAttribute] = values['attributes'] identifiers: List[str] = values['identifiers'] # get set of available taxon slugs available_tax...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_taxa(self, **kwargs):\n if \"taxa\" not in kwargs and \"oids\" not in kwargs and \"labels\" not in kwargs:\n raise TypeError(\"Need to specify `taxa`, `oids` or `labels` list.\")\n taxa = set(kwargs.get(\"taxa\", []))\n oids = set(kwargs.get(\"oids\", []))\n labels =...
[ "0.5959546", "0.5623623", "0.5571614", "0.54068583", "0.54007125", "0.53843564", "0.53759086", "0.5344634", "0.5308052", "0.528676", "0.52811086", "0.5273162", "0.5246677", "0.5235604", "0.5228496", "0.5165709", "0.51461434", "0.5132584", "0.51072395", "0.510238", "0.50868255...
0.7016716
0
Method of SaintLesque/Schepers to distribute seats votes = list of votes
def distributeSeats(total_seats, votes, debug=False, steps=1): seats=[0]*len(votes) total_votes = np.array(votes).sum() d = round(total_votes/total_seats, 0) assigned_seats = 0 while assigned_seats != total_seats: i = 0 for e in votes: seats[i] = round(e/d, 0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_seat_assignment():\n parties = get_sorted_parties()\n allocated_seats = get_sorted_allocated_seats() \n #list(zip(parties, allocated_seats))\n #pandas.concat([parties, allocated_seats], axis=1)\n distributed_seats = []\n for i in range(0, len(parties)):\n list_votes2 = get_sor...
[ "0.6186161", "0.55241674", "0.5510613", "0.54928535", "0.53502405", "0.52477694", "0.5246096", "0.5230471", "0.5179617", "0.5179617", "0.511548", "0.5108267", "0.5023458", "0.49894318", "0.4986476", "0.49607322", "0.49202275", "0.49162194", "0.49080694", "0.4887515", "0.48804...
0.72480005
0
Return the number of votes value as a number. Depending on the vote type, 1st or 2nd votes are returned.
def numberofvotes(record, votetype): if (votetype == 1): value = record['erststimmen'] elif (votetype == 2): value = record['zweitstimmen'] else: raise ('Invalid votetype provided. Parameter value must be 1 or 2.') if value == '-': return 0 return int(value)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_votes(self):\n return sum(self.votes_per_count)", "def count_votes(self):\n return self.annotate(sum=Sum('value'))", "def count_upvotes(self):\n return self.filter(value=1).count()", "def t(p, vote_count):\n return vote_count[p]", "def evaluateVoteCount(toCompare):\n\n #w...
[ "0.7046721", "0.69320077", "0.64479935", "0.6445246", "0.6421509", "0.6401795", "0.62980145", "0.6255682", "0.62249494", "0.61506885", "0.6065528", "0.60515994", "0.60392594", "0.6011186", "0.59549886", "0.5930976", "0.59255874", "0.58896184", "0.58039486", "0.5762207", "0.57...
0.75620496
0
returns alphabetically sorted list of parties
def get_sorted_parties(): return list(dfSeatsPerPartyBy2ndVotes.sort_values(by=["party"])["party"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sorted():\n return sorted(country_list, key=get_pop_and_name)", "def get_people(self):\n return sorted(list(self.plist.keys()))", "def clients_sorted_by_name(self):\n rentals = self.get_list()\n rentals = sorted(rentals, key = lambda rental: rental.client.full_name)\n ret...
[ "0.6733721", "0.6340795", "0.62988514", "0.62180257", "0.6207776", "0.6170243", "0.60070765", "0.59440976", "0.5921248", "0.59084487", "0.5884037", "0.5858088", "0.58417654", "0.5839189", "0.5795835", "0.5792995", "0.57860404", "0.57793385", "0.57755154", "0.5755828", "0.5718...
0.717219
0
returns a list of allocated seats sorted by party
def get_sorted_allocated_seats(): return list(dfSeatsPerPartyBy2ndVotes.sort_values(by=["party"])["allocated_seats"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allocate_seats(constit, party_seats):\n constituencies = dict(constit)\n constituency_seats = {}\n for constituency, _ in constituencies.items():\n constituency_seats[constituency] = ''\n sorted_seats = sort_parties_by_seats(party_seats)\n for party, seats in sorted_seats:\n alloca...
[ "0.7138782", "0.6403223", "0.639168", "0.5833872", "0.57861584", "0.5698178", "0.5633167", "0.5604765", "0.5448866", "0.5396747", "0.52694094", "0.52560455", "0.5186727", "0.51847446", "0.5177663", "0.5152866", "0.5070866", "0.5058316", "0.50500154", "0.50088996", "0.49835032...
0.8360633
0
Distributes the total number of seats per party by 2nd votes.
def final_seat_assignment(): parties = get_sorted_parties() allocated_seats = get_sorted_allocated_seats() #list(zip(parties, allocated_seats)) #pandas.concat([parties, allocated_seats], axis=1) distributed_seats = [] for i in range(0, len(parties)): list_votes2 = get_sorted_votes2([...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distributeSeats(total_seats, votes, debug=False, steps=1):\n seats=[0]*len(votes)\n total_votes = np.array(votes).sum() \n d = round(total_votes/total_seats, 0)\n \n assigned_seats = 0\n while assigned_seats != total_seats: \n i = 0\n for e in votes:\n seats[i] = r...
[ "0.62307465", "0.56033283", "0.5483724", "0.54284436", "0.53296125", "0.5314998", "0.5310338", "0.5305902", "0.5232298", "0.51984274", "0.5194866", "0.51302296", "0.51231205", "0.50765413", "0.5059216", "0.5047439", "0.5006322", "0.4984975", "0.4977831", "0.49506813", "0.4899...
0.6118161
1
Create a mock object suitable for replacing confluent_kafka.Consumer which has a list_topics method which acts as if a predetermined set of topics exist.
def make_mock_listing_consumer(topics=[]): def get_topics(topic=None, timeout=None): nonlocal topics result = {} if topic is None: for topic in topics: result[topic] = MagicMock() # don't care much what value is result[topic].error = None # but i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_kafka_consumer(\n kafka_fixture_name: str,\n kafka_topics: Optional[List[str]] = None,\n seek_to_beginning: bool = False,\n scope: str = 'function',\n **consumer_kwargs\n) -> Callable[..., KafkaConsumer]:\n if kafka_topics is None:\n kafka_topics = []\n\n @pytest.fixture(scope=...
[ "0.6605228", "0.6418212", "0.6234094", "0.61997974", "0.61825895", "0.6142635", "0.6128908", "0.61017543", "0.6045486", "0.60094476", "0.6002151", "0.5979141", "0.59018415", "0.58984995", "0.58328545", "0.5803527", "0.5799088", "0.5792315", "0.57541776", "0.57241386", "0.5716...
0.85897976
0
decorator that raises an error if a fn is run used to mark sections of code as "legacy"
def legacy_code(func): @wraps(func) def wrapper(*args, **kwargs): msg = "{0} is legacy code".format(func.__name__) raise QError(msg) return wrapper
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obsolete(func, fail=True):\n\n def inner(*args, **kwargs):\n if not fail:\n logging.error('Called obsolete function %s' % func.__name__)\n return func(*args, **kwargs)\n raise ObsoleteError('Tried to call function %s but it is marked as obsolete' % func.__name__)\n\n r...
[ "0.67392856", "0.6506785", "0.6431633", "0.6427536", "0.64046365", "0.63920295", "0.63743603", "0.63304853", "0.6317589", "0.62874895", "0.6287107", "0.62396675", "0.6211268", "0.6200986", "0.6190534", "0.6165075", "0.61492383", "0.6097565", "0.6093927", "0.6078514", "0.60504...
0.7149867
0
set a Django field widget attribute
def set_field_widget_attributes(field, widget_attributes): for key, value in widget_attributes.items(): field.widget.attrs[key] = value if key == "class": # djangular overwrites widget classes using the built-in "widget_css_classes" attribute # so be sure to re-set it here ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def TCFieldWidget(field, request):\n widget = FieldWidget(field, TCWidget(request))\n # widget.label = u'' # don't show the label twice\n return widget", "def XMLTextFieldWidget(field, request):\n return FieldWidget(field, XMLTextWidget(request))", "def addattrs(field, my_attrs):\n my_attrs = m...
[ "0.65111285", "0.62745863", "0.6249279", "0.6230223", "0.6206397", "0.6205999", "0.61867696", "0.6174277", "0.612251", "0.60981774", "0.59975064", "0.5996624", "0.5969774", "0.59523904", "0.58594465", "0.5841845", "0.5819242", "0.5793698", "0.57847726", "0.57839906", "0.57712...
0.6904253
0
if this is a LazyObject, then get the actual object rather than the lazy indirection written in support of 523 to cope w/ pickling changes _after_ serializing a session (recall I cache stuff on the session)
def evaluate_lazy_object(obj): wrapped_obj = getattr(obj, LAZY_OBJECT_NAME, None) if wrapped_obj is None: # if it isn't a lazy object then just return the original object... return obj if wrapped_obj is uninitialized_lazy_object: # if it is a lazy object but, hasn't been initialized ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def obj(self):\n if not self._obj:\n self._get()\n return self._obj", "def itemFromProxy(obj):\n return object.__getattribute__(obj, '_sharedItem')", "def __self__(self):\n if self._ob is not None:\n return self._ob()", "def obj(self):\r\n return self._obj...
[ "0.64511096", "0.6139487", "0.60631067", "0.59895074", "0.5965974", "0.58726513", "0.5867599", "0.5861102", "0.5825755", "0.57879114", "0.57749474", "0.5773256", "0.5772455", "0.5748728", "0.5748728", "0.57446975", "0.5741606", "0.5738076", "0.571345", "0.56780285", "0.567802...
0.63453275
1
Validator function to use with fileFields. Ensures the file attempting to be uploaded matches a set of extensions.
def validate_file_extension(value, valid_extensions): if not value.name.split(".")[-1] in valid_extensions: raise ValidationError("Invalid File Extension.")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_extension(value):\n if (not value.name.endswith('.png') and\n not value.name.endswith('.jpeg') and\n not value.name.endswith('.gif') and\n not value.name.endswith('.bmp') and\n not value.name.endswith('.jpg')):\n\n text = _(\"Files allowed\")\n files = \".jpg,...
[ "0.7897772", "0.7662936", "0.7593943", "0.7567712", "0.75481987", "0.7404324", "0.73468167", "0.72607017", "0.71938854", "0.707316", "0.701128", "0.70094186", "0.6994248", "0.69769514", "0.69355", "0.69355", "0.6934976", "0.69339526", "0.69339526", "0.69339526", "0.69339526",...
0.8191283
0
Generates a list of all positions that the Queen can attack. Alternatively it may be good to use the elegant diagonal summation/difference checks.
def generateQueenAttacks(boardsize, pos): assert isinstance(pos, Position) and validatePosition(boardsize, pos) attackList = [] startPos = Position(pos.x, pos.y) def addAttackList(pos): for attacked in attackList: if pos.compare(attacked): return attackLi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moves(self):\n move_list = list()\n for i in range(self.n):\n row = self.queens[i][0]\n col = self.queens[i][1]\n for rd in [-1,0,1]:\n for cd in [-1,0,1]:\n if (rd == 0) and (cd == 0):\n continue\n ...
[ "0.75085545", "0.7238031", "0.72162753", "0.69097525", "0.68830097", "0.6834835", "0.6642358", "0.66276836", "0.6615933", "0.6517043", "0.6509062", "0.6507567", "0.6499198", "0.649662", "0.64962876", "0.6493829", "0.64880407", "0.6486416", "0.64808154", "0.6464777", "0.640126...
0.74447596
1
Tests whether pos is in valid_positions using the compare function in the Position class. This allows us to set two different objects equal. If it is, return the position pointer. Otherwise, return False.
def isInList(valid_positions, pos): assert isinstance(pos, Position) for position in valid_positions: if pos.compare(position): return position return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_position_exists(self, pos=None):\n if pos is None:\n pos = self.draw.position\n return (pos[0] in self.range_of_valid_coordinates) and (pos[1] in self.range_of_valid_coordinates)", "def move_is_valid(self, pos):\n\n if (not isinstance(pos, tuple) or len(pos) != 2 or \n ...
[ "0.6746193", "0.66301435", "0.6584429", "0.65756834", "0.6544668", "0.65213627", "0.64284897", "0.64258605", "0.6366852", "0.63338536", "0.62852615", "0.62646544", "0.62159127", "0.6182148", "0.61781657", "0.6178161", "0.6168304", "0.61011946", "0.6100861", "0.6086811", "0.60...
0.67221254
1
Tries to place a queen in the position that is passed. Calls isInList to help it decide. Returns True if the queen was successfully place, False otherwise.
def placeQueen(valid_positions, pos, boardsize): if isInList(valid_positions, pos): #IS a valid position! invalid_positions = generateQueenAttacks(boardsize, pos) #update valid_positions for pos in invalid_positions: temp = isInList(valid_positions, pos) if temp: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(board, N):\n # when all the N queens are placed \n if N == 0:\n return True\n\n # cal dimension of board \n n = len(board[0])\n for i in range(n):\n for j in range(n):\n attacked = is_attacked(i, j, board) # checking if (i,j) is safe to place the queen \n ...
[ "0.6420456", "0.6292266", "0.6042101", "0.57444483", "0.5711553", "0.569694", "0.5641004", "0.5552675", "0.55362207", "0.54819834", "0.53560907", "0.53097683", "0.52483106", "0.5243161", "0.5211949", "0.519052", "0.516914", "0.51623195", "0.51597553", "0.5157929", "0.51412994...
0.73797727
0
The function returns a panda dataframe for the input channel artifacts. AWS SageMaker passes all values in FileMode from the S3 bucket into the train, test, and validation "channels" when starting your container. This function takes in the channel and merges all CSV files per channel into a dataframe for reading.
def input_as_dataframe(self, channel='training'): data_directories = { 'training', 'validation', 'testing' } if channel in data_directories: csv_files = glob.glob(os.path.join(f'/opt/ml/input/data/{channel}/*.csv')) print(f'Files in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_train_data(spark_session, sample_size, channels, sample_prob=1, normalize_class_distribution=False, seed=42):\n filename = \"train_{}{}{}_updated.parquet\"\n train_df = read_data(spark_session, filename, sample_size, channels, sample_prob, normalize_class_distribution, seed)\n return train_df", "def ...
[ "0.56002134", "0.5580284", "0.5487554", "0.54729915", "0.54723316", "0.53689516", "0.53628457", "0.53199345", "0.52421874", "0.5238083", "0.52218586", "0.5214587", "0.51922494", "0.5191581", "0.51565295", "0.5144537", "0.51300454", "0.5121978", "0.51176524", "0.5095419", "0.5...
0.74998736
0
Checks whether there are active recommendations for each category for the given marketplace, and if there are, returns the time when recommendations were last updated for each category.
def get_last_updated_time_for_recommendations(self, marketplace_id): return self.make_request( "GetLastUpdatedTimeForRecommendations", {"MarketplaceId": marketplace_id}, method="POST", )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_ok_to_update(self):\n current_time = int(time.time())\n last_refresh = self.last_refresh\n if last_refresh is None:\n last_refresh = 0\n if current_time >= (last_refresh + self.refresh_rate):\n return True\n return False", "def list_recommenda...
[ "0.48689032", "0.4762724", "0.47439244", "0.47338334", "0.4668525", "0.46228564", "0.4600863", "0.45566443", "0.45439604", "0.45418546", "0.45240474", "0.4514353", "0.45044154", "0.45044154", "0.45044154", "0.45044154", "0.45044154", "0.45044154", "0.45044154", "0.45004466", ...
0.600832
0
Returns your active recommendations for a specific category or for all categories for a specific marketplace. Pass `next_token` to call "ListRecommendationsByNextToken" instead.
def list_recommendations( self, marketplace_id=None, recommendation_category=None, next_token=None ): return self.make_request( "ListRecommendations", { "MarketplaceId": marketplace_id, "RecommendationCategory": recommendation_category, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_recommendations_by_next_token(self, token):\n return self.list_recommendations(next_token=token)", "def recommendations(self, **kwargs):\n\n path = self._get_movie_id_path('recommendations')\n resp = self._get_method(path, kwargs)\n return resp", "def get_recommendations(se...
[ "0.6757458", "0.59316045", "0.53259814", "0.5148535", "0.49028853", "0.47453037", "0.4716145", "0.47134882", "0.46941304", "0.46536207", "0.46397585", "0.46383676", "0.46056136", "0.45473558", "0.45473436", "0.45289943", "0.45214188", "0.45171258", "0.4443659", "0.43732527", ...
0.7668175
0
Alias for `list_recommendations(next_token=token)` instead.
def list_recommendations_by_next_token(self, token): return self.list_recommendations(next_token=token)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_recommendations(\n self, marketplace_id=None, recommendation_category=None, next_token=None\n ):\n return self.make_request(\n \"ListRecommendations\",\n {\n \"MarketplaceId\": marketplace_id,\n \"RecommendationCategory\": recommendation...
[ "0.6227083", "0.5611457", "0.55928564", "0.5550036", "0.5543547", "0.54899335", "0.54398435", "0.5348996", "0.52498764", "0.5179839", "0.5169776", "0.5147826", "0.51265526", "0.5100554", "0.50321686", "0.4914144", "0.49053377", "0.48637497", "0.4819782", "0.4819782", "0.48040...
0.8355562
0
open tunnel to redis server and start sender/receiver tasks
async def start(self): with SSHTunnelForwarder(**self.tunnel_config) as tunnel: address = tunnel.local_bind_address aredis = await aioredis.create_redis_pool(address, encoding="utf-8") logger.info(f"bridge connected: {aredis.address}") try: await...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run():\n\n assert SSH_HOST is not None, 'SSH_HOST not set. Please configure.'\n\n\n def connect():\n port = find_open_port(SSH_HOST)\n if init_tunnel(SSH_HOST, port):\n print 'Tunnel initialized, pid:', PID\n return {'ssh tunnel entry': 'ssh://{}:{}'.format(SSH_HOST, p...
[ "0.65094125", "0.636926", "0.6272023", "0.6137986", "0.61329263", "0.61177987", "0.61006737", "0.6098699", "0.60555124", "0.59931874", "0.5980451", "0.59593314", "0.5934894", "0.59215707", "0.5857913", "0.58315027", "0.5825562", "0.5810092", "0.5768256", "0.5762866", "0.57565...
0.70374256
0
A test runner for the app's Click commands.
def runner(app): return app.test_cli_runner()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runner() -> CliRunner:\n return click.testing.CliRunner()", "def runner(app):\n\n return app.test_cli_runner()", "def test_runner(self):\n run(HelloWorldApi, [\"/bin/test_api.py app_root/bin/libs\", \"app_root/bin/libs\"], sys.stdin.buffer,\n sys.__stdout__.buffer)", "def runner()...
[ "0.7855431", "0.77106535", "0.68480515", "0.67668295", "0.6669386", "0.6475", "0.64695936", "0.64695936", "0.63834995", "0.6270718", "0.6234035", "0.6231622", "0.6230506", "0.6221766", "0.6186083", "0.61765647", "0.61760014", "0.61495066", "0.6146101", "0.6142871", "0.6096929...
0.77260715
1
A test marker named "smoke" is used to run only a subset of tests Feel free to create your own markers. Add them to your tests with a ".mark.mymarker" and run only those tests with 'pytest m 'mymarker'
def pytest_configure(config): config.addinivalue_line( "markers", "smoke" )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pytest_pilot_markers():", "def case(*ids):\n return pytest.mark.testrail(ids=ids)", "def runtests(ctx):\n run('pytest -s tests', pty=pty_available)\n run('flake8 --ignore E265,E266,E501 --exclude src, lib', pty=pty_available)", "def spec_tests():\n pass", "def test_markers(f):\n ...
[ "0.680616", "0.62240934", "0.6152068", "0.6072265", "0.60588026", "0.6049441", "0.5862266", "0.5828549", "0.57791716", "0.5772465", "0.5752862", "0.57491755", "0.57372534", "0.56901443", "0.56876606", "0.56696975", "0.56610435", "0.56579846", "0.5653875", "0.5643033", "0.5625...
0.71748304
0
Return the _id field of the current class. We cannot use the "_id" property (i.e. trip._id) because valid properties cannot start with an underscore. We can access it using trip["_id"] but that is cumbersome to use and can throw if the _id field does not exist (which may or may not be what we want). Let's abstract it o...
def get_id(self): return self["_id"]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_id(self):\n return self.id", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self.__id", "def _get_id(self):\n return self._...
[ "0.71313035", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754", "0.71026754"...
0.7405886
0
computes output shape after padding
def compute_output_shape(self, input_shape): output_shape = [0] * self.rank for d in range(self.rank): output_shape[d] = sum(self.paddings[d]) + input_shape[d] return tf.TensorShape(output_shape)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_output_shape(input_shape):\n shape_1 = input_shape[0]\n shape_2 = 90\n shape_3 = input_shape[2]\n\n return (shape_1, shape_2, shape_3)", "def compute_output_shape(self, s):\n return s[0], s[1] + 2 * self.padding[0], s[2] + 2 * self.padding[1], s[3]", "def get_output_shape(self):\n ...
[ "0.76141727", "0.71460515", "0.7127075", "0.70725465", "0.69714063", "0.6915575", "0.68842566", "0.6832676", "0.68002874", "0.6773313", "0.67546433", "0.6744123", "0.6714085", "0.6710998", "0.6694745", "0.66736597", "0.6663072", "0.66281855", "0.6554645", "0.6497201", "0.6481...
0.7320594
1
Custom implementation of the tf layer build method. Sets the shape of the random noise along the specified axis
def build(self, input_shape): shape = np.ones(len(input_shape), dtype=np.int32) shape[self._axis] = input_shape[self._axis] self._rand_shape = tf.constant(shape, dtype=tf.dtypes.int32)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def randn(*shape, **kwargs):\n return Tensor(np.random.randn(*shape), **kwargs)", "def build(self,input_shape):\n\n self.w = self.add_weight(shape=(input_shape[-1],self.units),\n initializer='random_normal',\n trainable=True)\n self.b = self.ad...
[ "0.6374517", "0.63439924", "0.6240142", "0.6123517", "0.60665405", "0.6052357", "0.59816384", "0.5958945", "0.5925781", "0.5909455", "0.59018105", "0.58936787", "0.5872386", "0.58613", "0.5829131", "0.58168006", "0.57844967", "0.57826954", "0.57500845", "0.5744017", "0.571286...
0.7089877
0
Assert that the shape of the input tensor is the expected 5D spatiotemporal shape
def _check_shape(input_shape): msg = ('Input to FlattenAxis must be 5D with dimensions: ' '(n_observations, n_spatial_0, n_spatial_1, n_temporal, ' 'n_features), but received shape: {}'.format(input_shape)) assert len(input_shape) == 5, msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(input_shape):\n msg = ('Input to SpatioTemporalExpansion must be 5D with dimensions: '\n '(n_observations, n_spatial_0, n_spatial_1, n_temporal, '\n 'n_features), but received shape: {}'.format(input_shape))\n assert len(input_shape) == 5, msg", "def tes...
[ "0.767875", "0.6563718", "0.64985377", "0.6418538", "0.64130336", "0.6398726", "0.63728774", "0.630607", "0.6295184", "0.629249", "0.6280885", "0.62366974", "0.62299126", "0.61740613", "0.61740327", "0.6142785", "0.6126741", "0.61242807", "0.6100432", "0.60915726", "0.6084971...
0.6978557
1
Assert that the shape of the input tensor is the expected 4D spatiotemporal shape
def _check_shape(input_shape): msg = ('Input to SpatialExpansion must be 4D with dimensions: ' '(n_observations, n_spatial_0, n_spatial_1, n_features), ' 'but received shape: {}'.format(input_shape)) assert len(input_shape) == 4, msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(input_shape):\n msg = ('Input to SpatioTemporalExpansion must be 5D with dimensions: '\n '(n_observations, n_spatial_0, n_spatial_1, n_temporal, '\n 'n_features), but received shape: {}'.format(input_shape))\n assert len(input_shape) == 5, msg", "def tes...
[ "0.71911967", "0.67564714", "0.670049", "0.65799737", "0.6575327", "0.6517123", "0.64665014", "0.64350545", "0.64287883", "0.6360004", "0.6293485", "0.6286067", "0.62737346", "0.62045807", "0.6179963", "0.6166289", "0.6125939", "0.6125699", "0.61026037", "0.6096365", "0.60823...
0.68198144
1
Assert that the shape of the input tensor is the expected 5D spatiotemporal shape
def _check_shape(input_shape): msg = ('Input to SpatioTemporalExpansion must be 5D with dimensions: ' '(n_observations, n_spatial_0, n_spatial_1, n_temporal, ' 'n_features), but received shape: {}'.format(input_shape)) assert len(input_shape) == 5, msg
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_shape(input_shape):\n msg = ('Input to FlattenAxis must be 5D with dimensions: '\n '(n_observations, n_spatial_0, n_spatial_1, n_temporal, '\n 'n_features), but received shape: {}'.format(input_shape))\n assert len(input_shape) == 5, msg", "def test_shape(self...
[ "0.697913", "0.65635157", "0.6497553", "0.64191765", "0.6413171", "0.63976014", "0.6373584", "0.6307098", "0.6297198", "0.6292825", "0.62823594", "0.62372994", "0.62291473", "0.61750543", "0.6174745", "0.6141534", "0.61258924", "0.61253655", "0.6100978", "0.6091626", "0.60870...
0.7679232
0
Build the SqueezeAndExcitation layer based on an input shape
def build(self, input_shape): self._n_channels = input_shape[-1] self._dense_units = int(np.ceil(self._n_channels / self._ratio)) if len(input_shape) == 4: pool_layer = tf.keras.layers.GlobalAveragePooling2D() elif len(input_shape) == 5: pool_layer = tf.keras.la...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _squeeze( inputs):\n input_channels = int(inputs.shape[-1])\n\n x = GlobalAveragePooling2D()(inputs)\n x = Dense(input_channels, activation='relu')(x)\n x = Dense(input_channels, activation='hard_sigmoid')(x)\n return x", "def SqueezeNet(input_shape=(224...
[ "0.62610316", "0.6183013", "0.6175946", "0.61648756", "0.60825264", "0.60796523", "0.60320926", "0.6001276", "0.5968941", "0.59427345", "0.5900571", "0.5879365", "0.5879365", "0.5879365", "0.58451587", "0.5822561", "0.57939166", "0.57673603", "0.5745453", "0.5732177", "0.5721...
0.7372575
0
concatenates a hiresolution feature to the input tensor x in the middle of a sup3r resolution network.
def call(self, x, hi_res_feature): return tf.concat((x, hi_res_feature), axis=-1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_feature(x, x1):\n if x is None:\n x = x1\n else:\n x = np.concatenate((x, x1), axis=1)\n return x", "def forward(self, x_conv_out: torch.Tensor) -> torch.Tensor:\n x_proj = F.relu(self.proj(x_conv_out))\n x_gate = torch.sigmoid(self.gate(x_conv_out))\n x_highwa...
[ "0.6034361", "0.5986766", "0.5870083", "0.58451366", "0.577961", "0.5670602", "0.56492305", "0.5633024", "0.53897166", "0.5371125", "0.53708494", "0.5368953", "0.5363347", "0.53163177", "0.5294121", "0.5290483", "0.5279402", "0.5279402", "0.5259506", "0.525445", "0.5245808", ...
0.7315015
0
Keep series to be added in the db based on not been in series and have freq
def _cleasing(series: Optional[dict], freq:list) -> dict: if series is not None: if series["freq"] in freq: if series["final"].year == 2021: if series["fonte"] in fonte_in: if str(series["number"]) not in remove['tickers']: return serie...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ts_check_frequency(self):\n if self.ts_df.index.freq is None:\n self._uvts_cls_logger.info(\"No specific frequency detected.\")\n self._uvts_cls_logger.info(\"Frequency chosen in initialization: \" + str(\n self.freq) + \" enter 'n' and call ts_resample() if you are ...
[ "0.5726502", "0.5679235", "0.5555176", "0.55462915", "0.5373807", "0.53481096", "0.53470653", "0.53257716", "0.5324926", "0.532478", "0.5263858", "0.5252361", "0.52493316", "0.5245782", "0.52219915", "0.51781195", "0.51664275", "0.5162759", "0.5158153", "0.51567346", "0.51484...
0.6278065
0
process resp from suds response (last observation) and grabs information for the series
def _process_info(resp: suds.sudsobject) -> dict: last = resp.ultimoValor return dict(fonte = str(resp.fonte), gestor = str(resp.gestorProprietario), freq = str(resp.periodicidadeSigla), nome = str(resp.nomeCompleto), number = int(resp.oid), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_serieses(parsed_response: dict) -> list:\n serieses = parsed_response[\"message:GenericData\"][\"message:DataSet\"][\"generic:Series\"]\n if type(serieses) != list:\n serieses = [serieses]\n return serieses", "def get_series(params):\n response = generate_request(params)\n if respo...
[ "0.6158879", "0.60087264", "0.5986832", "0.5605868", "0.5602771", "0.55909127", "0.5586363", "0.55628216", "0.5537049", "0.5475821", "0.5453993", "0.54405534", "0.5413769", "0.54081506", "0.5394293", "0.53770554", "0.53512913", "0.53332907", "0.532174", "0.5290337", "0.528562...
0.61579174
1
Generates the final list of series to be used (inserted) in the database. Raw input (by side effect) comes from file codigos.xlsx
def final_series(): tickers = pd.read_excel(os.path.abspath(os.path.dirname(__file__)) +"./codigos.xlsx", header=[0]).values.flatten() # tickers = pd.read_excel("./codigos.xlsx", # header=[0]).values.flatten() ls = fetch_series(list(set(tickers))) net_se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def series_ingestion(series:List[dict]) -> None:\n for srs in series:\n try:\n add_series(\"BCB.\" + str(srs['number']), \n srs['nome'], \n *gestores[srs['gestor']])\n except:\n logger.error(f\"Unable to add series BCB.{srs['number'...
[ "0.63566905", "0.59604704", "0.589756", "0.58577883", "0.5839274", "0.58158976", "0.5808274", "0.5788732", "0.57789326", "0.5719818", "0.56998694", "0.56896603", "0.56371063", "0.557891", "0.55630285", "0.5514822", "0.55077946", "0.5449205", "0.54456735", "0.54253983", "0.542...
0.69550884
0
add series for bcb into the database
def series_ingestion(series:List[dict]) -> None: for srs in series: try: add_series("BCB." + str(srs['number']), srs['nome'], *gestores[srs['gestor']]) except: logger.error(f"Unable to add series BCB.{srs['number']}")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_column(self, column_name, series):\n self.data[column_name] = pd.Series(series)", "def add_to_database(dataframe):\r\n \r\n # df.shape returns the number of columns and rows in a dataframe\r\n # So using the first value returned, we can cycle through each row in the dataframe (where each ...
[ "0.6130202", "0.5961946", "0.5830775", "0.5714348", "0.57038665", "0.56634265", "0.556326", "0.55575716", "0.54669654", "0.5381389", "0.53632724", "0.5322067", "0.5307755", "0.52783656", "0.5196585", "0.5154061", "0.5117939", "0.50698835", "0.5065572", "0.5061166", "0.5053288...
0.7271585
0
Static partition method. Performs partition by "plucking" (1 train_size) n messages out of the provided data set, and places them in a new test set.
def partition(data, device, train_size=0.8): # Start with a copy, will be training train = copy.deepcopy(data) test = [] # Get distribution of message indices, keep ordering test_len = int((1 - train_size) * len(data)) test_indices = sorted(random.sample(range(len(data))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_train_partition(self, sent_partition_size):\n\n self._train_data_partitioned = self._partition_dataset(\n unpartitioned_dataset=self._train_data,\n sent_partition_size=sent_partition_size\n )\n\n self._test_data_partitioned = self._partition_dataset(\n ...
[ "0.67046744", "0.627256", "0.62224567", "0.6146135", "0.608464", "0.60470444", "0.6025138", "0.60056865", "0.5964145", "0.596257", "0.59514266", "0.59134537", "0.59086394", "0.5894597", "0.5875567", "0.5854712", "0.5852151", "0.5848135", "0.58325994", "0.58012825", "0.5780520...
0.6851961
0
Calculate the number of available moves for the passed in player
def number_moves(game, player): return float(len(game.get_legal_moves(player)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __moves_available(self, board: Board):\n player_moves = self.get_num_of_moves(board, self.player_color)\n opponent_moves = self.get_num_of_moves(board, self.opponent_color)\n # print(len(player_moves), len(opponent_moves))\n\n return player_moves - opponent_moves * 3", "def get_nu...
[ "0.74395734", "0.7321936", "0.6822133", "0.6733796", "0.6693827", "0.6667687", "0.6616912", "0.66106665", "0.65502703", "0.6479705", "0.6458653", "0.64512634", "0.6449264", "0.64048064", "0.6316542", "0.62993276", "0.62872946", "0.62864095", "0.62860495", "0.6279876", "0.6272...
0.83128154
0
A measuer of how complete the board is. Returns float The percent of complete the game board is. Between 0 and 1.
def completeness_of_game(game): spaces = game.width * game.height played_spaces = len([x for x in game._board_state[:-3] if x == 1]) return float(played_spaces / spaces)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_complete(self) -> float:\n return self.__percentage_complete", "def percent_passing(self) -> float:\n num_meas = Enumerable(self.mlc_meas).select_many(lambda m: m.passed).count()\n num_pass = (\n Enumerable(self.mlc_meas)\n .select_many(lambda m: m.passed...
[ "0.7187204", "0.7039708", "0.6988115", "0.6894421", "0.68699104", "0.6860702", "0.6820164", "0.6814431", "0.67519665", "0.6700369", "0.669995", "0.6684258", "0.6677539", "0.66357076", "0.6621043", "0.6610755", "0.65787625", "0.65730417", "0.6553437", "0.6544321", "0.6537376",...
0.7382144
0
Returns the average timeout depthlimited
def average_timeout_depth(self): if self.timeout_depths: return sum(self.timeout_depths) / len(self.timeout_depths) else: return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def averageTime(self):\n \n pass", "def getTimeDepth(d,v,dmax=200):\n\n d = np.sort(d)\n d = np.append(d,dmax)\n\n twttop = 2.*np.diff(d)/v # 2-way travel time within each layer\n twttop = np.append(0.,twttop)\n twttop = np.cumsum(twttop) # 2-way travel time from surface to t...
[ "0.6291707", "0.600832", "0.59655666", "0.58856165", "0.5845937", "0.58268595", "0.57281715", "0.5727008", "0.5701169", "0.5675126", "0.5657336", "0.5652876", "0.5619992", "0.55982137", "0.55904514", "0.5574663", "0.55337244", "0.55325866", "0.55304694", "0.55241233", "0.5508...
0.8632682
0
Check if the depth is equal or greater than the search_depth of the agent or if there are no legal moves. Raise SearchTimeout if time_left is less than the TIMER_THRESHOLD.
def _terminal_test(self, game, depth): if self.time_left() < self.TIMER_THRESHOLD: self.timeout_depths.append(depth) raise SearchTimeout() beyond_search_depth = depth >= self.search_depth no_legal_moves = len(game.get_legal_moves()) == 0 return beyond_search_dep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_move(self, game, time_left):\n self.time_left = time_left\n\n # TODO: finish this function!\n # Initialize the best move so that this function returns something\n # in case the search fails due to timeout\n best_move = (-1, -1)\n # The try/except block will automat...
[ "0.61455846", "0.6037407", "0.5798006", "0.5744633", "0.5734702", "0.56711614", "0.5609345", "0.560281", "0.5550985", "0.5535231", "0.5535231", "0.5535231", "0.5535231", "0.55233854", "0.5504624", "0.54934865", "0.5485863", "0.54704106", "0.5470082", "0.5467495", "0.54378605"...
0.6744877
0
Check if the depth is equal or greater than the search_depth of the agent or if there are no legal moves. Raise SearchTimeout if time_left is less than the TIMER_THRESHOLD.
def _terminal_test(self, game, depth): if self.time_left() < self.TIMER_THRESHOLD: self.timeout_depths.append(depth) raise SearchTimeout() beyond_search_depth = depth >= self.search_depth no_legal_moves = len(game.get_legal_moves()) == 0 return beyond_search_dep...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_move(self, game, time_left):\n self.time_left = time_left\n\n # TODO: finish this function!\n # Initialize the best move so that this function returns something\n # in case the search fails due to timeout\n best_move = (-1, -1)\n # The try/except block will automat...
[ "0.6146046", "0.60382676", "0.5797216", "0.57454133", "0.57356983", "0.5671075", "0.56099486", "0.56038743", "0.5551499", "0.5535788", "0.5535788", "0.5535788", "0.5535788", "0.55238247", "0.5503368", "0.5494259", "0.5486273", "0.5470563", "0.546864", "0.54667735", "0.5437583...
0.6742982
1
Execute a PYJQ query to extract from each model's results the dict related to input book_page. Collect labels in span groups at Spacy doc level and set appropriate extensions values on tokens
def load_bner_onto_tokens_extension(question, book_page): doc = nlp(question) doc._.BOOK_PAGE = book_page doc.spans["bner_spans"] = [] itree = IntervalTree() #we use pyjq to make a selection over a nested json with the aim to retain from each model the dict associated with the book_page ## se a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def within_book_search_json(request, book_id):\n query = request.GET.get('q')\n term = query # todo: meta options?\n book = Book.objects.get(pk=book_id)\n\n if not query or len(query) < 3:\n return\n\n # todo: method on objectmanager to search by keyword\n notes = book.notes.filter(\n ...
[ "0.5708067", "0.55803597", "0.52704716", "0.5067415", "0.4997363", "0.49662167", "0.4906672", "0.48808354", "0.4867383", "0.48577002", "0.48404002", "0.48006877", "0.4791166", "0.47886", "0.47818494", "0.47446042", "0.47305262", "0.47226065", "0.46784338", "0.46754616", "0.46...
0.6609978
0
0MQ server startup and communication management
def start_server(self) -> None: with self.socket.bind(self.address): print("ZeroMQ Server listening at {}".format(self.address)) while True: payload_rx = self.socket.recv(flags=0) if payload_rx: self.decode_payload(payload_rx) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self._connect()\n self._init_exchange()\n self._init_queue()\n self._bind_queue()", "def main(connection_file):\n\n ctx = zmq.Context.instance()\n\n with open(connection_file) as f:\n cfg = json.loads(f.read())\n\n reg_url = cfg['interface']\n iop...
[ "0.6537591", "0.6530103", "0.6514542", "0.65044683", "0.64858484", "0.6449997", "0.6438438", "0.6425711", "0.6412168", "0.63570845", "0.6355636", "0.6352996", "0.62894076", "0.6263325", "0.62401557", "0.62241405", "0.6221612", "0.6191344", "0.6186266", "0.6111829", "0.6066045...
0.71882457
0
Test setting jacobian options
def test_jacobian_options(self, mocker): spy = mocker.spy(qml.gradients, "param_shift") a = jax.numpy.array([0.1, 0.2]) dev = qml.device("default.qubit", wires=1) def cost(a, device): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_test_jacobian(self):\n self.set_up()\n inputObject = self.vmecOptimization.vmecInputObject\n rbc = np.copy(inputObject.rbc)\n zbs = np.copy(inputObject.zbs)\n inputObject.rbc = 0*inputObject.rbc\n inputObject.zbs = 0*inputObject.zbs\n orientable = self.vmec...
[ "0.6496576", "0.6447693", "0.63923275", "0.6203111", "0.60555536", "0.6051566", "0.60316074", "0.6018218", "0.5993192", "0.59864306", "0.5792883", "0.57222456", "0.5718024", "0.5713784", "0.56529015", "0.5624789", "0.5615789", "0.55724496", "0.55696857", "0.55681354", "0.5566...
0.71294117
0
Test that an error is raised if an gradient transform is used with grad_on_execution=True
def test_incorrect_gradients_on_execution(self): a = jax.numpy.array([0.1, 0.2]) dev = qml.device("default.qubit", wires=1) def cost(a, device): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) qml.RX(a[1], wires=0) qml.e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_gradient_convergence(self):\n pass", "def test_grad_test_values(self):\r\n backup = theano.config.compute_test_value\r\n theano.config.compute_test_value = 'raise'\r\n try:\r\n x = tensor.scalar('x')\r\n x.tag.test_value = 1\r\n # Used to cras...
[ "0.7141852", "0.6999792", "0.6979812", "0.6958912", "0.6902775", "0.6743894", "0.6662304", "0.6653443", "0.65697926", "0.6568476", "0.6530911", "0.650202", "0.6501163", "0.6478995", "0.6458334", "0.6353595", "0.63159007", "0.62760735", "0.62685746", "0.6248912", "0.61487573",...
0.7932203
0
Test that an error is raised if the interface is unknown
def test_unknown_interface(self): a = jax.numpy.array([0.1, 0.2]) dev = qml.device("default.qubit", wires=1) def cost(a, device): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) qml.RX(a[1], wires=0) qml.expval(qml.Pauli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_device_intf():\n\n cable = Cable(device_a_name=\"deva\", interface_a_name=\"inta\", device_z_name=\"devb\", interface_z_name=\"intb\")\n assert cable.get_device_intf(\"a\") == (\"deva\", \"inta\")\n assert cable.get_device_intf(\"z\") == (\"devb\", \"intb\")\n\n with pytest.raises(ValueErr...
[ "0.67788285", "0.6699145", "0.66089153", "0.65495366", "0.65344524", "0.647308", "0.6403296", "0.63941544", "0.636498", "0.6334388", "0.63309187", "0.62822324", "0.62677455", "0.623547", "0.6222963", "0.6220105", "0.6214236", "0.62119627", "0.62050354", "0.6197082", "0.619083...
0.68783915
0
Test that grad on execution uses the `device.execute_and_gradients` pathway
def test_grad_on_execution(self, mocker): dev = qml.device("default.qubit", wires=1) spy = mocker.spy(dev, "execute_and_gradients") def cost(a): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) qml.RX(a[1], wires=0) qml.ex...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_no_gradients_on_execution(self, mocker):\n dev = qml.device(\"default.qubit\", wires=1)\n spy_execute = mocker.spy(qml.devices.DefaultQubit, \"batch_execute\")\n spy_gradients = mocker.spy(qml.devices.DefaultQubit, \"gradients\")\n\n def cost(a):\n with qml.queuing.A...
[ "0.7481806", "0.71142423", "0.6695256", "0.65490276", "0.64862365", "0.63315445", "0.62705255", "0.62506074", "0.6239375", "0.6215396", "0.619238", "0.61799407", "0.61622083", "0.60890555", "0.6043788", "0.6037538", "0.6016332", "0.60110986", "0.59955305", "0.5993162", "0.595...
0.7644838
0
Test that no grad on execution uses the `device.batch_execute` and `device.gradients` pathway
def test_no_gradients_on_execution(self, mocker): dev = qml.device("default.qubit", wires=1) spy_execute = mocker.spy(qml.devices.DefaultQubit, "batch_execute") spy_gradients = mocker.spy(qml.devices.DefaultQubit, "gradients") def cost(a): with qml.queuing.AnnotatedQueue() a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_incorrect_gradients_on_execution(self):\n a = jax.numpy.array([0.1, 0.2])\n\n dev = qml.device(\"default.qubit\", wires=1)\n\n def cost(a, device):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a[0], wires=0)\n qml.RX(a[1], wires=0)\n ...
[ "0.6840362", "0.67945534", "0.62804043", "0.62784797", "0.620019", "0.6160229", "0.602515", "0.60208565", "0.60208565", "0.599637", "0.5913095", "0.5900473", "0.58735245", "0.5856681", "0.58525246", "0.5840177", "0.58140266", "0.5806199", "0.5756336", "0.5752305", "0.574577",...
0.7671382
0
Test the use of a custom cache object with multiple tapes
def test_custom_cache_multiple(self, mocker): dev = qml.device("default.qubit", wires=1) spy = mocker.spy(qml.interfaces, "cache_execute") a = jax.numpy.array(0.1) b = jax.numpy.array(0.2) def cost(a, b, cache): with qml.queuing.AnnotatedQueue() as q1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_local_cache():", "def test_custom_cache(self, mocker):\n dev = qml.device(\"default.qubit\", wires=1)\n spy = mocker.spy(qml.interfaces, \"cache_execute\")\n\n def cost(a, cache):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a[0], wires=0)\n ...
[ "0.7523432", "0.7488053", "0.7069932", "0.7023241", "0.6847037", "0.67787766", "0.6732996", "0.6732327", "0.6684719", "0.66628677", "0.6645275", "0.65749645", "0.6552753", "0.6544951", "0.65383387", "0.6496633", "0.6484428", "0.6461473", "0.643884", "0.6417242", "0.6400255", ...
0.7550254
0
Test that, when using parametershift transform, caching produces the optimum number of evaluations.
def test_caching_param_shift(self, tol): dev = qml.device("default.qubit", wires=1) def cost(a, cache): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) qml.RX(a[1], wires=0) qml.expval(qml.PauliZ(0)) tape = qml.tape....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cache_maxsize(self, mocker):\n dev = qml.device(\"default.qubit\", wires=1)\n spy = mocker.spy(qml.interfaces, \"cache_execute\")\n\n def cost(a, cachesize):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a[0], wires=0)\n qml.RX(a[1], wires...
[ "0.6651072", "0.6048294", "0.6017", "0.59834677", "0.58053", "0.5749205", "0.5714358", "0.5695462", "0.56551707", "0.5652003", "0.56464815", "0.55483776", "0.54793906", "0.5419169", "0.54163677", "0.5401587", "0.53614277", "0.5349554", "0.534416", "0.5324941", "0.5314627", ...
0.69252145
0
Test that caching produces the optimum number of adjoint evaluations when mode=backward
def test_caching_adjoint_backward(self): dev = qml.device("default.qubit", wires=2) params = jax.numpy.array([0.1, 0.2, 0.3]) def cost(a, cache): with qml.queuing.AnnotatedQueue() as q: qml.RY(a[0], wires=0) qml.RX(a[1], wires=0) qml.R...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_cache_maxsize(self, mocker):\n dev = qml.device(\"default.qubit\", wires=1)\n spy = mocker.spy(qml.interfaces, \"cache_execute\")\n\n def cost(a, cachesize):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a[0], wires=0)\n qml.RX(a[1], wires...
[ "0.61493266", "0.6035271", "0.601645", "0.59946704", "0.58465856", "0.5792817", "0.5757036", "0.5731369", "0.56620586", "0.566111", "0.5609847", "0.56050646", "0.5604916", "0.5592317", "0.5580091", "0.554066", "0.5504138", "0.5499855", "0.5489731", "0.54679126", "0.5462262", ...
0.66844857
0
Test scalar jacobian calculation
def test_scalar_jacobian(self, execute_kwargs, tol): a = jax.numpy.array(0.1) dev = qml.device("default.qubit", wires=2) def cost(a): with qml.queuing.AnnotatedQueue() as q: qml.RY(a, wires=0) qml.expval(qml.PauliZ(0)) tape = qml.tape.Qua...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jacobian(self, x):\n pass", "def JacobianFunction(p,x,y,z):\n \n n = len(x)\n \n J = np.array([ np.ones((n)),x,x**2,y,y**2,x*y ])\n \n return J", "def jacobian(f, x, epsilon = 1e-10):\n f_ = f(x)\n value = np.zeros((len(f_), len(x)))\n \n for i in range(len(x)):\n ...
[ "0.7339697", "0.69234794", "0.6917951", "0.69130737", "0.6863862", "0.6843426", "0.67897356", "0.6771901", "0.6765239", "0.6762716", "0.67603743", "0.6646111", "0.6586984", "0.6561696", "0.6551046", "0.65283936", "0.6493513", "0.6487881", "0.6482703", "0.646528", "0.6461305",...
0.7391808
0
Test reusing a quantum tape by passing new parameters
def test_reusing_quantum_tape(self, execute_kwargs, tol): a = jax.numpy.array(0.1) b = jax.numpy.array(0.2) dev = qml.device("default.qubit", wires=2) with qml.queuing.AnnotatedQueue() as q: qml.RY(a, wires=0) qml.RX(b, wires=1) qml.CNOT(wires=[0, 1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_integration(self):\n\n m = 5 # number of wires in A\n M = 2**m\n\n xmax = np.pi # bound to region [-pi, pi]\n xs = np.linspace(-xmax, xmax, M)\n\n probs = np.array([norm().pdf(x) for x in xs])\n probs /= np.sum(probs)\n\n func = lambda i: np.sin(xs[i]) **...
[ "0.63494396", "0.611109", "0.59224325", "0.589698", "0.5878735", "0.58523005", "0.5766617", "0.57567036", "0.5725462", "0.56870687", "0.5686969", "0.56491363", "0.5639581", "0.56304204", "0.5624216", "0.56179994", "0.5607596", "0.56032", "0.55903065", "0.5581218", "0.55777025...
0.7527882
0
Test classical processing within the quantum tape for a single tape
def test_classical_processing_single_tape(self, execute_kwargs): a = jax.numpy.array(0.1) b = jax.numpy.array(0.2) c = jax.numpy.array(0.3) def cost(a, b, c, device): with qml.queuing.AnnotatedQueue() as q: qml.RY(a * c, wires=0) qml.RZ(b, wir...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_active_inference_SPM_1b(self):", "def test_classical_processing_multiple_tapes(self, execute_kwargs):\n dev = qml.device(\"default.qubit\", wires=2)\n params = jax.numpy.array([0.3, 0.2])\n\n def cost_fn(x):\n with qml.queuing.AnnotatedQueue() as q1:\n qml....
[ "0.62464356", "0.61126363", "0.59649825", "0.59497005", "0.5917769", "0.58554536", "0.57219815", "0.5702824", "0.56830955", "0.565531", "0.56474787", "0.5647309", "0.5630913", "0.5625515", "0.56166446", "0.5601413", "0.55888873", "0.5582979", "0.5569949", "0.55557936", "0.553...
0.6337568
0
Test classical processing within the quantum tape for multiple tapes
def test_classical_processing_multiple_tapes(self, execute_kwargs): dev = qml.device("default.qubit", wires=2) params = jax.numpy.array([0.3, 0.2]) def cost_fn(x): with qml.queuing.AnnotatedQueue() as q1: qml.Hadamard(0) qml.RY(x[0], wires=[0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_classical_processing_single_tape(self, execute_kwargs):\n a = jax.numpy.array(0.1)\n b = jax.numpy.array(0.2)\n c = jax.numpy.array(0.3)\n\n def cost(a, b, c, device):\n with qml.queuing.AnnotatedQueue() as q:\n qml.RY(a * c, wires=0)\n ...
[ "0.6260577", "0.6099374", "0.60667086", "0.6040244", "0.60340387", "0.59733605", "0.59639525", "0.5918906", "0.59123546", "0.58580023", "0.584144", "0.5829903", "0.58174", "0.58160144", "0.58011144", "0.57997733", "0.579832", "0.5781381", "0.5778989", "0.5777852", "0.57400465...
0.6635692
0
Tests the shape of vectorvalued QNode results.
def test_vector_valued_qnode(self, execute_kwargs, ret, out_dim, expected_type): dev = qml.device("default.qubit", wires=2) params = jax.numpy.array([0.1, 0.2, 0.3]) grad_meth = ( execute_kwargs["gradient_kwargs"]["method"] if "gradient_kwargs" in execute_kwargs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_vec(self):\n x = get_vec(5)\n assert x.shape == (5,)\n assert np.all(x == np.zeros(5))", "def isvec(qob):\n shp = qob.shape\n return len(shp) == 1 or (len(shp) == 2 and (shp[0] == 1 or shp[1] == 1))", "def test_vector_shape(self):\n model = PoincareModel(self.data...
[ "0.64669347", "0.64521986", "0.63848865", "0.6384336", "0.63729805", "0.63232344", "0.6228884", "0.6149276", "0.61155164", "0.6107356", "0.6096001", "0.6076757", "0.6044631", "0.59956014", "0.59195197", "0.5917795", "0.58967865", "0.58740616", "0.58721894", "0.5870175", "0.58...
0.7302401
0
Test the jacobian computation with multiple tapes with probability and expectation value computations.
def test_multi_tape_jacobian_probs_expvals(self, execute_kwargs): adjoint = execute_kwargs.get("gradient_kwargs", {}).get("method", "") == "adjoint_jacobian" if adjoint: pytest.skip("The adjoint diff method doesn't support probabilities.") def cost(x, y, device, interface, ek): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_expectation_values(self, approx_order, strategy, tol):\r\n dev = qml.device(\"default.qubit\", wires=2)\r\n x = 0.543\r\n y = -0.654\r\n\r\n with qml.tape.JacobianTape() as tape:\r\n qml.RX(x, wires=[0])\r\n qml.RY(y, wires=[1])\r\n qml...
[ "0.6522309", "0.65060055", "0.6396451", "0.63793343", "0.61633843", "0.61629945", "0.6161094", "0.6139958", "0.61293775", "0.61203456", "0.6013492", "0.6010821", "0.6009504", "0.5966791", "0.59597903", "0.59468144", "0.59339505", "0.5917524", "0.5891985", "0.5855533", "0.5796...
0.7660705
0
Searches Spotify for a song, giving you the link you can use to listen in. Give the query to search for and it will search by title/artist for the best match
async def spotify(self, ctx, *, query): # Setup the headers with the token that should be here headers = {"Authorization": "Bearer {}".format(self._token)} opts = {"q": query, "type": "track"} url = "https://api.spotify.com/v1/search" response = await utils.request(url, headers=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_song(title, artist):\n\ttitle = quote(title, safe='')\n\tartist = quote(artist, safe='')\n\tbase_url = SPOTIFY_API_HOST + 'search/' + '?q=track:{0}+artist:{1}&type=track&limit=1'\n\turl = base_url.format(title, artist)\n\tresults = requests.get(url).json()\n\n\ttry:\n\t\tif results['tracks']['total'] ==...
[ "0.80161357", "0.737705", "0.7374892", "0.71660817", "0.7111647", "0.70489657", "0.7044572", "0.6919186", "0.69184464", "0.68979985", "0.68788624", "0.6842842", "0.6830334", "0.67822534", "0.6743658", "0.67357975", "0.6718091", "0.66173923", "0.661147", "0.66001695", "0.65450...
0.7385611
1
Searches Spotify for a playlist, giving you the link you can use to listen in. Give the query to search for and it will search for the best match
async def playlist(self, ctx, *, query): # Setup the headers with the token that should be here headers = {"Authorization": "Bearer {}".format(self._token)} opts = {"q": query, "type": "playlist"} url = "https://api.spotify.com/v1/search" response = await utils.request(url, heade...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def playlist_search(search_term, results=5):\r\n if search_term:\r\n url = PLAYLIST_SEARCH_URL.format(API_KEY, util.web.quote(search_term.encode('ascii', 'ignore')))\r\n response = util.web.http_get(url=url, json=True, referer='https://tinychat.com')\r\n\r\n if response['json'] is not None:...
[ "0.7246209", "0.7094535", "0.6902199", "0.6900072", "0.6880712", "0.68578", "0.68566424", "0.6802174", "0.6751635", "0.66845226", "0.6641539", "0.66020864", "0.65797824", "0.656957", "0.65241736", "0.63375807", "0.6305814", "0.62658346", "0.6250762", "0.6225917", "0.6218487",...
0.7926087
0
Test POST /fn/ for task creation.
async def test_fn_create(app: Quart) -> None: test_client = app.test_client() response = await test_client.post( "/fn", json=VALID_TASK_BASIC ) assert response.status_code == 200 response_json = await response.get_json() assert response_json == VALID_TASK_BASIC
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_anonymous_01_newtask(self):\r\n # Del previous TaskRuns\r\n self.create()\r\n self.del_task_runs()\r\n\r\n res = self.app.get('api/app/1/newtask')\r\n print res.data\r\n data = json.loads(res.data)\r\n assert data['info'], data", "def test_create_task(sel...
[ "0.7558174", "0.7519237", "0.7402585", "0.73293424", "0.72627306", "0.7140294", "0.70866376", "0.69574684", "0.6845608", "0.6843559", "0.6759246", "0.67584723", "0.6733653", "0.6723772", "0.6711094", "0.6681573", "0.65603113", "0.65247786", "0.6523374", "0.65187365", "0.65153...
0.84658504
0
Simplest train test with using named output
def test_simple_train_named_output(self): data_source = nemo.backends.pytorch.tutorials.RealFunctionDataLayer(n=10000, batch_size=128,) trainable_module = nemo.backends.pytorch.tutorials.TaylorNet(dim=4) loss = nemo.backends.pytorch.tutorials.MSELoss() data = data_source() self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_training(self):\n\t\tpass", "def test_machine_learning():", "def test_training(self):\n warnings.filterwarnings('ignore')\n example_args = example_args_parser()\n example_args.unittest = True\n # prepare data\n example_args.stage = 'prepare'\n example_wrapper(...
[ "0.72303665", "0.6986525", "0.6882543", "0.68158686", "0.6709295", "0.6583969", "0.65741163", "0.6494195", "0.64419305", "0.6441741", "0.6437468", "0.6436363", "0.63998556", "0.6396058", "0.6387685", "0.63823533", "0.6376246", "0.63716936", "0.63709074", "0.63214844", "0.6311...
0.7193557
1
Checks multiline conditions ``if`` statement nodes.
def _check_multiline_conditions(self, node: ast.If) -> None: start_lineno = getattr(node, 'lineno', None) for sub_nodes in ast.walk(node.test): sub_lineno = getattr(sub_nodes, 'lineno', None) if sub_lineno is not None and sub_lineno > start_lineno: self.add_violat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_if_statement(self, line):\n line = re.sub(\"^if *\", \"\", line)\n if '(' not in line or ')' not in line:\n self.print_error(\"Syntax error: If statements take the syntax if (condition) { ... }\",\n errorFunc=SyntaxError)\n\n\n # remove the brac...
[ "0.69199467", "0.66166645", "0.64184743", "0.6394726", "0.63435435", "0.626644", "0.6216721", "0.6210071", "0.62085503", "0.61941326", "0.6121475", "0.6098061", "0.5982492", "0.59647274", "0.59607804", "0.59274286", "0.58617854", "0.58296543", "0.5819066", "0.5787807", "0.577...
0.7710257
0
Commit `n` new people to the database. Return their IDs.
def create_multiple_people(sqla, n): person_schema = PersonSchema() new_people = [] for i in range(n): valid_person = person_schema.load(person_object_factory()) new_people.append(Person(**valid_person)) sqla.add_all(new_people) sqla.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_flush_pk_given(n):\n session = Session(bind=engine)\n for chunk in range(0, n, 1000):\n session.add_all(\n [\n Customer(\n id=i + 1,\n name=\"customer name %d\" % i,\n description=\"customer description %d\" % ...
[ "0.6410909", "0.6035476", "0.5936561", "0.59001946", "0.58297455", "0.5781418", "0.57174855", "0.5668549", "0.55672234", "0.55669963", "0.5547272", "0.5537836", "0.5524978", "0.5519709", "0.54809123", "0.5450484", "0.5418881", "0.5374081", "0.53303605", "0.5317177", "0.530194...
0.7085406
0
Commit accounts for `fraction` of `people` in DB.
def create_multiple_accounts(sqla, fraction=0.75): if fraction < 0.1 or fraction > 1.0: raise RuntimeError(f"Fraction ({fraction}) is out of bounds") all_people = sqla.query(Person).all() sample_people = random.sample(all_people, math.floor(len(all_people) * fraction)) account_schema = Account...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit(self):\n for user_name, user in self._users.items():\n self._execute(\n \"UPDATE users \\\n SET credits = ? \\\n WHERE name == ?\",\n (user.credits, user_name)\n )\n for item_name, amount in user.items....
[ "0.55138946", "0.5332356", "0.52618074", "0.52338505", "0.52129024", "0.51808655", "0.5152565", "0.5076112", "0.506996", "0.50614417", "0.5041748", "0.5001631", "0.49909", "0.49831", "0.49751437", "0.49751437", "0.49751437", "0.49751437", "0.49751437", "0.49574712", "0.495608...
0.56495214
0
Prepare the database with a random number of people, some of which have accounts. Returns list of IDs of the new accounts.
def prep_database(sqla): create_multiple_people(sqla, random.randint(5, 15)) create_multiple_accounts(sqla) return [account.id for account in sqla.query(Account.id).all()]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_users(count=10):\n for i in range(count):\n user = generate_random_user()\n db.session.add(user)\n db.session.commit()", "def create_multiple_accounts(sqla, fraction=0.75):\n if fraction < 0.1 or fraction > 1.0:\n raise RuntimeError(f\"Fraction ({fraction}) is out of bo...
[ "0.63409966", "0.62582266", "0.6153173", "0.6131511", "0.6050464", "0.5958763", "0.590086", "0.58537793", "0.58406174", "0.581963", "0.5800112", "0.5779376", "0.5766366", "0.5753821", "0.5740715", "0.57321405", "0.5722673", "0.57001567", "0.566019", "0.5607473", "0.55965966",...
0.7617684
0
Print list in pretty columns.
def print(listing: typing.Iterable[typing.Any]) -> None: listing = tuple(str(i) for i in listing) if not listing: return width = max(len(i) for i in listing) + 2 count = min(shutil.get_terminal_size().columns // width, len(listing)) for row in itertools.zip_longest(*(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fmtcols(mylist, cols):\n maxwidth = max(list(map(lambda x: len(x), mylist)))\n justifyList = list(map(lambda x: x.ljust(maxwidth), mylist))\n lines = (' '.join(justifyList[i:i + cols])\n for i in range(0, len(justifyList), cols))\n print(\"\\n\".join(lines))", "def tabular_formatted_p...
[ "0.7253442", "0.716318", "0.705893", "0.6965506", "0.6951886", "0.6873508", "0.6842252", "0.6768106", "0.67344517", "0.669688", "0.6666301", "0.66652215", "0.66576207", "0.6651075", "0.662986", "0.65690386", "0.64982414", "0.6490559", "0.64825016", "0.64640856", "0.64574146",...
0.7227835
1
Cli wrapper for handling ForML exceptions.
def cli() -> None: try: group() # pylint: disable=no-value-for-parameter except forml.AnyError as err: print(err, file=sys.stderr)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n try:\n args.handler()\n except pymoira.BaseError as err:\n error( err )", "def main(self):\n args = self.parse_cli()\n\n def _resource_error_message(emsg):\n return \"{prog} {subcmd}: {id}: {msg}\".format(\n prog=self.parser.prog, subcmd...
[ "0.60021865", "0.5985003", "0.5935742", "0.5924656", "0.58899945", "0.5881254", "0.5846594", "0.5846594", "0.5834598", "0.58008087", "0.5768631", "0.5730561", "0.57305557", "0.5700776", "0.5700776", "0.5693197", "0.5686788", "0.5674693", "0.5662413", "0.56506747", "0.56506747...
0.6522494
0
Validates that initial and next state have the same log prob shape.
def assert_log_prob_shape_compliance(self, initial_state, next_state): for key in initial_state.as_dict.keys(): i_value = initial_state.get(key) is_i_random_var = isinstance(i_value, ed.RandomVariable) n_value = next_state.get(key) is_n_random_var = isi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_start_probs(self, initial: np.ndarray) -> None:\n if not isinstance(initial, np.ndarray):\n raise TypeError('Initial state distribution must be a numpy.ndarray')\n if not initial.shape == (self.n_states,):\n raise ValueError('Initial state distribution must be of shape...
[ "0.5958672", "0.58740187", "0.58280957", "0.5819362", "0.5771447", "0.56955814", "0.5686055", "0.56681377", "0.56341374", "0.56278366", "0.5553349", "0.548919", "0.5487075", "0.5450516", "0.5438275", "0.54236823", "0.53835535", "0.53824335", "0.5376346", "0.535134", "0.531660...
0.8014728
0
Implements generic MGF1 Mask Generation function as described in Appendix B.2.1 of RFC 3447. The hash function is passed by name. valid values are 'md2', 'md4', 'md5', 'sha1', 'tls, 'sha256', 'sha384' and 'sha512'. Returns None on error.
def pkcs_mgf1(mgfSeed, maskLen, h): # steps are those of Appendix B.2.1 if not _hashFuncParams.has_key(h): warning("pkcs_mgf1: invalid hash (%s) provided" % h) return None hLen = _hashFuncParams[h][0] hFunc = _hashFuncParams[h][2] if maskLen > 2**32 * hLen: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _hash_function(self, n):\n # Get the mask for this n, or make a new one of 32 random bits.\n mask = self._memomask.get(n)\n if mask is None:\n random.seed(n ^ self.seed_mask)\n mask = self._memomask[n] = int(random.getrandbits(32))\n # Now return a function that uses Jenkins Hash\n #\n...
[ "0.5720204", "0.5584942", "0.5408497", "0.51387376", "0.5122226", "0.5117155", "0.51049674", "0.506334", "0.50571454", "0.501058", "0.49770173", "0.49719885", "0.49459144", "0.4913112", "0.49088615", "0.49074224", "0.48908415", "0.48510462", "0.48508447", "0.484109", "0.48351...
0.75723803
0
Implements EMSAPSSENCODE() function described in Sect. 9.1.1 of RFC 3447
def pkcs_emsa_pss_encode(M, emBits, h, mgf, sLen): # 1) is not done hLen = _hashFuncParams[h][0] # 2) hFunc = _hashFuncParams[h][2] mHash = hFunc(M) emLen = int(math.ceil(emBits/8.)) if emLen < hLen + sLen + 2: # 3) warning("encod...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_email(email, key):\n return", "def test_encode():\n enig = Enigma(534, 16, 8, [4, 6, 0, 7, 3, 0, 2, 3, 7, 0, 4, 2, 6, 1, 5, 5])\n string = \"\"\"Hello, this is a test string. I will follow this with a return\nbringing it onto a new line. I can do this forever, but I won't. Just\nfor a while.\...
[ "0.6101852", "0.60834146", "0.6082749", "0.60545015", "0.5945272", "0.5945272", "0.5905637", "0.5859622", "0.5806776", "0.58012116", "0.57811916", "0.57620645", "0.5729991", "0.5668424", "0.56242007", "0.55970365", "0.55773354", "0.55689085", "0.5524341", "0.5515865", "0.5503...
0.6408031
0
Implements EMSAPSSVERIFY() function described in Sect. 9.1.2 of RFC 3447
def pkcs_emsa_pss_verify(M, EM, emBits, h, mgf, sLen): # 1) is not done hLen = _hashFuncParams[h][0] # 2) hFunc = _hashFuncParams[h][2] mHash = hFunc(M) emLen = int(math.ceil(emBits/8.)) # 3) if emLen < hLen + sLen + 2: return False ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ecssa_verify(ec: EC, hf, m: bytes, P: Point, sig: ECSS) -> bool:\n\n # the bitcoin proposed standard is only valid for curves\n # whose prime p = 3 % 4\n if not ec.pIsThreeModFour:\n errmsg = 'curve prime p must be equal to 3 (mod 4)'\n raise ValueError(errmsg)\n\n # Let r = int(sig[...
[ "0.67954147", "0.657173", "0.64441437", "0.6231932", "0.6160214", "0.61599946", "0.6157672", "0.6145806", "0.5965935", "0.5962814", "0.5930591", "0.5899652", "0.58821315", "0.58375406", "0.57815605", "0.57596624", "0.5742779", "0.5730758", "0.57255775", "0.57254857", "0.57162...
0.6674336
1
Implements EMSAPKCS1V1_5ENCODE() function described in Sect. 9.2 of RFC 3447.
def pkcs_emsa_pkcs1_v1_5_encode(M, emLen, h): # section 9.2 of RFC 3447 hLen = _hashFuncParams[h][0] # 1) hFunc = _hashFuncParams[h][2] H = hFunc(M) hLeadingDigestInfo = _hashFuncParams[h][3] # 2) T = hLeadingDigestInfo + H tLen = len(T) if emLen < t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rsassa_pkcs1_v1_5_sign(self, M, h):\n\n # 1) EMSA-PKCS1-v1_5 encoding\n k = self._modulusLen / 8\n EM = pkcs_emsa_pkcs1_v1_5_encode(M, k, h)\n if EM is None:\n warning(\"Key._rsassa_pkcs1_v1_5_sign(): unable to encode\")\n return None\n\n # 2) RSA signa...
[ "0.58637017", "0.57749647", "0.5767254", "0.562831", "0.5544573", "0.5455732", "0.54434717", "0.5439919", "0.54337126", "0.5427922", "0.54122305", "0.5409033", "0.53953534", "0.533786", "0.5249663", "0.52453196", "0.52303314", "0.5200437", "0.5186495", "0.5167307", "0.5165996...
0.66770023
0
Implements RSASSAPKCS1v1_5VERIFY() function as described in Sect. 8.2.2 of RFC 3447.
def _rsassa_pkcs1_v1_5_verify(self, M, S, h): # 1) Length checking k = self._modulusLen / 8 if len(S) != k: warning("invalid signature (len(S) != k)") return False # 2) RSA verification s = pkcs_os2ip(S) # 2.a) m = self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_rsa_sha1(request):\n from .rsa import verify_sha1\n base_string = generate_signature_base_string(request)\n sig = binascii.a2b_base64(to_bytes(request.signature))\n return verify_sha1(sig, to_bytes(base_string), request.rsa_public_key)", "def verify(public_key, message, signature):\n ha...
[ "0.63578653", "0.63091177", "0.62384", "0.6164231", "0.61427945", "0.61369234", "0.592434", "0.58686256", "0.58176625", "0.5731193", "0.5705756", "0.5680333", "0.5656388", "0.56533843", "0.5642347", "0.56344414", "0.56185615", "0.5606178", "0.5587348", "0.5557569", "0.5531679...
0.7382296
0
Implements RSASSAPSSSIGN() function described in Sect. 8.1.1 of RFC 3447.
def _rsassa_pss_sign(self, M, h=None, mgf=None, sLen=None): # Set default parameters if not provided if h is None: # By default, sha1 h = "sha1" if not _hashFuncParams.has_key(h): warning("Key._rsassa_pss_sign(): unknown hash function " "provided (%s)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rsa_sign(message, privatekey):\r\n \r\n # A key object is created to interact with the PyCrypto\r\n # encryption suite. The object contains key data and\r\n # the necessary rsa functions.\r\n temp_key_obj = _rsa_keydict_to_keyobj(privatekey = privatekey) \r\n \r\n return _rsa_chopstring(message, temp_ke...
[ "0.65902674", "0.6372968", "0.59697056", "0.5959437", "0.5933867", "0.5871692", "0.5871691", "0.5791218", "0.57825357", "0.57733977", "0.5738437", "0.56678075", "0.5650177", "0.56263316", "0.5613606", "0.56071854", "0.5593046", "0.5567222", "0.5563613", "0.55477333", "0.55406...
0.68218243
0
Implements RSASSAPKCS1v1_5SIGN() function as described in Sect. 8.2.1 of RFC 3447.
def _rsassa_pkcs1_v1_5_sign(self, M, h): # 1) EMSA-PKCS1-v1_5 encoding k = self._modulusLen / 8 EM = pkcs_emsa_pkcs1_v1_5_encode(M, k, h) if EM is None: warning("Key._rsassa_pkcs1_v1_5_sign(): unable to encode") return None # 2) RSA signature m =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sign_rsa_sha1(client, request):\n base_string = generate_signature_base_string(request)\n return rsa_sha1_signature(base_string, client.rsa_key)", "def Sign(self, bytes_to_sign, logf=None):\r\n # Implements PKCS1-v1_5 w/SHA256 over the bytes, and returns\r\n # the result as a base64url encoded bi...
[ "0.6281883", "0.59832203", "0.5783482", "0.5714475", "0.5635768", "0.5571883", "0.5559704", "0.5497805", "0.54522115", "0.5442058", "0.54414326", "0.5421102", "0.5405827", "0.5400036", "0.53347284", "0.53216994", "0.53019977", "0.527801", "0.5203799", "0.51961136", "0.5192714...
0.75837
0
Concatenate all the certificates (PEM format for the export) in 'anchor_list' and write the result to file 'filename'. On success 'filename' is returned, None otherwise. If you are used to OpenSSL tools, this function builds a CAfile that can be used for certificate and CRL check. Also see create_temporary_ca_file().
def create_ca_file(anchor_list, filename): try: f = open(filename, "w") for a in anchor_list: s = a.output(fmt="PEM") f.write(s) f.close() except: return None return filename
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_temporary_ca_file(anchor_list):\n try:\n f, fname = tempfile.mkstemp()\n for a in anchor_list:\n s = a.output(fmt=\"PEM\")\n l = os.write(f, s)\n os.close(f)\n except:\n return None\n return fname", "def create_temporary_ca_path(anchor_list, f...
[ "0.7813592", "0.7130165", "0.54865235", "0.5233345", "0.52280974", "0.5154805", "0.51458985", "0.50976825", "0.5081456", "0.5056192", "0.49436203", "0.49168116", "0.48983476", "0.48318136", "0.482673", "0.48083445", "0.480649", "0.4801994", "0.4781368", "0.47468302", "0.47389...
0.84687245
0
Concatenate all the certificates (PEM format for the export) in 'anchor_list' and write the result to file to a temporary file using mkstemp() from tempfile module. On success 'filename' is returned, None otherwise. If you are used to OpenSSL tools, this function builds a CAfile that can be used for certificate and CRL...
def create_temporary_ca_file(anchor_list): try: f, fname = tempfile.mkstemp() for a in anchor_list: s = a.output(fmt="PEM") l = os.write(f, s) os.close(f) except: return None return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ca_file(anchor_list, filename):\n try:\n f = open(filename, \"w\")\n for a in anchor_list:\n s = a.output(fmt=\"PEM\")\n f.write(s)\n f.close()\n except:\n return None\n return filename", "def create_temporary_ca_path(anchor_list, folder):\n ...
[ "0.8418291", "0.75909305", "0.5836558", "0.5250865", "0.51880836", "0.51657206", "0.5152744", "0.50840783", "0.50522465", "0.501845", "0.50167364", "0.498353", "0.49797028", "0.4977977", "0.49645388", "0.4925362", "0.48608357", "0.48578507", "0.4818017", "0.48157322", "0.4780...
0.83903056
1
Create a CA path folder as defined in OpenSSL terminology, by storing all certificates in 'anchor_list' list in PEM format under provided 'folder' and then creating the associated links using the hash as usually done by c_rehash. Note that you can also include CRL in 'anchor_list'. In that case, they will also be store...
def create_temporary_ca_path(anchor_list, folder): # We should probably avoid writing duplicate anchors and also # check if they are all certs. try: if not os.path.isdir(folder): os.makedirs(folder) except: return None l = len(anchor_list) if l == 0: return N...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_ca_file(anchor_list, filename):\n try:\n f = open(filename, \"w\")\n for a in anchor_list:\n s = a.output(fmt=\"PEM\")\n f.write(s)\n f.close()\n except:\n return None\n return filename", "def create_temporary_ca_file(anchor_list):\n try:\n...
[ "0.5929768", "0.56557614", "0.5049341", "0.49274954", "0.49231866", "0.48154494", "0.4807038", "0.47962224", "0.4793785", "0.47824243", "0.47587633", "0.47089493", "0.4689932", "0.46597952", "0.46543935", "0.46317053", "0.4611708", "0.45996815", "0.45926845", "0.45742983", "0...
0.8136269
0
Returns collection of charts that are part of the worksheet
def charts(self): return self.properties.get('charts', EntityCollection(self.context, WorkbookChart, ResourcePath("charts", self.resource_path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def charts(self):\n return self._charts", "def charts(self):\n return self.container['charts']", "def get_weekly_chart_list(self) -> ListModel[Chart]:\n return self.retrieve(\n bind=Chart,\n flatten=\"chart\",\n params=dict(method=\"user.getWeeklyChartList\...
[ "0.76351535", "0.75301296", "0.6606785", "0.6591396", "0.6510425", "0.643841", "0.6303004", "0.6279748", "0.6144825", "0.60105306", "0.58883137", "0.5710741", "0.56871444", "0.5678899", "0.5657876", "0.5635193", "0.5595577", "0.5593473", "0.54826975", "0.5446992", "0.5428346"...
0.79114956
0
Collection of tables that are part of the worksheet.
def tables(self): return self.properties.get('tables', WorkbookTableCollection(self.context, ResourcePath("tables", self.resource_path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tables(self) -> list:\n return self.list_tables()", "def _tables(self):\n tabs = set()\n for cond in self._andalso + self._orelse:\n tabs = tabs.union(cond._tables())\n return tabs", "def make_tables(self):\n return [XLSRowSet(name, self.workbook.sheet_by_name(...
[ "0.7461289", "0.7429046", "0.7311719", "0.7223998", "0.70689285", "0.6959644", "0.6953568", "0.69121426", "0.675924", "0.670654", "0.66978776", "0.66874295", "0.6667738", "0.66497767", "0.6632957", "0.6626624", "0.6615419", "0.6606073", "0.659836", "0.65665925", "0.656333", ...
0.79417855
0
Collection of PivotTables that are part of the worksheet.
def pivot_tables(self): return self.properties.get('pivotTables', EntityCollection(self.context, WorkbookPivotTable, ResourcePath("pivotTables", self.resource_path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tables(self):\n return self.properties.get('tables',\n WorkbookTableCollection(self.context, ResourcePath(\"tables\", self.resource_path)))", "def make_tables(self):\n return [XLSRowSet(name, self.workbook.sheet_by_name(name), self.window)\n for ...
[ "0.6552649", "0.65002507", "0.5966005", "0.5962965", "0.5830784", "0.5787573", "0.56597066", "0.56334597", "0.5631033", "0.5583295", "0.5544617", "0.5506703", "0.54890263", "0.5459125", "0.5382791", "0.5318419", "0.52870756", "0.5273004", "0.5272081", "0.5182937", "0.516016",...
0.788829
0
Returns sheet protection object for a worksheet.
def protection(self): return self.properties.get('protection', WorkbookWorksheetProtection(self.context, ResourcePath("protection", self.resource_path)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sheet():\n creds = None\n # The file token.pickle stores the user's access and refresh tokens, and is\n # created automatically when the authorization flow completes for the first\n # time.\n if os.path.exists('token.pickle'):\n with open('token.pickle', 'rb') as token:\n c...
[ "0.6435777", "0.6164468", "0.61453366", "0.60792303", "0.57868165", "0.57408464", "0.5719054", "0.5713475", "0.56248987", "0.5560803", "0.5474494", "0.54677033", "0.5372001", "0.534923", "0.5348853", "0.53312427", "0.52593756", "0.5227131", "0.520839", "0.5198447", "0.5190751...
0.64826155
0
for portal_catalog to index enableAutopublishing field
def _enableautopublishing(obj, **kwargs): from collective.autopublishing.behavior import IAutoPublishing if IAutoPublishing.providedBy(obj): return getattr(obj, "enableAutopublishing", True) return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeATCTTypesAutoPublishAware():\n makeTypesAutoPublishAware(atct_types)\n print \"---------- PATCH: ADDED enableAutopublishing field TO ATCT TYPES ----------\"", "def enable_index_update_feature(settings):\n settings.FEATURES[INDEX_UPDATES] = True", "def supports_catalog_admin(self):\n ret...
[ "0.5977186", "0.5692152", "0.518013", "0.5164247", "0.50872403", "0.5072901", "0.50575805", "0.5032113", "0.50128716", "0.4981646", "0.49514616", "0.49275663", "0.4918709", "0.49117836", "0.49029917", "0.4898081", "0.48666328", "0.48662493", "0.4820428", "0.4810867", "0.48106...
0.5994194
0
Display schedules of upcoming content.
def schedule(request): return render(request, 'editorial/schedule.html', {})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_schedule(self):\n for entry in self.entries:\n print(entry.get_entry_string())", "def tentative_schedule(request):\n\n\tshows_dict = {\n\t\t0: [],\n\t\t1: [],\n\t\t2: [],\n\t\t3: [],\n\t\t4: [],\n\t\t5: [],\n\t\t6: []\n\t}\n\n\tfor i in range(7):\n\t\tfor show in Show.objects.filter(d...
[ "0.66718227", "0.64995277", "0.6440209", "0.6389953", "0.63754326", "0.6360611", "0.63576716", "0.632596", "0.62293255", "0.62261754", "0.6072113", "0.60381263", "0.6003317", "0.5986058", "0.5982519", "0.596582", "0.5961603", "0.5935291", "0.59298605", "0.5909142", "0.5903294...
0.71254635
0
Test case for variables_get
def test_variables_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variablepresentations_get(self):\n pass", "def test_variables_id_get(self):\n pass", "def test_extracting_one_value(self):\n\t\tself.assertEqual([\"b\"], au.extract_variables(bf.Var(\"b\")), \"Invalid variables extracted, expected [b].\")", "def test_variables_post(self):\n pass...
[ "0.8215227", "0.7764042", "0.6906656", "0.69032335", "0.6889915", "0.688419", "0.6710159", "0.6670743", "0.6668918", "0.66338056", "0.655833", "0.6541936", "0.6481389", "0.6392791", "0.63722074", "0.63574237", "0.6326553", "0.63067013", "0.62641114", "0.6202791", "0.61986876"...
0.90671307
0
Test case for variables_id_delete
def test_variables_id_delete(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variablepresentations_id_delete(self):\n pass", "def test_variables_id_put(self):\n pass", "def test_variables_id_get(self):\n pass", "def delete(self, _id):", "def test_data_source_soaps_id_dynamic_datas_delete(self):\n pass", "def test_delete_identity(self):\n ...
[ "0.8686963", "0.6904678", "0.6892248", "0.67542267", "0.6735828", "0.66662467", "0.66563714", "0.6654981", "0.6652009", "0.6647733", "0.662836", "0.66211337", "0.6588618", "0.6571248", "0.65261865", "0.6509833", "0.6506774", "0.64923763", "0.6465943", "0.6455365", "0.64396185...
0.92804
0
Test case for variables_id_get
def test_variables_id_get(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variablepresentations_id_get(self):\n pass", "def test_variables_id_put(self):\n pass", "def test_variablepresentations_id_put(self):\n pass", "def test_variables_get(self):\n pass", "def test_variables_id_delete(self):\n pass", "def test_prefectures_id_get(sel...
[ "0.8552639", "0.7692867", "0.71789104", "0.6928761", "0.6813583", "0.67081404", "0.6625167", "0.65886503", "0.64681137", "0.641009", "0.6402178", "0.6359477", "0.6327255", "0.63117224", "0.63117224", "0.63117224", "0.63117224", "0.63117224", "0.63117224", "0.63117224", "0.631...
0.91430855
0
Test case for variables_id_put
def test_variables_id_put(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variablepresentations_id_put(self):\n pass", "def test_variables_id_get(self):\n pass", "def test_variables_id_delete(self):\n pass", "def test_variablepresentations_id_get(self):\n pass", "def test_data_source_soaps_id_put(self):\n pass", "def test_user_id_put...
[ "0.8485972", "0.7542932", "0.69008446", "0.6871325", "0.64289016", "0.6362585", "0.6187098", "0.60498357", "0.5927218", "0.58996814", "0.58913213", "0.58510417", "0.5832242", "0.5727545", "0.5676216", "0.5657101", "0.5649096", "0.55572104", "0.55464125", "0.5542622", "0.55351...
0.90912896
0
Test case for variables_post
def test_variables_post(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_variablepresentations_post(self):\n pass", "def vefi_postprocessing(variables):\n return variables", "def test_adding_variable(self):\n\t\turl = reverse('variables')\n\t\tdata = {'variableName': 'a', 'variableValue': 123}\n\t\tresponse = self.client.post(url, data, format='json')\n\t\ts = se...
[ "0.81294644", "0.6594173", "0.65466845", "0.6435603", "0.6416398", "0.6214588", "0.6195658", "0.61302716", "0.6070885", "0.59662485", "0.5965029", "0.5921644", "0.5803392", "0.57740813", "0.57717896", "0.5768627", "0.57051903", "0.56980747", "0.56764126", "0.56758875", "0.561...
0.8911665
0