query stringlengths 9 3.4k | document stringlengths 9 87.4k | metadata dict | negatives listlengths 4 101 | negative_scores listlengths 4 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Given a grade in traditional format returns its numerical value. | def grades_to_number(grade):
# Conditions
if grade == "A":
return 1
elif grade == "B":
return 0.5
elif grade == "C":
return 0
elif grade == "D":
return -0.5
else:
return -1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grade_conversion(grade):\n grade_converter = {\"A\": 4.00, \"A-\":3.67, \"B+\": 3.33, \"B\": 3.00, \"B-\": 2.67, \"C+\": 2.33, \"C\": 2.00, \"C-\": 1.67, \"D\": 1.00, \"F\": 0.0}\n while True:\n for val, val2 in grade_converter.items():\n if grade == val:\n return val2",
... | [
"0.73501873",
"0.68947804",
"0.68758976",
"0.66896164",
"0.6650556",
"0.663879",
"0.6590116",
"0.6418488",
"0.641584",
"0.639903",
"0.6305388",
"0.61268765",
"0.6086562",
"0.60312635",
"0.588034",
"0.58800024",
"0.5850215",
"0.5826675",
"0.5701853",
"0.5628017",
"0.5513478",
... | 0.8073355 | 0 |
Raise error if statement is false. Adds component information to message. | def assertTrue(self, statement, message):
prefix = "In component %s: " % self.name
if not statement:
error(prefix + str(message)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def err_message(self, message):\n self.errors.append(1)\n message = \"<b>\" + message + \"</b>\"\n self.timer_id = GLib.timeout_add_seconds(5, self.error_false)\n # Show if is was hidden\n if self.hidden:\n self.toggle()\n self.was_hidden = True\n sel... | [
"0.56584454",
"0.55685383",
"0.5480881",
"0.5420251",
"0.5274064",
"0.5239337",
"0.5213085",
"0.5182997",
"0.5171589",
"0.51616085",
"0.51604795",
"0.51502395",
"0.513914",
"0.5138146",
"0.5124125",
"0.51095736",
"0.50949955",
"0.5094471",
"0.5077176",
"0.5068538",
"0.506511"... | 0.6945145 | 0 |
Replace all refferences to sequences with the actual sequences, expand domains, etc. | def clean_const(self, old_const, name):
const = []
for item in old_const:
if item[0] == sequence_flag:
seq_name, wc = item[1]
self.assertTrue( seq_name in self.seqs, "Sequence '%s' referenced before definion (in sequence/strand '%s')" % (seq_name, name) )
if not wc:
seq =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sequence_replace(sequences, char_to_replace, char_replacements):\n return [sequence_replace_single(sequence, char_to_replace, char_replacements) for sequence in sequences]",
"def fix_seq(self, fixed_seq):\n self.wc.fix_seq(wc(fixed_seq))",
"def replace(self, domain, sequence):\n index = self._... | [
"0.687006",
"0.64151245",
"0.6338442",
"0.600167",
"0.5956396",
"0.5860406",
"0.5779753",
"0.5771344",
"0.5728492",
"0.56815237",
"0.5620823",
"0.5620125",
"0.5592783",
"0.55877864",
"0.5569021",
"0.5498307",
"0.5496083",
"0.5480103",
"0.54734826",
"0.543392",
"0.5417541",
... | 0.0 | -1 |
Add I/O information once we've read the component. | def add_IO(self, inputs, outputs):
self.input_seqs = []
self.input_structs = []
for (seq_name, wc), struct_name in inputs:
self.assertTrue( seq_name in self.seqs, "Declare statement references undefined sequence '%s'" % seq_name )
if wc:
self.input_seqs.append( self.seqs[seq_name].wc )
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _io_update(self):\n logger.info(\"IO Update\")\n self._toggle_pin(\"IO_UPDATE\")",
"def handle_read(self):\n pass",
"def _handle_read(self):\n pass",
"def register_read(self):\n self._reads_since_check += 1",
"def read(self):\n pass",
"def read(self):\n ... | [
"0.60627383",
"0.6056281",
"0.60099465",
"0.59529054",
"0.5902193",
"0.5721443",
"0.56422293",
"0.56246233",
"0.56007826",
"0.56007826",
"0.5561346",
"0.55334574",
"0.5502303",
"0.547912",
"0.5478724",
"0.5478039",
"0.5453139",
"0.54431236",
"0.5436852",
"0.54329354",
"0.5430... | 0.0 | -1 |
Output synthesis of all data into a single file. | def output_synthesis(self, prefix, outfile):
if prefix:
outfile.write("#\n## Component %s\n" % prefix[:-1])
else:
outfile.write("#\n## Top Component\n")
# Define sequences
for seq in list(self.base_seqs.values()):
if not seq.dummy:
if not seq.in_strand:
warning("... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_output(self):",
"def export(self, file: TextIO) -> None:\n file.write(f'\"{self.name}\"\\n\\t{{\\n')\n file.write(f'\\tchannel {self.channel}\\n')\n file.write(f'\\tsoundlevel {join_float(self.level)}\\n')\n\n if self.volume != (1, 1):\n file.write(f'\\tvolume {jo... | [
"0.6159958",
"0.60382056",
"0.6025846",
"0.5874376",
"0.58742553",
"0.58717626",
"0.5852426",
"0.58256155",
"0.5785766",
"0.5776453",
"0.575999",
"0.57547444",
"0.575132",
"0.5748626",
"0.5747197",
"0.56965256",
"0.5694176",
"0.56709766",
"0.56587386",
"0.56449944",
"0.561443... | 0.59521836 | 3 |
Compile data into NUPACK format and output it | def output_nupack(self, prefix, outfile):
if prefix:
outfile.write("#\n## Component %s\n" % prefix[:-1])
else:
outfile.write("#\n## Top Component\n")
used_seqs = set()
# Define structures
for struct in list(self.structs.values()):
outfile.write("structure %s = %s\n" % (st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _pack_data( self, data ) : \r\n \r\n # hints = self._translation_table.get( type(data), None )\r\n hints = self._get_hints( data ) \r\n \r\n if hints is None : \r\n \r\n ## #debug: \r\n ## print \"_pack_data(): no hints for data ty... | [
"0.5695821",
"0.55385834",
"0.5406081",
"0.53828984",
"0.5377109",
"0.53617066",
"0.53571606",
"0.53300756",
"0.53291017",
"0.53282076",
"0.532767",
"0.5307225",
"0.5276184",
"0.5275858",
"0.52680707",
"0.5247397",
"0.5245808",
"0.51902896",
"0.5184493",
"0.51772344",
"0.5161... | 0.6070958 | 0 |
create some test data to help in the tests | def create_testdata(self):
# create a numpy array (matrix)
x= np.array([[1,2,3],[4,5,6],[7,8,9]])
x_rand= np.random.randn(100,5)
# create a scipy sparse matrix
# the syntax is (data,(rows, cols)), shape=(nrows,ncols)
s= sp.sparse.coo_matrix( ([3,2],([0,2],[1,6])),shape=(3... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def setUpTestData(cls):\n data_gen.run()",
"def getTestData(self):\n raise NotImplementedError",
"def create_test_data(self):\n fak... | [
"0.7376175",
"0.7376175",
"0.7376175",
"0.7376175",
"0.71997833",
"0.71737844",
"0.70964205",
"0.7089956",
"0.707751",
"0.70720345",
"0.7058007",
"0.705647",
"0.7027412",
"0.70260316",
"0.6997285",
"0.69802326",
"0.69571537",
"0.6944287",
"0.69331676",
"0.6924585",
"0.6906168... | 0.0 | -1 |
test the check_sparse helper function of the class | def test_check_sparse(self):
x, x_rand, s = self.create_testdata()
task = mmRDTR()
#check that a dense array x is passed thru unchanged
check = task.check_sparse(x)
self.assertEqual(np.all(check==x),True)
#check that a sparse matrix s is converted to a numpy array
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_return_sparse():\n X = Vectorizer(strategy=\"bow\", return_sparse=True).fit_transform(X_text, y10)\n assert all(pd.api.types.is_sparse(X[c]) for c in X.columns)",
"def is_sparse(x: Any, backend=None) -> bool:\r\n module = get_module(backend)\r\n return module.is_sparse(x)",
"def test_spars... | [
"0.7598279",
"0.67092216",
"0.66901195",
"0.66851485",
"0.65175474",
"0.6501066",
"0.6450492",
"0.63985956",
"0.6397077",
"0.6388959",
"0.63845825",
"0.6358451",
"0.63335603",
"0.6332554",
"0.6324011",
"0.63189375",
"0.6216197",
"0.61706775",
"0.6131384",
"0.61189103",
"0.611... | 0.82182574 | 0 |
test the apply_ridit helper function of the class | def test_apply_ridit(self):
x, x_rand, s = self.create_testdata()
task = mmRDTR()
s = task.check_sparse(s)
for data in [x, x_rand, s]:
#get ecdf for data
Fn=task.make_ECDF(data)
out=task.apply_ridit( data, Fn )
# check same dimension
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ipam_rirs_update(self):\n pass",
"def test_ipam_rirs_partial_update(self):\n pass",
"def apply(self):",
"def apply(self) -> None:",
"def apply(self) -> None:",
"def _regr_basic():",
"def test_ipam_rirs_create(self):\n pass",
"def test_ipam_rirs_list(self):\n pass"... | [
"0.61163276",
"0.59165066",
"0.58017886",
"0.5764783",
"0.5764783",
"0.57614654",
"0.56750005",
"0.5673456",
"0.55145764",
"0.55145764",
"0.55145764",
"0.55145764",
"0.55145764",
"0.54082805",
"0.53986454",
"0.5394817",
"0.5368661",
"0.52817476",
"0.5250451",
"0.5250451",
"0.... | 0.6735588 | 0 |
test the fit function of the class | def test_fit(self):
X = self.generate_X()
task = mmRDTR()
fit_result = task.fit(X) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fit_test(self):",
"def fit():\n pass",
"def fit(self):\n raise NotImplementedError",
"def fit(self, X):",
"def fit(self):\n raise NotImplementedError('')",
"def test_fit_score(self):\n oz = ClassificationScoreVisualizer(GaussianNB())\n assert_not_fitted(oz, X_test=s... | [
"0.8760779",
"0.78713596",
"0.7343353",
"0.7299654",
"0.72884196",
"0.71841216",
"0.7181076",
"0.7141227",
"0.7138661",
"0.7133409",
"0.7124624",
"0.70977885",
"0.7081293",
"0.7055085",
"0.70081306",
"0.6991212",
"0.6991212",
"0.6991212",
"0.6991212",
"0.6991212",
"0.6991212"... | 0.69048506 | 28 |
test the transform function of the class | def test_transform(self):
X = self.generate_X()
task = mmRDTR()
task.fit(X)
res = task.transform(X)
# check if Instance
self.assertIsInstance(res,Container)
# check if names
self.assertEqual(np.all(res.colnames()==[str(i) for i in xrange(len(res.colnames()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_transform(self):\n t = Identity()\n assert t.transform(\"yo\") == \"yo\"",
"def test__transform_continuous(self):",
"def test_transform(self):\n new_route = self.route.transform(\"transformed\")\n assert new_route != self.route\n assert new_route.route[\"transform\"]... | [
"0.78432393",
"0.77078724",
"0.755688",
"0.7465211",
"0.7195168",
"0.7193356",
"0.7171419",
"0.7155136",
"0.71213484",
"0.71176875",
"0.7019547",
"0.7019499",
"0.7005889",
"0.6928611",
"0.6928611",
"0.6928611",
"0.6928611",
"0.6928611",
"0.6928611",
"0.6928611",
"0.68952787",... | 0.7430546 | 4 |
test that the class can be pickled. This is required! | def test_pickle(self):
X = self.generate_X()
task = mmRDTR()
task.fit(X)
with tempfile.TemporaryFile(mode='w+b') as tf:
cPickle.dump(task, tf) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test__pickle_unpickle(self):\n pass",
"def is_picklable(obj):\n try:\n pickle.dumps(obj)\n\n except pickle.PicklingError:\n return False\n return True",
"def pickling_check(instance):\n pkled_instance = pickle.loads(pickle.dumps(instance))\n equality_check(instance, pkled_in... | [
"0.7766796",
"0.7023192",
"0.70111704",
"0.68939847",
"0.68062013",
"0.6688174",
"0.65288275",
"0.64928705",
"0.6480514",
"0.6470261",
"0.64368373",
"0.64125913",
"0.6339479",
"0.63313913",
"0.62767243",
"0.62755203",
"0.6253431",
"0.62279636",
"0.6154304",
"0.61521703",
"0.6... | 0.58481103 | 36 |
returns the position of the first element of L (or null if empty) | def first(self):
if self.head == None: #check if first(head) node is empty
return 'null' #if yes, then return null
else: #if it is not empty
return self.head.data #return the data of head node
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(l):\n return next(iter(l), None)",
"def get_position(self, pos):\n element = self.head\n count = 1\n\n if pos == 1:\n return element\n elif pos > 1 and self.head:\n while count < pos:\n element = element.next\n count += ... | [
"0.6740738",
"0.646736",
"0.6381092",
"0.6284914",
"0.62721545",
"0.6191292",
"0.61816573",
"0.61816573",
"0.6139446",
"0.6106643",
"0.610262",
"0.60530066",
"0.603829",
"0.6034633",
"0.59650475",
"0.59551835",
"0.5947551",
"0.5889093",
"0.5876231",
"0.5875915",
"0.5865966",
... | 0.0 | -1 |
returns the position of the last element of L (or null if empty) | def last(self):
if self.tail == None: #check if last(tail) node is empty
return 'null' #if yes, then return null
else: #if it is not empty
return self.tail.data #return the data of tail node
| {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_and_increment_last(l):\n if len(l) > 0:\n return l[-1] + 1\n else:\n return 0",
"def last_el(x):\n if N.isscalar(x): return x\n else: return x[-1]",
"def last_node(self):\n nodes = self.as_list()\n\n if... | [
"0.747328",
"0.6796135",
"0.6775285",
"0.6767427",
"0.6678793",
"0.6671239",
"0.66121864",
"0.657024",
"0.65492374",
"0.65280974",
"0.64499354",
"0.6430752",
"0.6406575",
"0.64011043",
"0.64009595",
"0.6396012",
"0.6385488",
"0.6368522",
"0.6234503",
"0.6195351",
"0.6172759",... | 0.62822825 | 18 |
returns the position of L immediately before position p (or null if p is the first position) | def before(self,p):
current = self.head #test from the head node
if p == current: #if the head node = p
return 'null' #there cannot be a node before it
while current != p: #else keep checking the elements until it reaches p
current = cur... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before(self, p):\n node = self._validate(p)\n return self._make_position(node._prev)",
"def before(self, p):\n self._validate(p) # inherited from linked bin tree\n if self.left(p):\n return self._subtree_last_position(self.left(p))\n else:\n ... | [
"0.73983413",
"0.725316",
"0.725187",
"0.66209006",
"0.649175",
"0.64731836",
"0.6471762",
"0.6471762",
"0.6406321",
"0.63417",
"0.6282636",
"0.62631005",
"0.6254486",
"0.6224825",
"0.60794467",
"0.6012308",
"0.59829956",
"0.59814024",
"0.596448",
"0.59429336",
"0.5918802",
... | 0.69982904 | 3 |
returns the position of L immediately after position p (or null if p is the last position) | def after(self,p):
current = self.tail #test from the tail node
if p == current: #if the tail node = p
return 'null' #there cannot be a node after it
while current !=p: #else keep cheking the elements until it reaches p
current = current... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after(self, p):\n self._validate(p)\n if self.right(p):\n return self._subtree_first_position(self.right(p))",
"def after(self, p):\n node = self._validate(p)\n return self._make_position(node._next)",
"def after(self, p):\n self._validate(p)\n # if ther... | [
"0.6643984",
"0.6595033",
"0.6525108",
"0.64751756",
"0.64172727",
"0.63107014",
"0.6306164",
"0.6306021",
"0.625738",
"0.6075544",
"0.60669947",
"0.59936905",
"0.5985779",
"0.59797704",
"0.59703594",
"0.5960083",
"0.5948607",
"0.5935823",
"0.5929081",
"0.58930165",
"0.588733... | 0.63229513 | 5 |
returns true if list L does not contain any elements | def isEmpty(self):
if self.size == 0:
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def empty_list(input_list):\n for item in input_list:\n if not isinstance(item, list) or not empty_list(item):\n return False\n return True",
"def empty(self):\n if len(self.list_x) == 0:\n return True\n else:\n return False",
"def has_duplicates(L):... | [
"0.69248295",
"0.6821237",
"0.6761476",
"0.6702743",
"0.6634148",
"0.6550037",
"0.6489615",
"0.63840836",
"0.63559216",
"0.6334243",
"0.6324001",
"0.6298447",
"0.6296335",
"0.6259463",
"0.6259463",
"0.6233526",
"0.6233526",
"0.62226903",
"0.6222215",
"0.6209927",
"0.62090117"... | 0.0 | -1 |
returns the number of elements in list L | def size(self):
return self.size.data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lsize( lst ):\n return sum( [ x[1] for x in lst ] )",
"def get_list_length(self):\n n = 0\n l = self\n while l.is_block():\n n+=1\n l = l.field(1)\n return n",
"def multiListSliceCount(lol):\n count = 1\n for i in range(0, len(lol)):\n count *= len(lol[i])\n #print ... | [
"0.80425906",
"0.73586816",
"0.73116475",
"0.7192604",
"0.71850836",
"0.7049387",
"0.7020185",
"0.6938846",
"0.6816559",
"0.68093985",
"0.6758624",
"0.6752049",
"0.66978496",
"0.66978496",
"0.66978496",
"0.66802704",
"0.6667987",
"0.6662106",
"0.66560817",
"0.6652997",
"0.665... | 0.0 | -1 |
insert a new element e into L before position p in L | def insertBefore(self,p,e):
if p == self.head: #if p is the head node
e.next = p #link e to p
p.prev = e #link p to e
self.head = e #set e to be the 'new' head node
else:
e.prev = p.prev #link e to prev node of p
e.n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_before(self, p, e):\n original = self._validate(p)\n return self._insert_between(e, original._prev, original)",
"def insert(self, p, elem):\n node = self._validate(p)\n new_node = self._Node(elem, idx=self._curr_idx, parent=node._parent)\n self._curr_idx += 1\n n... | [
"0.7177922",
"0.6874387",
"0.66734815",
"0.66600996",
"0.66056806",
"0.65625167",
"0.6527007",
"0.6516699",
"0.6501757",
"0.6501425",
"0.64947516",
"0.64712495",
"0.64524704",
"0.6429785",
"0.6418433",
"0.6399305",
"0.63491744",
"0.6340355",
"0.63270706",
"0.6181561",
"0.6172... | 0.700999 | 1 |
insert a new element e into L after position p in L | def insertAfter(self,p,e):
if p == self.tail: #if p is the tail node
e.prev = p #link e to p
p.next = e #link p to e
self.tail = e #set e to be the 'new' tail node
else:
e.next = p.next #link e to next node of p
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(self, p, elem):\n node = self._validate(p)\n new_node = self._Node(elem, idx=self._curr_idx, parent=node._parent)\n self._curr_idx += 1\n node._parent = new_node\n new_node._children.append(node)\n self._size += 1\n\n # Invalidate depths and heights after... | [
"0.6875697",
"0.683577",
"0.68196416",
"0.6734926",
"0.6691563",
"0.6660932",
"0.65894085",
"0.6546601",
"0.65235424",
"0.6392077",
"0.6371146",
"0.6342604",
"0.63203907",
"0.63068795",
"0.6300094",
"0.6290958",
"0.6276742",
"0.6204748",
"0.6189171",
"0.6147242",
"0.6122845",... | 0.682632 | 2 |
remove from L the element at position p | def remove(self,p):
if p == self.head: #if p is the head node
self.head = p.next #set the next node of p to be the 'new' head node
(p.next).prev = None #remove the node at p
p.next = None
elif p == self.tail: #if p is the tail node
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _primerElem(l):\n return l[0]",
"def _delete(self, p):\n node = self._validate_position(p)\n if self.num_children() == 2:\n raise ValueError(\"p has two children\")\n child = node.left if node.left else node.right\n if child is not None:\n child.pa... | [
"0.7094929",
"0.69678015",
"0.6729318",
"0.6718443",
"0.67099273",
"0.6697062",
"0.6682515",
"0.6554262",
"0.64620167",
"0.6452039",
"0.63894767",
"0.6297301",
"0.62565506",
"0.6173853",
"0.6139017",
"0.60856044",
"0.60625595",
"0.5995619",
"0.5984009",
"0.5981097",
"0.597260... | 0.7055117 | 1 |
Calculate lambda, as expected proportion of matches given current parameter estimates. This can then be used in future iterations. | def _get_new_lambda(df_intermediate, spark):
df_intermediate.createOrReplaceTempView("df_intermediate")
sql = _sql_gen_new_lambda(table_name = "df_intermediate")
new_lambda = spark.sql(sql).collect()[0][0]
logger.debug(_format_sql(sql))
return new_lambda | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lambda_test(p_values, df=1):\n from scipy.stats import chi2\n assert np.max(p_values) <= 1 and np.min(p_values) >= 0, 'These do not appear to be p-values'\n\n chi_sq_scores = chi2.ppf(1 - p_values, df)\n return np.median(chi_sq_scores) / chi2.ppf(0.5, df)",
"def estimate_lambda(pv):\n LOD2 = s... | [
"0.6383703",
"0.61530626",
"0.6080477",
"0.6018759",
"0.5840749",
"0.5760841",
"0.5750119",
"0.57363546",
"0.5723312",
"0.5714453",
"0.56494725",
"0.56297857",
"0.5629501",
"0.5614423",
"0.5603768",
"0.5592957",
"0.55713123",
"0.5547953",
"0.5502096",
"0.5501065",
"0.5482079"... | 0.0 | -1 |
This intermediate step is calculated for efficiency purposes. In the maximisation step, to compute the new pi probability distributions, we need to perform a variety of calculations that can all be derived from this intermediate table. Without this intermediate table, we'd be repeating these calculations multiple times... | def _sql_gen_intermediate_pi_aggregate(params, table_name="df_e"):
gamma_cols_expr = ", ".join(params._gamma_cols)
sql = f"""
select {gamma_cols_expr}, sum(match_probability) as expected_num_matches, sum(1- match_probability) as expected_num_non_matches, count(*) as num_rows
from {table_name}
grou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pi(self):\n normalized_n_dst = self.n_dst.copy() + self.gammaVec\n normalized_n_dst /= normalized_n_dst.sum(2)[:,:,np.newaxis]\n return normalized_n_dst",
"def pss(self):\n return (self.table[0, 0] * self.table[1, 1] - self.table[0, 1] * self.table[1, 0]) / \\\n ((se... | [
"0.62122965",
"0.61385614",
"0.6076035",
"0.6052701",
"0.6030304",
"0.6028335",
"0.5994988",
"0.59436256",
"0.59324783",
"0.59095144",
"0.5829195",
"0.5826312",
"0.58158267",
"0.57321453",
"0.5729174",
"0.57263774",
"0.57257736",
"0.572308",
"0.5709745",
"0.56897724",
"0.5683... | 0.5574973 | 34 |
Calculate and collect a dataframe that contains all the new values of pi | def _get_new_pi_df(df_intermediate, spark, params):
df_intermediate.createOrReplaceTempView("df_intermediate")
sql = _sql_gen_pi_df(params)
levels = spark.sql(sql).collect()
logger.debug(_format_sql(sql))
return [l.asDict() for l in levels] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_ppmi_dataframe(df):\n print(\"Finding ppmi values.\")\n total_playcount = sum(df.sum())\n user_playcounts = df.sum(axis=1)\n artist_playcounts = df.sum(axis=0)\n ppmi_df = copy.copy(df)\n count = 0\n for user, user_artist_playcounts in df.iterrows():\n count += 1\n for ar... | [
"0.61537164",
"0.61082387",
"0.58550006",
"0.583575",
"0.57613325",
"0.56257576",
"0.56048256",
"0.55872786",
"0.55625355",
"0.55508137",
"0.5512807",
"0.54886276",
"0.5485332",
"0.5442169",
"0.5427862",
"0.54192454",
"0.5370678",
"0.53671974",
"0.53658366",
"0.53658366",
"0.... | 0.6026391 | 2 |
Compute new parameters and save them in the params object Note that the params object will be updated inplace by this function | def run_maximisation_step(df_e: DataFrame, params:Params, spark:SparkSession):
sql = _sql_gen_intermediate_pi_aggregate(params)
df_e.createOrReplaceTempView("df_e")
df_intermediate = spark.sql(sql)
logger.debug(_format_sql(sql))
df_intermediate.createOrReplaceTempView("df_intermediate")
df_int... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def params(self,new):\n self._params = new\n self._config_set()\n self._make_model()",
"def update_params(self):\n pass",
"def _update(self):\n self.all_params = {}\n self._update_experiment_params()\n self._update_preprocessing_params()\n self._update_mo... | [
"0.75146294",
"0.7500831",
"0.73883706",
"0.7324785",
"0.7292129",
"0.72097903",
"0.7136608",
"0.7088695",
"0.70828885",
"0.68995994",
"0.6886074",
"0.68453836",
"0.68438697",
"0.6820021",
"0.6814047",
"0.6811034",
"0.6809738",
"0.67101955",
"0.67038906",
"0.6682897",
"0.6675... | 0.0 | -1 |
We don't need to do anything here | def reset(self):
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __call__(self):\n\t\treturn",
"def __call__(self) -> None:",
"def _prepare(self):",
"def _prepare(self):",
"def use(self):",
"def _postprocess(self):",
"def think(self):\n pass",
"def task4_1(self):\n\n pass",
"def process(self):",
"def process(self):",
"def process(self):",
... | [
"0.6804911",
"0.6802637",
"0.6771641",
"0.6771641",
"0.66040874",
"0.6561943",
"0.65613747",
"0.65321374",
"0.65316516",
"0.65316516",
"0.65316516",
"0.6511114",
"0.6511114",
"0.6489836",
"0.6477101",
"0.6477101",
"0.6435898",
"0.64198613",
"0.63735265",
"0.6354782",
"0.63547... | 0.0 | -1 |
Corrupt the user_actions Iterate through confidence scores from the user and assign confidence scores | def act(self):
channel_act = copy.deepcopy(self.observation)
for user_act in channel_act['user_acts']:
# Dialogue Act
da_conf = self.generate_confidence()
da_value = user_act["dialogue_act"]["value"]
if np.random.random() > da_conf:
if da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processUserAction(self, user_action):\n self.history[\"user_action\"] = user_action\n dialogue_act = user_action[\"action\"]\n self.current_function = None\n self.dont_know = False\n\n\n def provideQuery():\n self.query = user_action[\"query\"]\n self.qu... | [
"0.599231",
"0.57049847",
"0.5691581",
"0.56584775",
"0.54967844",
"0.5440647",
"0.537422",
"0.53671217",
"0.53370816",
"0.52791506",
"0.5246821",
"0.52241063",
"0.5219914",
"0.521852",
"0.51977473",
"0.51950365",
"0.5189769",
"0.51806927",
"0.51794785",
"0.5178694",
"0.51723... | 0.6197056 | 0 |
Samples a confidence scores with mean and std and to 2 floating points | def generate_confidence(self):
conf_score = np.random.normal(self.speech_conf_mean,
self.speech_conf_std)
conf_score = round(conf_score, 2)
conf_score = max(conf_score, 0.0) # >= 0.
conf_score = min(conf_score, 1.0) # <= 1.
return conf_scor... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mean_and_std(arr):\r\n return np.round(np.mean(arr), 3), np.round(np.std(arr), 3)",
"def t_confidence_Interval_Difference_Of_Means(xSamples, ySamples, confidence):\n try:\n if len(xSamples) >= 30 or len(ySamples) >= 30:\n raise sampleSizeError(\"Should use normal distribution inst... | [
"0.66411084",
"0.6402423",
"0.6390351",
"0.6385513",
"0.63556993",
"0.6347492",
"0.63240963",
"0.63124734",
"0.62927604",
"0.62422436",
"0.62417847",
"0.6182535",
"0.6175855",
"0.6153768",
"0.61489564",
"0.61415195",
"0.6125406",
"0.6114166",
"0.6107675",
"0.60969204",
"0.609... | 0.60132307 | 27 |
Converts user_acts into tempplate utterances | def template_nlg(self, user_acts):
utt_list = []
for user_act in user_acts:
user_dialogue_act = user_act['dialogue_act']['value']
if user_dialogue_act == UserAct.INFORM:
# Template based NLG based on intent
intent_slot = user_act.get('intent', None... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_ta_from_act(baseurl, userid):\n\n objects = create_api_agent(baseurl, userid).object_search(\n object_type=[\"threatActor\"], limit=1000\n )\n\n ta_set = set()\n\n for x in objects:\n ta_set.add(x.value)\n\n return list(ta_set)",
"def act(self):\n channel_act = cop... | [
"0.58724743",
"0.5625835",
"0.551214",
"0.5409075",
"0.53485686",
"0.5217385",
"0.5202939",
"0.5195586",
"0.51527953",
"0.5138877",
"0.51198244",
"0.50440043",
"0.50417674",
"0.50400853",
"0.5015522",
"0.49861735",
"0.49047104",
"0.49036646",
"0.48940292",
"0.4872141",
"0.485... | 0.6775663 | 0 |
Gets node class with string | def builder(string):
return getattr(sys.modules[__name__], string) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_cls(node):\n return node.get_attr(Type).load()",
"def ast_class(cl):\n\n return cl.__class__.__name__",
"def get_class_name(self):\n\n if \"class\" in self._root.attrib:\n return self._root.attrib['class']\n else:\n return self._root.tag",
"def getClass(strn... | [
"0.7078205",
"0.6657408",
"0.6641923",
"0.66377974",
"0.65782577",
"0.6392188",
"0.63500905",
"0.63432723",
"0.63345295",
"0.62907475",
"0.6290162",
"0.6285721",
"0.62509006",
"0.61592335",
"0.6113799",
"0.60864496",
"0.60847723",
"0.6084575",
"0.60062665",
"0.5986922",
"0.59... | 0.0 | -1 |
Makes a list of short language targets from docopt arguments. | def short_language_targets(arguments):
language_targets = [('cocoa', 'Cocoa'), ('cpp', 'C++'), ('csharp', 'C#'),
('delphi', 'Delphi'), ('erl', 'Erlang'), ('go', 'Go'),
('hs', 'Haskell'), ('java', 'Java'), ('perl', 'Perl'),
('py', 'Python'), ('r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def targets(path, args):\n if args:\n return \" \".join([\"{0}{1}\".format(path, target) for target in args])",
"def main(argv, to_language=TO_LANGUAGE, from_language=FROM_LANGUAGE):\n # TODO use docopt to handle the command line arguments! Cf. http://docopt.org/\n # TODO can docopt handle a cli docume... | [
"0.6037546",
"0.59513944",
"0.58951634",
"0.56917363",
"0.55272824",
"0.5514861",
"0.5499981",
"0.54830027",
"0.53945893",
"0.5386601",
"0.53694504",
"0.53217447",
"0.5305375",
"0.5300996",
"0.5243239",
"0.51841044",
"0.51742613",
"0.517381",
"0.51401",
"0.51359576",
"0.51312... | 0.7530393 | 0 |
Parse input arguments using docopt, and validate parsed arguments. | def parse_input_arguments():
maxcompiler_dir = os.environ.get('MAXCOMPILERDIR')
docopt_arguments = docopt(__doc__, version=common.VERSION)
maxfile = os.path.abspath(docopt_arguments['<maxfile>'])
output_dir = os.path.abspath(docopt_arguments['-d'])
if not maxcompiler_dir:
print 'Environme... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_arguments(args):\n if not args.input_file[-4:] == \".pdb\":\n exit(\"ERROR: Input file should be in PDB format\")\n if args.n_decoys < 0:\n exit(\"ERROR: Number of decoys must be a non-negative value\")\n if args.n_steps < 0:\n exit(\"ERROR: Number of PASSO steps must be ... | [
"0.72529703",
"0.6942774",
"0.6896695",
"0.66919255",
"0.6578765",
"0.65496486",
"0.6525131",
"0.65190226",
"0.6444054",
"0.6442767",
"0.64228827",
"0.6420457",
"0.64047205",
"0.6385732",
"0.63761455",
"0.6372911",
"0.6366383",
"0.6366383",
"0.6338424",
"0.6327316",
"0.632446... | 0.5999665 | 55 |
Generate wrappers for cpp and target languages using thrift. | def generate_thrift_wrappers(maxfile_name, dirs, targets):
with common.change_working_directory(dirs['scratch']):
run('thrift', '--gen', 'cpp', maxfile_name + '.thrift')
for target in targets:
run('thrift', '--gen', target, maxfile_name + '.thrift')
target_dir = os.path.joi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genlangs(self):\r\n raise NotImplementedError",
"def generate(env) -> None:\n c_file, cxx_file = SCons.Tool.createCFileBuilders(env)\n\n # C\n c_file.add_action(\".l\", LexAction)\n c_file.add_emitter(\".l\", lexEmitter)\n\n c_file.add_action(\".lex\", LexAction)\n c_file.add_emitter(\".... | [
"0.6480759",
"0.58898515",
"0.57488286",
"0.5730907",
"0.57146156",
"0.56862015",
"0.55958766",
"0.5567627",
"0.5498909",
"0.53208256",
"0.53153443",
"0.52377367",
"0.52115756",
"0.5196872",
"0.51798254",
"0.5160678",
"0.5137435",
"0.51359266",
"0.51251113",
"0.51107913",
"0.... | 0.7060585 | 0 |
Makes server executable and copies it to the server directory. | def make_server_binary(maxfile_name, dirs):
cpp_flags = ['-finstrument-functions', '-fopenmp', '-fPIC',
'-I', dirs['slic'], '-I', 'gen-cpp']
ld_flags = ['-fopenmp', '-lresolv', '-lnsl', '-lthrift',
'-lslic', '-lmaxeleros', '-lpthread', '-lm', '-lrt',
'-L', '/lib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __run_server(self):\n os.chdir(os.path.dirname(self.server_path))\n self.server_process = subprocess.Popen([self.server_path, \\\n \"{}:{}\".format(self.args.ip, self.args.port)])",
"def cmd_install(self, wwwdata):\n server_dir = os.path.join(data_dir, 'server')\n shuti... | [
"0.6527404",
"0.6116494",
"0.611519",
"0.59657335",
"0.5925858",
"0.59156394",
"0.5887736",
"0.58727956",
"0.58700514",
"0.5839557",
"0.58347446",
"0.5825447",
"0.57806313",
"0.5776767",
"0.56729174",
"0.56441593",
"0.56402147",
"0.5629048",
"0.5612238",
"0.5604618",
"0.55996... | 0.60644394 | 3 |
SearchArticlesOldGet200ApplicationJsonResponse a model defined in OpenAPI | def __init__(self, total_hits=None, results=None, local_vars_configuration=None): # noqa: E501 # noqa: E501
if local_vars_configuration is None:
local_vars_configuration = Configuration()
self.local_vars_configuration = local_vars_configuration
self._total_hits = None
self... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_models_request():\n # TODO: add sort and filter by creation/modification date\n return (\n json.dumps({\"models\": {\n k: d[\"data\"] for k, d in app.models.items()\n }}), 200,\n {'ContentType': 'application/json'}\n )",
"def opt_model_create_rest_api():\n r... | [
"0.6143598",
"0.5736824",
"0.5614495",
"0.56118083",
"0.56109303",
"0.5537503",
"0.5485257",
"0.5410691",
"0.54061174",
"0.5308331",
"0.5292343",
"0.5291964",
"0.52889574",
"0.52812797",
"0.52679974",
"0.522819",
"0.52141756",
"0.5212764",
"0.519609",
"0.5194048",
"0.51909727... | 0.0 | -1 |
Sets the total_hits of this SearchArticlesOldGet200ApplicationJsonResponse. | def total_hits(self, total_hits):
self._total_hits = total_hits | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total(self):\n return self._evaluate()['hits']['total']",
"def put(self):\n global hits\n hits += 1\n return {\"hits\": hits}, 200",
"def reads_total(self, reads_total):\n\n self._reads_total = reads_total",
"def total(self, total):\n\n self._total = total",
"def t... | [
"0.54473805",
"0.54155636",
"0.52267927",
"0.5190426",
"0.5190426",
"0.5190426",
"0.5190426",
"0.5190426",
"0.5190426",
"0.5190426",
"0.5190426",
"0.51651007",
"0.4924236",
"0.4924236",
"0.48841897",
"0.48756126",
"0.48579973",
"0.48558527",
"0.4820793",
"0.47767225",
"0.4775... | 0.7280627 | 0 |
Sets the results of this SearchArticlesOldGet200ApplicationJsonResponse. | def results(self, results):
self._results = results | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results(self, results):\n self._results = results",
"def results(self, results):\n self._results = results",
"def update_results(self, results):\n pass",
"def get_results(self):\n\n super().get_results()",
"def update_results(self):\n try:\n results = self.... | [
"0.57976335",
"0.57976335",
"0.55461985",
"0.5324147",
"0.5291422",
"0.52474743",
"0.523546",
"0.523546",
"0.52331185",
"0.51514375",
"0.5126471",
"0.51160884",
"0.50785786",
"0.50740576",
"0.5028948",
"0.4993678",
"0.49873585",
"0.49852616",
"0.49796173",
"0.49095565",
"0.48... | 0.5727451 | 6 |
Returns the model properties as a dict | def to_dict(self):
result = {}
for attr, _ in six.iteritems(self.openapi_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_dict(self):\n return self.properties",
"def to_dict(self):\n return self.properties",
"def get_properties(self):\n return self.properties",
"def asdict(self):\n return self._prop_dict",
"def json(self):\n rv = {\n prop: getattr(self, prop)\n f... | [
"0.7751993",
"0.7751993",
"0.73391134",
"0.7334895",
"0.7297356",
"0.727818",
"0.7159078",
"0.71578115",
"0.71494967",
"0.71494967",
"0.71283495",
"0.71275014",
"0.7122587",
"0.71079814",
"0.7060394",
"0.7043251",
"0.7034103",
"0.70233124",
"0.69635814",
"0.69586295",
"0.6900... | 0.0 | -1 |
Returns the string representation of the model | def to_str(self):
return pprint.pformat(self.to_dict()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __str__(self):\n return super().__str__() + self.model.__str__()",
"def __str__(self) -> str:\n # noinspection PyUnresolvedReferences\n opts = self._meta\n if self.name_field:\n result = str(opts.get_field(self.name_field).value_from_object(self))\n else:\n ... | [
"0.85856473",
"0.7816244",
"0.77898955",
"0.77511245",
"0.77511245",
"0.7712556",
"0.76984036",
"0.766997",
"0.7650706",
"0.7601334",
"0.7583777",
"0.7571045",
"0.75404567",
"0.7523676",
"0.7515677",
"0.7501507",
"0.7488033",
"0.7488033",
"0.74696296",
"0.7452353",
"0.7446052... | 0.0 | -1 |
For `print` and `pprint` | def __repr__(self):
return self.to_str() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pprint(*args, **kwargs):\n if PRINTING:\n print(*args, **kwargs)",
"def print_out():\n pass",
"def custom_print(*objects):\n print(*objects, sep=OFS, end=ORS)",
"def _print(self, *args):\n return _ida_hexrays.vd_printer_t__print(self, *args)",
"def _printable(self):\n ... | [
"0.75577617",
"0.73375154",
"0.6986672",
"0.698475",
"0.6944995",
"0.692333",
"0.6899106",
"0.6898902",
"0.68146646",
"0.6806209",
"0.6753795",
"0.67497987",
"0.6744008",
"0.6700308",
"0.6691256",
"0.6674591",
"0.6658083",
"0.66091245",
"0.6606931",
"0.6601862",
"0.6563738",
... | 0.0 | -1 |
Returns true if both objects are equal | def __eq__(self, other):
if not isinstance(other, SearchArticlesOldGet200ApplicationJsonResponse):
return False
return self.to_dict() == other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self, other):\n return are_equal(self, other)",
"def __eq__(self,other):\n try: return self.object==other.object and isinstance(self,type(other))\n except: return False",
"def __eq__(self, other):\n if i... | [
"0.8088132",
"0.8088132",
"0.8054589",
"0.7982687",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
"0.79670393",
... | 0.0 | -1 |
Returns true if both objects are not equal | def __ne__(self, other):
if not isinstance(other, SearchArticlesOldGet200ApplicationJsonResponse):
return True
return self.to_dict() != other.to_dict() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ne__(self, other: object) -> bool:\n if self.__eq__(other):\n return False\n return True",
"def __ne__(self, other: object) -> bool:\n return not self.__eq__(other)",
"def __ne__(self, other) -> bool:\n return not self.__eq__(other)",
"def __eq__(self, other):\n ... | [
"0.845611",
"0.8391477",
"0.8144138",
"0.81410587",
"0.8132492",
"0.8093973",
"0.80920255",
"0.80920255",
"0.80920255",
"0.8085325",
"0.8085325",
"0.8076365",
"0.8076365",
"0.8065748",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
"0.8042487",
... | 0.0 | -1 |
Create a new decider instance for this tank. | def __init__(self, target_height, margin):
self.target_height = target_height
self.margin = margin | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_test_discount(self):\n return Discount()",
"def create_child(parent, idx):\n boardCopy = deepcopy(parent.currentBoardState)\n action = boardCopy.get_available_actions()[idx]\n parent.children[idx] = DecisionTree(boardCopy, action, parent.level+1, parent, strategy=parent.strategy)",
"de... | [
"0.5191765",
"0.5076142",
"0.5060887",
"0.5056275",
"0.49928105",
"0.49708506",
"0.49122322",
"0.4881246",
"0.48092645",
"0.48057178",
"0.48007756",
"0.4775759",
"0.4762769",
"0.47324157",
"0.47183925",
"0.4665197",
"0.4644241",
"0.46142703",
"0.459592",
"0.45821506",
"0.4580... | 0.0 | -1 |
Decide a new action for the pump, given the current height of liquid in the tank and the current action of the pump. Note that the new action for the pump MAY be the same as the current action of the pump. | def decide(self, current_height, current_action, actions):
actions = actions.update({'DUMMY': 10})
if current_action == 'PUMP_OFF':
if current_height < self.target_height - self.margin:
output = 'PUMP_IN'
elif current_height > self.margin + self.target_height:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action(self, action_space, observation, info): # pylint: disable=no-self-use\n _ = observation\n equity_alive = info['player_data']['equity_to_river_alive']\n\n incremen1 = .1\n increment2 = .2\n\n if equity_alive > self.min_bet_equity + increment2 and Action.ALL_IN in actio... | [
"0.60473734",
"0.5985461",
"0.5977221",
"0.59078944",
"0.5883411",
"0.5873858",
"0.5844478",
"0.5834539",
"0.58246136",
"0.5776659",
"0.57639843",
"0.5763768",
"0.57577544",
"0.57437027",
"0.5739798",
"0.5713187",
"0.5679994",
"0.5670566",
"0.56656426",
"0.56560576",
"0.56474... | 0.68249935 | 0 |
The FileLines instance is computed once for the whole file, and then given to objects like functions, etc ... Overriding the __getattr__ allows to return the proper number of lines of code | def __getattr__(self, name):
if name == "all_lines":
if self.start_pos and self.end_pos:
all_lines = []
for line in self._all_lines:
if self.is_line_in_range(line):
all_lines.append(line)
return all_lines
else:
return self._all_lines | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, filepath):\n self.filepath = filepath\n with open(filepath) as f:\n self.lines = f.readlines()\n #self.lines = open(self.filepath).readlines()",
"def count_lines(file_obj):\n for idx, line in enumerate(file_obj):\n pass\n file_obj.seek(0)\n retur... | [
"0.6283597",
"0.6183272",
"0.5958822",
"0.59523785",
"0.59335214",
"0.58936715",
"0.5865806",
"0.58191407",
"0.57664025",
"0.5741699",
"0.56886345",
"0.5679209",
"0.56454134",
"0.5637524",
"0.5636009",
"0.563222",
"0.5628767",
"0.561285",
"0.5605677",
"0.56037796",
"0.5603779... | 0.6028943 | 2 |
Preconditions a and b are both positive integers. Posconditions The equation for ax+by=gcd(a,b) has been returned where x and y are solved. | def extendedEuclid(a,b):
b,a=max(a,b),min(a,b)
# Format of euclidList is for back-substitution
euclidList=[[b%a,1,b,-1*(b//a),a]]
while b%a>0:
b,a=a,b%a
euclidList.append([b%a,1,b,-1*(b//a),a])
if len(euclidList)>1:
euclidList.pop()
euclidList=euclidList[::-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xgcd(a, b):\n x0, x1, y0, y1 = 0, 1, 1, 0\n while a != 0:\n q, b, a = b // a, a, b % a\n y0, y1 = y1, y0 - q * y1\n x0, x1 = x1, x0 - q * x1\n return b, x0, y0",
"def xgcd(a, b):\n x0, x1, y0, y1 = 0, 1, 1, 0\n while a != 0:\n q, b, a = b // a, a, b % a\n y0,... | [
"0.8131183",
"0.8131183",
"0.8131183",
"0.8057621",
"0.80062246",
"0.7813316",
"0.77613276",
"0.77406746",
"0.76858586",
"0.7654909",
"0.7601469",
"0.7501284",
"0.7445204",
"0.7383715",
"0.7354288",
"0.7335645",
"0.73292977",
"0.7298441",
"0.729725",
"0.72899187",
"0.7289423"... | 0.0 | -1 |
Get rid of spikes in the tracking traces, using the derivative to identify them. Substitute the corresponding point in the trace with the mean of the previous and following point. | def func(self, browser):
############################################
# ANALYSIS FUNCTION
# Read options
derivativeThs = float(self.plotWidget.derivativeCursorThsPos)
nPoints = int(self.nPoints.text())
# Get plotted data
items = self.plotWidget.plotDa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeInsignificant(self):\n #TODO make sure this method now works AFTER meanCurves and analyseCures have been run\n \n # Searching for curves that are in the noise\n if len(self.plate.noProtein) > 0:\n thresholdm, i = rh.meanSd([self.originalPlate.wells[x].monoThresh for... | [
"0.58470225",
"0.5708201",
"0.5597968",
"0.54835445",
"0.54410774",
"0.542808",
"0.54200786",
"0.5339328",
"0.5296624",
"0.5267313",
"0.51959884",
"0.51736915",
"0.5172928",
"0.5141799",
"0.51233274",
"0.51216316",
"0.5119079",
"0.51096934",
"0.50713056",
"0.5036228",
"0.5022... | 0.5065696 | 19 |
Show derivative of plotted traces | def show_derivative(self):
for trace in self.plotWidget.plotDataItems:
dt = float(trace.attrs['dt'])
dtrace = np.diff(trace.data)
x = pgplot.make_xvector(dtrace, dt)
self.plotWidget.plot(x, dtrace, pen=pg.mkPen('r')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_trace(self):\n az.plot_trace(self.ifd_)",
"def plotTrace(trace):\n for t in trace:\n plt.plot(range(len(t)),t,alpha=0.5)\n plt.ylabel(\"Trace\")\n plt.xlabel(\"Step\")\n\n return",
"def plotalltraces(td):\n \n plotmsubtrace(td, 211)\n dftf.plotflypic(td, 212)",
"de... | [
"0.63325393",
"0.6113642",
"0.6045664",
"0.6022848",
"0.5986188",
"0.5986095",
"0.5979825",
"0.58989567",
"0.5875466",
"0.5855709",
"0.5802141",
"0.57811975",
"0.5743841",
"0.57375747",
"0.5692409",
"0.5653667",
"0.5639974",
"0.56074584",
"0.5578918",
"0.5578197",
"0.5554327"... | 0.858307 | 0 |
Show horizontal cursor to set Derivative threshold | def show_derivativeCursor(self, var):
if self.derivativeThreshold.isChecked():
self.plotWidget.derivativeCursorThsPos = 0
self.plotWidget.derivativeCursorThs = pg.InfiniteLine(pos=self.plotWidget.derivativeCursorThsPos,
angle=0, movabl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int_33H_4(self):\r\n horizontal_position = self.registers['CX'].get_int(-1)\r\n vertical_position = self.registers['DX'].get_int(-1)\r\n print(horizontal_position, vertical_position)\r\n MainWindow.set_cursor_poisition(horizontal_position, vertical_position)",
"def cmd_h(self):\n ... | [
"0.5796579",
"0.55734044",
"0.55304766",
"0.5470074",
"0.5419417",
"0.5379397",
"0.5370672",
"0.532646",
"0.52975315",
"0.5263073",
"0.5261954",
"0.52364624",
"0.5232485",
"0.51936173",
"0.517233",
"0.5167267",
"0.51614726",
"0.5137182",
"0.5129036",
"0.51274407",
"0.5126044"... | 0.7340794 | 0 |
Taking command line input from user argLen=len(sys.argv) accessKey='' secretAccessKey='' | def run(self):
#To ADD
# Get Access keys from command line
accessKey = self.accessKey
secretAccessKey = self.secretAccessKey
try:
#Creating S3 Connection using Access and Secrect access key
conn = S3Connection(accessKey, secretAccessKey)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_main_optional_args(self):\n args = [\"in_toto_keygen.py\"]\n password = \"123456\"\n with patch.object(sys, 'argv', args + [\"-p\", \"bob\"]), \\\n patch(\"getpass.getpass\", return_value=password), self.assertRaises(\n SystemExit):\n in_toto_keygen_main()\n with patch.object(sy... | [
"0.6283587",
"0.62699413",
"0.6263736",
"0.6237544",
"0.60287285",
"0.5915213",
"0.59088415",
"0.5829603",
"0.58103305",
"0.5777824",
"0.5756763",
"0.5748059",
"0.57381445",
"0.57310563",
"0.5710534",
"0.5703511",
"0.56833094",
"0.56609464",
"0.564093",
"0.5634175",
"0.563356... | 0.0 | -1 |
Queryset rezervacije mora biti prefetchan tako, da obstaja atribut seznam_ucilnic | def dodaj_rezervacije(self, rezervacije):
for r in rezervacije:
for u in r.seznam_ucilnic:
for d in r.dnevi_med(self.min_datum, self.max_datum):
self.rezerviranost_ucilnic[u.pk, d].append(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return Pregunta.objects.order_by('-fecha_publicacion')[:5]",
"def get_queryset(self):\n return Pregunta.objects.order_by('-fecha_publicacion')[:5]",
"def prefetch(self, oids):\n self.timeline.reset()\n self.timeline.start(\"prefetch\")\n fetch(oids)\... | [
"0.5717746",
"0.5717746",
"0.5453998",
"0.5419845",
"0.54132175",
"0.52975947",
"0.52657986",
"0.52616173",
"0.5224112",
"0.52203935",
"0.5219025",
"0.5162499",
"0.5152765",
"0.506055",
"0.5051794",
"0.50504905",
"0.5009305",
"0.50009507",
"0.49670637",
"0.49513248",
"0.49505... | 0.0 | -1 |
Queryset rezervacije mora biti prefetchan tako, da obstaja atribut seznam_ucilnic | def za_rezervacije(rezervacije: RezervacijaQuerySet):
min_datum = datetime.date.max
max_datum = datetime.date.min
ucilnice = set()
for r in rezervacije:
if r.zacetek < min_datum:
min_datum = r.zacetek
if r.konec > max_datum:
max_dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self):\n return Pregunta.objects.order_by('-fecha_publicacion')[:5]",
"def get_queryset(self):\n return Pregunta.objects.order_by('-fecha_publicacion')[:5]",
"def prefetch(self, oids):\n self.timeline.reset()\n self.timeline.start(\"prefetch\")\n fetch(oids)\... | [
"0.5716318",
"0.5716318",
"0.54535943",
"0.54185843",
"0.54111767",
"0.52951235",
"0.5264533",
"0.526032",
"0.52224743",
"0.5219302",
"0.5218486",
"0.51620924",
"0.51517016",
"0.50509757",
"0.50482804",
"0.50082207",
"0.49993232",
"0.49658108",
"0.4950173",
"0.4949384",
"0.49... | 0.5060937 | 13 |
Vrne konflikte z dejavnostjo, ki bi v ucilnici `ucilnica` potekala dne `datum` od ure `od` do `do`. | def konflikti(self, ucilnica, datum, od, do, ignore=None):
konflikti = Konflikt()
if ucilnica not in self.ucilnice:
raise ValueError("Struktura iskanja ni bila pripravljena za iskanje konfliktov v učilnici {}".format(ucilnica))
if not (self.min_datum <= datum <= self.max_datum):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def afficher(dico):\n return dico",
"def konvertuj_datum(self, datum):\n brojevi = datum.split(\".\")\n konvertovani = date(int(brojevi[2]), int(brojevi[1]), int(brojevi[0]))\n return konvertovani",
"def get_diluciju(self, naziv):\n jedinica = self.dilucijskeJedinice[naziv]\n ... | [
"0.58726335",
"0.5751894",
"0.55712575",
"0.53919107",
"0.5346459",
"0.5335857",
"0.52883875",
"0.5163623",
"0.51620984",
"0.5089418",
"0.5075269",
"0.50245464",
"0.50216717",
"0.49458143",
"0.48880613",
"0.48880613",
"0.48863357",
"0.48458362",
"0.47982788",
"0.47760344",
"0... | 0.67294 | 0 |
Calls libueye function "name" and arguments "args". | def CALL(name, *args):
funcname = 'is_' + name
func = getattr(libueye, funcname)
new_args = []
for a in args:
if isinstance (a, unicode):
print name, 'argument',a, 'is unicode'
new_args.append (str (a))
else:
new_args.append (a)
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exec_function(self, args):\n raise NotImplementedError()",
"def function(args):\n pass",
"def execute(*args):",
"def call_command(self, name, args):\n try:\n cmd = self.commands[name]\n except KeyError:\n self.answer(\"Unknown command\", success=False)\n ... | [
"0.640477",
"0.6396848",
"0.622575",
"0.6156197",
"0.6116038",
"0.60650057",
"0.6060712",
"0.6041498",
"0.59850496",
"0.598363",
"0.598363",
"0.59757733",
"0.5974144",
"0.5971125",
"0.59319705",
"0.5909913",
"0.59068924",
"0.5881039",
"0.584733",
"0.5842975",
"0.5842975",
"... | 0.7134281 | 0 |
AddToSequence() inserts image memory into the image memory list, which is to be used for ring buffering. The image memory has to be allocated with AllocImageMem(). All image memory which is used for ring buffering must have been allocated the same colour depth (i.e. bits per pixel). The number of image memories for a s... | def AddToSequence(self):
self.seq += 1
r = CALL('AddToSequence',self,self.image,self.id)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blit_numbering_raster_sequence(\n seq: numpy.ndarray,\n *,\n placement: DoubleNumber = (0, 30),\n color: TripleNumber = (\n 0,\n 0,\n 1,\n ), # If your images are in [0, 255] range replace (0, 0, 1) with (0, 0, 255)\n thickness: Number = 2,\n font_scale: Number = 1,\n... | [
"0.59207517",
"0.5390376",
"0.53259945",
"0.5279279",
"0.5246303",
"0.52161103",
"0.5213354",
"0.5180779",
"0.5101926",
"0.50713897",
"0.5061602",
"0.5060367",
"0.5037115",
"0.5005602",
"0.5003824",
"0.49623504",
"0.49397454",
"0.49381202",
"0.49326006",
"0.49286252",
"0.4914... | 0.692556 | 0 |
ClearSequence() deletes all image memory from the sequence list that was inserted with AddToSequence(). After ClearSequence() no more image memory is active. To make a certain part of the image memory active, SetImageMem() and SetImageSize() have to be executed. Not tested! | def ClearSequence(self):
r = CALL('ClearSequence',self)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clearImage(self):\n if self.hasImage():\n self.scene.removeItem(self._pixmapHandle)\n self._pixmapHandle = None\n self.zoom=-1\n self.scene.clear()",
"def clear_space():\r\n global images_a, images_b, images_total\r\n images_a = []\r\n images_b = []... | [
"0.6570196",
"0.65086734",
"0.64905375",
"0.6423561",
"0.63797385",
"0.63776374",
"0.62805897",
"0.6275361",
"0.61856747",
"0.61388135",
"0.6086096",
"0.6067803",
"0.6053134",
"0.60502607",
"0.60235214",
"0.60192657",
"0.6007248",
"0.6005377",
"0.5986416",
"0.5961006",
"0.590... | 0.64965254 | 2 |
LockSeqBuf() can be used to disable the overwriting of the image memory with new image data. And thus it is possible to prevent images which are required for further processing from being overwritten. Full access to the image memory is still available. Only one image memory can be disabled at the same time. To access t... | def LockSeqBuf(self,number):
r = CALL('LockSeqBuf',self,INT(number),self.image)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UnlockSeqBuf(self,number):\r\n r = CALL('UnlockSeqBuf',self,INT(number),self.image)\r\n return self.CheckForSuccessError(r)",
"def lock(self, writelock=False, nattempts=0):\n return _image.image_lock(self, writelock, nattempts)",
"def SetImageMem(self):\r\n r = CALL(\"SetImageMe... | [
"0.6084089",
"0.56645983",
"0.5099585",
"0.5071171",
"0.5041481",
"0.50194633",
"0.4996996",
"0.49619144",
"0.49557486",
"0.4897481",
"0.48785716",
"0.4865201",
"0.47347102",
"0.470923",
"0.47019348",
"0.46933535",
"0.46878475",
"0.46854433",
"0.46795315",
"0.46741796",
"0.46... | 0.71576244 | 0 |
With UnlockSeqBuf() image acquisition is allowed in a previously locked image memory. The image memory is put to the previous position in the sequence list. | def UnlockSeqBuf(self,number):
r = CALL('UnlockSeqBuf',self,INT(number),self.image)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def LockSeqBuf(self,number):\r\n r = CALL('LockSeqBuf',self,INT(number),self.image)\r\n return self.CheckForSuccessError(r)",
"def unlock(self):\n return _image.image_unlock(self)",
"def AddToSequence(self):\r\n self.seq += 1\r\n r = CALL('AddToSequence',self,self.image,self.... | [
"0.6962397",
"0.5811078",
"0.56012094",
"0.5488451",
"0.52648664",
"0.52333075",
"0.52333075",
"0.5225316",
"0.51950514",
"0.51867604",
"0.5148955",
"0.5122874",
"0.5096556",
"0.5069418",
"0.5010914",
"0.5009539",
"0.500756",
"0.49962044",
"0.49961293",
"0.49904197",
"0.49895... | 0.67305315 | 1 |
The function GetLastMemorySequence() returns the ID of the last recorded sequence in the memory board. This parameter can then be used in combination with the function TransferImage() to read images out of the camera memory. No memory board to test this, Not tested! | def GetLastMemorySequence(self):
r = CALL('GetLastMemorySequence',self,byref(self.id))
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_sequence_ind(self,):\n return self.last_sequence_ind_",
"def getLast(self):\n return self.dataBuffer[len(self.dataBuffer) - 1]",
"def getLastWaveIdentifier(self): \n return self.lastWaveIdentifier",
"def getLastInstruction(self) -> ghidra.program.model.listing.Instruction:\n ... | [
"0.6061169",
"0.5892281",
"0.58848685",
"0.58324695",
"0.58267003",
"0.58168834",
"0.5726267",
"0.5687172",
"0.5649448",
"0.5640867",
"0.5622492",
"0.5602114",
"0.5586681",
"0.5564437",
"0.55424047",
"0.552731",
"0.5516105",
"0.55109864",
"0.5494791",
"0.5479138",
"0.5465261"... | 0.8036485 | 0 |
Experiment to find out how it works TransferImage(self, INT nMemID, INT seqID, INT imageNr, INT reserved) Not in the user manual! Not implemented! | def TransferImage():
CALL('TransferImage',self,INT(),INT(),INT(),INT()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CopyImageMem(self):\r\n r = CALL(\"CopyImageMem\",self,self.image,self.id,self.data.ctypes.data)\r\n return self.CheckForSuccessError(r)",
"def upload(self, img):\n # create a connection to sendspace\n (upl_url, upl_max_size, upl_id, upl_extra_info) = self.connect()\n # ret... | [
"0.6329293",
"0.6220998",
"0.6046591",
"0.5963438",
"0.56137717",
"0.5613641",
"0.5574188",
"0.5550258",
"0.55243576",
"0.55123603",
"0.5489153",
"0.5420019",
"0.54051477",
"0.5369926",
"0.5334564",
"0.53238004",
"0.53175116",
"0.5273996",
"0.5253874",
"0.5251831",
"0.5225943... | 0.8339813 | 0 |
Experiment to find out how it works TransferMemorySequence(HIDS hf, INT seqID, INT StartNr, INT nCount, INT nSeqPos); Not in the user manual! Not implemented! | def TransferMemorySequence():
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transfer(self,num_bytes,direction=DMA_FROM_DEV):\n if num_bytes > self.bufLength:\n raise RuntimeError(\"Buffer size smaller than the transfer size\")\n if num_bytes > DMA_TRANSFER_LIMIT_BYTES:\n raise RuntimeError(\"DMA transfer size > {}\".format(\n ... | [
"0.54891014",
"0.5347686",
"0.5318841",
"0.5270872",
"0.51825416",
"0.5155339",
"0.5146869",
"0.5104306",
"0.50902504",
"0.50573677",
"0.50363404",
"0.49797234",
"0.4931008",
"0.490873",
"0.48839486",
"0.48791245",
"0.48564565",
"0.48082015",
"0.47808975",
"0.47191754",
"0.47... | 0.80883545 | 0 |
The function GetMemorySequenceWindow() can be used to check the window size of a specified memory board sequence. The assigned sequence ID is required as a parameter. Not tested! | def GetMemorySequenceWindow(self,id):
top = INT()
left = INT()
right = INT()
bottom = INT()
CALL('GetMemorySequenceWindow',self,INT(id),byref(left),byref(top),byref(right),byref(bottom))
return (left.value,top.value,right.value,bottom.value) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_window_size():\n \n wight = 870\n height = 519\n \n window = win32gui.FindWindow(MINECRAFT_CLASS_NAME, MINECRAFT_TITLE + MINECRAFT_VERSION)\n x0, y0, x1, y1 = win32gui.GetWindowRect(window)\n # x0 and y0 are initial points, upper left corner and lower left corner\n # then we need ... | [
"0.5690125",
"0.54432243",
"0.53728735",
"0.53610545",
"0.52660197",
"0.5167988",
"0.51675874",
"0.5138758",
"0.51371366",
"0.51131445",
"0.5107756",
"0.5100013",
"0.50933105",
"0.5079727",
"0.5071882",
"0.5068407",
"0.5062683",
"0.49924228",
"0.49746266",
"0.49321997",
"0.49... | 0.723778 | 0 |
With GetActSeqBuf() the image memory in which image acquisition (ppcMem) is currently taking place and the image memory which was last used for image acquisition (ppcMemLast) can be deter mined. This function is only available when the ring buffer is active. If image acquisition is started for a ring buffer, GetActSeqB... | def GetActSeqBuf(self):
aqID = INT()
pcMem = c_char_p()
pcMemLast = c_char_p()
paqID = byref(aqID)
ppcMem = byref(pcMem)
ppcMemLast = byref(pcMemLast)
r = CALL('GetActSeqBuf',self,paqID,ppcMem,ppcMemLast)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _sequenceAcqu(self):\n print('New-Seq_acq')\n exp = (self.mmc.getExposure())*0.001 #converted in s\n ledOnDuration = exp*self.expRatio[0]\n print('time LED ON (s) : ', ledOnDuration)\n\n print(\"Nb of frames : \", self.nbFrames)\n imageCount = 0\n\n pool = Threa... | [
"0.5627501",
"0.5494958",
"0.5061174",
"0.50324005",
"0.502218",
"0.49722916",
"0.4871921",
"0.48253193",
"0.47874895",
"0.4785045",
"0.47748902",
"0.4767203",
"0.47671735",
"0.47668168",
"0.474207",
"0.46511355",
"0.46315074",
"0.45889023",
"0.4576766",
"0.4576253",
"0.45573... | 0.6706684 | 0 |
AllocImageMem() allocates image memory for an image with width, width and height, height and colour depth bitspixel. Memory size | def AllocImageMem(self,width=1024,height=768,bitpixel=8):
self.image = c_char_p()
self.id = INT()
r = CALL('AllocImageMem',self,
INT(width),
INT(height),
INT(bitpixel),
byref(self.image),
byref(self.id))
return self.Ch... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAllocatedImageMem(self,width=1024,height=768,bitpixel=8):\r\n self.image = self.data.ctypes.data_as(c_char_p)\r\n self.id = INT()\r\n r = CALL('SetAllocatedImageMem',self,\r\n INT(width),\r\n INT(height),\r\n INT(bitpixel),\r\n self.data.ctype... | [
"0.6616378",
"0.6572187",
"0.58373463",
"0.5794703",
"0.5751268",
"0.56347877",
"0.5547725",
"0.5499699",
"0.5445616",
"0.5373528",
"0.52685547",
"0.5174698",
"0.5127752",
"0.5101924",
"0.5101255",
"0.50806683",
"0.5023088",
"0.50209063",
"0.49926105",
"0.4966518",
"0.4951278... | 0.7672257 | 0 |
The function GetNumberOfMemoryImages() returns the number of valid images that are currently located in the camera memory within the specified sequence ID. This number can differ from the originally recorded number of images because of overwriting. Not tested! | def GetNumberOfMemoryImages(self):
number = INT()
r = CALL('GetNumberOfMemoryImages',self,INT(self.seq),byref(number))
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num_of_images(self):",
"def n_images_acquired(self):\n n = ct.c_long()\n self.lib.GetTotalNumberImagesAcquired(ct.pointer(n))\n return n.value",
"def get_image_count(self):\n return self._num_images",
"def get_cameras_number():\n lib.initlib()\n return lib.is_GetNumb... | [
"0.6676571",
"0.65308803",
"0.62239295",
"0.62019396",
"0.61771584",
"0.61675495",
"0.61380553",
"0.61248803",
"0.6089397",
"0.6089397",
"0.6089397",
"0.60535747",
"0.6038884",
"0.6011779",
"0.6006518",
"0.6004487",
"0.599203",
"0.58890057",
"0.58890057",
"0.58890057",
"0.588... | 0.8223581 | 0 |
SetImageMem() sets the allocated image memory to active memory. Only an active image memory can receive image data. After calling SetImageMem() function SetImageSize() must follow to set the image size of the active memory. A pointer from function AllocImgMem() has to be given to parameter pcImgMem. | def SetImageMem(self):
r = CALL("SetImageMem",self,self.image,self.id)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetAllocatedImageMem(self,width=1024,height=768,bitpixel=8):\r\n self.image = self.data.ctypes.data_as(c_char_p)\r\n self.id = INT()\r\n r = CALL('SetAllocatedImageMem',self,\r\n INT(width),\r\n INT(height),\r\n INT(bitpixel),\r\n self.data.ctype... | [
"0.7618905",
"0.6651815",
"0.6251461",
"0.5740315",
"0.57321954",
"0.5631259",
"0.5518322",
"0.5349664",
"0.52179897",
"0.5142729",
"0.51273984",
"0.51216274",
"0.5033604",
"0.5016422",
"0.5004",
"0.49997732",
"0.49759445",
"0.49490502",
"0.49485502",
"0.49477434",
"0.4937284... | 0.78645116 | 0 |
Sets the image size. | def SetImageSize(self,x=IS.GET_IMAGE_SIZE_X_MAX,y=0):#non-zero ret
r = CALL("SetImageSize",self,INT(x),INT(y))
if x & 0x8000 == 0x8000:
return self.CheckForNoSuccessError(r)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_size(self, size=None):\n if not size:\n size = self.output_size\n self.img = cv2.resize(self.img, size)\n self.update_image()\n self.update_size()",
"def set_size(self, size):\n \n self.width = size[0]\n self.height = size[1]",
"def update_siz... | [
"0.841263",
"0.8023403",
"0.79978627",
"0.77170604",
"0.76743096",
"0.76459676",
"0.76122963",
"0.76122963",
"0.7562627",
"0.751572",
"0.7340996",
"0.73329",
"0.7270612",
"0.7137942",
"0.71214044",
"0.71099627",
"0.71042144",
"0.7049516",
"0.7049516",
"0.7049516",
"0.7049516"... | 0.67862725 | 32 |
FreeImageMem() deallocates previously allocated image memory.i For pcImgMem one of the pointers from AllocImgMem() has to be used. All other pointers lead to an error message! The repeated handing over of the same pointers also leads to an error message | def FreeImageMem (self):
r = CALL("FreeImageMem",self,self.image,self.id)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __exit__(self, *_):\r\n\t\tself.ueye.is_FreeImageMem(self.hCam, self.pcImageMemory, self.MemID)\r\n\r\n\t\t# Disables the hCam camera handle and releases the data structures and memory areas taken up by the uEye camera\r\n\t\tself.ueye.is_ExitCamera(self.hCam)",
"def free_int_mem(self):\n self.lib.Fre... | [
"0.64440423",
"0.62874573",
"0.61488086",
"0.5999576",
"0.59756696",
"0.59691554",
"0.59213704",
"0.5740886",
"0.5714064",
"0.56540054",
"0.5632984",
"0.5619123",
"0.5605082",
"0.5587151",
"0.5580869",
"0.5533592",
"0.5524327",
"0.55048376",
"0.5504792",
"0.5502427",
"0.54957... | 0.7937349 | 0 |
Set an allocated memory, that was not allocated using AllocImageMem, to the driver so it can be used to store the image that will be degitized. The allocated memory must be globally locked. (Basically, use this if some nondriver function happens to have some memory already allocated, so you don't need to allocate more ... | def SetAllocatedImageMem(self,width=1024,height=768,bitpixel=8):
self.image = self.data.ctypes.data_as(c_char_p)
self.id = INT()
r = CALL('SetAllocatedImageMem',self,
INT(width),
INT(height),
INT(bitpixel),
self.data.ctypes.data,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def SetImageMem(self):\r\n r = CALL(\"SetImageMem\",self,self.image,self.id)\r\n return self.CheckForSuccessError(r)",
"def GetImageMem(self):\r\n CALL('GetImageMem',self,byref(self.image))",
"def CopyImageMem(self):\r\n r = CALL(\"CopyImageMem\",self,self.image,self.id,self.data.ct... | [
"0.7402396",
"0.66219264",
"0.6307344",
"0.6264005",
"0.6122258",
"0.6064721",
"0.6030779",
"0.6020769",
"0.60027856",
"0.59418774",
"0.5817562",
"0.5667821",
"0.5655998",
"0.56383294",
"0.5613352",
"0.5534367",
"0.5529542",
"0.5491862",
"0.5460692",
"0.5405741",
"0.54041404"... | 0.7015416 | 1 |
GetActiveImageMem() returns the pointer to the beginning and the ID number of the active memory. If DirectDraw mode is active and image memory has been allocated, this function returns the pointer and the ID of the image memory, which was activated with SetImageMem(). However, it should be noted that in DirectDraw mode... | def GetActiveImageMem(self):
CALL('GetActiveImageMem',self,byref(self.image),byref(self.id)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetImageMem(self):\r\n CALL('GetImageMem',self,byref(self.image))",
"def CopyImageMem(self):\r\n r = CALL(\"CopyImageMem\",self,self.image,self.id,self.data.ctypes.data)\r\n return self.CheckForSuccessError(r)",
"def gpu_memory_info(device_id=0):\n free = ctypes.c_uint64()\n tota... | [
"0.67824006",
"0.5597025",
"0.5579964",
"0.5479365",
"0.5476903",
"0.53032494",
"0.50066215",
"0.49821952",
"0.49688146",
"0.49688146",
"0.49688146",
"0.49688146",
"0.49688146",
"0.49688146",
"0.49688146",
"0.49657318",
"0.49247557",
"0.49197346",
"0.49170998",
"0.49014604",
... | 0.8161192 | 0 |
GetImageMem() returns the pointer to the start of the active image memory. In DirectDraw mode the pointer is returned to the back buffer (or the visible area DirectDraw Primary Surface mode). | def GetImageMem(self):
CALL('GetImageMem',self,byref(self.image)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetActiveImageMem(self):\r\n CALL('GetActiveImageMem',self,byref(self.image),byref(self.id))",
"def CopyImageMem(self):\r\n r = CALL(\"CopyImageMem\",self,self.image,self.id,self.data.ctypes.data)\r\n return self.CheckForSuccessError(r)",
"def AllocImageMem(self,width=1024,height=768,b... | [
"0.7460679",
"0.6584813",
"0.6127438",
"0.57283247",
"0.56294703",
"0.5555408",
"0.5555408",
"0.5555408",
"0.5555408",
"0.5555408",
"0.5555408",
"0.5555408",
"0.54311067",
"0.5347561",
"0.5340391",
"0.5305238",
"0.52647305",
"0.5254108",
"0.52021575",
"0.51812404",
"0.5174073... | 0.78059375 | 0 |
CopyImageMem() copies the contents of the image memory, as described is pcSource and nID to the area in memory, which pcDest points to. | def CopyImageMem(self):
r = CALL("CopyImageMem",self,self.image,self.id,self.data.ctypes.data)
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_image(img: Image) -> Image:\n width, height = img.size\n new_img = Image.new(img.mode, img.size)\n new_pixels = new_img.load() # New Image pixels, default: all black.\n pixels = img.load() # Input Image pixels.\n for x in range(width):\n for y in range(height):\n new_pix... | [
"0.576396",
"0.57384807",
"0.56374925",
"0.56293875",
"0.5537115",
"0.5518485",
"0.54961926",
"0.54178214",
"0.53316796",
"0.53236693",
"0.53062844",
"0.5238389",
"0.5208273",
"0.5200405",
"0.5180205",
"0.5167048",
"0.51256067",
"0.51174074",
"0.50254786",
"0.49877104",
"0.49... | 0.791541 | 0 |
CaptureVideo() digitizes video images in real time and transfers the images to the previously allocated image memory. Alternatively if you are using DirectDraw the images can be transferred to the graphics board. The image acquisition (DIB Mode) takes place in the memory which has been set by SetImageMem() and AllocIma... | def CaptureVideo(self,wait=IS.DONT_WAIT):
r = CALL("CaptureVideo",self,INT(wait))
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capture(self):\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.grab()\n self.vid.gra... | [
"0.63115054",
"0.6152999",
"0.59013313",
"0.58645725",
"0.57968444",
"0.5737996",
"0.57196504",
"0.5652519",
"0.55645716",
"0.5542248",
"0.5521725",
"0.55036235",
"0.54414064",
"0.54344016",
"0.53873783",
"0.5380199",
"0.5375573",
"0.53666544",
"0.5350495",
"0.5342905",
"0.53... | 0.70174927 | 0 |
The StopLiveVideo() function freezes the image in the VGA card or in the PC's system memory. The function is controlled with | def StopLiveVideo(self,wait=IS.DONT_WAIT):
r = CALL("StopLiveVideo",self,INT(wait))
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop_video_server(_total):\r\n video_server = getattr(world, 'video_source', None)\r\n if video_server:\r\n video_server.shutdown()",
"def stop_live(self):\n self._toolbox.disable_streaming_flag()\n self._toolbox.disable_webcam(self._index)\n self._prompt.kill()",
"def sto... | [
"0.6991777",
"0.6940316",
"0.6929381",
"0.68190914",
"0.67107403",
"0.6597823",
"0.6583434",
"0.6512658",
"0.64685744",
"0.64407724",
"0.6422619",
"0.64002013",
"0.6393008",
"0.6362295",
"0.6283709",
"0.6258325",
"0.622677",
"0.62158215",
"0.6209707",
"0.61776364",
"0.6160418... | 0.7543952 | 0 |
There is a rewritable EEPROM in the camera which serves as a small memory. Additionally to the information which is stored in the EEPROM, 64 extra bytes can be written. With the ReadEEPROM() command the contents of these 64 bytes can be read. See WriteEEPROM. | def ReadEEPROM(self,offset = 0, count = 64):
if offset + count > 64:
sys.stderr.write("offset + count too big, must be smaller or equal 64")
raise
buffer = create_string_buffer(count)
CALL('ReadEEPROM',self,INT(offset),buffer,INT(count))
return buffer.value | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteEEPROM(self, content, offset = 0):\r\n count = len(content)\r\n if count + offset > 64:\r\n raise Exception(\"Content to long\")\r\n pcString = c_char_p(content)\r\n r = CALL('WriteEEPROM',self,INT(offset),pcString,INT(count))\r\n return self.CheckForSuccessEr... | [
"0.6319234",
"0.56649333",
"0.55280775",
"0.5375901",
"0.52162194",
"0.5143304",
"0.5135952",
"0.51126176",
"0.5111086",
"0.5098229",
"0.5038877",
"0.50353706",
"0.49758065",
"0.49262488",
"0.49171293",
"0.49111095",
"0.4910159",
"0.49044698",
"0.49027112",
"0.48953053",
"0.4... | 0.57210016 | 1 |
In the DCU camera there is a rewritable EEPROM, where 64 bytes of information can be written. With the ReadEEPROM() function the contents of this 64 byte block can be read. | def WriteEEPROM(self, content, offset = 0):
count = len(content)
if count + offset > 64:
raise Exception("Content to long")
pcString = c_char_p(content)
r = CALL('WriteEEPROM',self,INT(offset),pcString,INT(count))
return self.CheckForSuccessError(r) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReadEEPROM(self,offset = 0, count = 64):\r\n if offset + count > 64:\r\n sys.stderr.write(\"offset + count too big, must be smaller or equal 64\")\r\n raise\r\n buffer = create_string_buffer(count)\r\n CALL('ReadEEPROM',self,INT(offset),buffer,INT(count))\r\n r... | [
"0.6042261",
"0.54330003",
"0.52526534",
"0.52253497",
"0.5193807",
"0.51187974",
"0.50331044",
"0.5017932",
"0.4991936",
"0.48770434",
"0.48613754",
"0.4837506",
"0.48153642",
"0.48085576",
"0.47987148",
"0.4787133",
"0.47628757",
"0.47406593",
"0.47082168",
"0.46985582",
"0... | 0.6103962 | 0 |
Sets the exposure time (in ms). | def Exposure(self, time):
IS_EXPOSURE_CMD_SET_EXPOSURE = 12 #there is a whole list to implement
TIME = DOUBLE(time)
nSizeOfParam = 8
CALL('Exposure', self,
UINT(IS_EXPOSURE_CMD_SET_EXPOSURE),
byref(TIME),
UINT(nSizeOfParam)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setExposureTime(self, cmd, expTime):\n\n pass",
"def set_exposure(self, exposure):\n self.logger.info(f'Setting exposure to {exposure}')\n self._driver.ExposureTime.SetValue(exposure)",
"def exp(self, exposure_time):\n print(f\"exp: {exposure_time}\")\n self.device_contro... | [
"0.81445235",
"0.79246736",
"0.75601643",
"0.69765526",
"0.68850553",
"0.676173",
"0.67069584",
"0.66022027",
"0.6574949",
"0.6556103",
"0.6542445",
"0.64979583",
"0.6438198",
"0.64039016",
"0.6358902",
"0.6349602",
"0.6347361",
"0.63219094",
"0.63219094",
"0.63219094",
"0.63... | 0.72623295 | 3 |
returns custom madduck2.login page. | def login(request):
if request.method == 'POST':
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None and user.is_active:
# Correct password, and the user is marked ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GET_login(self):\r\n\r\n # dest is the location to redirect to upon completion\r\n dest = request.get.get('dest','') or request.referer or '/'\r\n return LoginPage(dest = dest).render()",
"def login_get():\n\treturn render_template('auth/login.html')",
"def login():\n return render_... | [
"0.7720298",
"0.75214493",
"0.7412668",
"0.7412668",
"0.73924345",
"0.7327351",
"0.7307032",
"0.730213",
"0.7291739",
"0.72679883",
"0.72607315",
"0.7187644",
"0.7178495",
"0.71504724",
"0.70992583",
"0.7083293",
"0.70808905",
"0.70808905",
"0.70700943",
"0.706351",
"0.702911... | 0.0 | -1 |
returns custom madduck2.logout page. | def logout(request):
auth.logout(request)
return render_to_response("auth/logout.html", {
}, context_instance=RequestContext(request)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout(request):\n return internal_logout(request, next_page = reverse('wainz.views.composite'), redirect_field_name = 'next')",
"def logout_get():\n\treturn render_template('auth/logout.html')",
"def logout():\n oidc.logout()\n return 'Hi, you have been logged out! <a href=\"/\">Return</a>'",
"... | [
"0.79936165",
"0.77474076",
"0.77439505",
"0.7703372",
"0.76739335",
"0.76351804",
"0.760067",
"0.75690746",
"0.7521209",
"0.7481427",
"0.74143153",
"0.72789454",
"0.7249124",
"0.72249764",
"0.7224086",
"0.721113",
"0.71941245",
"0.7150177",
"0.7127977",
"0.7107422",
"0.71009... | 0.6944417 | 32 |
returns custom madduck2.signup page. | def signup(request):
user_form = UserCreationForm()
if request.method == 'POST':
user_form = UserCreationForm(request.POST)
if user_form.is_valid():
""" new user account is created here"""
""" @fixme: this is a buggy peice of code; cannot do commit=False; becaus... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_signup():\n\n title = 'Sign up'\n\n return render_template('signup_page.html',\n title=title)",
"def signup():\n return render_template('auth/signup.html')",
"def showSignup():\n return render_template('signup.html')",
"def showSignUpPage(request):\n return ... | [
"0.77151006",
"0.74754655",
"0.7366364",
"0.73301077",
"0.72466236",
"0.7191181",
"0.7178934",
"0.71358883",
"0.7055338",
"0.702861",
"0.699943",
"0.6871869",
"0.67743146",
"0.67548543",
"0.6634334",
"0.6567255",
"0.6480738",
"0.6455892",
"0.64366424",
"0.63959074",
"0.635191... | 0.0 | -1 |
Creates a onedimensional copy of the original list. Each atomic value is copied directly into the returned list. Each list or tuple encountered in the original list has its elements fully expanded into the returned list. | def flatten(list_to_flatten):
flattened_list = []
for item in list_to_flatten:
if isinstance(item, list) or isinstance(item, tuple):
flattened_list += flatten(item)
else:
flattened_list.append(item)
return flattened_list | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def copy_list(original_list):\n list_copy = []\n for i in range(len(original_list)):\n list_copy.append([])\n for j in range(len(original_list)):\n list_copy[i].append(original_list[i][j])\n return list_copy",
"def list_copy(l: List[Any]) -> List[Any]:\n return [item for item... | [
"0.6927564",
"0.64464235",
"0.63768125",
"0.6303269",
"0.6203216",
"0.61485165",
"0.6136498",
"0.61050004",
"0.6041816",
"0.6032829",
"0.59858614",
"0.59675235",
"0.5932443",
"0.58459234",
"0.5824462",
"0.57863224",
"0.5776607",
"0.57702994",
"0.5757627",
"0.5735408",
"0.5725... | 0.51816493 | 97 |
Initializes an Item object, takes the item name (str) | def __init__(self, name):
self.name = name | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, item_name):\r\n \r\n self.name = item_name\r\n self.description = \"\"",
"def __init__(self, name_s, items_in_store):\r\n self.name_s = name_s\r\n self.items_in_store = items_in_store",
"def __init__(self, name, attack):\n Item.__init__(self)\n self.name ... | [
"0.7933732",
"0.7256386",
"0.7137786",
"0.70841163",
"0.7080853",
"0.6915665",
"0.6822847",
"0.6761839",
"0.6723331",
"0.6570796",
"0.6493013",
"0.6445518",
"0.64126956",
"0.6395101",
"0.63883436",
"0.63592875",
"0.63533205",
"0.6345877",
"0.6329376",
"0.63196975",
"0.6317261... | 0.5778051 | 85 |
Called when this item is picked up by the player | def on_take(self):
print("You have picked up", self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pickup_item(self, ):\n if (self.charac_pos.x, self.charac_pos.y) == self.pos_item['ether']:\n self.pos_item['ether'] = (0, 0 * sprite_size)\n self.item_count += 1\n self.sound_item.play()\n if (self.charac_pos.x, self.charac_pos.y) == self.pos_item['tube']:\n ... | [
"0.7146995",
"0.68761605",
"0.6870488",
"0.6847355",
"0.68059784",
"0.6717971",
"0.64551896",
"0.6427112",
"0.6412922",
"0.64051783",
"0.6392263",
"0.63346094",
"0.62734675",
"0.618369",
"0.61465937",
"0.6142249",
"0.6100217",
"0.6097457",
"0.60778993",
"0.6074445",
"0.599273... | 0.70965105 | 1 |
Called when this item is dropped by the player | def on_drop(self):
print("You have dropped", self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def player_drop(self, item):\n dropped = self.drop(item)\n if dropped:\n self.handler.message_box.add_msg(\"You drop the {}!\".format(dropped),\n data.COLOURS['player_item_text'])",
"def drop(self, item: Item):\n self.items.remove(item)\... | [
"0.80975914",
"0.7594839",
"0.74566597",
"0.73042905",
"0.7237568",
"0.72101736",
"0.7155132",
"0.7151828",
"0.7109596",
"0.6984946",
"0.69737184",
"0.6890466",
"0.68652225",
"0.68452036",
"0.6787491",
"0.67635703",
"0.64342856",
"0.64155585",
"0.6387442",
"0.63798624",
"0.63... | 0.8000647 | 1 |
Accepts a list of urls and checks to see if they are formatted properly and are reachable. The function checks the scheme, then network location (hostname), and if both of those exist, it will attempt to request the url and record any error messages it receives. It uses a real UserAgent so it can get past redirects and... | def check_validity(urls):
invalid_urls = []
user_agent = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X "
"10_12_3) AppleWebKit/537.36 (KHTML, like "
"Gecko) Chrome/56.0.2924.87 Safari/537.36"}
for url in urls:
result = urlpar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_unreachable_urls(list_of_urls):\n list_of_reachable_url = []\n for url in list_of_urls:\n try:\n f = requests.get(url)\n print('\\t',url, 'status_code:', f.status_code)\n list_of_reachable_url.append(url)\n except:\n print('\\t',url, 'not r... | [
"0.6424543",
"0.63942724",
"0.63441634",
"0.6322449",
"0.62593704",
"0.62425035",
"0.61717874",
"0.61462724",
"0.6141986",
"0.61378294",
"0.60741097",
"0.6065361",
"0.5937483",
"0.59069526",
"0.58640397",
"0.5852774",
"0.58442056",
"0.5838501",
"0.5793359",
"0.5778443",
"0.57... | 0.76034284 | 0 |
LDIF attribute representation is base64 encoded if attribute value contains nonprintable characters or starts with reserved characters | def testAddBase64(self):
m = delta.Add("attr", [":value1", "value\n\r2"])
self.assertEqual(
m.asLDIF(),
b"""\
add: attr
attr:: OnZhbHVlMQ==
attr:: dmFsdWUKDTI=
-
""",
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_contains_nonprintable_characters(self):\n result = attributeAsLDIF(b\"key\", b\"val\\xFFue\")\n self.assertEqual(result, b\"key:: %s\\n\" % encode(b\"val\\xFFue\"))",
"def test_contains_special_characters(self):\n for c in b\"\\0\", b\"\\n\", b\"\\r\":\n\n value = b\"foo\... | [
"0.7499714",
"0.6736177",
"0.671143",
"0.65535486",
"0.63017637",
"0.62908363",
"0.6265325",
"0.6265325",
"0.6251473",
"0.6208478",
"0.6180993",
"0.6132462",
"0.60858405",
"0.6081717",
"0.6067649",
"0.605414",
"0.59649545",
"0.5903844",
"0.5866528",
"0.58233964",
"0.582337",
... | 0.669042 | 3 |
Returns a new LDAP root for dc=example,dc=com. | def getRoot(self):
return inmemory.ReadOnlyInMemoryLDAPEntry(
dn=distinguishedname.DistinguishedName("dc=example,dc=com")
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domainroot(d):\n dn = str2dn(d)\n dn.pop(0)\n return dn2str(dn)",
"def direct():\n\n unsafe_dc = request.args['dc']\n unsafe_filter = request.args['username']\n\n dn = \"dc={}\".format(unsafe_dc)\n search_filter = \"(user={})\".format(unsafe_filter)\n\n srv = ldap3.Server('ldap://127.0.0.1'... | [
"0.6270654",
"0.5712243",
"0.545023",
"0.5329593",
"0.50764936",
"0.5068848",
"0.5041615",
"0.50335836",
"0.49236822",
"0.48996553",
"0.48969284",
"0.48898906",
"0.48693934",
"0.48487878",
"0.47870293",
"0.4745563",
"0.47230995",
"0.47035939",
"0.4702607",
"0.46856213",
"0.46... | 0.63973844 | 0 |
It will return the LDIF representation of the operation. | def testAsLDIF(self):
sut = delta.AddOp(
entry.BaseLDAPEntry(
dn="dc=example,dc=com",
attributes={
"foo": ["bar", "baz"],
"quux": ["thud"],
},
)
)
result = sut.asLDIF()
self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def operation(self) -> str:\n return self._operation",
"def getOp(self):\n return self._OPERATION",
"def operation2string(self, operation):\n op = \"Custom\"\n if operation == QNetworkAccessManager.HeadOperation:\n op = \"HEAD\"\n elif operation == QNetworkAccessMa... | [
"0.6456117",
"0.61639804",
"0.5994714",
"0.56923014",
"0.5622008",
"0.5622008",
"0.5592037",
"0.5570391",
"0.5562648",
"0.55601966",
"0.54974437",
"0.5485282",
"0.5485282",
"0.5485282",
"0.5485282",
"0.54639965",
"0.54379326",
"0.5437863",
"0.5434873",
"0.5420649",
"0.5417145... | 0.49874538 | 72 |
Objects are equal when the have the same LDAP entry. | def testAddOpEqualitySameEntry(self):
first_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={"foo": ["same", "attributes"]},
)
second_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attribu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equal_on_equal(self):\n a = Certificate(\n certificate_type=self.certificate_type_b,\n certificate_value=self.certificate_value_b)\n b = Certificate(\n certificate_type=self.certificate_type_b,\n certificate_value=self.certificate_value_b)\n\n ... | [
"0.663903",
"0.66290337",
"0.6565405",
"0.645035",
"0.64484584",
"0.6415347",
"0.6400843",
"0.628204",
"0.6277051",
"0.62680084",
"0.62679434",
"0.6235978",
"0.62092066",
"0.62021416",
"0.61936814",
"0.6190466",
"0.6190466",
"0.6190466",
"0.6174414",
"0.6152447",
"0.61515516"... | 0.6938779 | 0 |
Objects are not equal when the have different LDAP entries. | def testAddOpInequalityDifferentEntry(self):
first_entry = entry.BaseLDAPEntry(
dn="ou=First Team, dc=example,dc=com",
attributes={"foo": ["same", "attributes"]},
)
second_entry = entry.BaseLDAPEntry(
dn="ou=First Team, dc=example,dc=com",
attribut... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_differentClassesEquality(self):\n self.assertFalse(Record(1, 2) == DifferentRecord(1, 2))",
"def test_not_equal_on_equal(self):\n a = Certificate(\n certificate_type=self.certificate_type_b,\n certificate_value=self.certificate_value_b)\n b = Certificate(\n ... | [
"0.6809871",
"0.6767201",
"0.6744707",
"0.6736668",
"0.66851926",
"0.668116",
"0.6680744",
"0.6642496",
"0.66402555",
"0.6628646",
"0.66133076",
"0.65468353",
"0.6545497",
"0.6531632",
"0.6517792",
"0.6498798",
"0.64390373",
"0.64005816",
"0.6388611",
"0.63755107",
"0.637537"... | 0.68304837 | 0 |
Objects is not equal with random objects. | def testAddOpInequalityNoEntryObject(self):
team_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={"foo": ["same", "attributes"]},
)
sut = delta.AddOp(team_entry)
self.assertNotEqual(sut, {"foo": ["same", "attributes"]}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_equality_check_against_other_object_doesnt_raise_exception(self):\n test_object = Vec3(1, 2, 3)\n self.assertFalse(test_object == Quat(1, 2, 3, 4))\n self.assertFalse(Quat(1, 2, 3, 4) == test_object)\n self.assertTrue(test_object != Quat(1, 2, 3, 4))\n self.assertTrue(Qu... | [
"0.6857258",
"0.6824082",
"0.68160635",
"0.6798619",
"0.67841375",
"0.6767044",
"0.6717165",
"0.67050284",
"0.6698792",
"0.66734797",
"0.6668297",
"0.6653493",
"0.6651219",
"0.66344124",
"0.65309775",
"0.6528229",
"0.65177",
"0.6509458",
"0.6501589",
"0.6492718",
"0.6491202",... | 0.0 | -1 |
Objects which are equal have the same hash. | def testAddOpHashSimilar(self):
first_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={"foo": ["same", "attributes"]},
)
second_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash__(self):\n return hash(self.hash)",
"def __hash__(self):\n return super().__hash__()",
"def __hash__(self):\r\n return hash(tuple(sorted(self.__dict__.items())))",
"def __hash__(self):\n return hash(tuple(sorted(self.__dict__.items())))",
"def __hash__(self):\n ... | [
"0.77017784",
"0.76154345",
"0.76134586",
"0.75549906",
"0.75549906",
"0.75549906",
"0.75549906",
"0.7532097",
"0.75056005",
"0.74700147",
"0.74668556",
"0.74668556",
"0.74668556",
"0.74546266",
"0.74546266",
"0.74546266",
"0.7384395",
"0.73809785",
"0.7370897",
"0.73666143",
... | 0.0 | -1 |
Objects which are not equal have different hash. | def testAddOpHashDifferent(self):
first_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={"foo": ["one", "attributes"]},
)
second_entry = entry.BaseLDAPEntry(
dn="ou=Duplicate Team, dc=example,dc=com",
attributes={... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash__(self):\n return super().__hash__()",
"def __hash__(self):\n return hash(self.hash)",
"def __hash__(self):\n return 0",
"def __hash__(self):\r\n return hash(tuple(sorted(self.__dict__.items())))",
"def __hash__(self):\n return hash(repr(self))",
"def __h... | [
"0.7564856",
"0.7425919",
"0.7301297",
"0.72786856",
"0.7221085",
"0.7221085",
"0.7221085",
"0.72175765",
"0.721317",
"0.7194113",
"0.7194113",
"0.7194113",
"0.7194113",
"0.71817267",
"0.7179601",
"0.71660316",
"0.71350855",
"0.7111713",
"0.71104544",
"0.70943356",
"0.7085317... | 0.67239004 | 83 |
It fails to perform the `add` operation for an existing entry. | def testAddOp_DNExists(self):
root = self.getRoot()
root.addChild(
rdn="ou=Existing Team",
attributes={
"objectClass": ["a", "b"],
"ou": ["HR"],
},
)
hr_entry = entry.BaseLDAPEntry(
dn="ou=Existing Team, dc=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_existing_key_fail(self, data):\n message = 'exists'\n rv = self.add_success(data)\n assert not in_response(rv, message)\n return self.add_fail(data, message)",
"def existing_key_fail(self, data, new_data):\n message = 'exists'\n rv = self.add_success(data)\n ... | [
"0.71164954",
"0.6588821",
"0.643554",
"0.6370714",
"0.6331228",
"0.6220641",
"0.621863",
"0.62142515",
"0.61926603",
"0.6165092",
"0.6156353",
"0.6148823",
"0.61016685",
"0.603093",
"0.602082",
"0.6005113",
"0.60016644",
"0.59912544",
"0.597168",
"0.59626424",
"0.5952711",
... | 0.5760522 | 31 |
It return the LDIF representation of the delete operation. | def testAsLDIF(self):
sut = delta.DeleteOp("dc=example,dc=com")
result = sut.asLDIF()
self.assertEqual(
b"""dn: dc=example,dc=com
changetype: delete
""",
result,
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(self):\n return self.get_data()",
"def _get_delete_packet(self):\n return self.__delete_packet",
"def delete(self):\n return self.request('', pylastica.request.Request.DELETE)",
"def get_delete_data(cmd, etid, request_object):\n cascade = False\n # Below will decide ... | [
"0.64063877",
"0.640283",
"0.63555926",
"0.61276275",
"0.6070813",
"0.60174006",
"0.5975395",
"0.59719837",
"0.59278756",
"0.5879305",
"0.5857722",
"0.58412755",
"0.5840907",
"0.5810483",
"0.5733122",
"0.5722565",
"0.5706737",
"0.5697221",
"0.5696561",
"0.56930155",
"0.569107... | 0.6950992 | 0 |
Objects are equal when the have the same DN. | def testDeleteOpEqualitySameDN(self):
first_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
second_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
first = delta.DeleteOp(first_entry)
second = delta.DeleteOp(second_entry)
self.assertEqual(first, second) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualityEqualDN(self):\n first_dn = distinguishedname.DistinguishedName(\n stringValue=\"ou=Team,dc=example,dc=com\"\n )\n first = delta.DeleteOp(first_dn)\n\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example, dc=com\")\n second = delta.Delet... | [
"0.665897",
"0.6595536",
"0.6559323",
"0.65231705",
"0.64151347",
"0.63600206",
"0.6305464",
"0.6276601",
"0.62563235",
"0.61931187",
"0.61730045",
"0.6166215",
"0.61655784",
"0.61634344",
"0.61440104",
"0.6120709",
"0.6116827",
"0.6102328",
"0.6101921",
"0.60912746",
"0.6087... | 0.6638436 | 1 |
DeleteOp objects are equal if their DNs are equal. | def testDeleteOpEqualityEqualDN(self):
first_dn = distinguishedname.DistinguishedName(
stringValue="ou=Team,dc=example,dc=com"
)
first = delta.DeleteOp(first_dn)
second_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example, dc=com")
second = delta.DeleteOp(second_entry... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualitySameDN(self):\n first_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n\n first = delta.DeleteOp(first_entry)\n second = delta.DeleteOp(second_entry)\n\n self.assertEqua... | [
"0.73695445",
"0.7121779",
"0.6974125",
"0.6964153",
"0.68876994",
"0.66953886",
"0.6677444",
"0.62607294",
"0.62252873",
"0.62102026",
"0.6203794",
"0.61505586",
"0.5923089",
"0.58912915",
"0.5797456",
"0.57742137",
"0.5747886",
"0.56847215",
"0.56771487",
"0.56651294",
"0.5... | 0.7539459 | 0 |
DeleteOp objects are not equal when the have different LDAP entries. | def testDeleteOpInequalityDifferentEntry(self):
first_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
second_entry = entry.BaseLDAPEntry(dn="ou=Cowboys, dc=example,dc=com")
first = delta.DeleteOp(first_entry)
second = delta.DeleteOp(second_entry)
self.assertNotEqua... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpEqualityEqualDN(self):\n first_dn = distinguishedname.DistinguishedName(\n stringValue=\"ou=Team,dc=example,dc=com\"\n )\n first = delta.DeleteOp(first_dn)\n\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example, dc=com\")\n second = delta.Delet... | [
"0.8243594",
"0.8238518",
"0.79273254",
"0.7917759",
"0.7837672",
"0.7599454",
"0.7520965",
"0.7130038",
"0.6935918",
"0.6859313",
"0.68569475",
"0.6782144",
"0.6508775",
"0.6477197",
"0.62264705",
"0.6213489",
"0.6212964",
"0.60358036",
"0.6033882",
"0.60309523",
"0.59265226... | 0.81283015 | 2 |
DeleteOp objects is not equal with random objects. | def testDeleteOpInequalityNoEntryObject(self):
team_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
sut = delta.DeleteOp(team_entry)
self.assertNotEqual(sut, "ou=Team, dc=example,dc=com") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testDeleteOpHashSimilar(self):\n first_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n second_entry = entry.BaseLDAPEntry(dn=\"ou=Team, dc=example,dc=com\")\n\n first = delta.DeleteOp(first_entry)\n second = delta.DeleteOp(second_entry)\n\n self.assertEqual(h... | [
"0.70038164",
"0.6970572",
"0.6884647",
"0.68697417",
"0.65711975",
"0.65628684",
"0.6557792",
"0.6550563",
"0.6518816",
"0.6513069",
"0.65084994",
"0.649781",
"0.6495219",
"0.6492234",
"0.6468633",
"0.6464731",
"0.644575",
"0.63759494",
"0.6375199",
"0.63696927",
"0.6339174"... | 0.6425396 | 17 |
Objects which are equal have the same hash. | def testDeleteOpHashSimilar(self):
first_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
second_entry = entry.BaseLDAPEntry(dn="ou=Team, dc=example,dc=com")
first = delta.DeleteOp(first_entry)
second = delta.DeleteOp(second_entry)
self.assertEqual(hash(first), hash... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __hash__(self):\n return hash(self.hash)",
"def __hash__(self):\n return super().__hash__()",
"def __hash__(self):\r\n return hash(tuple(sorted(self.__dict__.items())))",
"def __hash__(self):\n return hash(tuple(sorted(self.__dict__.items())))",
"def __hash__(self):\n ... | [
"0.77017784",
"0.76154345",
"0.76134586",
"0.75549906",
"0.75549906",
"0.75549906",
"0.75549906",
"0.7532097",
"0.75056005",
"0.74700147",
"0.74668556",
"0.74668556",
"0.74668556",
"0.74546266",
"0.74546266",
"0.74546266",
"0.7384395",
"0.73809785",
"0.7370897",
"0.73666143",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.