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 |
|---|---|---|---|---|---|---|
Test case for drugs_get | def test_drugs_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_drugs_id_get(self):\n pass",
"def test_get_foods(self):\n pass",
"def test_get_dealer_ratings(self):\n pass",
"def test_get_food(self):\n pass",
"def test_getitem(self):\n for name, det in self.sampler.detectors.items():\n fromGetItem = self.sampler[na... | [
"0.6962607",
"0.596903",
"0.58494073",
"0.56993365",
"0.56963634",
"0.5652749",
"0.5547654",
"0.55350125",
"0.54472077",
"0.5434252",
"0.54235184",
"0.53876746",
"0.53432137",
"0.53232735",
"0.5316595",
"0.52970773",
"0.5294284",
"0.52920455",
"0.52872455",
"0.5267997",
"0.52... | 0.80927145 | 0 |
Test case for drugs_id_get | def test_drugs_id_get(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_solareclipses_id_get(self):\n pass",
"def test_brains_id_get(self):\n pass",
"def test_cyclingleagues_id_get(self):\n pass",
"def test_drugs_get(self):\n pass",
"def test_variablepresentations_id_get(self):\n pass",
"def test_metrostations_id_get(self):\n ... | [
"0.6939252",
"0.68702316",
"0.6762579",
"0.6670218",
"0.66457254",
"0.6614921",
"0.6511314",
"0.6363711",
"0.6351318",
"0.6340964",
"0.63330746",
"0.6301962",
"0.62805253",
"0.6253979",
"0.62284195",
"0.6225187",
"0.62247854",
"0.62032455",
"0.6199987",
"0.6199941",
"0.619744... | 0.8770127 | 0 |
Make a connection with the entry node as defined in the configuration | def connect_entry_node(config):
connect_kwargs = _authenticate(config)
try:
conn = Connection(config.hostname, user=config.user, connect_kwargs=connect_kwargs)
conn.open()
if conn.is_connected:
logging.info(f"Connection to {Fore.CYAN}{config.hostname}{Style.RESET_ALL} ESTABLISHED")
return conn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_connection_entry(self,client_id, display_name,session_id,host,conn,addr):\n self.connections[client_id] = {\n \"display_name\" : display_name,\n \"session_id\" : session_id,\n \"host\" : host,\n \"CONN\" : conn,\n \"ADDR\" ... | [
"0.6261105",
"0.5987139",
"0.5675734",
"0.5650265",
"0.5552257",
"0.5552257",
"0.55126846",
"0.55125797",
"0.5504496",
"0.5482419",
"0.5469519",
"0.5461703",
"0.54432505",
"0.54420763",
"0.5436924",
"0.5436924",
"0.5435477",
"0.5412596",
"0.54032594",
"0.53936654",
"0.5388650... | 0.77102304 | 0 |
Variable representing whether the value is equal to `k`. | def equal_to(self, k):
lower, upper = self.value_range
assert isinstance(k, int), "k should be integer"
assert lower <= k <= upper, "This value never takes {}".format(k)
return self.array[k-lower] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_set(x, k):\n\n return get_bit(x, k) == 1",
"def __contains__(self, k) :\n try :\n (ch, k) = k\n if k not in self.parent().monoid() :\n k = (ch, k)\n except TypeError :\n pass\n \n return k in self.precision()",
"def check... | [
"0.665361",
"0.58944875",
"0.58171",
"0.57273793",
"0.56973225",
"0.5624972",
"0.5607115",
"0.55373967",
"0.5494322",
"0.5414764",
"0.5356808",
"0.53386307",
"0.52599514",
"0.5257434",
"0.52198607",
"0.52160364",
"0.5210782",
"0.5205698",
"0.51945966",
"0.519126",
"0.51844853... | 0.65765846 | 1 |
Split a ops along one axis. | def split(x, axis, split_size):
assert axis < x.ndim, 'Dimension out of range!'
if isinstance(split_size, int):
_split_size = [x.shape[axis] // split_size] * split_size
elif isinstance(split_size, (list, tuple)):
_split_size = split_size
else:
raise TypeError
if x.ndim == ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_split(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n axis = op.input(\"AxisTensor\")\n if axis:\n axis = g.get_node(axis[0])\n axis, infered = try_infer_value(axis, g.get_params())\n if infered:\n axis = axis.tolist()[0]\n else:\n axis = op.at... | [
"0.68655205",
"0.6178037",
"0.6167283",
"0.616612",
"0.6152276",
"0.6116156",
"0.6059845",
"0.6048551",
"0.6027751",
"0.5952619",
"0.58748364",
"0.58061045",
"0.57778054",
"0.57778054",
"0.57778054",
"0.57778054",
"0.57778054",
"0.57778054",
"0.57778054",
"0.57611406",
"0.572... | 0.62171984 | 1 |
Given a valid input file, whith each line corresponding to an authenticity and IP address, record the entry into the distance_matrix table | def add_record(filename, handler):
distance_matrix = defaultdict(lambda: defaultdict(int))
### process the input file line
### by line and record the info
with open(filename, 'r') as f:
for line_terminated in f:
line = line_terminated.rstrip('\n')
auth, ip = line.sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readDistances(fileName):\n infile = open(fileName, \"r\")\n distances = {}\n\n for line in infile:\n line = [i.strip() for i in line.split()]\n if not distances.has_key(line[0]):\n distances[line[0]] = {}\n distances[line[0]][line[1]] = float(line[2])\n\n if not ... | [
"0.5802501",
"0.57328147",
"0.5718213",
"0.56730574",
"0.56598943",
"0.54219216",
"0.5357045",
"0.53561974",
"0.53092146",
"0.5246977",
"0.51776904",
"0.5154674",
"0.5143338",
"0.5134231",
"0.5129285",
"0.5119593",
"0.5116218",
"0.5105296",
"0.5104957",
"0.5103251",
"0.510302... | 0.6963724 | 0 |
Given an IP address and the distance matrix of recorded logins, find the mile distance between the new login IP and the closest IP found in the input distance matrix | def query_result(distance_matrix, ip_address, handler):
### get location info from IPinfo handler
details = handler.getDetails(ip_address)
lat, lon = details.loc.split(',')
location = (float(lat), float(lon))
mindist = float('inf')
score = 0
closest_ip = ""
### iterate through the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mi_from_dm(distance_matrix, ns, nh, spike_train_list=None):\n \n nr = len(distance_matrix)\n nt = nr/ns\n nearest_neighbours = np.array([r.argsort()[:nh] for r in distance_matrix])\n \n if spike_train_list is not None:\n\n members_of_glob = trains_in_glob(spike_train_list)\n glo... | [
"0.57739556",
"0.5677657",
"0.5665553",
"0.5558894",
"0.5465855",
"0.53911155",
"0.53774333",
"0.5360239",
"0.5293323",
"0.5270165",
"0.52522093",
"0.5250559",
"0.52264786",
"0.5202218",
"0.5168349",
"0.51664054",
"0.51661325",
"0.51570827",
"0.5152626",
"0.51514626",
"0.5142... | 0.6245658 | 0 |
Takes set of features (X) as (n,m) matrix and labels (Y) as (1,m) matrix and splits them into train and dev sets only, of specified proportions. It's assumed that a test set isn't needed. Train set will have same number of examples of each class | def get_train_dev_sets (X, Y, train_set_proportion = 0.9):
size_classes = np.unique(Y, return_counts = True)[1] # get an array of all class sizes
# our training set contains train_set_proportion * smallest class size of each class
size_smallest_class = min (np.unique (Y, return_counts = True)[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_validation_split(train_data, fraction_per_class=0.1, shuffle=True):\n\n subset_train_data = []\n val_data = []\n val_label_counts = {}\n\n class_labels = [i['class']['label'] for i in train_data]\n images_per_class = Counter(class_labels)\n val_images_per_class = {label: 0 for label in... | [
"0.69534475",
"0.67535543",
"0.675251",
"0.6752314",
"0.67367667",
"0.67177093",
"0.66581184",
"0.65962744",
"0.65679055",
"0.6543682",
"0.65190715",
"0.651609",
"0.651609",
"0.649336",
"0.6485503",
"0.645766",
"0.6442591",
"0.64340514",
"0.6409809",
"0.6406509",
"0.63813823"... | 0.7541141 | 0 |
Checks if a attribute is present in the map. | def has_attr(self, key):
return key in self.attrs | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_attribute(self, key):\n return key in self.__dict",
"def hasAttribute(self, attrib):\n return self._dqa(attrib) in self.attributes",
"def has_attribute(self, attribute: str) -> bool:\n return any([\n key_node.value == attribute for key_node, _ in self.yaml_node.value\n ... | [
"0.77951694",
"0.75643295",
"0.7487096",
"0.7437156",
"0.7325842",
"0.7323163",
"0.7234313",
"0.7232403",
"0.71460485",
"0.7135965",
"0.71117365",
"0.7074761",
"0.70553344",
"0.696566",
"0.6910702",
"0.6880677",
"0.6843631",
"0.6789804",
"0.67363316",
"0.67363316",
"0.6715766... | 0.76034814 | 1 |
Get int tuple attribute | def get_int_tuple(self, key, default=RequiredAttr()):
if key in self.attrs:
tshape = self.attrs[key]
return tuple(int(x) if x.strip("- ").isdigit() else None
for x in tshape.strip('()[]').split(',') if x)
if isinstance(default, RequiredAttr):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_tuple_tuple_int(self, key, default=RequiredAttr()):\n if key in self.attrs:\n value = self.attrs[key]\n seq = []\n for tup in value.strip('()').split('),'):\n tup = tup.strip('[]()')\n els = [int(x.strip('( ')) for x in tup.split(',')]\n... | [
"0.69215757",
"0.6645626",
"0.66433114",
"0.6346006",
"0.6260027",
"0.6199099",
"0.6199099",
"0.6077572",
"0.605784",
"0.603156",
"0.60089225",
"0.59770185",
"0.5941179",
"0.5941179",
"0.5917879",
"0.59170973",
"0.5884412",
"0.5858999",
"0.58254415",
"0.5802723",
"0.57957757"... | 0.7065071 | 0 |
Get float tuple attribute | def get_float_tuple(self, key, default=RequiredAttr()):
if key in self.attrs:
tshape = self.attrs[key]
return tuple(float(x.strip()) for x in
tshape.strip('()[]').split(','))
if isinstance(default, RequiredAttr):
raise AttributeError("Require... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_float(self, name):\n return self.field(name).toDouble()[0]",
"def get(self) -> float:\n ...",
"def get(self) -> list[float]:",
"def value(self) -> float:",
"def get_float2(self):\n pass",
"def getFloat(self, int: int, int2: int) -> float:\n ...",
"def tuple(self) -> ... | [
"0.6947683",
"0.64995533",
"0.646677",
"0.64302754",
"0.6405026",
"0.636478",
"0.6314991",
"0.6308329",
"0.6139215",
"0.6139215",
"0.6139215",
"0.6121712",
"0.6113931",
"0.60830843",
"0.6072688",
"0.6065176",
"0.6062541",
"0.6058387",
"0.60391164",
"0.6024105",
"0.6016953",
... | 0.69845355 | 0 |
Get int list attribute | def get_int_list(self, key, default=RequiredAttr()):
if key in self.attrs:
tshape = self.attrs[key]
return tuple(int(x.strip()) for x in tshape.strip('[]()').split(','))
if isinstance(default, RequiredAttr):
raise AttributeError("Required attribute {} not found.".form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_list_of_int2(self):\n pass",
"def getIntRow(self, int: int) -> typing.List[int]:\n ...",
"def getList(self):\n return self.value if not self.isInteger() else None",
"def get_list_index(self):\r\n s = self.query('LIST:IND?')\r\n return int(s)",
"def get_list_index(... | [
"0.66262454",
"0.6193669",
"0.61430955",
"0.60918474",
"0.60918474",
"0.6033879",
"0.59550107",
"0.5951969",
"0.59298927",
"0.5917252",
"0.5856964",
"0.5846401",
"0.5845549",
"0.58444774",
"0.58166885",
"0.57922244",
"0.5790361",
"0.5780653",
"0.5769435",
"0.57669526",
"0.575... | 0.69882196 | 0 |
Get the callable function from Relay based on operator name. | def get_relay_op(op_name):
if '.' in op_name:
# explicit hierachical modules
op = _op
try:
for opn in op_name.split('.'):
op = getattr(op, opn)
except AttributeError:
op = None
else:
# try search op in various modules
for ca... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_operators_function(self, operator):\n operators_function = self.operators_dict[operator]['function']\n return operators_function",
"def _get_impl(self, name: str) -> Optional[Callable]:\n if name in dir(operator):\n impl = getattr(operator, name)\n elif name in di... | [
"0.7406448",
"0.679072",
"0.66380924",
"0.6484281",
"0.64102334",
"0.6306777",
"0.63057077",
"0.6099966",
"0.6064666",
"0.6039508",
"0.6001269",
"0.5974583",
"0.59727806",
"0.5909024",
"0.5907584",
"0.5872211",
"0.5851213",
"0.57937634",
"0.5652419",
"0.5640223",
"0.5617097",... | 0.69795084 | 1 |
Wrapper for getting required attributes. | def _required_attr(self, attr, key):
assert isinstance(attr, dict)
if key not in attr:
raise AttributeError("Required attribute {} not found.".format(key))
return attr[key] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hasRequiredAttributes(self):\n return _libsbml.Replacing_hasRequiredAttributes(self)",
"def hasRequiredAttributes(self):\n return _libsbml.ListOfMembers_hasRequiredAttributes(self)",
"def hasRequiredAttributes(self):\n return _libsbml.Rule_hasRequiredAttributes(self)",
"def hasRequir... | [
"0.7227858",
"0.711518",
"0.7098395",
"0.70928067",
"0.7072372",
"0.704537",
"0.70103115",
"0.6975578",
"0.6929557",
"0.69076544",
"0.6905721",
"0.6814309",
"0.6813221",
"0.6799107",
"0.67813826",
"0.67778164",
"0.67716455",
"0.6765467",
"0.6757953",
"0.67148197",
"0.6710964"... | 0.7423325 | 0 |
Extention to infer_value that can be used when some input values are missing. This function creates dummy inputs with the same shape and random values then calls infer_value. This is helpful when implementing certain onnx operators where we need to evaluate the graph to determine a static shape. | def infer_value_simulated(input_val, params):
fake_params = []
# Add a fake copy of all missing params.
for free_param in analysis.free_vars(input_val):
if free_param.name_hint not in params:
fp_dtype = free_param.type_annotation.dtype
fp_shape = [s.value for s in free_param.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dummy_input(dataset=None, device=None, input_shape=None):\n def create_single(shape):\n t = torch.randn(shape)\n if device:\n t = t.to(device)\n return t\n\n def create_recurse(shape):\n if all(isinstance(x, int) for x in shape):\n return create_singl... | [
"0.6108313",
"0.6079087",
"0.58093524",
"0.57226783",
"0.5583185",
"0.55778635",
"0.5501691",
"0.54721665",
"0.53937286",
"0.5391811",
"0.53671724",
"0.53256667",
"0.53183067",
"0.5274428",
"0.5266232",
"0.52542746",
"0.5244573",
"0.5238319",
"0.5236556",
"0.5190879",
"0.5176... | 0.6968069 | 0 |
Extend the schema with extensions from a given document. Produces a new schema given an existing schema and a document which may contain GraphQL type extensions and definitions. The original schema will remain unaltered. Because a schema represents a graph of references, a schema cannot be extended without effectively ... | def extend_schema(
schema: GraphQLSchema,
document_ast: DocumentNode,
assume_valid=False,
assume_valid_sdl=False,
) -> GraphQLSchema:
assert_schema(schema)
if not isinstance(document_ast, DocumentNode):
"Must provide valid Document AST"
if not (assume_valid or assume_valid_sdl):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extend_schema(schema, documentAST=None):\n\n assert isinstance(schema, GraphQLSchema), \"Must provide valid GraphQLSchema\"\n assert documentAST and isinstance(\n documentAST, ast.Document\n ), \"Must provide valid Document AST\"\n\n # Collect the type definitions and extensions found in the... | [
"0.7152162",
"0.6199529",
"0.5654745",
"0.5047008",
"0.5010231",
"0.49995986",
"0.4997885",
"0.49345613",
"0.48233047",
"0.48126537",
"0.4781279",
"0.4780831",
"0.4719805",
"0.46937755",
"0.4683046",
"0.46628058",
"0.46534902",
"0.46362936",
"0.4603454",
"0.45834753",
"0.4577... | 0.78335834 | 0 |
Merges adjacent elements of list using the function merge if they satisfy the predicate should_merge. >>> merge_pairs([], None, None) [] >>> merge_pairs([1], None, None) [1] | def merge_pairs(list, should_merge, merge):
ret = []
i = 0
while i < len(list) - 1:
a = list[i]
b = list[i + 1]
if should_merge(a, b):
ret.append(merge(a, b))
i += 2
else:
ret.append(a)
i += 1
if i == len(list) - 1:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_merge_merges_two_pairs():\n L = [1, 3, 5]\n R = [2, 4, 6]\n assert merge(L, R) == [1, 2, 3, 4, 5, 6]",
"def _merge_pairs(heaps):\n iheap = iter(heaps)\n return reduce(_merge, starmap(_merge, zip_longest(iheap, iheap)), None)",
"def test_merge_on_unbalanced_lists():\n L = [2, 3, 4, 8]... | [
"0.59846586",
"0.5855778",
"0.584706",
"0.54605675",
"0.5450307",
"0.5439926",
"0.54203266",
"0.53817874",
"0.53332865",
"0.5297357",
"0.52889675",
"0.52856797",
"0.5274889",
"0.5241527",
"0.52391654",
"0.521954",
"0.520833",
"0.5199808",
"0.51718277",
"0.5171244",
"0.514888"... | 0.79013443 | 0 |
Syntactically converts the given formula to an equivalent formula that contains no constants or operators beyond ``'~'``, ``'&'``, and ``'|'``. | def to_not_and_or(formula: Formula) -> Formula:
# Task 3.5
map_operators = {'->': Formula.parse('(~p|q)'),
'+': Formula.parse('((p&~q)|(~p&q))'),
'<->': Formula.parse('~((p&~q)|(~p&q))'),
'-&': Formula.parse('~(p&q)'),
'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_not_and(formula: Formula) -> Formula:\r\n # Task 3.6a\r\n map_operators = {'->': Formula.parse('~(~~p&~q)'),\r\n '+': Formula.parse('~(~(p&~q)&~(~p&q))'),\r\n '<->': Formula.parse('~~(~(p&~q)&~(~p&q))'),\r\n '-&': Formula.parse('~(p&q)'),\r\n... | [
"0.78396636",
"0.73771214",
"0.7097078",
"0.6928427",
"0.68398327",
"0.67592794",
"0.63313806",
"0.614937",
"0.6135606",
"0.6120701",
"0.6105442",
"0.6054379",
"0.5904767",
"0.5886168",
"0.5857447",
"0.5810102",
"0.5789075",
"0.5750183",
"0.5743646",
"0.5663795",
"0.5609394",... | 0.7853216 | 0 |
Syntactically converts the given formula to an equivalent formula that contains no constants or operators beyond ``'~'`` and ``'&'``. | def to_not_and(formula: Formula) -> Formula:
# Task 3.6a
map_operators = {'->': Formula.parse('~(~~p&~q)'),
'+': Formula.parse('~(~(p&~q)&~(~p&q))'),
'<->': Formula.parse('~~(~(p&~q)&~(~p&q))'),
'-&': Formula.parse('~(p&q)'),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_not_and_or(formula: Formula) -> Formula:\r\n # Task 3.5\r\n\r\n map_operators = {'->': Formula.parse('(~p|q)'),\r\n '+': Formula.parse('((p&~q)|(~p&q))'),\r\n '<->': Formula.parse('~((p&~q)|(~p&q))'),\r\n '-&': Formula.parse('~(p&q)'),\r\n ... | [
"0.77717495",
"0.7425099",
"0.7160818",
"0.7018279",
"0.677997",
"0.6648497",
"0.62222594",
"0.62099564",
"0.6157961",
"0.6139761",
"0.60791767",
"0.6078416",
"0.58891666",
"0.58561105",
"0.58492416",
"0.5845347",
"0.57735455",
"0.5740163",
"0.56789494",
"0.55800474",
"0.5572... | 0.7865738 | 0 |
First collect all filter/exclude kwargs and apply any annotations. Then apply all filters at once, and all excludes at once. | def apply_queryset_rules(self, qs):
clauses = {
'filter': [],
'exclude': []}
for rule in self.drip_model.queryset_rules.all():
clause = clauses.get(rule.method_type, clauses['filter'])
kwargs = rule.filter_kwargs(qs, now=self.now)
clause.app... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_filters(self, queryset, applicable_filters=None, applicable_exclusions=None):\n if applicable_filters:\n queryset = queryset.filter(applicable_filters)\n if applicable_exclusions:\n queryset = queryset.exclude(applicable_exclusions)\n return queryset",
"def fi... | [
"0.61385673",
"0.6110174",
"0.5842964",
"0.5821749",
"0.58052117",
"0.57512754",
"0.5749911",
"0.56085443",
"0.55886805",
"0.5545914",
"0.55406946",
"0.55305916",
"0.5476483",
"0.5461148",
"0.54527724",
"0.54313934",
"0.54216677",
"0.5406818",
"0.5334862",
"0.53316426",
"0.53... | 0.6466627 | 0 |
Do an exclude for all Users who have a SentDrip already. | def prune(self):
target_user_ids = self.get_queryset().values_list('id', flat=True)
exclude_user_ids = SentDrip.objects.filter(date__lt=conditional_now(),
drip=self.drip_model,
user__id__in=target_user_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_user_is_excluded_from_deleted_conversation(self):\n conv = G(Conversation, type=CONVERSATION_TYPE_CHAT, creator=self.user1,\n users=[self.user1, self.user2])\n self.login(self.user2)\n self.client.delete(self.get_url(conv.pk))\n self.assertNotIn(self.user2,\n ... | [
"0.6179749",
"0.61499584",
"0.61499584",
"0.6137465",
"0.6028033",
"0.5863789",
"0.5830699",
"0.57538897",
"0.5730778",
"0.57232326",
"0.5718191",
"0.5688476",
"0.56523585",
"0.5635312",
"0.56094944",
"0.55972457",
"0.5579404",
"0.55664945",
"0.5528624",
"0.5520288",
"0.55186... | 0.7648101 | 0 |
Send the message to each user on the queryset. Create SentDrip for each user that gets a message. Returns count of created SentDrips. | def send(self):
if not self.from_email:
self.from_email = getattr(settings, 'DRIP_FROM_EMAIL', settings.DEFAULT_FROM_EMAIL)
MessageClass = message_class_for(self.drip_model.message_class)
count = 0
for user in self.get_queryset():
message_instance = MessageClass... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email_users():\n\n # Get users emails\n users_emails = User.objects.exclude(\n Q(email='') |\n Q(email=None)\n ).values_list(\n 'email',\n flat=True\n )\n\n # Send email to each user\n # for email_user in users_emails:\n\n title = 'Se han calculado nuevos H... | [
"0.62278306",
"0.6016069",
"0.59103787",
"0.58179075",
"0.5776858",
"0.5742175",
"0.57325256",
"0.57264173",
"0.57171",
"0.5660152",
"0.56478035",
"0.5600484",
"0.55936176",
"0.55391765",
"0.54784375",
"0.54368925",
"0.540159",
"0.54002535",
"0.5397534",
"0.53905976",
"0.5368... | 0.85237306 | 0 |
Returns a queryset of auth.User who meet the criteria of the drip. Alternatively, you could create Drips on the fly using a queryset builder from the admin interface... | def queryset(self):
User = get_user_model()
return User.objects | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self, *args, **kwargs):\n qs = super().get_queryset(*args, **kwargs).filter(user=self.request.user).filter(trip=self.kwargs[\"trip_pk\"])\n return qs",
"def get_queryset(self, **kwargs):\n username = self.request.user.username\n query = Meal.objects.filter(member__use... | [
"0.6366428",
"0.6234337",
"0.6199895",
"0.61049324",
"0.6045615",
"0.6038543",
"0.6038543",
"0.6038543",
"0.6018214",
"0.59551626",
"0.59536856",
"0.59344023",
"0.5931327",
"0.5927328",
"0.59158546",
"0.5913066",
"0.5899185",
"0.58891493",
"0.5865894",
"0.5847154",
"0.5839151... | 0.6318245 | 1 |
Get value of `v` variable for user given. | def get_value(v):
# try to get attribute from user
obj = getattr(user, v, None)
# if no, search for corresponding method in MailgunBatchMessage
if not obj:
obj = getattr(self, 'get_var_' + v, None)
if obj:
obj = functool... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __getitem__(self, v):\r\n return self.unif.get(v, (v, None))[0]",
"def get_test_value(v):\r\n if not isinstance(v, graph.Variable):\r\n v_var = theano.tensor.as_tensor_variable(v)\r\n else:\r\n v_var = v\r\n return PureOp._get_test_value(v_var)",
"def val(self):\n return se... | [
"0.67969924",
"0.6555199",
"0.62935513",
"0.6186055",
"0.6174981",
"0.6174981",
"0.6163416",
"0.61316735",
"0.61196446",
"0.61030054",
"0.5967322",
"0.5836284",
"0.58111215",
"0.58040035",
"0.5763369",
"0.570538",
"0.5653742",
"0.5628622",
"0.5621249",
"0.55765676",
"0.556653... | 0.7231402 | 0 |
Gets the sign_request of this Notification. | def sign_request(self):
return self._sign_request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_request(self, sign_request):\n\n self._sign_request = sign_request",
"def signer_info(self):\n return self.content['signer_infos'][0]",
"def signrequest(self, signrequest):\n\n self._signrequest = signrequest",
"def signature_receipt(self):\n return self._signature_receip... | [
"0.6505988",
"0.64640635",
"0.6310958",
"0.6199028",
"0.6162181",
"0.61612487",
"0.6047868",
"0.60037017",
"0.60037017",
"0.5997262",
"0.5997262",
"0.5997262",
"0.59881365",
"0.5966498",
"0.5892732",
"0.57776195",
"0.5770622",
"0.57574916",
"0.5697886",
"0.565307",
"0.5627128... | 0.85575163 | 0 |
Sets the sign_request of this Notification. | def sign_request(self, sign_request):
self._sign_request = sign_request | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signrequest(self, signrequest):\n\n self._signrequest = signrequest",
"def sign_request(self):\n return self._sign_request",
"def sign_date(self, sign_date):\n\n self._sign_date = sign_date",
"def signature_flag(self, signature_flag):\n\n self._signature_flag = signature_flag"... | [
"0.84742993",
"0.64590573",
"0.620037",
"0.6148148",
"0.6113091",
"0.5792947",
"0.5792947",
"0.57670236",
"0.57670236",
"0.5736216",
"0.5673617",
"0.5673617",
"0.56619704",
"0.5566606",
"0.55310297",
"0.5487905",
"0.5442937",
"0.5238676",
"0.52140945",
"0.5198234",
"0.5179636... | 0.8737033 | 0 |
Gets the reminder of this Notification. | def reminder(self):
return self._reminder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_reminder(self, pk):\n try:\n return TimeReminder.objects.get(pk=pk)\n except TimeReminder.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)",
"def get_reminder(self, pk):\n try:\n return LastResortReminder.objects.get(pk=pk)\n e... | [
"0.71455425",
"0.6891089",
"0.678316",
"0.6735698",
"0.659876",
"0.659876",
"0.65116197",
"0.64684063",
"0.63896084",
"0.6327286",
"0.6277262",
"0.6274905",
"0.60776114",
"0.6037533",
"0.5978656",
"0.59326404",
"0.5782124",
"0.5731846",
"0.57160497",
"0.57128954",
"0.5712109"... | 0.8614829 | 0 |
Sets the reminder of this Notification. | def reminder(self, reminder):
self._reminder = reminder | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reminder(self):\n return self._reminder",
"def send_reminder(self):\n pass",
"def remind():\n ntftion.notify('reminder', f\"{self.notification}:\\n{self.work_name}\\n{self.work_datetime.hour}: \"\n f\"{self.work_datetime.minute} \", app_icon='r... | [
"0.70754886",
"0.69571507",
"0.69405735",
"0.6228798",
"0.61394835",
"0.6040281",
"0.58387345",
"0.5768717",
"0.57459015",
"0.56309134",
"0.5608622",
"0.55782384",
"0.5551046",
"0.5505801",
"0.549583",
"0.5485203",
"0.5457215",
"0.5457215",
"0.54363394",
"0.54363394",
"0.5431... | 0.86430067 | 0 |
Gets the signature_receipt of this Notification. | def signature_receipt(self):
return self._signature_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def signature(self):\n return self._signature",
"def signature(self) -> object:\n return self._signature",
"def signature(se... | [
"0.70089465",
"0.6790117",
"0.6790117",
"0.6790117",
"0.67468214",
"0.67468214",
"0.66194445",
"0.6583787",
"0.6546591",
"0.6222418",
"0.60791725",
"0.59909457",
"0.59747934",
"0.59122163",
"0.5862758",
"0.5801572",
"0.5718406",
"0.566632",
"0.55493283",
"0.5482278",
"0.54530... | 0.87627965 | 0 |
Sets the signature_receipt of this Notification. | def signature_receipt(self, signature_receipt):
self._signature_receipt = signature_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature",
"def signature(self, signature: object):\n\n self._signature = signature"... | [
"0.6701163",
"0.6701163",
"0.6632486",
"0.6632486",
"0.6313848",
"0.62911636",
"0.6196344",
"0.6086643",
"0.6081512",
"0.59637827",
"0.5959168",
"0.58943254",
"0.58943254",
"0.5879025",
"0.5794835",
"0.5639368",
"0.5639368",
"0.562514",
"0.5517498",
"0.5482735",
"0.54577374",... | 0.8634348 | 0 |
Gets the final_receipt of this Notification. | def final_receipt(self):
return self._final_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def final_receipt(self, final_receipt):\n\n self._final_receipt = final_receipt",
"def signature_receipt(self):\n return self._signature_receipt",
"def expired_receipt(self):\n return self._expired_receipt",
"def canceled_receipt(s... | [
"0.77169365",
"0.7076309",
"0.6723085",
"0.61884576",
"0.5989326",
"0.52719885",
"0.51912034",
"0.5185656",
"0.5172056",
"0.51552427",
"0.51406",
"0.5103925",
"0.51008695",
"0.50596833",
"0.5029491",
"0.5015495",
"0.5008211",
"0.49744728",
"0.49663818",
"0.49422437",
"0.49082... | 0.8890507 | 0 |
Sets the final_receipt of this Notification. | def final_receipt(self, final_receipt):
self._final_receipt = final_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def final_receipt(self):\n return self._final_receipt",
"def final_fee(self, final_fee):\n\n self._final_fee = final_fee",
"def signature_receipt(self, signature_receipt):\n\n self._signature_receipt = signature_receipt",
"def receipt_date(self, receipt_date):\n\n self._receipt_da... | [
"0.71738446",
"0.68162334",
"0.59358484",
"0.55554044",
"0.55554044",
"0.5494866",
"0.54874605",
"0.510274",
"0.5064916",
"0.47631332",
"0.46558532",
"0.46454015",
"0.4602984",
"0.45904246",
"0.45539644",
"0.44825977",
"0.4455887",
"0.44092995",
"0.43887445",
"0.43840337",
"0... | 0.9068991 | 0 |
Gets the canceled_receipt of this Notification. | def canceled_receipt(self):
return self._canceled_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def canceled_receipt(self, canceled_receipt):\n\n self._canceled_receipt = canceled_receipt",
"def expired_receipt(self):\n return self._expired_receipt",
"def cancel_reason(self):\n return self._dict.get('cancel_reason')",
"def fi... | [
"0.6706422",
"0.6338433",
"0.60910046",
"0.5974326",
"0.5619224",
"0.5595106",
"0.5568138",
"0.5519622",
"0.5397197",
"0.53215355",
"0.5230794",
"0.5083148",
"0.50725925",
"0.50639725",
"0.50222707",
"0.50041664",
"0.4978102",
"0.4965941",
"0.49254417",
"0.49073887",
"0.48796... | 0.8553076 | 0 |
Sets the canceled_receipt of this Notification. | def canceled_receipt(self, canceled_receipt):
self._canceled_receipt = canceled_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def canceled_receipt(self):\n return self._canceled_receipt",
"def SetEditCanceled(self, editCancelled):\r\n\r\n self._editCancelled = editCancelled",
"def SetEditCanceled(self, editCancelled):\r\n\r\n self.editCancelled = editCancelled",
"def mark_cancelled(self):\n self.status =... | [
"0.7068766",
"0.5886961",
"0.57902795",
"0.5752808",
"0.5700536",
"0.562062",
"0.5521638",
"0.54572934",
"0.54282314",
"0.53707474",
"0.5233155",
"0.513378",
"0.5099384",
"0.50112",
"0.50112",
"0.4962524",
"0.49221703",
"0.49004206",
"0.4857812",
"0.48547903",
"0.4841269",
... | 0.880762 | 0 |
Gets the expired_receipt of this Notification. | def expired_receipt(self):
return self._expired_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getReceipt(self):\n return self._Receipt",
"def canceled_receipt(self):\n return self._canceled_receipt",
"def expired_receipt(self, expired_receipt):\n\n self._expired_receipt = expired_receipt",
"def signature_receipt(self):\n return self._signature_receipt",
"def final_re... | [
"0.6830866",
"0.6528994",
"0.64108986",
"0.6122404",
"0.611016",
"0.5972135",
"0.59301025",
"0.58057636",
"0.57681483",
"0.56331587",
"0.5622614",
"0.56137514",
"0.55514413",
"0.55232537",
"0.5511145",
"0.5458906",
"0.54523116",
"0.5428282",
"0.53302795",
"0.5286335",
"0.5271... | 0.8766947 | 0 |
Sets the expired_receipt of this Notification. | def expired_receipt(self, expired_receipt):
self._expired_receipt = expired_receipt | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expired_receipt(self):\n return self._expired_receipt",
"def set_expired(self, bExpired):\n self._bExpired = bExpired",
"def canceled_receipt(self, canceled_receipt):\n\n self._canceled_receipt = canceled_receipt",
"def receipt_date(self, receipt_date):\n\n self._receipt_date ... | [
"0.69136924",
"0.65413976",
"0.6506499",
"0.6205384",
"0.6205384",
"0.58310276",
"0.57295185",
"0.5686164",
"0.5681967",
"0.56405723",
"0.55964017",
"0.5468952",
"0.53696054",
"0.53485996",
"0.52808875",
"0.52037495",
"0.51817936",
"0.51682025",
"0.514733",
"0.5086682",
"0.50... | 0.89509016 | 0 |
Default deserializer for the configuration. Decodes the dictionary of configurations and returns the object. It will be a new object, so singleton as expected. | def deserialize(cls, serial_obj):
dct = json.loads(serial_obj, object_hook=CustomTypeDecoder)
env = Configuration.Configuration()
env.update(dct)
return env | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __json_decode__(cls, value: Dict[str, Any]) -> \"BaseDiscriminator\":\r\n return cls.from_config(value)",
"def deserialize_file(cls, file_path='./data.json'):\n file_stream = open(file_path, 'rb')\n dct = json.load(file_stream, object_hook=CustomTypeDecoder)\n file_stream.close()\... | [
"0.6742495",
"0.67256796",
"0.6695552",
"0.66199493",
"0.66149414",
"0.6585057",
"0.65694356",
"0.6452336",
"0.6362264",
"0.6359893",
"0.6345447",
"0.63241106",
"0.6318138",
"0.63063115",
"0.6304159",
"0.62719494",
"0.6264559",
"0.62456566",
"0.622678",
"0.6191434",
"0.617835... | 0.71628773 | 0 |
Default deserializer from a file for the configuration. | def deserialize_file(cls, file_path='./data.json'):
file_stream = open(file_path, 'rb')
dct = json.load(file_stream, object_hook=CustomTypeDecoder)
file_stream.close()
env = Configuration.Configuration()
env.update(dct)
return env | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(filepath):\n with open(filepath) as f:\n return Config(json.load(f))",
"def read(cls, filename: str) -> Objdict:\n obj = config.read(filename)\n return cls.from_obj(obj)",
"def read_config(self) -> dict:\n\n if self.valid_is_json():\n with open(self.fi... | [
"0.7235232",
"0.6988427",
"0.68567115",
"0.6852458",
"0.6785788",
"0.6767773",
"0.67407274",
"0.6733364",
"0.672874",
"0.6721311",
"0.6638073",
"0.6601209",
"0.66008145",
"0.65727854",
"0.6547221",
"0.643465",
"0.6431324",
"0.64131236",
"0.6400986",
"0.63889885",
"0.6385047",... | 0.7814111 | 0 |
Read a signed Int8 Address The address of the device Register the register to read from Read_Int8 signed 8 bit integer | def Read_Int8(self,Address,Register):
return struct.unpack('b',self.Transaction(chr(Address+1)+chr(Register),3)[1][2])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Read_uInt8(self,Address,Register):\n return struct.unpack('B',self.Transaction(chr(Address+1)+chr(Register),3)[1][2])[0]",
"def Read_uInt8s(self,Address,Register,Number=0):\n pass",
"def read_S8(self, register):\n raise NotImplementedError",
"def peek8(self,adr,memory=\"vn\"):\n ... | [
"0.78665906",
"0.77179676",
"0.71487117",
"0.7134326",
"0.70481306",
"0.7047891",
"0.70005065",
"0.6967565",
"0.69378",
"0.6895548",
"0.68713015",
"0.6766169",
"0.66373456",
"0.6619421",
"0.6604791",
"0.65506357",
"0.64697355",
"0.64616907",
"0.6460209",
"0.6424792",
"0.63670... | 0.8052241 | 0 |
Write a signed Int8 Address The address of the device Register The register to write to Int8 Data to write | def Write_Int8(self,Address,Register,Int8):
self.Transaction(chr(Address)+chr(Register)+struct.pack('b',Int8)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt8(self,Address,Register,uInt8):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('B',uInt8))",
"def Write_uInt8s(self,Address,Register,*Bytes):\n\n self.Transaction(chr(Address)+chr(Register)+''.join([chr(b) for b in Bytes]))",
"def write8(self, register, value):\n r... | [
"0.78396",
"0.7361376",
"0.7318864",
"0.71235067",
"0.69756967",
"0.67618924",
"0.67304933",
"0.6645114",
"0.6605967",
"0.65409344",
"0.6473072",
"0.64430517",
"0.63728863",
"0.63628685",
"0.63356644",
"0.63318735",
"0.63112986",
"0.62819844",
"0.62717485",
"0.62658685",
"0.6... | 0.7935615 | 0 |
Write a unsigned Int8 Address The address of the device Register The register to write to Int8 Data to write | def Write_uInt8(self,Address,Register,uInt8):
self.Transaction(chr(Address)+chr(Register)+struct.pack('B',uInt8)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_Int8(self,Address,Register,Int8):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('b',Int8))",
"def Write_uInt8s(self,Address,Register,*Bytes):\n\n self.Transaction(chr(Address)+chr(Register)+''.join([chr(b) for b in Bytes]))",
"def i2c_write8(self, address, register, value):\... | [
"0.783875",
"0.73918885",
"0.7331926",
"0.72815585",
"0.7139815",
"0.6933486",
"0.69315565",
"0.687477",
"0.6825541",
"0.66600263",
"0.66334826",
"0.66192186",
"0.6473537",
"0.64359456",
"0.6399895",
"0.63837516",
"0.63691723",
"0.6330402",
"0.627311",
"0.6237708",
"0.6192998... | 0.78742146 | 0 |
Read an List of uInt8 (byte) Address The address of the device Register The register to read from Number The amount of byes to read, if 0 or not set, an unexpected length is received Read_uInt8s list of Unsigned 8 bit integers | def Read_uInt8s(self,Address,Register,Number=0):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_U8(self, register):\n raise NotImplementedError",
"def Read_uInt8(self,Address,Register):\n return struct.unpack('B',self.Transaction(chr(Address+1)+chr(Register),3)[1][2])[0]",
"def Read_Int8(self,Address,Register):\n return struct.unpack('b',self.Transaction(chr(Address+1)+chr(R... | [
"0.68012553",
"0.67983985",
"0.6527978",
"0.6481418",
"0.62438405",
"0.6164902",
"0.6121828",
"0.61210364",
"0.61069214",
"0.6106025",
"0.6084902",
"0.6079088",
"0.6065211",
"0.596804",
"0.5954369",
"0.592658",
"0.5841965",
"0.57755846",
"0.5775408",
"0.57601494",
"0.57580096... | 0.79105335 | 0 |
Write an List of uInt8 (byte) Address The address of the device Register The register to write to Bytes any number of uInt8 parameters to send | def Write_uInt8s(self,Address,Register,*Bytes):
self.Transaction(chr(Address)+chr(Register)+''.join([chr(b) for b in Bytes])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_byte_data(self, value, register_address):\n if type(value) != list:\n value = [value]\n with SMBus(self.i2c_bus) as bus:\n bus.write_i2c_block_data(self.i2c_address, register_address, value)",
"def write_list(self, register, data):\n raise NotImplementedError"... | [
"0.67981577",
"0.6704531",
"0.6608552",
"0.65305793",
"0.6474144",
"0.6448826",
"0.63122416",
"0.6308248",
"0.62680376",
"0.62366146",
"0.6151094",
"0.61090803",
"0.59915066",
"0.5980886",
"0.59801805",
"0.5963657",
"0.5905106",
"0.5874926",
"0.58645827",
"0.5826516",
"0.5776... | 0.7205725 | 0 |
Read a unsigned Int16 Address The address of the device Register the register to read from Read_uInt16 Unsigned 16 bit integer | def Read_uInt16(self,Address,Register):
return struct.unpack('H',self.Transaction(chr(Address+1)+chr(Register),6)[1][2:4])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_u16(self) -> int:\n ...",
"def read_u16(self) -> int:",
"def Read_uInt16s(self,Address,Register,Number):\n pass",
"def read_uint16(self):\n return self.read(BitTypes.UINT_16.value)",
"def swd_read16(self, offset):\n value = self._dll.JLINK_SWD_GetU16(offset)\n re... | [
"0.81635886",
"0.8032624",
"0.7999498",
"0.7777916",
"0.7513588",
"0.718891",
"0.717321",
"0.7160988",
"0.71514785",
"0.7083056",
"0.70489675",
"0.6846207",
"0.6826202",
"0.68191516",
"0.6800038",
"0.6758055",
"0.67399687",
"0.6699592",
"0.6612511",
"0.6579253",
"0.65281314",... | 0.8291817 | 0 |
Write a unsigned Int16 Address The address of the device Register The register to write to uInt16 Data to write | def Write_uInt16(self,Address,Register,uInt16):
self.Transaction(chr(Address)+chr(Register)+struct.pack('H',uInt16)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt16s(self,Address,Register,*Word):\n\n pass",
"def memory_write16(self, addr, data, zone=None):\n return self.memory_write(addr, data, zone, 16)",
"def write16(self, register, value):\n raise NotImplementedError",
"def flash_write16(self, addr, data):\n return self.fl... | [
"0.82063425",
"0.78181696",
"0.7634962",
"0.7389971",
"0.72749937",
"0.71342576",
"0.7091859",
"0.6815001",
"0.68047065",
"0.6748137",
"0.6543162",
"0.64805824",
"0.6379333",
"0.63238686",
"0.6302137",
"0.6252054",
"0.6250519",
"0.6199664",
"0.61417335",
"0.6091105",
"0.60829... | 0.8541705 | 0 |
Read an List of uInt16 (byte) Address The address of the device Register The register to read from Number The amount of uInt to read, if 0 or not set, an unexpected length is received Read_uInt16s list of Unsigned 8 bit integers | def Read_uInt16s(self,Address,Register,Number):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_u16(self) -> int:\n ...",
"def read_u16(self) -> int:",
"def Read_uInt16(self,Address,Register):\n return struct.unpack('H',self.Transaction(chr(Address+1)+chr(Register),6)[1][2:4])[0]",
"def read_uint16(self):\n return self.read(BitTypes.UINT_16.value)",
"def read_U16LE(self,... | [
"0.75358695",
"0.7459875",
"0.73276025",
"0.69784",
"0.6963508",
"0.6702258",
"0.66774035",
"0.6658045",
"0.66127485",
"0.6599928",
"0.6591615",
"0.65362215",
"0.65305805",
"0.6488654",
"0.6485442",
"0.6409686",
"0.6398612",
"0.63246655",
"0.63168716",
"0.6293406",
"0.6272483... | 0.81322134 | 0 |
Write an List of uInt16 Address The address of the device Register The register to write to Bytes any number of uInt16 parameters to send | def Write_uInt16s(self,Address,Register,*Word):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt16(self,Address,Register,uInt16):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('H',uInt16))",
"def write16bit(self, register, value):\n if value > ((2 ** 16) - 1) or value < 0:\n raise ValueError\n valuearray = struct.pack('!H', value) # Place value int... | [
"0.7146254",
"0.68336576",
"0.6811218",
"0.6624079",
"0.63176405",
"0.62738127",
"0.6254202",
"0.6227875",
"0.5980343",
"0.59563285",
"0.5932073",
"0.5927485",
"0.59186816",
"0.58876306",
"0.58745456",
"0.5827044",
"0.58204675",
"0.58200586",
"0.5818447",
"0.5809733",
"0.5693... | 0.76751184 | 0 |
Read a signed Int32 Address The address of the device Register the register to read from Read_Int32 signed 32 bit integer | def Read_Int32(self,Address,Register):
return struct.unpack('i',self.Transaction(chr(Address+1)+chr(Register),6)[1][2:6])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Read_uInt32(self,Address,Register):\n return struct.unpack('I',self.Transaction(chr(Address+1)+chr(Register),6)[1][2:6])[0]",
"def read_int32(self):\n return self.read(BitTypes.INT_32.value)",
"def UINT32(dump,addr):\n return dump.ROM[addr]",
"def read_uint32(self):\n bytes = self... | [
"0.7938116",
"0.73023224",
"0.7083806",
"0.7060345",
"0.70138675",
"0.70011234",
"0.69925785",
"0.6991219",
"0.698009",
"0.69768965",
"0.6795787",
"0.67492425",
"0.673381",
"0.66784495",
"0.6527868",
"0.6515315",
"0.6489014",
"0.64860344",
"0.64565074",
"0.64469045",
"0.64072... | 0.8088217 | 0 |
Write a signed Int32 Address The address of the device Register The register to write to Int32 Data to write | def Write_Int32(self,Address,Register,Int32):
self.Transaction(chr(Address)+chr(Register)+struct.pack('i',Int32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_uInt32(self,Address,Register,uInt32):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('I',uIt32))",
"def memory_write32(self, addr, data, zone=None):\n return self.memory_write(addr, data, zone, 32)",
"def flash_write32(self, addr, data):\n return self.flash_write(addr,... | [
"0.7897174",
"0.7593963",
"0.6945903",
"0.6867116",
"0.68060774",
"0.6795882",
"0.67681146",
"0.6661644",
"0.66553354",
"0.6640903",
"0.65995103",
"0.65927786",
"0.6588998",
"0.6540409",
"0.64840925",
"0.6438452",
"0.6419408",
"0.6414085",
"0.6382138",
"0.6367795",
"0.6358461... | 0.802687 | 0 |
Read a unsigned Int32 Address The address of the device Register the register to read from Read_uInt32 Unsigned 32 bit integer | def Read_uInt32(self,Address,Register):
return struct.unpack('I',self.Transaction(chr(Address+1)+chr(Register),6)[1][2:6])[0] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UINT32(dump,addr):\n return dump.ROM[addr]",
"def read_u32(self, addr):\n if not self._is_u32(addr):\n raise ValueError('The addr parameter must be an unsigned 32-bit value.')\n\n addr = ctypes.c_uint32(addr)\n data = ctypes.c_uint32()\n\n result = self._lib.NRFJPROG... | [
"0.7614109",
"0.75956124",
"0.7490897",
"0.7431615",
"0.7270321",
"0.7042093",
"0.7041247",
"0.67477655",
"0.6741279",
"0.6723369",
"0.6624384",
"0.65658647",
"0.65604794",
"0.65059125",
"0.6457537",
"0.64132166",
"0.6392351",
"0.6358857",
"0.6324301",
"0.6317787",
"0.6312699... | 0.82531214 | 0 |
Write a unsigned Int32 Address The address of the device Register The register to write to uInt32 Data to write | def Write_uInt32(self,Address,Register,uInt32):
self.Transaction(chr(Address)+chr(Register)+struct.pack('I',uIt32)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Write_Int32(self,Address,Register,Int32):\n self.Transaction(chr(Address)+chr(Register)+struct.pack('i',Int32))",
"def memory_write32(self, addr, data, zone=None):\n return self.memory_write(addr, data, zone, 32)",
"def write_u32(self, addr, data, control):\n if not self._is_u32(addr):... | [
"0.7766806",
"0.7403072",
"0.7294441",
"0.7015551",
"0.691147",
"0.68457687",
"0.67176855",
"0.6678525",
"0.66594285",
"0.6647543",
"0.65600866",
"0.65094566",
"0.6473076",
"0.6463868",
"0.6458747",
"0.6426765",
"0.64085823",
"0.6339451",
"0.63279176",
"0.6283313",
"0.6238975... | 0.81594443 | 0 |
Read a string Address The address of the device Register The register to read from MaxLen Maximum length of string to receive (it handles '0' terminated strings) Read_String String | def Read_String(self,Address,Register,MaxLen=0x20):
ret,rxbuf = self.Transaction(chr(Address+1)+chr(Register),MaxLen)
return string_at(addressof(rxbuf)+2) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Read_String(self, size = 0, encoding='UTF-8', errors='strict'):\r\n if size == 0: size = self.Port.inWaiting()\r\n data = self.Port.read(size)\r\n return data.decode(encoding = encoding, errors = errors)",
"def read_string(self, register, length):\n return bytearray(self.device.re... | [
"0.70028126",
"0.6980602",
"0.6883572",
"0.67737055",
"0.6616408",
"0.6616312",
"0.6552851",
"0.651481",
"0.649733",
"0.6468191",
"0.6396641",
"0.63574106",
"0.6341653",
"0.6228547",
"0.6160232",
"0.61100286",
"0.6099237",
"0.6007269",
"0.60037875",
"0.59350383",
"0.5926568",... | 0.8516193 | 0 |
Write a string Address The address of the device Register The register to write to String The String to write MaxLen Maximum length of string to send | def Write_String(self,Address,Register,String,MaxLen=0x20):
if len(String)>MaxLen:
String=String[0:20]
self.Transaction(chr(Address)+chr(Register)+String) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_string(self, registeraddress, textstring, numberOfRegisters=16):\n _checkInt(numberOfRegisters, minvalue=1, description='number of registers for write string')\n _checkString(textstring, 'input string', minlength=1, maxlength=2 * numberOfRegisters)\n self._genericCommand(16, register... | [
"0.7139596",
"0.6873426",
"0.671522",
"0.6573955",
"0.6182657",
"0.60370183",
"0.6036801",
"0.5979046",
"0.58727807",
"0.5844694",
"0.58355594",
"0.5822651",
"0.5804149",
"0.5785666",
"0.578189",
"0.57627696",
"0.5735659",
"0.57321703",
"0.57269746",
"0.5692011",
"0.56371427"... | 0.8200132 | 0 |
device The I2C bus to use e.g. /dev/i2c0, /dev/i2c1 etc. Port Default=None if set to an Integer this will be the TCP/IP port to listen on. Server Default=None if set to a string e.g. '192.168.200.137' the bus listening on that address/port combination will be connected to. Ckeck for Raspberry Pi, and its version in /Pr... | def __init__(self,device=0,Port=None,Server=None):
self.Port = Port
self.Server=Server
if self.Server != None: # TCP Client mode
self.NetInit()
self.Transaction=self._NetTransaction
else:
try:
self.I2cBus = SMBus(device)
ex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_smbus():\n i2c__bus = 1\n # detect the device that is being used\n device = platform.uname()[1]\n\n if device == \"orangepione\": # running on orange pi one\n i2c__bus = 0\n\n elif device == \"orangepiplus\": # running on orange pi plus\n i2c__bus ... | [
"0.6020106",
"0.59051126",
"0.5800702",
"0.57668036",
"0.5684478",
"0.56790775",
"0.5578225",
"0.55659646",
"0.55587167",
"0.55345947",
"0.552737",
"0.55182916",
"0.5458657",
"0.5458213",
"0.5458213",
"0.5447071",
"0.54229194",
"0.54229194",
"0.5421495",
"0.5400966",
"0.53800... | 0.68887323 | 0 |
device Any SPIBus device in /dev, default /dev/spidev0.0 delay SPI Bus delay between transactions in ms, default 0 speed Set the Bus Speed (Obsolete) bits Number of bits in a data word, default = 8 Port Default=None if set to an Integer this will be the TCP/IP port to listen on. Server Default=None if set to a string e... | def __init__(self, device = '/dev/spidev0.0', delay = 40, speed = 200000, bits = 8,Port=None,Server=None):
self.Port = Port
self.Server=Server
if self.Server != None:
self.Transaction=self._NetTransaction
else:
if self.Port != None: # Init Server Thread
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spi_controller(\n # ---[ Module Ports]---\n glbl, # global interface, clock, reset, etc.\n spibus, # external SPI bus\n # optional ports\n fifobus=None, # streaming interface, FIFO bus\n mmbus=None, # memory-mapped bus, contro status access\n cso=None, # control-st... | [
"0.624048",
"0.6078499",
"0.6019561",
"0.5922347",
"0.59178054",
"0.5847743",
"0.5753442",
"0.5743636",
"0.5731967",
"0.56904924",
"0.5669521",
"0.55726254",
"0.5566881",
"0.5560543",
"0.5515413",
"0.5515413",
"0.5515413",
"0.5515413",
"0.5515413",
"0.5515413",
"0.55007553",
... | 0.6545486 | 0 |
Do a SPI Transaction OutBuffer mandatory String, containing chr(Address)+chr(Command)+chr(databyte 1)+.... read Number of bytes to read from the SPI device There would be no need to call this method as normally Read/Write methods would be called. | def Transaction(self,OutBuffer, read = 0):
ReceiveBuffer = create_string_buffer(chr(0) * 0x80)
TransmitBuffer= create_string_buffer(OutBuffer)
Transaction = spi_ioc_transfer()
Transaction.speed_hz = c_uint32(self.Speed)
Transaction.tx_buf=addressof(TransmitBuffer)
Transac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SPItrans(self,data):\n self.data=data;\n self.writecmd(0x01,0x00,len(data),data);\n return self.data;",
"def comTxRx(self, cmd, dataOut, length):\n if DEBUG > 1: sys.stderr.write(\"* comTxRx()\\n\")\n txFrame = b''\n rxHeader = 0\n rxNum = 0\n\n ... | [
"0.63117373",
"0.6113982",
"0.5917034",
"0.5878923",
"0.58540875",
"0.5797914",
"0.57559353",
"0.575137",
"0.564221",
"0.56343573",
"0.55112803",
"0.548802",
"0.54583234",
"0.5438905",
"0.5434643",
"0.543079",
"0.54177696",
"0.5386856",
"0.53701365",
"0.53331035",
"0.5269813"... | 0.73968476 | 0 |
returns the Identification string of this board Ident String | def Ident(self):
return self.Bus.Read_String(self.Address,Ident) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_identifier_string(self):\n return self.identifier",
"def identification(self):\n return remove_whitespace(str(self))",
"def get_debug_firmware_id_string(self):\n # Read the address via get_var_strict; this will fetch the value\n # from chipdata as well, but we can ignore it.... | [
"0.6987778",
"0.67978716",
"0.6764644",
"0.6748439",
"0.65874225",
"0.6544882",
"0.6525158",
"0.6523529",
"0.65140986",
"0.6489128",
"0.6487459",
"0.64666474",
"0.6437531",
"0.6412842",
"0.6400601",
"0.6344795",
"0.63359374",
"0.63288873",
"0.63056296",
"0.6302307",
"0.628118... | 0.719106 | 0 |
change the address of the board, It will update all internal addressing so the object will continue to work after changing. newaddress when set it will change to that address, if not It will retrun the board to it's default address. | def ChangeAddress(self, newaddress=None):
if newaddress == None:
newaddress = self.DefaultAddress
if self.Address != newaddress:
self.Bus.Write_uInt8(self.Address,0xF1,0x55)
self.Bus.Write_UInt8(self.Address,0xF2,0xAA)
self.Bus.Write_uInt8(self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def address(self, new_address):\n house_num, street_name, apt_num = new_address\n self._address.house_num = house_num\n self._address.street_name = street_name\n self._address.apt_num = apt_num",
"def changeAddress(self, newAddr):\n\n addresses = [0xD0, 0xD2, 0xD4, 0xD6, 0xD8, ... | [
"0.6968702",
"0.6779255",
"0.67633706",
"0.6653302",
"0.6354171",
"0.63050854",
"0.6036159",
"0.60305643",
"0.60068655",
"0.59433436",
"0.5938419",
"0.5926675",
"0.59057134",
"0.58873636",
"0.582803",
"0.5814446",
"0.57541937",
"0.5734992",
"0.5695932",
"0.5626893",
"0.560197... | 0.7784743 | 0 |
Print text on the given x/y position | def PrintAt(self,x=0,y=0,text=''):
self.SetCursor(x,y)
self.Print(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_text(TINY_FONT, x, y, text, color = white):\n text_image = TINY_FONT.render(text, True, color)\n gameDisplay.blit(text_image, (x,y))",
"def showText(self, surface, point, text, color=None, size=20):\n if not color: color = self.color\n v = self / 2\n point = v(point)\n ... | [
"0.75420284",
"0.7345843",
"0.73031473",
"0.72118306",
"0.71401596",
"0.71239936",
"0.71079236",
"0.70952535",
"0.7056604",
"0.7019968",
"0.69929975",
"0.6809417",
"0.68032587",
"0.67993826",
"0.67609805",
"0.674463",
"0.67254466",
"0.67141485",
"0.67134196",
"0.67089564",
"0... | 0.8542406 | 0 |
Read All buttons for them being pressed right now. an array of length self.PushButtons with boolean values, True when being pressed | def ReadAll(self):
v =self.Bus.Read_uInt8(self.Address,0x10)
Buttons = []
for i in range(0,self.PushButtons):
Buttons.append(v & 2**i == 2**i)
return Buttons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReportPressed(self):\n v =self.Bus.Read_uInt8(self.Address,0x30)\n Buttons = []\n for i in range(0,self.PushButtons):\n Buttons.append(v & 2**i == 2**i)\n return Buttons",
"def ReportPressedOnce(self):\n v =self.Bus.Read_uInt8(self.Address,0x31)\n Buttons ... | [
"0.8114529",
"0.7944816",
"0.7152064",
"0.70644414",
"0.70604044",
"0.69560605",
"0.6933124",
"0.6848978",
"0.68196493",
"0.68196493",
"0.68196493",
"0.6810601",
"0.666875",
"0.6630967",
"0.6573754",
"0.6516853",
"0.6513661",
"0.6398797",
"0.63832265",
"0.63609034",
"0.634874... | 0.8038649 | 1 |
Report if any button has been pressed since this method was last called. Will reset the register you can use this in a loop, be shure to flush the register beforehand by calling this once. If you keep a button pushed, it will read out ans True multiple times. an array of length self.PushButtons with boolean values, Tru... | def ReportPressed(self):
v =self.Bus.Read_uInt8(self.Address,0x30)
Buttons = []
for i in range(0,self.PushButtons):
Buttons.append(v & 2**i == 2**i)
return Buttons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReportPressedOnce(self):\n v =self.Bus.Read_uInt8(self.Address,0x31)\n Buttons = []\n for i in range(0,self.PushButtons):\n Buttons.append(v & 2**i == 2**i)\n return Buttons",
"def ReportPressed(self):\n Buttons = BitWizardPushButtons.ReportPressed(self)\n ... | [
"0.78948176",
"0.7165853",
"0.6681266",
"0.66426915",
"0.6507882",
"0.64714015",
"0.63386923",
"0.6328944",
"0.63090307",
"0.63068634",
"0.63040835",
"0.6297285",
"0.6280571",
"0.6242765",
"0.62305",
"0.62104577",
"0.61594784",
"0.6077292",
"0.60507023",
"0.60392195",
"0.6000... | 0.737288 | 1 |
Report if any button has been pressed since this method was last called. Will reset the register you can use this in a loop, be shure to flush the register beforehand by calling this once. an array of length self.PushButtons with boolean values, True if that button has been pressed If you keep a button pushed, it will ... | def ReportPressedOnce(self):
v =self.Bus.Read_uInt8(self.Address,0x31)
Buttons = []
for i in range(0,self.PushButtons):
Buttons.append(v & 2**i == 2**i)
return Buttons | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReportPressed(self):\n v =self.Bus.Read_uInt8(self.Address,0x30)\n Buttons = []\n for i in range(0,self.PushButtons):\n Buttons.append(v & 2**i == 2**i)\n return Buttons",
"def ReportPressed(self):\n Buttons = BitWizardPushButtons.ReportPressed(self)\n if ... | [
"0.7264512",
"0.71112067",
"0.66515493",
"0.6636008",
"0.64775056",
"0.64016086",
"0.631957",
"0.6290049",
"0.6268382",
"0.6246533",
"0.6244634",
"0.62072283",
"0.6203593",
"0.61756384",
"0.613776",
"0.6079891",
"0.60628754",
"0.5990521",
"0.59813625",
"0.5908591",
"0.5906919... | 0.7845797 | 0 |
Sets Set All outputs | def SetAllOutputs(self,value=0x00):
self.Bus.Write_uInt8(self.Address,0x10,value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __set_outputs__(self):\n self.__set_in_out_var__(None, 1)",
"def setOutputs(self, output_list):\n self.output_list = output_list",
"def set_outputs(self, outputs):\n self.attributes[\"outputs\"] = outputs",
"def clear_outputs(self):\n self.outputs = []",
"def outputs(self):\... | [
"0.8003771",
"0.67797655",
"0.6765054",
"0.66162467",
"0.66130114",
"0.64702857",
"0.63728154",
"0.63615733",
"0.6282863",
"0.62811464",
"0.6223294",
"0.6191807",
"0.61690444",
"0.61681104",
"0.61078674",
"0.60947853",
"0.60888416",
"0.6051391",
"0.6051391",
"0.604703",
"0.60... | 0.6815498 | 1 |
Set the timeout for the display Backlight, works for UI | def SetBacklightTimeout(self,Timeout):
self._BacklightTimeout = Timeout | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout(self):\n self._status_update(\"Pyloton: Timeout\")\n time.sleep(3)",
"def _banner_timeout(self):\n self.hide_banner()\n self._request_redraw()\n self.sm.on_state_event(self.events.TIMEOUT)",
"def set_timeout(self, wait):\n self._screen.timeout(wait)",
"de... | [
"0.70468503",
"0.69224423",
"0.6916143",
"0.68615156",
"0.66449136",
"0.658186",
"0.6576237",
"0.6575784",
"0.6442536",
"0.64272",
"0.63957685",
"0.62995005",
"0.6260351",
"0.6203594",
"0.61873376",
"0.61337364",
"0.6130251",
"0.6099144",
"0.60366535",
"0.5946312",
"0.5911457... | 0.75628906 | 0 |
Pushbutton ReportPressed to dim the backlight on RPi_Ui (Overide of BitWizardPushButtons.ReportPressed) | def ReportPressed(self):
Buttons = BitWizardPushButtons.ReportPressed(self)
if True in Buttons:
if self.TimedOut:
self.TimedOut=False
self.Backlight(self._Backlight)
Buttons = [False,False,False,False,False,False]
self._... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_action():\n if light_btn.isChecked():\n self.variables.default_values_dict[\"settings\"][\"external_lights\"] = True\n else:\n self.variables.default_values_dict[\"settings\"][\n \"external_lights\"\n ] = False",
"def... | [
"0.6728505",
"0.61880445",
"0.61630297",
"0.61123383",
"0.6055992",
"0.6053815",
"0.604196",
"0.6039217",
"0.599153",
"0.59292024",
"0.5919152",
"0.5907752",
"0.58741057",
"0.5823997",
"0.5814381",
"0.5796915",
"0.5794703",
"0.57796586",
"0.57780975",
"0.5756154",
"0.57455707... | 0.6972805 | 0 |
Since it is impossible to tell which LCD is connected it is impossible for the I2C/SPI.scan() method to create the proper instance. Pass the proper object reference (Not Instance), ie. LCD_16x2, LCD20x4 before scan is called. The system default is 20x4, change to 16x2 with SetAutoDetectLCD(LCD_16x2) | def SetAutodetectLCD(lcd):
SPI.DeviceList["spi_lcd"]= lcd
I2C.DeviceList["i2c_lcd"]= lcd | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, i2c, address=0x27, cols=2, rows=16, dotsize=LCD_5x8DOTS ):\n\t\tself.address = address\n\t\tself.i2c = i2c\n\t\tself.cols = cols\n\t\tself.rows = rows\n\t\tself._backlightval = LCD_NOBACKLIGHT\n\t\tself._displayfunction = None\n\t\tself._displaycontrol = None\n\t\tself._displaymode = None\n... | [
"0.6630001",
"0.59439677",
"0.5788926",
"0.56884766",
"0.5552669",
"0.5528249",
"0.54945964",
"0.54655087",
"0.5463934",
"0.54499257",
"0.5441803",
"0.54222804",
"0.53546727",
"0.53463024",
"0.5339335",
"0.5308705",
"0.5291431",
"0.5286333",
"0.52705914",
"0.5236894",
"0.5224... | 0.7400794 | 0 |
Since it is impossible to tell which LCD is connected it is impossible for the I2C/SPI.scan() method to create the proper instance. Pass the proper object reference(Not instance of), ie. RPi_Ui_16x2, RPi_Ui_20x4 before scan is called. the system default is 20x4, change to 16x2 with SetAutoDetectUi(RPi_Ui_16x2) | def SetAutoDetectUi(Ui):
SPI.DeviceList["spi_rpi_ui"]= Ui
I2C.DeviceList["i2c_rpi_ui"]= Ui | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAutodetectLCD(lcd):\n SPI.DeviceList[\"spi_lcd\"]= lcd \n I2C.DeviceList[\"i2c_lcd\"]= lcd",
"def __init__(self, i2c, address=0x27, cols=2, rows=16, dotsize=LCD_5x8DOTS ):\n\t\tself.address = address\n\t\tself.i2c = i2c\n\t\tself.cols = cols\n\t\tself.rows = rows\n\t\tself._backlightval = LCD_NO... | [
"0.6453533",
"0.63798755",
"0.59730196",
"0.5904277",
"0.5848181",
"0.58395076",
"0.5746525",
"0.57129997",
"0.56716585",
"0.5667914",
"0.56595755",
"0.5656416",
"0.5629506",
"0.5612086",
"0.5596658",
"0.5477269",
"0.5459482",
"0.54374117",
"0.54097146",
"0.53916657",
"0.5385... | 0.73700273 | 0 |
Function to convert Degree's to steps, used internally Degree @ retval int the amount of steps to make for the given Degree | def DegreeToSteps(self,Degree):
return int(round(Degree*(self.Reduction/self.StepAngle/2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def StepsToDegree(self,Steps):\n return int(round(Steps/(self.Reduction/self.StepAngle/2)))",
"def convertAngleToSteps(fltTheta):\r\n # TODO: Might have to be careful with rounding here to make sure that \r\n # the number of steps isn't exceeding the drawing surface.\r\n return int(round(fltTheta... | [
"0.77702314",
"0.67601454",
"0.659136",
"0.6129901",
"0.6084898",
"0.60727346",
"0.6030488",
"0.60034776",
"0.59928167",
"0.59865206",
"0.59865206",
"0.57927656",
"0.57707834",
"0.5734329",
"0.5669641",
"0.5616382",
"0.5610817",
"0.55463594",
"0.5466656",
"0.54575145",
"0.545... | 0.8635107 | 0 |
Function to convert steps to Degree's, used internally Steps @ retval int the amount of degrees to make rotated for the given steps | def StepsToDegree(self,Steps):
return int(round(Steps/(self.Reduction/self.StepAngle/2))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DegreeToSteps(self,Degree):\n return int(round(Degree*(self.Reduction/self.StepAngle/2)))",
"def steps_to_angle():\n pass",
"def convertAngleToSteps(fltTheta):\r\n # TODO: Might have to be careful with rounding here to make sure that \r\n # the number of steps isn't exceeding the drawing su... | [
"0.79061306",
"0.7653404",
"0.67190117",
"0.660746",
"0.6580089",
"0.6538874",
"0.6403662",
"0.6282578",
"0.62664586",
"0.61508554",
"0.6141019",
"0.61340106",
"0.6133048",
"0.61151785",
"0.6110795",
"0.6103478",
"0.6078138",
"0.6029091",
"0.601887",
"0.6012724",
"0.59948564"... | 0.88097495 | 0 |
Set the delay between steps in milliseconds. | def SetStepDelay(self,delay=200):
self.Bus.Transaction(chr(self.Address)+chr(0x43)+chr(delay)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_step_time(self, us):\n if us < 20: # 20 us is the shortest possible for esp8266\n self.step_time = 20\n else:\n self.step_time = us",
"def delay(ms: int, /) -> None:",
"def set_sleep_time(self, milliseconds:int):\n self.send_command(f\"configure mainLoopSleep... | [
"0.73977536",
"0.72625935",
"0.7138458",
"0.70271593",
"0.7014592",
"0.6879273",
"0.6835529",
"0.6796799",
"0.6772317",
"0.6603924",
"0.65467125",
"0.64857274",
"0.64000475",
"0.6390102",
"0.63837636",
"0.63833266",
"0.63742644",
"0.6347534",
"0.6315406",
"0.6266779",
"0.6252... | 0.77672315 | 0 |
GIVEN 2 articles stored in the database WHEN the execute method is called THEN it should return 2 articles | def test_list_articles():
Article(
author = 'jane@doe.com',
title = 'New Article',
content = 'SUper extra awesome article'
).save()
Article(
author = 'jane@doe.com',
title = 'Another Article',
content = 'SUper awesome article'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_article_search_returns_only_published_articles(self):\n article1 = ArticleFactory(title=\"same\")\n article1.publish()\n article2 = ArticleFactory(title=\"same\")\n request = RequestFactory().get(\"\", {\"q\": \"same\"})\n response = Search.as_view()(request, category=\"... | [
"0.5785783",
"0.57265925",
"0.5713051",
"0.5597009",
"0.5474673",
"0.5473755",
"0.5411754",
"0.54039586",
"0.53997785",
"0.53681624",
"0.5362804",
"0.53209573",
"0.5298953",
"0.5297505",
"0.5279912",
"0.5263414",
"0.52319616",
"0.52222764",
"0.5217103",
"0.5212828",
"0.520103... | 0.66596305 | 0 |
GIVEN ID of article stored in the database WHEN the execute method is called on GetArticleByIDQuery with id set THEN it should return the article with the same id | def test_get_article_by_id():
article = Article(
author = 'jane@doe.com',
title = 'New Article',
content = 'Super extra awesome article'
).save()
query = GetArticleByIDQuery(
id = article.id
)
assert query.execute().id == article.id | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_article_by_id(article_id):\n return Article.query.get(article_id)",
"def articles_id (_id = None):\n\n with current_app.config.dba.engine.begin () as conn:\n res = execute (conn, r\"\"\"\n SELECT no\n FROM article\n WHERE no = :id\n \"\"\", { 'id' : _id })\n\n ... | [
"0.6621332",
"0.6605944",
"0.6476289",
"0.6215331",
"0.61311716",
"0.61184144",
"0.604446",
"0.60398215",
"0.6022566",
"0.6009041",
"0.5792643",
"0.5790264",
"0.57522136",
"0.5744034",
"0.5716061",
"0.5710784",
"0.57015",
"0.5675517",
"0.56689227",
"0.565596",
"0.5649508",
... | 0.7395768 | 0 |
Make directory d if it does not exist. | def make_dir(d):
if not os.path.exists(d):
os.makedirs(d) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdir_if_missing(d):\n if not os.path.exists(d):\n os.makedirs(d)",
"def ensure_dir(d):\n\n if not os.path.exists(d):\n os.makedirs(d, exist_ok=True)\n\n return",
"def make_dir(self):\n if not os.path.exists(self.d):\n try:\n os.mkdir(self.d)\n ... | [
"0.8084663",
"0.80841124",
"0.8020355",
"0.775315",
"0.7681081",
"0.7598447",
"0.7556047",
"0.72051305",
"0.7164293",
"0.7116012",
"0.7082882",
"0.7074899",
"0.7067386",
"0.7060422",
"0.70583636",
"0.70255744",
"0.7009468",
"0.70062506",
"0.6965047",
"0.6955441",
"0.6951046",... | 0.8431976 | 0 |
Add experiment method to the CCBP repo. | def add_experiment(experiment_file, exp_method_template, experiment):
with open(exp_method_template, 'r') as f:
exp_text = f.readlines()
for idx, l in enumerate(exp_text):
exp_text[idx] = exp_text[idx].replace('EDIT', experiment)
exp_text[idx] = exp_text[idx].replace('RANDALPHA', experim... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_experiment():\n pass",
"def add_experiment(self, experiment, trial_runner):\n generator = generate_trials(experiment.spec, experiment.name)\n while True:\n try:\n trial_runner.add_trial(next(generator))\n except StopIteration:\n break",... | [
"0.6156148",
"0.56966305",
"0.5447701",
"0.5435075",
"0.5434259",
"0.5365528",
"0.5331065",
"0.5323644",
"0.52798617",
"0.5270549",
"0.5248787",
"0.5175614",
"0.51717705",
"0.51531214",
"0.5145617",
"0.5133069",
"0.5061734",
"0.5059365",
"0.50237244",
"0.50053847",
"0.4980861... | 0.60194564 | 1 |
Dict of fields in exp & hp_combo_history tables. DEPRECIATED. | def experiment_fields(self):
return {
'experiment_name': ['experiments', 'hp_combo_history'],
'model_struct': ['experiments', 'hp_combo_history'],
'loss_function': ['experiments', 'hp_combo_history'],
'regularization_type': ['experiments', 'hp_combo_history'],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_fields(self):\n tables = [self.sell_table, self.buy_table, self.pending_table]\n for table in tables:\n sql = f'SHOW COLUMNS in {table}'\n self.fields[table] = list(tb.Database().read(sql).Field)",
"def _get_fields(self):\n if not self._cursor.description:\n ... | [
"0.6062942",
"0.60320985",
"0.59121275",
"0.5831187",
"0.5783695",
"0.57616085",
"0.57540345",
"0.5731939",
"0.5731939",
"0.5731939",
"0.5731939",
"0.57171136",
"0.570444",
"0.5673894",
"0.5650515",
"0.564584",
"0.5625621",
"0.5621913",
"0.5615795",
"0.55844766",
"0.5581691",... | 0.63812417 | 0 |
Update the in_process table. | def update_in_process(self, experiment_id, experiment_name):
self.cur.execute(
"""
INSERT INTO in_process
VALUES
(%(experiment_id)s, %(experiment_name)s)
""",
{
'experiment_id': experiment_id,
'experiment_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_in_process(self):\n self.cur.execute(\n \"\"\"\n DELETE FROM in_process\n \"\"\"\n )\n if self.status_message:\n self.return_status('DELETE')",
"def update(self):\n self.__execute(self.pkgin_bin, \"update\")",
"def _UpdateProcess... | [
"0.63497984",
"0.63332486",
"0.61047435",
"0.608932",
"0.5691337",
"0.564854",
"0.564854",
"0.55939466",
"0.5567589",
"0.5547397",
"0.54927236",
"0.5469693",
"0.5424243",
"0.54079384",
"0.540322",
"0.5333648",
"0.53215027",
"0.53182644",
"0.53092015",
"0.5269363",
"0.5252108"... | 0.69824755 | 0 |
Update performance in database. | def update_performance(self, namedict):
self.cur.execute(
"""
INSERT INTO performance
(
experiment_id,
experiment_name,
summary_dir,
ckpt_file,
training_loss,
validation_loss,
time_elapsed,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.getDbRecord().update()",
"def update(self):\r\n self._data.update()\r\n if self._data == None:\r\n _Log.error('No data!')\r\n\r\n\r\n expedite = self._data.data['trafficinfo']['evaluation']['expedite']\r\n congested = self._data.data['traffic... | [
"0.6509698",
"0.6202826",
"0.6168462",
"0.6149157",
"0.60288525",
"0.60197735",
"0.60197735",
"0.60117024",
"0.59726214",
"0.59726214",
"0.5958502",
"0.59549385",
"0.5941081",
"0.59111905",
"0.5895951",
"0.58733785",
"0.58725345",
"0.5870312",
"0.5861612",
"0.58130264",
"0.58... | 0.6958792 | 0 |
Find neuron RF extents. | def rf_extents(rf_dict):
x_min, y_min, x_max, y_max = np.inf, np.inf, -np.inf, -np.inf
for rf in rf_dict:
x_min = np.min([rf['on_center_x'], x_min])
x_max = np.max([rf['on_center_x'], x_max])
y_min = np.min([rf['on_center_y'], y_min])
y_max = np.max([rf['on_center_y'], y_max])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extents(self):\n\n return self._local",
"def get_extent(self):\n pass",
"def bounds(self):\n return self.kernel.bounds",
"def eigs_bounds(self) -> Tuple[float, float]:\n raise NotImplementedError",
"def extents(nodes):\n from numpy import min, max\n return ( min(nodes[... | [
"0.57222384",
"0.56132746",
"0.55579513",
"0.5532564",
"0.5531425",
"0.5515227",
"0.5451464",
"0.53820735",
"0.5380216",
"0.53566694",
"0.5344756",
"0.53414917",
"0.5337997",
"0.5317886",
"0.52476686",
"0.52455115",
"0.5230921",
"0.52194214",
"0.5207557",
"0.51670116",
"0.516... | 0.5756262 | 0 |
Main function for creating multiple datasets of cells. | def build_multiple_datasets(
template_dataset='ALLEN_st_cells_1_movies',
template_experiment='ALLEN_st_selected_cells_1',
model_structs='ALLEN_st_selected_cells_1',
this_dataset_name='MULTIALLEN_',
cluster=False,
print_info=False,
N=16):
main_config = Allen_Br... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _make_data(self):\n pdf_datasets_all = make_pdf_datasets(self.pdf_list, self.xlims, self.ylims, self.tlims, self.dims, 9)\n self.pdf_dataset = np.concatenate(pdf_datasets_all, axis = 0)\n self.PDE_dataset = make_PDE_dataset(self.num_collocation, self.xlims, self.ylims, self.tlims, self.dim... | [
"0.6562069",
"0.6378845",
"0.6354283",
"0.6316083",
"0.62349546",
"0.6135683",
"0.6084193",
"0.60566413",
"0.60399926",
"0.6018695",
"0.5989639",
"0.59114677",
"0.5879213",
"0.5840391",
"0.5840384",
"0.5737519",
"0.5724221",
"0.57017046",
"0.567982",
"0.5675995",
"0.5673494",... | 0.65459776 | 1 |
Outputs all machine post table data to an HTML table | def show_machine_data():
alive = watchdog.is_alive()
auto_refresh = False
try:
state = db.session.query(Machine).order_by(
desc(Machine.datetime)).first().state
except AttributeError as e:
print(e)
state = None
machine_columns = Machine.__table__.columns.keys() ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _create_table_html(self, table):\n if table != {} and table is not None:\n html_output = [['<hr>']]\n else:\n html_output = []\n\n for t in self._util_func.dict_key_list(table.keys()):\n html_output.append(table[t])\n\n return html_output",
"def _r... | [
"0.5875978",
"0.5873028",
"0.58397424",
"0.5802151",
"0.5788867",
"0.5787383",
"0.5766469",
"0.5749839",
"0.5716409",
"0.5689428",
"0.56666607",
"0.5666076",
"0.5640234",
"0.56383634",
"0.5631717",
"0.5630049",
"0.56254095",
"0.56163317",
"0.55991006",
"0.55957836",
"0.557559... | 0.59431374 | 0 |
Find the Kth to last element in the provided linked list | def kth_to_last(l_list, k=1):
if not l_list:
return
if k > len(l_list):
return
runner = l_list.head()
for i in range(k):
if runner.next(): # Prevent the runner to become None in case the last element is asked for.
runner = runner.next()
curr = l_list.head()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kth_to_last(k, head_node):\n\n # Find length of list \n current = head_node\n\n length = 1\n\n while current.next:\n current = current.next\n length += 1\n\n # Target node is the node at this position\n target = length - k\n\n # Walk through the list again to find the target ... | [
"0.8564791",
"0.830158",
"0.82131547",
"0.8204853",
"0.8184758",
"0.8146143",
"0.8034099",
"0.7913925",
"0.79061",
"0.78458095",
"0.78102875",
"0.7725206",
"0.7183092",
"0.70147955",
"0.697414",
"0.6879367",
"0.6716813",
"0.6621819",
"0.6531186",
"0.63832355",
"0.6359959",
... | 0.866186 | 0 |
Creates vector representation of the Reaction. | def to_vector(self, ordering: SortedList, definitions: dict) -> VectorReaction:
return VectorReaction(self.lhs.to_vector(ordering),
self.rhs.to_vector(ordering),
self.rate,
self.label) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateVector(self) -> BaseVector:",
"def get_vector(self): \n #print(self.state)\n '''\n print(\"\"\"\n Price {}\n Last Price {}\n Last Period Transaction {}\n Last Transaction {}\n Las Value {}\n Last day {}\n ... | [
"0.6665019",
"0.6596818",
"0.64737743",
"0.6390654",
"0.62830263",
"0.62098897",
"0.6147397",
"0.6104169",
"0.60224813",
"0.5998774",
"0.59849834",
"0.59742516",
"0.5942503",
"0.5909041",
"0.59065425",
"0.5890604",
"0.58901316",
"0.58487916",
"0.58466876",
"0.5835752",
"0.580... | 0.6723516 | 0 |
Checks whether Reaction is compatible (positionwise) with the other Reaction. | def compatible(self, other: 'Reaction') -> bool:
return self.lhs.compatible(other.lhs) and self.rhs.compatible(other.rhs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_compatible(self, other):\n return self.intervals == other.intervals and\\\n self.nonderived_directions == other.nonderived_directions",
"def check_input(self, other, position):\n if self.torsion != other.torsion:\n raise TypeError('only defined for equal attribu... | [
"0.61432666",
"0.60429746",
"0.5990198",
"0.59204614",
"0.5867403",
"0.5812303",
"0.5796631",
"0.57636225",
"0.5760353",
"0.57204664",
"0.56528145",
"0.56444025",
"0.5563609",
"0.55412245",
"0.5528171",
"0.55193806",
"0.5513896",
"0.551168",
"0.5506807",
"0.5475464",
"0.54702... | 0.7327405 | 0 |
Bug in KVGraph scanned edge index prefixes, if key was a prefix subkey of another, edge sets would get merged (ie get outgoing from 'Work' and get edges from 'Work' and 'Workflow') | def test_subkey(man):
errors = []
G = man.writeTest()
G.addVertex("Work", "Thing", {})
G.addVertex("Workflow", "Thing", {})
G.addVertex("Other", "Thing", {})
G.addVertex("OtherGuy", "Thing", {})
G.addEdge("Work", "Other", "edge")
G.addEdge("Workflow", "OtherGuy", "edge")
count = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sub_graph_merging(self):",
"def fdupes(g, node_prefix='_qh/',edge_type='qhash'):\n build_index_on_node_attr(g, 'qhash', 'f', node_prefix=node_prefix, expand=True)\n paths = g.node_labels\n print '\\n'.join(sorted(str(s) for s in paths.items()))\n for k in paths:\n if k:\n edge =... | [
"0.5714441",
"0.56734216",
"0.5637052",
"0.5577061",
"0.5503158",
"0.5477301",
"0.54704285",
"0.5442094",
"0.52750355",
"0.52721703",
"0.52144784",
"0.5206014",
"0.52055544",
"0.51789516",
"0.5176996",
"0.51732147",
"0.515362",
"0.5153376",
"0.51384985",
"0.51207113",
"0.5102... | 0.5682298 | 1 |
reads images from step_2 of Abnormalities_{pred_class} iteratively and stores the segmented results in respective Abnormality folders in step_3 | def _segmentation(self):
ab_list = ["Apthae", "Ulcer", "Bleeding", "Lymphangectasias", "Angioectasias",
"Polypoids", "ChylousCysts", "Stenoses", "Voedemas"]
for i in range(8):
os.makedirs(self.root + "/step_3/Segmentation/" + ab_list[i])
if len(os.listdir(sel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _preprocess(self):\n print(\"Note: if root path is changed, the previously generated json files need to be re-generated (delete them first)\")\n if osp.exists(self.imgs_labeled_dir) and \\\n osp.exists(self.imgs_detected_dir) and \\\n osp.exists(self.split_classic_det_json_pat... | [
"0.6488945",
"0.63861114",
"0.63370585",
"0.6305231",
"0.6295932",
"0.6280022",
"0.62435",
"0.62386715",
"0.62044656",
"0.617644",
"0.6137203",
"0.6128609",
"0.61197495",
"0.6097207",
"0.6095458",
"0.6087278",
"0.60740185",
"0.60617715",
"0.60595185",
"0.60527277",
"0.6051960... | 0.6864981 | 0 |
Find the greatest product composed of adjacent digits in the target. | def greatest_adjacent_product(target, window):
stringified = str(target)
length = len(stringified)
greatest_product = None
for i in range(length):
digits = stringified[i:i+window]
# Stop if we've reached the end of the target.
if len(digits) < window:
break
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findMaxProduct(n):\n large = 0\n for i in range(len(s)):\n p = 1\n number = s[i:i+n]\n for iteration in range(len(number)):\n h = number[iteration]\n p = p * int(h)\n if p > large:\n large = p\n\n \n return large",
"def answer(n... | [
"0.6903726",
"0.6857714",
"0.67919636",
"0.66889226",
"0.6557949",
"0.65135604",
"0.6460066",
"0.6365226",
"0.6357242",
"0.62768096",
"0.6264018",
"0.6260539",
"0.61785734",
"0.6170831",
"0.6168582",
"0.616774",
"0.6163965",
"0.61451274",
"0.6138531",
"0.61355084",
"0.6102624... | 0.78511107 | 0 |
Create compartment of volume litres to the model. | def addCompartment(self, vol=1, comp_id=""):
c1 = self.model.createCompartment()
self.check(c1, "create compartment")
if len(comp_id) == 0:
comp_id = "c" + str(self.model.getNumCompartments())
self.check(c1.setId(comp_id), "set compartment id")
self.check(c1.setConst... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getComponentVolume(self):\n lengthO = self.getDimension(\"lengthOuter\")\n widthO = self.getDimension(\"widthOuter\")\n heightO = self.getDimension(\"heightOuter\")\n lengthI = self.getDimension(\"lengthInner\")\n widthI = self.getDimension(\"widthInner\")\n heightI = ... | [
"0.6180432",
"0.61743987",
"0.6035146",
"0.59658885",
"0.58646786",
"0.5781318",
"0.5760401",
"0.57396454",
"0.5709215",
"0.5665116",
"0.55692405",
"0.556802",
"0.5451793",
"0.5437442",
"0.54308164",
"0.54264474",
"0.53905106",
"0.5368558",
"0.535571",
"0.5326488",
"0.5320295... | 0.6638296 | 0 |
Add Parameter with value and unit. | def addParameter(self, param_id, val, units="per_second"):
k = self.model.createParameter()
self.check(k, "create parameter k")
self.check(k.setId(param_id), "set parameter k id")
self.check(k.setConstant(True), 'set parameter k "not constant"')
self.check(k.setValue(val), "set ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_parameter(self, key, value, unit=None):\n self._params.add_parameter(key, value, unit=unit)",
"def add_parameter(self,\n name, # The name of the parameter\n scaling=None, # The type of scaling to be used for the parameter\n ... | [
"0.82874894",
"0.708983",
"0.6829403",
"0.6814717",
"0.66201866",
"0.6617158",
"0.6571154",
"0.6450562",
"0.6365669",
"0.6351074",
"0.633297",
"0.6325818",
"0.6306438",
"0.62996763",
"0.6283294",
"0.6256354",
"0.6211669",
"0.62110573",
"0.619499",
"0.6131698",
"0.6130436",
... | 0.76129323 | 1 |
Create reaction provided with reactants and products in lists | def addReaction(
self, reactants, products, expression, local_params=None, rxn_id=""
):
r1 = self.model.createReaction()
self.check(r1, "create reaction")
if len(rxn_id) == 0:
rxn_id = "v" + str(self.model.getNumReactions())
self.check(r1.setId(rxn_id), "set reac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_new_products(self, reactions):\n\t\tnew_products = []\n\t\tnew_reactions = []\n\n\t\tESTNF = { c:c for c in self._E + self._S + self._T + self._N + self._F }\n\t\tB = { c:c for c in self._B}\n\n\t\t\n\t\t# Loop over every reaction\n\t\tfor reaction in reactions:\n\t\t\t\n\t\t\t# This will be set to False i... | [
"0.63749737",
"0.6317097",
"0.62966883",
"0.62879795",
"0.60872364",
"0.600487",
"0.590436",
"0.5742794",
"0.5737819",
"0.5732844",
"0.570524",
"0.5698835",
"0.56814855",
"0.5613817",
"0.5554881",
"0.5480505",
"0.54754674",
"0.5467506",
"0.5428214",
"0.53823024",
"0.5361916",... | 0.7240448 | 0 |
Set the level and version of the SBML. | def setLevelAndVersion(self, level, version):
if level == 2 and version == 1:
self.check(
self.document.checkL2v1Compatibility(), "convert to level 2 version 1"
)
elif level == 2 and version == 2:
self.check(
self.document.checkL2v2Com... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setLevelAndVersion(self, *args):\n return _libsbml.SBMLDocument_setLevelAndVersion(self, *args)",
"def set_version(self, bundle, ctx, filename, version):",
"def setLevel(self, level):\n self.lvl = level",
"def __set_level(self,L):\n assert isinstance(L,level)\n self.__level = ... | [
"0.769604",
"0.61835164",
"0.61147755",
"0.6106898",
"0.6085804",
"0.60042036",
"0.59990776",
"0.5976736",
"0.59713435",
"0.59694105",
"0.59370613",
"0.5916645",
"0.58822036",
"0.5833963",
"0.5748092",
"0.57120925",
"0.57120925",
"0.57120925",
"0.5709978",
"0.56237537",
"0.56... | 0.681456 | 1 |
Return list of reactions. | def getListOfReactions(self):
return self.model.getListOfReactions() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfReactions(self, *args):\n return _libsbml.Model_getListOfReactions(self, *args)",
"def get(self, *args):\n return _libsbml.ListOfReactions_get(self, *args)",
"def get_reactions(self, ctx, params):\n # ctx is the context object\n # return variables are: out_reactions\n ... | [
"0.84443134",
"0.7732917",
"0.7593978",
"0.75806725",
"0.71437573",
"0.7127357",
"0.7103175",
"0.7064662",
"0.69016105",
"0.6861794",
"0.67643917",
"0.6445993",
"0.6424792",
"0.63278866",
"0.62533516",
"0.61013055",
"0.60785043",
"0.5952071",
"0.5947103",
"0.5941724",
"0.5852... | 0.8845906 | 0 |
Return list of events. | def getListOfEvents(self):
return self.model.getListOfEvents() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_event_list(self):\n pass",
"def event_list(self):\n return self._event_list",
"def eventList(self):\n return self._eventList",
"def get_events(self):\n return self.s.query(Event).all()",
"def get_events(self):\n return self.events",
"def get_events(self):\n ... | [
"0.86139786",
"0.8441339",
"0.8322548",
"0.82276314",
"0.8218052",
"0.81742597",
"0.81725585",
"0.8035816",
"0.8020913",
"0.79858756",
"0.797429",
"0.79679704",
"0.7951244",
"0.7951244",
"0.7903473",
"0.7902892",
"0.7841911",
"0.7759052",
"0.7747804",
"0.7731363",
"0.7717868"... | 0.8529751 | 1 |
Return list of compartments. | def getListOfCompartments(self):
return self.model.getListOfCompartments() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfCompartments(self, *args):\n return _libsbml.Model_getListOfCompartments(self, *args)",
"def get(self, *args):\n return _libsbml.ListOfCompartments_get(self, *args)",
"def get_compo_list(self):\n if not os.path.isdir(self.datapath):\n os.makedirs(self.datapath)\n ... | [
"0.8236304",
"0.7289726",
"0.66118",
"0.64601165",
"0.6438496",
"0.63647705",
"0.6309551",
"0.6223363",
"0.62205863",
"0.6161241",
"0.6151167",
"0.6123978",
"0.6114628",
"0.6081711",
"0.6070095",
"0.6044272",
"0.5961506",
"0.5943147",
"0.5942136",
"0.58378804",
"0.5835492",
... | 0.86843723 | 0 |
Return list of initial assignments. | def getListOfInitialAssignments(self):
return self.model.getListOfInitialAssignments() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getListOfInitialAssignments(self, *args):\n return _libsbml.Model_getListOfInitialAssignments(self, *args)",
"def get(self, *args):\n return _libsbml.ListOfInitialAssignments_get(self, *args)",
"def expandInitialAssignments(self):\n return _libsbml.SBMLDocument_expandInitialAssignments... | [
"0.8595369",
"0.7728021",
"0.71545815",
"0.68684244",
"0.6814491",
"0.6761947",
"0.67307884",
"0.66645753",
"0.66095",
"0.655691",
"0.6483029",
"0.6331909",
"0.6148361",
"0.6102908",
"0.61010826",
"0.61003727",
"0.6078539",
"0.60089874",
"0.59971535",
"0.5944701",
"0.592173",... | 0.8724247 | 0 |
Update the current maintenance operation details. The function assumes the lock is held, so it mustn't be run outside of a locked context. | def update_maintenance_operation(session, operation=None):
op_text = None
if operation:
op_text = operation.__name__
with session.begin():
row = session.query(models.OVNMaintenance).one_or_none()
row.processing_operation = op_text | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_maintenance_update(self):\n logger.info(\"Applying maintenance updates on master node\")\n self.env.admin_install_updates()\n\n logger.info(\"Applying maintenance updates on slaves\")\n slaves_mu_script_url = (\n \"https://github.com/Mirantis/tools-sustaining/\"\n ... | [
"0.5867695",
"0.56723994",
"0.5615302",
"0.5559361",
"0.5506716",
"0.55006397",
"0.54780126",
"0.546298",
"0.5416064",
"0.5408446",
"0.54082394",
"0.5376733",
"0.5372986",
"0.53697467",
"0.53407073",
"0.53365695",
"0.5307522",
"0.5293821",
"0.5283861",
"0.52823216",
"0.527683... | 0.6677877 | 0 |
Multiply the arguments together and return the result. Return 0 if nothing is provided. | def multiplier(*args):
if not args:
return 0
product = args[0]
for a in args[1:]:
print('a is: ',a)
product *= a
return product,args | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiply(*args):\n\n # TODO: Fill sum with the correct value, based on the\n # args provided.\n multiplier = str(args[0] * args[1])\n return multiplier",
"def multiply(*args):\n\n result = int(args[0]) * int(args[1])\n\n return str(result)",
"def multiply(*args):\n body = ['<h1>Multipl... | [
"0.75643426",
"0.7499688",
"0.73542553",
"0.73391604",
"0.7257125",
"0.7164405",
"0.6913725",
"0.68508834",
"0.6821964",
"0.67234933",
"0.67221737",
"0.66998255",
"0.661906",
"0.661806",
"0.6617685",
"0.6611777",
"0.6573631",
"0.6566888",
"0.655735",
"0.65564847",
"0.65564847... | 0.75896585 | 0 |
Mean Square Difference between block1 and block2. The MSD squares the difference between pixels. This exaggerates any differences. | def get_MSD(block1, block2):
#print(block1.shape)
#print(block2.shape)
return sum(sum(abs(block1 - block2) ** 2)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mse(image1: np.ndarray, image2: np.ndarray) -> np.ndarray:\n return np.sqrt(np.power((image1 - image2), 2).mean(axis=(-1, -2)))",
"def rmse_calc(arr1, arr2):\n assert arr1.shape==arr2.shape\n \n return np.sqrt(np.mean((arr2-arr1)**2))",
"def diff_of_means(data_1, data_2):\n\n # The difference o... | [
"0.69033825",
"0.669493",
"0.6665844",
"0.6632717",
"0.6632717",
"0.6627138",
"0.6560583",
"0.6471391",
"0.6450246",
"0.6382861",
"0.6365556",
"0.63599515",
"0.63308215",
"0.62787956",
"0.62648207",
"0.62530696",
"0.621018",
"0.6190956",
"0.6185977",
"0.6171467",
"0.6162568",... | 0.7546987 | 0 |
Converts a probability to a Bbit representation Rounds probabilistically Treats '111..1' as special code for "always go left" This means that the probability M1/M is essentially unimplementable. The rounding for values in the range (M2/M, 1) chooses between M2/M and 1. | def AsBBit(x, B):
assert x <= 1, "it's a probability"
M = 2**B
scaled_x = x*M
rem = scaled_x - np.floor(scaled_x)
if (x == 1):
x_bin = M - 1
elif (scaled_x > M - 2):
# in this range, things are ugly
# because we reserve 'all ones' as 'always go left'
r = np.rando... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def b2b(digits, base1, base2):\n return v2r(r2v(digits, base1), base2)",
"def _bin_backport(x):\n chars = []\n for n in range(7, -1, -1):\n y = x - 2**n\n if y >= 0:\n chars.append('1')\n x = y\n else:\n chars.append('... | [
"0.58173186",
"0.57893705",
"0.57611245",
"0.57578206",
"0.57540005",
"0.5753532",
"0.56986177",
"0.5682524",
"0.56686634",
"0.56452507",
"0.56297547",
"0.55971247",
"0.5574483",
"0.5554583",
"0.55472493",
"0.552116",
"0.5508542",
"0.54777133",
"0.5444325",
"0.54382855",
"0.5... | 0.6578575 | 0 |
Extract distribution from ptree in binary heap format | def extract_distribution(ptree):
w_apx = np.zeros(ptree.shape)
FlattenPtreeRecur(ptree, w_apx, 1, 1)
return w_apx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantitative_distribution(child, N): \n binned = np.histogram(child.dropna(), bins=10) # Value counts (first line)\n prop = binned[0] / binned[0].sum() # proportion of bins\n bins = binned[1] # N + 1 bin boundaries\n # print(prop)\n indices = np.random.choice(a=10, p=prop, size=N)\n # print(... | [
"0.571666",
"0.55543864",
"0.5520795",
"0.54512775",
"0.54449975",
"0.53802675",
"0.53694427",
"0.5253975",
"0.524146",
"0.5240888",
"0.52291477",
"0.52237815",
"0.5197187",
"0.5196258",
"0.5156737",
"0.51480544",
"0.51254857",
"0.511837",
"0.5105831",
"0.5103998",
"0.5067123... | 0.69958687 | 0 |
builds the probability tree from a weight distribution | def build_tree(self, w):
w_abs = np.abs(w)
if sum(w_abs) != 1.:
w_abs = w_abs / sum(w_abs)
self.w = w_abs
self.tree = np.zeros(w.shape)
self._build_node(w_abs, 1)
self.w_apx = extract_distribution(self.tree)
n_levels = np.ceil(np.log2(len(w)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tree_distribution(value_dict, tree, order):\n\n # Note list below excludes contexts involving the last variable\n leaves = [n for n in tree.nodes\n if nx.shortest_path_length(tree, \"Root\", n) == len(order)-1]\n # All outcomes must include the possibilities of the last variable\n # ... | [
"0.66968054",
"0.6560203",
"0.63389176",
"0.61528265",
"0.6024916",
"0.595494",
"0.5781261",
"0.5775068",
"0.57630837",
"0.5746584",
"0.5659049",
"0.56462646",
"0.5642387",
"0.56409246",
"0.5584207",
"0.55681026",
"0.55351555",
"0.55288833",
"0.5509602",
"0.55047935",
"0.5489... | 0.6636103 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.