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
Find the desired state give a schedule
def _get_desired_state(schedule): current_hour = int(time.strftime("%H", time.gmtime())) current_week_day = time.strftime("%A", time.gmtime()).lower() start = schedule[current_week_day]['start'] stop = schedule[current_week_day]['stop'] state = 'stop' if current_hour >= start and current_hour < stop: s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_current_state(self):\n schedule = parser.parse_schedule(SCHEDULE)\n self.assertEqual(\"a\", schedule.get_current_state(dt(monday, '09:30')))\n self.assertEqual(\"c\", schedule.get_current_state(dt(monday, '08:30')))\n self.assertIsNone(schedule.get_current_state(dt(saturday...
[ "0.71231353", "0.6688169", "0.6462357", "0.6322983", "0.59492326", "0.5888927", "0.5873696", "0.584331", "0.57127213", "0.5705844", "0.5693119", "0.5692573", "0.56763047", "0.5673177", "0.5662666", "0.5662666", "0.5624019", "0.5621992", "0.5611431", "0.5609096", "0.55962247",...
0.80120367
0
ELB does not send health checks after stopping/starting the instance. This method reregister the instances in the profile ELB's to start sending health checks again.
def reregister_elb_instances(profile): if 'elb_names' in profile: conn = elb_conn[profile['region']] elbs = conn.get_all_load_balancers(profile['elb_names']) for elb in elbs: instance_ids = _get_instance_ids(elb.instances) print "Reregistering " + elb.name + " instances." try: co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule():\n for profile in schedules['profiles']:\n instances = _get_instances(profile['instance_tags'], profile['region'])\n start_stop_instances(instances, profile['schedule'])\n reregister_elb_instances(profile)", "def stop(self):\n if not self._started:\n return\n\n t...
[ "0.6334031", "0.62459713", "0.6142694", "0.5938756", "0.5917088", "0.57516193", "0.5744347", "0.5738114", "0.5633704", "0.5574055", "0.5539278", "0.5505054", "0.5477789", "0.5458649", "0.5433622", "0.54268354", "0.54172254", "0.54146117", "0.5390834", "0.5369521", "0.5361009"...
0.78677464
0
Given an array of boto.ec2.instances returns instance ids.
def _get_instance_ids(instances): instance_ids = [] for instance in instances: instance_ids.append(instance.id) return instance_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_ids(self, instances):\n instance_ids = []\n for instance in instances:\n instance_ids.append(instance.id)\n return instance_ids", "def get_instances_ids(self):\n reservations = self.__get_reservations()\n instances_ids = []\n instances,_ = self.__get_m...
[ "0.79161435", "0.7302014", "0.6808307", "0.67969036", "0.6750258", "0.6715816", "0.64550406", "0.64538854", "0.63021296", "0.6263368", "0.6237591", "0.62266445", "0.62067336", "0.6107761", "0.60811573", "0.6030414", "0.60244936", "0.6010169", "0.59973186", "0.5986456", "0.597...
0.83387077
0
Ecrire une fonction qui renvoie True si le point (x, y) est dans le cercle de r et de centre (0, 0)
def dans_cercle(self, r, x, y): self.r_num(r) valid = (isinstance(x, int) or isinstance(x, float)) and \ (isinstance(y, int) or isinstance(y, float)) if valid: if sqrt(x**2+y**2)<self.r: return True else: return Fals...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_circle(x0, y0, x, y, r):\n return ((x - x0) ** 2 + (y - y0) ** 2) <= (r ** 2)", "def incircle(self,xpos,ypos,cellx,celly):\n xcell, ycell = self.getcellcenter(cellx,celly)\n if ((xpos - xcell)**2 + (ypos - ycell)**2) < self.crad2:\n return True\n return False\n\n ...
[ "0.79219043", "0.71947825", "0.7167775", "0.7003251", "0.68779093", "0.68285936", "0.68090075", "0.67871714", "0.6755175", "0.6642627", "0.66155875", "0.6614157", "0.6549788", "0.648813", "0.6464612", "0.64520663", "0.64299595", "0.6427061", "0.6418052", "0.6398764", "0.63900...
0.74996036
1
Helper to calculate the remaining calls to github.
async def remaining(github: GitHubAPI): try: result = await github.rate_limit() except GitHubAuthenticationException as exception: _LOGGER.error(f"GitHub authentication failed - {exception}") return None except BaseException as exception: # pylint: disable=broad-except _LOGG...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def get_fetch_updates_for(github: GitHubAPI):\n if (limit := await remaining(github)) is None:\n return None\n\n if limit - RATE_LIMIT_THRESHOLD <= CALLS_PR_REPOSITORY:\n return 0\n return math.floor((limit - RATE_LIMIT_THRESHOLD) / CALLS_PR_REPOSITORY)", "def get_pullReq_commits(pul...
[ "0.7030906", "0.63627785", "0.62276036", "0.5946589", "0.59272087", "0.5900084", "0.5822916", "0.5744561", "0.5682124", "0.5652667", "0.5551989", "0.5540379", "0.55062664", "0.54878956", "0.54800576", "0.5454324", "0.53284425", "0.5261303", "0.5250635", "0.5246006", "0.524556...
0.6762042
1
Display a coloured subtitle.
def subtitle(string): print("{}\n{}\n".format(bold(string), underline(string, "-")))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subtitle(self, txt):\n num = len(txt)\n ticks = \"-\" * num\n print(txt)\n print(ticks)", "def create_subtitle(self):\n label_subtitle = Label(self.frame, text=\"Projet Python 2020\", font=(\"Arial\", 25), bg='light blue',\n fg='white')\n ...
[ "0.70619345", "0.6629809", "0.61023265", "0.60484195", "0.6003638", "0.59983635", "0.5956739", "0.59418565", "0.58387935", "0.58370787", "0.5800514", "0.5796084", "0.5772227", "0.5701921", "0.56968796", "0.5666018", "0.5659659", "0.565431", "0.56356025", "0.56096834", "0.5607...
0.7079763
0
timestamp of last message
def last_timestamp(self): return self._last_timestamp
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lastMessageReceived():", "def get_last_timestamp(self):\n return self._frame_timestamp", "def get_last_time(self):\n \n return self._last", "def lasttime(self):\n if hasattr(self, \"_lasttime\"):\n return self._lasttime\n else:\n return None", "d...
[ "0.7769647", "0.72082126", "0.71306455", "0.70400333", "0.700233", "0.68460685", "0.6843184", "0.6805808", "0.67488164", "0.6714291", "0.6710211", "0.66942847", "0.6675987", "0.66672134", "0.661491", "0.6594136", "0.6582506", "0.65269333", "0.6519992", "0.6519992", "0.6500791...
0.7429002
1
dictionary of all information multiple messages (key is a string, value is a list of lists that contains the messages)
def msg_info_multiple_dict(self): return self._msg_info_multiple_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages(self):\n return {}", "def _add_message_info_multiple(self, msg_info):\n if msg_info.key in self._msg_info_multiple_dict:\n if msg_info.is_continued:\n self._msg_info_multiple_dict[msg_info.key][-1].append(msg_info.value)\n else:\n sel...
[ "0.6741191", "0.6618709", "0.65769136", "0.65106976", "0.628509", "0.6223275", "0.6112383", "0.61069626", "0.60848707", "0.605104", "0.60022557", "0.5961217", "0.59569836", "0.59249747", "0.5894613", "0.5869188", "0.584395", "0.5818667", "0.5804151", "0.5800034", "0.5740932",...
0.74228317
0
list of all changed parameters (tuple of (timestamp, name, value))
def changed_parameters(self): return self._changed_parameters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters_changed(self):\n pass", "def getChanges():", "def parameters(self):\n return []", "def parameters_list(self):\n return [getattr(self.parameters, p) for p in self.parameters_names()]", "def parameter_names(self) -> List[str]:", "def parameters(self):\n return [p ...
[ "0.68223023", "0.66279924", "0.64772093", "0.6446315", "0.641585", "0.6374758", "0.6344504", "0.63368213", "0.6317814", "0.63148576", "0.63148576", "0.6312907", "0.6299366", "0.6272338", "0.61801887", "0.61597204", "0.6142085", "0.6137029", "0.6132782", "0.6114759", "0.607902...
0.72855586
0
dict of MessageLoggingTagged objects
def logged_messages_tagged(self): return self._logged_messages_tagged
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tags_dict(self):\n return ({'name': 'tag', 'attrs': {'k': k, 'v': v}} for k, v in self.tags.items())", "def tag_dict(self):\n tag_dict = dict()\n for document in self.documents:\n for tag in document.tags:\n tag_type = tag['tag']\n tag_dic...
[ "0.6306031", "0.62712485", "0.6040021", "0.60088646", "0.59619224", "0.5934395", "0.58777297", "0.5834602", "0.57534343", "0.5654458", "0.5623019", "0.5615123", "0.55820113", "0.5542628", "0.5486026", "0.5482367", "0.54719156", "0.53995234", "0.53904647", "0.5385974", "0.5371...
0.69523114
0
True if a file corruption got detected
def file_corruption(self): return self._file_corrupt
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_packet_corruption(self, header):\n data_corrupt = False\n if header.msg_type == 0 or header.msg_size == 0 or header.msg_size > 10000:\n if not self._file_corrupt and self._debug:\n print('File corruption detected')\n data_corrupt = True\n sel...
[ "0.7275737", "0.6909501", "0.67795235", "0.64751434", "0.6472965", "0.63858616", "0.6306912", "0.62951386", "0.62945735", "0.62230986", "0.6217393", "0.62134457", "0.61752665", "0.6157496", "0.6143077", "0.6092819", "0.60877305", "0.60756284", "0.6073221", "0.603981", "0.6015...
0.7284083
0
True if compat flag DEFAULT_PARAMETERS is set
def has_default_parameters(self): return self._compat_flags[0] & (0x1 << 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_defaults(self):\n fparam = FParameter(POSITIONAL_ONLY)\n assert fparam.kind == POSITIONAL_ONLY\n for k, v in FPARAM_DEFAULTS.items():\n assert getattr(fparam, k) == v", "def params_optional(self) -> bool:\n result = True\n if self.no_params:\n # W...
[ "0.7427541", "0.6925821", "0.65238214", "0.6483276", "0.6483276", "0.63574094", "0.63574094", "0.63574094", "0.6292153", "0.62191045", "0.61751884", "0.6142402", "0.6056118", "0.60462034", "0.60293055", "0.60282165", "0.6020094", "0.59459364", "0.5905384", "0.5896462", "0.586...
0.8273586
0
get a list of (timestamp, value) tuples, whenever the value changes. The first data point with nonzero timestamp is always included, messages with timestamp = 0 are ignored
def list_value_changes(self, field_name): t = self.data['timestamp'] x = self.data[field_name] indices = t != 0 # filter out 0 values t = t[indices] x = x[indices] if len(t) == 0: return [] ret = [(t[0], x[0])] indices = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_timestamped_metric_values_as_strings(self):\n ret_list = []\n i = 0\n while i < len(self.__metric_value_list):\n ret_list.append(self.__metric_value_list[i].timestamp.strftime(\"%Y-%m-%d %H:%M:%S\") + \" \" +\n str(self.__metric_value_list[i].value...
[ "0.5824866", "0.5726083", "0.56159997", "0.54942083", "0.54706985", "0.54493475", "0.5436982", "0.54328585", "0.5425895", "0.5425895", "0.5419897", "0.5354519", "0.53296113", "0.5266226", "0.52593285", "0.5251129", "0.52483207", "0.5224536", "0.5218457", "0.52090126", "0.5194...
0.77215576
0
add a _MessageParameterDefault object
def _add_parameter_default(self, msg_param): default_types = msg_param.default_types while default_types: # iterate over each bit def_type = default_types & (~default_types+1) default_types ^= def_type def_type -= 1 if def_type not in self._default_paramet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_default_params(self, params):\n params['key'] = self.key\n params['format'] = self.format\n #params['unique_id'] = generate_unique_id()\n return params", "def create_object_parameter_from_default(obj, default):\n values = []\n if default.enum:\n for v in DefaultPa...
[ "0.6885487", "0.6562944", "0.6430674", "0.624202", "0.6017792", "0.6001936", "0.5993875", "0.5911069", "0.5879578", "0.58791137", "0.58579123", "0.58325547", "0.5811331", "0.5731214", "0.5731214", "0.5729596", "0.5720812", "0.57182", "0.57125837", "0.56727165", "0.5632015", ...
0.81283206
0
add a message info multiple to self._msg_info_multiple_dict
def _add_message_info_multiple(self, msg_info): if msg_info.key in self._msg_info_multiple_dict: if msg_info.is_continued: self._msg_info_multiple_dict[msg_info.key][-1].append(msg_info.value) else: self._msg_info_multiple_dict[msg_info.key].append([msg_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msg_info_multiple_dict(self):\n return self._msg_info_multiple_dict", "def add_info(self, info_message: dict):\n self.info.update(info_message)", "def _add_info(self, msg, **kwargs):\n\n args, extensions = self._filter_args(msg, **kwargs)\n for key, val in args.items():\n ...
[ "0.7767071", "0.6895153", "0.6687446", "0.6489464", "0.6157023", "0.59883577", "0.58090824", "0.576598", "0.57619935", "0.57111245", "0.56639373", "0.56390464", "0.55331975", "0.55028325", "0.55022395", "0.54579544", "0.5442484", "0.54279864", "0.53858125", "0.53597647", "0.5...
0.87783754
0
read the file from a given location until the end of sync_byte sequence is found or an end condition is met(reached EOF or searched all last_n_bytes).
def _find_sync(self, last_n_bytes=-1): sync_seq_found = False initial_file_position = self._file_handle.tell() current_file_position = initial_file_position search_chunk_size = 512 # number of bytes that are searched at once if last_n_bytes != -1: current_file_posit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_until(self, c, chunk_size=96):\n s = io.BytesIO()\n fp = self._fp\n eof = False\n\n while True:\n chunk = fp.read(chunk_size)\n\n if not chunk:\n # The end of the file was reached. We'll bail out of the loop\n # and return ev...
[ "0.6459113", "0.62749535", "0.6266084", "0.612903", "0.58795774", "0.5834802", "0.58217543", "0.5724661", "0.5703309", "0.5690901", "0.56636", "0.56636", "0.56429064", "0.56224495", "0.56210196", "0.56070936", "0.5563991", "0.55546427", "0.5546318", "0.55455285", "0.5493936",...
0.74218076
0
check for data corruption based on an unknown message type in the header set _file_corrupt flag to true if a corrupt packet is found
def _check_packet_corruption(self, header): data_corrupt = False if header.msg_type == 0 or header.msg_size == 0 or header.msg_size > 10000: if not self._file_corrupt and self._debug: print('File corruption detected') data_corrupt = True self._file_cor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_bad_data():\n get_file_reply(files[2][0], files[2][1])", "def check_headers(df, filename):\n print(\"Checking headers for: \" + filename)\n read_message = \"\"\n\n original_colnames = df.columns.tolist()\n # good_colnames = [\"Marker\",\"Chr\",\"Position\",\"Effect_allele\",\"Other_alle...
[ "0.6176655", "0.59605867", "0.5881001", "0.58625066", "0.58625066", "0.5849321", "0.5756507", "0.5756507", "0.5756501", "0.57418764", "0.56147045", "0.55945456", "0.55350333", "0.55093884", "0.54594165", "0.54587096", "0.5445845", "0.5425486", "0.5398548", "0.5377166", "0.534...
0.76328593
0
Creates an array attribute containing array attributes of integers. If the operand is already an array attribute, forwards it. Otherwise treats the operand as a list of attributes or integers, potentially interpserced, to create a new arrayofarray attribute. Expects the threadlocal MLIR context to have been set by the ...
def _get_int_int_array_attr( values: Optional[Union[ArrayAttr, Sequence[Union[ArrayAttr, IntOrAttrList]]]] ) -> ArrayAttr: if values is None: return ArrayAttr.get([]) if isinstance(values, ArrayAttr): return values if isinstance(values, list): v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enableAttributeArray(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass", "def setAttributeArray(self, *__args): # real signature unknown; restored from __doc__ with multiple overloads\n pass", "def __init__(\n self,\n array: Array,\n ...
[ "0.5632645", "0.55638945", "0.53828555", "0.53659517", "0.53659517", "0.5316151", "0.53118175", "0.52722055", "0.5270165", "0.5228894", "0.5194302", "0.519273", "0.51908255", "0.51729876", "0.5158492", "0.51555264", "0.51448303", "0.51444167", "0.5142811", "0.5137237", "0.513...
0.6210563
0
Hierarchically cluster the expression profiles.
def cluster(eps, linkage='average'): # TODO: your code here # Start by creating leaves for all the profiles and computing Euclidean distances between each pair. nodes = [ExpressionHierarchicalClusterLeaf(ep) for ep in eps] distances = {} for i in range(len(nodes)): f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cluster_hierarchically(active_sites):\n\n\n cls, sc = agglomerative(active_sites)\n\n return cls", "def clusters(self):\n raise NotImplementedError", "def test_get_hyperflex_cluster_profile_list(self):\n pass", "def assign_clusters(self):\n running_perts = {}\n for name ...
[ "0.5672239", "0.5575119", "0.52612776", "0.51963127", "0.51467055", "0.514348", "0.509445", "0.49672025", "0.49633887", "0.4957409", "0.49469635", "0.49469188", "0.4851559", "0.48466492", "0.48371315", "0.4828702", "0.4827677", "0.4780171", "0.47612554", "0.47612554", "0.4747...
0.56489336
1
Routes related to metrics are delegated to OtterMetrics.
def metrics(self, request): return OtterMetrics(self.store).app.resource()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_metrics(self, from_time=None, to_time=None, metrics=None, view=None):\n return self._get_resource_root().get_metrics(self._path() + '/metrics',\n from_time, to_time, metrics, view)", "def set_metrics(self):", "def metrics(self):\n raise NotImplementedError(\"metrics\")", "def AppMetr...
[ "0.5967554", "0.5963758", "0.5958907", "0.58173203", "0.5702679", "0.5702003", "0.5692182", "0.56049716", "0.55973095", "0.5572481", "0.5559284", "0.5490586", "0.54229575", "0.5382848", "0.53609043", "0.534358", "0.5328718", "0.53084874", "0.5297921", "0.5258105", "0.5254089"...
0.65490466
0
Assert that creating an amendment statement with secured party and debtor edits worksa as expected.
def test_create_amendment_edit(session, client, jwt, description, data, sp_amend_id, debtor_amend_id): json_data = copy.deepcopy(data) if sp_amend_id is not None: json_data['addSecuredParties'][0]['amendPartyId'] = sp_amend_id else: del json_data['addSecuredParties'][0]['amendPartyId'] i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_approve_agreement(self):\n pass", "def test_owner_edit_assessment_valid(self):\n req = {'weight': 60, 'additional_description': 'asdfqwer'}\n response = self.user_01.put(self.assessment_report_url, req)\n self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)\n ...
[ "0.66511834", "0.6303875", "0.630162", "0.6266475", "0.6166075", "0.6130697", "0.6124604", "0.6123696", "0.6073379", "0.60479134", "0.60479134", "0.6042392", "0.6023422", "0.6012972", "0.6002221", "0.59952265", "0.5974059", "0.5972718", "0.59536445", "0.5933681", "0.5923553",...
0.7524552
0
Assert that a get amendment registration statement works as expected.
def test_get_amendment(session, client, jwt, desc, roles, status, has_account, reg_num, base_reg_num): current_app.config.update(AUTH_SVC_URL=MOCK_URL_NO_KEY) headers = None # setup if status == HTTPStatus.UNAUTHORIZED and desc.startswith('Report'): headers = create_header_account_report(jwt, ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_amendment_edit(session, client, jwt, description, data, sp_amend_id, debtor_amend_id):\n json_data = copy.deepcopy(data)\n if sp_amend_id is not None:\n json_data['addSecuredParties'][0]['amendPartyId'] = sp_amend_id\n else:\n del json_data['addSecuredParties'][0]['amendParty...
[ "0.64464396", "0.63845927", "0.63768023", "0.62937075", "0.62937075", "0.605112", "0.60243297", "0.59206325", "0.5902402", "0.5859729", "0.58191997", "0.5813629", "0.58083546", "0.5763737", "0.5750557", "0.5737895", "0.57193136", "0.5703327", "0.56942743", "0.5671445", "0.566...
0.7382489
0
Assert that setting the amendment change type from the amendment data works as expected.
def test_change_types(session, client, jwt, change_type, is_general_collateral): current_app.config.update(PAYMENT_SVC_URL=MOCK_PAY_URL) json_data = copy.deepcopy(AMENDMENT_STATEMENT) json_data['changeType'] = change_type json_data['debtorName']['businessName'] = 'TEST BUS 2 DEBTOR' del json_data['c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_change_asset_type_assignment_rule(self):\n pass", "def test_change_relation_type(self):\n pass", "def test_update_data_type_of_attrvalue(self):\n user = User.objects.create(username=\"hoge\")\n\n entity = Entity.objects.create(name=\"entity\", created_user=user)\n en...
[ "0.6533172", "0.6207626", "0.6028736", "0.6021598", "0.6020911", "0.5930699", "0.5922061", "0.59145033", "0.59051156", "0.5879773", "0.58577573", "0.5824438", "0.58031595", "0.5800085", "0.57931745", "0.5766806", "0.5757334", "0.574065", "0.56755495", "0.5674831", "0.5652479"...
0.66191286
0
Create a financing statement for testing.
def create_financing_test(session, client, jwt): statement = copy.deepcopy(FINANCING_STATEMENT) statement['debtors'][0]['businessName'] = 'TEST BUS 2 DEBTOR' statement['type'] = 'SA' del statement['createDateTime'] del statement['baseRegistrationNumber'] del statement['payment'] del statemen...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctest_DKBCCCsvStatementParser():", "def test_transaction_management_statements(self):\n for script_pattern in (\n \"BEGIN TRANSACTION; %s; COMMIT;\",\n \"BEGIN; %s; END TRANSACTION;\",\n \"/* comment */BEGIN TRANSACTION; %s; /* comment */COMMIT;\",\n \"/* ...
[ "0.5922423", "0.58748436", "0.57381195", "0.5712238", "0.5536309", "0.54875225", "0.5401516", "0.5340367", "0.5328818", "0.5325756", "0.5258779", "0.5224878", "0.51681894", "0.5089125", "0.50795174", "0.50786793", "0.5077896", "0.50717795", "0.50620943", "0.50568455", "0.5052...
0.65338284
0
Test the properties homepage.
def test_properties_index(self): result = self.client.get('/') self.assertEqual(result.status, '200 OK') self.assertIn(b'Welcome', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_property_page(self):\n self.property_page.proceed_to_property_page()\n\n \"\"\"Step2 - Check rooms section\n Exp2 - Property page opened \"\"\"\n self.property_page.check_rooms_section()\n\n \"\"\"Step3 - Check other section\n Exp3 - Each item works well \"\"\"\...
[ "0.7226637", "0.6801965", "0.6606398", "0.65856403", "0.6486094", "0.6486094", "0.6480849", "0.6455193", "0.6366206", "0.6360378", "0.6354731", "0.6353792", "0.6351547", "0.6343604", "0.63424563", "0.6332773", "0.6328751", "0.63285375", "0.63134605", "0.63006544", "0.6274684"...
0.7332575
0
Test the new offer creation page.
def test_offers_new(self): result = self.client.get('/offers_new') self.assertEqual(result.status, '200 OK') self.assertIn(b'Make an Offer', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_view(self):\n supplement = SupplementFactory(user=self.user_1)\n time = get_utc_now()\n\n post_data = {\n \"supplement_uuid\": str(supplement.uuid),\n \"time\": time.isoformat(),\n \"quantity\": 5,\n }\n\n response = self.client_1....
[ "0.72297406", "0.70225155", "0.65767425", "0.6547002", "0.6517671", "0.65035397", "0.6491894", "0.6482098", "0.6441887", "0.6362172", "0.63465416", "0.63443273", "0.6332997", "0.6332686", "0.6323293", "0.63143426", "0.63076407", "0.6299864", "0.6273754", "0.622774", "0.619269...
0.80279493
0
Test showing the page of all offers.
def test_offers_show_every(self): result = self.client.get('/offers_show_every') self.assertEqual(result.status, '200 OK') self.assertIn(b'Offers', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_offers(self):\n pass", "def test_show_offer(self, mock_find):\n mock_find.return_value = sample_offer\n\n result = self.client.get(f'/offers/{sample_offer_id}')\n self.assertEqual(result.status, '200 OK')\n self.assertIn(b'Description', result.data)", "def test_b...
[ "0.72028357", "0.63975585", "0.6307497", "0.6142342", "0.6118828", "0.6108139", "0.6106805", "0.61000824", "0.60947084", "0.6088211", "0.6061273", "0.6035597", "0.6009674", "0.5989309", "0.59431523", "0.59197736", "0.5881938", "0.5876856", "0.5876462", "0.58678347", "0.582831...
0.78508234
0
Test submitting a new offer. Entry point for route is called offers_show_all.
def test_submit_offer(self, mock_insert): result = self.client.post('offers_show', data=sample_form_data) # After submitting, should redirect to the offers_show page. self.assertEqual(result.status, '302 FOUND') mock_insert.assert_called_with(sample_offer)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_offers_new(self):\n result = self.client.get('/offers_new')\n self.assertEqual(result.status, '200 OK')\n self.assertIn(b'Make an Offer', result.data)", "def test_offers_show_every(self):\n result = self.client.get('/offers_show_every')\n self.assertEqual(result.status...
[ "0.7137048", "0.673148", "0.67147416", "0.6314298", "0.6304351", "0.61012447", "0.6049734", "0.6017124", "0.59592426", "0.58525443", "0.57838637", "0.573978", "0.5655164", "0.5545433", "0.5451833", "0.54337096", "0.5407538", "0.5388778", "0.53809834", "0.5359097", "0.5352999"...
0.74099815
0
Test showing a single offer.
def test_show_offer(self, mock_find): mock_find.return_value = sample_offer result = self.client.get(f'/offers/{sample_offer_id}') self.assertEqual(result.status, '200 OK') self.assertIn(b'Description', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_offers_show_every(self):\n result = self.client.get('/offers_show_every')\n self.assertEqual(result.status, '200 OK')\n self.assertIn(b'Offers', result.data)", "def test_get_offers(self):\n pass", "def test_offers_new(self):\n result = self.client.get('/offers_new')\...
[ "0.7261696", "0.6998221", "0.6710632", "0.64315236", "0.6270281", "0.6039189", "0.60301286", "0.59781045", "0.59634453", "0.5904044", "0.5892867", "0.5879203", "0.5841947", "0.5778148", "0.57217896", "0.5689361", "0.56728566", "0.5562918", "0.55520946", "0.5543369", "0.554163...
0.77325225
0
Test rendering of the edit offer form.
def test_offers_edit(self, mock_find): mock_find.return_value = sample_offer result = self.client.get(f'/offers/{sample_offer_id}/edit') self.assertEqual(result.status, '200 OK') self.assertIn(b'Edit This Offer', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_edit_offer(self, mock_find):\n mock_find.return_value = sample_offer\n\n result = self.client.get(f'/offers/{sample_offer_id}')\n self.assertEqual(result.status, '200 OK')\n self.assertIn(b'Description', result.data)", "def test_edit(self):\n # Test using the Trovebox ...
[ "0.7102556", "0.6937645", "0.65472555", "0.6311472", "0.6263482", "0.61965406", "0.6167895", "0.615845", "0.6157788", "0.612634", "0.61004084", "0.60736597", "0.60716546", "0.606673", "0.6046549", "0.6044666", "0.60096306", "0.6009348", "0.60079074", "0.60064816", "0.5977993"...
0.7367693
0
Test submitted an edited offer.
def test_edit_offer(self, mock_find): mock_find.return_value = sample_offer result = self.client.get(f'/offers/{sample_offer_id}') self.assertEqual(result.status, '200 OK') self.assertIn(b'Description', result.data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_offers_edit(self, mock_find):\n mock_find.return_value = sample_offer\n\n result = self.client.get(f'/offers/{sample_offer_id}/edit')\n self.assertEqual(result.status, '200 OK')\n self.assertIn(b'Edit This Offer', result.data)", "def test_submit_offer(self, mock_insert):\n ...
[ "0.7510725", "0.698181", "0.62977237", "0.62476325", "0.6218222", "0.61978376", "0.6181655", "0.6157984", "0.61287814", "0.6128666", "0.61075187", "0.6098314", "0.60974056", "0.6076452", "0.60475904", "0.6021605", "0.5991045", "0.59832805", "0.5976426", "0.59733415", "0.59711...
0.7380167
1
Test deletion of an offer.
def test_offers_delete(self, mock_delete): form_data = {'_method': 'DELETE'} result = self.client.post(f'/offers/{sample_offer_id}/delete', data=form_data) self.assertEqual(result.status, '302 FOUND') mock_delete.assert_called_with({'_id': sample_offer_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_delete_item_using_delete(self):\n pass", "def test_delete(self):\n pass", "def test_delete_case(self):\n pass", "def test_delete_store_success(self):\n product = sample_product(supplier_id=self.user)\n url = detail_url(product.id)\n res = self.client.delete(...
[ "0.68176514", "0.6788493", "0.67163765", "0.6692377", "0.65834457", "0.65589345", "0.65540034", "0.6534039", "0.64845026", "0.64759994", "0.644285", "0.6428234", "0.64046663", "0.6401266", "0.64008033", "0.6393146", "0.6370907", "0.63591313", "0.63482857", "0.63346833", "0.63...
0.77197415
0
A helper routine for selectionSort which finds the index of the biggest value in data at the mark index or greater.
def _findMaxIndex(data, mark): # assume the maximum value is at initial mark position maxIndex = mark # loop over the remaining positions greater than the mark for mark in range(mark+1, len(data)): # if a bigger value is found, record its index if data[mark][1][2] > data[maxIndex][1][2]:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_max(data):\n index = 0\n res = data[index]\n for i in range(1, len(data)):\n if data[i] > res:\n res = float(data[i])\n index = i\n else:\n break\n return res, index", "def index_largest(seq):\n assert len(seq) > 0\n x, greatest, index = l...
[ "0.6781426", "0.67771745", "0.64360774", "0.63961357", "0.6354491", "0.6354491", "0.6354491", "0.6315467", "0.6232908", "0.61545926", "0.6070463", "0.60310376", "0.5987817", "0.5986606", "0.59847385", "0.59797347", "0.5973072", "0.596987", "0.5966308", "0.5958042", "0.5954138...
0.85851187
0
Perform an inplace selection sort of data.
def selectionSort(data): for mark in range(len(data)-1): maxIndex = _findMaxIndex(data, mark) # swap the element at marker with the min index data[mark], data[maxIndex] = data[maxIndex], data[mark] return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selection_sort(self, data):\n for i in range(len(data)-1, 0, -1):\n i_max = 0\n for j in range(1, i+1):\n if data[j] > data[i_max]:\n i_max = j\n tmp = data[i]\n data[i] = data[i_max]\n data[i_max] = tmp\n print \"pass\", i, data", "def selection_sort(unsorted...
[ "0.77006024", "0.67082053", "0.65607554", "0.6547946", "0.6539799", "0.6534672", "0.6529109", "0.64570767", "0.6438951", "0.6392037", "0.63764393", "0.63130563", "0.6299781", "0.6295771", "0.6284434", "0.6272947", "0.62266135", "0.62155014", "0.6215076", "0.6189748", "0.61669...
0.7535001
1
Perform crossover from p1, p2 into c1, c2. Note that we do not actually perform crossover. We build a model from all the parents. Then we sample the model to produce the children. This function is called self.pop_size / 2 times.
def crossover (self, p1, p2, p_pop, c1, c2, c_pop) : assert self.crossover_count < self.pop_size assert self.get_iteration () == self.last_gen self.parents.append (p1) self.parents.append (p2) self.crossover_count += 2 if self.crossover_count == self.pop_size : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crossover(self, pop):\n intDiscID = self.iID + self.dID\n varID = self.cID\n goldenRatio = (1.0 + sqrt(5)) / 2.0\n dx = np.zeros_like(pop[0])\n children = []\n used = []\n for i in range(0, int(self.fracElite * len(pop)), 1):\n r = int(rand() * self.p...
[ "0.73990524", "0.7297003", "0.7292777", "0.7076102", "0.69150895", "0.6808625", "0.6713596", "0.6706768", "0.6703259", "0.65825945", "0.6577948", "0.6534811", "0.649272", "0.64872974", "0.63988644", "0.63337296", "0.6228257", "0.6193814", "0.6190003", "0.6182483", "0.6107116"...
0.8853995
0
An opengraph description meta should be present if the person bio placeholder is set.
def test_templates_person_detail_open_graph_description_bio(self): person = PersonFactory() page = person.extended_object # Add a bio to a person placeholder = person.extended_object.placeholders.get(slot="bio") add_plugin( language="en", placeholder=plac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_templates_person_detail_open_graph_description_bio_exceeds_max_length(\n self,\n ):\n person = PersonFactory()\n page = person.extended_object\n placeholder_value = (\n \"Long description that describes the page with a summary. \" * 7\n )\n\n # Add a...
[ "0.68601227", "0.66034406", "0.65626204", "0.6385466", "0.61810136", "0.6127859", "0.6040194", "0.598596", "0.58483034", "0.5840213", "0.5766451", "0.5667915", "0.5608601", "0.55792457", "0.55779576", "0.55524266", "0.55337346", "0.55221784", "0.5492852", "0.54895395", "0.547...
0.7378928
0
The "Organizations" section should not be displayed when empty.
def test_templates_person_detail_organizations_empty(self): person = PersonFactory(should_publish=True) # The "organizations" section should not be present on the public page url = person.public_extension.extended_object.get_absolute_url() response = self.client.get(url) self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def organizations(self):\n self.elements('organizations')", "def display_org_with_default(self):\r\n if self.display_organization:\r\n return self.display_organization\r\n\r\n return self.org", "def test_organizations_list(self):\n pass", "def clean_organization(self):\...
[ "0.6324429", "0.615348", "0.6080977", "0.59967095", "0.5937215", "0.5870967", "0.5870967", "0.5729163", "0.5728357", "0.5711528", "0.56988746", "0.56364673", "0.55923396", "0.55328053", "0.5492391", "0.5482238", "0.54775167", "0.5456552", "0.54380375", "0.5429035", "0.5420223...
0.71524966
0
The "maincontent" placeholder block should not be displayed on the public page when empty but only on the draft version for staff.
def test_templates_person_detail_maincontent_empty(self): person = PersonFactory(should_publish=True) # The "organizations" section should not be present on the public page url = person.public_extension.extended_object.get_absolute_url() response = self.client.get(url) self.asse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_empty_posts(self, client, site, homepage):\n response = client.get(homepage.relative_url(site))\n assertTemplateNotUsed(response, \"snippets/carousel.html\")", "def show_homepage():\n\n return render_template(\"blank-slate.html\")", "def test_not_microsite_anonymous_homepage_content(s...
[ "0.58954334", "0.5879357", "0.58698666", "0.58275884", "0.5777995", "0.57750595", "0.5751515", "0.5750153", "0.5733736", "0.5710872", "0.55958956", "0.558564", "0.55835044", "0.55611306", "0.5554163", "0.5551871", "0.5529988", "0.5525225", "0.54813397", "0.54223466", "0.54117...
0.6660572
0
The courses to which a person has participated should appear on this person's detail page.
def test_templates_person_detail_related_courses(self): user = UserFactory(is_staff=True, is_superuser=True) self.client.login(username=user.username, password="password") person = PersonFactory() course = CourseFactory(fill_team=[person]) url = person.extended_object.get_absol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_courses(self):\r\n\r\n return self.def_ms.get_courses()", "def get_courses(self):\n if not self.is_course_based_activity():\n raise IllegalState()\n else:\n raise Unimplemented()", "def see_teaching_courses(self, username: str, token: str) -> List[Dict[str, ob...
[ "0.70524913", "0.68237513", "0.67915165", "0.6646394", "0.65155363", "0.64971614", "0.6459945", "0.64266986", "0.6408845", "0.6397062", "0.6390385", "0.634456", "0.634456", "0.62637556", "0.625636", "0.62397075", "0.62369204", "0.619848", "0.61810017", "0.6175437", "0.6159269...
0.68516326
1
Make sure the person detail page does not display too many courses, even when a large number are related to the current person, as this can cause the page to load very slowly and is not a great experience for the user anyway.
def test_templates_person_detail_related_max_courses(self, _mock_page_url): # Create our dummy person and the 3 courses we'll attach to it person = PersonFactory(should_publish=True) courses = CourseFactory.create_batch(3, fill_team=[person], should_publish=True) # Link the 3 courses wit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_templates_person_detail_related_courses(self):\n user = UserFactory(is_staff=True, is_superuser=True)\n self.client.login(username=user.username, password=\"password\")\n\n person = PersonFactory()\n course = CourseFactory(fill_team=[person])\n\n url = person.extended_ob...
[ "0.6131107", "0.5759475", "0.555766", "0.5475429", "0.5444028", "0.5432407", "0.5432407", "0.5407837", "0.53872633", "0.534116", "0.5268757", "0.5227538", "0.5218553", "0.5216301", "0.5184439", "0.5172156", "0.5165793", "0.5139287", "0.5070918", "0.5049757", "0.5048851", "0...
0.6978592
0
The blog posts written by a person should appear on this person's detail page.
def test_templates_person_detail_related_blog_posts(self): user = UserFactory(is_staff=True, is_superuser=True) self.client.login(username=user.username, password="password") person = PersonFactory() blog_post = BlogPostFactory(fill_author=[person]) url = person.extended_object...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_blog(self):", "def post_detail_blog(request, blog_pk):\n # recuperar el post\n # recupera posts\n posts = Post.objects.order_by('-created_at').filter(owner=blog_pk)\n\n # prepara el contexto de la plantilla\n context = {\n 'post_objects': posts\n }\n\n # renderiza y devuelve ...
[ "0.6633275", "0.64074415", "0.62881434", "0.623036", "0.6202774", "0.6185763", "0.61564267", "0.61334616", "0.60681987", "0.6010772", "0.6004283", "0.599102", "0.59621155", "0.59385824", "0.5935328", "0.5891563", "0.5883217", "0.58808655", "0.58712953", "0.5863682", "0.586032...
0.7080314
0
A person template page without attached person should show an error banner explaining to the user that he/she is misusing the template.
def test_template_person_detail_without_person(self): page = PageFactory( template="courses/cms/person_detail.html", title__language="en", should_publish=True, ) with self.assertTemplateUsed( "courses/cms/fragment_error_detail_template_banner.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errorview(request):\n \n #return a page indicating an error has occured\n return render(request, 'SmellGuessTemplate/error.html')", "def page_not_found(error):\r\n return render_template('error_template.html' , title = \"404 bud\", \r\n \t\t\t\t\t\t\t\t\t\t\t\tmessage = \"Time to make the chim...
[ "0.6937663", "0.6863008", "0.68516415", "0.6752877", "0.6686156", "0.66346717", "0.6599722", "0.65577775", "0.6542976", "0.650337", "0.6459382", "0.6441446", "0.64403677", "0.64176124", "0.63976896", "0.63921285", "0.63720983", "0.63401914", "0.63311446", "0.626568", "0.62625...
0.7322566
0
The person meta description should show meta_description placeholder if defined
def test_templates_person_detail_meta_description(self): person = PersonFactory() page = person.extended_object title_obj = page.get_title_obj(language="en") title_obj.meta_description = "A custom description of the person" title_obj.save() page.publish("en") u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_templates_person_detail_meta_description_empty(self):\n person = PersonFactory()\n page = person.extended_object\n page.publish(\"en\")\n\n url = person.extended_object.get_absolute_url()\n response = self.client.get(url)\n self.assertEqual(response.status_code, 2...
[ "0.7493067", "0.73539066", "0.7327169", "0.6953486", "0.6882343", "0.68740034", "0.6779088", "0.6736526", "0.6641838", "0.66232705", "0.66081226", "0.65941656", "0.65928084", "0.65557325", "0.6542866", "0.65394235", "0.65185213", "0.6508125", "0.64476067", "0.64332944", "0.64...
0.747935
1
The person meta description should show the bio if no meta_description is specified
def test_templates_person_detail_meta_description_bio(self): person = PersonFactory() page = person.extended_object # Add a bio to a person placeholder = person.extended_object.placeholders.get(slot="bio") add_plugin( language="en", placeholder=placeholde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_templates_person_detail_meta_description_bio_exceeds_max_length(self):\n person = PersonFactory()\n page = person.extended_object\n placeholder_value = (\n \"Long description that describes the page with a summary. \"\n \"Long description that describes the page ...
[ "0.75098807", "0.73679626", "0.7329358", "0.7161595", "0.7068236", "0.6558661", "0.6484242", "0.6474118", "0.6419864", "0.6413481", "0.63787854", "0.62688863", "0.6268348", "0.62623376", "0.6260252", "0.62513417", "0.62280905", "0.61857986", "0.6161864", "0.61527085", "0.6134...
0.7804819
0
The person meta description should be cut if it exceeds more than 160 caracters
def test_templates_person_detail_meta_description_bio_exceeds_max_length(self): person = PersonFactory() page = person.extended_object placeholder_value = ( "Long description that describes the page with a summary. " "Long description that describes the page with a summar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_description(self):\n description = self.cleaned_data['description']\n if not re.match(r'[\\w{4}\\s*]+', description) or len(description) < 10:\n v_err('no_desc')\n return description", "def clean_bio(self):\n bio = BeautifulSoup(self.cleaned_data['bio'], \"html.pa...
[ "0.70148104", "0.7013429", "0.70095193", "0.69248194", "0.69162107", "0.66320646", "0.63486636", "0.6343417", "0.63398165", "0.6330294", "0.6316465", "0.63015544", "0.62774426", "0.6244998", "0.62317955", "0.62015456", "0.6111285", "0.60665274", "0.60504776", "0.6047837", "0....
0.7297463
0
The person meta description should not be present if neither the meta_description field on the page, nor the `bio` placeholder are filled
def test_templates_person_detail_meta_description_empty(self): person = PersonFactory() page = person.extended_object page.publish("en") url = person.extended_object.get_absolute_url() response = self.client.get(url) self.assertEqual(response.status_code, 200) s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_templates_person_detail_meta_description_bio_exceeds_max_length(self):\n person = PersonFactory()\n page = person.extended_object\n placeholder_value = (\n \"Long description that describes the page with a summary. \"\n \"Long description that describes the page ...
[ "0.7431924", "0.7200077", "0.69734985", "0.6669384", "0.661611", "0.64824736", "0.63739985", "0.6300522", "0.6011192", "0.59699476", "0.5845052", "0.58380896", "0.58326775", "0.5792924", "0.5760811", "0.5732031", "0.5725326", "0.567543", "0.563398", "0.55857897", "0.5585393",...
0.7527318
0
This function list neighbour entries attached to the given device
def showNeighboursByDevice(logger, device, version=None): args = [] if version: if version == 4: args.append(IpConstant.IPV4) elif version == 6: args.append(IpConstant.IPV6) args += [IpOption.NEIGHBOUR, IpAction.SHOW, IpConstant.DEV, dev...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_neighbors(self):\n #checked#\n ###your code here###\n for address in self.homes:\n for i in range(-1, 2):\n for j in range(-1,2):\n neighbor_address=(address[0]+i, address[1]+j)\n if neighbor_address in self.homes and nei...
[ "0.6101965", "0.607459", "0.57528055", "0.57520497", "0.5742883", "0.5716349", "0.56814736", "0.5574797", "0.5566046", "0.5548959", "0.5539017", "0.5530729", "0.549348", "0.54754215", "0.547334", "0.5468345", "0.5450718", "0.5447196", "0.5421929", "0.54108864", "0.5410668", ...
0.63305134
0
This method defines the mesh points for a rectangle, i.e., the position of all mesh points, position of internal mesh ooints and the position of mesh points on the boundary The origin of a rectangular cooerdinate is set on the lower left vertex
def defineRectangleLayout(self): #--- Define a 2-D mesh --- # Divide x- and y-axis self.xPoints = self.frange(0,self.Lx,self.h) self.yPoints = self.frange(0,self.Ly,self.h) # Position (xy-coordinate) of boundary points boundary_xyCoord = [(0,j) for j in self.yPoints] + ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rectangle_mesh(point1=Point(0,0), point2=Point(2,1), numptsX=10, numptsY=5):\n\n mesh = RectangleMesh(point1, point2, numptsX, numptsY )\n print_mesh_stats(mesh)\n \n return mesh", "def defineCircleLayout(self):\n # Define a 2-D array representing the position of each mesh point\n s...
[ "0.64728147", "0.62877953", "0.6205329", "0.60404485", "0.6037853", "0.5973269", "0.5953323", "0.5934904", "0.589541", "0.58810884", "0.58740115", "0.58539", "0.57664204", "0.5756188", "0.57504964", "0.57337874", "0.5713471", "0.5667736", "0.5666688", "0.5631335", "0.5629928"...
0.7203463
0
This method defines the mesh points for a circle, i.e., the position of all mesh points, position of internal mesh ooints and the position of mesh points on boundary The circle is assumed to be circumvented in a square whose side is 2R, where R is the radius of the circle. The origin of coordinate is put on the lower l...
def defineCircleLayout(self): # Define a 2-D array representing the position of each mesh point self.xPoints = self.frange(0,self.R,self.h) self.yPoints = self.frange(0,self.R,self.h) # Position of internal mesh points internal_xyCoord = [(i,j) for i in self.xPoints for j in sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Circle(self, center=(0.,0.), radius=1., nrad=16, ncirc=40,\n element_type=\"tri\", refinement=False, refinement_level=2, algorithm=\"standard\"):\n\n if not isinstance(center,tuple):\n raise ValueError(\"The center of the circle should be given in a tuple with two elements (x,y)\")\n\n...
[ "0.6620402", "0.66109216", "0.65732807", "0.6343558", "0.632906", "0.6316999", "0.6316061", "0.62945837", "0.6293581", "0.6277532", "0.6220626", "0.6174127", "0.61614174", "0.6084093", "0.6067162", "0.6029042", "0.5996201", "0.59894913", "0.59739685", "0.59610116", "0.5938487...
0.7477296
0
Finds the label of a point in the mesh. Here, label simply means numbering of the points. x and y are the x and ycoordinates of the mesh point
def findLabel(self, x, y): #- xLabel - if x in self.xPoints: xLabel = self.xPoints.index(self.boundary_xyCoord[k][0]) else: # Find the points on the left and right of this point in xPoints done = 0 k = 0 while done == 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetPointForLabel(points):\n # TODO: find the last point at a minute boundary\n return points[-1]", "def _pos2label(self, p, labels):\n if labels is not None:\n if p in labels.keys():\n return labels[p]\n else:\n return ''\n # raise V...
[ "0.6582488", "0.6358846", "0.6352905", "0.6296264", "0.6275451", "0.6212019", "0.62040955", "0.62040955", "0.62040955", "0.6174925", "0.61322933", "0.6091263", "0.6082127", "0.6060067", "0.6033801", "0.6001611", "0.5974338", "0.5960098", "0.59467596", "0.59385484", "0.5938548...
0.7756455
0
Computes fE, fW, fN and fS for each mesh point. These are used to calcualte the coefficients needed to computing the Laplacian
def fCalc(self): # A dictionary composed of all internal and boundary points allPoints = dict(self.internalPoints.items() + self.boundaryPoints.items()) for pointLabel in allPoints.keys(): # Compute fE, fW, fN and fW only for internal mesh points if allPoints[pointLabel]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_mesh_laplacian(mesh, weights=None, fem_b=None, lap_type=\"conformal\"):\n print(\" Computing Laplacian\")\n if weights is None:\n (weights, fem_b) = compute_mesh_weights(mesh, weight_type=lap_type)\n\n if lap_type == \"fem\":\n weights.data = weights.data / 2\n\n N = weights....
[ "0.66401815", "0.5937063", "0.59241253", "0.57615346", "0.5728458", "0.5698205", "0.5588096", "0.5559542", "0.55237275", "0.54786545", "0.5427542", "0.54004824", "0.5383396", "0.5380944", "0.5374193", "0.5373815", "0.5343213", "0.53354645", "0.5324629", "0.5318333", "0.531444...
0.6225645
1
This method defines the mesh points for a given layoutType
def run(self): # Dictionaries whose keys are labels of the points in a 2-D grid and values # are an instance of the class meshPoint holding the informaiton about # that mesh point self.boundaryPoints = {} self.internalPoints = {} # Rectangle if self.layoutTyp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_kpoints(self):\n kpoints_mesh = KpointsData()\n kpoints_mesh.set_cell_from_structure(self.inputs.structure)\n kpoints_mesh.set_kpoints_mesh_from_density(\n distance=self.ctx.protocol['kpoints_mesh_density'],\n offset=self.ctx.protocol['kpoints_mesh_offset']\n ...
[ "0.61567265", "0.59727186", "0.5618531", "0.55318904", "0.55072707", "0.5487643", "0.53527415", "0.5328569", "0.5255884", "0.5221636", "0.51695275", "0.5121471", "0.51163435", "0.51055086", "0.5098627", "0.50728333", "0.5067539", "0.50483656", "0.50268656", "0.5023135", "0.49...
0.6759298
0
Returns a list of sharded queries for the given Cloud Datastore query. This will create up to the desired number of splits, however it may return less splits if the desired number of splits is unavailable. This will happen if the number of split points provided by the underlying Datastore is less than the desired numbe...
def get_splits(datastore, query, num_splits, partition=None): # Validate that the number of splits is not out of bounds. if num_splits < 1: raise ValueError('The number of splits must be greater than 0.') if num_splits == 1: return [query] _validate_query(query) splits = [] scatter_keys = _get_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_scatter_query(query, num_splits):\n\n scatter_query = query_pb2.Query()\n for kind in query.kind:\n scatter_kind = scatter_query.kind.add()\n scatter_kind.CopyFrom(kind)\n\n # ascending order\n datastore_helper.add_property_orders(scatter_query, SCATTER_PROPERTY_NAME)\n\n # There is a split ...
[ "0.67025167", "0.61562634", "0.5903706", "0.58714837", "0.5599633", "0.55345684", "0.5488992", "0.54546636", "0.5414201", "0.53706396", "0.5295972", "0.5295972", "0.52716196", "0.5193675", "0.51312673", "0.50698984", "0.50670683", "0.50543606", "0.504738", "0.501817", "0.5008...
0.7298268
0
Verifies that the given query can be properly scattered.
def _validate_query(query): if len(query.kind) != 1: raise ValueError('Query must have exactly one kind.') if query.order: raise ValueError('Query cannot have any sort orders.') if query.HasField('limit'): raise ValueError('Query cannot have a limit set.') if query.offset > 0: raise ValueErr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_data_validity(X, y, query, task):\n # ADD IMPLEMENTATION HERE", "def _verify_query_segregation(query, auth_project=None):\r\n auth_project = (auth_project or\r\n acl.get_limited_to_project(pecan.request.headers))\r\n\r\n if not auth_project:\r\n return\r\n\r\n for ...
[ "0.6401588", "0.6210684", "0.58407664", "0.57362634", "0.5674811", "0.5641738", "0.56243056", "0.56197655", "0.56001127", "0.5595915", "0.55926687", "0.5555283", "0.5554201", "0.55246806", "0.54903454", "0.5469015", "0.5455433", "0.54320014", "0.5399444", "0.5393129", "0.5352...
0.6341513
1
Validates that we only have allowable filters. Note that equality and ancestor filters are allowed, however they may result in inefficient sharding.
def _validate_filter(filter): if filter.HasField('composite_filter'): for sub_filter in filter.composite_filter.filters: _validate_filter(sub_filter) elif filter.HasField('property_filter'): if filter.property_filter.op in UNSUPPORTED_OPERATORS: raise ValueError('Query cannot have any inequalit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_filters(self, level):\n if(self.filters == Filters.NoFilter):\n return True\n else:\n return (self.filters & level.filters == 0)", "def is_valid_model_filters(model, filters):\n for key in filters.keys():\n if not hasattr(model, key):\n return F...
[ "0.6807991", "0.6739831", "0.6739831", "0.6700357", "0.65870214", "0.63247246", "0.6261503", "0.6168656", "0.61411965", "0.6037914", "0.5961685", "0.59602743", "0.59555244", "0.5937219", "0.59234697", "0.5908777", "0.5897933", "0.5850972", "0.58172536", "0.5808177", "0.575862...
0.79034907
0
Creates a scatter query from the given user query.
def _create_scatter_query(query, num_splits): scatter_query = query_pb2.Query() for kind in query.kind: scatter_kind = scatter_query.kind.add() scatter_kind.CopyFrom(kind) # ascending order datastore_helper.add_property_orders(scatter_query, SCATTER_PROPERTY_NAME) # There is a split containing enti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_query(self, query):\n query = pylastica.query.Query.create(query)\n data = query.to_dict()\n return self.set_param('query', data['query'])", "def _make_query(self):\r\n raise NotImplementedError()", "def make_query(self, query, data: Dict):\n return query.format_map(d...
[ "0.5525376", "0.5451804", "0.5393287", "0.5366259", "0.53469455", "0.53204435", "0.53188956", "0.53165925", "0.52957654", "0.5291086", "0.52879786", "0.52722937", "0.5265367", "0.5225464", "0.5224158", "0.51896924", "0.5150565", "0.5137202", "0.51339495", "0.5131162", "0.5131...
0.71407485
0
Given a list of keys and a number of splits find the keys to split on.
def _get_split_key(keys, num_splits): # If the number of keys is less than the number of splits, we are limited # in the number of splits we can make. if not keys or (len(keys) < (num_splits - 1)): return keys # Calculate the number of keys per split. This should be KEYS_PER_SPLIT, # but may be less if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _choose_split_points(cls, sorted_keys, shard_count):\n assert len(sorted_keys) >= shard_count\n index_stride = len(sorted_keys) / float(shard_count)\n return [sorted_keys[int(round(index_stride * i))]\n for i in range(1, shard_count)]", "def split_list(l, k):\n\n\tn = len(l)\n\tsublists =...
[ "0.6757466", "0.6268931", "0.6221212", "0.6128692", "0.5942825", "0.588038", "0.5819608", "0.58183414", "0.5790286", "0.57337314", "0.57150143", "0.56872034", "0.56827277", "0.56672984", "0.5664926", "0.5642625", "0.56417096", "0.56417096", "0.5603416", "0.55761635", "0.55568...
0.72753096
0
Board must count number of connections to origin properly.
def test_count_connected(self): data = [[0, 1, 0], [1, 0, 0], [0, 0, 1]] board = Board(data) self.assertEquals(board.count_connected(), 1) data = [[1, 1, 0], [1, 0, 0], [0, 0, 1]] board = Board(data) self.as...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __len__(self):\r\n return len(self.board)", "def play_round_Conway_Cell(self):\n for x in self.board:\n for f in x:\n f.live_neighbors = 0\n\n for i in range(1, self.cols - 1):\n for j in range(1, self.rows - 1):\n status = self.board[i][j].s...
[ "0.7049893", "0.6507776", "0.6334881", "0.63287544", "0.63064605", "0.62994397", "0.62831104", "0.6227796", "0.61846995", "0.61787885", "0.6168326", "0.6165085", "0.61543095", "0.6147843", "0.6074171", "0.6044323", "0.6024515", "0.6007123", "0.60047996", "0.5995366", "0.59897...
0.6705546
1
Load the dictionary from the filename
def load_dictionary(cls, filename, non_lang_syms=None): return AsrDictionary.load(filename, f_non_lang_syms=non_lang_syms)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dictionary(filename):\n filename = os.path.join(FILE_DIR, 'assets/obj/' + filename)\n try:\n with open(filename, 'rb') as input:\n return pickle.load(input)\n except Exception as e:\n print(\"exception\", e)", "def load_dictionary(filepath):\r\n # context manager rea...
[ "0.79066867", "0.7503246", "0.74313736", "0.7323459", "0.71952224", "0.71250665", "0.7083375", "0.70716083", "0.70621836", "0.7057795", "0.70570594", "0.7048259", "0.6998082", "0.6897135", "0.6888102", "0.68791723", "0.6873016", "0.6848805", "0.6822207", "0.6801678", "0.67969...
0.75451654
1
View used when Nginx Upload Progress module is enabled. When the Nginx Upload Progress module is used, we get to the WSGI application (and thus to this view) only when the file has been completely written to disk by Nginx. So here we merely copy it to the final upload directory and that is all.
def upload_with_nginx_upload_progress(request): input_file, file_size, filename = get_file_from_request(request) upload_dir = request.registry.settings['poulda.upload_dir'] path = os.path.join(upload_dir, filename) with open(path, 'w') as output: # We must read only 'file_size' bytes from the 'i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload(request):\n # We pass the 'file_id' in the query string as a GET parameter. If\n # we read it from the POSTed data, WebOb would read all POSTed\n # data, which has various features and traps (like setting the\n # \"Content-Length\" header to 0) that we do not need since we are\n # going t...
[ "0.63862", "0.6194678", "0.6183757", "0.58975005", "0.5862023", "0.58206344", "0.57981217", "0.57981217", "0.5738606", "0.55839986", "0.55655915", "0.5544447", "0.55011976", "0.5443568", "0.5443568", "0.54429203", "0.5387098", "0.53435814", "0.5304923", "0.5290966", "0.527481...
0.7100043
0
View used only when the Nginx Upload Progress support has been disabled. When the Nginx Upload Progress support is enabled, this view is never called at all, since the Nginx module takes care of returning progress information.
def progress(request): file_id = request.GET['X-Progress-ID'] session = DBSession() u = session.query(Upload).filter_by(id=file_id).one() data = {'state': u.state} if u.state == 'uploading': if not os.path.exists(u.tmp_path): # The temporary file has not been created yet or it ha...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upload_progress(request):\n filename = request.COOKIES['sessionid']\n tmpfile = os.path.join(tempfile.gettempdir(), filename)\n try:\n f = open(tmpfile, 'r')\n data = f.readlines()\n f.close()\n except Exception, e:\n data = \"{'uploaded': '1', 'total': '1', finished: t...
[ "0.6554945", "0.64034593", "0.62213355", "0.62133723", "0.6208436", "0.6106646", "0.6060596", "0.5965132", "0.59357363", "0.5908629", "0.5904201", "0.59027714", "0.5886245", "0.5858225", "0.58090687", "0.5805078", "0.573955", "0.5732239", "0.57051885", "0.5704621", "0.5654044...
0.667452
0
Return score for a subj, obj pair of entities.
def get_fact_score(extracted_scores, subj, obj, freq_dict, score_type='FREQ_SCORE'): score_types = set('FREQ_SCORE', 'MIN_SCORE') # Min of Page Rank scores of both Entities # Upweight facts where both have high scores min_score = min( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self, obj):\r\n query = \"\"\"\r\n SELECT SUM(vote), COUNT(vote)\r\n FROM %s\r\n WHERE content_type_id = %%s\r\n AND object_id = %%s\"\"\" % qn(self.model._meta.db_table)\r\n ctype = ContentType.objects.get_for_model(obj)\r\n cursor = connection.curs...
[ "0.63347", "0.6332622", "0.61146146", "0.60328287", "0.5940963", "0.5918125", "0.58817494", "0.5824574", "0.58078414", "0.58037364", "0.578324", "0.57741785", "0.5726161", "0.5708169", "0.57081425", "0.57005334", "0.56996214", "0.5697008", "0.56950974", "0.56923544", "0.55983...
0.6586029
0
barcode_filename should throw when sequence is wrong A ValueError exception should be raised if the second digit of the sequence (sequence % 10) is not the same as the ISO weekday number (%u).
def test_wrong_sequence(self): date = datetime(2016, 11, 12) seq = 31 with self.assertRaises(ValueError): star_barcode.barcode_filename(date, seq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ordinary(self):\n date = datetime(2016, 11, 12)\n seq = 36\n name = star_barcode.barcode_filename(date, seq)\n self.assertEqual(\n name,\n 'Barcode_2016-W45-6_36.pdf'\n )", "def test_year_boundary(self):\n date = datetime(2017, 1, 1)\n ...
[ "0.6670714", "0.6530107", "0.5832887", "0.58181393", "0.5765814", "0.57609874", "0.5743387", "0.5700269", "0.56717837", "0.5667678", "0.56279606", "0.5543977", "0.53887117", "0.5270413", "0.5240893", "0.5214146", "0.52075595", "0.520386", "0.51060236", "0.5103093", "0.5087052...
0.77777255
0
barcode_filename should use ISO week year not standard year January 1 2017 is the final ISO day (Sunday) in the final ISO
def test_year_boundary(self): date = datetime(2017, 1, 1) seq = 27 name = star_barcode.barcode_filename(date, seq) self.assertEqual( name, 'Barcode_2016-W52-7_27.pdf' )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_ordinary(self):\n date = datetime(2016, 11, 12)\n seq = 36\n name = star_barcode.barcode_filename(date, seq)\n self.assertEqual(\n name,\n 'Barcode_2016-W45-6_36.pdf'\n )", "def get_year(self, filename):\n year = self.file.replace('s24_...
[ "0.6433659", "0.5829394", "0.5579298", "0.5543711", "0.5455112", "0.54528177", "0.544621", "0.5437168", "0.53968394", "0.53321236", "0.5271344", "0.52466387", "0.5219768", "0.5202958", "0.51598704", "0.5142467", "0.5128275", "0.51264524", "0.51088095", "0.509985", "0.5091835"...
0.73840857
0
date_to_sequence_and_week handles a typical case Given a datetime object for 20161115 (a Tuesday) and a 7long list of the integer 2 the sequence returned should be 22 and the week 46.
def test_standard_seq_week(self): date = datetime(2016, 11, 15) prices = [2] * 7 expected_sequence = 22 expected_week = 46 self.assertEqual( star_barcode.date_to_sequence_and_week( date=date, price_codes=prices), (expected_sequence, expecte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_to_weeks(list_of_days):\n all_weeks = []\n for day in list_of_days:\n that_week = day.isocalendar()\n if (\n len(all_weeks) == 0\n or all_weeks[-1].year != that_week.year\n or all_weeks[-1].week != that_week.week\n ):\n all_weeks.appen...
[ "0.61387986", "0.60740703", "0.6026458", "0.5912314", "0.59121364", "0.58824337", "0.5854664", "0.58490837", "0.5826529", "0.58078784", "0.5777913", "0.5774713", "0.57356215", "0.5734437", "0.57301974", "0.5707575", "0.5675245", "0.56201994", "0.54466105", "0.5442153", "0.542...
0.657142
0
date_to_sequence_and_week handles a short price code list Given a datetime object for 20161115 (a Tuesday) and a 2long list of the integer 2 the sequence returned should be 22 and the week 46.
def test_short_prices(self): date = datetime(2016, 11, 15) prices = [2] * 2 expected_sequence = 22 expected_week = 46 self.assertEqual( star_barcode.date_to_sequence_and_week( date=date, price_codes=prices), (expected_sequence, expected_wee...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_standard_seq_week(self):\n date = datetime(2016, 11, 15)\n prices = [2] * 7\n expected_sequence = 22\n expected_week = 46\n self.assertEqual(\n star_barcode.date_to_sequence_and_week(\n date=date, price_codes=prices),\n (expected_sequ...
[ "0.67803526", "0.59415525", "0.55468106", "0.5470812", "0.54572535", "0.5452534", "0.5385184", "0.5376735", "0.53491974", "0.52875465", "0.5275247", "0.5237731", "0.5220215", "0.5215518", "0.5195454", "0.5180022", "0.51517755", "0.514522", "0.51418126", "0.5131633", "0.512274...
0.66608876
1
construct_postscript raises ValueError if bwipp is missing If the location passed to construct_postscript for the location of the bwipp postscript library does not exist, then it should raise ValueError.
def test_missing_bwipp(self): seq = 21 week = 46 header = 'MSTAR 2016-11-14 MON 1.0' with self.assertRaisesRegex(ValueError, 'BWIPP'): star_barcode.construct_postscript( bwipp_location=Path('/fake-path/not-here.ps'), issn=self.issn, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_typical(self):\n seq = 21\n week = 46\n header = 'MSTAR 2016-11-14 MON 1.0'\n issn_args = ' '.join([self.issn, str(seq), str(week)])\n result = star_barcode.construct_postscript(\n bwipp_location=self.bwipp,\n issn=self.issn,\n sequence=s...
[ "0.5087618", "0.43715426", "0.43431723", "0.41926655", "0.4133377", "0.4116569", "0.41082445", "0.4093432", "0.40924096", "0.40412655", "0.40265974", "0.4017204", "0.401558", "0.4012506", "0.39556316", "0.39462158", "0.39448643", "0.3938337", "0.3933324", "0.39185902", "0.391...
0.654025
0
construct_postscript raises ValueError for ISSN of incorrect length ISSNs are either 7 or 8 digits long (8 being the optional check digit), with a mandatory (for BWIPP) hyphen in the fifth place. construct_postscript should raise a ValueError if the ISSN is not of the form \d{4}\d{3,4}.
def test_issn_incorrect_length(self): issns = ['0307-15', '0307-15789', '03071758', '0307175'] for num in issns: with self.subTest(num=num): with self.assertRaisesRegex(ValueError, num): star_barcode.construct_postscript( issn=num, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_typical(self):\n seq = 21\n week = 46\n header = 'MSTAR 2016-11-14 MON 1.0'\n issn_args = ' '.join([self.issn, str(seq), str(week)])\n result = star_barcode.construct_postscript(\n bwipp_location=self.bwipp,\n issn=self.issn,\n sequence=s...
[ "0.5829142", "0.56344336", "0.55918896", "0.5059645", "0.5048119", "0.5004267", "0.49888775", "0.47327802", "0.4711844", "0.46778655", "0.46777925", "0.45442563", "0.45348784", "0.45309243", "0.45161062", "0.45033395", "0.45016456", "0.44776788", "0.44747177", "0.44611934", "...
0.7332778
0
construct_postscript raises ValueError if sequence outside range Sequence can be between 00 and 99. Although in our usage the second digit is the ISO weekday, so in practice limited 0107 and 9197, special sequences may require the extra numbers. Must not raise for sequences 0009, represented by integers 09, as these ar...
def test_sequence_outside_range(self): seqs = [-1, 100] for seq in seqs: with self.subTest(seq=seq): with self.assertRaisesRegex(ValueError, str(seq)): star_barcode.construct_postscript( sequence=seq, bwipp_l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sequence_0_to_9(self):\n seqs = list(range(10))\n for seq in seqs:\n with self.subTest(seq=seq):\n result = star_barcode.construct_postscript(\n sequence=seq,\n bwipp_location=self.bwipp,\n issn=self.issn,\n ...
[ "0.6997066", "0.634367", "0.6063364", "0.55118203", "0.5302438", "0.5274324", "0.5145185", "0.5130142", "0.49437207", "0.49163416", "0.48809633", "0.48788667", "0.485482", "0.48448265", "0.48089215", "0.4794429", "0.47890186", "0.47434813", "0.4631714", "0.45985904", "0.45810...
0.6875425
1
construct_postscript must not raise for sequences 0009 As all possible sequences run 0099, they can be adequately represented by an integer rather than a string. But the construct_postscript function must not raise for integers 09, even though as (unformatted) strings they are of length 1.
def test_sequence_0_to_9(self): seqs = list(range(10)) for seq in seqs: with self.subTest(seq=seq): result = star_barcode.construct_postscript( sequence=seq, bwipp_location=self.bwipp, issn=self.issn, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_typical(self):\n seq = 21\n week = 46\n header = 'MSTAR 2016-11-14 MON 1.0'\n issn_args = ' '.join([self.issn, str(seq), str(week)])\n result = star_barcode.construct_postscript(\n bwipp_location=self.bwipp,\n issn=self.issn,\n sequence=s...
[ "0.62206656", "0.6154193", "0.60054547", "0.50962126", "0.4953612", "0.49484235", "0.49279657", "0.49098706", "0.48882347", "0.4887555", "0.48665893", "0.48258013", "0.4716987", "0.47128314", "0.46274677", "0.45913213", "0.4562817", "0.45471853", "0.4519758", "0.450454", "0.4...
0.6519479
0
construct_postscript raises ValueError if 0 < week < 54 ISO weeks must be between 1 and 53.
def test_week_wrong(self): weeks = [0, 54] for week in weeks: with self.subTest(week=week): with self.assertRaisesRegex(ValueError, str(week)): star_barcode.construct_postscript( week=week, bwipp_location=sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_week_in_range(self):\n weeks = list(range(1, 54))\n seq = 21\n for week in weeks:\n with self.subTest(week=week):\n result = star_barcode.construct_postscript(\n week=week,\n bwipp_location=self.bwipp,\n ...
[ "0.6856618", "0.59355134", "0.5696191", "0.5515064", "0.5420971", "0.515004", "0.5008384", "0.49796438", "0.48173553", "0.4778165", "0.47201556", "0.47167677", "0.47131327", "0.47100455", "0.46958074", "0.46758375", "0.46508726", "0.45938125", "0.4555849", "0.45406747", "0.45...
0.7138101
0
construct_postscript accepts week >= 1, <= 53
def test_week_in_range(self): weeks = list(range(1, 54)) seq = 21 for week in weeks: with self.subTest(week=week): result = star_barcode.construct_postscript( week=week, bwipp_location=self.bwipp, issn=self.i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly():", "def test_week_wrong(self):\n weeks = [0, 54]\n for week in weeks:\n with self.subTest(week=week):\n with self.assertRaisesRegex(ValueError, str(week)):\n star_barcode.construct_postscript(\n week=week,\n ...
[ "0.6462268", "0.64046675", "0.58653", "0.5658921", "0.5573468", "0.5554211", "0.5514348", "0.5287353", "0.5228355", "0.51670694", "0.5163674", "0.5142728", "0.513467", "0.5127089", "0.51245564", "0.5107337", "0.5054805", "0.5047123", "0.503464", "0.50195706", "0.50117457", ...
0.69929993
0
process_arguments turns date into datetime
def test_date_only(self): args = { '--directory': './', '<date>': '2016-11-15', '<header>': None, '<seq>': None, '<week>': None } expected = { '--directory': Path('./'), '<date>': datetime(2016, 11, 15), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_dates(args):\n if 'date' in args:\n if args.get('period') == 'range' and 'end_date' in args:\n args['date'] = '{},{}'.format(args['date'],\n args['end_date'])\n return args", "def parse_date_ar...
[ "0.6994293", "0.64886105", "0.6331184", "0.62835664", "0.62754744", "0.6230057", "0.62074155", "0.6174838", "0.61325836", "0.61302996", "0.6023809", "0.6020006", "0.600959", "0.6000738", "0.5934657", "0.58660245", "0.58435833", "0.5829836", "0.58003515", "0.5754549", "0.57290...
0.67965895
1
Create a Connectable Observable. A multicasted Observable (rx_publish) uses a Subject under the hood to make multiple Observers see the same Observable execution.
def rx_publish( an_observable: Observable, subject_handler: Optional[SubjectHandler] = None, connection_handler: Optional[ConnectableObservableHandler] = None, subject_factory: SubjectFactory = rx_subject, ) -> ConnectableObservable: _ref_count_activated = False # Flag to enable auto-connect _r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auto_connect(self, subscriber_count: int = 1) -> Observable[_T]:\n\n connectable_subscription: List[Optional[abc.DisposableBase]] = [None]\n count = [0]\n source = self\n is_connected = [False]\n\n if subscriber_count == 0:\n connectable_subscription[0] = source.co...
[ "0.6327228", "0.5750856", "0.56302005", "0.5515695", "0.5454845", "0.5408904", "0.52990055", "0.5291215", "0.51549757", "0.5026792", "0.49772325", "0.4947613", "0.49465865", "0.4932727", "0.4932727", "0.48783442", "0.48331305", "0.47861823", "0.47821546", "0.47797227", "0.475...
0.7431155
0
Convert a hex string to an real application tag.
def real_tag(x): if _debug: real_tag._debug("real_tag %r", x) b = xtob(x) tag = Tag(Tag.applicationTagClass, Tag.realAppTag, len(b), b) if _debug: real_tag._debug(" - tag: %r", tag) return tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def a2b_hex(string):\n\n if len(string) % 2 == 1:\n string = '0' + string\n\n try:\n return binascii.a2b_hex(string.encode('ascii'))\n except TypeError:\n raise Error('Invalid hexadecimal string')", "def hex2bin(hexstr: str, padding: int) -> str:\n if not hexstr.lower().start...
[ "0.52152145", "0.5183621", "0.5144421", "0.51350594", "0.5121004", "0.5116178", "0.51159996", "0.5048852", "0.504039", "0.5035954", "0.502589", "0.49917215", "0.49784186", "0.49771157", "0.49458298", "0.4939181", "0.4935022", "0.49316686", "0.49273714", "0.49200398", "0.48948...
0.62485677
0
Encode an Real object into a tag.
def real_encode(obj): if _debug: real_encode._debug("real_encode %r", obj) tag = Tag() obj.encode(tag) if _debug: real_encode._debug(" - tag: %r, %r", tag, tag.tagData) return tag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(self, obj):\n # type: (List[List[Any]]) -> str\n raise NotImplementedError()", "def encode(self, o):\n # Our encoding prepends an 'x:' prefix.\n return b'x:%s' % str(o.name).encode('utf-8')", "def encode(self, o):\n # Our encoding prepends an 'x:' prefix.\n return b'x:%s' %...
[ "0.66648567", "0.6392294", "0.6392294", "0.63117164", "0.6230552", "0.6224176", "0.6219446", "0.6212044", "0.6202672", "0.61778486", "0.6174891", "0.6076576", "0.6026148", "0.600362", "0.59921145", "0.5973116", "0.5968331", "0.59151846", "0.59141284", "0.590889", "0.58611935"...
0.8445998
0
Decode an real application tag into an real.
def real_decode(tag): if _debug: real_decode._debug("real_decode %r", tag) obj = Real(tag) if _debug: real_decode._debug(" - obj: %r, %r", obj, obj.value) return obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_tag(x):\n if _debug: real_tag._debug(\"real_tag %r\", x)\n\n b = xtob(x)\n tag = Tag(Tag.applicationTagClass, Tag.realAppTag, len(b), b)\n if _debug: real_tag._debug(\" - tag: %r\", tag)\n\n return tag", "def decode(self, encoded):", "def decode(data):\n raise NotImplementedEr...
[ "0.5753349", "0.54978716", "0.5208845", "0.5159719", "0.49766794", "0.49363422", "0.4895536", "0.48932958", "0.48754647", "0.486865", "0.486865", "0.4816334", "0.4798622", "0.47956207", "0.4790625", "0.47812086", "0.47764444", "0.477164", "0.47608012", "0.47092384", "0.469922...
0.64384407
0
Write the cfg, bnd and all results in working dir. prefix is a string that will determine the name of the created files. If there is a conflict with existing files, the existing files will be replaced or not, depending on the value of the replace argument.
def save(self, prefix, replace=False): if not _check_prefix(prefix): return # Create the results directory try: os.makedirs(prefix) except OSError: if not replace: print('Error directory already exists: %s' % prefix, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(self, basedir, outdir, name, prefix=None):", "def prefix(args):\n\n args.suppress_verify_output = True\n if verify(args) != 0:\n # restore stdout\n sys.stdout = sys.__stdout__\n print(\"Config file not valid, please use the verify function to debug\")\n return 1\n\n ...
[ "0.635768", "0.586553", "0.54163074", "0.53897345", "0.53673553", "0.5315337", "0.5300036", "0.5274199", "0.5262346", "0.52035856", "0.5146001", "0.5133099", "0.51283026", "0.51201814", "0.51081294", "0.509893", "0.50881577", "0.5049526", "0.50436527", "0.49555004", "0.491972...
0.7196396
0
Carga los chatbots que se han creado con el MetaChatBot y los pone en la variable lista de chatbots.
def loadChatbots(self): pathChatbots = os.path.dirname(os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))) # ruta donde se guardarán los chatbots listAllChatbots = os.listdir(pathChatbots) # lista de chatbots en la ruta if len(listAllChatbots) ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bots():\n return get_bots(\"botsunlimited.settings\")", "async def bot_list(self) -> list:\n return await self._do_request(\"get\", botlist_address, self._user_auth)", "def list(self):\n\n result = []\n for i in self.bots:\n result.append(i.name)\n return result", ...
[ "0.6440786", "0.6281717", "0.6269866", "0.60385484", "0.5908586", "0.5807652", "0.57034916", "0.56967723", "0.5637857", "0.5546249", "0.554186", "0.5504985", "0.54998374", "0.5493724", "0.54400545", "0.5419266", "0.54172266", "0.54100966", "0.5401008", "0.53980523", "0.536805...
0.6672791
0
Elimina un chatbot de la lista
def deleteStructureChatbotDict(self,sentence): if sentence in self.dictChatBots: del self.dictChatBots[sentence] if not(self.currentStructureChatBot is None) and sentence == self.currentStructureChatBot.name: self.currentStructureChatBot = None # se reestablec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def del_memes(context):\n\n for meme_sent in MEMES_SENT:\n meme_sent[0].delete() # Delete the photo sent\n\n # for meme_sent in MEMES_SENT: # Edit the message sent\n # edited_text = f\"i sent a meme for {meme_sent[3]} but its deleted now. sent such a coolio meme and you missed it? lol better ...
[ "0.6861239", "0.671623", "0.66893005", "0.6594528", "0.6464064", "0.6448829", "0.6392518", "0.63728786", "0.6306389", "0.6304155", "0.62954575", "0.62544626", "0.61831826", "0.61374134", "0.6090278", "0.60877824", "0.6072825", "0.60493064", "0.6018521", "0.59921765", "0.59625...
0.6754195
1
Estimate sample Lmoments, based on Fortran code written for inclusion in IBM Research Report RC20525, 'FORTRAN ROUTINES FOR USE WITH THE METHOD OF LMOMENTS, VERSION 3' by J. R. M. Hosking, IBM Research Division, T. J. Watson Research Center, Yorktown Heights, NY 10598, Version 3 August 1996.
def _estimate_lmoments(values): # we need to have at least four values in order to make a sample L-moments estimation number_of_values = np.count_nonzero(~np.isnan(values)) if number_of_values < 4: message = 'Insufficient number of values to perform sample L-moments estimation' _logge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_log_moment(self, num_examples=5040):\n q = tf.cast(num_examples, tf.float64) * 1.0 / self._total_examples\n mu_1, sigma_1 = 0, 4 # mean and standard deviation\n s_1 = np.random.normal(mu_1, sigma_1, 1000)\n mu_2, sigma_2 = 1, 4 # mean and standard deviation\n s_2 = np.random.normal(mu...
[ "0.5974585", "0.5965852", "0.59529734", "0.5871154", "0.5866207", "0.5765351", "0.57264125", "0.5722149", "0.5719706", "0.5702045", "0.5696745", "0.56964016", "0.56698036", "0.56648046", "0.5660657", "0.5654306", "0.56494606", "0.56422335", "0.5630442", "0.5622559", "0.561797...
0.75961566
0
Universal function (ufunc) used to perform fitting of a value to a Pearson Type III distribution as described by the Pearson Type III parameters and probability of zero arguments.
def _pearson_fit_ufunc(value_to_fit, pearson_param_1, pearson_param_2, pearson_param_3, probability_of_zero): fitted_value = np.NaN # only fit to the distribution if the value is valid/not missing if not m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fu_fit(fu, v):\n popt, pcov = curve_fit(\n lambda v, a : beta.cdf(v, a, 1),\n v, fu,\n p0 = (1,)\n )\n chi2 = np.sum((beta.cdf(v, *popt, 1) - fu)**2 / (len(v)-2))\n res = np.zeros(len(popt)+1)\n res[0:1] = popt\n res[1] = math.sqrt(chi2)\n return res", "def scalar():...
[ "0.58594096", "0.57445276", "0.5513431", "0.5453187", "0.5377383", "0.5373627", "0.53578883", "0.53555936", "0.5353605", "0.5349096", "0.5334888", "0.5317195", "0.53059936", "0.52796435", "0.5270886", "0.52526087", "0.5245205", "0.5244957", "0.5240639", "0.523926", "0.5236488...
0.77840495
0
Test the __init__ method when parameter 'mac' is None. Should raise an AttributeError.
def test_init_no_mac(self): # mocks of files rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3) with self.assertRaises(ValueError): ap = APInfo(port_id=1, ip="2.2.2.2", mac=None, radio_mac="bb:bb:bb:bb:bb:00", udp_port=12345, wlc_ip='1.1.1.1', gateway_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_no_mac(self):\n with self.assertRaises(ValueError):\n client = ClientInfo(None, ip=\"3.3.3.3\", ap_info=self.ap)", "def test_init_valid(self):\n payload = payloads.MACResponsePayload(\n self.unique_identifier,\n self.mac_data)\n self.assertEqual...
[ "0.80347633", "0.6937742", "0.67790335", "0.6592743", "0.65171486", "0.64225554", "0.63336587", "0.6297807", "0.6291427", "0.62434447", "0.6237877", "0.618715", "0.6131393", "0.6048131", "0.60438824", "0.6021288", "0.5993613", "0.598887", "0.5986037", "0.59799427", "0.5956695...
0.78006566
1
Test the __init__ method when parameter 'ip' is None. Since the field is optional, it should pass.
def test_init_no_ip(self): # mocks of files rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3) ap = APInfo(port_id=1, ip=None, mac="bb:bb:bb:bb:bb:bb", radio_mac="bb:bb:bb:bb:bb:00", udp_port=12345, wlc_ip='1.1.1.1', gateway_ip='1.1.1.2', ap_mode=APMode.LOCAL, rsa_ca_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_no_ip(self):\n client = ClientInfo(\"cc:cc:cc:cc:cc:cc\", ip=None, ap_info=self.ap)\n self.assertEqual(client.ip, None)\n self.assertEqual(client.ip_bytes, None)", "def __init__(__self__, *,\n ip: Optional[pulumi.Input['IPAccessControlArgs']] = None):\n i...
[ "0.7619989", "0.7324193", "0.7324193", "0.7323932", "0.70612985", "0.6996996", "0.6709637", "0.6705524", "0.6618657", "0.65942365", "0.6415844", "0.6387556", "0.6366282", "0.6358961", "0.6319033", "0.6228522", "0.6208983", "0.6139439", "0.6108403", "0.6083423", "0.6066069", ...
0.7339444
1
Test the __init__ method when mandatory parameter 'mac' is None.
def test_init_no_mac(self): with self.assertRaises(ValueError): client = ClientInfo(None, ip="3.3.3.3", ap_info=self.ap)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_no_mac(self):\n # mocks of files\n rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)\n\n with self.assertRaises(ValueError):\n ap = APInfo(port_id=1, ip=\"2.2.2.2\", mac=None, radio_mac=\"bb:bb:bb:bb:bb:00\", udp_port=12345, wlc_ip='1.1.1.1',\n ...
[ "0.7700126", "0.718434", "0.7076505", "0.69038445", "0.68528235", "0.64499795", "0.6309808", "0.6301054", "0.6203087", "0.616466", "0.6155142", "0.61442065", "0.61114347", "0.609657", "0.607744", "0.6011186", "0.6001735", "0.59643024", "0.5931269", "0.5910585", "0.5905488", ...
0.79045194
0
Test the __init__ method when parameter 'ip' is None. Since the field is optional, it should pass.
def test_init_no_ip(self): client = ClientInfo("cc:cc:cc:cc:cc:cc", ip=None, ap_info=self.ap) self.assertEqual(client.ip, None) self.assertEqual(client.ip_bytes, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_no_ip(self):\n # mocks of files\n rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)\n\n ap = APInfo(port_id=1, ip=None, mac=\"bb:bb:bb:bb:bb:bb\", radio_mac=\"bb:bb:bb:bb:bb:00\", udp_port=12345, wlc_ip='1.1.1.1',\n gateway_ip='1.1.1.2', ap_mode=APMode....
[ "0.7339444", "0.7324193", "0.7324193", "0.7323932", "0.70612985", "0.6996996", "0.6709637", "0.6705524", "0.6618657", "0.65942365", "0.6415844", "0.6387556", "0.6366282", "0.6358961", "0.6319033", "0.6228522", "0.6208983", "0.6139439", "0.6108403", "0.6083423", "0.6066069", ...
0.7619989
0
Test the __init__ method when mandatory parameter 'ap_info' is of wrnong type.
def test_init_wrong_ap_type(self): ap_wrong = object() with self.assertRaises(ValueError): client = ClientInfo("cc:cc:cc:cc:cc:cc", ip="3.3.3.3", ap_info=ap_wrong)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_init_correct(self):\n # mocks of files\n rsa_ca_priv_file, rsa_priv_file, rsa_cert_file = range(3)\n\n ap = APInfo(port_id=1, ip=\"2.2.2.2\", mac=\"bb:bb:bb:bb:bb:bb\", radio_mac=\"bb:bb:bb:bb:bb:00\", udp_port=12345, wlc_ip='1.1.1.1',\n gateway_ip='1.1.1.2', ap_mod...
[ "0.6921114", "0.65740025", "0.6484534", "0.6405382", "0.6275763", "0.6217997", "0.6217997", "0.6214719", "0.6097751", "0.6065284", "0.6019445", "0.5953711", "0.59293115", "0.5921581", "0.5915253", "0.58873135", "0.5881595", "0.58771056", "0.5855381", "0.5837291", "0.57922626"...
0.7740714
0
Generator that randomly picks a banner.
def p_banner(): return random.choice([banner, banner_two, banner_three, banner_four, banner_five])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_banner(banners):\n # simple random\n n = random.randint(0, len(banners)-1)\n return banners[n]", "def random_agent(bandit, iterations):\n\n for i in range(iterations):\n a = random.choice(bandit.actions)\n r = bandit.sample(a)\n yield a, r", "def __call__...
[ "0.83091736", "0.59306204", "0.58803475", "0.5830148", "0.5823706", "0.5815695", "0.5790653", "0.578291", "0.57775927", "0.57775927", "0.5766402", "0.5765952", "0.57585686", "0.5751899", "0.571453", "0.57093734", "0.5685661", "0.5679009", "0.5675502", "0.5662307", "0.5655421"...
0.82409924
1
Return the estimation of the frequncy of _item
def estimate(self, item): return self.A[item] if item in self.A.keys() else 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSupport(item):\n return float(freqSet[item]) / len(transactionList)", "def frequency(my_list, item):\n return float(my_list.count(item)) / float(len(my_list))", "def probability(self, item):\n count = self.counter.get(item, 0)\n if self.smoothing_dict:\n smooth_count...
[ "0.7510796", "0.69838566", "0.6894229", "0.68342465", "0.65238917", "0.6520979", "0.65185326", "0.6337576", "0.6205688", "0.6191449", "0.618391", "0.61624837", "0.60866416", "0.6069064", "0.6059242", "0.60343236", "0.6033009", "0.5995923", "0.59935904", "0.58633614", "0.58616...
0.71200216
1
Create two sidewalk nodes from three nodes in a street.
def make_sidewalk_nodes(street, prev_node, curr_node, next_node): if prev_node is None: v = - curr_node.vector_to(next_node, normalize=False) vec_prev = curr_node.vector() + v prev_node = Node(None, vec_prev[0], vec_prev[1]) elif next_node is None: v = - curr_node.vector_to(prev_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_crosswalks(street_network, sidewalk_network):\n\n intersection_nodes = street_network.nodes.get_intersection_nodes()\n # intersection_nodes = [street_network.nodes.get(nid) for nid in intersection_node_ids]\n\n # Create sidewalk nodes for each intersection node and overwrite the adjacency informa...
[ "0.7492876", "0.70636004", "0.67605174", "0.6115718", "0.6109412", "0.6021206", "0.601323", "0.58551604", "0.5776858", "0.5567624", "0.54745114", "0.5371082", "0.53700775", "0.53357", "0.5334523", "0.53326386", "0.53183347", "0.53169686", "0.5308732", "0.52969956", "0.5264002...
0.76479685
0
Sort nodes around the center_node in clockwise
def sort_nodes(center_node, nodes): def cmp(n1, n2): angle1 = (math.degrees(center_node.angle_to(n1)) + 360.) % 360 angle2 = (math.degrees(center_node.angle_to(n2)) + 360.) % 360 if angle1 < angle2: return -1 elif angle1 == angle2: return 0 else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def angle_sort_adjacent_nodes(self,n,ref_nbr=None):\n nbrs=self.node_to_nodes(n)\n if len(nbrs)==0:\n return []\n diffs=self.nodes['x'][nbrs] - self.nodes['x'][n]\n angles=np.arctan2(diffs[:,1],diffs[:,0])\n nbrs=nbrs[np.argsort(angles)]\n if ref_nbr is not None...
[ "0.6512776", "0.6447932", "0.6426049", "0.6336005", "0.62776023", "0.62600493", "0.62230253", "0.620947", "0.619001", "0.6097722", "0.6039976", "0.6013449", "0.59956414", "0.5990902", "0.5963925", "0.5945009", "0.5903254", "0.5896407", "0.5880149", "0.5859731", "0.5853133", ...
0.84855396
0
Make a crosswalk node from three nodes. The first one is a pivot node and two other nodes are ones that are connected to the pivot node. The new node is created between the two nodes.
def make_crosswalk_node(node, n1, n2): v_curr = node.vector() v1 = node.vector_to(n1, normalize=True) v2 = node.vector_to(n2, normalize=True) v = v1 + v2 v /= np.linalg.norm(v) # Normalize the vector v_new = v_curr + v * 0.00011 # v_new = v_curr + np.array(latlng_offset(v_curr[0], vector=v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_crosswalk_nodes(intersection_node, adj_street_nodes):\n if len(adj_street_nodes) < 4:\n raise ValueError(\"You need to pass 4 or more nodes for adj_street_nodes \")\n\n crosswalk_nodes = []\n for i in range(len(adj_street_nodes)):\n n1 = adj_street_nodes[i - 1]\n n2 = adj_str...
[ "0.5853841", "0.559815", "0.5525337", "0.5493262", "0.5337593", "0.53229654", "0.5302764", "0.52075243", "0.5164342", "0.5134576", "0.5120714", "0.5114995", "0.5095743", "0.5006646", "0.4994069", "0.49922845", "0.4960581", "0.49248648", "0.4921853", "0.4896195", "0.48945636",...
0.64911985
0
Connect crosswalk nodes to sidewalk nodes. Then remove redundant sidewalk nodes around the intersection.
def connect_crosswalk_nodes(sidewalk_network, crosswalk_node_ids): # crosswalk_node_ids = crosswalk.get_node_ids()[:-1] # Crosswalk has a redundant node at the end. for crosswalk_node_id in crosswalk_node_ids[:-1]: try: # Get the intersection node and two nodes that created the intersectio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_crosswalks(street_network, sidewalk_network):\n\n intersection_nodes = street_network.nodes.get_intersection_nodes()\n # intersection_nodes = [street_network.nodes.get(nid) for nid in intersection_node_ids]\n\n # Create sidewalk nodes for each intersection node and overwrite the adjacency informa...
[ "0.6593879", "0.6568376", "0.57184863", "0.57171595", "0.5688481", "0.5669665", "0.5584961", "0.5583269", "0.55469465", "0.5519208", "0.5487563", "0.54811114", "0.5460484", "0.5458733", "0.5423852", "0.5416431", "0.53239524", "0.5261848", "0.5261536", "0.5253484", "0.5230734"...
0.72504723
0
Splits a large OSM files
def split_large_osm_file(filename): command = "java -Xmx4000M -jar ./lib/splitter.jar --output=xml --output-dir=data --max-nodes=15000 " + filename + " > splitter.log" os.system(command)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_file(self, input_file):\r\n file_list = [] \r\n with open(input_file, 'r', encoding='GB18030', errors='ignore') as f_in:\r\n data = f_in.readlines()\r\n lines_num = len(data)\r\n size = lines_num // self.num_workers # lines splitted in a chunk\r\n ...
[ "0.6776535", "0.6658732", "0.6537813", "0.641983", "0.6385792", "0.6284475", "0.6230259", "0.6148328", "0.6138635", "0.61125404", "0.60882944", "0.6068976", "0.6046665", "0.60240245", "0.5992238", "0.59826624", "0.596513", "0.595883", "0.59121525", "0.5833727", "0.5827267", ...
0.70029205
0
Returns a merged sidewalk network Takes two sidewalk networks and merges them without duplicating sidewalk data
def merge_sidewalks(sidewalk_network1, sidewalk_network2): for node in sidewalk_network1.nodes.get_list(): node.confirmed = True ''' # add new nodes from sidewalk_network2 to sidewalk_network1 for sidewalk_node in sidewalk_network2.nodes.get_list(): in_other = False same_node =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_networks_in_series(n1, n2):\n new_l_size = n1.l_size + n2.l_size + 1 # One additional vertex in between.\n new_u_size = n1.u_size + n2.u_size\n\n # Connect the 0-pole and the inf-pole in the result network.\n new_link_edge = n1.zero_pole.insert_before()\n new_link_edge_opp = n2.inf_pole.i...
[ "0.6948328", "0.6779855", "0.6415078", "0.6316667", "0.62008923", "0.6062278", "0.6058839", "0.6043561", "0.6039173", "0.6013152", "0.59606683", "0.59541595", "0.59236413", "0.5908109", "0.59027153", "0.5885178", "0.5791493", "0.57893294", "0.57688636", "0.57563233", "0.57294...
0.7956663
0
Convert a Java object of `SparseVectorWrapper` to a scipy sparse matrix whose number of rows is 1. `j_obj.getSize()` must return a positive number.
def j_sparse_vector_wrapper_to_scipy_spmatrix(j_obj: JavaObject): indices = np.frombuffer(j_obj.getIndicesBytes(), dtype="<i4") values = np.frombuffer(j_obj.getValuesBytes(), dtype="<f8") size = j_obj.getSize() indptr = np.array([0, indices.shape[0]], dtype=np.int32) return csr_m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sparse(self):\n from divisi2.sparse import SparseVector\n return SparseVector(self, self.labels)", "def to_sparse(self):\n from divisi2.sparse import SparseMatrix\n return SparseMatrix(self, self.row_labels, self.col_labels)", "def sparse_matrix(data, stype=\"csr\", dtype=com...
[ "0.6758371", "0.6584369", "0.63413817", "0.62148833", "0.6176313", "0.61322516", "0.61192065", "0.6099706", "0.60937256", "0.60803705", "0.5934155", "0.59088725", "0.5851765", "0.5839966", "0.58354145", "0.58263737", "0.58221644", "0.58093333", "0.5790453", "0.5756694", "0.56...
0.84431887
0
User not logged in returns 403
def test_not_logged_in(self): response = self.c.get(reverse(submit_point), {'lat': 34.0, 'lng': 45.3, 'zoom': 13}) self.assertEqual(response.status_code, 403)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_not_logged_user_cannot_access(self):\n\n utils.test_not_logged_cannot_access(self, self.url)", "def test_not_logged_user_cannot_access(self):\n\n utils.test_not_logged_cannot_access(self, self.url)", "def test_not_logged_user_cannot_access(self):\n\n utils.test_not_logged_cannot_a...
[ "0.75391126", "0.75391126", "0.75391126", "0.75391126", "0.745583", "0.729318", "0.72895944", "0.728383", "0.7196082", "0.7116251", "0.7104749", "0.7040694", "0.7040694", "0.70018977", "0.70018977", "0.70018977", "0.691351", "0.69067097", "0.68914956", "0.6850118", "0.681733"...
0.7585612
0
The same point is not submitted twice
def test_same_point_not_submitted(self): self.c.force_login(self.u) data = {'lat': 34.0, 'lng': 45.3, 'zoom': 13} response = self.c.get(reverse(submit_point), data) response = self.c.get(reverse(submit_point), data) response = self.c.get(reverse(submit_point), data) respo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_duplicate_question(self):\n\n self.post_question()\n return self.post_question()", "def post_duplicate_meetup(self):\n\n self.post_meetup()\n return self.post_meetup()", "def test_create_single_poll_submission(self):\r\n # This method utilises the POST request method...
[ "0.6164863", "0.5824898", "0.57879406", "0.5720838", "0.5720838", "0.5641985", "0.5631077", "0.5560973", "0.55347097", "0.54725015", "0.5429235", "0.5414906", "0.5264571", "0.5264571", "0.5264571", "0.5264571", "0.5264571", "0.5264571", "0.5264571", "0.5264571", "0.5264571", ...
0.7431294
0
Return thumbnail for image.
def get_thumbnail(img_path): thumb = JPEGImage(unicode(img_path)).exif_thumbnail.as_blob() if thumb: logger.debug("Using EXIF thumbnail for {0}".format(img_path)) return thumb else: logger.debug("Generating thumbnail for {0}".format(img_path)) return scale_image(unicode(img_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thumbnail(self, item):\n if self._has_image_field(item) and self._field_is_visible('image'):\n tile_conf = self.get_tile_configuration()\n image_conf = tile_conf.get('image', None)\n if image_conf:\n scaleconf = image_conf['imgsize']\n # Sca...
[ "0.7674613", "0.76600677", "0.7653746", "0.7650969", "0.75755334", "0.7431497", "0.73779297", "0.71744597", "0.71693736", "0.71072376", "0.7059326", "0.705206", "0.7002036", "0.6974647", "0.695208", "0.69503266", "0.68614525", "0.6830077", "0.68119925", "0.6811585", "0.680578...
0.8027751
0
Context Manager that mounts the first available partition on a USB drive, yields its path and then unmounts it.
def mount_stick(stick): mount = stick.get_dbus_method( "FilesystemMount", dbus_interface="org.freedesktop.UDisks.Device") path = mount('', []) try: yield path except Exception as e: raise e finally: unmount = stick.get_dbus_method( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_mountpoint(mount_point):\n execute('mount', mount_point, sudo=True)\n yield\n execute('umount', mount_point, sudo=True)", "def device_mounted(uuid):\n out, err = run_cmd(['lsblk', '-o', 'NAME,UUID,MOUNTPOINT', '--json'])\n\n blockdevices = json.loads(out)['blockdevices']\n\n for blkd...
[ "0.70899236", "0.6207645", "0.61623937", "0.6131135", "0.6095027", "0.59806234", "0.58773124", "0.5866817", "0.58360296", "0.5835725", "0.5802551", "0.5792832", "0.57846195", "0.57844996", "0.57720214", "0.5739339", "0.5727825", "0.57082254", "0.5678425", "0.5647393", "0.5639...
0.62446415
1