query
stringlengths
10
2k
document
stringlengths
20
51.2k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Simplify a list by remove zeros on right hand side
def simplify(coefficients): current_degree = -1 for i in range(len(coefficients)): if (abs(coefficients[i]) > EPSILON): current_degree = i return coefficients[:current_degree + 1]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def task5_push_zeros(input_list):\n for elem in input_list:\n if elem == 0:\n input_list.remove(elem)\n input_list.append(0)\n return input_list", "def move_zeros(items: list) -> Iterable[int]:\n return [x for x in items if x != 0] + [x for x in items if x == 0]", "def mov...
[ "0.68204486", "0.6741805", "0.66045904", "0.6549311", "0.65383345", "0.6470629", "0.6458993", "0.6444168", "0.64283675", "0.64080495", "0.6401907", "0.6370814", "0.63668054", "0.63651717", "0.63514364", "0.6336873", "0.633462", "0.63027376", "0.6301348", "0.6291057", "0.62873...
0.0
-1
Writes the dictionary into a JSON file
def _dict_to_json(self): try: from os.path import getsize if getsize(self.db_path)/1024 > 1024**3: print("File Size Limit reached (> 1 GB)") return False except FileNotFoundError: pass try: self._lock() w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(self, _filepath=None):\n _json_txt = json.dumps(self.json_dict, indent=2)\n self._write_json_text(_json_txt, _filepath)", "def write(self, fp, **kwds):\n json.dump(self._dict, fp)", "def write_json(dictionary, filename):\r\n with open(filename, 'w') as data_file:\r\n js...
[ "0.8372794", "0.827657", "0.81439865", "0.8140624", "0.81330544", "0.8123982", "0.80605495", "0.8054747", "0.8021045", "0.7963498", "0.7939668", "0.7877664", "0.7827506", "0.7780276", "0.77772033", "0.77772033", "0.7754394", "0.77496463", "0.7724768", "0.77154714", "0.7698979...
0.0
-1
Compute the discounted reward backwards in time
def discount_rewards(rwd, gamma=0.99): discounted_r = np.zeros_like(rwd) running_add = 0 for t in range(len(rwd)-1, -1, -1): running_add = running_add * gamma + rwd[t] discounted_r[t] = running_add return discounted_r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _compute_reward(self):\n last_score = self.episode_qualities[-2]\n new_score = self.episode_qualities[-1]\n reward = new_score - last_score\n return reward", "def discount_rewards(rewards):\r\n discounted_r = np.zeros_like(rewards)\r\n running_add = 0\r\n for t in reverse...
[ "0.7364386", "0.7289322", "0.72852564", "0.72272784", "0.71608216", "0.71490854", "0.71231914", "0.70985013", "0.7051685", "0.7003924", "0.6974387", "0.695452", "0.695371", "0.6940347", "0.6930859", "0.6926646", "0.69232625", "0.691938", "0.690888", "0.68827343", "0.686575", ...
0.6623506
33
L{UserAgent.parse_OPERA} should return a UserAgent instance for an Opera 9 UserAgent string.
def test_parseOpera9(self): agent = UserAgent.parse_OPERA('Opera/9.20 (Windows NT 6.0; U; en)') self.assertEqual(agent.browser, browsers.OPERA) self.assertEqual(agent.version, (9, 20))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_operaParser(self):\n agent = UserAgent.fromHeaderValue('Opera/9.20 (Windows NT 6.0; U; en)')\n self.assertEqual(agent.browser, browsers.OPERA)", "def parse_os(self) -> None:\n if not self.os:\n self.os = OS(\n self.user_agent,\n self.ua_hash,...
[ "0.8164038", "0.56154656", "0.5230294", "0.5143173", "0.5108097", "0.5104196", "0.5098348", "0.4981631", "0.49663305", "0.49302748", "0.49302748", "0.48782483", "0.4854487", "0.48433423", "0.48423147", "0.48137057", "0.48036197", "0.47970572", "0.47911474", "0.47638467", "0.4...
0.8391486
0
Returns True if s is a valid coding or noncoding variant, else False.
def valid_variant(s, is_coding=True): _validate_str(s) if s == WILD_TYPE_VARIANT: return True else: if is_coding: for mut in s.split(", "): match = re_coding.match(mut) if match is None: return False return True ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate(self, s):\n if len(s) == 0:\n return False\n if s in self.whitelist:\n return True\n if s in self.blacklist:\n return False\n\n # SQL Types are rarely used\n if 't' in s and 'f(t' not in s and 'At' not in s:\n return False\...
[ "0.72035474", "0.6961041", "0.66656667", "0.6562472", "0.6549987", "0.6363448", "0.63200104", "0.6189151", "0.61818963", "0.6130783", "0.607805", "0.6077228", "0.6064334", "0.60626346", "0.6010145", "0.59984577", "0.59979177", "0.59434646", "0.5941066", "0.5933571", "0.592555...
0.7935333
0
Store a new experience in the buffer. Params
def append_data(self, state, action, reward, next_state, finish): if len(self.data) < self.max_data: # if the list isn't already full we simply push the result # in the end of the list self.data.append(tuple((state, action, reward, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, experience):\n self.buffer.append(experience)", "def append(self, experience: Experience) -> None:\n self.buffer.append(experience)", "def store(self, experience):\n\n self.memory.store(experience)", "def remember(self, experience):\n self.memory.append(experience)",...
[ "0.78609574", "0.75496125", "0.7474227", "0.74703896", "0.74410576", "0.7265206", "0.72429717", "0.68903375", "0.6808411", "0.6795076", "0.66981685", "0.6487271", "0.63401425", "0.6324192", "0.61409914", "0.6092154", "0.6092154", "0.6092154", "0.6092154", "0.6092154", "0.6092...
0.0
-1
given a sklearn confusion matrix (cm), make a nice plot Arguments
def plot_cm(cm, target_names, title='Confusion matrix', cmap=None, normalize=True): accuracy = np.trace(cm) / float(np.sum(cm)) misclass = 1 - accuracy if cmap is None: cmap = plt.get_cmap('Blues') plt.figure(figsize=(6, 6), dpi=100) plt.ims...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, class_names):\n figure = plt.figure(figsize=(10, 10))\n plt.imshow(cm, interpolation='nearest', cmap=plt.cm.Blues)\n plt.title(\"Confusion matrix\")\n plt.colorbar()\n tick_marks = np.arange(len(class_names))\n plt.xticks(tick_marks, class_names, rotation=45)\n plt.yticks(tick_...
[ "0.79997694", "0.79955804", "0.7947871", "0.79360676", "0.79129595", "0.7897813", "0.7879448", "0.786082", "0.786082", "0.78540397", "0.78501374", "0.78499055", "0.78404397", "0.7835427", "0.7828328", "0.78253037", "0.78049725", "0.78017557", "0.77822274", "0.77789044", "0.77...
0.0
-1
The suffix name of a Global Datastore. If `global_replication_group_id_suffix` is changed, creates a new resource.
def global_replication_group_id_suffix(self) -> pulumi.Input[str]: return pulumi.get(self, "global_replication_group_id_suffix")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_replication_group_id_suffix(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def global_replication_group_id_suffix(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def _metric_na...
[ "0.75821406", "0.73900175", "0.63114595", "0.61062473", "0.5968661", "0.59345704", "0.59345704", "0.57732475", "0.5765001", "0.5738848", "0.5736284", "0.57362837", "0.57362837", "0.5734576", "0.5734576", "0.5734576", "0.57225764", "0.5674524", "0.56390136", "0.5615383", "0.55...
0.7615214
0
The number of node groups (shards) on the global replication group.
def num_node_groups(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "num_node_groups")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_node_groups(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"num_node_groups\")", "def num_shards(self) -> int:\n return self.db_nodes", "def ngroups(self):\n return self._ngroups", "def getNumEnergyGroups(self):\n return self.lib.numGroups", "def getNumGroups(se...
[ "0.83522993", "0.7570014", "0.7472229", "0.7387607", "0.7048615", "0.69270694", "0.6922376", "0.69174105", "0.6895419", "0.68828934", "0.68451977", "0.6731325", "0.67147917", "0.6699222", "0.6685127", "0.6661887", "0.6639857", "0.663934", "0.65800893", "0.65800893", "0.657947...
0.78166443
1
An ElastiCache Parameter Group to use for the Global Replication Group. Required when upgrading a major engine version, but will be ignored if left configured after the upgrade is complete. Specifying without a major version upgrade will fail. Note that ElastiCache creates a copy of this parameter group for each member...
def parameter_group_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "parameter_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_node_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['GlobalReplicationGroupGlobalNodeGroupArgs']]]]:\n return pulumi.get(self, \"global_node_groups\")", "def global_replication_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "d...
[ "0.6315814", "0.63098454", "0.62625235", "0.60960543", "0.5960076", "0.59239274", "0.5815941", "0.57479596", "0.5639791", "0.5609459", "0.55557096", "0.5471414", "0.5464035", "0.5462186", "0.5452672", "0.5417358", "0.53788215", "0.53788215", "0.5352837", "0.5352837", "0.53338...
0.58646685
9
The ARN of the ElastiCache Global Replication Group.
def arn(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def group_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"group_arn\")", "def global_replication_group_id(self) -> pulumi.Ou...
[ "0.71488994", "0.71488994", "0.6600374", "0.6444652", "0.6354316", "0.63009393", "0.6265935", "0.62371606", "0.61776507", "0.60630816", "0.60525155", "0.6001442", "0.5932023", "0.5887166", "0.58703905", "0.58703905", "0.5858196", "0.5858196", "0.5858196", "0.5858196", "0.5858...
0.0
-1
A flag that indicate whether AuthToken (password) is enabled.
def auth_token_enabled(self) -> Optional[pulumi.Input[bool]]: return pulumi.get(self, "auth_token_enabled")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_token_enabled(self) -> pulumi.Output[bool]:\n return pulumi.get(self, \"auth_token_enabled\")", "def enable_password_verification(self) -> bool:\n return pulumi.get(self, \"enable_password_verification\")", "def auth_enabled(self):\n\n return self._api_manager.auth_enabled()", "...
[ "0.78541464", "0.7331558", "0.6996196", "0.6887527", "0.6690571", "0.6675807", "0.66285187", "0.66285187", "0.65334976", "0.64619863", "0.6442612", "0.6406916", "0.6386982", "0.6367639", "0.6358182", "0.63502973", "0.63328105", "0.6332606", "0.6330039", "0.63299274", "0.63182...
0.7631044
1
The full ID of the global replication group.
def global_replication_group_id(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "global_replication_group_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_replication_group_id(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "def global_replication_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "def group_id(self) -> str:\n return pulumi.get(se...
[ "0.8922953", "0.8715425", "0.78609776", "0.78609776", "0.7817306", "0.7778254", "0.77731085", "0.77731085", "0.77731085", "0.77731085", "0.77731085", "0.7698093", "0.76713616", "0.75895303", "0.75221556", "0.74650776", "0.7431197", "0.7431197", "0.7431197", "0.74202573", "0.7...
0.8451429
2
The suffix name of a Global Datastore. If `global_replication_group_id_suffix` is changed, creates a new resource.
def global_replication_group_id_suffix(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "global_replication_group_id_suffix")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_replication_group_id_suffix(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def global_replication_group_id_suffix(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def _metric_name(self, s...
[ "0.7614175", "0.738855", "0.6312056", "0.61064863", "0.5966678", "0.59341055", "0.59341055", "0.5774106", "0.57656735", "0.5739979", "0.57364786", "0.57357436", "0.57357436", "0.5733982", "0.5733982", "0.5733982", "0.57242996", "0.56722844", "0.56390625", "0.5616552", "0.5537...
0.7580979
1
The number of node groups (shards) on the global replication group.
def num_node_groups(self) -> Optional[pulumi.Input[int]]: return pulumi.get(self, "num_node_groups")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_node_groups(self) -> pulumi.Output[int]:\n return pulumi.get(self, \"num_node_groups\")", "def num_shards(self) -> int:\n return self.db_nodes", "def ngroups(self):\n return self._ngroups", "def getNumEnergyGroups(self):\n return self.lib.numGroups", "def getNumGroups(se...
[ "0.83522993", "0.7570014", "0.7472229", "0.7387607", "0.7048615", "0.69270694", "0.6922376", "0.69174105", "0.6895419", "0.68828934", "0.68451977", "0.6731325", "0.67147917", "0.6699222", "0.6685127", "0.6661887", "0.6639857", "0.663934", "0.65800893", "0.65800893", "0.657947...
0.78166443
2
An ElastiCache Parameter Group to use for the Global Replication Group. Required when upgrading a major engine version, but will be ignored if left configured after the upgrade is complete. Specifying without a major version upgrade will fail. Note that ElastiCache creates a copy of this parameter group for each member...
def parameter_group_name(self) -> Optional[pulumi.Input[str]]: return pulumi.get(self, "parameter_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_node_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['GlobalReplicationGroupGlobalNodeGroupArgs']]]]:\n return pulumi.get(self, \"global_node_groups\")", "def global_replication_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "d...
[ "0.6315814", "0.63098454", "0.62625235", "0.60960543", "0.5960076", "0.59239274", "0.5815941", "0.57479596", "0.5639791", "0.5609459", "0.55557096", "0.5471414", "0.5464035", "0.5462186", "0.5452672", "0.5417358", "0.53788215", "0.53788215", "0.5352837", "0.5352837", "0.53338...
0.58646685
8
The ARN of the ElastiCache Global Replication Group.
def arn(self) -> pulumi.Output[str]: return pulumi.get(self, "arn")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def log_group_arn(self) -> str:\n return jsii.get(self, \"logGroupArn\")", "def group_arn(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"group_arn\")", "def global_replication_group_id(self) -> pulumi.Ou...
[ "0.71488994", "0.71488994", "0.6600374", "0.6444652", "0.6354316", "0.63009393", "0.6265935", "0.62371606", "0.61776507", "0.60630816", "0.60525155", "0.6001442", "0.5932023", "0.5887166", "0.58703905", "0.58703905", "0.5858196", "0.5858196", "0.5858196", "0.5858196", "0.5858...
0.5613111
83
A flag that indicate whether AuthToken (password) is enabled.
def auth_token_enabled(self) -> pulumi.Output[bool]: return pulumi.get(self, "auth_token_enabled")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_token_enabled(self) -> Optional[pulumi.Input[bool]]:\n return pulumi.get(self, \"auth_token_enabled\")", "def enable_password_verification(self) -> bool:\n return pulumi.get(self, \"enable_password_verification\")", "def auth_enabled(self):\n\n return self._api_manager.auth_enable...
[ "0.7631044", "0.7331558", "0.6996196", "0.6887527", "0.6690571", "0.6675807", "0.66285187", "0.66285187", "0.65334976", "0.64619863", "0.6442612", "0.6406916", "0.6386982", "0.6367639", "0.6358182", "0.63502973", "0.63328105", "0.6332606", "0.6330039", "0.63299274", "0.631826...
0.78541464
0
The full ID of the global replication group.
def global_replication_group_id(self) -> pulumi.Output[str]: return pulumi.get(self, "global_replication_group_id")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_replication_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "def global_replication_group_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"global_replication_group_id\")", "def group_id(self) -> str:\n return pulu...
[ "0.8715425", "0.8451429", "0.78609776", "0.78609776", "0.7817306", "0.7778254", "0.77731085", "0.77731085", "0.77731085", "0.77731085", "0.77731085", "0.7698093", "0.76713616", "0.75895303", "0.75221556", "0.74650776", "0.7431197", "0.7431197", "0.7431197", "0.74202573", "0.7...
0.8922953
0
The suffix name of a Global Datastore. If `global_replication_group_id_suffix` is changed, creates a new resource.
def global_replication_group_id_suffix(self) -> pulumi.Output[str]: return pulumi.get(self, "global_replication_group_id_suffix")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_replication_group_id_suffix(self) -> pulumi.Input[str]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def global_replication_group_id_suffix(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"global_replication_group_id_suffix\")", "def _metric_nam...
[ "0.76153", "0.75822884", "0.6310976", "0.61057687", "0.5970051", "0.5932896", "0.5932896", "0.57726175", "0.57640594", "0.57391673", "0.5734596", "0.5734596", "0.5734333", "0.57328695", "0.57328695", "0.57328695", "0.5721953", "0.5675663", "0.5639129", "0.56149757", "0.553959...
0.7389755
2
The number of node groups (shards) on the global replication group.
def num_node_groups(self) -> pulumi.Output[int]: return pulumi.get(self, "num_node_groups")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_node_groups(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"num_node_groups\")", "def num_node_groups(self) -> Optional[pulumi.Input[int]]:\n return pulumi.get(self, \"num_node_groups\")", "def num_shards(self) -> int:\n return self.db_nodes", "def ngroups(self)...
[ "0.7817279", "0.7817279", "0.756935", "0.74731565", "0.738736", "0.7049554", "0.6928447", "0.69225883", "0.69194317", "0.6897756", "0.68817127", "0.6847009", "0.6732832", "0.6714874", "0.6701356", "0.668684", "0.66623384", "0.66416687", "0.6640439", "0.6582336", "0.6582336", ...
0.8353321
0
An ElastiCache Parameter Group to use for the Global Replication Group. Required when upgrading a major engine version, but will be ignored if left configured after the upgrade is complete. Specifying without a major version upgrade will fail. Note that ElastiCache creates a copy of this parameter group for each member...
def parameter_group_name(self) -> pulumi.Output[Optional[str]]: return pulumi.get(self, "parameter_group_name")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_node_groups(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['GlobalReplicationGroupGlobalNodeGroupArgs']]]]:\n return pulumi.get(self, \"global_node_groups\")", "def global_replication_group_id(self) -> Optional[str]:\n return pulumi.get(self, \"global_replication_group_id\")", "d...
[ "0.6313579", "0.63073087", "0.62603456", "0.6095352", "0.5959134", "0.5922795", "0.58640176", "0.58640176", "0.58640176", "0.58640176", "0.58136064", "0.5638838", "0.56087625", "0.5553142", "0.5468814", "0.5461911", "0.5460051", "0.54499197", "0.54151094", "0.5376083", "0.537...
0.5747309
11
Extract the Coordinate Reference System from a dataset.
def get_crs(ds, format='crs'): crs = None if 'crs' in ds.attrs: crs = _parse_crs(ds.attrs['crs']) elif 'crs' in ds.data_vars: for attr in ds['crs'].attrs: try: crs = _parse_crs(ds['crs'].attrs[attr]) except CRSError: pass e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getDataCoordinates(self):\n coord = np.zeros((self.dataset.shape[0], 2))\n for i in range(len(self.dataset)):\n coord[i, 0] = self.dataset[i][0]\n coord[i, 1] = self.dataset[i][1]\n return coord", "def load_data(dataset_str, isnormalize):\n names = ['x', 'y', 'tx...
[ "0.59560275", "0.5592134", "0.5390888", "0.5387635", "0.53737056", "0.53553116", "0.53114814", "0.5290935", "0.5283114", "0.5252196", "0.52475035", "0.5243139", "0.52332735", "0.522357", "0.52214783", "0.5212131", "0.52078825", "0.5201327", "0.519319", "0.519319", "0.51886505...
0.50162125
39
Extract the bounding box in projection coordinates.
def get_bounds(ds): trans = get_transform(ds) if trans is not None: if isinstance(ds, xr.Dataset): dims = ds.dims elif isinstance(ds, xr.DataArray): dims = dict(zip(ds.dims, ds.shape)) nrows = dims['y'] ncols = dims['x'] corners = (np.array([0, 0,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bounding_box(self):\n latlon00 = self.ij_to_latlon(-1,-1)\n latlon01 = self.ij_to_latlon(-1,self.domain_size[1]+1)\n latlon11 = self.ij_to_latlon(self.domain_size[0]+1,self.domain_size[1]+1)\n latlon10 = self.ij_to_latlon(self.domain_size[0]+1,-1)\n return (latlon00,latlon01,...
[ "0.8108404", "0.8057351", "0.77959454", "0.7715172", "0.7651218", "0.7582781", "0.7534013", "0.7534013", "0.7519656", "0.7519656", "0.7515429", "0.75096154", "0.750104", "0.7454508", "0.74472535", "0.7413669", "0.7404383", "0.7316415", "0.7286997", "0.7282726", "0.72694683", ...
0.0
-1
This function helps to read the input file and returns them as a dataframe.
def read_data(input_file, support, freq_item_list, infreq_item_dict): df = pd.read_csv(input_file) # load the data in a dataframe support_count = int(support*len(df.index)) first_level = [] for i in df.columns: # iterate through each column header first_level.a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(self) -> pd.DataFrame:\n with open(self.file_path, 'r') as in_file:\n headers = in_file.readline()\n headers = headers.replace(\"\\n\", \"\")\n\n if ',' in headers:\n headers = headers.split(',')\n else:\n headers = headers.sp...
[ "0.7691001", "0.7207224", "0.71596456", "0.71007", "0.70995665", "0.70475525", "0.7046122", "0.7046122", "0.7046122", "0.6969183", "0.6926419", "0.6921795", "0.6884629", "0.68508315", "0.6849374", "0.6840854", "0.6813222", "0.6809105", "0.677179", "0.6743672", "0.6733037", ...
0.0
-1
Check if `obj` is a sedes object. A sedes object is characterized by having the methods `serialize(obj)` and `deserialize(serial)`.
def is_sedes(obj): return hasattr(obj, 'serialize') and hasattr(obj, 'deserialize')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def infer_sedes(obj):\n if isinstance(obj, bool):\n return boolean\n\n msg = 'Did not find sedes handling type {}'.format(type(obj).__name__)\n raise TypeError(msg)", "def is_object(obj):\n return (isinstance(obj, object) and\n type(obj) is not type and\n type(obj) is not...
[ "0.6362382", "0.6030905", "0.5873585", "0.5794478", "0.5767871", "0.5730364", "0.5640401", "0.5622459", "0.56045324", "0.55965614", "0.55854946", "0.55301404", "0.5494655", "0.5486527", "0.539866", "0.53887683", "0.53822213", "0.5375352", "0.5356565", "0.5345841", "0.5338948"...
0.83887005
0
figure out if the given number is a prime number
def isprime(n): if n % 2 == 0: return False # else take square root and iterate over all uneven (step 2) numbers sqrt_n = int(math.floor(math.sqrt(n))) for i in range(3, sqrt_n + 1, 2): if n % i == 0: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_prime_number(number_):\n flag = 0\n for values in range(2, number_//2):\n if number_ % values == 0:\n flag += 1\n if flag == 1:\n return True\n else:\n return False", "def is_prime(number):\n\t\n\tif number < 2: return False\n\telif number == 2: return True\n\te...
[ "0.86495465", "0.85478884", "0.8541501", "0.85288024", "0.8469142", "0.8460555", "0.8454103", "0.8430223", "0.8421361", "0.842064", "0.8416806", "0.8416377", "0.8405139", "0.83764076", "0.8348792", "0.8346897", "0.8343302", "0.8321562", "0.8300475", "0.8265365", "0.8262659", ...
0.77229595
87
Generates a random string in hexadecimal with 32 random bytes by default
def gen_nonce(self, length=32): if(length < 32): res = {"message": 'Invalid nonce length'}, 400 else: nonce = secrets.token_hex(floor(length)) nonces_file = "client-generate-nonces.txt" res = self.check_nonce(nonce, nonces_file, length) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_secret() -> str:\n r = random.randrange(0, 255) # INSECURE, just for demo\n r = hex(r)[2:]\n if len(r) == 1:\n return f'0{r}'\n return r", "def gen_hex_str(octets=64):\n # Generate random hex string\n return binascii.b2a_hex(os.urandom(octets)).decode()", "def generate_random_s...
[ "0.82645386", "0.81677413", "0.8086821", "0.79797643", "0.7977213", "0.7943085", "0.78975016", "0.7897451", "0.78172857", "0.77781373", "0.76804245", "0.7676209", "0.76457465", "0.7632983", "0.7600389", "0.75729936", "0.75143594", "0.7462125", "0.74536085", "0.74450815", "0.7...
0.0
-1
Test connected graph with multiple transpose conv2d
def test_multiple_transpose_conv2d(self): tf.compat.v1.reset_default_graph() with tf.device('/cpu:0'): model = tf.keras.Sequential() model.add(tf.keras.layers.Conv2DTranspose(1, (4, 4), input_shape=(28, 28, 3))) model.add(tf.keras.layers.MaxPooling2D((2, 2))) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_transposed_conv2d_model(self):\n tf.compat.v1.reset_default_graph()\n\n _ = transposed_conv2d_model()\n\n conn_graph = ConnectedGraph(tf.compat.v1.get_default_graph(), ['input_1'], ['conv2d_transpose/BiasAdd'])\n self.assertEqual(conn_graph.get_all_ops()['conv2d_transpose/conv2...
[ "0.7270202", "0.68293214", "0.67820853", "0.67175436", "0.6554241", "0.65433484", "0.65023184", "0.6411989", "0.6232234", "0.61262786", "0.61207384", "0.6111881", "0.60179955", "0.59919953", "0.59837484", "0.5981406", "0.595129", "0.5950664", "0.5948734", "0.5945841", "0.5941...
0.7934786
0
Test connected graph construction on a keras graph with dropout op
def test_dropout_keras_get_op_product_graph(self): tf.compat.v1.reset_default_graph() _ = dropout_keras_model() conn_graph = ConnectedGraph(tf.compat.v1.get_default_graph(), ['input_1'], ['dropout_keras_model/Softmax']) self.assertTrue(validate_branch_ops(conn_graph)) self.asser...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dropout_keras_model():\n\n inputs = tf.keras.Input(shape=(10, 10, 3,))\n x = tf.keras.layers.Conv2D(16, (3, 3))(inputs)\n x = tf.keras.layers.Dropout(rate=.4)(x)\n x = tf.identity(x)\n x = tf.keras.layers.Conv2D(8, (2, 2))(x)\n x = tf.keras.layers.Flatten()(x)\n outputs = tf.keras.layers.D...
[ "0.6803065", "0.66139233", "0.65148234", "0.65076566", "0.6350817", "0.62594265", "0.6244908", "0.61929727", "0.61395353", "0.6099732", "0.6070375", "0.60554826", "0.5931202", "0.5928226", "0.5914595", "0.58959526", "0.58830434", "0.58760273", "0.58518887", "0.58432823", "0.5...
0.7467137
0
This should probably be worked into the new_fragment machinery it basically just assigns an external_ref that is designed according to a custom template and ensured to be unique. But if _get_next_name gets folded into the interface, then new_fragment should use it internally when creating a reference fragment.
def _new_reference_fragment(self, flow, **kwargs): # create a new parent fragment parent_ref = self._get_next_name(flow) frag = self.fg.new_fragment(flow, 'Output', Name=parent_ref, external_ref=parent_ref, **kwargs) self._refs.append(frag) return frag
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_next_name(self, flow):\n parent_ref = '%s ASSEMBLY' % flow.external_ref\n try:\n self.fg.get(parent_ref)\n except EntityNotFound:\n return parent_ref\n _ac = 0\n while True:\n parent_ref = '%s ASSEMBLY alt %d' % (flow.external_ref, _ac)\n...
[ "0.5709572", "0.5610815", "0.5585535", "0.5460988", "0.5428736", "0.53512573", "0.5341894", "0.5315185", "0.5315067", "0.5300112", "0.5278231", "0.5274674", "0.5243231", "0.5242421", "0.52257574", "0.51911384", "0.51852965", "0.5163999", "0.51316637", "0.50838184", "0.5050216...
0.63499963
0
Create and save a User with the given email and password.
def _create_user(self, email, password, **extra_fields): if not email: raise ValueError('The given email must be set') email = self.normalize_email(email) user = self.model(email=email, **extra_fields) user.set_password(password) user.save(using=self._db) return user
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_user(self, email, password, **extra_fields):\n\n if not email:\n raise ValueError(\"Vous devez renseigner un email!\")\n\n email = self.normalize_email(email)\n user = self.model(email=email, **extra_fields)\n user.set_password(password)\n user.save(using=s...
[ "0.8511467", "0.85078454", "0.85021895", "0.85021806", "0.8489139", "0.8489139", "0.8488738", "0.8488738", "0.8488738", "0.84858716", "0.84768116", "0.8475896", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0.84750444", "0....
0.85441065
0
Configures the bot with a Telegram Token. Returns a bot instance.
def configure_telegram(): TELEGRAM_TOKEN = os.environ.get('TELEGRAM_TOKEN') if not TELEGRAM_TOKEN: logger.error('The TELEGRAM_TOKEN must be set') raise NotImplementedError return telegram.Bot(TELEGRAM_TOKEN)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, TOKEN: str) -> None:\n super(TelegramBot, self).__init__()\n self.TOKEN = TOKEN\n self.URL = f\"https://api.telegram.org/bot{TOKEN}/\"\n logging.debug(\"Telegram Bot ready\")", "def telegram(self, client_key=None, tgid=None, key=None):\n return Telegram(self,...
[ "0.71838427", "0.598269", "0.5755125", "0.56100076", "0.56100076", "0.5572895", "0.5554391", "0.554791", "0.5497328", "0.5492029", "0.54629433", "0.5387489", "0.53853995", "0.5382343", "0.5382343", "0.5310844", "0.5294854", "0.5289101", "0.52847594", "0.52706236", "0.5263624"...
0.7841998
0
Returns the sum of the first n integers [1, n].
def sumn(n): return n * (n + 1) // 2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_nth( n ):\n if n > 0:\n return sum( range(n + 1) )\n else:\n return 0", "def integer_sum(n):\n\n sum = 0\n k = 0\n\n # INVARIANT\n # The sum of far is equal to the sum of the first k integer numbers\n # VARIANT: n-k\n #\n while (k!=n):\n k += 1\n ...
[ "0.8372894", "0.82741934", "0.82374406", "0.8102394", "0.8029557", "0.7925527", "0.7882119", "0.7874917", "0.77134466", "0.77134466", "0.75713056", "0.74466485", "0.7434572", "0.74294776", "0.7387028", "0.7360476", "0.7307361", "0.72442234", "0.72421163", "0.7233952", "0.7123...
0.0
-1
Asks user to specify a city, month, and day to analyse.
def get_filters(): print('Hello! Let\'s explore some US bikeshare data!') # get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs city = input('Which city would you like to see bikeshare data from?\n') while city.lower() not in cities: ci...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)", "def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f...
[ "0.66761404", "0.663546", "0.6440627", "0.6404285", "0.6388439", "0.6347631", "0.6313973", "0.6287964", "0.62619716", "0.626152", "0.6253766", "0.6250932", "0.6239717", "0.6222759", "0.6185614", "0.6158984", "0.6146623", "0.6144539", "0.61367893", "0.6131773", "0.6129655", ...
0.5747328
82
Loads data for the specified city and filters by month and day if applicable.
def load_data(city, month, day): df = pd.read_csv(CITY_DATA[city.lower()]) df['Start Time'] = pd.to_datetime(df['Start Time']) df['month'] = df['Start Time'].dt.month df['day_of_week'] = df['Start Time'].dt.dayofweek # check that this is the right method() if month != 'all': month = mont...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ...
[ "0.813227", "0.8108956", "0.8046483", "0.8042587", "0.8009157", "0.80073005", "0.7999508", "0.7998818", "0.79889566", "0.7979226", "0.7973997", "0.7961329", "0.79560906", "0.7947187", "0.794649", "0.7908341", "0.79083204", "0.7904475", "0.79011774", "0.78934294", "0.78827393"...
0.7889157
20
Displays statistics on the most frequent times of travel.
def time_stats(df): print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() # display the most common month try: select_pop_month = df['month'].mode()[0] popular_month = months[select_pop_month - 1] print("The most popular month is: ", popular_mon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.8023522", "0.802221", "0.7914353", "0.7826378", "0.7821697", "0.78140223", "0.7765606", "0.7739828", "0.7735833", "0.7733764", "0.7686237", "0.76675326", "0.7651101", "0.7644171", "0.7639292", "0.7636152", "0.76248395", "0.76227194", "0.7611663", "0.7599656", "0.75825727",...
0.7343545
51
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # display most commonly used start station common_start = df['Start Station'].mode()[0] print("The most common Start Station is: ", common_start) # display most commonly used end sta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.78170687", "0.76637906", "0.75547594", "0.74924624", "0.7475916", "0.7447317", "0.74322265", "0.7424947", "0.74187243", "0.7401574", "0.7388717", "0.73868257", "0.7366443", "0.7360476", "0.735797", "0.7356537", "0.73533744", "0.7352685", "0.7351529", "0.73434633", "0.73414...
0.7235295
37
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() # display total travel time total_secs = df['Trip Duration'].sum() total_travel_time = dt.timedelta(seconds=int(total_secs)) print("The total travel time was: ", total_travel_time) # display me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.814274", "0.8025143", "0.80041367", "0.79496753", "0.7937415", "0.79312176", "0.7926815", "0.7915187", "0.79142886", "0.7908032", "0.79055744", "0.7900715", "0.7891682", "0.78894734", "0.7886722", "0.78851086", "0.7884266", "0.7882474", "0.78738385", "0.78686154", "0.78664...
0.78020316
45
A string representation of the candidate semester of this event. Assumes that there are only spring and fall semesters, separated at 07/01.
def semester(self): return get_semester(self.start_time)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semester(self):\n return self.course.semester", "def toStudentString(self):\r\n return \"{0}th year, section {1}, {2} {3}\".format(self.batch, self.batch_id, self.batch, self.batch_id)", "def __str__(self):\n return \"%s, %02d, %s\" % (self.code, self.section, self.semester)", "def f...
[ "0.7017857", "0.6556487", "0.6232291", "0.60339814", "0.59314996", "0.56894875", "0.56170887", "0.55374897", "0.54927564", "0.5439712", "0.54395586", "0.5403159", "0.5381232", "0.5254202", "0.5158659", "0.5129786", "0.49786425", "0.49498373", "0.49333057", "0.49302572", "0.48...
0.7237193
0
Verify applications can be sorted.
def test_lt(self): assert self.app2 < self.app1 assert self.app3 > self.app2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duo_application_list(self):\n pass", "def test_get_top_returns_apps_with_most_taskruns(self):\r\n\r\n ranked_3_app = self.create_app_with_contributors(8, 0, name='three')\r\n ranked_2_app = self.create_app_with_contributors(9, 0, name='two')\r\n ranked_1_app = self.create_app...
[ "0.58484405", "0.5786501", "0.57349646", "0.5719213", "0.5642342", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", "0.56104136", ...
0.5777742
2
Loop through the graph via DFS. Take note of each node visited. Get the neighbors of each visited node and, if one of the neighbors has been visited previously, the graph is acyclic (we have found a "back edge"). Return True is the graph is acyclic ("no cycles"). Otherwise False.
def is_acyclic(graph): visited = [] dfs_seq = DFSIterator(graph) for node in dfs_seq: visited.insert(0, node) node_neighbors = graph.get_neighbors(node) for neighbor in node_neighbors: if neighbor in visited: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_cyclic(self):\n \n visited = set()\n path = []\n \n for node in self.node_set:\n if node not in visited:\n if self.is_cyclic_helper(node, visited, path) is True:\n return True \n \n visited.clear()\n...
[ "0.79722095", "0.79352635", "0.7882874", "0.7679681", "0.75684035", "0.7491147", "0.745476", "0.7437086", "0.742106", "0.74135935", "0.73694307", "0.7327075", "0.7285766", "0.71912336", "0.7112109", "0.7097216", "0.7024811", "0.6963287", "0.69419026", "0.6941177", "0.6887429"...
0.8334848
0
Display buttons on my deck part of the screen
def build_deck_screen_my_deck_button_display(screen,buttons, screen_status, button_status, card_database_filter, user): local_store_list = build_deck_screen_my_deck_card_list_refine(user) #character number display if user.character_card == '': button1 = Button('Character: 0/1','' ,(250,250,250),50, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_deck_screen_stable_button_display(screen, buttons,screen_status,button_status):\n # button1 = Button('Back','build_deck_screen', (0,0,0),0, 0, 50, 50)\n # button1.update()\n # button1.draw(screen)\n button2 = Button('Save','build_deck_screen', (250,250,250),1150, 0, 50, 50, font_color = (0,0,...
[ "0.7215322", "0.7088829", "0.706845", "0.6976967", "0.69417405", "0.6860475", "0.68331236", "0.67572856", "0.6740697", "0.6568086", "0.6565316", "0.65535647", "0.6535624", "0.6518689", "0.6500669", "0.6498479", "0.6438394", "0.6407794", "0.63959336", "0.63953567", "0.63482314...
0.71127164
1
Display buttons in my hand on battle screen
def battle_screen_my_hand_button_display(screen,buttons, screen_status, button_status, card_database_filter, user): if screen_status.battle_screen_action_indicator != 'stage-0': # Page forward button button1 = Button('>','', (0,0,0),1100, 660, 50, 50) # Edge cases when len() = 14,28,42 ... ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def battle_screen_character_1_button_display(screen,buttons, screen_status, button_status, card_database_filter, user):\n button_basic_info = Button('Lv: ' + user.character_card.level + ' HP: ' + user.character_card.health + ' Card #: ' + str(len(user.hand_list)),'', (0,0,0),1000, 0, 200, 30, alpha = 100)\n ...
[ "0.7400225", "0.72634995", "0.72240454", "0.7212437", "0.7196902", "0.7156687", "0.711871", "0.70304376", "0.7024443", "0.693146", "0.6888981", "0.6838892", "0.6826134", "0.6818473", "0.67814416", "0.6760153", "0.66341984", "0.66273", "0.6626192", "0.66169685", "0.66049874", ...
0.77452433
0
Assign default training parameters.
def default_training_params(): N_EPOCHS = 100 BATCH_SIZE = 64 EPSILON = 0.0001 return N_EPOCHS, BATCH_SIZE, EPSILON
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_training_params(use_defaults):\n if use_defaults:\n n_epochs, batch_size, epsilon = default_training_params()\n return n_epochs, batch_size, epsilon\n\n print (\"Select number of epochs to train (default 100):\")\n n_epochs = int(input())\n print (\"Select batch size (default 64):...
[ "0.75077623", "0.7238071", "0.7210219", "0.71838194", "0.7112171", "0.70919997", "0.7058195", "0.6993066", "0.67845136", "0.6687815", "0.6683278", "0.66686547", "0.66615415", "0.6625849", "0.662339", "0.662339", "0.6563328", "0.6550092", "0.6549268", "0.65455294", "0.653711",...
0.7801491
0
This test should be implemented. The goal is to test that we are able to query for a device's min sensor reading.
def test_device_readings_min(self): request = self.client().get('/devices/{}/readings/min/'.format(self.device_uuid)) self.assertEqual(request.json.get('value', None), 22)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_device_readings_min(device_uuid):\n\n # Set the db that we want and open the connection\n if app.config['TESTING']:\n conn = sqlite3.connect('test_database.db')\n else:\n conn = sqlite3.connect('database.db')\n conn.row_factory = sqlite3.Row\n cur = conn.cursor()\n # Ex...
[ "0.6890985", "0.6571122", "0.6453831", "0.63936716", "0.6268402", "0.62332904", "0.62310725", "0.61720884", "0.61489606", "0.6097589", "0.60669273", "0.60669273", "0.60360056", "0.60324496", "0.6026906", "0.60188735", "0.5962089", "0.5957457", "0.594849", "0.5937988", "0.5936...
0.7703251
0
This test should be implemented. The goal is to test that we are able to query for a device's max sensor reading.
def test_device_readings_max(self): request = self.client().get('/devices/{}/readings/max/'.format(self.device_uuid)) self.assertEqual(request.json.get('value', None), 100)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_device_readings_max(device_uuid):\n\n # Set the db that we want and open the connection\n if app.config['TESTING']:\n conn = sqlite3.connect('test_database.db')\n else:\n conn = sqlite3.connect('database.db')\n conn.row_factory = sqlite3.Row\n cur = conn.cursor()\n # Ex...
[ "0.69908476", "0.67816466", "0.66820204", "0.649431", "0.6472194", "0.6464675", "0.6440061", "0.6235329", "0.6178303", "0.6152396", "0.61118066", "0.6083506", "0.6083506", "0.6075236", "0.5995309", "0.5978684", "0.5974685", "0.58784515", "0.5873748", "0.58549875", "0.58403736...
0.8063827
0
This test should be implemented. The goal is to test that we are able to query for a device's mean sensor reading value.
def test_device_readings_mean(self): request = self.client().get('/devices/{}/readings/mean/'.format(self.device_uuid)) self.assertEqual(request.json.get('value', None), 61)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_mean_value(self):\n dict_with_value = self.info_list.get_value_info()\n print(dict_with_value[\"amount\"])\n self.assertEqual(dict_with_value['mean'], 135.0)", "def request_device_readings_mean(device_uuid):\n\n # Set the db that we want and open the connection\n if app.config...
[ "0.6797275", "0.6746199", "0.67386156", "0.67386156", "0.6603054", "0.6469152", "0.6420717", "0.63960916", "0.62147856", "0.6162081", "0.6131403", "0.61129016", "0.6111855", "0.60883254", "0.60755956", "0.60737747", "0.6071952", "0.6054504", "0.6048195", "0.6011008", "0.59919...
0.80363446
0
GET a list of Pages.
def get(self, request): pages = self.get_queryset().all() return render(request, 'list.html', { 'pages': pages })
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_pages(request):\n context = RequestContext(request)\n pages = request.website.get_pages()\n return render_to_response(\"pages/list_pages.html\", {\"pages\": pages}, context)", "def list(self, request ):\n\t\tinUrl = request.query_params.get('url', None )\n\t\t#if inUrl is None:\n\t\t#\tinUrl = ...
[ "0.77786064", "0.7577209", "0.7013189", "0.6987679", "0.69482005", "0.6886229", "0.6827389", "0.67998", "0.67509806", "0.6702824", "0.6658481", "0.66021645", "0.65862703", "0.65639615", "0.6552138", "0.65515673", "0.64796925", "0.64738864", "0.6440241", "0.6409216", "0.638137...
0.75349367
3
Initialize state tomography fitter with experimental data.
def __init__(self, result, circuits, measured_qubits): self._circuits = circuits self._result = result self._qubit_list = sorted(measured_qubits) self._meas_basis = None self._prep_basis = None super().set_measure_basis("Pauli") super().set_preparation_basis("Pau...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _initial_setup(self, **train_kwargs):\n self._update(time_step=0., **train_kwargs)", "def _initialize_default_start(self, state):\n state.tau = self.rng.gamma(0.5, 1 / self.fixed.tau_rate)\n eta = self.rng.standard_normal(self.fixed.n)\n eta = eta - eta.mean()\n state.eta =...
[ "0.6305635", "0.6159471", "0.6149039", "0.6100188", "0.6086526", "0.60727346", "0.6029454", "0.60261595", "0.60190654", "0.60018253", "0.59867364", "0.5957666", "0.5954296", "0.59436774", "0.59387785", "0.59387785", "0.59387785", "0.59387785", "0.59387785", "0.59277606", "0.5...
0.0
-1
Disambiguate some word according to tag guessing to reduce cases. return word list with dismbiguate.
def disambiguateWords(self, word_list, tag_list): # print u" ".join(word_list).encode('utf8'); # print u" ".join(tag_list).encode('utf8'); if len(word_list)==0 or len(word_list)!=len(tag_list): return word_list; else: newwordlist=[]; wordtaglist=list(zip(word_list,tag_list)); # print wordtaglist ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disambiguateWordsOld(self, word_list, tag_list):\n\t\t# print u\" \".join(word_list).encode('utf8');\n\t\t# print u\" \".join(tag_list).encode('utf8');\t\t\t\n\t\n\t\tif len(word_list)==0 or len(word_list)!=len(tag_list):\n\t\t\treturn word_list;\n\t\telse:\n\t\t\tnewwordlist=[];\n\t\t\twordtaglist=zip(word_li...
[ "0.8081535", "0.67247176", "0.65766335", "0.6324581", "0.6324581", "0.6203217", "0.61880946", "0.61800396", "0.61464", "0.61140853", "0.60791016", "0.6070367", "0.60469097", "0.604219", "0.60194933", "0.6017979", "0.59741116", "0.5970288", "0.5942556", "0.5856558", "0.5848363...
0.8451448
0
Disambiguate some word according to tag guessing to reduce cases. return word list with dismbiguate.
def disambiguateWordsOld(self, word_list, tag_list): # print u" ".join(word_list).encode('utf8'); # print u" ".join(tag_list).encode('utf8'); if len(word_list)==0 or len(word_list)!=len(tag_list): return word_list; else: newwordlist=[]; wordtaglist=zip(word_list,tag_list); # print wordtaglist ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disambiguateWords(self, word_list, tag_list):\n\t\t# print u\" \".join(word_list).encode('utf8');\n\t\t# print u\" \".join(tag_list).encode('utf8');\n\t\n\t\tif len(word_list)==0 or len(word_list)!=len(tag_list):\n\t\t\treturn word_list;\n\t\telse:\n\t\t\tnewwordlist=[];\n\t\t\twordtaglist=list(zip(word_list,t...
[ "0.8450991", "0.6725538", "0.65770364", "0.63254696", "0.63254696", "0.62011534", "0.61856633", "0.6182049", "0.61485046", "0.6114921", "0.6078041", "0.6071126", "0.6046797", "0.6042672", "0.6019203", "0.60183555", "0.5975254", "0.59701055", "0.5943359", "0.5858394", "0.58491...
0.8082038
1
Set the daemon status and optionally notify the network event log. Can return a deferred, but can't ever return/throw an error.
def set_daemon_running(self, status): if status: log.debug("The DHCP daemon is running") else: log.debug("The DHCP daemon is NOT running") self.daemon_running = status # XXX: write the network log return defer.succeed(None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sd_notify(state, logger, unset_environment=False):\n\n\n addr = os.environ.get('NOTIFY_SOCKET')\n if addr is None:\n # not run in a service, just a noop\n return\n try:\n sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM | socket.SOCK_CLOEXEC)\n if addr[0] == '@':\n ...
[ "0.60928535", "0.5974307", "0.5337039", "0.5258123", "0.52459043", "0.52405065", "0.5232672", "0.52219564", "0.5196447", "0.51791424", "0.5144387", "0.5139187", "0.5137963", "0.51335806", "0.5129074", "0.512557", "0.5073991", "0.505162", "0.5044884", "0.5013629", "0.5013629",...
0.70232785
0
Set up the Selenium WebDriver
def _get_webdriver(self): driver = webdriver.Chrome(self.CHROME_DRIVER_PATH, options=self.CHROME_DRIVER_OPTIONS) driver.implicitly_wait(1) driver.set_window_size(1024, 768) return driver
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_selenium():\n # Define the options to run with headless mode enabled\n options = Options()\n options.headless = True\n\n # Instatiate the browser object here, pointing at an exectable location which should be located in the same\n # base directory as the script\n driver = webdriver.Fire...
[ "0.80957204", "0.7895889", "0.77725184", "0.7755568", "0.75431895", "0.7535406", "0.7531819", "0.7520694", "0.74798405", "0.74716574", "0.74412465", "0.7428584", "0.74038625", "0.7334214", "0.7235906", "0.71374977", "0.7127531", "0.705608", "0.7005122", "0.6949775", "0.694822...
0.5845121
77
Returns the input image with 4 channels.
def ensure_alpha_channel(img, alpha=1.0, dtype=np.float32, copy=False): img = im_core.ensure_float01(img, dtype=dtype, copy=copy) c = im_core.num_channels(img) if c == 4: return img else: if isinstance(alpha, np.ndarray): alpha_channel = alpha else: alpha_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_image(self):\n image = np.frombuffer(self.image, dtype=np.uint8)\n return image.reshape(*self.size, self.channels)", "def get_4d(slice, copylayers=[], transparancy=0):\n assert slice.ndim < 3\n img = np.zeros(slice.shape)\n img = img[:, :, np.newaxis]\n img = np.repeat(img, 4, 2...
[ "0.65052915", "0.62954444", "0.6291726", "0.62606514", "0.6210046", "0.6197939", "0.61012167", "0.6079313", "0.60474336", "0.5965715", "0.59653324", "0.59547", "0.5927908", "0.59140015", "0.589234", "0.5862352", "0.58399814", "0.57753974", "0.5772434", "0.57709444", "0.575892...
0.0
-1
Converts to k8s object.
def to_k8s_client_obj(self): return k8s.V1EnvVar( name=self.name, value_from=k8s.V1EnvVarSource(field_ref=k8s.V1ObjectFieldSelector(field_path=self.field_path)), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def k8s_actions(config, underlay):\n return k8smanager.K8SManager(config, underlay)", "def _get_k8s_service(self):\n return kubernetes.client.V1Service(\n api_version=\"v1\",\n kind=\"Service\",\n metadata=kubernetes.client.V1ObjectMeta(name=self._k8s_service_name),\n ...
[ "0.5636383", "0.5443655", "0.5418372", "0.5281964", "0.5244229", "0.5205539", "0.51404375", "0.5109452", "0.5026323", "0.4930715", "0.48713803", "0.4821201", "0.48063555", "0.4779449", "0.47574177", "0.47288087", "0.4722481", "0.4696967", "0.46841544", "0.46777323", "0.467523...
0.599036
0
Define the layers and initialize them. Pytorch initializes the layers by default, with random weights, sampled from certain distribution. However, in some cases you might want to explicitly initialize some layers, either by sampling from a different distribution, or by using pretrained weights (word embeddings / transf...
def __init__(self, embeddings, hidden_dim, output_size, dropout_emb, dropout_lstm): super(BaselineLSTMModel, self).__init__() # 1) embedding layer: trainable_emb = False self.word_embeddings = nn.Embedding(num_embeddings=embeddings.shape[0], e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_layer(layer):\n \n if layer.weight.ndimension() == 4:\n (n_out, n_in, height, width) = layer.weight.size()\n n = n_in * height * width\n \n elif layer.weight.ndimension() == 2:\n (n_out, n) = layer.weight.size()\n\n std = math.sqrt(2. / n)\n scale = std * math.sqrt...
[ "0.75832784", "0.7390319", "0.7380712", "0.72391194", "0.72320354", "0.72320354", "0.72320354", "0.71570826", "0.71200925", "0.7118806", "0.7114382", "0.7111402", "0.7105092", "0.7077508", "0.7073865", "0.7031268", "0.70299476", "0.6989486", "0.69741344", "0.6965085", "0.6962...
0.0
-1
Define the layers and initialize them. Pytorch initializes the layers by default, with random weights, sampled from certain distribution. However, in some cases you might want to explicitly initialize some layers, either by sampling from a different distribution, or by using pretrained weights (word embeddings / transf...
def __init__(self, embeddings, hidden_dim, output_size, dropout_emb, dropout_lstm): super(AttentionalLSTM, self).__init__() # 1) embedding layer: trainable_emb = False self.word_embeddings = nn.Embedding(num_embeddings=embeddings.shape[0], emb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_layer(layer):\n \n if layer.weight.ndimension() == 4:\n (n_out, n_in, height, width) = layer.weight.size()\n n = n_in * height * width\n \n elif layer.weight.ndimension() == 2:\n (n_out, n) = layer.weight.size()\n\n std = math.sqrt(2. / n)\n scale = std * math.sqrt...
[ "0.75831205", "0.7390998", "0.7380499", "0.7238596", "0.7231267", "0.7231267", "0.7231267", "0.71567327", "0.7121631", "0.7117871", "0.71157223", "0.71108466", "0.7104864", "0.7079051", "0.70735395", "0.70315176", "0.70293117", "0.6989293", "0.6973822", "0.69655734", "0.69622...
0.0
-1
Returns an int64_list from a bool / enum / int / uint.
def _int64_feature(value): if type(value) != list and type(value) != np.ndarray: value = [value] return tf.train.Feature(int64_list=tf.train.Int64List(value=value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _BoolsToInts(arg_list):\n result = []\n for arg in arg_list:\n if isinstance(arg, (list, tuple)):\n result.append(_BoolsToInts(arg))\n elif arg is True:\n result.append(1)\n elif arg is False:\n result.append(0)\n else:\n result.append(arg)\n\n return result", "def convertT...
[ "0.6880756", "0.65959364", "0.64623183", "0.6449189", "0.6366776", "0.62898964", "0.6271142", "0.6215376", "0.61042506", "0.59511524", "0.59452623", "0.5903748", "0.5866437", "0.5866437", "0.5856854", "0.58461636", "0.58444816", "0.583239", "0.5803493", "0.57961476", "0.57961...
0.5653262
34
Plot value count top values of a list of categorical features
def value_count_top(df, cat_features, top = 10, save_plot = False, path_dir = None ): cat_features = list(set(cat_features)) cols = cat_features if len(cols) != 0: for i, col in sorted(list(enumerate(cols)), key=lambda x: x[1]): fig, ax = plt.subplots() fig.set_size_inches(4....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_topn(classifier,vectorizer,categories,n):\n feature_names = np.asarray(vectorizer.get_feature_names())\n for i, category in enumerate(categories):\n topn = np.argsort(classifier.coef_[i])[-n:]\n print('{}: {}'.format(category,\", \".join(feature_names[topn])))", "def value_count_plot...
[ "0.7120824", "0.7003644", "0.68860495", "0.6388988", "0.6388988", "0.6301415", "0.6292761", "0.62668765", "0.62416637", "0.61124873", "0.60949624", "0.6066097", "0.59973836", "0.5977678", "0.5945544", "0.5930342", "0.59113705", "0.58947104", "0.587464", "0.58605313", "0.58580...
0.7627669
0
Plot value count bottom values of a list of categorical features
def value_count_bottom(df, cat_features, bottom = 10, save_plot = False, path_dir = None ): cat_features = list(set(cat_features)) cols = cat_features if len(cols) != 0: for i, col in sorted(list(enumerate(cols)), key=lambda x: x[1]): fig, ax = plt.subplots() fig.set_size_inc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_count_plot(df, cat_features, save_plot = False, path_dir = None ):\n cat_features = list(set(cat_features)) \n if len(cat_features) != []:\n less_than_30 = []\n more_than_30 = []\n for col in cat_features :\n if df[col].nunique() < 30 :\n less_than_...
[ "0.7504523", "0.6826147", "0.6235299", "0.6231499", "0.61579686", "0.6136962", "0.6119237", "0.6079324", "0.6073302", "0.6070827", "0.6039404", "0.6030102", "0.60080373", "0.6001914", "0.59463054", "0.59300244", "0.5867888", "0.58644736", "0.58378446", "0.58209765", "0.577144...
0.70301676
1
Plot box_plot of continuous features
def box_plot_continuous(df, cont_feat, percentiles = 0.05, save_plot = False, path_dir = None): cont_feat = list(set(cont_feat)) if len(cont_feat) != 0: p_size = min(2, len(cont_feat)) j = int(len(cont_feat) / 2) + 1 plt.figure(figsize=(4.5 ** p_size, 4.5 ** p_size)) for i, col i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boxplot(data):\n sns.boxplot(data, width=0.5, palette=\"colorblind\")\n # add points on the plot\n sns.swarmplot(data, color='red', alpha=0.75)", "def plot_bv_box(df, xcolname, ycolname, ylogflag=False, icol=0):\n # set plot size\n fig, ax = plt.subplots(figsize=(8,6))\n\n\n # log scale or ...
[ "0.738606", "0.69259024", "0.6848107", "0.68190604", "0.67502296", "0.6716791", "0.66170007", "0.65864587", "0.6500164", "0.64726126", "0.6431978", "0.64090055", "0.6396103", "0.6375251", "0.6252211", "0.6212638", "0.6208042", "0.6180333", "0.6087304", "0.60672355", "0.606636...
0.6945767
1
Number of different values of column cat2 for every category of column cat1
def num_of_cat2_per_cat1(df, cat1, cat2, figsize=(12,5), normalize = False, num_label = 1, save_plot = False, path_dir = None ): # Group by category #1 and counts the unique values of category #2 for each group comp_count = df.groupby(cat1)[cat2].nunique().sort_values(ascending=False) if (normalize == True)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cat_count(data, column_str, criteria):\r\n ct1 = []\r\n ct2 = []\r\n for i in range(len(find_cats_freq(data, column_str))):\r\n ct1.append(find_cats_freq(data[criteria], column_str)[i])\r\n ct2.append(find_cats_freq(data, column_str)[i])\r\n return np.array(ct1)/np.array(ct2)", "def...
[ "0.67674106", "0.67157376", "0.6492828", "0.63434833", "0.62586606", "0.61451375", "0.6054594", "0.599374", "0.5957393", "0.59001034", "0.5840279", "0.5781809", "0.57635784", "0.5712137", "0.56852424", "0.5645349", "0.56419456", "0.56388676", "0.5598011", "0.5576568", "0.5559...
0.66553867
2
Plot percentage of NaN values in DataFrame, having more than perc_missing missing values
def percentage_missing_plots(df, perc_missing = 0.1, save_plot = False, path_dir = None): # Missing value proportion in each column: perc = {} for col in df.columns: perc_col = get_percentage_missing(df[col]) if perc_col > float(perc_missing*100): perc[col] = perc_col ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_missing_pct(df):\n percent = (df.isnull().sum() / df.isnull().count()).sort_values(ascending=False)\n return percent", "def missing_value_count_and_percent(df):\n df = pd.concat({'num_missing_values':df.isnull().sum(), 'pct_missing_values':df.isnull().mean().round(4)}, axis=1)", "def check_na...
[ "0.7952677", "0.7921611", "0.77834946", "0.7768306", "0.7561069", "0.7561069", "0.7532111", "0.7452284", "0.73001266", "0.7278602", "0.709151", "0.7075814", "0.7007777", "0.6971477", "0.6943784", "0.68844634", "0.6859328", "0.6807048", "0.68033564", "0.67266923", "0.6710772",...
0.76193565
4
Repeat parameters across channels. The input is shaped as (B, ...), while to output (B same_on_frame, ...), which to guarentee that the same transformation would happen for each frame. (B1, B2, ..., Bn) => (B1, ... B1, B2, ..., B2, ..., Bn, ..., Bn) | ch_size | | ch_size | ..., | ch_size |
def __repeat_param_across_channels__(self, param: torch.Tensor, frame_num: int) -> torch.Tensor: repeated = param[:, None, ...].repeat(1, frame_num, *([1] * len(param.shape[1:]))) return repeated.reshape(-1, *list(param.shape[1:])) # type: ignore
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __repeat_param_across_channels__(self, param: Tensor, frame_num: int) -> Tensor:\n repeated = param[:, None, ...].repeat(1, frame_num, *([1] * len(param.shape[1:])))\n return repeated.reshape(-1, *list(param.shape[1:]))", "def th_repeat(a, repeats, axis=0):\r\n assert len(a.size()) == 1\r\n ...
[ "0.7620403", "0.6074459", "0.5826648", "0.5709121", "0.5581889", "0.55670077", "0.55209374", "0.55194014", "0.5514113", "0.5478754", "0.54762536", "0.53994197", "0.53724164", "0.5360325", "0.53582597", "0.53510237", "0.5270185", "0.52180547", "0.52076817", "0.51726884", "0.51...
0.7709468
0
Determine if a integer is 1to9 pandigital.
def is_nine_pandigital(number): digits = str(number) return bool(len(digits) == len(ALL_NINE) and set(digits) == ALL_NINE)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_19_pandigital(n):\n return len(str(n)) == 9 and set(list(str(n))) == pan", "def is_pandigital(x):\n s = str(x)\n if len(s) != 9:\n return False\n\n digit_set = set(int(char) for char in s)\n for i in range(1, 10):\n if i not in digit_set:\n return False\n\n retur...
[ "0.7422858", "0.733428", "0.70909494", "0.69369304", "0.67518604", "0.6617841", "0.6441147", "0.64259875", "0.6385047", "0.6318548", "0.62343526", "0.62120765", "0.6196197", "0.6175988", "0.61095095", "0.6080749", "0.6052421", "0.6038843", "0.6017177", "0.59212697", "0.590043...
0.73672175
1
Fixture that returns the ADLSGen2APIClient instance's api_cleint. This particular fixture uses Oauth2 authentication method. Useful for testing the underlying filesystem_api.
def adls_gen2_fs_oauth2_api_client(args): if not args.account_name: raise Exception('Test runs only if --account-name is passed.') return AdlsGen2ApiClient(authentication_method='Oauth2', account_name=args.account_name)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_client() -> APIClient:\n return APIClient()", "def api_client() -> APIClient:\n\n return APIClient()", "def client(): # pylint: disable=missing-param-doc,missing-type-doc\n api = CometApi(hmac_secret=\"secret\")\n\n @api.register_auth()\n def override():\n if g.test_authorized_fo...
[ "0.6785753", "0.66747195", "0.63828295", "0.63753825", "0.62899333", "0.6119664", "0.6117024", "0.6100626", "0.6077277", "0.6066913", "0.5999952", "0.5993765", "0.5966186", "0.59625614", "0.5954186", "0.5949536", "0.5925619", "0.59187615", "0.5855007", "0.5851206", "0.5811116...
0.0
-1
Fixture that returns the ADLSGen2FileSystem instance's api_cleint. This particular fixture uses Oauth authentication method. Useful for testing the underlying filesystem_api.
def adls_gen2_fs_oauth2(args): if not all([args.account_name, args.filesystem_id]): raise Exception('Test runs only if --account-name and --filesystem-id are passed.') return AdlsGen2FileSystem(authentication_method='Oauth2', account_name=args.account_name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client(): # pylint: disable=missing-param-doc,missing-type-doc\n api = CometApi(hmac_secret=\"secret\")\n\n @api.register_auth()\n def override():\n if g.test_authorized_for:\n return g.test_authorized_for\n return []\n\n @api.register_hydrator()\n def test_hydrate(issu...
[ "0.559453", "0.5591121", "0.5488617", "0.5391888", "0.5339344", "0.5287714", "0.5243161", "0.5228053", "0.5224948", "0.5223098", "0.5209177", "0.52059853", "0.51966625", "0.5163451", "0.5163208", "0.5153197", "0.5147478", "0.5135651", "0.51353383", "0.5122661", "0.5119685", ...
0.47784147
62
Creates an object that can map from a continuous value to a color based on a colormap specified.
def __init__(self, vmin, vmax, cmap="Blues", kind="hex"): assert vmin < vmax, "vmin must be smaller than vmax" assert kind.lower() in ["hex", "rgba"], 'kind must be one of ["hex", "rgba"]' self.vmin = vmin self.vmax = vmax self.cmap = cmap self.kind = kind # Norm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_colormap(scale_range=(0.0, 1.0), hue_range=(0.8, 0.0),\n saturation_range=(1.0, 1.0), value_range=(0.8, 0.8),\n nan_color=(0.2, 0.2, 0.2, 1.0)):\n lookup_table = vtk.vtkLookupTable()\n lookup_table.SetRange(scale_range)\n\n lookup_table.SetHueRange(hu...
[ "0.6762387", "0.6556902", "0.63383216", "0.629819", "0.6250554", "0.6137054", "0.6106124", "0.61004657", "0.6091736", "0.6079629", "0.60712326", "0.60680234", "0.60680234", "0.60680234", "0.60680234", "0.6038515", "0.60258806", "0.59936917", "0.5982682", "0.59752053", "0.5945...
0.71058923
0
This function computes the global entropy score E (diversity). A metropolitan area's entropy score.
def cal_globalEntropy(self): group_score = [] pop_total = np.sum(self.pop_sum) prop = np.asarray(np.sum(self.pop, axis=0))[0] # loop at sum of each population groups for group in prop: group_idx = group / pop_total * np.log(1 / (group / pop_total)) group_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div(self):\n freqList = [i / sum(self.has.values()) for i in self.has.values()]\n entropies = [i * math.log(i, 2) for i in freqList]\n entropy = -sum(entropies)\n return entropy", "def entropy(data):\n e = 0\n\n counter = collections.Counter(data)\n l = len(da...
[ "0.72293425", "0.68516284", "0.683191", "0.66374046", "0.6574769", "0.6550297", "0.6527979", "0.64763755", "0.64545864", "0.6440966", "0.64393514", "0.64383745", "0.6435785", "0.6427947", "0.64278364", "0.6414083", "0.6413632", "0.64118075", "0.64092076", "0.64018685", "0.640...
0.68663275
1
This function computes the local entropy index H for all localities. The functions cal_localEntropy() for local diversity and cal_globalEntropy for global entropy are called as input. If population intensity was previously computed, the spatial version will be returned, else the non spatial version will be selected (ra...
def cal_localIndexH(self): local_entropy = self.cal_localEntropy() global_entropy = self.cal_globalEntropy() et = global_entropy * np.sum(self.pop_sum) eei = np.asarray(global_entropy - local_entropy) h_local = np.asarray(self.pop_sum) * eei / et return h_local
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_localEntropy(self):\n if len(self.locality) == 0:\n proportion = np.asarray(self.pop / self.pop_sum)\n\n else:\n polygon_sum = np.sum(self.locality, axis=1).reshape(self.n_location, 1)\n proportion = np.asarray(self.locality / polygon_sum)\n\n entropy =...
[ "0.72056544", "0.6376065", "0.61589575", "0.58960253", "0.56866074", "0.562748", "0.561921", "0.5561674", "0.54936486", "0.54901147", "0.5486283", "0.54682726", "0.5378474", "0.53664356", "0.535996", "0.53436524", "0.53331566", "0.5322959", "0.52852094", "0.52813184", "0.5279...
0.82291174
0
Return a requests Response object on success or None on failure
def open_twitter_sample_stream(): twitter_sample_parameters = {'stall_warnings': 'true', } r = requests.post('https://stream.twitter.com/1.1/statuses/sample.json', data=twitter_sample_parameters, auth=oauth_credentials, stream=True, timeout=300) if r.status_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_response(request_url):\n return requests.get(request_url)", "def _get(self, url: str) -> requests.Response:\n # todo: do some error checking here\n if url.startswith(API_PATH['base']):\n try:\n # logger.debug(f\"RestClient._get(): {url}\") # log in calling funct...
[ "0.7232029", "0.6719551", "0.66641635", "0.66160625", "0.6533793", "0.65278095", "0.6495072", "0.6411002", "0.6397186", "0.6390121", "0.63795906", "0.63582784", "0.6348996", "0.6308855", "0.63029873", "0.630005", "0.62949765", "0.6290181", "0.62747884", "0.62747884", "0.62604...
0.0
-1
Return a 'speakable' timestamp, e.g. 8am, noon, 9pm, etc.
def get_speakable_timestamp(timestamp): speakable = f"{timestamp.strftime('%I').lstrip('0')} {timestamp.strftime('%p')}" if speakable == '12 PM': return 'noon' elif speakable == '12 AM': return 'midnight' return speakable
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timestamp(blank):\n today = datetime.today()\n return today.strftime(\"%A %B %d, %-I:%M %p\")", "def timeStamp():\n import time\n return str(time.strftime(\"%a %d %b %Y %I:%M:%S %p\"))", "def get_time_stamp():\n LOG.info('In get_time_stamp')\n timestamp_in_secs = time.time()\n ...
[ "0.6661555", "0.65137535", "0.65072346", "0.64812773", "0.64656293", "0.64320934", "0.64185804", "0.64050627", "0.63539547", "0.63497597", "0.6348212", "0.6323478", "0.63144654", "0.6304702", "0.62973917", "0.6291501", "0.6251585", "0.6243039", "0.6242076", "0.62325555", "0.6...
0.79561013
0
Generates a correct path for any platform
def join_path(*args): return os.path.join(*args)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_plato_path():\n\treturn \"/tsi/\"", "def path_creator(rel_path=''):\n if platform.system() != 'Windows':\n if rel_path == '':\n path_list=sys.argv[0].split('/')[:-1]\n return '/'.join(path_list)\n else:\n path_list = sys.argv[0].split('/')[:-1]\n ...
[ "0.68407935", "0.67291874", "0.66797614", "0.6464132", "0.6391632", "0.63854575", "0.6374949", "0.6321801", "0.6293019", "0.6263794", "0.61730903", "0.6149489", "0.6119712", "0.61058307", "0.6069464", "0.5989377", "0.5944702", "0.5884633", "0.5876261", "0.58601445", "0.585961...
0.0
-1
Gets the default location of Minecraft for this system
def get_default_mc_loc(): if platform.system() == 'Windows': # Windows return join_path(os.getenv('APPDATA'), '.minecraft') # C:\Users\<user name>\AppData\Roaming elif platform.system() == 'Darwin': # MacOS return join_path(os.getenv('HOME'), 'Library', 'Application Support', 'minecraft') # ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_alt_loc(self):\n return self.default_alt_loc", "def default_secondary_location(self) -> str:\n return pulumi.get(self, \"default_secondary_location\")", "def get_location(self):\n return self._overridden_location or self.get_default_location()", "def get_current_location(...
[ "0.6796112", "0.6690159", "0.6681357", "0.65638244", "0.64394754", "0.63865715", "0.63452643", "0.63273835", "0.6317721", "0.6317721", "0.6317721", "0.6303396", "0.6303396", "0.62629807", "0.62240577", "0.6176864", "0.6176864", "0.6176864", "0.6176864", "0.6176864", "0.617686...
0.8103766
0
Opens URL in the default browser
def open_browser(url): import webbrowser webbrowser.open_new(url)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open(url):\r\n webbrowser.open(url)", "def open_in_browser(self):\n webbrowser.open(self.url)", "def open_url(name):\n url = localReadConfig.get_webServer(name)\n browser = open_browser()\n browser.get(url)\n return browser", "def openurl(url):\n\n # Open the URL\n webbrowser....
[ "0.8300836", "0.824589", "0.80313796", "0.7982461", "0.7885389", "0.7706711", "0.7696021", "0.7672873", "0.7672488", "0.7662576", "0.7551381", "0.7441665", "0.74353623", "0.7414981", "0.74112564", "0.7294314", "0.7282164", "0.72268164", "0.72234035", "0.72146", "0.7204085", ...
0.81538117
2
Returns the file name, derived from the path
def get_file_name(path): return os.path.basename(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_name(path):\n return os.path.basename(path).split('.')[0]", "def getfilename(path):\r\n return path.split('\\\\').pop().split('/').pop().rsplit('.', 1)[0]", "def get_file_name(path: str) -> str:\n return os.path.splitext(os.path.basename(path))[0]", "def get_file_name(self):\n return...
[ "0.841461", "0.83068866", "0.8304893", "0.82852703", "0.82507", "0.8241181", "0.81059855", "0.810212", "0.8101138", "0.8002947", "0.7876396", "0.7809701", "0.7807089", "0.77653134", "0.7728102", "0.77166677", "0.7706979", "0.76581496", "0.7640988", "0.7635858", "0.75833327", ...
0.87579036
0
Gets the parent directory of the end of path
def get_parent_dir(path): return os.path.dirname(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parent_path(cls,path):\n # os.path.dirname(), but strip directories like files (like unix basename)\n # Treat directories like files...\n if path[-1]=='/':\n path=path[:-1]\n ret = os.path.dirname(path)\n return ret", "def parent_dir_path(path):\n return absolu...
[ "0.8631019", "0.86226535", "0.8482168", "0.8416384", "0.836997", "0.8308873", "0.81717604", "0.7833703", "0.7683455", "0.75546896", "0.7370464", "0.72962385", "0.7266949", "0.7264568", "0.7248265", "0.72423804", "0.7222234", "0.71652234", "0.70380044", "0.6964497", "0.6919675...
0.8882332
0
from a binary string to a list of [id,weight,value].
def phenotype(indiv): pheno = [[id, problem['weights'][id], problem['values'][id]] for id in range(len(indiv)) if indiv[id] == 1] return pheno
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_bit_array(text_string: str) -> list:\n\n array = list()\n for char in text_string:\n # Get the char value on one byte\n bin_val = Des.bin_value(char, 8)\n # Add the bits to the final list\n array.extend([int(x) for x in list(bin_val)])\n ...
[ "0.64919543", "0.6369273", "0.6161091", "0.6039952", "0.5935068", "0.58602935", "0.58450687", "0.58346134", "0.5802277", "0.58013606", "0.57577527", "0.5723122", "0.5716271", "0.57105553", "0.56988865", "0.565404", "0.5635822", "0.563525", "0.56202936", "0.5611972", "0.560164...
0.0
-1
Verify Templates Design keywords. notemplates is a compatibility tests for repo without `templates` directory
def test_build_templates(template, output_dir): project_dir = main.cookiecutter( f'tests/test-templates/{template}', no_input=True, output_dir=output_dir, ) readme_file = os.path.join(project_dir, 'requirements.txt') with codecs.open(readme_file, encoding='utf8') as f: readme = f.read(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_do_some_templates_exist():\n assert len(templates) > 0", "def test_template_name():\n for t in templates:\n assert len(t.name) > 0", "def test_correct_template(self):\n self.assertCorrectTemplateUsed('common/home.html')", "def assertProjectTemplatesUsed(self, response):\n self...
[ "0.7111534", "0.6666861", "0.65406275", "0.6487179", "0.6421827", "0.63946855", "0.63901585", "0.63757336", "0.63595605", "0.63183606", "0.6218981", "0.619849", "0.6161492", "0.613266", "0.613266", "0.6100594", "0.6085184", "0.60767275", "0.59393513", "0.5919201", "0.5910538"...
0.65004456
3
Compute the average power of the signal x in a specific frequency band.
def bandpower(data, sf, band, window_sec=None, relative=False): from scipy.signal import welch from scipy.integrate import simps band = np.asarray(band) low, high = band # Define window length if window_sec is not None: nperseg = window_sec * sf else: nperseg = (2 / low) * ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signal_power(signal_input, *arg):\r\n signal_T = np.array(signal_input)\r\n energy = np.abs(signal_T) ** 2\r\n if len(arg) < 1:\r\n power = np.mean(energy)\r\n else:\r\n power = np.mean(energy, axis=arg[0])\r\n return power", "def avg_power_spectro(Sxx...
[ "0.7155431", "0.68030465", "0.66364723", "0.62977445", "0.62147605", "0.60456085", "0.6014055", "0.59779775", "0.5957791", "0.59175956", "0.58937895", "0.5854286", "0.5835787", "0.58209395", "0.581682", "0.5793635", "0.578129", "0.5776566", "0.57712775", "0.5752855", "0.57368...
0.54986525
40
Return VerticalPanel positioned under Panel holding Canvas.
def get_vpanel(self): if not self.vpanel: self.vpanel = VerticalPanel() RootPanel().add(self.vpanel) return self.vpanel
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_panel(self):\n return\n # return Panel(self)", "def vertical(self):\n return self._vertical", "def create_main_panel(self):\n self.panel = wx.Panel(self)\n\n self.init_plot()\n self.canvas = FigCanvas(self.panel, -1, self.fig)\n\n self.control_box = V...
[ "0.59304374", "0.5891619", "0.5868168", "0.5845361", "0.56416017", "0.55967766", "0.5532673", "0.54355943", "0.5425686", "0.52850765", "0.5281079", "0.52607864", "0.5256582", "0.52467227", "0.5237199", "0.52117944", "0.520629", "0.5177642", "0.5177642", "0.51756483", "0.51203...
0.7619186
0
Return canvas topoffset position.
def getAbsoluteTop(self): return self.canvas.getAbsoluteTop()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_offset(self):\n raise NotImplementedError", "def top_y(self):\r\n return self.position.y + self.size.y + self.bulk", "def top(self):\n return self.points['topRight'].y", "def top(self):\n return self.points['topRight'].y", "def get_pos(self):\n return self.rect.midt...
[ "0.72364736", "0.7140133", "0.71326786", "0.71326786", "0.7042159", "0.6944361", "0.6920801", "0.67182386", "0.6553493", "0.6536355", "0.6505047", "0.64384615", "0.6414971", "0.6367798", "0.6331739", "0.6323262", "0.6314093", "0.63107616", "0.62790745", "0.62784046", "0.62769...
0.789404
0
Return page horizontal scroll offset.
def getScrollLeft(self): return self.frame.scrollLeft
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPageLeft(self):\n return self.pageLeft", "def get_page_offset(self) -> int:\n page_offset: int = self.page_number\n if page_offset <= 1:\n return 0\n return (page_offset - 1) * self.get_page_size()", "def page_from(self):\n return 0 if self.page_size == 0 el...
[ "0.69253963", "0.67402333", "0.63669795", "0.6355653", "0.61935073", "0.61398447", "0.61341226", "0.6121505", "0.6121505", "0.6062614", "0.6013576", "0.59761524", "0.5965584", "0.59297615", "0.5900503", "0.58795595", "0.58795404", "0.5856518", "0.5819797", "0.5810518", "0.580...
0.7284408
0
Return page vertical scroll offset.
def getScrollTop(self): return self.frame.scrollTop
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page_offset(self) -> int:\n page_offset: int = self.page_number\n if page_offset <= 1:\n return 0\n return (page_offset - 1) * self.get_page_size()", "def getYOffset(self):\n return _libsbml.Point_getYOffset(self)", "def content_box_y(self):\n return self.p...
[ "0.68147075", "0.6493165", "0.6470923", "0.6470406", "0.63588506", "0.6256047", "0.6245041", "0.62061375", "0.6198362", "0.6152118", "0.6121141", "0.6095557", "0.609246", "0.60858583", "0.6024968", "0.60186183", "0.5990239", "0.59896463", "0.5985493", "0.5972965", "0.59450394...
0.6441127
4
Set Canvas element id. Argument is the id text.
def set_caption(self, text): self.id = text try: self.canvas.setID(self.id) except (TypeError, AttributeError): pass return None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_id(self, id):\n self.data['id'] = id", "def set_id(self, id_):\n\n self.id_ = id_", "def set_id(self, player_id):\n pass", "def set_id(self, id):\n self.__id = id", "def set_id(self, id):\n self.id = id\n print(\"self id = \" + str(self.id))", "def id(sel...
[ "0.67934334", "0.67737395", "0.6765662", "0.6758977", "0.6753172", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6605382", "0.6593913", "0.6567454", "0.65555596", "0.6528973", ...
0.0
-1
Get Canvas element id.
def get_caption(self): try: return self.canvas.getID() except (TypeError, AttributeError): return self.id
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getId(self):\n return _libsbml.Dimensions_getId(self)", "def getId(self):\n return _libsbml.Point_getId(self)", "def id(self):\n return id(self._component)", "def getid(self):\n return self.__id", "def get_axis_id(self, axis_name):\n logger.debug('core.cuboid ... gett...
[ "0.63365096", "0.62944233", "0.62823427", "0.612597", "0.61065453", "0.6096312", "0.6091381", "0.60819", "0.60819", "0.60728997", "0.60728997", "0.60728997", "0.60728997", "0.60728997", "0.60728997", "0.6066748", "0.60233265", "0.60220987", "0.5999465", "0.5992309", "0.599230...
0.6058908
16
Converts the python sequence (tuples and lists) to an un ordered list
def html_sequence(seq_esc: "Sequence") -> str: items = (f"<li>{htmlize(item)}</li>" for item in seq_esc) return "<ul>\n" + "\n".join(items) + "\n</ul>"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_list(ls):\r\n if isinstance(ls, (list, tuple)):\r\n return list(ls)\r\n else:\r\n return [ls]", "def _to_list(series: Union[TimeSeries, Sequence[TimeSeries]]) -> Sequence[TimeSeries]:\n\n return [series] if not isinstance(series, Sequence) else series", "def tolist(x):\n return...
[ "0.7171209", "0.7075143", "0.6932708", "0.68989366", "0.6858652", "0.6792945", "0.67869085", "0.67027855", "0.66101676", "0.6588554", "0.65431666", "0.65118504", "0.64956164", "0.6436783", "0.6404273", "0.64024276", "0.6393895", "0.63901395", "0.6380912", "0.63746196", "0.633...
0.0
-1
Returns the sum of the function values of f evaluated at values x0, x1, x2, ..., xn where xs=[x0,x1,x2,...,xn]
def sum_f(f, xs): sum = 0 for x in xs: sum += f(x) return sum
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_f(f, xs):\n sum_num = 0\n for num in xs:\n int_num = int(num)\n fun_num = f(int_num)\n sum_num = sum_num+fun_num\n return sum_num", "def f1(x):\n \n # Sum over data points\n f = 0.0\n for m_ind in range(cfg.ntrain):\n f += f1_part_i(x,m_ind) \n \n ...
[ "0.7689102", "0.677604", "0.67113", "0.66471976", "0.6618757", "0.6492451", "0.64732724", "0.63708246", "0.6328787", "0.6316019", "0.62078315", "0.6148149", "0.6132703", "0.60836047", "0.5986995", "0.5977715", "0.59347856", "0.59131885", "0.59122735", "0.59122735", "0.5893695...
0.8387013
0
This method run before each test. If test objects (data structures) already initialized skip.
def setUp(self): input_files = glob.glob(PATH_TO_INPUT_FILES) # Read input (csv) files from current (sw/test) directory. if not self.sessionizing: self.sessionizing = Sessionizing() self.sessionizing.initialize(*input_files) if not self.sites_session_counter: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setUp(self):\r\n # nothing to do, all tests use different things\r\n pass", "def before_run_tests(cls):\n pass", "def setUp(self):\n Base._Base__nb_objects = 0", "def setUp(self):\n Base._Base__nb_objects = 0", "def setUp(self):\n Base._Base__nb_objects = 0", ...
[ "0.7356431", "0.72856975", "0.7214756", "0.7214756", "0.7214756", "0.7214756", "0.7214756", "0.7214756", "0.7055025", "0.7034403", "0.6953418", "0.6950764", "0.6943474", "0.6943117", "0.69019616", "0.684371", "0.6801573", "0.6800003", "0.6773715", "0.6773715", "0.6769694", ...
0.0
-1
Place the active window in the middle of the screen
def middle_option(): active = get_active_window() Width=get_middle_Width(active) Height=get_middle_Height() PosX = get_middle_PosX(active,Width) PosY= get_middle_PosY() move_window(active,PosX,PosY,Width,Height) raise_window(active)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(window):\n window.update_idletasks()\n\n # Find the screen resolution\n screen_width = window.winfo_screenwidth()\n screen_height = window.winfo_screenheight()\n\n # Find new (x, y) coordinates\n size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))\n x = screen_w...
[ "0.79966515", "0.7973493", "0.7970798", "0.79106516", "0.7908796", "0.7885023", "0.7834887", "0.78096235", "0.77864593", "0.77566457", "0.7718074", "0.76976424", "0.7646006", "0.759631", "0.759631", "0.75170386", "0.7370159", "0.7297165", "0.72718257", "0.7175345", "0.7096375...
0.6607998
40
Place the active window in the bottom left corner of the screen
def bottom_left_option(): active = get_active_window() Width=get_corner_Width(active) Height=get_bottom_Height() PosX = get_left_PosX(active,Width) PosY=get_bottom_PosY() move_window(active,PosX,PosY,Width,Height) raise_window(active)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def placeWindow(self):\r\n\t\t# window size\r\n\t\tw = 600\r\n\t\th = 300\r\n\t\t# find the screen size\r\n\t\tsw = self.parent.winfo_screenwidth()\r\n\t\tsh = self.parent.winfo_screenheight()\r\n\t\t# now define the location on the current screen\r\n\t\tx = (sw/2-0.5*w)\r\n\t\ty = (sh/2-0.5*h)\r\n\t\tself.parent....
[ "0.7852993", "0.76210344", "0.7476628", "0.7427107", "0.7110935", "0.7055845", "0.68054163", "0.6776939", "0.67633384", "0.6706597", "0.66986203", "0.6689711", "0.6684727", "0.66516566", "0.6648298", "0.6631068", "0.6507404", "0.6495565", "0.6495565", "0.6449752", "0.64315635...
0.7485281
2
Split windows, focus on the new window, and return the new window.
def split(nvim, vertical=False, new_file=True): cmds = Cmds(["vsplit" if vertical else "split"]) if new_file: cmds.append("enew") cmds.run(nvim) return nvim.current.window
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_window(session):\n def create_window():\n windows_before = session.handles\n name = session.execute_script(\"window.open()\")\n assert len(session.handles) == len(windows_before) + 1\n new_windows = list(set(session.handles) - set(windows_before))\n return new_windo...
[ "0.6843045", "0.6658341", "0.6456951", "0.6413343", "0.64051354", "0.63260406", "0.63051087", "0.6170292", "0.59696925", "0.5965667", "0.5954286", "0.59186965", "0.5891547", "0.5858402", "0.58511937", "0.58058786", "0.5693715", "0.5686892", "0.5685447", "0.56737304", "0.56337...
0.56581986
20
Vertically split windows, focus on the new window, and return the new window.
def vsplit(nvim, new_file=True): return split(nvim, True, new_file)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_window(session):\n def create_window():\n windows_before = session.handles\n name = session.execute_script(\"window.open()\")\n assert len(session.handles) == len(windows_before) + 1\n new_windows = list(set(session.handles) - set(windows_before))\n return new_windo...
[ "0.6696572", "0.65526664", "0.6546986", "0.65454763", "0.65320134", "0.63900703", "0.61894244", "0.61151457", "0.6024209", "0.5999345", "0.5976759", "0.5772122", "0.5749668", "0.5729732", "0.56777453", "0.564488", "0.56050384", "0.5602524", "0.5498536", "0.54270434", "0.54030...
0.48737007
75
Will center the currently focused window on line line_no.
def center_on_line(line_no): return Cmds([str(line_no), Cmd.normal("z."), "redraw!"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def center(window):\n window.update_idletasks()\n\n # Find the screen resolution\n screen_width = window.winfo_screenwidth()\n screen_height = window.winfo_screenheight()\n\n # Find new (x, y) coordinates\n size = tuple(int(_) for _ in window.geometry().split('+')[0].split('x'))\n x = screen_w...
[ "0.7087361", "0.7021938", "0.69975656", "0.6938597", "0.68613523", "0.6642707", "0.6622737", "0.65862757", "0.657932", "0.6537366", "0.6537366", "0.6528483", "0.6497942", "0.6495269", "0.6426588", "0.6420842", "0.6409015", "0.6406213", "0.63755536", "0.63755536", "0.6366713",...
0.769848
0
Date is internal UTC ISO format string. Output should be "today", "yesterday", "in 5 days", etc. Arrow will try to humanize down to the minute, so we need to catch 'today' as a special case.
def humanize_arrow_date( date ): try: then = arrow.get(date).to('local') now = arrow.utcnow().to('local') if then.date() == now.date(): human = "Today" else: human = then.humanize(now) if human == "in a day": human = "Tomorrow" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def humanize_arrow_date(date):\n try:\n then = arrow.get(date)\n now = arrow.utcnow()\n now = now.replace(hour=0, minute=0, second=0)\n if then.date() == now.date():\n human = \"Today\"\n else:\n human = then.humanize(now)\n if human == \"in a ...
[ "0.7299229", "0.6316933", "0.623622", "0.61559504", "0.5996783", "0.5975734", "0.58404326", "0.58039963", "0.57811826", "0.57704353", "0.5769235", "0.5741685", "0.567308", "0.56673306", "0.5662842", "0.56438786", "0.5624631", "0.5599852", "0.55823165", "0.5573989", "0.5570482...
0.7053984
1
Loads images and labels from the given directory in PASCAL VOC format.
def from_pascal_voc_folder( cls, data_dir: str, max_num_images: Optional[int] = None, cache_dir: Optional[str] = None, ) -> 'Dataset': cache_files = dataset_util.get_cache_files_pascal_voc(data_dir, cache_dir) if not dataset_util.is_cached(cache_files): label_map = dataset_util.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_imagenet(directory):\n path_train, path_val = directory + '/ILSVRC2012_img_train', directory + '/ILSVRC2012_img_val'\n train_labels = os.listdir(path_train)\n train_data = []\n for label in train_labels:\n imgs_path = os.path.join(path_train, label)\n imgs = os.listdir(imgs_path)...
[ "0.6542538", "0.6446743", "0.62993336", "0.6207669", "0.61119", "0.61032426", "0.61006826", "0.60944206", "0.60626346", "0.6026999", "0.59973633", "0.5986289", "0.5985126", "0.5978871", "0.59532017", "0.59505475", "0.5946941", "0.59357435", "0.59327054", "0.5930023", "0.59246...
0.5631647
48
Returns a Transform with the given frames.
def make_transform(parent_frame: str, child_frame: str) -> TransformStamped: out = TransformStamped() out.header.frame_id = parent_frame out.child_frame_id = child_frame # some random data out.transform.rotation.w = 1 out.transform.translation.x = 0.1 return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_transform(self, from_frame, to_frame):\n if not self._pipeline:\n return None\n try:\n from_ind = self._get_frame_index(from_frame)\n except ValueError:\n raise CoordinateFrameError(\"Frame {0} is not in the available \"\n ...
[ "0.64223534", "0.6363581", "0.60932153", "0.6016298", "0.60145336", "0.5937197", "0.5937197", "0.5937197", "0.5868103", "0.5840218", "0.58271337", "0.57548267", "0.57184625", "0.5640878", "0.5603786", "0.5562078", "0.5558426", "0.55530345", "0.5549237", "0.5548251", "0.554738...
0.66231483
0
r"""Computes the logarithm of the density matrix for a batch of visible quantum numbers `(xr,xc)` and stores the result into `out`. Specifically, for each element of the batch i, this function should compute out[i]=log(rho(xr[i],xc[i])). If xr is None, it is assumed that xr has twice as many quantum numbers and contain...
def log_val(self, xr, xc=None, out=None): if xc is None: return self._plog_val(xr, out) else: return self._plog_val(_np.hstack((xr, xc)), out)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def der_log(self, xr, xc=None, out=None):\n if xc is None:\n return self._pder_log(xr, out)\n else:\n return self._pder_log(_np.hstack((xr, xc)), out)", "def logpdf(self, X, pool=None):\n logpdfs = []\n for logweight, space, kde in zip(self._logweights,\n ...
[ "0.67536134", "0.5929095", "0.5787016", "0.5787016", "0.57842773", "0.57700914", "0.5677975", "0.5523281", "0.5417427", "0.53904533", "0.53785", "0.53733927", "0.53521395", "0.5330728", "0.5298528", "0.52868307", "0.5277517", "0.5247273", "0.52235293", "0.52163136", "0.520864...
0.6746137
1
Initializes a new instance of the uniform edge sampler.
def __init__(self, sample_size, neighbours, lengths, offsets, seed=0): self.sample_size = sample_size self.seed, self.seed2 = random_seed.get_seed(seed) self.neighbours = neighbours self.lengths = lengths self.offsets = offsets super(UniformEdgeDataset, self).__init__()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(\n self, weights, edge_score_norm\n ):\n self.weights = weights\n self.edge_score_norm = edge_score_norm", "def __init__(self, a, b, *args, **kwargs):\n self.a = a\n self.b = b\n super(Uniform, self).__init__(*args, **kwargs)", "def __init__(self, *args):\n ...
[ "0.62703085", "0.6190725", "0.6130677", "0.6081981", "0.6041637", "0.600893", "0.59430003", "0.59430003", "0.59147745", "0.59108746", "0.5893205", "0.58904165", "0.58743054", "0.5865136", "0.5862257", "0.5861973", "0.5816936", "0.5816936", "0.5816936", "0.58011127", "0.577944...
0.68228763
0