query stringlengths 9 9.05k | document stringlengths 10 222k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 4 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
finds all indices at level J2 of the k1th node of level J1 for J2<J1 here the graph at higher level is coarser in the chain | def tree_idx2(treeG,k1,J1,J2):
g = treeG[J1]['clusters'][k1]
if(J1>J2+1):
for j in np.arange(J2+1, J1)[::-1]:
g1 = []
for i in np.arange(0,len(g),1):
g1 = np.array(np.append(g1,treeG[j]['clusters'][g[i]]), dtype = int)
g = g1
y = g
return y | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_idx(tree,j1,J1,J2):\n j = j1\n for k in np.arange(J1+1,J2+1,1):\n j = tree[k]['IDX'][j]\n \n j2 = j\n return j2",
"def leftright_neighbors(j, chain) :\n i, k = find_neighbors(j, chain.bridges_dict)\n if chain.lumens_dict[i].pos <= chain.lumens_dict[k].pos :\n return [i... | [
"0.7266823",
"0.6305669",
"0.5982671",
"0.59240067",
"0.5828946",
"0.5808852",
"0.57802653",
"0.5776684",
"0.5682929",
"0.566963",
"0.5660535",
"0.5623801",
"0.5549423",
"0.5520403",
"0.5512112",
"0.54909265",
"0.54774123",
"0.54624104",
"0.5460863",
"0.5455769",
"0.5449673",... | 0.7601491 | 0 |
HaarGOB generates Haar Global Orthonormal Basis for a chain or tree treeG % | def HaarGOB(treeG):
# number of level of the chain (or tree)
Ntr = len(treeG)
# reorder chain (optional)
# reordering each level so that in each level the nodes are in the
# descent order of degrees
# compute u_l^c for level J_0 (top level)
clusterJ0 = treeG[Ntr-1]['clusters']
N0 = len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Bo_Bosol_calc(self):\n self.Bosol = (self.g*self.alpha * self.srflx ) \n #ZEROS FOR T3W APPLICATION\n self.Bo = np.zeros([self.b.shape[0]])",
"def Uext(edge_index, num_nodes, levels, ratio=0.5, edge_weight=None):\n # generate tree \n if edge_weight is None:\n edge_weight = t... | [
"0.5692631",
"0.5615502",
"0.55466145",
"0.5538011",
"0.5481357",
"0.5468493",
"0.5373694",
"0.52191734",
"0.5216214",
"0.5204906",
"0.5202637",
"0.51951194",
"0.5182853",
"0.5173281",
"0.51684976",
"0.51679844",
"0.51679844",
"0.5167218",
"0.51536244",
"0.51372653",
"0.51359... | 0.798821 | 0 |
adj2edge computes edge_index and edge_weights for adjacency matrix adj | def adj2edge(adj):
adj = adj.tocoo().astype(np.float64)
row = adj.row
col = adj.col
values = adj.data
edge_weights = torch.Tensor(values)
edge_index = torch.LongTensor([list(row),list(col)])
return edge_index, edge_weights | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edge2adj(edge_index,edge_weight,num_nodes):\n adj = torch.sparse.FloatTensor(edge_index, edge_weight, torch.Size([num_nodes,num_nodes]))\n return adj",
"def dense_to_sparse(adj):\n assert adj.dim() >= 2 and adj.dim() <= 3\n assert adj.size(-1) == adj.size(-2)\n\n index = adj.nonzero(as_tuple=T... | [
"0.7901713",
"0.6594338",
"0.64761364",
"0.64059156",
"0.6341312",
"0.62411606",
"0.6226355",
"0.62218237",
"0.62197196",
"0.62104046",
"0.6197038",
"0.6163088",
"0.6163088",
"0.6163088",
"0.6163088",
"0.6163088",
"0.61335826",
"0.6109824",
"0.60774726",
"0.6057789",
"0.60332... | 0.86497563 | 0 |
edge2adj computes adjacency matrix by edge_index and edge_weights | def edge2adj(edge_index,edge_weight,num_nodes):
adj = torch.sparse.FloatTensor(edge_index, edge_weight, torch.Size([num_nodes,num_nodes]))
return adj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adj2edge(adj):\n adj = adj.tocoo().astype(np.float64)\n row = adj.row\n col = adj.col\n values = adj.data\n edge_weights = torch.Tensor(values)\n edge_index = torch.LongTensor([list(row),list(col)])\n return edge_index, edge_weights",
"def adjacency(self):\n if self.E > 0:\n ... | [
"0.7782306",
"0.68695056",
"0.68650424",
"0.6750768",
"0.67112184",
"0.6684284",
"0.6679103",
"0.6674294",
"0.6650591",
"0.6610233",
"0.6591361",
"0.6504153",
"0.6456505",
"0.64083904",
"0.63484436",
"0.63129056",
"0.6301835",
"0.6234439",
"0.6218886",
"0.62024945",
"0.618971... | 0.83138466 | 0 |
Uext computes the extended Haar basis for each layer of the tree. It generates a tree with L layers and then Haar basis for each layer. | def Uext(edge_index, num_nodes, levels, ratio=0.5, edge_weight=None):
# generate tree
if edge_weight is None:
edge_weight = torch.ones((edge_index.size(1), ),
device=edge_index.device)
A = edge2adj(edge_index,edge_weight,num_nodes).to_dense()
A = A.cpu().num... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HaarGOB(treeG):\n # number of level of the chain (or tree)\n Ntr = len(treeG)\n # reorder chain (optional) \n # reordering each level so that in each level the nodes are in the\n # descent order of degrees\n # compute u_l^c for level J_0 (top level)\n clusterJ0 = treeG[Ntr-1]['clusters']\n... | [
"0.5844538",
"0.5258079",
"0.52351433",
"0.49955368",
"0.4839558",
"0.48073968",
"0.47809663",
"0.47492084",
"0.47427544",
"0.4726209",
"0.47189516",
"0.4703458",
"0.46744376",
"0.4659299",
"0.4624729",
"0.46183556",
"0.46159506",
"0.460538",
"0.4555086",
"0.4548719",
"0.4547... | 0.70847505 | 0 |
Construct a new instance based on the given URI. Memory elements resolve bytestring formats. Currently, this method accepts a base64 using the standard and URLsafe alphabet as the python ``base64.urlsafe_b64decode`` module function would expect. | def from_uri(cls, uri):
if uri is None:
raise InvalidUriError(uri, 'None value given')
if len(uri) == 0:
return DataMemoryElement('', None)
data_b64_m = cls.URI_B64_RE.match(uri)
if data_b64_m is not None:
m_d = data_b64_m.groupdict()
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_base64(cls, b64_str, content_type=None):\n if b64_str is None:\n raise ValueError(\"Base 64 string should not be None\")\n # The decode function does not like taking unicode strings.\n # Additionally, the encoding alphabet should not container any unicode\n # symbols... | [
"0.67628026",
"0.5690241",
"0.56474173",
"0.53488606",
"0.53230876",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",
"0.53032386",... | 0.74022305 | 0 |
Create new MemoryElement instance based on a given base64 string and content type. This method accepts a base64 using the standard and URLsafe alphabet as the python ``base64.urlsafe_b64decode`` module function would expect. | def from_base64(cls, b64_str, content_type=None):
if b64_str is None:
raise ValueError("Base 64 string should not be None")
# The decode function does not like taking unicode strings.
# Additionally, the encoding alphabet should not container any unicode
# symbols, so this au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_base64(x):\n\treturn numpy.fromstring(\n\t\tbinascii.a2b_base64(x),\n\t\tdtype=numpy.uint8\n\t)",
"def __init__(self, data, from_base64=False, **kwargs):\n super().__init__(data, **kwargs)\n self.type_name = 'base64'\n self.encoding = kwargs.get('encoding', 'original')\n # TO... | [
"0.6197852",
"0.5826548",
"0.5806672",
"0.56795895",
"0.56371",
"0.55859756",
"0.54986817",
"0.54737747",
"0.5445685",
"0.543529",
"0.54014313",
"0.5395255",
"0.5395255",
"0.53750473",
"0.53251284",
"0.5311812",
"0.52977824",
"0.5245776",
"0.5175264",
"0.5153908",
"0.51193684... | 0.83755225 | 0 |
Create a new DataMemoryElement from a byte string and optional content type. | def __init__(self, bytes=None, content_type=None, readonly=False):
super(DataMemoryElement, self).__init__()
self._bytes = bytes
self._content_type = content_type
self._readonly = bool(readonly) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_base64(cls, b64_str, content_type=None):\n if b64_str is None:\n raise ValueError(\"Base 64 string should not be None\")\n # The decode function does not like taking unicode strings.\n # Additionally, the encoding alphabet should not container any unicode\n # symbols... | [
"0.7108122",
"0.6535859",
"0.63346565",
"0.60067624",
"0.5948532",
"0.5873863",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
"0.58676773",
... | 0.72616655 | 0 |
Check if this element contains no bytes. | def is_empty(self):
return not bool(self._bytes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self) -> bool:\n return self.size_bytes == 0",
"def empty(self):\n return 0 >= len(self.__data)",
"def empty(self):\r\n return self.getSize() == 0",
"def is_empty(self):\r\n return self.buff==[]",
"def is_empty(self):\n return len(self.data) == 0",
"def is_empt... | [
"0.71236455",
"0.70640343",
"0.70586455",
"0.69462913",
"0.6941436",
"0.6916584",
"0.6891693",
"0.6877218",
"0.6877218",
"0.6877218",
"0.6877218",
"0.6877218",
"0.6877218",
"0.6877218",
"0.68745804",
"0.68534386",
"0.6840915",
"0.68221784",
"0.67716426",
"0.67669696",
"0.6752... | 0.79667604 | 0 |
Generate the src (encoder input), trg (decoder input) and trg_y (the target) sequences from a sequence. | def get_src_trg(self,sequence:torch.Tensor, enc_seq_len: int, dec_seq_len: int, target_seq_len: int) -> Tuple[torch.tensor, torch.tensor, torch.tensor]:
# get the encoder input sequence
src = sequence[:enc_seq_len]
# get the decoder input sequence (same dimension as the target sequence, must con... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gru_seq2seq_internal(inputs, targets, hparams, train):\n with tf.variable_scope(\"gru_seq2seq\"):\n if inputs is not None:\n inputs_length = common_layers.length_from_embedding(inputs)\n # Flatten inputs.\n inputs = common_layers.flatten4d3d(inputs)\n input... | [
"0.593233",
"0.5926355",
"0.58997285",
"0.58114034",
"0.5793437",
"0.5730409",
"0.5728731",
"0.5704291",
"0.56196785",
"0.55970013",
"0.55869216",
"0.557607",
"0.5574199",
"0.5562988",
"0.55269337",
"0.55253494",
"0.55233973",
"0.5522249",
"0.5515685",
"0.5509468",
"0.5477484... | 0.7085247 | 0 |
Produce all the start and end index position of all subsequences. The indices will be used to split the data into subsequences on which the modle will be trained. | def get_indices_entire_sequence(data: pd.Dataframe, window_size: int, step_size: int) -> list:
stop_position = len(data)-1 # 1- because of 0 indexing
# Start the first sub-sequence at index position 0
subseq_first_idx = 0
subseq_last_idx = subseq_first_idx + window_size
indices = []
while su... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def master_ndindex(self): # itermaster_indices(self):\n return itertools_product(\n *[range(*r) for r in self.location]\n ) # TODO check",
"def occurence(main_seq,sub_seq):\n start= 0\n indices =[]\n while True:\n start = main_seq.find(sub_seq,start)\n if start >... | [
"0.6543954",
"0.63142383",
"0.6296787",
"0.62787384",
"0.61617285",
"0.6131563",
"0.6119201",
"0.6053211",
"0.60374343",
"0.5922312",
"0.5917239",
"0.5886822",
"0.5878144",
"0.5838814",
"0.5809811",
"0.58025837",
"0.57582617",
"0.57275957",
"0.56790435",
"0.5669531",
"0.56656... | 0.67622393 | 0 |
Downcast columns in df to smallest possible version of it's existing data type | def to_numeric_and_downcast_data(df: pd.DataFrame):
fcols = df.select_dtypes('float').columns
icols = df.select_dtypes('integer').columns
df[fcols] = df[fcols].apply(pd.to_numeric, downcast='float')
df[icols] = df[icols].apply(pd.to_numeric, downcast='integer')
return df | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_types(df):\n \n # Iterate through each column\n for c in df:\n \n # Convert ids and booleans to integers\n if ('SK_ID' in c):\n df[c] = df[c].fillna(0).astype(np.int32)\n \n # Convert objects to category\n elif (df[c].dtype == 'object') ... | [
"0.71998435",
"0.6876043",
"0.67652696",
"0.65559554",
"0.6455821",
"0.644587",
"0.6364636",
"0.62903696",
"0.6282195",
"0.62721366",
"0.6207411",
"0.6206089",
"0.62029654",
"0.6188845",
"0.6180624",
"0.6135772",
"0.6115902",
"0.6098156",
"0.6085898",
"0.606376",
"0.6032358",... | 0.7185001 | 1 |
path_to_network_model = 'path to network model (model.json)' path_to_weight = 'path to network weight weight_xx_xx.h5' | def build_model(path_to_network_model, path_to_weights):
# with tf.device('/gpu:0'):
json_file = open(path_to_network_model, 'r')
model_json = json_file.read()
json_file.close()
# custom_objects={"backend": K, "tf": tf}
model = model_from_json(model_json, custom_objects={"tf": tf})
model.co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_weight(model):\n file = h5py.File(WEIGHT_SAVE, 'r')\n weight = []\n for i in range(len(file.keys())):\n weight.append(file['weight' + str(i)][:])\n model.set_weights(weight)",
"def build_network(weights_path: str=''):\n\n input_tensor = Input(shape=(9,))\n one = Dense(32)(input_... | [
"0.69953287",
"0.66284347",
"0.6616078",
"0.65943617",
"0.6494463",
"0.6436399",
"0.640401",
"0.6360392",
"0.6324705",
"0.6292688",
"0.62856126",
"0.6285134",
"0.6282934",
"0.62742645",
"0.6269212",
"0.62690365",
"0.62554795",
"0.6199645",
"0.6178937",
"0.617519",
"0.61673677... | 0.69942236 | 1 |
Function used to fetch avatar from the Gravatar service if exists. Return None if there is no avatar associated to the email. | def get_from_gravatar(email):
# We need an email hash
encoded_email = email.encode('utf-8')
hashed_email = hashlib.md5(encoded_email).hexdigest()
# Construct the gravatar url
gravatar_url = f'https://www.gravatar.com/avatar/{hashed_email}.jpg'
gravatar_params_url = {
# Returns a 404 st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetAvatar(self):\n\n return self.__GetJsonOrNone(\"/users/\"+self.userName+\"/avatar\", False)",
"def avatar_url(self) -> typing.Optional[files.URL]:\n return self.make_avatar_url()",
"def avatar_url(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"avatar_url\")",
"d... | [
"0.76837873",
"0.72060746",
"0.71892136",
"0.6978371",
"0.68678874",
"0.6823327",
"0.67536706",
"0.67294395",
"0.6720323",
"0.66511005",
"0.6620417",
"0.65893024",
"0.6579452",
"0.65355057",
"0.64937675",
"0.6492578",
"0.6462109",
"0.64486617",
"0.6448432",
"0.6436299",
"0.63... | 0.75602454 | 1 |
Generate an avatar name thanks to the email. We securely crypt the email string with a salt in order to not publicly expose it. | def generate_avatar_name(email, ext):
hashed_email = hashlib.sha256(f'{email}{settings.SECRET_KEY}'.encode('utf-8')).hexdigest()
return hashed_email[:10] + ext | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_gravatar_for_email(email: str) -> str:\n\n return (\n \"https://www.gravatar.com/avatar/\"\n f\"{hashlib.md5(email.encode('utf-8').lower()).hexdigest()}.jpg?s=80&d=wavatar\"\n )",
"def nice_username(email):\n clean_email = re.sub(r'\\W', '', email.replace('@', '_')).lower()\n ha... | [
"0.73999673",
"0.7097084",
"0.6820465",
"0.6732867",
"0.672743",
"0.66447204",
"0.65883774",
"0.6583871",
"0.65574443",
"0.65574443",
"0.6549196",
"0.65378356",
"0.639468",
"0.6390905",
"0.63883585",
"0.637788",
"0.6374814",
"0.6370425",
"0.63400793",
"0.63260204",
"0.6305132... | 0.8441059 | 0 |
Return the time dimension as a list of pandas Periods. We use periods here because pandas doesn't support datetime objects as low as 00010101. | def times_to_periods(time_var):
m = re.search('\d{4}-\d{2}-\d{2}', time_var.units)
start_date = datetime.datetime.strptime(m.group(0), '%Y-%m-%d')
periods = None
if 'hours since' in time_var.units:
# Pandas likes the periods to be the same here, so make them both
# daily.
perio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_periods():\n return [\n relativedelta(),\n relativedelta(days=6),\n relativedelta(months=1),\n relativedelta(months=3),\n relativedelta(years=1),\n relativedelta(years=5)\n ]",
"def experiment_periods():\n # Temperature readings start March 22 2004, ... | [
"0.67609286",
"0.63582677",
"0.62649435",
"0.6155508",
"0.6074081",
"0.58952624",
"0.578981",
"0.57746047",
"0.5768422",
"0.5726475",
"0.5664651",
"0.56344503",
"0.5581242",
"0.55617535",
"0.5546203",
"0.55174637",
"0.55173665",
"0.5478255",
"0.5437849",
"0.5420171",
"0.54163... | 0.6550311 | 1 |
Gets the Jeeves variable environment associated with the fields. | def get_env(obj, fields, env):
if hasattr(obj, "jeeves_vars"):
jeeves_vars = JeevesModelUtils.unserialize_vars(obj.jeeves_vars)
else:
jeeves_vars = {}
for var_name, value in jeeves_vars.iteritems():
# TODO: We only need to ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env(self) -> Optional[Sequence['_core.v1.outputs.EnvVarPatch']]:\n return pulumi.get(self, \"env\")",
"def env(self) -> Optional[pulumi.Input[Sequence[pulumi.Input['EnvVarArgs']]]]:\n return pulumi.get(self, \"env\")",
"def env(self):\n return spack.schema.environment.parse(self.conf.g... | [
"0.69181806",
"0.68876934",
"0.6845298",
"0.6815192",
"0.6769637",
"0.6733922",
"0.67176634",
"0.67149407",
"0.6706889",
"0.6697576",
"0.6697576",
"0.6697576",
"0.6697576",
"0.66975623",
"0.6676838",
"0.66730505",
"0.66585475",
"0.6540979",
"0.647285",
"0.64224195",
"0.636300... | 0.7325562 | 0 |
The decorator for associating a label with a field. | def label_for(*field_names):
def decorator(field):
"""Definition of the decorator itself.
"""
field._jeeves_label_for = field_names
return field
return decorator | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decorator(field):\n field._jeeves_label_for = field_names\n return field",
"def label_tag(field, **attrs):\n return field.label_tag(attrs=attrs)",
"def addLabel(*args):",
"def render_field(field, bulk_nullable=False, label=None):\n return {\n 'field': field,\n 'label': l... | [
"0.7269786",
"0.66567016",
"0.62161195",
"0.60929924",
"0.5974023",
"0.59708226",
"0.59422326",
"0.59422326",
"0.59422326",
"0.58018804",
"0.58018804",
"0.5789356",
"0.5755176",
"0.57127935",
"0.5710527",
"0.57077277",
"0.5688701",
"0.56688595",
"0.5643982",
"0.5643982",
"0.5... | 0.7656045 | 0 |
Hack __eq__ that checks equality if we have FExprs and checks object ID equality otherwise. | def evil_hack(self, other):
if isinstance(other, FExpr):
return other == self
return isinstance(other, self.__class__) and self.id == other.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def __eq__(self,*args):\r\n pass",
"def... | [
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7341255",
"0.7188106",
"... | 0.7629236 | 0 |
Creates compound key from x and y coordinates | def __compound_key(key):
x_int = int(key[0])
y_int = int(key[1])
zeros = len(str(y_int))
key = x_int * (10 ** zeros) + y_int
return key | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_shared_key(self, scalar: bytes, point: bytes) -> bytes:",
"def create_key ():",
"def buildsectorkey(x,y):\n return (int(x/5.0) * 1000) + int(y/5.0)",
"def key(self, x):\r\n return tuple(x)",
"def placementKey( geo):\n def diagcmp( xyA, xyB):\n \"\"\"\n Compare two positi... | [
"0.6720195",
"0.6465461",
"0.6461856",
"0.63997746",
"0.63790846",
"0.6287957",
"0.6111425",
"0.60200435",
"0.5975687",
"0.5969978",
"0.5882472",
"0.57838935",
"0.5775664",
"0.57685125",
"0.5761042",
"0.5751735",
"0.5745129",
"0.573421",
"0.5730822",
"0.5720599",
"0.5714592",... | 0.75826716 | 0 |
create a table from the create_table_sql statement | def create_table(self, create_table_sql):
connection = self.__create_connection()
try:
c = connection.cursor()
c.execute(create_table_sql)
except Error as e:
print(e) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_table(create_table_sql):\n conn = DbUtil.connection\n try:\n c = conn.cursor()\n c.execute(create_table_sql)\n except Error as e:\n print(e)",
"def create_table(self, conn, create_table_sql):\n try:\n c = conn.cursor()\n ... | [
"0.8759513",
"0.82744473",
"0.82354605",
"0.82232726",
"0.8189872",
"0.79669744",
"0.7963673",
"0.7913139",
"0.7912647",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",
"0.7890366",... | 0.86485636 | 1 |
Create a new waypoint in the waypoints table | def create_waypoint(self, waypoint):
connection = self.__create_connection()
try:
waypoint_list = list(waypoint)
key = self.__compound_key(waypoint)
waypoint_list.insert(0, key)
keyed_waypoint = tuple(waypoint_list)
sql = ''' INSERT INTO wayp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_waypoint(self, waypoint):\n self.drone.add_waypoint(waypoint)",
"def test_create(self):\n self.assertTrue(WayPoint.objects.exists())",
"def create_checkpoint(self, checkpoint):\n connection = self.__create_connection()\n sql = ''' INSERT INTO checkpoints(waypoint_x, waypoint... | [
"0.71296006",
"0.6022779",
"0.598041",
"0.5930506",
"0.5815703",
"0.5801523",
"0.5801523",
"0.57732916",
"0.57205147",
"0.5672037",
"0.5647759",
"0.553559",
"0.55011636",
"0.5473091",
"0.5431038",
"0.54085684",
"0.53466284",
"0.52942044",
"0.5293238",
"0.5281328",
"0.5280719"... | 0.8311361 | 0 |
Create a new checkpoint in the checkpoints table | def create_checkpoint(self, checkpoint):
connection = self.__create_connection()
sql = ''' INSERT INTO checkpoints(waypoint_x, waypoint_y, safe_options)
VALUES(?,?,?) '''
try:
cur = connection.cursor()
cur.execute(sql, checkpoint)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_checkpoint(self):\n checkpoint_id = uuid.uuid4()\n self.checkpoints.append(checkpoint_id)\n self.journal_data[checkpoint_id] = {}\n return checkpoint_id",
"def create_checkpoint(self, name, path=''):\n\n\t\tnb_path = self._get_os_path(name, path)\n\t\tself.log.debug('creati... | [
"0.73608464",
"0.6789329",
"0.6478464",
"0.63167423",
"0.62396365",
"0.60853195",
"0.59209615",
"0.5885209",
"0.58608073",
"0.58315974",
"0.5827007",
"0.5812425",
"0.5756481",
"0.5748305",
"0.57442254",
"0.5742551",
"0.57420397",
"0.5736219",
"0.56815714",
"0.5677968",
"0.563... | 0.8073979 | 0 |
Create a new traversed point in the traversed table | def create_traversed(self, traversed):
connection = self.__create_connection()
sql = ''' INSERT INTO traversed(traversed_x, traversed_y)
VALUES(?,?) '''
x = traversed[0]
y = traversed[1]
db_point = (x, y)
try:
cur = connection.cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, new_pt):\n self.x = float(new_pt[0])\n self.y = float(new_pt[1])\n self.next = None\n self.prev = None\n self.distance_to_next = 0\n self.angle = None",
"def FindClosestInsertedPoint(self, ):\n ...",
"def translate(self, tr):\n self.poi... | [
"0.58246714",
"0.57672495",
"0.5573922",
"0.55345064",
"0.55288726",
"0.5473619",
"0.54607856",
"0.54018605",
"0.5400066",
"0.5371111",
"0.53601223",
"0.5342438",
"0.53276473",
"0.5288304",
"0.525824",
"0.5252915",
"0.5242898",
"0.52268004",
"0.52259123",
"0.5224936",
"0.5211... | 0.65885204 | 0 |
Query points by key and table | def select_point_by_key(self, key, table, return_row=None):
if table == 'checkpoints':
column = 'checkpoint_id'
elif table == 'traversed':
column = 'traversed_id'
else:
table = 'waypoints'
key = self.__compound_key(key)
column = 'waypoi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(self, points):\n return self.locate_points(points)",
"def _query(self, p, k):\n raise NotImplementedError(\"This method must be implemented by the subclass\")",
"def key_by_point( self,point ):\n lons,lats,keys = self.lons_lats_keys\n for i, key in enumerate(keys):\n ... | [
"0.5889039",
"0.5883731",
"0.5832497",
"0.56991744",
"0.5664913",
"0.5645209",
"0.56317484",
"0.5630859",
"0.5604878",
"0.55439955",
"0.5508025",
"0.5472543",
"0.54706925",
"0.54380006",
"0.54042155",
"0.5399091",
"0.5372341",
"0.5366144",
"0.5353823",
"0.5333691",
"0.5291874... | 0.6853148 | 0 |
Delete all rows in the table defined by the second argument | def delete_all_rows(self, table):
sql = f"DELETE FROM {table}"
connection = self.__create_connection()
cur = connection.cursor()
cur.execute(sql)
cur.close()
connection.commit() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeall(table):\n doall(\"DELETE FROM {table}\".format(table=table))",
"def delete(self, table, **kwargs):\n cols, values = self.get_cols_and_values(table, kwargs)\n where_clause = self.get_where_clause_pattern(cols)\n sql = \"DELETE FROM %s %s;\" % (table, where_clause)\n se... | [
"0.77163625",
"0.76939785",
"0.737599",
"0.72692215",
"0.72637427",
"0.7180149",
"0.7061651",
"0.7027843",
"0.70110524",
"0.69264096",
"0.6924888",
"0.6893002",
"0.6851628",
"0.6834079",
"0.67637074",
"0.6733534",
"0.6713137",
"0.6683006",
"0.6672669",
"0.66359156",
"0.661455... | 0.81261355 | 0 |
Bind get and set state for the classObject | def bind(classObject, outFunction, inFunction):
classObject.__getstate__ = outFunction
classObject.__setstate__ = inFunction | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_state( self ):",
"def __setstate__(self,values):\n self.initDefault()\n setter = object.__setattr__\n for value,attr in zip(values,self.persistent):\n setter(self,attr,value)\n if self.dirty_sizeCrc == None:\n self.dirty_sizeCrc = {} #--Use empty dict ins... | [
"0.6168593",
"0.61640024",
"0.6132138",
"0.6032844",
"0.6031065",
"0.5975732",
"0.5932563",
"0.5910368",
"0.58908594",
"0.5875813",
"0.5875813",
"0.574821",
"0.57443416",
"0.5741208",
"0.5741208",
"0.5741208",
"0.5741208",
"0.5741208",
"0.5741208",
"0.5741208",
"0.5741208",
... | 0.6962742 | 0 |
Example of usage. Search user by name. search_user('name') Input a orderby filter. | def search_user(user, conditions=[],fields=[], filters={}):
return db((db.auth_user.first_name.like(user+'%')),*conditions).select(*fields,**filters) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(user, param):\r\n if len(param) <= 2:\r\n return bad_request(error_messages['too_short'])\r\n return search_user(param.lower(), user)",
"def __searchUser(self, args = []):\n\n try:\n if len(args) == 0:\n self.__cm.send(p.T_QUERY, '')\n else:\n ... | [
"0.72149456",
"0.70173097",
"0.68860996",
"0.67118216",
"0.6707727",
"0.66784",
"0.66506845",
"0.66497344",
"0.6636527",
"0.6440549",
"0.6318612",
"0.63150394",
"0.6296097",
"0.627032",
"0.6262157",
"0.62532055",
"0.62382454",
"0.62122864",
"0.6206182",
"0.618279",
"0.6161719... | 0.72818494 | 0 |
A list of ``Head`` objects representing the branch heads in this repo | def heads(self) -> "IterableList[Head]":
return Head.list_items(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def HeadList(self):\n return [(rname, repo.currenthead) for rname, repo in self.repos.items()\n ]",
"def list_branches(self) -> List[str]:\n self.__verify_repo_initialized()\n branches = heads.get_branch_names(self._env.branchenv)\n return branches",
"def branches(sel... | [
"0.7669622",
"0.7283023",
"0.6956049",
"0.6777083",
"0.6743007",
"0.65778285",
"0.65757793",
"0.6558573",
"0.65321577",
"0.6507141",
"0.6422385",
"0.6398561",
"0.63309616",
"0.6270313",
"0.6236289",
"0.6222004",
"0.6214245",
"0.6209972",
"0.6113209",
"0.61016154",
"0.60954344... | 0.74838305 | 1 |
A list of Reference objects representing tags, heads and remote references. | def references(self) -> "IterableList[Reference]":
return Reference.list_items(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def References(self, default=[{}]):\n tmp = self.data.get('metadata', {}).get('references', default)\n return [HEP.ReferenceObject(i) for i in tmp]",
"def list_refs(self):\n pass",
"def references(self):\n return self.header('References', '').split()",
"def references(self... | [
"0.76388407",
"0.7497304",
"0.74670535",
"0.7447669",
"0.74251896",
"0.73717904",
"0.7346691",
"0.7213302",
"0.7202282",
"0.71578926",
"0.7128635",
"0.7120887",
"0.709356",
"0.702713",
"0.68480635",
"0.66500163",
"0.66306657",
"0.652262",
"0.6441418",
"0.6441418",
"0.64324945... | 0.81828594 | 0 |
A list of Remote objects allowing to access and manipulate remotes | def remotes(self) -> "IterableList[Remote]":
return Remote.list_items(self) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remotes():",
"def list():\n rino.remote.list()",
"def list_all(self) -> List[RemoteInfo]:\n self.__verify_repo_initialized()\n res = []\n names = heads.get_remote_names(self._env.branchenv)\n for name in names:\n address = heads.get_remote_address(self._env.branche... | [
"0.77948105",
"0.7373213",
"0.66775936",
"0.6559818",
"0.6369482",
"0.6239379",
"0.6211052",
"0.61885506",
"0.6181893",
"0.6156011",
"0.6145892",
"0.6142728",
"0.6067896",
"0.595653",
"0.5873541",
"0.58715945",
"0.5788966",
"0.5760611",
"0.5727742",
"0.5713417",
"0.5677134",
... | 0.7765647 | 1 |
Create a new submodule | def create_submodule(self, *args: Any, **kwargs: Any) -> Submodule:
return Submodule.add(self, *args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_module(reset_sys_argv, move_home_pypackage):\n\n TestModule.make_new()\n mod_path = TestModule.full_path()\n os.mkdir(mod_path)\n os.chdir(mod_path)\n return mod_path",
"def _create_module(self, rootdir):\n name = 'module_' + rootdir.get_name()\n moduleobj = Module(name, root... | [
"0.68351126",
"0.6803382",
"0.67171615",
"0.66205806",
"0.6598088",
"0.65517914",
"0.65517914",
"0.65492576",
"0.6532966",
"0.6435915",
"0.6409295",
"0.62397474",
"0.60960925",
"0.6081008",
"0.603641",
"0.60336757",
"0.60078114",
"0.6005087",
"0.5977489",
"0.59753126",
"0.597... | 0.7785115 | 0 |
An iterator yielding Submodule instances, see Traversable interface for a description of args and kwargs | def iter_submodules(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]:
return RootModule(self).traverse(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __iter__(self):\n for child in self.children:\n yield child",
"def __iter__(self):\r\n for addon in self.addons.itervalues():\r\n yield addon",
"def __iter__(self):\n\n for i in self._children:\n yield i",
"def __modules_recurse(self, mod=None):\n ... | [
"0.70599717",
"0.70367163",
"0.70107394",
"0.69925714",
"0.6988354",
"0.68957764",
"0.68280786",
"0.6697993",
"0.6683282",
"0.66573066",
"0.66323555",
"0.65368533",
"0.65161717",
"0.65046936",
"0.65046936",
"0.65046936",
"0.65046936",
"0.64145535",
"0.6368157",
"0.6365535",
"... | 0.8552979 | 0 |
Update the submodules, keeping the repository consistent as it will take the previous state into consideration. For more information, please see the documentation of RootModule.update | def submodule_update(self, *args: Any, **kwargs: Any) -> Iterator[Submodule]:
return RootModule(self).update(*args, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __gitSubmodulesUpdate(self):\n self.vcs.gitSubmoduleUpdate(self.project.getProjectPath())",
"def update_submodules(options, project_directory=None):\n pass",
"def __gitSubmodulesUpdateInit(self):\n self.vcs.gitSubmoduleUpdate(self.project.getProjectPath(),\n ... | [
"0.8273983",
"0.7530298",
"0.741268",
"0.7374539",
"0.7051919",
"0.6860598",
"0.67321277",
"0.67252666",
"0.67068815",
"0.6294269",
"0.6186224",
"0.6008203",
"0.6001612",
"0.59648216",
"0.5868813",
"0.58159584",
"0.58059067",
"0.5801212",
"0.5719237",
"0.57147783",
"0.5677075... | 0.7637963 | 1 |
Create a new head within the repository. For more documentation, please see the Head.create method. | def create_head(
self,
path: PathLike,
commit: Union["SymbolicReference", "str"] = "HEAD",
force: bool = False,
logmsg: Optional[str] = None,
) -> "Head":
return Head.create(self, path, commit, logmsg, force) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_head(self):\n self.scenes[self.current_scene].add_object(Head())\n self.redraw()",
"def test_heads_create_new_branch_name(repository: Repository) -> None:\n branch = repository.heads.create(\"branch\", repository.head.commit)\n assert \"branch\" == branch.name",
"def head(self, *arg... | [
"0.63383657",
"0.6072974",
"0.60409087",
"0.5962928",
"0.584704",
"0.57201564",
"0.56907433",
"0.5676699",
"0.5572015",
"0.54943293",
"0.548941",
"0.54613024",
"0.5434265",
"0.5379896",
"0.53622866",
"0.5352816",
"0.53478324",
"0.5345006",
"0.5291252",
"0.52907807",
"0.527280... | 0.7366868 | 0 |
Delete the given heads | def delete_head(self, *heads: "Union[str, Head]", **kwargs: Any) -> None:
return Head.delete(self, *heads, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_heads_delitem_pass(repository: Repository) -> None:\n head, heads = repository.head, repository.heads\n heads[\"branch\"] = head.commit\n del heads[\"branch\"]\n assert \"branch\" not in heads",
"async def delete(self, *keys, **kwargs):\n\n def gen_keys(keys):\n all_keys = ... | [
"0.662057",
"0.6283624",
"0.62365943",
"0.6154708",
"0.61533",
"0.60387325",
"0.59136975",
"0.5881483",
"0.5836089",
"0.5749807",
"0.5712213",
"0.5685886",
"0.567495",
"0.5669514",
"0.5664937",
"0.5654739",
"0.5639694",
"0.56207883",
"0.5617286",
"0.55653095",
"0.5544909",
... | 0.81724703 | 0 |
Create a new tag reference. For more documentation, please see the TagReference.create method. | def create_tag(
self,
path: PathLike,
ref: Union[str, "SymbolicReference"] = "HEAD",
message: Optional[str] = None,
force: bool = False,
**kwargs: Any,
) -> TagReference:
return TagReference.create(self, path, ref, message, force, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_ref(self, commit_id=None):\n pass",
"def create(self, name, tag):\n\n\t\turl_json = urllib.urlencode({\"name\": name, \"tag\": tag})\n\t\treturn self._create(\"/tag?json_hash=%s\" % url_json, \"tag\")",
"def create(self, params={}, **options):\n return self.client.post(\"/tags\", param... | [
"0.59600246",
"0.5921391",
"0.5677583",
"0.5571974",
"0.5454277",
"0.5450359",
"0.5311379",
"0.5293005",
"0.5243687",
"0.52253234",
"0.5220693",
"0.5210611",
"0.51849747",
"0.5182306",
"0.51744187",
"0.5162945",
"0.51305825",
"0.50870734",
"0.5077504",
"0.50474465",
"0.503864... | 0.76285815 | 0 |
Delete the given tag references | def delete_tag(self, *tags: TagReference) -> None:
return TagReference.delete(self, *tags) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_tag(tag):\n tag.destroy()",
"def delete_tags(configurationIds=None, tags=None):\n pass",
"def delete(self):\n request = self.tags_service.delete(path=self._path)\n request.execute()",
"def delete_tags(self, session):\n self._tag(session.delete, delete=True, session=sessi... | [
"0.74908113",
"0.69803345",
"0.6959128",
"0.6875728",
"0.6813849",
"0.6787498",
"0.6787498",
"0.67267305",
"0.66673917",
"0.6630343",
"0.6623658",
"0.6561728",
"0.6551617",
"0.65438586",
"0.64053017",
"0.6404828",
"0.6366689",
"0.63114005",
"0.624464",
"0.62365365",
"0.623625... | 0.73343515 | 1 |
Create a new remote. For more information, please see the documentation of the Remote.create methods | def create_remote(self, name: str, url: str, **kwargs: Any) -> Remote:
return Remote.create(self, name, url, **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, name, url, fetch=None):\n\n cremote = ffi.new('git_remote **')\n\n if fetch:\n err = C.git_remote_create_with_fetchspec(cremote, self._repo._repo, to_bytes(name), to_bytes(url), to_bytes(fetch))\n else:\n err = C.git_remote_create(cremote, self._repo._rep... | [
"0.67014074",
"0.62331426",
"0.6180231",
"0.6137926",
"0.608516",
"0.60208064",
"0.59646577",
"0.5958771",
"0.5917804",
"0.58422226",
"0.58086926",
"0.5789144",
"0.57574284",
"0.5696584",
"0.5675059",
"0.56502056",
"0.56050366",
"0.56050366",
"0.5579403",
"0.55601066",
"0.555... | 0.79686105 | 0 |
Delete the given remote. | def delete_remote(self, remote: "Remote") -> str:
return Remote.remove(self, remote) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self, remote):\n self.target.ttbd_iface_call(\"store\", \"file\", method = \"DELETE\",\n file_path = remote)",
"def delete(self, remote_path, recursive=False, storage_id=None):\n client, remote_path = self._get_storage(remote_path, storage_id=storage_id... | [
"0.7682362",
"0.6875603",
"0.68518686",
"0.67977387",
"0.6762961",
"0.669659",
"0.64433646",
"0.63840145",
"0.6335172",
"0.6303484",
"0.6267692",
"0.6251161",
"0.6187777",
"0.61610276",
"0.6155516",
"0.6142472",
"0.5973078",
"0.5961846",
"0.5920732",
"0.59107065",
"0.5896682"... | 0.8166319 | 0 |
The Commit object for the specified revision | def commit(self, rev: Union[str, Commit_ish, None] = None) -> Commit:
if rev is None:
return self.head.commit
return self.rev_parse(str(rev) + "^0") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_commit(self, revision: Optional[str] = None) -> Commit:\n if revision is None:\n self._status.check_authority_for_commit()\n revision = self._status.commit_id\n\n if not revision:\n raise TypeError(\"The given revision is illegal\")\n\n try:\n ... | [
"0.8085897",
"0.70397526",
"0.69165814",
"0.6903157",
"0.68965274",
"0.67812264",
"0.6728202",
"0.6728202",
"0.6425962",
"0.6402016",
"0.6315707",
"0.6211917",
"0.61918885",
"0.617947",
"0.61127025",
"0.60912085",
"0.60884523",
"0.6075905",
"0.6062242",
"0.60242486",
"0.60148... | 0.7424044 | 1 |
The Tree object for the given treeish revision | def tree(self, rev: Union[Tree_ish, str, None] = None) -> "Tree":
if rev is None:
return self.head.commit.tree
return self.rev_parse(str(rev) + "^{tree}") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree(self):\r\n return self._tree",
"def get_tree(self):\n return self.tree or None",
"def get_revision(self, revision_id: int):\n return self.phab.differential.query(ids=[revision_id])[0]",
"def get_revision(path):\n return get_output(['hg', 'parent', '--template', '{node|short}'], c... | [
"0.62793964",
"0.6062064",
"0.60547894",
"0.6046036",
"0.5975122",
"0.5974379",
"0.5974379",
"0.5974379",
"0.5974379",
"0.5954079",
"0.59513175",
"0.59513175",
"0.5913077",
"0.5883543",
"0.585654",
"0.5836427",
"0.5828777",
"0.5825333",
"0.5804237",
"0.5804237",
"0.5802752",
... | 0.74559385 | 0 |
The list of alternates for this repo from which objects can be retrieved | def _get_alternates(self) -> List[str]:
if self.git_dir:
alternates_path = osp.join(self.git_dir, "objects", "info", "alternates")
if osp.exists(alternates_path):
with open(alternates_path, "rb") as f:
alts = f.read().decode(defenc)
return alts.strip(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored(self):\n return [n for n in self if n.anchored]",
"def get_list(self):\n return self.__repository.get_all()",
"def objects_rst(self):\n return [_.as_rst for _ in self.objects]",
"def all(self):\n return (self.__objects)",
"def get(self) -> Iterable[instarepo.github.... | [
"0.6158056",
"0.5991527",
"0.5942561",
"0.5918882",
"0.58671314",
"0.586206",
"0.58560485",
"0.5837963",
"0.58292234",
"0.58124197",
"0.57813555",
"0.57793325",
"0.57546026",
"0.5742623",
"0.5726128",
"0.57250094",
"0.57250094",
"0.57250094",
"0.57250094",
"0.57250094",
"0.57... | 0.7048576 | 0 |
Iterator for blame information for the given file at the given revision. Unlike .blame(), this does not return the actual file's contents, only a stream of BlameEntry tuples. | def blame_incremental(self, rev: str | HEAD, file: str, **kwargs: Any) -> Iterator["BlameEntry"]:
data: bytes = self.git.blame(rev, "--", file, p=True, incremental=True, stdout_as_string=False, **kwargs)
commits: Dict[bytes, Commit] = {}
stream = (line for line in data.split(b"\n") if line)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blame(\n self,\n rev: Union[str, HEAD],\n file: str,\n incremental: bool = False,\n rev_opts: Optional[List[str]] = None,\n **kwargs: Any,\n ) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:\n if incremental:\n retur... | [
"0.687814",
"0.5826051",
"0.5454278",
"0.536348",
"0.53327614",
"0.5308022",
"0.5291127",
"0.5245023",
"0.5227329",
"0.5143375",
"0.5124427",
"0.5117952",
"0.50996363",
"0.5096424",
"0.50628304",
"0.50562906",
"0.50471145",
"0.50234556",
"0.4950158",
"0.49470937",
"0.493742",... | 0.67107004 | 1 |
The blame information for the given file at the given revision. | def blame(
self,
rev: Union[str, HEAD],
file: str,
incremental: bool = False,
rev_opts: Optional[List[str]] = None,
**kwargs: Any,
) -> List[List[Commit | List[str | bytes] | None]] | Iterator[BlameEntry] | None:
if incremental:
return self.blame_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log_revision(self, revision):\n to_file = self.to_file\n\n date_str = format_date(revision.rev.timestamp,\n revision.rev.timezone or 0,\n self.show_timezone,\n date_fmt='%Y-%m-%d',\n ... | [
"0.5913227",
"0.5896219",
"0.57163703",
"0.5458407",
"0.5452725",
"0.53854674",
"0.5355485",
"0.5340035",
"0.53253865",
"0.53196186",
"0.5255778",
"0.51921225",
"0.51908374",
"0.5182135",
"0.5161458",
"0.5132206",
"0.51175064",
"0.5117142",
"0.5064486",
"0.50542784",
"0.50473... | 0.6293388 | 0 |
Create a role from this color | async def create_role(self, guild: discord.Guild, updatedb: bool = True) -> discord.Role:
role = await guild.create_role(name=self.name, color=self.to_discord_color())
if updatedb:
new_color = Color(self.name, hexcode=self.hexcode, role=role.id)
db.update_color(guild.id, old=sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(self, **kwargs):\n return Role(**kwargs)",
"async def _create_new_role(self, context, name: str, target=GROUP_CATEGORY_NAME, channel=False, color: discord.Color = None):\n # todo - sanitize input, preventing \"-\" specifically\n target_role = get(context.guild.roles, name=target)\... | [
"0.73236614",
"0.7301094",
"0.6828104",
"0.67364144",
"0.66851634",
"0.6617505",
"0.6605897",
"0.6464028",
"0.64356637",
"0.6399802",
"0.6391038",
"0.63460284",
"0.63116336",
"0.6277806",
"0.62576514",
"0.6206674",
"0.614834",
"0.61444193",
"0.61128056",
"0.6056904",
"0.60527... | 0.742958 | 0 |
Calculate the center of mass at a given timestep. | def center_of_mass(self, time):
if self.start_time <= time <= self.end_time:
diff = time - self.start_time
valid = np.flatnonzero(self.masks[diff] != 0)
if valid.size > 0:
com_x = 1.0 / self.timesteps[diff].ravel()[valid].sum() * np.sum(self.timesteps[diff].ra... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_of_mass_ij(self, time):\n if self.start_time <= time <= self.end_time:\n diff = time - self.start_time\n valid = np.flatnonzero(self.masks[diff] > 0)\n if valid.size > 0:\n com_i = 1.0 / self.timesteps[diff].ravel()[valid].sum() * np.sum(self.timest... | [
"0.6844818",
"0.68440056",
"0.6691238",
"0.6615028",
"0.6614479",
"0.65928054",
"0.6530316",
"0.6500311",
"0.64259684",
"0.6407685",
"0.639365",
"0.63404274",
"0.6300212",
"0.61495924",
"0.60711735",
"0.60408115",
"0.5994796",
"0.5985383",
"0.5948109",
"0.5918347",
"0.5911638... | 0.7396159 | 0 |
Calculate the center of mass in terms of row and column coordinates at a given timestep. | def center_of_mass_ij(self, time):
if self.start_time <= time <= self.end_time:
diff = time - self.start_time
valid = np.flatnonzero(self.masks[diff] > 0)
if valid.size > 0:
com_i = 1.0 / self.timesteps[diff].ravel()[valid].sum() * np.sum(self.timesteps[diff].... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center_of_mass(self, time):\n if self.start_time <= time <= self.end_time:\n diff = time - self.start_time\n valid = np.flatnonzero(self.masks[diff] != 0)\n if valid.size > 0:\n com_x = 1.0 / self.timesteps[diff].ravel()[valid].sum() * np.sum(self.timestep... | [
"0.71941334",
"0.6786518",
"0.67721343",
"0.6684895",
"0.6676267",
"0.667017",
"0.65894467",
"0.6522056",
"0.6484865",
"0.6448102",
"0.6434498",
"0.6407855",
"0.6395826",
"0.63766694",
"0.6311463",
"0.6293397",
"0.6199473",
"0.6177228",
"0.61628026",
"0.6141784",
"0.61305386"... | 0.68937564 | 1 |
Extract patch of uniform radius from existing STObject. This is intended for extracting patches from STObjects that are built around the bounding box of the original object. Areas outside the object are padded with zeros. | def extract_patch(self, patch_radius, full_x, full_y, full_i, full_j):
com_ijs = [self.center_of_mass_ij(time) for time in self.times]
patch_grid = []
patch_mask = []
patch_x = []
patch_y = []
patch_i = []
patch_j = []
for t, time in enumerate(self.times):... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def circle_mask(radius,size=None,offset=None,inner=0,subsample_limit=4,center=False):\n def subsample(x,y,sz,r,lim):\n d = np.hypot(x, y)\n if lim==0: #hit recursion limit\n #return area if x,y is inside circle\n return sz**2 if d < r else 0.0\n elif d + 0.70711*sz < r... | [
"0.58737177",
"0.5712891",
"0.5665485",
"0.5573411",
"0.53280324",
"0.52987015",
"0.5288066",
"0.52771604",
"0.52546126",
"0.5193035",
"0.51887894",
"0.51804686",
"0.5152492",
"0.51085407",
"0.50978655",
"0.5092692",
"0.50868815",
"0.5078248",
"0.5078181",
"0.50755835",
"0.50... | 0.6380766 | 0 |
The shortest distance between two objects at specified times. | def closest_distance(self, time, other_object, other_time):
ti = np.where(self.times == time)[0][0]
oti = np.where(other_object.times == other_time)[0][0]
xs = self.x[ti].ravel()[self.masks[ti].ravel() == 1]
xs = xs.reshape(xs.size, 1)
ys = self.y[ti].ravel()[self.masks[ti].ravel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimum_distance(object_1, object_2):\n\n # package import\n import numpy as np\n\n # main algorithm\n minimum_distance = 100000\n\n for coord_1 in object_1:\n for coord_2 in object_2:\n distance_btwn_coords = np.linalg.norm(coord_1 - coord_2)\n if distance_btwn_coor... | [
"0.6308728",
"0.6308175",
"0.6306714",
"0.6151658",
"0.59401333",
"0.5889106",
"0.58839244",
"0.5882022",
"0.58807635",
"0.5862003",
"0.5818082",
"0.57882285",
"0.57865316",
"0.5778319",
"0.5778047",
"0.5778047",
"0.5778047",
"0.5778047",
"0.5778047",
"0.5773194",
"0.5765998"... | 0.70089066 | 0 |
Gets the corner array indices of the STObject at a given time that corresponds to the upper left corner of the bounding box for the STObject. | def get_corner(self, time):
if self.start_time <= time <= self.end_time:
diff = time - self.start_time
return self.i[diff][0, 0], self.j[diff][0, 0]
else:
return -1, -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_clip_loc_in_array(self):\r\n\r\n # coordinates of upperleft and lowerright points of binding box\r\n box_ulx, box_uly, box_lrx, box_lry = self.clip_box[0][0], self.clip_box[0][1], \\\r\n self.clip_box[1][0], self.clip_box[1][1]\r\n\r\n # Get... | [
"0.6598285",
"0.6139835",
"0.6112729",
"0.576549",
"0.5758299",
"0.5703311",
"0.5681286",
"0.56660783",
"0.5658853",
"0.56519884",
"0.5638632",
"0.5610338",
"0.561029",
"0.559737",
"0.5572375",
"0.5572375",
"0.5567781",
"0.5557293",
"0.5556761",
"0.5544489",
"0.5520843",
"0... | 0.69373137 | 0 |
Gets the size of the object at a given time. | def size(self, time):
if self.start_time <= time <= self.end_time:
return self.masks[time - self.start_time].sum()
else:
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def N(self):\n return len(self.time)",
"def getSize(self) -> long:\n ...",
"def time_length(self):\n return self._time_length",
"def get_size(self):\n return self.__size",
"def get_size (self, path=None, ttype=None) :\n if path : return self._adaptor.get_size (path, t... | [
"0.64984864",
"0.6387305",
"0.6322752",
"0.6263697",
"0.6258462",
"0.6255351",
"0.6252175",
"0.6245129",
"0.6233702",
"0.62288994",
"0.6227355",
"0.6205685",
"0.61765087",
"0.61765087",
"0.61765087",
"0.6172496",
"0.6164189",
"0.6161504",
"0.6161504",
"0.6160959",
"0.6156999"... | 0.655424 | 0 |
Calculate the maximum intensity found at a timestep. | def max_intensity(self, time):
ti = np.where(time == self.times)[0][0]
return self.timesteps[ti].max() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_time(self):\n return self.time[np.argmax(self.flux)]",
"def find_max(subimage):\r\n\tmax_val_subimage = np.nanmax(subimage)\r\n\treturn max_val_subimage",
"def get_max_temp(self):\n self.max_temp = self.domain[1] * 2",
"def compute_vmax(particle, fieldset, time):\n if particle.active... | [
"0.6631323",
"0.6328347",
"0.60821176",
"0.60574615",
"0.60488397",
"0.6045541",
"0.60445887",
"0.598731",
"0.5968672",
"0.5935312",
"0.59227914",
"0.59169674",
"0.5916635",
"0.59161717",
"0.5910001",
"0.59040123",
"0.5877174",
"0.5861299",
"0.5841355",
"0.5838975",
"0.582510... | 0.8293343 | 0 |
Counts the number of points that overlap between this STObject and another STObject. Used for tracking. | def count_overlap(self, time, other_object, other_time):
ti = np.where(time == self.times)[0][0]
ma = np.where(self.masks[ti].ravel() == 1)
oti = np.where(other_time == other_object.times)[0]
obj_coords = np.zeros(self.masks[ti].sum(), dtype=[('x', int), ('y', int)])
other_obj_co... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overlap_measure(self, other_cube):\n return np.count_nonzero(np.logical_and(self.mask, other_cube.mask))",
"def getNumPoints(self, l1, l2):\n n1 = self.pointcounts[l1]\n n2 = self.pointcounts[l2]\n self.pointcounts[('Cl_%d' % self.labelcount, l1, l2)] = n1 + n2\n return (n1... | [
"0.63140106",
"0.62945986",
"0.6173448",
"0.61602545",
"0.58802414",
"0.5830572",
"0.5804341",
"0.5783624",
"0.5756955",
"0.5751775",
"0.5751775",
"0.5733898",
"0.57244635",
"0.57110035",
"0.57077324",
"0.5682836",
"0.5662518",
"0.5660011",
"0.5659256",
"0.56547207",
"0.56493... | 0.69642967 | 0 |
Calculate shape statistics using regionprops applied to the object mask. | def calc_shape_statistics(self, stat_names):
stats = {}
try:
all_props = [regionprops(m) for m in self.masks]
except TypeError:
raise TypeError("masks not the right type")
for stat in stat_names:
stats[stat] = np.mean([p[0][stat] for p in all_props])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_shape_metrics(shape):",
"def get_shape_info(self, obj):\r\n return obj.shape",
"def extract_object_properties(segmented_image_path, intensity_image_path, image_name, xy_scale, z_scale):\n\n print('Extracting object properties for {image_name}'.format(image_name=image_name))\n\n # import p... | [
"0.6216324",
"0.6161571",
"0.6146432",
"0.59620297",
"0.560959",
"0.55250263",
"0.55222064",
"0.5369874",
"0.5358723",
"0.530235",
"0.5295728",
"0.5277625",
"0.52083945",
"0.52040446",
"0.51777107",
"0.51777107",
"0.517326",
"0.51222855",
"0.51037216",
"0.51020885",
"0.50539"... | 0.70535785 | 0 |
Calculate shape statistics for a single time step | def calc_shape_step(self, stat_names, time):
ti = np.where(self.times == time)[0][0]
shape_stats = []
try:
props = regionprops(self.masks[ti], self.timesteps[ti])[0]
except:
for stat_name in stat_names:
shape_stats.append(np.nan)
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_shape_metrics(shape):",
"def shape(self):",
"def shape(self):",
"def compute_statistics(self):",
"def profile(n_shells, sld_solvent, sld, thickness,\n interface, shape, nu, n_steps):\n\n n_shells = int(n_shells + 0.5)\n n_steps = int(n_steps + 0.5)\n z = []\n rho = []\n z... | [
"0.66259956",
"0.5955176",
"0.5955176",
"0.577517",
"0.5712187",
"0.5709054",
"0.5698116",
"0.5691803",
"0.5639098",
"0.55508775",
"0.5538703",
"0.5535251",
"0.5515732",
"0.55082923",
"0.550244",
"0.5500896",
"0.5461036",
"0.54606634",
"0.5448752",
"0.5422498",
"0.54190004",
... | 0.7263127 | 0 |
Reads a geojson file containing an STObject and initializes a new STObject from the information in the file. | def read_geojson(filename):
json_file = open(filename)
data = json.load(json_file)
json_file.close()
times = data["properties"]["times"]
main_data = dict(timesteps=[], masks=[], x=[], y=[], i=[], j=[])
attribute_data = dict()
for feature in data["features"]:
for main_name in main_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_from_geojson(self, filename_or_url):",
"def read_geojson(cls, path_or_json_or_string_or_url):\n assert path_or_json_or_string_or_url\n data = None\n if isinstance(path_or_json_or_string_or_url, (dict, list)):\n data = path_or_json_or_string_or_url\n try:\n ... | [
"0.6565144",
"0.62611824",
"0.6244399",
"0.6140623",
"0.61241573",
"0.61241573",
"0.6090193",
"0.60680777",
"0.60359716",
"0.60111064",
"0.5999579",
"0.5994746",
"0.5970371",
"0.59552634",
"0.5928882",
"0.5925866",
"0.5925866",
"0.5925866",
"0.5917864",
"0.5884269",
"0.588285... | 0.7161496 | 0 |
Test module education.py by downloading education.csv and testing shape of extracted data has 50 rows and 6 columns | def test_education():
test_path = tempfile.mkdtemp()
x_train, metadata = education(test_path)
try:
assert x_train.shape == (50, 6)
except:
shutil.rmtree(test_path)
raise() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_read_in_file(self):\r\n filename = \"CrimeDataSmall.csv\"\r\n\r\n lst = cds.read_in_file(filename)\r\n\r\n self.assertIsInstance(lst, list, \"Returned datatype should be a list\")\r\n self.assertEqual(len(lst), 4, \"There should be 4 rows returned from CrimeDataSmall 1 header a... | [
"0.63723415",
"0.62270033",
"0.6200997",
"0.6197327",
"0.6120514",
"0.61067593",
"0.6058314",
"0.605779",
"0.6046841",
"0.6043048",
"0.60374284",
"0.60166985",
"0.59914315",
"0.5984721",
"0.5972968",
"0.5959958",
"0.594414",
"0.59350675",
"0.5925406",
"0.5905807",
"0.5902556"... | 0.6356588 | 1 |
Yield all valid configurations of relational transformers. | def __relational_transformer_encoder_settings(
self,
) -> Iterator[RelationalTransformerEncoderSettings]:
for use_mask, use_dense_relations, use_sparse_edges in product((False, True), repeat=3):
for rezero_mode in ("off", "scalar", "vector", "scalar-tied"):
for norm_mode ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __relational_transformer_decoder_settings(\n self,\n ) -> Iterator[RelationalTransformerDecoderSettings]:\n for (\n use_mask,\n use_dense_relations_enc,\n use_dense_relations_self,\n use_sparse_edges_enc,\n use_sparse_edges_self,\n ... | [
"0.6474837",
"0.53251475",
"0.5319521",
"0.5209259",
"0.5188677",
"0.5173214",
"0.51650053",
"0.5105509",
"0.5066457",
"0.50433284",
"0.50107235",
"0.50103253",
"0.49935812",
"0.49896842",
"0.49888027",
"0.49841383",
"0.48936567",
"0.48592305",
"0.4849316",
"0.4847811",
"0.48... | 0.6645643 | 0 |
Yield all valid configurations of relational transformers. | def __relational_transformer_decoder_settings(
self,
) -> Iterator[RelationalTransformerDecoderSettings]:
for (
use_mask,
use_dense_relations_enc,
use_dense_relations_self,
use_sparse_edges_enc,
use_sparse_edges_self,
) in product((... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __relational_transformer_encoder_settings(\n self,\n ) -> Iterator[RelationalTransformerEncoderSettings]:\n for use_mask, use_dense_relations, use_sparse_edges in product((False, True), repeat=3):\n for rezero_mode in (\"off\", \"scalar\", \"vector\", \"scalar-tied\"):\n ... | [
"0.66448367",
"0.5326287",
"0.5319896",
"0.52103376",
"0.5188164",
"0.5173452",
"0.5166215",
"0.51054615",
"0.50679874",
"0.50437236",
"0.50113964",
"0.5011107",
"0.499381",
"0.4989055",
"0.498828",
"0.49869108",
"0.48953924",
"0.48607004",
"0.48501715",
"0.48480287",
"0.4810... | 0.6474692 | 1 |
Initialize a HealthcheckTask that will monitor open channels for responsiveness. | def __init__(
self,
raiden,
send_ping_time,
max_unresponsive_time,
sleep_time=DEFAULT_HEALTHCHECK_POLL_TIMEOUT):
super(HealthcheckTask, self).__init__()
self.protocol = raiden.protocol
self.raiden = raiden
self.stop_event = As... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initialize(self, task_handle):\r\n # Saved name is used in self.close() to throw graceful error on\r\n # double closes.\r\n self._saved_name = self.name\r\n\r\n self._ai_channels = AIChannelCollection(task_handle)\r\n self._ao_channels = AOChannelCollection(task_handle)\r\n ... | [
"0.62494344",
"0.5961112",
"0.5958263",
"0.5938313",
"0.5878526",
"0.58011854",
"0.5743681",
"0.5699212",
"0.5692236",
"0.5674095",
"0.56663835",
"0.56368005",
"0.5581776",
"0.55618113",
"0.555209",
"0.5538532",
"0.5525536",
"0.5508811",
"0.54958546",
"0.54538614",
"0.5453523... | 0.66662455 | 0 |
Wait for a Secret message from our partner to update the local state, if the Secret message is not sent within time the channel will be closed. | def _wait_for_unlock_or_close(self, raiden, assetmanager, channel, mediated_transfer): # noqa
if not isinstance(mediated_transfer, MediatedTransfer):
raise ValueError('MediatedTransfer expected.')
block_to_close = mediated_transfer.lock.expiration - raiden.config['reveal_timeout']
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait(self, seconds):\n logging.info(\"sleeping\")\n self.new_message_event.wait(seconds)\n logging.info(\"waking\")",
"def wait(self, timeoout=None, state=\"C-completed\"):",
"def wait(self):\n return self.bot_client.send_command(_Command.Wait)",
"def call_and_wait(self, priva... | [
"0.59381497",
"0.57186913",
"0.57142264",
"0.56484854",
"0.5637439",
"0.56051433",
"0.55720794",
"0.55712587",
"0.5532899",
"0.55139875",
"0.5488483",
"0.5480868",
"0.545767",
"0.5422705",
"0.54170346",
"0.54163635",
"0.53835714",
"0.53561306",
"0.5349918",
"0.5311638",
"0.53... | 0.5940582 | 0 |
Utility to wait until the expiration block. For a chain ABC, if an attacker controls A and C a mediated transfer can be done through B and C will wait for/send a timeout, for that reason B must not unregister the hashlock from the transfermanager until the lock has expired, otherwise the revealed secret wouldnt be caug... | def _wait_expiration(self, raiden, transfer, sleep=DEFAULT_EVENTS_POLL_TIMEOUT):
# pylint: disable=no-self-use
expiration = transfer.lock.expiration + 1
while True:
current_block = raiden.get_block_number()
if current_block > expiration:
return
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wait_for_unlock_or_close(self, raiden, assetmanager, channel, mediated_transfer): # noqa\n\n if not isinstance(mediated_transfer, MediatedTransfer):\n raise ValueError('MediatedTransfer expected.')\n\n block_to_close = mediated_transfer.lock.expiration - raiden.config['reveal_timeout... | [
"0.69757426",
"0.67084336",
"0.6450271",
"0.6419715",
"0.6300111",
"0.62941855",
"0.6109355",
"0.60013986",
"0.59448105",
"0.5880379",
"0.5855095",
"0.58424264",
"0.58197796",
"0.5800568",
"0.5791604",
"0.5788613",
"0.5786998",
"0.5775948",
"0.5775757",
"0.57577634",
"0.57515... | 0.745295 | 0 |
Send the `mediated_transfer` and wait for either a message from `target` or the `next_hop`. | def send_and_iter_valid(self, raiden, path, mediated_transfer): # noqa pylint: disable=no-self-use
next_hop = path[1]
target = path[-1]
response_iterator = self._send_and_wait_time(
raiden,
mediated_transfer.recipient,
mediated_transfer,
raiden.c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_and_wait_valid_state( # noqa\n self,\n raiden,\n path,\n from_asset_transfer,\n to_asset,\n to_amount):\n # pylint: disable=too-many-arguments\n\n next_hop = path[1]\n taker_address = path[-1] # taker_address and next... | [
"0.57773656",
"0.57587355",
"0.5551432",
"0.55353814",
"0.5440931",
"0.5366063",
"0.5365974",
"0.5334669",
"0.52989167",
"0.5294817",
"0.52596116",
"0.5229827",
"0.52132344",
"0.51989824",
"0.5196242",
"0.516799",
"0.51414514",
"0.5096862",
"0.5096862",
"0.5089351",
"0.508485... | 0.6000456 | 0 |
Start the exchange by sending the first mediated transfer to the taker and wait for mediated transfer for the exchanged asset. This method will validate the messages received, discard the invalid ones, and wait until a valid state is reached. The valid state is reached when a mediated transfer for `to_asset` with `to_a... | def send_and_wait_valid_state( # noqa
self,
raiden,
path,
from_asset_transfer,
to_asset,
to_amount):
# pylint: disable=too-many-arguments
next_hop = path[1]
taker_address = path[-1] # taker_address and next_hop might be e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_transfer_from_to(self, transfer, from_state, to_state): # noqa pylint: disable=too-many-branches\n if transfer.asset != self.asset_address:\n raise ValueError('Asset address mismatch')\n\n if transfer.recipient != to_state.address:\n raise ValueError('Unknow recipi... | [
"0.5800603",
"0.52266335",
"0.51184654",
"0.504392",
"0.50016147",
"0.49726683",
"0.49235693",
"0.48161134",
"0.4802176",
"0.47530946",
"0.47449794",
"0.47436798",
"0.47381318",
"0.47036916",
"0.46851128",
"0.46547458",
"0.46305975",
"0.4610333",
"0.4598604",
"0.45845968",
"0... | 0.7472868 | 0 |
Reveal the `secret` to both participants. The secret must be revealed backwards to get the incentives right (first mediator would not forward the secret and get the transfer to itself). With exchanges there is an additional failure point, if a node is mediating both asset transfers it can intercept the transfer (as in ... | def reveal_secret(self, raiden, secret, last_node, exchange_node):
# pylint: disable=no-self-use
reveal_secret = RevealSecret(secret)
raiden.sign(reveal_secret)
# first reveal the secret to the last_node in the chain, proceed after
# ack
raiden.send_and_wait(last_node, ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link(self, secret=None, secondSecret=None):\r\n if hasattr(dposlib, \"core\"):\r\n if secret:\r\n keys = dposlib.core.crypto.getKeys(secret)\r\n self.senderPublicKey = keys[\"publicKey\"]\r\n self._privateKey = keys[\"privateKey\"]\r\n i... | [
"0.58369744",
"0.56620103",
"0.56620103",
"0.55961484",
"0.55783224",
"0.5472373",
"0.547191",
"0.54131114",
"0.5322428",
"0.5291196",
"0.5291196",
"0.5289748",
"0.5253815",
"0.52519923",
"0.52519923",
"0.5239631",
"0.52201116",
"0.52102727",
"0.5178132",
"0.5176432",
"0.5162... | 0.77447605 | 0 |
Helper function to evaluate a policy. | def policy_eval(env, policy, V, discount_factor):
policy_value = np.zeros(env.nS)
for state, action in enumerate(policy):
for probablity, next_state, reward, info in env.P[state][action]:
policy_value[state] += probablity * (reward + (discount_factor * V[next_state]))
return policy_valu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _evaluate_policy(self, state, legal_actions, step_rewards=None, action=None):\n raise NotImplementedError",
"def _policy_eval(self, policy: np.ndarray) -> np.ndarray:\n V = np.zeros(self.state_dim)\n diff = 1.0\n dr = 0.9\n while (diff >= self.theta):\n diff = 0.... | [
"0.72292733",
"0.7077397",
"0.69526213",
"0.6838988",
"0.67981094",
"0.6676597",
"0.6588217",
"0.64621633",
"0.64386576",
"0.6392877",
"0.63441277",
"0.6329117",
"0.6262564",
"0.6261382",
"0.6261382",
"0.6256801",
"0.62402046",
"0.6235945",
"0.62337315",
"0.6233538",
"0.62180... | 0.7368473 | 0 |
Return the extension's default config as a bytestring. | def get_default_config(self):
return config.read(pathlib.Path(__file__).parent / "ext.conf") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_config_yaml(cls):\n return DEFAULT_CONFIG",
"def get_default_config():\n # Swallow STDERR if it says\n # \"No config file found, using default configuration\"\n result = subprocess.check_output(['pylint', '--generate-rcfile'],\n stderr=subprocess.PI... | [
"0.6824224",
"0.680333",
"0.6583121",
"0.6450405",
"0.6361044",
"0.63239425",
"0.62646985",
"0.62367845",
"0.61887556",
"0.6159045",
"0.61573994",
"0.61218196",
"0.6119183",
"0.611836",
"0.6094854",
"0.6074354",
"0.60658973",
"0.6061596",
"0.60256606",
"0.60228896",
"0.600976... | 0.73125625 | 0 |
Create wav.scp and utt2spk files for kaldi project | def create_wav_file(self, ):
f_out = open(self.wav_file, 'w')
u_utt2spk = open(self.utt2spk, 'w')
for file in glob.glob(self.wav_folder+'/*.wav'):
base = os.path.basename(file).split('.')[0]
# write to scp file
f_out.write(base + '\t' + file + '\n')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n parser = argparse.ArgumentParser(description='ivector runner')\n parser.add_argument('--wav-dir', required=True,\n help='directory to original audio files')\n parser.add_argument('--label-file', required=True,\n help='label files')\n parser.ad... | [
"0.69527787",
"0.60774755",
"0.57179433",
"0.5668634",
"0.56360894",
"0.5610512",
"0.5534734",
"0.5505975",
"0.55012095",
"0.5486451",
"0.54637885",
"0.5412917",
"0.5376822",
"0.53642124",
"0.53635687",
"0.5349875",
"0.53381526",
"0.53311914",
"0.52724004",
"0.52690685",
"0.5... | 0.7969667 | 0 |
get word and pos lists from raw text you need a tokenizer to toke syntactic word and | def get_word_pos_list(self, raw_text):
raw_text = raw_text.strip()
word_list = []
pos_list = []
# pdb.set_trace()
seg_list = jieba.posseg.cut(raw_text,HMM=False) # 默认是精确模式
for word, flag in seg_list:
# remove the punctuation, we will keep punctuation as proso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tokenize(text):\n global TOK\n tokens = TOK.tokenize(text)\n output = {\n 'words': tokens.words(),\n 'offsets': tokens.offsets(),\n 'pos': tokens.pos(),\n 'lemma': tokens.lemmas(),\n 'ner': tokens.entities(),\n }\n return output",
"def _tokenize(text, languag... | [
"0.7470431",
"0.7395416",
"0.70028955",
"0.69835544",
"0.6983043",
"0.69734746",
"0.69718397",
"0.6965676",
"0.6950102",
"0.6923767",
"0.69043654",
"0.6903462",
"0.68873143",
"0.68592477",
"0.68408453",
"0.68376726",
"0.67986983",
"0.6785129",
"0.6743991",
"0.67269915",
"0.67... | 0.7505949 | 0 |
``SetupVal`` element indexing and field access. | def __getitem__(self, key : Union[int,str]) -> 'SetupVal':
if isinstance(key, int):
return elem(self, key)
elif isinstance(key, str):
return field(self, key)
else:
raise ValueError(f'{key!r} is not a valid element index or field name.') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elem(base: SetupVal, index: int) -> SetupVal:\n if not isinstance(base, SetupVal):\n raise ValueError('elem expected a SetupVal, but got {base!r}')\n if not isinstance(index, int):\n raise ValueError('elem expected an int, but got {index!r}')\n return ElemVal(base, index)",
"def variab... | [
"0.58010423",
"0.52174956",
"0.5192589",
"0.5170526",
"0.51652193",
"0.51367235",
"0.506961",
"0.5066795",
"0.504464",
"0.4995726",
"0.49847153",
"0.49725524",
"0.49245268",
"0.4918753",
"0.4906506",
"0.48814476",
"0.48668903",
"0.48634082",
"0.48634082",
"0.4850767",
"0.4846... | 0.693802 | 0 |
JSON representation with the information for those ``SetupVal``s which require additional information to initialize/allocate them vs that which is required later to reference them. I.e., ``.to_json()`` will be used to refer to such ``SetupVal``s in expressions, and ``.to_init_json() is used to initialize/allocate them.... | def to_init_json(self) -> JSON:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encodeSettingsJSONDict(self) -> dict:\n dct = super().encodeSettingsJSONDict()\n dct.update({\n \"numberOfIterations\": self._numberOfIterations,\n \"maximumSubIterations\": self._maximumSubIterations,\n \"updateReferenceState\": self._updateReferenceState\n ... | [
"0.6016759",
"0.59344727",
"0.5904529",
"0.5867126",
"0.5833199",
"0.5813906",
"0.5790869",
"0.5764384",
"0.5764384",
"0.57443666",
"0.57392055",
"0.5720278",
"0.57077616",
"0.5707635",
"0.56752557",
"0.5665849",
"0.56467897",
"0.5616303",
"0.5615064",
"0.55913943",
"0.557868... | 0.6813533 | 0 |
Denotes the end of the precondition specification portion of this ``Contract``, records that the function is executed with arguments ``args``, and denotes the beginning of the postcondition portion of this ``Contract``. | def execute_func(self, *args : SetupVal) -> None:
if self.__arguments is not None:
raise ValueError("The function has already been called once during the specification.")
elif self.__state != 'pre':
raise ValueError("Contract state expected to be 'pre', but found {self.__state!r}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precondition(self, *args, **kwargs):\n pass",
"def postcondition(self, proposition : Union[str, CryptolTerm, cryptoltypes.CryptolJSON]) -> None:\n if not isinstance(proposition, CryptolTerm):\n condition = Condition(CryptolTerm(proposition))\n else:\n condition = Co... | [
"0.6177178",
"0.5723174",
"0.547548",
"0.5295999",
"0.5283578",
"0.5148678",
"0.5082617",
"0.501515",
"0.49261147",
"0.4886479",
"0.4850595",
"0.4825933",
"0.47102427",
"0.47032326",
"0.46924946",
"0.4658807",
"0.46557087",
"0.46190742",
"0.46120164",
"0.4607931",
"0.46035954... | 0.6442863 | 0 |
Declares a fresh variable of type ``type`` (with name ``suggested_name`` if provided and available). | def fresh_var(self, type : Union['LLVMType','JVMType', 'MIRType'], suggested_name : Optional[str] = None) -> FreshVar:
fresh_name = self.get_fresh_name('x' if suggested_name is None else self.get_fresh_name(suggested_name))
v = FreshVar(self, type, fresh_name)
if self.__state == 'pre':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mk_var(self, name, type_):\n # type: (str, ty.Type) -> expr.Var\n\n var = expr.Var(name, type_)\n self.var_scopes[0].appendleft((name, var))\n return var",
"def __new_var__(self, var_type=None, name=None) -> str:\n if name is None:\n from time import time\n ... | [
"0.59824485",
"0.57070416",
"0.5549584",
"0.55357915",
"0.55215186",
"0.55021834",
"0.54834145",
"0.5469009",
"0.54618245",
"0.5438908",
"0.5366721",
"0.53471917",
"0.52980685",
"0.52784896",
"0.52565503",
"0.51915675",
"0.51400554",
"0.51354724",
"0.51354724",
"0.51239824",
... | 0.6603329 | 0 |
Allocates a pointer of type ``type``. If ``read_only == True`` then the allocated memory is immutable. If ``alignment != None``, then the start of the allocated region of memory will be aligned to a multiple of the specified number of bytes (which must be a power of 2). If ``points_to != None``, it will also be asserte... | def alloc(self, type : Union['LLVMType', 'JVMType', 'MIRType'], *, read_only : bool = False,
alignment : Optional[int] = None,
points_to : Optional[SetupVal] = None) -> SetupVal:
a = Allocated(self, type, mutable = not read_only, al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allocate(self, shape, dtype, **kwargs):\n buf = _xrt_allocate(shape, dtype, self.device, self.idx, **kwargs)\n buf.memory = self\n return buf",
"def allocate(n, dtype=numpy.float32):\n return drv.pagelocked_empty(int(n), dtype, order='C', mem_flags=drv.host_alloc_flags.PORTABLE|drv.ho... | [
"0.57738674",
"0.5534184",
"0.5054423",
"0.50366706",
"0.5023372",
"0.49843517",
"0.49530864",
"0.49458945",
"0.4920282",
"0.49179143",
"0.48030093",
"0.47454146",
"0.4738631",
"0.47363767",
"0.47094506",
"0.46954837",
"0.4584886",
"0.45835534",
"0.45791695",
"0.4517232",
"0.... | 0.7695017 | 0 |
Declare that the memory location indicated by the ``pointer`` contains the ``target``. If ``check_target_type == PointerType()``, then this will check that ``target``'s type matches the type that ``pointer``'s type points to. If ``check_target_type`` is an ``LLVMType``, then this will check that ``target``'s type match... | def points_to(self, pointer : SetupVal, target : SetupVal, *,
check_target_type : Union[PointerType, 'LLVMType', 'JVMType', 'MIRType', None] = PointerType(),
condition : Optional[Condition] = None) -> None:
pt = PointsTo(pointer, target, check_target_type = check_target_type,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_as_target(self, message_handler):\n\n super().verify_as_target(message_handler)\n\n # Set the various property values.\n ndk_root = self.platform.android_ndk_root\n android_api = self.platform.android_api\n toolchain_prefix = self.android_toolchain_prefix\n host... | [
"0.50255257",
"0.4770521",
"0.46615148",
"0.450306",
"0.4230812",
"0.4189861",
"0.41728953",
"0.41636252",
"0.41299722",
"0.41146696",
"0.41034138",
"0.40895876",
"0.4089576",
"0.4074428",
"0.40625694",
"0.4047812",
"0.40265095",
"0.40036213",
"0.3980081",
"0.39789042",
"0.39... | 0.69602436 | 0 |
Declare that the memory location indicated by the ``pointer`` is a bitfield whose field, indicated by the ``field_name``, contains the ``target``. Currently, this function only supports LLVM verification. Attempting to use this function for JVM or MIR verification will result in an error. | def points_to_bitfield(self, pointer : SetupVal, field_name : str,
target : SetupVal) -> None:
pt = PointsToBitfield(pointer, field_name, target)
if self.__state == 'pre':
self.__pre_state.points_to_bitfield.append(pt)
elif self.__state == 'post':
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def OpenBitfield(self, name, unused_offset, width, repeat): # pylint: disable=unused-argument\n self.bitfield_name = name\n self.bitfield_type = 'uint{}_t'.format(width)\n self.bitfield_repeat = repeat\n self.output.write(' union {}_{} {{\\n'.format(self.register_name, name))\n self.output.write('... | [
"0.54733264",
"0.5460847",
"0.5197722",
"0.50341105",
"0.47181937",
"0.46958515",
"0.45150685",
"0.4506024",
"0.44881466",
"0.4487029",
"0.4483094",
"0.44623378",
"0.44325507",
"0.43442968",
"0.42491135",
"0.42240646",
"0.41894463",
"0.41745946",
"0.4154531",
"0.4145011",
"0.... | 0.74496937 | 0 |
Establishes ``proposition`` as a precondition for the function ```Contract``` being specified. Preconditions must be specified before ``execute_func`` is called in the contract specification. | def precondition(self, proposition : Union[str, CryptolTerm, cryptoltypes.CryptolJSON]) -> None:
if not isinstance(proposition, CryptolTerm):
condition = Condition(CryptolTerm(proposition))
else:
condition = Condition(proposition)
if self.__state == 'pre':
sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precondition(self, *args, **kwargs):\n pass",
"def _assert_preconditions(preconditions: List[List[Contract]], resolved_kwargs: Mapping[str, Any],\n func: CallableT) -> Optional[BaseException]:\n exception = None # type: Optional[BaseException]\n\n # Assert the precondit... | [
"0.61248356",
"0.60602695",
"0.5561483",
"0.55492395",
"0.538599",
"0.53433055",
"0.52163595",
"0.5191791",
"0.5176035",
"0.5135069",
"0.5098375",
"0.50205106",
"0.50175613",
"0.49804023",
"0.48634037",
"0.48445925",
"0.4840729",
"0.4834197",
"0.47933236",
"0.47728536",
"0.47... | 0.78954935 | 0 |
Declares a precondition using a ``cry_f``style format string, i.e. ``precondition_f(...)`` is equivalent to ``precondition(cry_f(...))`` | def precondition_f(self, s : str) -> None:
expression = to_cryptol_str_customf(s, frames=1, filename="<precondition_f>")
return self.precondition(expression) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_precondition(f):\n\n @wraps(f)\n def wrap(*args, **kwargs):\n self = args[0]\n driver = get_driver(PG_DEFAULT_DRIVER)\n self.manager = driver.connection_manager(kwargs['sid'])\n self.conn = self.manager.connection(did=kwargs['did'])\n s... | [
"0.5880695",
"0.5841402",
"0.5509067",
"0.5456788",
"0.5433575",
"0.5348727",
"0.5202193",
"0.51498044",
"0.5137578",
"0.51247513",
"0.51114064",
"0.510678",
"0.50279385",
"0.50184995",
"0.50016326",
"0.4935318",
"0.49185336",
"0.49085987",
"0.48786557",
"0.48547697",
"0.4761... | 0.7872119 | 0 |
Establishes ``proposition`` as a postcondition for the function ```Contract``` being specified. Postconditions must be specified after ``execute_func`` is called in the contract specification. | def postcondition(self, proposition : Union[str, CryptolTerm, cryptoltypes.CryptolJSON]) -> None:
if not isinstance(proposition, CryptolTerm):
condition = Condition(CryptolTerm(proposition))
else:
condition = Condition(proposition)
if self.__state == 'post':
s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precondition(self, proposition : Union[str, CryptolTerm, cryptoltypes.CryptolJSON]) -> None:\n if not isinstance(proposition, CryptolTerm):\n condition = Condition(CryptolTerm(proposition))\n else:\n condition = Condition(proposition)\n if self.__state == 'pre':\n ... | [
"0.61258537",
"0.57307535",
"0.5594438",
"0.52904093",
"0.5121971",
"0.5082023",
"0.45603463",
"0.45593423",
"0.4496507",
"0.4484249",
"0.44274974",
"0.43986225",
"0.43901643",
"0.43795395",
"0.4364809",
"0.4350057",
"0.43307158",
"0.4328069",
"0.43119374",
"0.43000028",
"0.4... | 0.79544693 | 0 |
Declares a postcondition using a ``cry_f``style format string, i.e. ``postcondition_f(...)`` is equivalent to ``postcondition(cry_f(...))`` | def postcondition_f(self, s : str) -> None:
expression = to_cryptol_str_customf(s, frames=1, filename="<postcondition_f>")
return self.postcondition(expression) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postcondition(self, proposition : Union[str, CryptolTerm, cryptoltypes.CryptolJSON]) -> None:\n if not isinstance(proposition, CryptolTerm):\n condition = Condition(CryptolTerm(proposition))\n else:\n condition = Condition(proposition)\n if self.__state == 'post':\n ... | [
"0.55773443",
"0.5464703",
"0.53132415",
"0.491308",
"0.48952672",
"0.48772743",
"0.4710679",
"0.46468252",
"0.45782396",
"0.45640504",
"0.44988325",
"0.4493813",
"0.44909164",
"0.44549403",
"0.44291052",
"0.43675834",
"0.43558705",
"0.432378",
"0.42930296",
"0.42715335",
"0.... | 0.7238748 | 0 |
Declares a return value using a ``cry_f``style format string, i.e. ``returns_f(...)`` is equivalent to ``returns(cry_f(...))`` | def returns_f(self, s : str) -> None:
expression = to_cryptol_str_customf(s, frames=1, filename="<returns_f>")
return self.returns(CryptolTerm(expression)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _returns_formatter(field, description):\n types = _or_types(field)\n tail = ('**%s** -- ' % types) if types else ''\n tail += description\n return ['returns'], tail",
"def returns(rtype):\n\n def check_returns(f):\n def new_f(*args, **kwds):\n result = f(*args, **kwds)\n ... | [
"0.5945622",
"0.5894744",
"0.5816567",
"0.5749548",
"0.5621279",
"0.5485676",
"0.51316035",
"0.5049416",
"0.5031203",
"0.5015301",
"0.49888146",
"0.49703193",
"0.49614596",
"0.49327898",
"0.49053165",
"0.4895231",
"0.48911119",
"0.4885299",
"0.48835716",
"0.48658392",
"0.4849... | 0.7086921 | 0 |
Returns a pointer to the named global ``name`` (i.e., a ``GlobalVarVal``). | def global_var(name: str) -> SetupVal:
return GlobalVarVal(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_global(self, name):\n return self.globals.get(name)",
"def FindGlobalName(name):\r\n r = Names.FindName(name)\r\n return None if r is None or r[1] != 0 else r[0]",
"def mk_global_var(self, name):\n # type: (str) -> expr.GlobalVar\n\n var = expr.GlobalVar(name)\n ... | [
"0.7643281",
"0.7405154",
"0.7267085",
"0.6754729",
"0.6508025",
"0.6064082",
"0.60515136",
"0.60301775",
"0.6013156",
"0.5977047",
"0.5975551",
"0.5970782",
"0.5953204",
"0.59230834",
"0.57300144",
"0.5704325",
"0.5697861",
"0.5673175",
"0.56570464",
"0.5642123",
"0.56327236... | 0.7522471 | 1 |
Embed a string of Cryptol syntax as a ``CryptolTerm`` (which is also a ``SetupVal``) also see ``cry_f``. | def cry(s : str) -> CryptolTerm:
return CryptolTerm(s) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cry_f(s : str) -> CryptolTerm:\n return CryptolTerm(to_cryptol_str_customf(s, frames=1))",
"def secret_char(c):\n return \"\\\\raisebox{{0.07ex}}{{{}}}\".format(c)",
"def dctSymText(pdct, symIndex, q_mut, symTxt_i):\n return _dctmcc.dctSymText(pdct, symIndex, q_mut, symTxt_i)",
"def text_of_quot... | [
"0.7075866",
"0.539913",
"0.5289928",
"0.5179048",
"0.50565886",
"0.50126344",
"0.49285215",
"0.49214622",
"0.48983872",
"0.48978207",
"0.48960435",
"0.4835875",
"0.47906184",
"0.46823758",
"0.46800852",
"0.46791527",
"0.4671936",
"0.46585104",
"0.46511346",
"0.46266696",
"0.... | 0.7450221 | 0 |
Embed a string of Cryptol syntax as a ``CryptolTerm`` (which is also a ``SetupVal``), where the given string is parsed as an fstring, and the values within brackets are converted to Cryptol syntax using ``to_cryptol_str`` from the Cryptol Python library. Like fstrings, values in brackets (``{``, ``}``) are parsed as py... | def cry_f(s : str) -> CryptolTerm:
return CryptolTerm(to_cryptol_str_customf(s, frames=1)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cry(s : str) -> CryptolTerm:\n return CryptolTerm(s)",
"def from_string(cls, term_string):\n term_string = term_string.replace(\" \", \"\")\n\n if term_string in cls.term_dict:\n return cls.term_dict[term_string]\n\n if term_string[0] == NALSyntax.StatementSyntax.Start.valu... | [
"0.6569946",
"0.5234279",
"0.5113254",
"0.4916386",
"0.47389224",
"0.47140557",
"0.4711699",
"0.46860373",
"0.46389678",
"0.4611042",
"0.4606485",
"0.46026778",
"0.458056",
"0.45728737",
"0.45649576",
"0.45310703",
"0.4507424",
"0.45044535",
"0.4489053",
"0.4486142",
"0.44690... | 0.7383577 | 0 |
Returns an array with the provided ``elements`` (i.e., an ``ArrayVal``). N.B., one or more ``elements`` must be provided. | def array(*elements: SetupVal) -> SetupVal: # FIXME why? document this here when we figure it out.
if len(elements) == 0:
raise ValueError('An array must be constructed with one or more elements')
for e in elements:
if not isinstance(e, SetupVal):
raise ValueError('array expected a S... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def literal_array(cls, elems):\n tys = [el.type for el in elems]\n if len(tys) == 0:\n raise ValueError(\"need at least one element\")\n ty = tys[0]\n for other in tys:\n if ty != other:\n raise TypeError(\"all elements must have the same type\")\n ... | [
"0.63141423",
"0.61759484",
"0.5876142",
"0.5876142",
"0.5855569",
"0.5829477",
"0.5603934",
"0.55806786",
"0.5522557",
"0.5486283",
"0.5423277",
"0.5363881",
"0.53270215",
"0.52615696",
"0.52372",
"0.5161364",
"0.5146069",
"0.5131763",
"0.51290524",
"0.5075306",
"0.5060467",... | 0.76690924 | 0 |
Returns the value of the array element at position ``index`` in ``base`` (i.e., an ``ElemVal``). | def elem(base: SetupVal, index: int) -> SetupVal:
if not isinstance(base, SetupVal):
raise ValueError('elem expected a SetupVal, but got {base!r}')
if not isinstance(index, int):
raise ValueError('elem expected an int, but got {index!r}')
return ElemVal(base, index) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, index):\n assert 0 <= index < len(self), \"Array subscript out of range\"\n return self._elements[index]",
"def __getitem__(self, index):\n return self._value_at(index)",
"def __getitem__(self, index):\n return self._value_at(index)",
"def get_value_by_index(... | [
"0.6206184",
"0.5925424",
"0.5925424",
"0.59076196",
"0.58871347",
"0.5847688",
"0.5847688",
"0.5773768",
"0.5763173",
"0.5750743",
"0.5704301",
"0.56787795",
"0.56467545",
"0.56258124",
"0.56258124",
"0.55708736",
"0.5560451",
"0.5526446",
"0.55208457",
"0.5520844",
"0.54921... | 0.6867809 | 0 |
Returns the value of struct ``base``'s field ``field_name`` (i.e., a ``FieldVal``). | def field(base : SetupVal, field_name : str) -> SetupVal:
if not isinstance(base, SetupVal):
raise ValueError('field expected a SetupVal, but got {base!r}')
if not isinstance(field_name, str):
raise ValueError('field expected a str, but got {field_name!r}')
return FieldVal(base, field_name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_field(self):\n return self.field[1]",
"def get_field_value(self, field_name):\n if field_name in self.fields.keys():\n return self.fields[field_name]\n else:\n return \"No such field\"",
"def give_field(self, name):\n return self.field(name).toPyObject... | [
"0.6439194",
"0.63589764",
"0.6254331",
"0.6202346",
"0.6119287",
"0.60831076",
"0.606883",
"0.6047433",
"0.60426337",
"0.5932046",
"0.5928633",
"0.59078467",
"0.58327734",
"0.5789522",
"0.57774085",
"0.5764291",
"0.576368",
"0.57622",
"0.5720652",
"0.56872433",
"0.5652889",
... | 0.7024381 | 0 |
Returns the initializer value of a named global ``name`` (i.e., a ``GlobalInitializerVal``). | def global_initializer(name: str) -> SetupVal:
if not isinstance(name, str):
raise ValueError('global_initializer expected a str naming a global value, but got {name!r}')
return GlobalInitializerVal(name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def global_var(name: str) -> SetupVal:\n return GlobalVarVal(name)",
"def get_global(self, name):\n return self.globals.get(name)",
"def get_named_value_raw(name):\n\n try:\n return _global_keys[name].get()\n except KeyError:\n named_value = NamedValue.query(NamedValue.name == nam... | [
"0.7120508",
"0.68908405",
"0.6277764",
"0.6152262",
"0.6053705",
"0.5999579",
"0.57844174",
"0.5782982",
"0.5781807",
"0.5656189",
"0.5576702",
"0.5554507",
"0.5533049",
"0.5532538",
"0.5531363",
"0.5520799",
"0.5518844",
"0.5491051",
"0.548402",
"0.5457721",
"0.5438547",
... | 0.8077522 | 0 |
Returns a null pointer value (i.e., a ``NullVal``). | def null() -> SetupVal:
return NullVal() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _getZeroPtrTypeOrNone(stmnt):\n stmnt = _resolveSingleStatement(stmnt)\n if not isinstance(stmnt, CFuncCall): return\n base = stmnt.base\n if isinstance(base, CStatement):\n if not base.isCType(): return\n base = base.asType()\n if not isinstance(base, CPointerType): return\n as... | [
"0.72967833",
"0.6637182",
"0.64364773",
"0.6151494",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
"0.6123286",
... | 0.67909634 | 1 |
Returns an LLVM structure value with the given ``fields`` (i.e., a ``StructVal``). | def struct(*fields : SetupVal) -> SetupVal:
for field in fields:
if not isinstance(field, SetupVal):
raise ValueError('struct expected a SetupVal, but got {field!r}')
return StructVal(list(fields)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_tuple(*fields):\n fields2 = []\n for (idx, f) in zip(range(len(fields)), fields):\n if isinstance(f, (_StructField, pb.StructField)):\n fields2.append(f)\n if isinstance(f, pb.SQLType):\n fields2.append(pb.StructField(\n field_name=\"_%s\" % str(idx),\n field_type=f))\n ... | [
"0.61968094",
"0.57476264",
"0.5655114",
"0.5549672",
"0.5416517",
"0.535677",
"0.5152097",
"0.51517534",
"0.5148884",
"0.51229507",
"0.5040807",
"0.50355387",
"0.4992091",
"0.49614033",
"0.49545547",
"0.49532297",
"0.48888758",
"0.48653442",
"0.48457876",
"0.48444068",
"0.48... | 0.71451795 | 0 |
This function compares two RPM version numbers. Each argument is a list of three variables [epoch,version,release]. | def rpmCompareVersion(first_version,second_version):
return rpm.labelCompare(first_version,second_version) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare_version_objects(version1, version2):\n if version1.epoch < version2.epoch:\n return -1\n if version1.epoch > version2.epoch:\n return 1\n result = compare_strings(version1.upstream, version2.upstream)\n if result != 0:\n return result\n if version1.revision or versio... | [
"0.70215285",
"0.66633147",
"0.66579026",
"0.648834",
"0.62769777",
"0.62584716",
"0.6164936",
"0.61591077",
"0.610196",
"0.6029816",
"0.59928286",
"0.59454083",
"0.5932434",
"0.5929968",
"0.59290105",
"0.5875276",
"0.584516",
"0.5836626",
"0.5822976",
"0.5797705",
"0.5790441... | 0.6935284 | 1 |
Get an authorization pin for the ecobee binary schedule app. | def get_auth_pin(self):
url = url_base + "authorize"
params = {"response_type": "ecobeePin",
"client_id": app_key,
"scope": "smartWrite"}
resp = requests.get(url, params=params)
try:
resp_json = resp.json()
except:
raise... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pin(self) -> str:\n return self._pin",
"async def get_app_pin(self) -> bool:\n return await self.AD.threading.get_app_pin(self.name)",
"def auth_code(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"auth_code\")",
"def auth_code(self) -> Optional[pulumi.Input[str... | [
"0.58701956",
"0.57063407",
"0.5260236",
"0.5260236",
"0.5260236",
"0.5260236",
"0.5260236",
"0.5260236",
"0.5260236",
"0.5260236",
"0.51845294",
"0.51545215",
"0.510651",
"0.50677514",
"0.50666404",
"0.50405896",
"0.50377643",
"0.5009676",
"0.50032365",
"0.49950856",
"0.4935... | 0.7196814 | 0 |
Break vals in to batches of length size. | def get_chunks(vals, size):
for i in range(0, len(vals), size):
yield vals[i:i + size] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def batch(self, data, size):\n\n return [data[x : x + size] for x in range(0, len(data), size)]",
"def batches(data, batch_size) -> list:\n rv = []\n for idx, line in enumerate(data):\n if idx != 0 and idx % batch_size == 0:\n yield rv\n ... | [
"0.6909949",
"0.6754942",
"0.67217785",
"0.6512714",
"0.6483336",
"0.6483336",
"0.6483336",
"0.6465507",
"0.643971",
"0.6420285",
"0.6406308",
"0.6345778",
"0.63422734",
"0.63244283",
"0.6319511",
"0.6283953",
"0.628309",
"0.6258906",
"0.6245347",
"0.6230005",
"0.6206792",
... | 0.7483654 | 0 |
Get short bio for a user because full bio should not display in the table | def get_short_bio(self, instance):
try:
short_bio = instance.bio[:40]
except:
short_bio = "No bio available"
return short_bio | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def biography_file(self, instance):\r\n try:\r\n return admin_display_file(instance.user.user_files, 'biography')\r\n except Exception:\r\n return mark_safe('<i class=\"fa fa-times-circle red\" aria-hidden=\"true\"></i>')",
"def bioinfo():\n\n pass",
"def desc_user(self):... | [
"0.67416525",
"0.6574375",
"0.6369881",
"0.619834",
"0.61608386",
"0.61477786",
"0.6073322",
"0.60365134",
"0.5987903",
"0.59600526",
"0.5940058",
"0.5936587",
"0.59278494",
"0.5918187",
"0.5883909",
"0.5853834",
"0.58389735",
"0.57879335",
"0.5781525",
"0.5740413",
"0.573701... | 0.8009275 | 0 |
Get post view for a post | def get_post_view(self, instance):
return instance.postview.view | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_post(request, slug_post):\n try:\n post = Entry.objects.filter(status=2).get(slug=slug_post)\n except Entry.DoesNotExist:\n raise Http404\n return render_to_response('blog/post.html', {'post':post, 'DISQUS_SHORTNAME':settings.DISQUS_SHORTNAME}, RequestContext(request))",
"def view... | [
"0.70041627",
"0.6730276",
"0.67235184",
"0.6705916",
"0.66414756",
"0.6488072",
"0.64159036",
"0.6387823",
"0.63466334",
"0.6297201",
"0.62165123",
"0.61953574",
"0.61860126",
"0.6175696",
"0.6172242",
"0.61636543",
"0.6123978",
"0.6123955",
"0.6107269",
"0.6044193",
"0.6018... | 0.8440669 | 0 |
Divide `text` in rows of length `len`, optionally padding the last line with `pad` | def _to_rows(key_len, text, pad=None):
rows = [
text[i:i+key_len]
for i in range(0, len(text), key_len)
]
# Pad if needed
if pad is not None:
rows[-1] = rows[-1] + '0' * (key_len - len(rows[-1]))
return rows | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wrap(text, width):\n lines = []\n pos = 0\n while pos < len(text):\n lines.append(text[pos : pos + width])\n pos += width\n return lines",
"def fill(text, width):\n width = int(width)\n paras = text.replace(\"\\r\\n\",\"\\n\").replace(\"\\r\",\"\\n\").split(\"\\n\\n\")\n w... | [
"0.6656059",
"0.63244617",
"0.62891924",
"0.62891924",
"0.62891924",
"0.62891924",
"0.62891924",
"0.606023",
"0.60042363",
"0.5964527",
"0.5961549",
"0.59477097",
"0.5937644",
"0.588403",
"0.58190686",
"0.57898563",
"0.5779069",
"0.57716274",
"0.5762766",
"0.5762766",
"0.5762... | 0.6751826 | 0 |
Plot the intensity ratio of 2 lines or sums of lines. Shown as a function of density and/or temperature. For a single wavelength range, set wvlRange = [wMin, wMax] For multiple wavelength ranges, set wvlRanges = [[wMin1,wMax1],[wMin2,wMax2], ...] A plot of relative emissivities is shown and then a dialog appears for th... | def intensityRatio(self, wvlRange=None, wvlRanges=None, top=10):
if not hasattr(self, 'Intensity'):
try:
self.intensity()
except:
print(' intensities not calculated and emiss() is unable to calculate them')
print(' perhaps the temperature ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lim_and_line(vmin, vmax):\n\n pl.xlim(vmin, vmax)\n pl.ylim(vmin, vmax)\n pl.plot([vmin,vmax], [vmin,vmax], 'k:', linewidth=1)\n pl.plot([vmin,vmax], [0,0], 'k:', linewidth=1)\n pl.plot([0,0], [vmin,vmax], 'k:', linewidth=1)",
"def intensityPlot(self, index=-1, wvlRange=None, top=10, linLog='l... | [
"0.6204814",
"0.59660244",
"0.5697046",
"0.5525023",
"0.5517527",
"0.55011183",
"0.54926276",
"0.5480352",
"0.54775566",
"0.53644186",
"0.535375",
"0.53435534",
"0.5336835",
"0.52333206",
"0.52042234",
"0.51844335",
"0.51832455",
"0.5175107",
"0.5120354",
"0.51150966",
"0.503... | 0.6637774 | 0 |
Save the intensity ratio to a file. The intensity ratio as a function to temperature and eDensity is saved to an asciii file. Descriptive information is included at the top of the file. | def intensityRatioSave(self,outFile=0):
if not outFile:
outFile = self.IntensityRatio['filename']
print(' saving ratio to filename = %s'%(outFile))
if hasattr(self, 'IntensityRatio'):
temperature=self.IntensityRatio['temperature']
eDensity=self.IntensityRa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self, filename=None):\n if filename == None:\n filename = self.ofilename\n\n ofile = open(filename, 'w')\n\n ofile.write('# Susceptibility: %E d(susc): %E Coercivity: %E d(coer): %E\\n' % (self.susceptibility_mean, self.susceptibility_std, self.coercivity_mean, self.coerci... | [
"0.63907874",
"0.6082645",
"0.60215884",
"0.5904199",
"0.58914584",
"0.5882333",
"0.5827093",
"0.581867",
"0.57799584",
"0.5736777",
"0.5658192",
"0.56443477",
"0.56338364",
"0.56292164",
"0.5624723",
"0.5618252",
"0.56170124",
"0.5571053",
"0.5525418",
"0.5509843",
"0.546931... | 0.7710725 | 0 |
Helper method to test regression fixtures like `data_regression`. Offers a basic template/script able to validate main behaviors expected by regression fixtures. Usage ``` import sys | def check_regression_fixture_workflow(
testdir,
source,
data_getter,
data_modifier,
expected_data_1,
expected_data_2,
compare_fn=None,
):
if compare_fn is None:
compare_fn = operator.eq
testdir.makepyfile(test_file=source)
# First run fails because there's no expected fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regression_vault():\n return load_regression_tests()",
"def fixture_example_data():\n import_example_data()",
"def test_customize_test_loads(self):\n self.create_user_with_role(\n self.user.name, self.user.email, self.user.password, Role.tester)\n self.create_forktest(\"own-f... | [
"0.7101717",
"0.6366032",
"0.63560283",
"0.6263984",
"0.6236161",
"0.6222066",
"0.6209129",
"0.6175011",
"0.61162287",
"0.6101934",
"0.60492957",
"0.6016519",
"0.5935364",
"0.5935364",
"0.5928671",
"0.5897968",
"0.589761",
"0.5887202",
"0.58685434",
"0.5858861",
"0.5848266",
... | 0.65733534 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.