query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Convert a number into comma notation as per Indian number system. This function accepts integer, float. If keep_decimal is true, we the decimal value will be be returned else decimal place will be ignored.
def indian_currency(amount, keep_decimal=True): if not amount: return 0.00 amount_string = valiate_format(amount) neg = True if amount < 0 else False amount_string, decimal_value = split_decimal(amount_string) length = len(amount_string) if length <=3: if keep_decimal and de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conv_num_with_commas(number_text):\n number=number_text.split(',')\n item=''\n for numero in number:\n item+=numero\n final_number=float(item)\n return final_number", "def display_float_with_comma(value):\n # incase the input type is not a string, convert into one\n if not isinsta...
[ "0.6213089", "0.6055099", "0.6021734", "0.59922403", "0.53055495", "0.52868134", "0.5286344", "0.528052", "0.52780765", "0.5189823", "0.5187271", "0.516885", "0.5160782", "0.5149218", "0.51118875", "0.50903136", "0.5089379", "0.50365806", "0.50206995", "0.49854368", "0.492030...
0.6437726
0
Compile struct packers for all of the formats used by BufferedByteStream. Called whenever a BufferedByteStream's endianness is changed.
def _compile_packers(endian): return { "B": struct.Struct(endian + "B"), "b": struct.Struct(endian + "b"), "h": struct.Struct(endian + "h"), "H": struct.Struct(endian + "H"), "l": struct.Struct(endian + "l"), "L": struct.Struct(endian + "L"), "d": struct.Struc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fill_cdata(cls):\n\n funcs = {}\n for key, name in [(\"b\", \"char\"), (\"h\", \"short\"),\n (\"i\", \"int\"), (\"q\", \"longlong\")]:\n for echar, esuffix in [(\"<\", \"le\"), (\">\", \"be\")]:\n esuffix = \"_\" + esuffix\n for unsigned in [True, False]...
[ "0.54127973", "0.52528113", "0.5202475", "0.51727545", "0.5138992", "0.51032", "0.50767475", "0.50531936", "0.502232", "0.501981", "0.50173527", "0.49746272", "0.49665293", "0.49586567", "0.49272287", "0.49084684", "0.49043682", "0.48672134", "0.48526588", "0.48318917", "0.48...
0.73967206
0
If C{length} is 1 or unspecified, return the rest of the buffer. Otherwise, return exactly the specified number of bytes from the buffer. Either way, advance the seek position over the data read.
def read(self, length=-1): if length == 0: return b'' if length < -1: raise IOError("invalid read length: %r" % length) if self.at_eof(): raise IOError( "Attempted to read from the buffer but already at the end") if length == -1: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, length):\n if length > self.remaining():\n raise BufferError(\"Not enough bytes [remaining=%d,requested=%d]\" %\n (self.remaining(), length))\n start = self.offset\n end = self.offset + length\n self.offset += length\n return ...
[ "0.7689199", "0.7155332", "0.6718683", "0.6675357", "0.6514841", "0.6514841", "0.64937276", "0.64912575", "0.6453085", "0.6440127", "0.6392433", "0.63902384", "0.635299", "0.6351777", "0.6294604", "0.62938076", "0.6220419", "0.62060124", "0.6198831", "0.61686623", "0.6131877"...
0.73477554
1
Looks up to C{size} bytes ahead in the stream without changing the seek position. Unlike C{read}, it is not an error to try to peek past the end of the buffer, and fewer than the number of requested bytes may be returned.
def peek(self, size=1): if size < -1: raise ValueError("Cannot peek backwards") if size == 0: return b'' if size == -1: size = self.remaining() peeked = b'' with Excursion(self._buf): while len(peeked) < size: c =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peek(self, size=-1):\n if not self._readable:\n raise UnsupportedOperation(\"read\")\n\n with self._seek_lock:\n self._raw.seek(self._seek)\n return self._raw._peek(size)", "def read(self, size=-1):\n chunk_index, prefix_size = self._index_pos(self._pos)\...
[ "0.74297446", "0.6948958", "0.67741823", "0.6749181", "0.66498965", "0.6569089", "0.6517509", "0.6480654", "0.6467621", "0.6467621", "0.62642694", "0.6217797", "0.6177777", "0.6168342", "0.61496145", "0.6127795", "0.60906035", "0.6076821", "0.60006875", "0.59697473", "0.58953...
0.69835883
1
Returns number of remaining bytes.
def remaining(self): return len(self) - self.tell()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_bytes(self):\n try:\n return self._get_limit('remaining')\n except ValueError:\n logging.error(\n \"Unable to gather limit statistics until log() has been called. Returning -1\")\n return -1", "def BytesTransferred(self) -> int:", "def...
[ "0.79955524", "0.7503243", "0.72665423", "0.723585", "0.723585", "0.7140973", "0.7121997", "0.7101556", "0.70414186", "0.7018545", "0.69614124", "0.69507426", "0.69253415", "0.6894986", "0.6894986", "0.6891443", "0.68778425", "0.6819636", "0.6797956", "0.67900383", "0.6769142...
0.78777385
1
Returns C{True} if the seek position is at the end of the stream.
def at_eof(self): return self.tell() == len(self)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def atEnd(self):\n return (self.ins.tell() == self.size)", "def has_end(self):\n return bool(self._end)", "def at_eof(self):\n return self._eof and not self._buffer", "def eof(self):\r\n\t\treturn self.index == len(self.data)", "def eos(self):\n return self.pos == len(self.strin...
[ "0.73306084", "0.7322948", "0.72013944", "0.7068702", "0.6958195", "0.69033283", "0.689503", "0.6812034", "0.68020433", "0.67834455", "0.6665296", "0.662397", "0.6615335", "0.65767634", "0.6551174", "0.6505491", "0.64960724", "0.6482905", "0.6482905", "0.6482905", "0.6482905"...
0.7866897
0
Writes the content of the specified C{s} into this buffer at the current seek position, and advance the seek position.
def write(self, s): self._buf.write(s) self._len = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write(self, s):\n self.fh.write(s)\n self.fh.flush()", "def write(self, s):\r\n for result in self.writeAsync(s):\r\n pass", "def write(self, s):\n written = 0\n while written != len(s):\n written += os.write(self.__pipe, s[written:])", "def write...
[ "0.6771928", "0.67325693", "0.6679446", "0.6551387", "0.64571244", "0.6429988", "0.6343345", "0.5962146", "0.5882854", "0.58304954", "0.56686735", "0.5592929", "0.55721587", "0.5517105", "0.5515542", "0.54562396", "0.54396826", "0.54280365", "0.54177964", "0.54036105", "0.533...
0.6774574
0
The endianness of this stream.
def endian(self): return self._endian
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def endianness(self):", "def data_endianess(self):\n data_endianess = self.query('FORMat:BORDer?')\n if data_endianess == 'NORM':\n return 'big'\n elif data_endianess == 'SWAP':\n return 'little'\n else:\n raise InstrIOError(cleandoc('''Agilent PNA did...
[ "0.85871786", "0.73067874", "0.71036994", "0.6880202", "0.6679047", "0.65297395", "0.6192463", "0.6032108", "0.5841983", "0.5796016", "0.56900966", "0.562354", "0.5619385", "0.5576774", "0.557647", "0.5484285", "0.5479514", "0.54259217", "0.5406424", "0.53953815", "0.5393183"...
0.8430153
1
Writes an C{unsigned char} to the stream.
def write_uchar(self, c): if not isinstance(c, six.integer_types): raise TypeError("expected an int, got %r" % type(c)) if not 0 <= c <= 255: raise OverflowError("Not in range, %d" % c) self.write(self._packers["B"].pack(c))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_char(self, c):\n if not isinstance(c, six.integer_types):\n raise TypeError(\"expected an int, got %r\" % type(c))\n\n if not -128 <= c <= 127:\n raise OverflowError(\"Not in range, %d\" % c)\n\n self.write(self._packers[\"b\"].pack(c))", "def write(self, data...
[ "0.62047654", "0.6169431", "0.5987988", "0.5944119", "0.59145176", "0.5777741", "0.5748772", "0.5719865", "0.5635184", "0.56037086", "0.55938625", "0.5517079", "0.55165476", "0.5494965", "0.5490515", "0.5480598", "0.53913444", "0.53841263", "0.5383362", "0.5370967", "0.535783...
0.6414628
0
Reads a 24 bit unsigned integer from the stream.
def read_24bit_uint(self): if self._is_little_endian(): order = [0, 8, 16] else: order = [16, 8, 0] n = 0 for x in order: n += (self.read_uchar() << x) return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_24bit_int(self):\n n = self.read_24bit_uint()\n\n if n & 0x800000 != 0:\n # the int is signed\n n -= 0x1000000\n\n return n", "def read_unsigned_integer(stream, size):\n\t\n\tvalue = 0\n\tfor i in xrange(0, size):\n\t\tbyte = ord(stream.read(1))\n\t\tvalue = (v...
[ "0.7435512", "0.6937585", "0.67033064", "0.6518586", "0.61511385", "0.60001844", "0.59865487", "0.59164345", "0.59018034", "0.5834223", "0.5816457", "0.5815409", "0.58138126", "0.57731247", "0.5771819", "0.5757917", "0.5757917", "0.57309335", "0.5648384", "0.5620404", "0.5613...
0.77171445
0
Writes a 24 bit unsigned integer to the stream.
def write_24bit_uint(self, n): if not isinstance(n, six.integer_types): raise TypeError("expected an int, got %r" % (type(n),)) if not 0 <= n <= 0xffffff: raise OverflowError("n is out of range") if self._is_little_endian(): order = [0, 8, 16] else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_24bit_int(self, n):\n if not isinstance(n, six.integer_types):\n raise TypeError(\"expected an int, got %r\" % (type(n),))\n\n if not -8388608 <= n <= 8388607:\n raise OverflowError(\"n is out of range\")\n\n if n < 0:\n n += 0x1000000\n\n if s...
[ "0.70267826", "0.67283916", "0.65581244", "0.63965625", "0.5880815", "0.5788928", "0.5785339", "0.57343805", "0.57132995", "0.5700842", "0.5683279", "0.5661951", "0.5599271", "0.5459302", "0.542944", "0.5402754", "0.5371565", "0.5343313", "0.5334597", "0.518417", "0.51594186"...
0.7210746
0
Reads a 24 bit integer from the stream.
def read_24bit_int(self): n = self.read_24bit_uint() if n & 0x800000 != 0: # the int is signed n -= 0x1000000 return n
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_24bit_uint(self):\n if self._is_little_endian():\n order = [0, 8, 16]\n else:\n order = [16, 8, 0]\n\n n = 0\n for x in order:\n n += (self.read_uchar() << x)\n\n return n", "def _read24(self, register):\r\n ret = 0.0\r\n ...
[ "0.733056", "0.65002835", "0.60552233", "0.6039677", "0.60131735", "0.5971058", "0.59647214", "0.59647214", "0.594664", "0.5936618", "0.59352607", "0.59033895", "0.5838442", "0.57878673", "0.5767999", "0.5709288", "0.5655133", "0.56492794", "0.56178665", "0.55877143", "0.5566...
0.791934
0
Writes a 24 bit integer to the stream.
def write_24bit_int(self, n): if not isinstance(n, six.integer_types): raise TypeError("expected an int, got %r" % (type(n),)) if not -8388608 <= n <= 8388607: raise OverflowError("n is out of range") if n < 0: n += 0x1000000 if self._is_little_endi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write24bit(self, register, value):\n if value > ((2 ** 24) - 1) or value < 0:\n raise ValueError\n valuearray = struct.pack('!I', value) # Place value into byte array, format '!I' is int, network order\n self.device.writeregistermulti(register, valuearray[1:]) #Only 3 LSB bytes...
[ "0.68899083", "0.68623495", "0.6844214", "0.63099045", "0.62283903", "0.6189997", "0.60188186", "0.5983669", "0.5938283", "0.59133977", "0.58699304", "0.5794902", "0.57604027", "0.5732328", "0.56575936", "0.5546907", "0.554556", "0.55351263", "0.5510964", "0.5464817", "0.5443...
0.7471859
0
Reads a UTF8 string from the stream.
def read_utf8_string(self, length): return self.read(length).decode("utf-8")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readString(stream):\n # read the string length (4-byte int, network byte order)\n buf = stream.read(4)\n if len(buf) < 4:\n raise RuntimeError(\"found %d bytes (expected: 4)\" % len(buf))\n n_bytes = struct.unpack(\"!i\", buf)[0]\n if n_bytes < 0:\n return None\n buf = stream.re...
[ "0.7554304", "0.7308685", "0.73078424", "0.66278684", "0.6578648", "0.65687615", "0.6549844", "0.6532995", "0.6521878", "0.64916456", "0.64635867", "0.643787", "0.63874054", "0.62223274", "0.6187246", "0.6127436", "0.61217374", "0.6100491", "0.6074277", "0.6024016", "0.599429...
0.7803178
0
Writes a string to the stream. If it is a Unicode object, it will be encoded in UTF8; if it is a byte string, it will be written out asis.
def write_utf8_string(self, u): if isinstance(u, six.text_type): u = u.encode("utf-8") elif isinstance(u, bytearray): u = six.binary_type(u) if not isinstance(u, six.binary_type): raise TypeError("Expected a string, got %r" % (u,)) self.write(u)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_utf8(self, s: str) -> None:\n self.write_bytes(s.encode(\"utf-8\"))", "def write(file, string, codec='utf8'):\n if isinstance(string, str):\n file.write(string)\n elif isinstance(string, unicode):\n file.write(string.encode(codec))", "def writeString(stream, s):\n if s i...
[ "0.7791684", "0.75173044", "0.7269316", "0.70626867", "0.6870034", "0.68018013", "0.67969155", "0.6790861", "0.67679846", "0.67537695", "0.66470253", "0.66467935", "0.6618192", "0.65673757", "0.6537432", "0.6496219", "0.6492293", "0.63817656", "0.6369088", "0.6359491", "0.635...
0.7696836
1
Matrix is filled up with given data If too much data the excess is discarded If too little data the remainder is filled with zeros If no data then the matrix will be only zeros (shell for result matrix)
def fillMatrix(self, data): i = 0 length = len(data) for r in range(self.rows): for c in range(self.columns): if i >= length: num = 0 else: num = data[i] self.mat[r][c] = num ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zeros_matrix(self, rows, cols):\r\n M = []\r\n while len(M) < rows:\r\n M.append([])\r\n while len(M[-1]) < cols:\r\n M[-1].append(0.0)\r\n\r\n return M", "def zeroMatrix(width, height):\n returnvalue = Matrix()\n for i in rang...
[ "0.6447685", "0.64340955", "0.62304294", "0.6177189", "0.6117132", "0.6110023", "0.60474694", "0.60474694", "0.6038418", "0.5968105", "0.5960306", "0.5879425", "0.58070964", "0.5775621", "0.57458425", "0.5740294", "0.57398784", "0.57330877", "0.57258934", "0.5714473", "0.5698...
0.73310274
0
Fill matrix with random numbers from 10 to 10
def randomfill(self): for r in range(self.rows): for c in range(self.columns): self.mat[r][c] = randint(-10, 10)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def irandmatrix(n, range = 10):\n A = mp.matrix(n, n)\n for i in xrange(n):\n for j in xrange(n):\n A[i,j]=int( (2 * mp.rand() - 1) * range)\n return A", "def generate_random_matrix(n):\n return [[random.randint(1, 50) for i in range(n)] for j in range(n)]", "def random_matrix(row...
[ "0.7244703", "0.7049676", "0.68952924", "0.6875506", "0.6874144", "0.68682826", "0.67189467", "0.6603398", "0.6603138", "0.6602197", "0.656827", "0.65382016", "0.6435154", "0.6365384", "0.6350057", "0.63318795", "0.63235366", "0.62902623", "0.6284012", "0.6262402", "0.6259421...
0.8371872
0
Test converting toluene and benzene smiles to oemol to ffxml to openmm simulation.
def test_ffxml_simulation(): with utils.enter_temp_directory(): m0 = openmoltools.openeye.smiles_to_oemol("Cc1ccccc1") charged0 = openmoltools.openeye.get_charges(m0) m1 = openmoltools.openeye.smiles_to_oemol("c1ccccc1") charged1 = openmoltools.openeye.get_charges(m1) ligands...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_to_from_oemol(self, molecule):\n from openff.toolkit.utils.toolkits import UndefinedStereochemistryError\n\n # Known failures raise an UndefinedStereochemistryError, but\n # the round-trip SMILES representation with the OpenEyeToolkit\n # doesn't seem to be affected.\n #...
[ "0.6176524", "0.61076534", "0.60451335", "0.5921864", "0.5918076", "0.5777649", "0.57627714", "0.57627714", "0.57380736", "0.5735808", "0.5732254", "0.5728689", "0.5727124", "0.56702065", "0.5639355", "0.5635702", "0.56343955", "0.56327903", "0.5627573", "0.5610018", "0.55571...
0.672862
0
Assert that two multiline strings are equal. If they aren't, show a nice diff.
def assertMultiLineEqual(self, first, second, msg=None): self.assertTrue(isinstance(first, str), 'First argument is not a string') self.assertTrue(isinstance(second, str), 'Second argument is not a string') if first != second: message = ''.join(diffli...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertMultiLineEqual(self, first, second, msg=None):\r\n self.assert_(isinstance(first, basestring), (\r\n 'First argument is not a string'))\r\n self.assert_(isinstance(second, basestring), (\r\n 'Second argument is not a string'))\r\n\r\n if first != second:...
[ "0.82592815", "0.74987626", "0.72812736", "0.726718", "0.7259299", "0.72427946", "0.718826", "0.71434915", "0.7009044", "0.6992177", "0.6975448", "0.6975448", "0.69021523", "0.6861659", "0.6852261", "0.68281657", "0.681266", "0.67798996", "0.67484903", "0.6747903", "0.6730730...
0.8611194
0
test Biblio's eq method for duplicates
def isduplicate(a, b): db = bibtexparser.loads(a+'\n'+b) e1, e2 = db.entries refs = Biblio() return refs.eq(e1, e2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isduplicate(self, a, b):\n db = bibtexparser.loads(a+'\\n'+b)\n e1, e2 = db.entries\n refs = Biblio(similarity=self.similarity)\n return refs.eq(e1, e2)", "def test_duplicate_entries(self):", "def testEquality(self):\n pass", "def isduplicate(self, a, b):\n open(...
[ "0.7259203", "0.65145224", "0.6298735", "0.62130135", "0.6186938", "0.61241937", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", "0.6092625", ...
0.7169162
1
test Biblio's eq method for duplicates
def isduplicate(self, a, b): db = bibtexparser.loads(a+'\n'+b) e1, e2 = db.entries refs = Biblio(similarity=self.similarity) return refs.eq(e1, e2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isduplicate(a, b):\n db = bibtexparser.loads(a+'\\n'+b)\n e1, e2 = db.entries\n refs = Biblio()\n return refs.eq(e1, e2)", "def test_duplicate_entries(self):", "def testEquality(self):\n pass", "def isduplicate(self, a, b):\n open(self.mybib, 'w').write(a)\n ...
[ "0.71667874", "0.65124714", "0.62988126", "0.62106305", "0.61856186", "0.6122873", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985", "0.60917985",...
0.72566575
0
Create the cached links. These are the links between locations caused by using direction keys for navigation as opposed to using dungeon features.
def cache_links(self): for source_location in self.gen_locations(): for vi, delta in vi_delta_pairs: drow, dcol = delta for command, magnitude in ((vi, 1), (vi.upper(), 8)): target_location = source_location for i in range(magni...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_links(self):\n xygrid = self.xymap.xygrid\n\n # we must use the xygrid coordinates\n x, y = self.x, self.y\n\n # scan in all directions for links\n for direction, (dx, dy) in MAPSCAN.items():\n\n lx, ly = x + dx, y + dy\n\n if lx in xygrid and ly i...
[ "0.69821167", "0.63550127", "0.5738111", "0.57277435", "0.5647053", "0.56404555", "0.5520767", "0.55009866", "0.54728156", "0.5469091", "0.5463365", "0.54544103", "0.54356766", "0.54338235", "0.5429366", "0.5406448", "0.5374355", "0.5365685", "0.53489137", "0.5334808", "0.533...
0.78895026
0
This function simply calculates the epsilon effective for a list of emissivities while the other one is a normal wall it returns a list of effective epsilons
def epsilonEffectiveVectorialOtherOneNormalWall(ListOfEpsilons): epsilon2= 0.9 ListOFEffectiveEpsilons= [] for anyEpsilon in ListOfEpsilons: result=1/(1/anyEpsilon+1/epsilon2-1) ListOFEffectiveEpsilons.append(result) return ListOFEffectiveEpsilons
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_epsilon(env, num_of_bandits, iterations, episodes):\n\n # Initialize total mean rewards array per episode by zero\n epsilon_rewards = np.zeros(iterations)\n\n for i in range(episodes):\n print(f\"Running Epsilon episode:{i}\")\n\n n = 1\n action_count_per_bandit = np.ones(num_...
[ "0.63106453", "0.60338986", "0.5957807", "0.59423536", "0.59085244", "0.5789438", "0.5741385", "0.5716987", "0.5681946", "0.5657834", "0.5606077", "0.55730236", "0.5513506", "0.5452497", "0.5435057", "0.54325557", "0.54113334", "0.54066813", "0.5396189", "0.5393934", "0.53853...
0.7452661
0
Return a new STL Formula object which represents the negation of this one. The robustness degree is given by rho(s,phi,t) = rho(s,phi,t)
def negation(self): new_robustness = lambda s, t : - self.robustness(s,t) new_formula = STLFormula(new_robustness) return new_formula
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def negated(self):\n ops = {Eq: Ne, Ge: Lt, Gt: Le, Le: Gt, Lt: Ge, Ne: Eq}\n # If there ever will be new Relational subclasses, the following line\n # will work until it is properly sorted out\n # return ops.get(self.func, lambda a, b, evaluate=False: ~(self.func(a,\n # b, ...
[ "0.63784575", "0.60499424", "0.6047615", "0.6025719", "0.5980413", "0.59710944", "0.5950272", "0.5905911", "0.5871128", "0.5808477", "0.57869494", "0.57742417", "0.57666385", "0.5696955", "0.56903917", "0.5639218", "0.5592459", "0.55629545", "0.55408806", "0.552846", "0.55211...
0.85079247
0
Return a new STL Formula object which represents the disjunction of
def disjunction(self, second_formula): new_robustness = lambda s, t : max( self.robustness(s,t), second_formula.robustness(s,t) ) new_formula = STLFormula(new_robustness) return new_formula
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_not_and_or(formula: Formula) -> Formula:\r\n # Task 3.5\r\n\r\n map_operators = {'->': Formula.parse('(~p|q)'),\r\n '+': Formula.parse('((p&~q)|(~p&q))'),\r\n '<->': Formula.parse('~((p&~q)|(~p&q))'),\r\n '-&': Formula.parse('~(p&q)'),\r\n ...
[ "0.6928513", "0.64927626", "0.64809364", "0.63076943", "0.6272961", "0.62019426", "0.6155834", "0.61348367", "0.6078864", "0.6068255", "0.60622615", "0.6024921", "0.6003905", "0.59905654", "0.59699976", "0.59579724", "0.59041035", "0.5857507", "0.5839025", "0.5812397", "0.580...
0.6939579
0
Return a new STL Formula object which represents this formula holding at some point in [t+t1, t+t2]. rho(s, F_[t1,t2](phi), t) = max_{k in [t+t1,t+t2]}( rho(s,phi,k) )
def eventually(self, t1, t2): new_robustness = lambda s, t : max([ self.robustness(s,k) for k in range(t+t1, t+t2+1)]) new_formula = STLFormula(new_robustness) return new_formula
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def always(self, t1, t2):\n new_robustness = lambda s, t : min([ self.robustness(s,k) for k in range(t+t1, t+t2+1)])\n\n new_formula = STLFormula(new_robustness)\n\n return new_formula", "def disjunction(self, second_formula):\n new_robustness = lambda s, t : max( self.robustness(s,t)...
[ "0.60814774", "0.5594397", "0.5511437", "0.5436593", "0.54058003", "0.53587633", "0.53587633", "0.5265794", "0.5249713", "0.52059805", "0.52044696", "0.5127763", "0.5115574", "0.5098548", "0.5070726", "0.50691354", "0.5043683", "0.49980867", "0.49883643", "0.49751607", "0.497...
0.65423965
0
Return a new STL Formula object which represents this formula holding at all times in [t+t1, t+t2]. rho(s, F_[t1,t2](phi), t) = min_{k in [t+t1,t+t2]}( rho(s,phi,k) )
def always(self, t1, t2): new_robustness = lambda s, t : min([ self.robustness(s,k) for k in range(t+t1, t+t2+1)]) new_formula = STLFormula(new_robustness) return new_formula
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eventually(self, t1, t2):\n new_robustness = lambda s, t : max([ self.robustness(s,k) for k in range(t+t1, t+t2+1)])\n\n new_formula = STLFormula(new_robustness)\n\n return new_formula", "def conjunction(self, second_formula):\n new_robustness = lambda s, t : min( self.robustness(...
[ "0.6225095", "0.5380109", "0.52846324", "0.5268822", "0.5250239", "0.507966", "0.5078371", "0.5048716", "0.5048716", "0.5045929", "0.50276214", "0.501732", "0.49967548", "0.4975366", "0.49715793", "0.49676615", "0.4959879", "0.49277917", "0.49169645", "0.49146962", "0.4910409...
0.6450866
0
data_id The data_id that will be attached to the records produced. course_fields speed_fields heading_fields wind_dir_fields wind_speed_fields Commaseparated lists of field names from which we should take values for course, speed over ground, heading, relative wind speed and relative wind direction. update_on_fields If...
def __init__(self, data_id, course_fields, speed_fields, heading_fields, wind_dir_fields, wind_speed_fields, update_on_fields=None, zero_line_reference=0, convert_wind_factor=1, convert_speed_factor=1, output_nmea=False): supe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processData(self,data):\n #print 'I GOT DATA',data,[0],data[1]\n # Check for valid data (not null or empty string)\n #print '**************NOTIFICATION***************',type(_RobotCommunicator.WALL_HEADER),type(data[0])\n if data:\n #print '**************NOTIFICATION******...
[ "0.53975344", "0.52873915", "0.50456554", "0.50301075", "0.49908647", "0.49831617", "0.48950723", "0.47512385", "0.47308448", "0.4730168", "0.47279853", "0.47256327", "0.47077668", "0.46848103", "0.46756554", "0.46603763", "0.46585894", "0.46537262", "0.46511868", "0.46418202",...
0.69498223
0
Incorporate any useable fields in this record, and if it gives us a new true wind value, return it.
def transform(self, record): if not record: return None if not type(record) is DASRecord: logging.warning('Improper format record: %s',record) return None update = False for field_name in record.fields: if field_name in self.course_fields: self.course_val = record.field...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wind_meta(self):\n return self.data.wind_meta", "def wind(self):\n return self._wind", "def _get_wred(self):\n return self.__wred", "def _get_wred(self):\n return self.__wred", "def _get_wred(self):\n return self.__wred", "def calc_generation_wind_proposed (self):\n if s...
[ "0.5335317", "0.52828914", "0.52291673", "0.52291673", "0.52291673", "0.51694596", "0.49782172", "0.49209738", "0.49078652", "0.48731014", "0.48608252", "0.48421362", "0.48118705", "0.4774674", "0.47562644", "0.47545525", "0.4751787", "0.4737342", "0.47335005", "0.472048", "0...
0.6221449
0
Initialise empty list to store movie objects.
def __init__(self): self.movies = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.movie_reviews = []", "def __init__(self, movie_list, handler):\n self = self\n self.movie_list = movie_list\n self.handler = handler", "def movies(self) -> List[Movie]:\n return super(MoviesManager, self).items", "def __init__(self):\n self...
[ "0.65290993", "0.64381063", "0.6387146", "0.6362394", "0.6308672", "0.62854606", "0.6260135", "0.61852294", "0.6150018", "0.60788643", "0.60733324", "0.60368407", "0.60368407", "0.603464", "0.6025904", "0.60086554", "0.5979831", "0.59669375", "0.5956342", "0.5935932", "0.5929...
0.7599408
0
Return a string representation of movie_collection.
def __str__(self): return str([str(movie) for movie in self.movies])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __str__(self):\n if len(self.movies) == 1:\n return \"[ %s\" % ( self.movies.head )\n else:\n i, l, s = 0, len(self.movies), \"\"\n ch = chr(201)\n for movie in self.movies:\n s += \"%s %s\" % ( ch, movie )\n i += 1\n ...
[ "0.6659319", "0.6628551", "0.62493557", "0.60645914", "0.58099663", "0.57829535", "0.5771873", "0.5735844", "0.5735844", "0.5711104", "0.5698495", "0.56329626", "0.5529546", "0.5506747", "0.5498773", "0.54663736", "0.54648674", "0.5462892", "0.5462892", "0.5462892", "0.546289...
0.7336832
0
Add a movie to the list of movies.
def add_movie(self, movie): self.movies.append(movie)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(self, movie):\n self.movies.append(movie)", "def insert(self, movie):\n self._currentMovie = self.movies.add(movie)\n self._updateMovieList = True", "def add_movie(self, movie_id, title, syn, actorsList):\n if movie_id in self.movies:\n \t\treturn False\n \tfor actor_i...
[ "0.8900799", "0.8045397", "0.7768572", "0.76284903", "0.7500664", "0.7352316", "0.7212312", "0.7136348", "0.7030553", "0.6866704", "0.6758157", "0.66564816", "0.65935546", "0.6266042", "0.6245702", "0.6196159", "0.6195921", "0.6169882", "0.6088118", "0.6033789", "0.60107416",...
0.8978601
0
Returns number of movies unwatched.
def get_number_un_watched(self): movies_un_watched = 0 for movie in self.movies: if not movie.is_watched: movies_un_watched += 1 return movies_un_watched
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_watched(self):\n movies_watched = 0\n for movie in self.movies:\n if movie.is_watched:\n movies_watched += 1\n return movies_watched", "def get_number_of_movies(self):\n raise NotImplementedError", "def unseen_count_for(self, user):\r\n ...
[ "0.7755944", "0.6540844", "0.61782014", "0.6130556", "0.6059607", "0.57578415", "0.57013404", "0.569084", "0.567021", "0.56334585", "0.55824435", "0.5575674", "0.55153644", "0.5513155", "0.5429644", "0.5418207", "0.5391372", "0.5387409", "0.5384734", "0.5315951", "0.5298279",...
0.90050864
0
Returns number of movies watched.
def get_number_watched(self): movies_watched = 0 for movie in self.movies: if movie.is_watched: movies_watched += 1 return movies_watched
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_of_movies(self):\n raise NotImplementedError", "def get_number_un_watched(self):\n movies_un_watched = 0\n for movie in self.movies:\n if not movie.is_watched:\n movies_un_watched += 1\n return movies_un_watched", "def tot_movies():\n ...
[ "0.79504406", "0.78356934", "0.684265", "0.6501998", "0.6493687", "0.64376444", "0.64284354", "0.6427606", "0.63701856", "0.63086224", "0.6142869", "0.61026233", "0.6084461", "0.60532176", "0.6037645", "0.58779836", "0.5861516", "0.5820638", "0.5809127", "0.5804819", "0.58046...
0.88137585
0
Save movies to file.
def save_movies(self, filename): out_file = open('{}'.format(filename), 'w') for movie in self.movies: out_file.write("{}\n".format(movie)) out_file.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_csv(outfile, movies):\n fieldnames = ['title', 'rating', 'year', 'actors', 'runtime']\n with open('movies.csv', 'w') as outfile:\n writer = csv.DictWriter(outfile, fieldnames=fieldnames)\n writer.writeheader()\n for line in movies:\n writer.writerow(line)\n\n\n # A...
[ "0.72095114", "0.71403253", "0.68307644", "0.6719887", "0.67072356", "0.6481229", "0.64616996", "0.6323915", "0.6316662", "0.6286281", "0.6236424", "0.62208205", "0.61929744", "0.6184691", "0.61743426", "0.60964686", "0.6085657", "0.60776585", "0.6068898", "0.6067825", "0.606...
0.8231782
0
Sort objects by keyword attribute.
def sort_movies(self, keyword): self.movies.sort(key=attrgetter(keyword, "title"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sortby(self):\n ...", "def keysort(*args, **kwargs): # real signature unknown\n pass", "def sort(self, field='word', order=None):\n self.data = list(self.sorted(field, order))", "def sort_key(self):\n ...", "def sort_books(self):\n self.foods = sorted(self.foods, key=attr...
[ "0.6517557", "0.62519825", "0.621693", "0.618207", "0.61291474", "0.60603756", "0.5968144", "0.591704", "0.58679897", "0.58125305", "0.57413775", "0.5737953", "0.5718942", "0.5710644", "0.5701423", "0.5689594", "0.5621519", "0.5617988", "0.5601959", "0.5600666", "0.5600666", ...
0.7797052
0
Return longest movie title length.
def calculate_longest_title(self): longest_title_length = 0 for movie in self.movies: title_length = len(movie.title) if title_length > longest_title_length: longest_title_length = title_length return longest_title_length
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def longest_word_length(words):", "def display_count_longest_title():\n longest_title = reports.count_longest_title(filename)\n print(\n \"The longest title in {} has a {} characters\\n\".format(\n filename,\n longest_title))", "def get_movie_longest_runtime(movies: list) -> ...
[ "0.77722895", "0.7590663", "0.7366647", "0.7108653", "0.7067252", "0.6978308", "0.69709504", "0.68817616", "0.683693", "0.6814063", "0.66816366", "0.66371953", "0.6625562", "0.66211367", "0.66208327", "0.6615058", "0.6594465", "0.6562419", "0.6558994", "0.6544149", "0.6536397...
0.8994632
0
Set movie at specified index watched if not already.
def set_movie_watched(self, movie_index): if self.movies[movie_index].is_watched: print("You have already watched {}".format(self.movies[movie_index].title)) else: self.movies[movie_index].watch_movie() print("{} from {} watched".format(self.movies[movie_index].title,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_target_movie(self, movie_title):\n self.target_movie = self.db.query(Movie).filter_by(\n title=movie_title).first()", "def setMovie(self, movie):\n if movie != None:\n self.titleText.set(movie.title)\n if isinstance(movie.director, types.StringTypes):\n ...
[ "0.5464972", "0.53104514", "0.5152905", "0.5102784", "0.50916296", "0.5083048", "0.50648904", "0.50172126", "0.49893054", "0.4985861", "0.49777514", "0.49769378", "0.4974608", "0.49403375", "0.49258924", "0.49239987", "0.4907317", "0.4899596", "0.489666", "0.48950246", "0.489...
0.7617139
0
Set is_watched to 'w' or 'u' ready for saving so that it matched sample output.
def bool_to_status(self): for movie in self.movies: if movie.is_watched: movie.is_watched = WATCHED else: movie.is_watched = UNWATCHED
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_movie_watched(self, movie_index):\n if self.movies[movie_index].is_watched:\n print(\"You have already watched {}\".format(self.movies[movie_index].title))\n else:\n self.movies[movie_index].watch_movie()\n print(\"{} from {} watched\".format(self.movies[movie...
[ "0.5912901", "0.555388", "0.51608515", "0.506256", "0.50503856", "0.5013928", "0.5003339", "0.4994564", "0.49897543", "0.49845046", "0.49726027", "0.49247593", "0.48908532", "0.48908532", "0.4881085", "0.4878073", "0.48633444", "0.48521966", "0.48514238", "0.48476604", "0.482...
0.5689392
1
Generate the dataset's data if it does not exist.
def generate_data(self): self.remove_hdf5_file() hdf5_handler = self.create_hdf5_file() self.populate_hdf5_file(hdf5_handler, self.dataset)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_data_set(self):\n if not self.assert_data_correct():\n self.download_all_data()\n self.unpack_rename_data()\n self.split_data_characters()\n self.clean_data_fragments()\n self.create_font_data()\n if not self.assert_train_augmented():\n...
[ "0.69200563", "0.67951465", "0.6723771", "0.6610489", "0.6583298", "0.65758735", "0.65656567", "0.6530771", "0.64458627", "0.64342827", "0.6404715", "0.6372979", "0.63223845", "0.62426066", "0.62412035", "0.6232917", "0.6224932", "0.6188829", "0.6183252", "0.6165206", "0.6160...
0.7456934
0
Generate a list of strings.
def generate_string_list(self, n): template_str = 'string_' string_list = [template_str + str(i) for i in range(n)] return string_list
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_string_list(char_list, length):\n return [e for e in generate_strings(char_list, length)]", "def generate_str(self, num):\n str_list = []\n for _ in range(num):\n str_list.append(self.fake.pystr())\n return str_list", "def generate_strings(char_list, length):\n ...
[ "0.78389084", "0.7442578", "0.72651327", "0.7240272", "0.7009902", "0.6672038", "0.6522357", "0.65052104", "0.64621574", "0.6427473", "0.64225364", "0.6373771", "0.6346114", "0.6333544", "0.6331938", "0.63198966", "0.6306335", "0.62754685", "0.6215374", "0.6160407", "0.615534...
0.777014
1
Load data for testing the FieldLoader class.
def get_test_data_FieldLoader(self, set_name='train', field='data'): path = "/{set_name}/{field}".format(set_name=set_name, field=field) field_loader = self.load_hdf5_file_FieldLoader(path) set_data = self.dataset[set_name] return field_loader, set_data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self) -> None:", "def load_data(self):", "def test_dataloader(self) -> DataLoader:\n return self._custom_data_loader()", "def load_data(self):\n raise NotImplementedError()", "def load_data(self, data):\n self.data = data\n self.validate()", "def setUp(self):\n ...
[ "0.7236644", "0.7104567", "0.7077611", "0.67128515", "0.6609189", "0.6563617", "0.6536698", "0.6475042", "0.6435233", "0.6316149", "0.6312232", "0.6294654", "0.6196114", "0.61840767", "0.61840767", "0.6171941", "0.61452377", "0.6128587", "0.6126146", "0.6096968", "0.6084923",...
0.7161606
1
Return a dataset for testing the FieldLoader class.
def get_test_dataset_DataLoader(self): test_info = self.get_test_DataLoader_info() name = test_info["name"] task = test_info["task"] data_dir = test_info["data_dir"] hdf5_file = test_info["hdf5_file"] data_loader = DataLoader(name, task, data_dir, hdf5_file) ret...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_test_data_FieldLoader(self, set_name='train', field='data'):\n path = \"/{set_name}/{field}\".format(set_name=set_name, field=field)\n field_loader = self.load_hdf5_file_FieldLoader(path)\n set_data = self.dataset[set_name]\n return field_loader, set_data", "def test_dataloade...
[ "0.76030594", "0.73050845", "0.7218909", "0.70823777", "0.707011", "0.6923885", "0.6874425", "0.68715763", "0.680077", "0.67888016", "0.6751399", "0.670098", "0.67003936", "0.66979426", "0.6590271", "0.6578667", "0.65673375", "0.6562923", "0.6548202", "0.65370923", "0.6524199...
0.7889583
0
Get the expected values of an object index from the test dataset.
def get_expected_object_values(set_data, fields, idx): assert set_data assert fields assert idx is not None if isinstance(idx, int): expected = get_single_object_values(set_data, fields, idx) else: expected = [] for i in idx: expected.append(get_single_object_val...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_dimensions_by_index(self):\n\n dimensions, dim_names = pyjstat.get_dimensions(\n self.oecd_datasets['oecd'], 'index')\n self.assertTrue(dim_names[2] == 'year')\n self.assertTrue(dimensions[0].iloc[0]['index'] == 0)", "def get_test_index(self):\n return self.tes...
[ "0.6085354", "0.59751713", "0.58467215", "0.5743093", "0.56780034", "0.5677077", "0.5662826", "0.5632936", "0.5603338", "0.5561478", "0.55502975", "0.55169076", "0.55166215", "0.54973763", "0.549305", "0.5478096", "0.5470087", "0.54686487", "0.54338706", "0.5414726", "0.53993...
0.71672696
0
Sending request to disarm an adjacent trap.
def disarm(self, direction): self.send("disarm " + direction) msg = self.recv() return msg.get(0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disassociation_from_ap(self):\n # send disassociation\n self.ap1.tx_msdu(da=self.host.macaddr, body=wifi.disassociation(), \n fctl=wifi.fctl_disassociation)\n \n # expect a deauth frame\n mpdu = self.ap1.rx_mpdu(wifi.AIR_MGMT)\n \n # sanity ch...
[ "0.5579351", "0.55666995", "0.53452766", "0.531071", "0.5253965", "0.52062815", "0.5178076", "0.51533264", "0.5106116", "0.50844777", "0.5076529", "0.5076529", "0.5076118", "0.5061429", "0.5057326", "0.5043118", "0.5009013", "0.4985737", "0.49818358", "0.49659583", "0.4953678...
0.6480957
0
Sends the given operation to the server.
def send(self, op): tokens = op.split() msg = message() for token in tokens: msg.add(token) self.pb.send(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_operation(self):\n operation = self.inputs['operation']\n res = self.entity.do_operation(self.context, **self.inputs)\n if res:\n return self.RES_OK, \"Node operation '%s' succeeded.\" % operation\n else:\n return self.RES_ERROR, \"Node operation '%s' failed...
[ "0.65273005", "0.65004045", "0.6436639", "0.6344679", "0.62421525", "0.61538506", "0.6068884", "0.6068392", "0.6000146", "0.5946958", "0.5913439", "0.5902766", "0.58820164", "0.58820164", "0.5862677", "0.5844414", "0.5798752", "0.5796108", "0.5752205", "0.5738845", "0.5728808...
0.6920459
0
Shift perfectly, no calculations of y; just y(n) > y((n+1)%L) (basically a rotateright) ... just for reference
def perfect_shift(y): return np.append([y[-1]],y[0:-1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift(image,shift_x,shift_y):\n return np.roll(np.roll(image,shift_y,axis=0),shift_x,axis=1)", "def lrshift(val, n) -> np.int64:\n return (val % (1 << 64)) >> n", "def _shift(self, s):\n start_pos = self._relative_head_pos()\n l = 1 + 2 * self.shift_length\n shift = int(s * l - 0...
[ "0.67403364", "0.6632031", "0.6628545", "0.6394657", "0.61860895", "0.61860895", "0.61860895", "0.61860895", "0.6110119", "0.606753", "0.59852594", "0.59837425", "0.5971836", "0.5950179", "0.5943645", "0.5943645", "0.58661544", "0.5860182", "0.5842202", "0.58294725", "0.58097...
0.6870793
0
I'm the e property.
def e(self): return self._e
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_E(self):\r\n return self.E", "def e(self, e):\n\n self._e = e", "def get_E(self):\n return self.E", "def E(self):\n return self._properties['E']", "def E(self):\n return self._E", "def E(self):\n return self._E", "def ehandle(self):\n return self._eh...
[ "0.74820995", "0.7460332", "0.73928255", "0.72371143", "0.71522623", "0.71522623", "0.6508572", "0.6490028", "0.6425671", "0.6375467", "0.6284834", "0.6227812", "0.6227812", "0.62267196", "0.6221513", "0.6193148", "0.60434306", "0.5989004", "0.5946854", "0.5887836", "0.584394...
0.8164787
0
I'm the inc property.
def inc(self): return self._inc
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inc(self):\n self._value += 1", "def increment(self):\r\n return self.add(1)", "def increment(self) -> global___Expression:", "def increment_counter(self) -> None:", "def _modifyProperty(self,dec):\n pass", "def incr_operand(self):\n pass", "def get_inc(self):\n retur...
[ "0.69979954", "0.6902046", "0.6662313", "0.66253597", "0.6607319", "0.6580319", "0.65539956", "0.65401846", "0.65195906", "0.6515084", "0.6501719", "0.63391596", "0.63147354", "0.6312719", "0.6285045", "0.6224541", "0.6216525", "0.6214255", "0.62074393", "0.6182061", "0.61629...
0.77464503
0
I'm the Om property.
def Om(self): return self._Om
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def om(self):\n return self._om", "def moi(self):\n\n pass", "def get_o(self):\n return self.o", "def property(self, p_int): # real signature unknown; restored from __doc__\n pass", "def _showProperty(self):\n pass", "def property( self, prop ):\n raise NotImplem...
[ "0.7130849", "0.60610646", "0.59436876", "0.59310603", "0.5916612", "0.58097064", "0.5673482", "0.5673482", "0.5673482", "0.54857105", "0.54576874", "0.5444633", "0.54392326", "0.5419425", "0.53296006", "0.5305579", "0.5263575", "0.52366114", "0.52342314", "0.5233221", "0.520...
0.7669906
0
I'm the om property.
def om(self): return self._om
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Om(self):\n return self._Om", "def moi(self):\n\n pass", "def property( self, prop ):\n raise NotImplementedError(\"property\")", "def get_o(self):\n return self.o", "def property(self, p_int): # real signature unknown; restored from __doc__\n pass", "def properties...
[ "0.7034278", "0.63692933", "0.6175412", "0.61665934", "0.61052203", "0.591592", "0.591592", "0.591592", "0.59120154", "0.58743906", "0.58643997", "0.5859979", "0.5732439", "0.56568724", "0.559987", "0.5554393", "0.5553714", "0.55381227", "0.54483944", "0.5425846", "0.54186624...
0.7430322
0
I'm the H property.
def H(self): return self._H
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def h(self) -> float:\n return self._h", "def h(self): # pylint: disable=invalid-name\n return self._h", "def is_H(self):\n return True", "def is_H(self):\n return True", "def h(self):\n return self._h", "def update_H(self):", "def get_h0(self, t):\n return se...
[ "0.73934793", "0.71388894", "0.710541", "0.710541", "0.6980057", "0.6904231", "0.6783644", "0.6776315", "0.674058", "0.6728726", "0.6598538", "0.6571018", "0.65669626", "0.6494272", "0.6486298", "0.6455249", "0.642911", "0.6422516", "0.6390683", "0.63494384", "0.6303365", "...
0.78022635
0
I'm the epoch property.
def epoch(self): return self._epoch
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch(self):\n return _coordsys.coordsys_epoch(self)", "def set_epoch(self, epoch):\r\n pass", "def epoch():\n\treturn time.time()", "def epoch():\n return datetime2epoch(datetime.now())", "def GetEpoch(self):\n return _gmat_py.Attitude_GetEpoch(self)", "def cur_epoch(self):\n...
[ "0.7948318", "0.7636237", "0.7558367", "0.75083977", "0.7421768", "0.7372495", "0.7297328", "0.7210528", "0.70881516", "0.6936589", "0.6905358", "0.68977195", "0.6741958", "0.66929716", "0.66661257", "0.666138", "0.66086245", "0.6600611", "0.6585031", "0.65276086", "0.6485145...
0.83609456
0
I'm the epoch_M property.
def epoch_M(self): return self._epoch_M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def epoch(self):\n return self._epoch", "def set_epoch(self, epoch):\r\n pass", "def epoch(self):\n return _coordsys.coordsys_epoch(self)", "def GetEpoch(self):\n return _gmat_py.Attitude_GetEpoch(self)", "def epoch():\n\treturn time.time()", "def epoch_detail(self):\n ...
[ "0.74173445", "0.6983966", "0.69142866", "0.6853805", "0.659223", "0.6501514", "0.6478274", "0.62859935", "0.62701535", "0.62441427", "0.62349266", "0.6152219", "0.60909456", "0.5969186", "0.5957573", "0.5929347", "0.5902148", "0.58972347", "0.586194", "0.58306897", "0.581658...
0.8976243
0
Compute and assign and Hmagnitude from a socalled singlE powerlaw, knee, or divot Hmagnitude distribution. When provided a slope alpha and a faintside maximum Hmagnitude (hmax), a Hmagnitude is drawn randomly from the distribution dN/dH propto 10(alpha H) in the range hmin = 1 to hmax. Specify hmin to change the bright...
def drawH(self, alpha, hmax, alpha_faint=None, contrast=1, hbreak=None, hmin=1): # Avoid singularity for alpha = 0 alpha = 0.0000000001 if alpha == 0 else alpha # Set alpha_faint to alpha for the case of a single power-law alpha_faint = alpha if alpha_faint is None else al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_height_fwhm_calculation(peakdata):\n # mu = 0\n # variance = 1.0\n # sigma = np.sqrt(variance)\n # x = np.linspace(mu - 20*sigma, mu + 20*sigma, 100.0)\n # y = norm.pdf(x, mu, 1)\n x = peakdata[0]\n y = peakdata[1]\n check_height_fwhm(x, y, lineshapes.voigt, models.VoigtModel())\n ...
[ "0.57013035", "0.561052", "0.5579129", "0.55207247", "0.548725", "0.54475385", "0.537149", "0.5325857", "0.5278528", "0.5268215", "0.52665937", "0.52601075", "0.5251945", "0.52324474", "0.5193713", "0.5178757", "0.5177294", "0.51746935", "0.5156782", "0.51521426", "0.51354307...
0.761445
0
Perturb (fuzz) semimajor axis randomly by up to + percent specified Input is treated as percentage if type is not specified as 'abs'. If type = 'abs', a will be changed randomly by + amount specified. The first argument is a string containing the variable to be fuzzed. The appropriate options are 'a', 'e', 'inc', 'Om',...
def fuzz(self, variable, fz, type=None): # Check to see if the attribute exists, if so get the value if not hasattr(self, variable): raise ValueError("You tried to fuzz a parameter that does not exit") var = getattr(self, variable) # if variable is an angle, treat it properly...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defuzzification(self):\n self.price = fuzz.defuzz(self.psf,self.fuzzy_output, 'som')", "def main():\r\n _evaluative_test(5)\r\n _fuzz_test(1)\r\n _fuzz_test(1, 512)\r\n _fuzz_test(1, 1512)\r\n _fuzz_test(1000)\r\n _fuzz_test(1000, 512)\r\n _fuzz_test(1000, 4077)", "def fuzz():\n...
[ "0.5732995", "0.55186677", "0.5119221", "0.50102854", "0.49203992", "0.48581415", "0.4821607", "0.48188433", "0.47911242", "0.4722664", "0.4682123", "0.4677746", "0.4645468", "0.46381727", "0.4637192", "0.46334326", "0.45095548", "0.450736", "0.44810542", "0.44614375", "0.442...
0.73384976
0
Determines smallest number divisible by all numbers 1 to x.
def smallestMultiple(x): ans = 1 for prime in xprime(x): ans *= prime**int(log(x, prime)) return ans
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_number_divisible(n):\n\tprime_numbers = generate_prime_less_than_n(n)\n\tlog_n = math.log(n)\n\tres = 1\n\tfor pi in prime_numbers:\n\t\tres *= math.pow(pi, math.floor(log_n/math.log(pi)))\n\treturn res", "def finddiv(x):\r\n \r\n div = (1, x)\r\n for i in range(2, x//2+1):\r\n if x%...
[ "0.76617324", "0.74890375", "0.708696", "0.70112544", "0.6964907", "0.69107777", "0.6902035", "0.68590194", "0.68404037", "0.683988", "0.67654645", "0.6758752", "0.6721042", "0.67108655", "0.66632086", "0.65752566", "0.65006626", "0.64714175", "0.64620346", "0.64505184", "0.6...
0.7994635
0
Modify a python object that supports the buffer interface internally. This is useful for testing things like socket.recv_into() dest_buffer must be smaller than source_buffer, or the code will assert.
def modify_buffer_object(source_buffer, dest_buffer, nbytes=None): assert len(source_buffer) <= len(dest_buffer) copy_len = len(source_buffer) if nbytes is None else min(nbytes, source_buffer) buffer_ptr = (ctypes.c_byte * len(dest_buffer)).from_buffer(dest_buffer) new_value_ptr = (ctypes.c_byte * len(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _tobuffer(self, object_):\n\n raise NotImplementedError", "def use_buffer(self, buffer_size):\n self.__buffer_size = buffer_size\n if self.__buffer is None:\n self.__buffer = []", "def swap_buffers(self):\n raise NotImplementedError()", "def _read_into_buffer(self):...
[ "0.71334606", "0.632377", "0.62844825", "0.6151401", "0.61270875", "0.61198306", "0.61197627", "0.602732", "0.594199", "0.5892748", "0.5892748", "0.5892748", "0.5828508", "0.5773723", "0.5754132", "0.5739361", "0.5726852", "0.5726852", "0.5720015", "0.571318", "0.568297", "...
0.78256
0
Await a condition function to return True, otherwise raise an AssertionError if the condition did not return True within the alloted time.
def await_condition(description, condition_eval_callable, on_failure=lambda: True, timeout=10, poll_s=0.1): start_time = time.time() def should_continue(): return time.time() - start_time < timeout while not condition_eval_callable(): if not should_continue(): on_failure() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def await_condition(condition, timeout=2000):\n\n for _ in range(timeout):\n if condition():\n return True\n time.sleep(0.001)\n return False", "def until_true(condition, timeout, error_msg):\n timeout = timestr_to_secs(timeout)\n max_wait = time.time() + timeout\n ...
[ "0.7560678", "0.72292703", "0.7114256", "0.7015878", "0.69801235", "0.69610274", "0.6899991", "0.6843958", "0.6793191", "0.6574894", "0.6491553", "0.64850456", "0.6315587", "0.6235223", "0.61285186", "0.6070208", "0.6060411", "0.60604", "0.6031214", "0.6023985", "0.6023985", ...
0.7275414
1
Store the partial dos as a numpy array
def set_partial_dos(self, array): self.set_array('partial_dos', array) self.set_attribute("n_partial_dos", len(array))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_fits_array(self):\n return self.data", "def array(self):", "def make_data(self): \n s = numpy.arange(0.0, 10.0, 0.01)\n s = numpy.reshape(s, (10,10,10))\n s = numpy.transpose(s)\n\n v = numpy.zeros(3000, 'd')\n v[1::3] = 1.0\n v = numpy.reshape(v, ...
[ "0.58784777", "0.58602244", "0.56124526", "0.56086195", "0.55979156", "0.55947816", "0.55429274", "0.5539849", "0.55386084", "0.5537771", "0.5529546", "0.5492652", "0.5482164", "0.54607034", "0.541553", "0.5411863", "0.541172", "0.54034406", "0.54002327", "0.54000807", "0.539...
0.6228336
0
Read a range of console lines from shared memory. Returns a pair of lists containing the console text and console text attributes.
def read(self, start_line, num_lines, timeout=0): # emulate timeout by sleeping timeout time if timeout > 0: read_timeout = float(timeout) / 1000 #logging.debug("sleep " + str(read_timeout) + " seconds") time.sleep(read_timeout) output = [] attributes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def read_console(self):\n while self.proc is not None and self.proc.poll() is None:\n line = await self.loop.run_in_executor(None, self.proc.stdout.readline) # Async readline\n # Parse the command output and get the time in epoch format\n match = re.match(r'\\[([0-9]{...
[ "0.60659015", "0.5939009", "0.58916974", "0.57521653", "0.56490976", "0.5647062", "0.564037", "0.56112045", "0.5468083", "0.5451037", "0.53977436", "0.5367511", "0.53567046", "0.531081", "0.5267202", "0.5250136", "0.52072364", "0.51704943", "0.51641566", "0.51494616", "0.5137...
0.60982656
0
Write input to shared memory.
def write(self, text): self.bucket += text istr = self.shm_input.read() if istr == '': logging.debug('input shm is empty, writing') self.shm_input.write(self.bucket[:500]) self.bucket = self.bucket[500:]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_mem(self):\n request = 'commands/writemem'\n return self._post(request)", "def init_shared_memory(self, mem_key):\n\n self.shm_input = ConqueSoleSharedMemory(CONQUE_SOLE_INPUT_SIZE, 'input', mem_key)\n self.shm_input.create('write')\n self.shm_input.clear()\n\n ...
[ "0.60039324", "0.5930608", "0.59300476", "0.59215933", "0.5888126", "0.5880619", "0.5785169", "0.57275254", "0.5707015", "0.56850415", "0.56826055", "0.5598872", "0.5578339", "0.5567999", "0.5565713", "0.5556433", "0.5556433", "0.5539855", "0.5533115", "0.5515601", "0.5509092...
0.6564761
0
Write virtual key code to shared memory using proprietary escape sequences.
def write_vk(self, vk_code): seq = u("\x1b[") + u(str(vk_code)) + u("VK") self.write(seq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sendKeyEventVirtualMachine(self,node,vmid, key):\n post_data = {'key': str(key)}\n data = self.connect('put',\"nodes/%s/qemu/%s/sendkey\" % (node,vmid), post_data)\n return data", "def write_key():\n key = fernet.Fernet.generate_key()\n keyfile = open(KEY_PATH,'wb')\n keyfile.wr...
[ "0.5687842", "0.5372233", "0.53592056", "0.53062105", "0.51792115", "0.5168341", "0.51523745", "0.51337457", "0.51326776", "0.5097107", "0.5078062", "0.5057081", "0.50533074", "0.50469446", "0.50351524", "0.5021595", "0.49984193", "0.49932158", "0.49932158", "0.4989421", "0.4...
0.70451427
0
Write idle command to shared memory block, so subprocess controller can hibernate.
def idle(self): logging.info('writing idle shm') self.shm_command.write({'cmd': 'idle', 'data': {}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def idle():", "def standby() -> None:", "def idle(self):\n return", "def send_cmd(self, cmd):\n logger.info(\"sending cmd %s to fuse\", cmd)\n with open(self.ipc + \".\" + str(threading.current_thread().ident), 'w', 0) as f:\n #with open(self.ipc, 'a+') as f:\n f.write(...
[ "0.644398", "0.5689538", "0.55050457", "0.5367759", "0.5346736", "0.532258", "0.52653563", "0.52629304", "0.5259209", "0.5252185", "0.52438426", "0.52135015", "0.52101225", "0.51984185", "0.51957124", "0.5160946", "0.51504266", "0.51238734", "0.51017064", "0.509163", "0.50765...
0.8227453
0
Write resume command to shared memory block, so subprocess controller can wake up.
def resume(self): self.shm_command.write({'cmd': 'resume', 'data': {}})
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resume(self):\n self.stdin_queue.put(\"resume\")", "def resume(self):\n\t\treturn Job(SDK.PrlVm_Resume(self.handle)[0])", "def resume(self):\n\t\tpass", "def resume(vm='', env=''):\n local( main_dir + '/vagrant/bin/vm.sh resume ' + str(vm) + ' ' + str(env) )", "def resume(self):\n pass",...
[ "0.62004507", "0.6185218", "0.6178511", "0.61511475", "0.6130952", "0.6130952", "0.6130952", "0.6088023", "0.593814", "0.5913175", "0.5753355", "0.57384956", "0.57384956", "0.56370336", "0.561635", "0.561405", "0.5585171", "0.5578812", "0.55781746", "0.55668956", "0.5525529",...
0.7903206
0
calculates PID for x, y and z
def xyzPID(home_lon, home_lat, home_alt, lon, lat, alt, error_sum, last_error_lon, last_error_lat, prev_time): #x PID output_lon, last_error_lon, prev_time = calculatePID(home_lon,lon,error_sum, last_error_lon, prev_time) #y PID output_lat, last_error_lat, prev_time = calculatePID(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def elec_p_xyz_loop(x, y, z):\n U = 0.\n\n r = np.sqrt(x**2 + y**2 + z**2)\n x = x/r\n y = y/r\n z = z/r\n\n npts = x.size\n for i in range(npts-1):\n for j in range(i+1, npts):\n dsq = (x[i]-x[j])**2 + (y[i]-y[j])**2 + (z[i]-z[j])**2\n U += 1./np.sqrt(dsq)\n re...
[ "0.6086874", "0.59364504", "0.5866037", "0.5758806", "0.5704394", "0.56775993", "0.5539624", "0.5480766", "0.5472652", "0.544325", "0.544325", "0.54417825", "0.5440501", "0.54281235", "0.53789955", "0.53669405", "0.5355419", "0.5350521", "0.5342179", "0.53407073", "0.52950525...
0.6788774
0
Set all parameters of the model to 0 Parameters. layers_dims list, the number of layers of the model and the number of nodes corresponding to each layer Returns parameters a dictionary containing all W and b W1 weight matrix with dimension (layers_dims[1], layers_dims[0]) b1 bias vector, dimension (layers_dims[1], 1) W...
def initialize_parameters_zeros(layers_dims): parameters = {} # the number of layers L = len(layers_dims) for l in range(1, L): parameters["W" + str(l)] = np.zeros((layers_dims[l], layers_dims[l - 1])) parameters["b" + str(l)] = np.zeros((layers_dims[l], 1)) return parameters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_parameters_random(layers_dims):\n # set random seed\n np.random.seed(3)\n parameters = {}\n L = len(layers_dims)\n\n for l in range(1, L):\n parameters['W' + str(l)] = np.random.randn(layers_dims[l], layers_dims[l - 1]) * 10\n parameters['b' + str(l)] = np.zeros((layers_...
[ "0.66994137", "0.6524211", "0.6484232", "0.6440478", "0.64257056", "0.63918364", "0.6384597", "0.63792133", "0.6360458", "0.63285124", "0.6324615", "0.6255973", "0.61910826", "0.61910826", "0.61910826", "0.61248976", "0.609352", "0.6068253", "0.6025813", "0.6024569", "0.59612...
0.80968946
0
Compute conventional batch mean and variance.
def _compute_batch_moments(x): return torch.mean(x, dim=(0, 2, 3), keepdim=True), torch.var(x, dim=(0, 2, 3), keepdim=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_stat(x):\n\tmean = torch.mean(x, dim=[0, 2, 3], keepdim=True)\n\tvar = torch.mean((x-mean)**2, dim=[0, 2, 3], keepdim=True)\n\treturn mean, var", "def _compute_mean_std(self, sum_, ssum, size):\n assert size > 1, 'BatchNorm computes unbiased standard-deviation, which requires size > 1.'\n ...
[ "0.7335093", "0.7076149", "0.7028218", "0.6966497", "0.6955343", "0.67826116", "0.6779366", "0.66976017", "0.66172445", "0.65709674", "0.6552331", "0.65507686", "0.6510585", "0.65076244", "0.6413702", "0.6331475", "0.6327264", "0.6293395", "0.62796533", "0.62605953", "0.62585...
0.7130227
1
Compute instance mean and variance.
def _compute_instance_moments(x): return torch.mean(x, dim=(2, 3), keepdim=True), torch.var(x, dim=(2, 3), keepdim=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_calculate_nhpp_mean_variance_inst_mean(self):\n\n _mean_var = calculate_nhpp_mean_variance(46, 3000.0, 0.332, 0.616, 2)\n self.assertAlmostEqual(_mean_var, 489.07164965)", "def get_mean_and_variance(self):\n self._set_statistics()\n return self.statistics_object.get_mean(), s...
[ "0.7042789", "0.7030097", "0.684569", "0.6785732", "0.6705467", "0.65460956", "0.6473726", "0.6455855", "0.64296347", "0.6423424", "0.64022136", "0.63945234", "0.6373781", "0.6314979", "0.6271918", "0.6263915", "0.62379485", "0.6202545", "0.61835915", "0.6181711", "0.6178875"...
0.7274688
0
Compute layer mean and variance.
def _compute_layer_moments(x): return torch.mean(x, dim=(1, 2, 3), keepdim=True), torch.var(x, dim=(1, 2, 3), keepdim=True)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_mean(self):\n return [layer._get_mean() for layer in self.layers]", "def variance(self, mean=None):\n raise NotImplementedError", "def mean(self):\n return self.vmean", "def _compute_mean_variance(self, mean_dict: Dict) -> None:\n self.eval_dict = defaultdict()\n f...
[ "0.68845415", "0.68721896", "0.68708557", "0.6631005", "0.6604006", "0.6520616", "0.6506461", "0.6493008", "0.6486367", "0.64617854", "0.643203", "0.639767", "0.6389797", "0.6380059", "0.6377723", "0.6370964", "0.63681614", "0.636281", "0.6351963", "0.6349545", "0.6343845", ...
0.69694275
0
Combine batch moments with augment moments using blend factor alpha.
def _compute_pooled_moments(x, alpha, batch_mean, batch_var, augment_moment_fn): augment_mean, augment_var = augment_moment_fn(x) pooled_mean = alpha * batch_mean + (1.0 - alpha) * augment_mean batch_mean_diff = batch_mean - pooled_mean augment_mean_diff = augment_mean - pooled_mean ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alpha_blend(input_image, segmentation_mask, alpha=0.5):\n blended = np.zeros(input_image.size, dtype=np.float32)\n blended = input_image * alpha + segmentation_mask * (1 - alpha)\n return blended", "def blending_example2():\n pic_earth = read_image(relpath(\"./externals/pic_earth.jpg\"), 2)\n ...
[ "0.59165734", "0.57801425", "0.57290673", "0.56443745", "0.5604431", "0.5587423", "0.55799013", "0.55666465", "0.55648756", "0.55581915", "0.55063105", "0.5502954", "0.5480455", "0.5472708", "0.5440756", "0.5434398", "0.5434398", "0.5413661", "0.5396812", "0.53911597", "0.538...
0.6051326
0
Provides the function to compute augment moemnts.
def _get_augment_moment_fn(self): pass # always override this function
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_augment_moment_fn(self):\n return self._compute_instance_moments", "def augment(self, image):\n pass", "def apply_augmentations(self, x, augmentations):\r\n # print(\"\\n#####################\\nSQDataset.apply_augmentations: x shape == \", x.shape)\r\n # print(\"SQDataset.a...
[ "0.64456785", "0.63316554", "0.62134147", "0.61737436", "0.6164592", "0.6051583", "0.60132986", "0.6005452", "0.5988301", "0.59473735", "0.5941723", "0.5938459", "0.5922076", "0.5920503", "0.58844405", "0.5810467", "0.57589525", "0.5726853", "0.56997806", "0.56924295", "0.569...
0.635719
1
Override the base class to get the function to compute instance moments.
def _get_augment_moment_fn(self): return self._compute_instance_moments
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moments(self):", "def _compute_instance_moments(x):\n return torch.mean(x, dim=(2, 3), keepdim=True), torch.var(x, dim=(2, 3), keepdim=True)", "def _get_augment_moment_fn(self):\n pass # always override this function", "def getMomentum(self):\n return self.p", "def _moments_match_nume...
[ "0.7662759", "0.68491524", "0.68225145", "0.57082653", "0.56545275", "0.56478214", "0.5608952", "0.55368495", "0.5529006", "0.5525961", "0.5501195", "0.54991955", "0.54955935", "0.5492941", "0.5492941", "0.54882663", "0.53813344", "0.53759295", "0.53658104", "0.532169", "0.53...
0.7838273
0
Handles muni input as either list (or array like) or some predefined strings.
def _muni_interpreter(self, muni_input): if isinstance(muni_input, (list, tuple, np.ndarray)): return(muni_input) elif muni_input == "all": if not hasattr(self, 'muni_info'): self._load_muni_info() return(list(self.muni_info.index[3:])) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input2strlist_nomapfile(invar):\n \n str_list = None\n if type(invar) is str:\n if invar.startswith('[') and invar.endswith(']'):\n str_list = [f.strip(' \\'\\\"') for f in invar.strip('[]').split(',')]\n else:\n str_list = [invar.strip(' \\'\\\"')]\n elif type(in...
[ "0.61064446", "0.6048012", "0.60012585", "0.5989305", "0.5966896", "0.5906677", "0.59033054", "0.58828855", "0.5752301", "0.57429147", "0.5707196", "0.5682213", "0.5681342", "0.5658818", "0.5644289", "0.5642251", "0.5619448", "0.5618888", "0.55098224", "0.548022", "0.54716176...
0.6802392
0
This takes the number to guess and the guess and compares them
def compare(number_to_guess, guess): if guess > number_to_guess: print('Too high. \n Guess again') elif guess < number_to_guess: print('Too low. \n Guess again') else: print(f'You got it! The answer was {number_to_guess}')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_guess(number, guess):\r\n if number == guess:\r\n return False, \"you won.\"\r\n elif number < guess:\r\n return True, \"too high.\"\r\n else:\r\n return True, \"too low.\"", "def checkGuess(guess, secretNum): \n if guess < secretNum:\n return \"Your guess is ...
[ "0.7632458", "0.7420763", "0.7156625", "0.7070007", "0.7053276", "0.6971584", "0.6961167", "0.69260126", "0.6814522", "0.67901284", "0.6761293", "0.67394257", "0.6682385", "0.6645885", "0.6593592", "0.6592362", "0.6556644", "0.65454453", "0.65333205", "0.65158445", "0.6447257...
0.76252204
1
Update the neb energies and forces
def get_neb_energies_forces(self): energies = [] forces = [] for i in self.path.inner_images: e, f = self.model.predict_energy_and_forces(i) energies.append(e) forces.append(f) self.model_forces = forces self.energies[1:-1] = energies s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_forces(self):\r\n # update all the functions\r\n self.compute_gravity()\r\n self.compute_tides()\r\n self.compute_centrifugal()\r\n self.compute_coriolis()\r\n\r\n # add together the forces into the summation function\r\n self.forcing.assign(self.ftides+s...
[ "0.7071552", "0.7028039", "0.6974602", "0.60360223", "0.60316986", "0.6016974", "0.5976503", "0.59699845", "0.5962121", "0.5897876", "0.5874239", "0.58718544", "0.584177", "0.58307546", "0.5797778", "0.5794067", "0.578954", "0.5766696", "0.57582974", "0.575816", "0.5734929", ...
0.71072215
0
Update CI NEB energies and forces for images of indices
def get_ci_energies_forces(self, indices: List[int]): self.get_neb_energies_forces() for i in indices: if i < 1 or i > len(self.path) - 2: raise ValueError('Index %d is at boundary' % i) self.forces[i] = self.model_forces[i] - 2 * np.sum(self.model_forces[i] * sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_neb_energies_forces(self):\n energies = []\n forces = []\n for i in self.path.inner_images:\n e, f = self.model.predict_energy_and_forces(i)\n energies.append(e)\n forces.append(f)\n self.model_forces = forces\n self.energies[1:-1] = energ...
[ "0.59176993", "0.5626548", "0.5580271", "0.5580271", "0.55643463", "0.5498005", "0.540635", "0.5385511", "0.53412944", "0.53172666", "0.5275748", "0.5260982", "0.52208763", "0.52207667", "0.52154756", "0.5145676", "0.5142759", "0.51413727", "0.5129286", "0.5127432", "0.512379...
0.63668287
0
MPQA (MultiPerspective Question Answering) Subjectivity Lexicon (8.222 entries)
def read_mpqa(): fname = ta_config.MPQA with open(fname, "r") as f: lines = f.read().splitlines() entries = [tuple(line.split("\t")) for line in lines] lexicon = defaultdict(dict) for entry in entries: priorpolarity = entry[5].split('=')[1] pos_map = {'no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possession_ques(analysis):\n\n #processing as statement\n phrase = statement(analysis)\n\n #We have to know if it is plural or singular\n if other_functions.plural_noun(analysis.sn) == 1:\n return ['whose'] + phrase[:len(phrase) - 1] + ['these'] + ['?']\n else:\n return ['whose'] +...
[ "0.5961933", "0.5959305", "0.58352005", "0.58204293", "0.575788", "0.57116324", "0.5685468", "0.56761533", "0.5612229", "0.5584282", "0.5581954", "0.5495818", "0.5487884", "0.5465028", "0.5460172", "0.5444511", "0.5440515", "0.5398719", "0.53861916", "0.53840286", "0.5369511"...
0.74378127
0
Creates an epsilongreedy policy based on a given Qfunction and epsilon. Returns a function that takes the state as an input and returns the probabilities for each action in the form of a numpy array of length of the action space(set of possible actions).
def createEpsilonGreedyPolicy(Q, epsilon, num_actions): def policyFunction(state): Action_probabilities = np.ones(num_actions, dtype=float) * epsilon / num_actions best_action = np.argmax(Q[state]) Action_probabilities[best_action] += (1.0 - epsilon) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createEpsilonGreedyPolicy(Q, epsilon, num_actions):\n def policyFunction(state):\n\n Action_probabilities = np.ones(num_actions,\n dtype = float) * epsilon / num_actions\n\n best_action = np.argmax(Q[state])\n Action_probabilities[best_action] += (1.0 - epsilon)\n ...
[ "0.85712636", "0.79445827", "0.7728248", "0.7678616", "0.76707244", "0.75580287", "0.7514789", "0.744547", "0.73657966", "0.73407954", "0.7282954", "0.7080421", "0.7035401", "0.70255274", "0.69141966", "0.6895311", "0.6749669", "0.6707011", "0.6700968", "0.6691628", "0.667362...
0.8536859
1
Deletes ingredient in progress for user with ``user_id``.
def delete_ingredients_in_progress(cls, user_id: str, ingredient_id: str): session: Session = cls.get_session() ingredient_in_progress = cls.get_query().filter( and_( IngredientsInProgressModel.ingredient_id == ingredient_id, IngredientsInProgressModel.user_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove(self, user_id):\n pass", "def delete(self, user: 'UserCondensed'):\n self._delete(entity=user)", "async def red_delete_data_for_user(self, *, requester, user_id):\n return", "async def red_delete_data_for_user(self, *, requester, user_id):\n return", "def delete_item(...
[ "0.678601", "0.66784865", "0.66746336", "0.66746336", "0.6618471", "0.65111923", "0.6441183", "0.6438016", "0.64127743", "0.6369499", "0.6331467", "0.6273206", "0.62685937", "0.62605387", "0.62178457", "0.61816704", "0.61548245", "0.6083064", "0.6066107", "0.60525554", "0.602...
0.858545
0
Get a list of jobs the user has volunteered for
def get(self, user_id): user = UserModel.find_by_id(user_id) print("Getting volunteered jobs") jobs = [job.json() for job in user.volunteered_jobs] return {"jobs": jobs}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_list(self):\n return self.job_list", "def get_job_list(self):\n return self.job_list", "def get(self):\n # TODO: auth\n return list(self.app.db.jobs.find())", "def get_job_query(self):\n context = aq_inner(self.context)\n catalog = getToolByName(context, 'portal_...
[ "0.6712661", "0.6712661", "0.66783905", "0.6636779", "0.6613315", "0.65323234", "0.6438695", "0.64050114", "0.63789976", "0.6336263", "0.63244027", "0.6301153", "0.6282709", "0.62449884", "0.61884457", "0.61836964", "0.6181903", "0.61756855", "0.61736864", "0.6167379", "0.614...
0.7515113
0
Allocate a 2dimensional array, with the specified initial value. May do weird things with objects, I'm not sure. >>> alloc2d(2,5) [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0]] >>> alloc2d(2,2,"x") [['x', 'x'], ['x', 'x']]
def alloc2d(x,y,iv=0): return [[iv for j in range(int(x))] for i in range(int(y))]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_two_d_array(dimens, val):\n w, x = dimens\n return [[val for j in range(x)] for i in range(w)]", "def create2d(row_count, col_count, value=None):\n a = [None] * row_count\n for row in range(row_count):\n a[row] = [value] * col_count\n return a", "def init_one_d_array(len, val):\n...
[ "0.65265894", "0.645137", "0.6148947", "0.60284287", "0.5584389", "0.5562695", "0.5459762", "0.544923", "0.54422444", "0.54183143", "0.5393952", "0.53860515", "0.5328383", "0.5234134", "0.5222009", "0.51992697", "0.51929575", "0.51736486", "0.5124553", "0.5068666", "0.5011701...
0.6807487
0
Subtract the list b from a, return a copy >>> sublist([1, 2, 3, 4, 5], [2, 3]) [1, 4, 5]
def sublist(a, b): r = a[:] for i in b: r.remove(i) return r
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listSubtract(alist,blist):\n result = []\n for item in alist:\n if item not in blist:\n result.append(item)\n return result", "def list_subtract(a, b):\n a_only = list(a)\n for x in b:\n if x in a_only:\n a_only.remove(x)\n return a_only", "def sub_list...
[ "0.7625603", "0.75862557", "0.70652115", "0.7039867", "0.69050086", "0.6803992", "0.66484016", "0.66435206", "0.6537795", "0.6537795", "0.6537795", "0.64460796", "0.6338398", "0.62913436", "0.6228029", "0.61968637", "0.61660093", "0.6100752", "0.6035787", "0.60106146", "0.600...
0.7964486
0
Adds a RgbdSensor to to the scene_graph at (fixed) pose X_PC relative to the parent_frame. If depth_camera is None, then a default camera info will be used. If renderer is None, then we will assume the name 'my_renderer', and create a VTK renderer if a renderer of that name doesn't exist. If parent_frame is None, then ...
def AddRgbdSensor( builder, scene_graph, X_PC, depth_camera=None, renderer=None, parent_frame_id=None, ): if sys.platform == "linux" and os.getenv("DISPLAY") is None: from pyvirtualdisplay import Display virtual_display = Display(visible=0, size=(1400, 900)) virtual_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AddRgbdSensors(\n builder,\n plant,\n scene_graph,\n also_add_point_clouds=True,\n model_instance_prefix=\"camera\",\n depth_camera=None,\n renderer=None,\n):\n if sys.platform == \"linux\" and os.getenv(\"DISPLAY\") is None:\n from pyvirtualdisplay import Display\n\n virt...
[ "0.6333064", "0.5002681", "0.4995963", "0.4986556", "0.4950906", "0.4458174", "0.44040585", "0.43817294", "0.43758163", "0.43542552", "0.43490773", "0.43313876", "0.43151295", "0.4292971", "0.42469728", "0.4221219", "0.4216358", "0.42138645", "0.4201191", "0.4180696", "0.4163...
0.8106876
0
Adds a RgbdSensor to the first body in the plant for every model instance with a name starting with model_instance_prefix. If depth_camera is None, then a default camera info will be used. If renderer is None, then we will assume the name 'my_renderer', and create a VTK renderer if a renderer of that name doesn't exist...
def AddRgbdSensors( builder, plant, scene_graph, also_add_point_clouds=True, model_instance_prefix="camera", depth_camera=None, renderer=None, ): if sys.platform == "linux" and os.getenv("DISPLAY") is None: from pyvirtualdisplay import Display virtual_display = Display(v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AddRgbdSensor(\n builder,\n scene_graph,\n X_PC,\n depth_camera=None,\n renderer=None,\n parent_frame_id=None,\n):\n if sys.platform == \"linux\" and os.getenv(\"DISPLAY\") is None:\n from pyvirtualdisplay import Display\n\n virtual_display = Display(visible=0, size=(1400, 90...
[ "0.60445213", "0.47997555", "0.47449347", "0.46184856", "0.45942456", "0.43920726", "0.43797317", "0.4326893", "0.42549992", "0.42535293", "0.4234432", "0.42307407", "0.42210782", "0.42094594", "0.41918367", "0.4191364", "0.41856608", "0.41717416", "0.41657764", "0.41477117", ...
0.7247001
0
Given a participant_id, return a participant_id. If we can claim the given participant_id, we will. Otherwise we'll find a random one that isn't taken yet. Whichever we return is guaranteed to be claimed in the database.
def claim_id(participant_id): seatbelt = 0 while 1: try: db.execute( "INSERT INTO participants (id) VALUES (%s)" , (participant_id,) ) except IntegrityError: # Collision, try again with a random value. participant_id = hex(int...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getParticipant(self, discordId):\n if discordId in participants:\n return participants[discordId]\n else:\n return None", "def participant_id(self):\n return self.data[\"id\"]", "def get_authorized_user(p):\n if Participant.objects.filter(psid=p).count() == 0:\...
[ "0.586102", "0.57109445", "0.55985445", "0.5515024", "0.53133464", "0.52435404", "0.51992923", "0.5119271", "0.51169336", "0.50899434", "0.5082975", "0.50726396", "0.50724584", "0.5045251", "0.49716988", "0.49658343", "0.496167", "0.4956202", "0.49425507", "0.49274588", "0.49...
0.7340709
0
Given str, unicode, unicode, and dict, return unicode and boolean. Network is the name of a social network that we support (ASCII blah). User_id is an immutable unique identifier for the given user on the given social network. Username is the user's login/user_id on the given social network. We will try to claim that f...
def upsert(network, user_id, username, user_info, claim=False): typecheck( network, str , user_id, (int, unicode) , user_info, dict ) user_id = unicode(user_id) # Record the user info in our database. # ===================================== INSERT = """\ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username(provider, username):\n\n if provider == 'alditalk':\n if username.isdigit(): # only mobile number\n return True\n else:\n return False\n elif provider == 'netzclub': # mobile number and email\n if ((username.isdigit()) or (...
[ "0.51669383", "0.5083092", "0.49614066", "0.49047366", "0.48961347", "0.4839635", "0.47655556", "0.4718195", "0.47101656", "0.46781144", "0.46727902", "0.46368912", "0.46256196", "0.46220523", "0.46210793", "0.4603513", "0.45982912", "0.45585674", "0.45509598", "0.45504412", ...
0.60893
0
Find the indices of the largest 5 clusters in the system
def findIndex(cluster_size, cluster_idx, tracked_clusters, index_tracked_clusters): print 'Update is conducting' # Calculate the largest 5 clusters size_arr = np.asarray(cluster_size) maxs = -bot.partsort(-size_arr, 5)[:5] # 5 largest clusters maxs = sorted(maxs, reverse=True) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clusters(self):\n return np.argmax(self.alpha[:, :, 0], axis=0)", "def get_cluster_indices(self,dataset, cluster_number):\n\t\tself.__init__(dataset, self.k)\n\t\tself.e_step() #got responsibilities\n\t\tmax_cluster = np.argmax(self.w, axis = 1)\n\t\tindices = []\n\t\tfor i in range(dataset.shape[0]):...
[ "0.6519562", "0.65038353", "0.64770246", "0.64451647", "0.64059144", "0.63642323", "0.6343986", "0.6262098", "0.61906475", "0.6190452", "0.6188377", "0.61648357", "0.61436564", "0.61352074", "0.61263", "0.61253023", "0.609048", "0.6041876", "0.6037949", "0.6018775", "0.601396...
0.66095847
0
Greedy algorithm which finds a probable mutation subgraph for given nodes. This algorithm chooses splits within the tree based on which mutation occurs most frequently, weighted by the prior probabilities of each mutation state for each character. Strings with NA ('') as a state in the split character are segregated wi...
def greedy_build(nodes, priors=None, cutoff=200, considered=set(), uniq='', targets=[]): # Tracks frequency of states for each character in nodes character_mutation_mapping = defaultdict(int) # G models the network that is returned recursively G = nx.DiGraph() root = root_finder(nodes) # Base case check for r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greedy_learn(self,node,db,labels,ids):\n if node.depth >= self.maxdepth or len(ids) <= self.minexamples:\n #terminate recursion\n node.pick_best_label(db,labels,ids)\n err = misclassification_error([labels[id] for id in ids])\n if err > 0:\n pri...
[ "0.590502", "0.5824857", "0.58222175", "0.5818163", "0.5810747", "0.5779823", "0.57535565", "0.572609", "0.5676844", "0.5671201", "0.5649606", "0.56414163", "0.5636852", "0.5616348", "0.56067246", "0.5597054", "0.55416656", "0.5537339", "0.55193657", "0.55169916", "0.5503138"...
0.7791946
0
Compares the weather forecast of two cities passed in
def get_weather_forecast_comparison(user_city, explored_city, days=7): user_city_forecast = weather_client.getForecastWeather(q=user_city, days=days)['forecast']['forecastday'] explored_city_forecast = weather_client.getForecastWeather(q=explored_city, days=days)['forecast']['forecastday'] weather_forecast_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_weather_forecast_comparison(user_city=\"lagos\", explored_city=\"london\", days=7):\n user_city_forecast = weather_client.getForecastWeather(q=user_city, days=days)['forecast']['forecastday']\n explored_city_forecast = weather_client.getForecastWeather(q=explored_city, days=days)['forecast']['forecas...
[ "0.71536994", "0.6245935", "0.6226744", "0.60275173", "0.5958302", "0.57983166", "0.5735847", "0.56872874", "0.5631134", "0.5619025", "0.5510218", "0.5439192", "0.5397346", "0.53896284", "0.5317874", "0.52734953", "0.5242966", "0.5232327", "0.521958", "0.5216427", "0.5195094"...
0.7030591
1
Returns True if the given term tuple (fieldname, text) is in this reader.
def __contains__(self, term): fieldname, text = term query = dict(fieldname=fieldname, text=text) return bool(self.index.collection.find(query).count())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(self, term):\n\t\tif term in self.textFile:\n\t\t\treturn True\n\t\t\n\t\treturn False", "def _is_term_exist(self, term):\n return term in self.postingDict", "def __contains__(self, doc_label):\n return doc_label in self.docs", "def __contains__(self, item):\n return item in...
[ "0.7650702", "0.68390197", "0.6475184", "0.6443119", "0.6418949", "0.63440895", "0.63410914", "0.6325038", "0.6281455", "0.6252877", "0.6130331", "0.6100055", "0.60711753", "0.5990042", "0.5925225", "0.59213024", "0.59145826", "0.5882695", "0.58655465", "0.58621746", "0.58379...
0.7103255
1
Returns the stored fields for the given document number.
def stored_fields(self, docnum): return self.index.collection.get(docnum).keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stored_fields(self, docnum):\r\n return self.doc_reader[docnum]", "def getFieldNumbers():\n return _getCampaignDict()[\"field_numbers\"]", "def field_by_number(self, number):\r\n return self._by_number[number]", "def field_by_number(cls, number):\n return cls.__by_number[number]",...
[ "0.83763015", "0.68768024", "0.6653822", "0.621729", "0.6031412", "0.5998559", "0.5727719", "0.5719909", "0.5710211", "0.56648844", "0.5622993", "0.5617283", "0.5602116", "0.558327", "0.5546262", "0.5530749", "0.5526932", "0.5522419", "0.5505145", "0.5499001", "0.5497499", ...
0.83722156
1
This function takes a ply that does not contain colored faces and convert it to a colored file format. Note that if you want to work with the colors
def colorize(filename): # Read data from existing ply plydata = PlyData.read(filename) # Return false if the file already contains colored faces properties = str(plydata['face'].properties) if "red" and "green" and "blue" and "counter" in properties: return True faces = plydata['face'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_pointcloud(rgb_file, mask_file,depth_file,ply_file):\n rgb = Image.open(rgb_file)\n # depth = Image.open(depth_file)\n depth = Image.open(depth_file).convert('I')\n mask = Image.open(mask_file).convert('I')\n\n # if rgb.size != depth.size:\n # raise Exception(\"Color and depth im...
[ "0.58714455", "0.57085764", "0.56858146", "0.54114306", "0.5275804", "0.5268924", "0.5008679", "0.49845684", "0.4942795", "0.49143073", "0.4902455", "0.4884634", "0.48557335", "0.48439094", "0.48289695", "0.48243293", "0.48167127", "0.47649246", "0.47608292", "0.4744698", "0....
0.72984517
0
This method is used to perform Label Encoding on a given list
def label_encode(data: List) -> [np.ndarray, List[LabelEncoder]]: labels_encoded = [] data_encoded = np.array(data) for i in range(data_encoded.shape[1]): le = preprocessing.LabelEncoder() le.fit(data_encoded[:, i]) labels_encoded.append(le) data_encoded[:, i] = le.transform(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_labels(labels_list: np.ndarray, label_encoder) -> np.ndarray:\n labels = label_encoder.fit_transform(labels_list)\n if label_encoder.classes_.size == 2:\n return labels\n else:\n return to_categorical(labels)", "def one_hot_encoding((uri, label), all_labels):\n labels = [0]*N...
[ "0.7562382", "0.6891295", "0.6828393", "0.67302644", "0.67219895", "0.65855664", "0.655393", "0.6548483", "0.65094924", "0.64900345", "0.64831984", "0.6471565", "0.6455571", "0.64494634", "0.6426103", "0.6385746", "0.62811464", "0.62680995", "0.622862", "0.6193661", "0.617948...
0.75347763
1
Check whether sequence str contains ALL of the items in set.
def containsAll(str, set): return 0 not in [c in str for c in set]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containsAny(str, set):\n return 1 in [c in str for c in set]", "def containsAny(str, set):\n return 1 in [c in str for c in set]", "def containsAny(str, set):\n return 1 in [c in str for c in set]", "def all_unique_set(string):\n return len(string) == len(set(string))", "def all_in_set(the_...
[ "0.75599706", "0.75599706", "0.75599706", "0.73432213", "0.7040939", "0.69977653", "0.67504674", "0.65502936", "0.6536207", "0.64373004", "0.63491184", "0.6310514", "0.6302475", "0.6282493", "0.6272134", "0.62464535", "0.62243676", "0.6215836", "0.62083054", "0.6190645", "0.6...
0.8373326
1
Loads a snippet from a dictionary. If an existing snippet with this date is found, that one is updated, committed to the database, and returned. Otherwise a new instance is populated, committed to the database, and returned.
def load_from_json(user_id, json): year = json["year"] week = json["week"] text = json.get("text", "") tags = json.get("tags", []) return Snippet.update(user_id, year, week, text, tags)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n if not os.path.isfile(self.DBFILE):\n self.snippets = {}\n return\n\n with open(self.DBFILE) as fobj:\n content = fobj.read()\n if not content.strip():\n content = \"{}\"\n\n self.snippets = {\n ...
[ "0.5525752", "0.5340668", "0.52998114", "0.5021224", "0.49906397", "0.48999608", "0.47908178", "0.47714812", "0.47337997", "0.4732373", "0.47303945", "0.47028187", "0.4698919", "0.46946174", "0.4689702", "0.46578616", "0.46578616", "0.46391878", "0.4634687", "0.4631234", "0.4...
0.57506377
0
Reads ident and direction from packet, and returns the associated struct description from structs global. Normalises return to be a ((str, str), ...)
def get_struct(self, packet): o = structs[packet.ident] if isinstance(o, dict): o = o[packet.direction] if len(o) and not isinstance(o[0], tuple): o = (o), return o
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def struct_handler(rdr: TextIO) -> str:\n # What is the indent level?\n line = rdr.readline()\n spaces = 0\n for c in line:\n if c != ' ':\n break\n spaces += 1\n if spaces < 4: # this would be a false positive exit early\n return line\n # define an exit condition\...
[ "0.60142964", "0.5952989", "0.5886524", "0.55371803", "0.5497203", "0.5459148", "0.5436307", "0.53541756", "0.529343", "0.5292839", "0.5251687", "0.5219966", "0.5216221", "0.5205466", "0.51578975", "0.50616544", "0.5050829", "0.50503224", "0.5029179", "0.50224257", "0.5017213...
0.71432406
0
Reads buff (consuming bytes) and returns the unpacked value according to the given type.
def unpack(self, data_type): if data_type in data_types: format = data_types[data_type] return self.unpack_real(format[0], format[1]) if data_type == "string8": length = self.unpack('short') if length < 0: raise Exception("Negative length for string") if len(self.buff) < length: raise Inco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unpack_real(self, data_type, length):\n\t\tif len(self.buff) < length:\n\t\t\traise IncompleteData()\n\t\to = struct.unpack_from('!'+data_type, self.buff)[0]\n\t\tself.buff = self.buff[length:]\n\t\treturn o", "def recv_type(self, type_):\n msg = self.recv()\n assert msg and msg['type'] == type...
[ "0.6121442", "0.6102325", "0.6010905", "0.59326094", "0.59165037", "0.57921314", "0.57729095", "0.5755466", "0.5736085", "0.5672907", "0.5606049", "0.5564489", "0.5529752", "0.5459146", "0.54543996", "0.5428361", "0.5421578", "0.5403828", "0.53911126", "0.5365144", "0.5348785...
0.6249607
0
Takes a packet, and returns the encoded bytestring representing it.
def encode_packet(self, packet): try: output = self.pack('ubyte', packet.ident) append = '' #0x17 if packet.ident == 0x17: if packet.data['unknown'] > 0: for i in ('x2','y2','z2'): append += self.pack('short', packet.data[i]) #0x33 if packet.ident in (0x33, 0x34): packet.data['da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_packet(self, packet, b64=False):\n if packet.binary and not b64:\n bytes = six.int2byte(packet.type)\n else:\n bytes = six.binary_type(packet.type)\n if packet.binary and b64:\n bytes = 'b' + bytes\n\n if packet.binary and b64:\n ...
[ "0.7865717", "0.6886599", "0.67298377", "0.6656107", "0.63058937", "0.62062097", "0.61510146", "0.6113067", "0.6092784", "0.60803", "0.60527766", "0.6038609", "0.6027137", "0.6022875", "0.59639084", "0.5963516", "0.5936586", "0.59108037", "0.58827156", "0.5860486", "0.5859598...
0.7339893
1
A wrapper about the normal objects, that lets you unpack encoded packets easily. Returns (packet, remaining_buff), where remaining_buff is the given buffer without the bytes eaten by the packet. If no more packets can be read from buff, returns (None, buff).
def stateless_unpack(buff, to_server): decoder = PacketDecoder(to_server) decoder.buff = buff packet = decoder.read_packet() return packet, decoder.buff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_packet(self):\n\n\t\t#self.debug(\"READ BUFFER SIZE: %d\" % len(self.buff))\n\t\tbackup = self.buff[:]\n\t\tpacket = Packet()\n\t\ttry:\n\t\t\tpacket.direction = self.node\n\t\t\tpacket.ident = self.unpack('ubyte')\n\t\t\t\n\t\t\t#Defined structs from huge dict\n\t\t\tfor datatype, name in self.get_struct...
[ "0.6680396", "0.6446139", "0.635691", "0.61377084", "0.60597813", "0.59214246", "0.59068066", "0.5846877", "0.5788773", "0.57825875", "0.5771481", "0.5694871", "0.5669175", "0.5655013", "0.5589426", "0.55781716", "0.5572244", "0.5557182", "0.55246246", "0.55121374", "0.551061...
0.72920316
0