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 |
|---|---|---|---|---|---|---|
Internal function; reads 160 bytes; returns SigRef dict | def _sigref(self, hdr):
# Called SigRef in OpenMIMS
d = {}
d['sigref enabled'] = bool(unpack(self._bo + 'i', hdr.read(4))[0])
d['Species'] = self._species(hdr)
d['detector'], d['offset'], d['quantity'] = \
unpack(self._bo + '3i', hdr.read(12))
return d | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _determineSiginfo(self):\n return self.scanhandler.getSigInfo()",
"def read_signature(self):\n sig = []\n for i in range(7):\n self.writecmd(self.APP, self.WRITE3_READ1, 4, [0x30, 0x00, i, 0x00])\n sig.append(ord(self.data[0]))\n return sig",
"def sigmap():... | [
"0.6265356",
"0.62076366",
"0.58365846",
"0.5536021",
"0.548548",
"0.5361751",
"0.5291962",
"0.5138455",
"0.51221097",
"0.5057368",
"0.5055885",
"0.50379044",
"0.5031653",
"0.4984343",
"0.49766272",
"0.49392748",
"0.49229896",
"0.4908266",
"0.49044812",
"0.4899056",
"0.488583... | 0.6557984 | 0 |
Internal function; reads 'name'list, returns 'Name'List list. Name is one of "poly", "champs", or "offset". pos is the byte position where the maker 'Name'List starts. | def _pco_list(self, hdr, name, pos):
if name not in ('poly', 'champs', 'offset'):
raise TypeError('Name must be one of "poly", "champs", or "offset".')
hdr.seek(pos + 16)
length = unpack(self._bo + 'i', hdr.read(4))[0]
d = []
for p in range(length):
if na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse(name: unicode) -> List[unicode]:\n ...",
"def get_data_list_name(name):\n last = name[-1]\n if last in 'y':\n if last in 'a,e,i,o,u,y':\n name = name[0:-1] + 'ies'\n else:\n name += 's'\n elif last in 'ou':\n name += 'es'\n elif last == 'f':... | [
"0.5913137",
"0.5734696",
"0.57173675",
"0.5704192",
"0.5428346",
"0.54114586",
"0.52919006",
"0.523092",
"0.515922",
"0.5128202",
"0.5107926",
"0.50323385",
"0.5029057",
"0.5024938",
"0.4984507",
"0.4982534",
"0.4959758",
"0.49559516",
"0.49408996",
"0.49160388",
"0.48871195... | 0.655029 | 0 |
Internal function; reads 604 bytes; returns NanoSIMSHeader dict | def _nanosims_header(self, hdr):
# Called MaskNano in OpenMIMS; BFieldTab separated out; create extra sub-dict PeakCenter
d = {}
d['PeakCenter'] = {}
d['nanosimsheader version'], d['regulation mode'], d['mode'], \
d['grain mode'], d['semigraphic mode'], d['stage delta x'], \
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_header(self):\n # Read entire header into memory in one read to minimize Disk I/O.\n self.fh.seek(0)\n hdr = self.fh.read(self.header['header size'])\n\n # Find several markers in the byte-string\n # Each of these may occur more than once, find last.\n polylist_po... | [
"0.73658174",
"0.69573504",
"0.6710574",
"0.6574793",
"0.65231746",
"0.6502288",
"0.6488246",
"0.6479689",
"0.64746445",
"0.6471829",
"0.6462192",
"0.6388814",
"0.6361079",
"0.63563436",
"0.62608254",
"0.620985",
"0.6195907",
"0.6173336",
"0.61434764",
"0.6078154",
"0.6060612... | 0.69959986 | 1 |
Internal function; reads 40 bytes; returns SibCenter dict | def _sib_center(self, hdr):
# Called SecIonBeamNano in OpenMIMS
d = {}
d['detector'], d['start'], d['step size'], d['center'], \
d['50% width'], d['count time'] = \
unpack(self._bo + '3i 4x 2d i 4x', hdr.read(40))
if d['detector'] < 0:
d['detector'] =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ReadFromFile(self):\n\n data = \"\"\n try:\n with open(self.fileLoc, \"r\") as file:\n data += file.read()\n except IOError:\n with open(self.fileLoc, \"w\") as file:\n file.write(\" \")\n return {}\n \n if len(d... | [
"0.5785536",
"0.5752516",
"0.5639445",
"0.56043977",
"0.55615175",
"0.5549157",
"0.55427647",
"0.5499839",
"0.5498824",
"0.5498824",
"0.5498824",
"0.5496546",
"0.5494193",
"0.5480265",
"0.54728454",
"0.54726946",
"0.5456474",
"0.5423638",
"0.5399397",
"0.5391563",
"0.5381119"... | 0.6221385 | 0 |
Internal function; reads 52 bytes; returns EnergyCenter dict | def _energy_center(self, hdr):
# Called EnergyNano in OpenMIMS
# Added b field index, energy center enabled, and frequency from MaskNano
d = {}
d['detector'], d['start'], d['step size'], d['center'], \
d['delta'], d['count time'], d['b field index'], \
d['energy c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_econt_info(self, out_log):\n f = open_general(out_log)\n tmptxt = f.readlines()\n f.close()\n econt = {}\n itmp = search_string('[read_energy] number of energy points', tmptxt)\n if itmp>=0: econt['Nepts'] = int(tmptxt.pop(itmp).split()[-1])\n itmp = search... | [
"0.62065685",
"0.6093772",
"0.5696404",
"0.5627784",
"0.5605166",
"0.5560062",
"0.54680985",
"0.5448884",
"0.54376864",
"0.5429396",
"0.5422118",
"0.54056734",
"0.5390641",
"0.5382166",
"0.5379131",
"0.5374726",
"0.5370468",
"0.5367548",
"0.53634447",
"0.5357649",
"0.5348297"... | 0.6450997 | 0 |
Internal function; reads 40 bytes; returns E0sCenter dict | def _e0s_center(self, hdr):
# Called E0SNano in OpenMIMS
# b field index and e0s center enabled added to sub dict from main nano header
d = {}
d['b field index'], d['detector'], d['start'], \
d['step size'], d['count time'], d['center'], \
d['80% width'], d['E0S c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _energy_center(self, hdr):\n # Called EnergyNano in OpenMIMS\n # Added b field index, energy center enabled, and frequency from MaskNano\n d = {}\n d['detector'], d['start'], d['step size'], d['center'], \\\n d['delta'], d['count time'], d['b field index'], \\\n ... | [
"0.6067025",
"0.58813965",
"0.58291084",
"0.58286965",
"0.57235354",
"0.5581604",
"0.5528893",
"0.54986584",
"0.5458972",
"0.54205716",
"0.5396964",
"0.53808576",
"0.53559226",
"0.5334973",
"0.53345394",
"0.532626",
"0.53206766",
"0.5314516",
"0.5314026",
"0.5313711",
"0.5308... | 0.70755607 | 0 |
Internal function; reads 24 bytes; returns Phd dict | def _phd(self, hdr):
# Called PHDTrolleyNano in OpenMIMS
d = {}
d['used for phd scan'], d['phd start'], d['phd step size'], \
d['phd points'], d['phd count time'], d['phd scan repeat'] = \
unpack(self._bo + '6i', hdr.read(24))
d['used for phd scan'] = bool(d['use... | {
"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.5721486",
"0.55390424",
"0.5529163",
"0.5527557",
"0.5471468",
"0.5452702",
"0.5451226",
"0.5411389",
"0.538196",
"0.5380471",
"0.5379405",
"0.53696734",
"0.5360308",
"0.53434056",
"0.5339368",
"0.533022",
"0.5322472",
"0.53157157",
"0.5310362",
"0.52643",
"0.52467644",
... | 0.6085258 | 0 |
Internal function; reads 552 bytes; returns PrimaryBeam dict | def _primary_beam(self, hdr):
# Called ApPrimaryNano in OpenMIMS
d = {}
start_position = hdr.tell()
d['source'], d['current start'], d['current end'], d['Lduo'], d['L1'] = \
unpack(self._bo + '8s 4i', hdr.read(24))
# Each widths list is 10 ints long
d['Dduo']... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def readMappedData(options,phase):\n whole_mapped_data={}\n mapped_data_per_size_per_register={}\n alignment_filename=options.output_directory+\"/\"+options.input_filename+\"_bowtie1.bwt\"\n fhr=open(alignment_filename,\"r\")\n for line in fhr:\n try:\n read_id, strand, chromosome,... | [
"0.5953983",
"0.58629256",
"0.58464247",
"0.58088523",
"0.58030945",
"0.5788257",
"0.5764471",
"0.5760921",
"0.574736",
"0.56431025",
"0.5618509",
"0.55198056",
"0.5428157",
"0.5426255",
"0.5387071",
"0.5371464",
"0.5357119",
"0.5354184",
"0.53521776",
"0.53091997",
"0.530407... | 0.6400666 | 0 |
Internal function; reads 192 bytes; returns SecondaryBeam dict. | def _secondary_beam(self, hdr):
# Called ApSecondaryNano in OpenMIMS
d = {}
tmp = unpack(self._bo + 'd 42i 2d', hdr.read(192))
d['E0W'], d['ES'] = tmp[:2]
d['ES widths'] = tmp[2:12]
d['ES heights'] = tuple(tmp[12:22])
d['AS'] = tmp[22]
d['AS widths'] = tup... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dict_of_bytes2(self):\n pass",
"def readMappedData(options,phase):\n whole_mapped_data={}\n mapped_data_per_size_per_register={}\n alignment_filename=options.output_directory+\"/\"+options.input_filename+\"_bowtie1.bwt\"\n fhr=open(alignment_filename,\"r\")\n for line in fhr:\n ... | [
"0.5769819",
"0.55768013",
"0.5320195",
"0.5309456",
"0.52810633",
"0.51117134",
"0.5046398",
"0.50424224",
"0.5036759",
"0.4987889",
"0.4974147",
"0.4973411",
"0.4964252",
"0.49318144",
"0.4931506",
"0.49255773",
"0.49146205",
"0.49056354",
"0.4885065",
"0.48805022",
"0.4860... | 0.6231906 | 0 |
Internal function; reads 808 bytes, returns Detectors dict, part 1. | def _detectors1(self, hdr):
d = {}
d['FCs'] = self._exit_slits(hdr)
for n in range(1, 6):
det = 'Detector {}'.format(n)
d[det] = self._exit_slits(hdr)
d['LD'] = {}
d['LD']['exit slit width'], d['LD']['exit slit coeff a'], \
d['LD']['exit slit... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _decode_5104(data):\n\n text = []\n start_byte = 0\n while start_byte + 2 < len(data):\n tag = data[start_byte:start_byte + 2]\n if tag == b'#u':\n start_byte += 2\n text_size = struct.unpack(\n '<h', data[start_byte:start_byte + 2])[0]\n s... | [
"0.55249",
"0.54951215",
"0.5483159",
"0.54417527",
"0.5366495",
"0.5354542",
"0.5315288",
"0.5307329",
"0.52868056",
"0.51759344",
"0.5173563",
"0.5164894",
"0.51616204",
"0.5144877",
"0.51448137",
"0.51444095",
"0.5130224",
"0.51261944",
"0.5096947",
"0.50784016",
"0.507406... | 0.5675555 | 0 |
Internal function; read 0 bytes (8 and back up), returns True or False detecting start of preset. | def _preset_start(self, hdr):
test = hdr.read(8)
hdr.seek(-8, 1)
try:
test = self._cleanup_string(test)
except UnicodeDecodeError:
# Some non-null filler bytes
return False
# First entry in preset is .isf filename with full path
# If ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_present(self):\n try:\n self.read_binary(0, 2)\n return True\n except:\n return False",
"def hasNextByte(self) -> bool:\n raise NotImplementedError",
"def is_first_read(flag):\n IS_FIRST_SEGMENT = 0x40\n return (int(flag) & IS_FIRST_SEGMENT) !=... | [
"0.63439775",
"0.58925444",
"0.5845527",
"0.58173966",
"0.5697024",
"0.56170756",
"0.5586485",
"0.55379504",
"0.5442987",
"0.5413312",
"0.5377335",
"0.536196",
"0.53448826",
"0.5337862",
"0.5263421",
"0.5255416",
"0.52382976",
"0.5230703",
"0.5229115",
"0.52268827",
"0.520412... | 0.6545438 | 0 |
Internal function; reads 84 bytes, returns Image dict. | def _image_hdr(self, hdr):
# Called ... in OpenMIMS
d = {}
d['header size'], d['type'], d['width'], d['height'], \
d['bytes per pixel'], d['masses'], d['planes'], \
d['raster'], d['original filename'] = \
unpack(self._bo + 'i 6h i 64s', hdr.read(84))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_data(reader: UFOReader, filename: str) -> bytes:\n return reader.readImage(filename) # type: ignore",
"def open_image_and_meta(image_bytes):\n with MemoryFile(image_bytes) as memfile:\n with memfile.open() as src:\n meta = src.meta\n arr = reshape_as_image(src.rea... | [
"0.62461895",
"0.62093973",
"0.61680365",
"0.6134627",
"0.6054998",
"0.59875107",
"0.5964318",
"0.5868772",
"0.5852784",
"0.57950795",
"0.57875484",
"0.5779638",
"0.576715",
"0.5753641",
"0.5728361",
"0.57266724",
"0.57217294",
"0.5679284",
"0.56631756",
"0.5645912",
"0.56333... | 0.6216535 | 1 |
Internal function, reads .chk_is file, extracts background calibration. | def _read_chk_is(self):
fname = os.path.splitext(self.filename)[0] + '.chk_is'
table = []
bg_before = []
bg_after = []
with open(fname, mode='rt') as fh:
for line in fh:
if line.startswith('FC Background before acq'):
bg_before = li... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_calibration_data(self):\n #Declare global variables.\n global calT1\n global calT2\n global calT3\n global calP1\n global calP2\n global calP3\n global calP4\n global calP5\n global calP6\n global calP7\n global calP8\n ... | [
"0.56478596",
"0.55802774",
"0.542935",
"0.5386057",
"0.5382122",
"0.5286587",
"0.51933795",
"0.51929796",
"0.5136395",
"0.5088418",
"0.5067865",
"0.50645894",
"0.50417954",
"0.5014326",
"0.50055486",
"0.5005512",
"0.49630728",
"0.49536607",
"0.49392435",
"0.4931138",
"0.4929... | 0.7982014 | 0 |
Internal function; read data in .bs beam stability file. | def _beamstability_data(self):
traces = unpack(self._bo + 'i', self.fh.read(4))[0]
x = []
data = []
maxpoints = 0
for _ in range(traces):
points = unpack(self._bo + 'i', self.fh.read(4))[0]
d = np.fromfile(self.fh, dtype=self._bo+'f8', count=2*points).resh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_bed_file(bed_file):\n print(\"Loading Bed file %s\" % bed_file)\n\n try:\n os.path.isfile(bed_file)\n except:\n FileNotFoundError\n bed_file_load = pybedtools.BedTool(bed_file).sort()\n return bed_file_load",
"def parse_beam(self):\n # AIPS FITS file; stored in the hi... | [
"0.5557442",
"0.5557168",
"0.55461687",
"0.5464128",
"0.54545546",
"0.54218113",
"0.5420415",
"0.5397793",
"0.53617966",
"0.53358483",
"0.5282153",
"0.5239658",
"0.52312976",
"0.51875347",
"0.51619405",
"0.5144712",
"0.5144712",
"0.5144712",
"0.5143893",
"0.5137624",
"0.51133... | 0.64199185 | 0 |
Internal function; cuts off bytes at first nullbyte, decodes bytes as latin1 string, returns string | def _cleanup_string(self, bytes):
try:
b = bytes.index(b'\x00')
except ValueError:
return bytes.decode('latin-1').strip()
else:
return bytes[:b].decode('latin-1').strip() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _as_bytes(s):\n if isinstance(s, bytes):\n return s\n # Assume it is a unicode string\n # Note ISO-8859-1 aka Latin-1 preserves first 256 chars\n return codecs.latin_1_encode(s)[0]",
"def _as_unicode(s):\n if isinstance(s, str):\n return s\n # Assume it is a bytes string\n ... | [
"0.6686752",
"0.630565",
"0.62807846",
"0.61300504",
"0.5987163",
"0.5986198",
"0.5982968",
"0.58899647",
"0.58807486",
"0.5878111",
"0.5768985",
"0.57272893",
"0.5689714",
"0.5689714",
"0.5672859",
"0.5670353",
"0.56358165",
"0.5626266",
"0.5562377",
"0.5544681",
"0.5535576"... | 0.7006598 | 0 |
Internal function. Reads and discards filler bytes, by default null (\\x00) and continue (\\xCC) bytes. Stops at start of first nonfiller byte. Reads chunk bytes at the time. | def _chomp(self, hdr, filler=(b'\x00\x00\x00\x00', b'\xCC\xCC\xCC\xCC'), chunk=4):
filler = tuple(filler)
bytes = hdr.read(chunk)
while(bytes and bytes in filler):
bytes = hdr.read(chunk)
hdr.seek(-1 * chunk, 1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _read_chunked(self):\r\n buf = \"\"\r\n size = 1\r\n while size:\r\n size = int(self._read_line(), 16)\r\n buf += self._read_num_bytes(size)\r\n self._read_num_bytes(2) # CRLF\r\n return buf",
"def skip(self):\r\n length = self.next_byte()\r... | [
"0.6053597",
"0.6052558",
"0.5874158",
"0.58329064",
"0.58284086",
"0.5771134",
"0.57389414",
"0.5656672",
"0.5602632",
"0.559781",
"0.54489756",
"0.5423433",
"0.53818965",
"0.5381836",
"0.53696436",
"0.5361858",
"0.53611284",
"0.5337939",
"0.5335115",
"0.53303003",
"0.531810... | 0.60821664 | 0 |
Function to efficiently aggregate messages for each node in graph, where there are possibly multiple messages per each target node. This is a utility function for implementations of GNN message passing. | def aggregate_messages(
messages: Tensor, # [num_messages, feature_dim]
message_targets: IntTensor, # [num_messages,]
num_nodes: int,
aggr: ScatterAggregation,
) -> Tensor: # [num_nodes, feature_dim]
msg_dtype = messages.dtype
return scatter(
messages.to(torch.float32),
index=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _aggregate_messages(\n self, messages: torch.Tensor, message_targets: torch.Tensor, num_nodes, aggregation_fn: str\n ):\n # Support AMP\n msg_dtype = messages.dtype\n return scatter(\n messages.to(torch.float32),\n index=message_targets,\n dim=0,\... | [
"0.7241586",
"0.65418226",
"0.6123842",
"0.59363586",
"0.5697992",
"0.5535959",
"0.54202497",
"0.537087",
"0.53061646",
"0.5261326",
"0.52610904",
"0.5260903",
"0.52011645",
"0.5192846",
"0.5178133",
"0.51587814",
"0.51336277",
"0.5112494",
"0.51045907",
"0.5100975",
"0.50970... | 0.7175127 | 1 |
Apply dropout to input and hidden tensors (`hx`), and pass them to the torch GRUCell. | def forward(
self,
input: Tensor, # [batch, input_size],
hx: Optional[Tensor] = None, # [batch, hidden_size]
) -> Tensor: # [batch, hidden_size]
if hx is None:
# Imitate behaviour of parent class: hx is assumed zero if not given.
hx = torch.zeros(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, x):\n x, self.hidden = self.gru(x, self.hidden)\n self.detach_hidden()\n x = self.dropout(x)\n x = self.out(x)\n return x",
"def xdropout(self, inputs):\n mask = tf.cast(\n 1\n - tf.compat.v1.distributions.Bernoulli(probs=1.0 - sel... | [
"0.63158464",
"0.61924565",
"0.61344814",
"0.6040275",
"0.59563404",
"0.59526837",
"0.5945194",
"0.589468",
"0.5870516",
"0.58595157",
"0.5839773",
"0.57184356",
"0.5685813",
"0.56556416",
"0.5635242",
"0.5629377",
"0.5625709",
"0.5618553",
"0.5608568",
"0.5607993",
"0.558091... | 0.68315345 | 0 |
Reset weights. Calls reset_parameters() of internal gnn blocks. | def reset_parameters(self) -> None:
for gnn_block in self.gnn_blocks:
gnn_block.reset_parameters() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset(self):\n ih = (param for name, param in self.named_parameters() if 'weight_ih' in name)\n hh = (param for name, param in self.named_parameters() if 'weight_hh' in name)\n b = (param for name, param in self.named_parameters() if 'bias' in name)\n for t in ih:\n torch... | [
"0.79932714",
"0.79035616",
"0.7834367",
"0.78313875",
"0.78313875",
"0.78313875",
"0.767987",
"0.7626979",
"0.76036555",
"0.75981075",
"0.75656754",
"0.7537917",
"0.7389454",
"0.73858106",
"0.73021424",
"0.72516924",
"0.7217353",
"0.7180251",
"0.7162394",
"0.71096396",
"0.70... | 0.80934423 | 0 |
Pass tensors through the gated MLP and aggregate results per graph in batch. | def forward(self, x: Tensor, graph_id: IntTensor,) -> Tensor:
values = self.gate(x) * self.mlp(x)
aggregated_values = self.pooling(values, batch=graph_id)
return aggregated_values | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process(self, sess):\n global send_counter\n \n #sess.run(self.sync) # copy weights from shared to local\n rollout = self.pull_batch_from_queue()\n batch = process_rollout(rollout, gamma=0.99, lambda_=1.0)\n\n should_compute_summary = self.task == 0 and self.local_ste... | [
"0.6211875",
"0.6151538",
"0.610468",
"0.60947186",
"0.59281915",
"0.58904624",
"0.5870712",
"0.5870712",
"0.5866208",
"0.5864979",
"0.58569485",
"0.5816808",
"0.5813107",
"0.5810335",
"0.5783212",
"0.572531",
"0.57049376",
"0.5696107",
"0.5656241",
"0.56464756",
"0.564645",
... | 0.6472639 | 0 |
Return a list of PIDs of all processes with the exact given name. | def get_pid(name: str) -> Set[int]:
process_pids = set()
for proc in psutil.process_iter():
if name == proc.name():
pid = proc.pid
process_pids.add(pid)
return process_pids | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_pids(name=None):\n results = []\n for process in win32com.client.GetObject('winmgmts:').InstancesOf('Win32_Process'):\n if name is None or process.Properties_(\"Name\").Value == name:\n results.append(process.Properties_(\"ProcessID\").Value)\n return results",
"def get_process... | [
"0.86876965",
"0.8130487",
"0.81158197",
"0.7994531",
"0.7505702",
"0.74132264",
"0.7358823",
"0.71109194",
"0.7047129",
"0.7007599",
"0.6951761",
"0.68290347",
"0.662532",
"0.6612348",
"0.66108376",
"0.6610585",
"0.656094",
"0.6514616",
"0.65063226",
"0.65048987",
"0.6396306... | 0.81838197 | 1 |
Fills a new instance of Document from result_dict values | def _create_document(result_dict):
document = Document(
name=result_dict['docname'],
original_id=result_dict['itemid'],
doctype=result_dict['doctype'],
language=result_dict['languageisocode'],
conclusion=result_dict['conclusion'],
originati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from_dict(new_info: dict):\n doc = Db2Document(mhr_number=new_info.get('mhrNumber'),\n document_type=new_info.get('documentType'),\n document_reg_id=new_info.get('documentRegistrationId'),\n interimed=new_info.get('interim... | [
"0.6431645",
"0.60881454",
"0.6047464",
"0.5946055",
"0.5795584",
"0.57508874",
"0.559095",
"0.559095",
"0.5563351",
"0.5520071",
"0.5506109",
"0.5494018",
"0.54919016",
"0.5481814",
"0.5478639",
"0.547054",
"0.5446041",
"0.5444935",
"0.54430723",
"0.5433615",
"0.5402362",
... | 0.6925021 | 0 |
As input, takes the plain text from a wikipedia article that we got from the Wikipedia API's extract field, which isn't quite plain text, and removes the remaining HTML tags. | def clean_plaintext_article(text, extract, end_indicators_file):
f = open(end_indicators_file, 'r')
lines = f.readlines()
edit = lines[0].strip()
for line in lines[1:]:
if line.split()[0] == 'exact':
text = re.sub([a.decode('utf-8') for a in line.split()][1] + r'.*', '', text, flags=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_wiki(raw, promote_remaining=True, simplify_links=True):\n # parsing of the wiki markup is not perfect, but sufficient for our purposes\n # contributions to improving this code are welcome :)\n text = to_unicode(raw, 'utf8', errors='ignore')\n text =decode_htmlentities(text) # '&nbsp;' -... | [
"0.70785666",
"0.6814593",
"0.6761327",
"0.6728122",
"0.6697248",
"0.6690004",
"0.66854423",
"0.6668842",
"0.66648316",
"0.6633084",
"0.6625655",
"0.6622855",
"0.657446",
"0.65701956",
"0.65586877",
"0.649775",
"0.6489087",
"0.64885706",
"0.6464117",
"0.6462337",
"0.64442384"... | 0.6991855 | 1 |
Take in a dataset directory src_dir, which should have subdirectories that represent categories, and files in those subdirectories that are plaintext wikipedia articles. Clean those wikipedia articles and put them in a new dataset directory called target_dir. | def make_clean_dataset_directory(src_dir, target_dir, end_indicators_file, consolidate_folders=True):
if not os.path.exists(target_dir):
os.makedirs(target_dir)
listing = os.listdir(src_dir)
for subdir in listing: # This could either be a category folder, or an individual file.
if os.path.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_files_from_dir(input_dir, output_dir):\n if not os.path.exists(output_dir):\n os.makedirs(output_dir) #Tạo thư mục\n input_files = os.listdir(input_dir) #trả về một danh sách chứa tên của các mục trong thư mục được cung cấp bởi đường dẫn. Danh sách theo thứ tự tùy ý. Nó không bao gồm các... | [
"0.6067923",
"0.5989471",
"0.5778318",
"0.56373096",
"0.56053823",
"0.5543957",
"0.54654044",
"0.5433345",
"0.53614277",
"0.5360227",
"0.53275084",
"0.53229684",
"0.5312409",
"0.5309615",
"0.5297832",
"0.5294819",
"0.52810127",
"0.5273178",
"0.5254635",
"0.5244912",
"0.522377... | 0.6953235 | 0 |
Creates new Shift Summaries from the summary page for a shift. If any old summaries exist for that shift they are deleted first. | def summary(request):
employee = request.user
try:
jsonData = json.loads(request.POST['jsonData'])
except Exception:
transaction.rollback()
return HttpResponseServerError("Error getting json data for shift summary")
try:
shift = Shift.objects.get(id=jsonData['shift_id'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def renderSummary(request, id):\n # employee = request.user\n try:\n shift = Shift.objects.get(id=id)\n shiftEmployee = shift.employee\n except Shift.DoesNotExist:\n return HttpResponseServerError('Shift does not exist for id %s' % str(id))\n\n owner = True\n if not request.user... | [
"0.60945135",
"0.53530335",
"0.5242784",
"0.51351255",
"0.49487114",
"0.49093837",
"0.4870971",
"0.48693582",
"0.47675723",
"0.47498357",
"0.47360638",
"0.46771362",
"0.46697927",
"0.46590078",
"0.4648301",
"0.46348074",
"0.46237573",
"0.46134755",
"0.46092758",
"0.45973882",
... | 0.7067428 | 0 |
' Renders the shift summary page. ' Makes sure to check if the shift for the given id has any ' past complete summaries and if so packages them up so the page can prefill using their data. ' | def renderSummary(request, id):
# employee = request.user
try:
shift = Shift.objects.get(id=id)
shiftEmployee = shift.employee
except Shift.DoesNotExist:
return HttpResponseServerError('Shift does not exist for id %s' % str(id))
owner = True
if not request.user.is_superuser ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summary(request):\n\n employee = request.user\n\n try:\n jsonData = json.loads(request.POST['jsonData'])\n except Exception:\n transaction.rollback()\n return HttpResponseServerError(\"Error getting json data for shift summary\")\n\n try:\n shift = Shift.objects.get(id=j... | [
"0.7063539",
"0.610309",
"0.601671",
"0.5919426",
"0.58649284",
"0.57904935",
"0.57591456",
"0.5634357",
"0.56085885",
"0.5563693",
"0.5556102",
"0.5552558",
"0.55480874",
"0.55379486",
"0.5533905",
"0.55061764",
"0.5490996",
"0.54038596",
"0.54034716",
"0.53655857",
"0.53415... | 0.8031955 | 0 |
' Utility method to round a number of seconds given. ' | def roundSeconds(seconds):
minutes = seconds / 60
remainder = seconds % 60
if(remainder >= 30):
minutes += 1
return minutes * 60 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def round_time(time):\n t_min = time.minute % 5\n t_sec = time.second\n t_mic = time.microsecond\n time = time - timedelta(minutes=t_min, seconds=t_sec, microseconds=t_mic)\n return time",
"def seconds_to_minutes(seconds: int, round: Optional[bool] = True) -> Union[int, float]:\n return int(sec... | [
"0.70922214",
"0.690971",
"0.6848357",
"0.67908466",
"0.6730991",
"0.6717476",
"0.66908914",
"0.6672902",
"0.664795",
"0.66186845",
"0.6597363",
"0.65158933",
"0.6506588",
"0.6506448",
"0.64764565",
"0.64697945",
"0.64634943",
"0.6400345",
"0.63910776",
"0.63588965",
"0.63536... | 0.76798344 | 0 |
Calculate the difference between the top two scores, or the difference between `score[zi]` and the top score if `zi` is provided and the top score is not `score[zi]`. | def _top2gap(
score: np.ndarray, zi: Optional[int] = None
) -> Tuple[np.ndarray, Optional[int]]:
sc_sort = np.sort(score)
if zi is None:
return (sc_sort[-1] - sc_sort[-2]), None
else:
sc_argsort = np.argsort(score)
if sc_argsort[-1] == zi:
return (sc_sort[-1] - sc_so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_p(zscore):\n for p, z in HANDY_Z_SCORE_CHEATSHEET:\n if zscore > z:\n break\n\n return (p, z)",
"def zscore(vals):",
"def update_zscore(stats_on_target, lastest_mustd):\n target_xss, target_xs, target_xct = stats_on_target\n xmu, xstd = lastest_mustd\n\n zss = (target_... | [
"0.63922083",
"0.5843415",
"0.56618506",
"0.5656263",
"0.560995",
"0.5562594",
"0.54961693",
"0.54869246",
"0.54641867",
"0.5443007",
"0.54417545",
"0.54293436",
"0.54293436",
"0.5423282",
"0.54230106",
"0.5389217",
"0.5386409",
"0.53851086",
"0.53793716",
"0.5376832",
"0.535... | 0.7453754 | 0 |
Calculate spectral mismatch between a test device and broadband reference device under specified solar spectral irradiance conditions. | def calc_spectral_mismatch_field(sr, e_sun, e_ref=None):
# Contributed by Anton Driesse (@adriesse), PV Performance Labs. Aug. 2022
# get the reference spectrum at wavelengths matching the measured spectra
if e_ref is None:
e_ref = get_am15g(wavelength=e_sun.T.index)
# interpolate the sr at th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_regression_determine_wavelength_solution(\n ad, params, caplog, change_working_dir, path_to_refs, request):\n caplog.set_level(logging.INFO, logger=\"geminidr\")\n\n with change_working_dir():\n logutils.config(file_name='log_regress_{:s}.txt'.format(ad.data_label()))\n p = GNIR... | [
"0.604893",
"0.6033039",
"0.60062414",
"0.5928658",
"0.59190756",
"0.5904265",
"0.5876055",
"0.58222663",
"0.5714382",
"0.5632911",
"0.5628808",
"0.5608495",
"0.5603212",
"0.55322564",
"0.55045724",
"0.55030805",
"0.5487496",
"0.5477556",
"0.5391897",
"0.5386815",
"0.53832394... | 0.66689473 | 0 |
Finds the script used to generate a file inside the file itself. The script is delimited by BEGINSCRIPT and ENDSCRIPT markers. | def find_script(file):
with open(file, 'r') as f:
content = f.read()
match = re.search(r'^BEGIN-SCRIPT$(.+)^END-SCRIPT$', content, flags=re.MULTILINE | re.DOTALL)
if not match:
raise RuntimeError("Was unable to find a script delimited with BEGIN-SCRIPT/END-SCRIPT markers in {}".format(test_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def locate_scripts():\n scripts = []\n bin_dir = os.path.join(os.getcwd(), 'bin')\n if not os.path.isdir(bin_dir):\n return scripts\n for item in os.listdir(bin_dir):\n full_path = os.path.join(bin_dir, item)\n if os.path.isfile(full_path):\n with open(full_path) as f:\n... | [
"0.6122574",
"0.61090255",
"0.5937082",
"0.58554554",
"0.56955844",
"0.5685164",
"0.56772226",
"0.5625765",
"0.5616509",
"0.56139773",
"0.5549608",
"0.5502706",
"0.5500484",
"0.544131",
"0.5414234",
"0.5391772",
"0.53889835",
"0.5358568",
"0.53528005",
"0.5326498",
"0.5246287... | 0.7724096 | 0 |
Generates the new content of the file by inserting the new content inbetween two '// GENERATEDMARKER' markers located in the file. | def generate_new_file(file, new_content):
with open(file, 'r') as f:
old_content = f.read()
try:
before, begin_marker, _, end_marker, after = re.split(r'(// GENERATED-MARKER\n)', old_content, flags=re.MULTILINE | re.DOTALL)
except ValueError:
raise RuntimeError("Failed to split {} b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decorate(self, content: StringList) -> None:\n super().decorate(content)\n for line in content[:20]:\n if line.startswith(TITLE_MARKER):\n title = line[len(TITLE_MARKER) :].strip()\n fence = \"=\" * len(title)\n content.insert(0, \"\", \"<ge... | [
"0.65119237",
"0.6067688",
"0.57665575",
"0.5726461",
"0.56776434",
"0.56165683",
"0.54802644",
"0.5454918",
"0.542743",
"0.5379646",
"0.5348984",
"0.534806",
"0.53045404",
"0.5290035",
"0.52649206",
"0.52472615",
"0.51925284",
"0.5130319",
"0.5127945",
"0.5125482",
"0.512298... | 0.84149283 | 0 |
Returns whether the given file is a header (i.e. not a directory or the modulemap file). | def is_header(file):
return not file.is_dir() and not file.name == 'module.modulemap.in' and file.name != 'libcxx.imp' | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_header(file_name):\n return str(file_name).endswith('.h')",
"def is_header(filename):\n header_extensions = {'h'}\n return os.path.splitext(filename)[1][1:] in header_extensions",
"def is_header(line):\n return line[0] == '>'",
"def _is_header(line):\n line = line.strip()\n i... | [
"0.87137336",
"0.8687271",
"0.7369525",
"0.72948503",
"0.6830301",
"0.65980905",
"0.6557658",
"0.6315039",
"0.6287697",
"0.6286363",
"0.62642336",
"0.6236005",
"0.62234765",
"0.62218875",
"0.6206959",
"0.6118588",
"0.6087388",
"0.60868716",
"0.60589707",
"0.6049242",
"0.60027... | 0.88265073 | 0 |
Changes directory to path. | def change_directory(path):
os.chdir(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ChangeDir(self, path: str) -> None:\n ...",
"def change_dir(path): \r\n os.chdir(path)",
"def changeDirectory( self, directory ):\n if directory[0] == '/':\n directory = directory.lstrip( '/' )\n self.cwd = '%s/%s' % ( self.cwd, directory )",
"def chdir(self, path):\n # temp... | [
"0.865226",
"0.84973204",
"0.7802195",
"0.7630714",
"0.75588304",
"0.7350675",
"0.7285465",
"0.7254859",
"0.7221519",
"0.7208849",
"0.7059509",
"0.70174396",
"0.69860536",
"0.69236386",
"0.6858423",
"0.6818829",
"0.6808604",
"0.6791804",
"0.67826647",
"0.6727871",
"0.6723542"... | 0.8586681 | 1 |
moves a file to dest_dir if it not already there | def move_file_to_dir(f, dest_dir):
ls = list_files(dest_dir)
if f not in ls:
shutil.move(f, dest_dir) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file(file, dest_path):\n if os.path.isdir(dest_path):\n shutil.move(file, dest_path)\n else:\n os.mkdir(dest_path)\n shutil.move(file, dest_path)",
"def copyfile(source, dest, newname=None):\n\n if not os.path.exists(source):\n #print 'no such file %s' %source\n ... | [
"0.72241163",
"0.71811706",
"0.71024615",
"0.7043271",
"0.6992353",
"0.6904317",
"0.6893632",
"0.68934584",
"0.68685323",
"0.68460876",
"0.67527044",
"0.6747862",
"0.66679794",
"0.6667955",
"0.6631026",
"0.6579253",
"0.65747",
"0.6554952",
"0.64573187",
"0.6434264",
"0.640577... | 0.7476682 | 0 |
Matches list of filenames for pattern defined by the regex and returns a list of those files | def recognize_files(list_of_filenames):
reg_exp = define_regex()
pattern = re.compile(reg_exp)
matched = []
for filename in list_of_filenames:
match = pattern.match(filename)
if match != None:
matched.append(filename)
return matched | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_file_list(work_dir, match_flag='*.*'):\n matches = []\n for root, dir, files in os.walk(work_dir):\n for items in fnmatch.filter(files, match_flag):\n matches.append(os.path.realpath(os.path.join(root, items)))\n\n return matches",
"def load_file_list(path=None, regx='\\.npz'):... | [
"0.7483796",
"0.74732363",
"0.7349342",
"0.7195525",
"0.71770495",
"0.7112973",
"0.70839906",
"0.70703053",
"0.7038981",
"0.70263165",
"0.70192766",
"0.6949542",
"0.6937594",
"0.693144",
"0.69030184",
"0.6834065",
"0.68313664",
"0.6821843",
"0.68181187",
"0.67769265",
"0.6774... | 0.83355945 | 0 |
Iterates through module type dictionary and specifies destination in college_dir in accordance to filename, if file is of a certain type, it is moved to destination, otherwise a symbolic link is made. | def sort_to_dest_dir(subject_type_dict,
catalog,
dest_dir=college_dir,
sym_link_check=nonlinkables,
michaelmas=michaelmas):
for code_type, files in subject_type_dict.items():
if code_type[0] in michaelmas:
dest... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpsym(src,dest):\n \n src = os.path.normpath(src)\n dest = os.path.normpath(dest)\n \n if not os.path.exists(src):\n return\n \n for dirpath,dirnames,filenames in os.walk(src):\n rel_dirpath = os.path.relpath(dirpath,src)\n dest_dirpath = os.path.join(dest,rel_dirpath)... | [
"0.53171545",
"0.5308555",
"0.516431",
"0.5151397",
"0.5129446",
"0.50636697",
"0.501714",
"0.49252018",
"0.48800334",
"0.48592624",
"0.4837829",
"0.48308873",
"0.47973913",
"0.47928435",
"0.4743364",
"0.47279918",
"0.46998546",
"0.46927008",
"0.4691658",
"0.46829045",
"0.462... | 0.67853266 | 0 |
Deep updates a config dict | def _deep_update_config(config, updates):
for key, value in updates.iteritems():
if isinstance(value, collections.Mapping):
config[key] = DexNet._deep_update_config(config.get(key, {}), value)
else:
config[key] = value
return config | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_config(self, update_dict):\n self.config = recursive_merge_dicts(self.config, update_dict)",
"def update_config(update):\n global _config\n new_config = copy.deepcopy(_config)\n _update_dict_recursive(new_config, update)\n logging.config.dictConfig(new_config)\n _configure_ulog_b... | [
"0.78453773",
"0.737817",
"0.73139685",
"0.7233828",
"0.711216",
"0.7014875",
"0.69151133",
"0.6882702",
"0.6860326",
"0.67890126",
"0.6769157",
"0.6727332",
"0.6577657",
"0.6511278",
"0.6510388",
"0.6502589",
"0.64962274",
"0.64731896",
"0.6425274",
"0.639042",
"0.6382424",
... | 0.8231411 | 0 |
Gets a copy of the default config dict with updates from the dict passed in applied | def _get_config(self, updates=None):
updated_cfg = copy.deepcopy(self.default_config.config)
if updates is not None:
DexNet._deep_update_config(updated_cfg, updates)
return updated_cfg | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify(self, **kwargs):\n config = self.defaults\n config.update(kwargs)\n return config",
"def spread_default_parameters(config, dev_cfg):\n def_cfg = config.get('DEFAULT')\n if def_cfg is None:\n return\n\n for (key, value) in def_cfg.items():\n if key not in dev... | [
"0.66045934",
"0.65640193",
"0.6530686",
"0.65138066",
"0.6472541",
"0.6466448",
"0.64058596",
"0.62974423",
"0.62935466",
"0.6254661",
"0.6220744",
"0.61982995",
"0.6168102",
"0.6164005",
"0.61444426",
"0.61388135",
"0.6138066",
"0.6106078",
"0.6105743",
"0.6105743",
"0.6101... | 0.7491972 | 0 |
Checks that database and dataset are open | def _check_opens(self):
if self.database is None:
raise RuntimeError('You must open a database first')
if self.dataset is None:
raise RuntimeError('You must open a dataset first') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_open_database(self):\n self.assertTrue(self.ss.open_database(self.test_database))\n self.assertEqual(self.ss.data_file(), self.test_database)\n self.assertTrue(os.path.exists(self.test_database))\n # database should be created if it doesn't exist\n self.assertTrue(self.s... | [
"0.6989263",
"0.69476736",
"0.67434",
"0.673275",
"0.6731678",
"0.652236",
"0.6463907",
"0.645221",
"0.6413646",
"0.63840127",
"0.631674",
"0.62967557",
"0.6279991",
"0.6266836",
"0.62586695",
"0.62319565",
"0.6228047",
"0.622733",
"0.6224471",
"0.6202433",
"0.6201982",
"0.... | 0.8080723 | 0 |
Attach default metadata to dataset. Currently only watertightness and number of connected components, and only watertightness has an attached function. | def _attach_metadata(self):
self.dataset.create_metadata("watertightness", "float", "1.0 if the mesh is watertight, 0.0 if it is not")
self.dataset.attach_metadata_func("watertightness", DexNet.is_watertight, overwrite=False, store_func=True)
self.dataset.create_metadata("num_con_comps", "float"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dataset_meta(self, dataset_meta: dict) -> None:\n self._dataset_meta = dataset_meta",
"def getDefaultData(dmd):",
"def inherit_metadata(descriptor, inherited_data):\r\n try:\r\n descriptor.xblock_kvs.inherited_settings = inherited_data\r\n except AttributeError: # the kvs doesn't have ... | [
"0.57966596",
"0.56133807",
"0.55747366",
"0.5541001",
"0.5522369",
"0.5514343",
"0.54954845",
"0.5444362",
"0.5413577",
"0.5362053",
"0.5340813",
"0.53403723",
"0.5321377",
"0.5293422",
"0.526995",
"0.52662474",
"0.5262187",
"0.5191958",
"0.51858234",
"0.51440084",
"0.512312... | 0.80177647 | 0 |
Return additional raw header cards to be propagated in downstream output files for configuration identification. The list of raw data FITS keywords should be those used to populate | def raw_header_cards(self):
return ['GRISM', 'MASKNAME', 'CCDSUM', 'obsmode'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_header_cards(self):\n return ['FIL1NAME', 'ECHANGL', 'XDANGL']",
"def get_primary_header(input_lst):\n lst = [\n # 12345678 12345678901234567890123456789012345678901234567\n ('SIMPLE' , 'file does conform to FITS standard' ),\n ('BITPIX' , 'number of bits p... | [
"0.7298435",
"0.6438025",
"0.6344194",
"0.61433077",
"0.60577613",
"0.5890611",
"0.58482563",
"0.5806897",
"0.57907546",
"0.57637787",
"0.5717691",
"0.5714998",
"0.565625",
"0.5656105",
"0.56480694",
"0.56447107",
"0.5605394",
"0.56041914",
"0.559683",
"0.5591537",
"0.5556682... | 0.73810166 | 1 |
Define frame types that are independent of the fully defined instrument configuration. Bias and dark frames are considered independent of a configuration. Standards are assigned to the correct configuration frame group by grism (i.e. ignoring that they are taken with a wider slit). | def config_independent_frames(self):
return {'standard': 'dispname', 'bias': None, 'dark': None} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_independent_frames(self):\n return {'standard': 'dispname','bias': None, 'dark': None}",
"def make_dark_frame(cfg_name, nframes_use=100, nbytes_header=8192, pixel_type=np.uint16, quiet=False, output_name=None):\n \n cfg = config.open(cfg_name)[0] # only first block...\n raw_cfg = [g fo... | [
"0.6436197",
"0.602926",
"0.52859503",
"0.5174622",
"0.5174019",
"0.5142752",
"0.50734013",
"0.50670743",
"0.5039474",
"0.49890667",
"0.49828172",
"0.49552318",
"0.49515548",
"0.49361637",
"0.49354115",
"0.4934211",
"0.4933904",
"0.49242225",
"0.49242225",
"0.4919626",
"0.491... | 0.63963085 | 1 |
Generate a default badpixel mask. Even though they are both optional, either the precise shape for the image (``shape``) or an example file that can be read to get | def bpm(self, filename, det, shape=None, msbias=None):
# Call the base-class method to generate the empty bpm; msbias is always set to None.
bpm_img = super().bpm(filename, det, shape=shape, msbias=None)
# Extract some header info
head0 = fits.getheader(filename, ext=0)
binning ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bad_pixel_mask(self):\n from mkidpipeline.pipeline import PROBLEM_FLAGS # This must be here to prevent a circular import!\n return self.flagged(PROBLEM_FLAGS)",
"def create_bad_pixel_mask(\n data: np.ndarray,\n grow: bool = False,\n iterations: int = 1,\n diagonal: bool = False,\n)... | [
"0.6372443",
"0.5823011",
"0.57337403",
"0.57052255",
"0.5597698",
"0.55941164",
"0.5584776",
"0.55441254",
"0.553597",
"0.55120516",
"0.5468373",
"0.53831416",
"0.53492963",
"0.52954996",
"0.52931976",
"0.5266981",
"0.5262085",
"0.5259913",
"0.5248393",
"0.52436393",
"0.5241... | 0.59745693 | 1 |
Return additional raw header cards to be propagated in downstream output files for configuration identification. The list of raw data FITS keywords should be those used to populate | def raw_header_cards(self):
return ['GRISM', 'MASKNAME', 'CCDSUM', 'obsmode'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_header_cards(self):\n return ['FIL1NAME', 'ECHANGL', 'XDANGL']",
"def get_primary_header(input_lst):\n lst = [\n # 12345678 12345678901234567890123456789012345678901234567\n ('SIMPLE' , 'file does conform to FITS standard' ),\n ('BITPIX' , 'number of bits p... | [
"0.7298435",
"0.6438025",
"0.6344194",
"0.61433077",
"0.60577613",
"0.5890611",
"0.58482563",
"0.5806897",
"0.57907546",
"0.57637787",
"0.5717691",
"0.5714998",
"0.565625",
"0.5656105",
"0.56480694",
"0.56447107",
"0.5605394",
"0.56041914",
"0.559683",
"0.5591537",
"0.5556682... | 0.73810166 | 0 |
Define frame types that are independent of the fully defined instrument configuration. Bias and dark frames are considered independent of a configuration. Standards are assigned to the correct configuration frame group by grism (i.e. ignoring that they are taken with a wider slit). | def config_independent_frames(self):
return {'standard': 'dispname','bias': None, 'dark': None} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config_independent_frames(self):\n return {'standard': 'dispname', 'bias': None, 'dark': None}",
"def make_dark_frame(cfg_name, nframes_use=100, nbytes_header=8192, pixel_type=np.uint16, quiet=False, output_name=None):\n \n cfg = config.open(cfg_name)[0] # only first block...\n raw_cfg = [g f... | [
"0.63963085",
"0.602926",
"0.52859503",
"0.5174622",
"0.5174019",
"0.5142752",
"0.50734013",
"0.50670743",
"0.5039474",
"0.49890667",
"0.49828172",
"0.49552318",
"0.49515548",
"0.49361637",
"0.49354115",
"0.4934211",
"0.4933904",
"0.49242225",
"0.49242225",
"0.4919626",
"0.49... | 0.6436197 | 0 |
[ask ob ] is for adding links which ask Irving Q. Tep about ob, where the optional text is the text of the link. | def _str_eval_ob(eval, act, ctxt, *obs) :
if len(obs) == 1 :
topic = obs[0]
text = obs[0]
else :
topic = obs[0]
text = obs[1]
return [make_action_link(text[0], "ask Irving Q. Tep about "+topic[0])] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def question(self, ctx, *, args=None):\n if not args:\n msg = f\"Type `;q <question text>` to make a question, or do `;help q`. For now, here's the questions list:\"\n await hf.safe_send(ctx, msg)\n await ctx.invoke(self.question_list)\n return\n args... | [
"0.5973302",
"0.5648272",
"0.5635386",
"0.53594154",
"0.5195056",
"0.5194249",
"0.51392394",
"0.5078398",
"0.50397134",
"0.5033191",
"0.5029654",
"0.50069314",
"0.49897385",
"0.49775213",
"0.49744242",
"0.4973713",
"0.49731743",
"0.4942121",
"0.49411282",
"0.49291396",
"0.490... | 0.57172334 | 1 |
Irving Q. Tep knows about various abstract ideas ("lore") and can talk about them. But, if he doesn't know about a topic, it's assumed that the player is asking about an object in the room, and we turn it into an Examining action. Otherwise, if there's no relevant object, Irving 'has nothing to say about that.' | def asking_irving(actor, y, ctxt) :
# current words have already been init'd since we're parsing
res = ctxt.parser.run_parser("somelore",
ctxt.parser.transform_text_to_words(y),
ctxt)
if len(res) == 1 :
desc = ctxt.world[Description(r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storytelling(state_object, nlg_object, classifier):\n # create arguments for the depth_first_Search\n visited = state_object.story_told\n story_graph = state_object.story_graph\n first_node = state_object.current_node\n is_ended = state_object.is_story_ended\n nodes_to_visit = state_object.no... | [
"0.6049415",
"0.59092253",
"0.5795633",
"0.5695042",
"0.569139",
"0.56818384",
"0.56072193",
"0.55658525",
"0.55487674",
"0.553238",
"0.5517598",
"0.55139285",
"0.54622877",
"0.5442091",
"0.54213697",
"0.54147464",
"0.5399941",
"0.535964",
"0.5334716",
"0.5333151",
"0.5331945... | 0.68112075 | 0 |
Get the arguments of the predicate. | def get_arguments_of_predicate(prop, predicate):
mat = [line.strip().split() for line in prop]
nr_rows, nr_columns = len(mat), len(mat[0])
for row in mat:
assert len(row) == nr_columns, "nr columns not equals"
for i in range(1, nr_columns):
start, end = None, None
for j in range... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowedArgs(self, predicate, msg=None):\n return allowed_args(predicate, msg)",
"def get_args(self):\r\n return self.args",
"def args(self):\n return self._args",
"def args(self):\n return self._args",
"def args(self):\n return self._args",
"def get_args( self, **kw... | [
"0.68683237",
"0.6809196",
"0.6770168",
"0.6770168",
"0.6770168",
"0.66910076",
"0.66531014",
"0.66503555",
"0.6604175",
"0.6575009",
"0.65468895",
"0.64946496",
"0.64601195",
"0.6455223",
"0.6430887",
"0.63970715",
"0.63916",
"0.63902396",
"0.6358533",
"0.62946916",
"0.62762... | 0.6947117 | 0 |
Gets the english_speaking of this BrandedFoodObjectCountryDetails. | def english_speaking(self) -> int:
return self._english_speaking | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_country(self):\n return self.reference[REF_COUNTRY][REF_VALUE]",
"def country(self):\n # type: () -> string_types\n return self._country",
"def get_full_language(self, language):\n if language:\n language = pycountry.languages.get(alpha_2=language)\n if... | [
"0.58155745",
"0.58037347",
"0.5783395",
"0.57351726",
"0.5729102",
"0.5729102",
"0.57215744",
"0.57215744",
"0.5577192",
"0.5557138",
"0.5488023",
"0.5475891",
"0.542672",
"0.5417674",
"0.5406375",
"0.5399636",
"0.5384113",
"0.5354075",
"0.53539574",
"0.5328435",
"0.5283759"... | 0.6648567 | 0 |
Sets the english_speaking of this BrandedFoodObjectCountryDetails. | def english_speaking(self, english_speaking: int):
self._english_speaking = english_speaking | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_english_speaking(self, non_english_speaking: int):\n\n self._non_english_speaking = non_english_speaking",
"def english_speaking(self) -> int:\n return self._english_speaking",
"def SetLanguage(self, language):\n try:\n newDict = guicmd.CommandInterface.MessageHandler.Ge... | [
"0.60021",
"0.5447365",
"0.52655524",
"0.5211105",
"0.51930285",
"0.51830804",
"0.51830804",
"0.51830804",
"0.51830804",
"0.51830804",
"0.5178265",
"0.51712817",
"0.5134353",
"0.5134353",
"0.5134353",
"0.5134353",
"0.5134353",
"0.51202106",
"0.49868217",
"0.49633968",
"0.4852... | 0.77188426 | 0 |
Gets the non_english_speaking of this BrandedFoodObjectCountryDetails. | def non_english_speaking(self) -> int:
return self._non_english_speaking | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_english_speaking(self, non_english_speaking: int):\n\n self._non_english_speaking = non_english_speaking",
"def nalichtingstijd(self):\n return self._nalichtingstijd.get_waarde()",
"def getNotHidden(self):\n return self.abudance_df[self.abundance_df['masked']==False]",
"def count... | [
"0.61189985",
"0.56761485",
"0.5567008",
"0.5242359",
"0.5242359",
"0.5203683",
"0.52000546",
"0.5163075",
"0.5163075",
"0.5095839",
"0.5061663",
"0.5061663",
"0.5057166",
"0.5053875",
"0.50499964",
"0.5040644",
"0.5005168",
"0.49840304",
"0.49795237",
"0.49520838",
"0.493385... | 0.6000392 | 1 |
Sets the non_english_speaking of this BrandedFoodObjectCountryDetails. | def non_english_speaking(self, non_english_speaking: int):
self._non_english_speaking = non_english_speaking | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def non_english_speaking(self) -> int:\n return self._non_english_speaking",
"def set_as_not_feedback(self):\n self.feedback = False",
"def disableVocolaTakesLanguages(self):\n key = \"VocolaTakesLanguages\"\n self.userregnl.set(key, 0)",
"def __init__(self, english_speaking: int=... | [
"0.52364606",
"0.52303463",
"0.522108",
"0.5217315",
"0.5214619",
"0.5182632",
"0.51249015",
"0.5087386",
"0.5066",
"0.50034666",
"0.4968789",
"0.4954232",
"0.49344936",
"0.49313223",
"0.49189222",
"0.49162045",
"0.48993996",
"0.48977357",
"0.48833433",
"0.4876455",
"0.483357... | 0.79648656 | 0 |
Initialize a PlotFunctionMonitor. Args | def __init__(self, plot_function, interactive=True):
global plt
try:
import matplotlib.pyplot as plt
except ImportError:
raise DependencyError(
'matplotlib must be installed to use PlotFunctionMonitor')
if interactive:
plt.ion()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _plot_init(self):\n pass",
"def _plot_init(self):\n pass",
"def __init__(self, *args, **kwargs):\n figtitle = kwargs.pop('figtitle', 'hi mom')\n Figure.__init__(self, *args, **kwargs)\n self.text(0.5, 0.95, figtitle, ha='center')\n self.history_pwm = np.zeros(100, ... | [
"0.6238517",
"0.6238517",
"0.6128511",
"0.60675013",
"0.60661936",
"0.6047811",
"0.6018118",
"0.5922721",
"0.58449054",
"0.5816608",
"0.5810132",
"0.5797345",
"0.5789915",
"0.5780012",
"0.5760865",
"0.57409364",
"0.571328",
"0.5707119",
"0.57063013",
"0.5704931",
"0.56921357"... | 0.7445095 | 0 |
Checks if the pointing and obsid have already been sucessfully searched (end time not none) | def database_search_done_check(obsid, pointing):
con = lite.connect(DB_FILE, timeout = TIMEOUT)
con.row_factory = lite.Row
with con:
cur = con.cursor()
#get script data
cur.execute("SELECT Ended FROM PulsarSearch WHERE Obsid=? AND Pointing=?",
(obsid, pointing))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ahead(self, obs, object):\n if(obs[self.listOfObjects.index(object)][int((self.no_rays-1)/2)] > 0):\n # print(\"found \" + str(object) + \" ahead\")\n return True\n return False",
"def done(self):\n # Only recheck if we found new paths\n if len(self.found) > ... | [
"0.55949336",
"0.5518937",
"0.5482843",
"0.5470889",
"0.542543",
"0.5391898",
"0.5326071",
"0.5301733",
"0.5301733",
"0.5301733",
"0.5301733",
"0.5301733",
"0.5301733",
"0.52952164",
"0.52853334",
"0.5270001",
"0.5265665",
"0.52653676",
"0.5246731",
"0.52194744",
"0.5202081",... | 0.6829871 | 0 |
Takes a csv from short period jobs and makes a large amount of updates | def database_mass_update(table,file_location):
with open(file_location,'r') as csv:
con = lite.connect(DB_FILE, timeout = TIMEOUT)
con.row_factory = lite.Row
with con:
cur = con.cursor()
lines = csv.readlines()
for l in lines:
l = l.split('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(self):\n\t\tself._data_updater_thread.start()\n\t\tf = open('output.csv', 'w') #TODO: handle output file correctly (cfg)\n\t\tf.write('(datetime;valve;thin_temp;thin_pres;out_temp)\\n')\n\t\tf.close()",
"def subprocess_to_update_models_from_csv():\r\n subprocess.call('python manage.py jobs', shell=Tru... | [
"0.63816714",
"0.631855",
"0.63122123",
"0.6221913",
"0.6090901",
"0.60301507",
"0.60152763",
"0.599658",
"0.5957087",
"0.5875272",
"0.58747673",
"0.5844321",
"0.5832309",
"0.5798371",
"0.57775307",
"0.57692266",
"0.5762977",
"0.5754372",
"0.5749664",
"0.56881356",
"0.5673160... | 0.7189886 | 0 |
Sort the result items contained into a list according to the specified sorting algorithm. | def sort_results(results_list, sorting_type):
if sorting_type == "Oldest":
return sort_results_by_date(results_list, False)
elif sorting_type == "Description A-Z":
return sort_results_alphabetically_on_description(results_list, False)
elif sorting_type == "Description Z-A":
return so... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_results(self):\n pass",
"def sortby(self):\n ...",
"def _sort_results(self, results: dict) -> List:\n return [results[url][\"display_name\"] for url in self.urls_list]",
"def sort_list():\n fun_list = basic_list_exception.make_list()\n fun_list.sort()\n return fun_list"... | [
"0.71125716",
"0.64095515",
"0.63753414",
"0.6271698",
"0.6268344",
"0.6254953",
"0.61314386",
"0.6110776",
"0.6102035",
"0.60722196",
"0.6012448",
"0.59810483",
"0.5974013",
"0.59697866",
"0.59281945",
"0.5906039",
"0.5879894",
"0.5851269",
"0.58423483",
"0.5835044",
"0.5830... | 0.6605192 | 1 |
Find (idx, word) tuple out of the field list that is the best candidate for RxBin. | def get_candidate(field_list, group):
o = min(enumerate(field_list), key=lambda x: get_distance_to_group(x[1], group))
# print("o: {}, distance: {}".format(o, get_distance_to_group(o[1], group)))
return o | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_best_shifts(wordlist, text):\n start = 0 # default\n # start = int(raw_input(\"Please input the starting position: \"))\n tuple_of_best_shifts = find_best_shifts_rec(wordlist, text, start)\n return tuple_of_best_shifts",
"def iter_from(self, fieldname, text):\n\t\tfields = 'fieldname', 'text... | [
"0.5626833",
"0.53581",
"0.534901",
"0.5278814",
"0.52705646",
"0.522147",
"0.5195941",
"0.5146434",
"0.5129529",
"0.5125923",
"0.51002",
"0.509962",
"0.50994325",
"0.50863063",
"0.5080628",
"0.5076823",
"0.50607723",
"0.5037602",
"0.5034198",
"0.5027689",
"0.50255024",
"0.... | 0.540043 | 1 |
sub(att1=value1, [att2=value2 [,...]]) Filters the collection according to given criteria. | def sub0(self, *args, **kwargs):
# Resultant collection initialization
coll = CollectionIp()
coll = self
for key, value in kwargs.iteritems():
coll = coll._with_attr(key, value)
for value in args:
# filter usign lambda function
f ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __sub__(self, other, **kwargs):\n kwargs.update({'sub': True})\n return self.__add__(other, **kwargs)",
"def filter_collection(collection, filter_tuples):\n\n for filter_tuple in filter_tuples:\n collection = collection[collection[filter_tuple[0]] == filter_tuple[1]]\n\n return col... | [
"0.5476869",
"0.54086787",
"0.5408645",
"0.5402196",
"0.53057534",
"0.5256865",
"0.521645",
"0.52059007",
"0.5185663",
"0.5145515",
"0.5080537",
"0.5074693",
"0.5034287",
"0.5034287",
"0.5024656",
"0.50107074",
"0.49985582",
"0.4992878",
"0.49790773",
"0.49588597",
"0.4945494... | 0.5745952 | 0 |
Tests the insertion of a `UserSearch` record via the `iodi_user_search` method of the `DalApp` class and its retrieval via the `get` method. | def test_iodi_get_user_search(self):
# IODI a new `User` record.
user_id = self.dal.iodi_user(
auth0_user_id="auth0|12345678",
email="fake@email.com",
)
# IODI a new `Search` record.
search_id = self.dal.iodu_search(
search_uuid=uuid.uuid4(),... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_12_admin_user_search(self):\r\n # Create two users\r\n self.register()\r\n self.signout()\r\n self.register(fullname=\"Juan Jose\", name=\"juan\",\r\n email=\"juan@juan.com\", password=\"juan\")\r\n self.signout()\r\n # Signin with admin user\... | [
"0.6590315",
"0.64303845",
"0.6159009",
"0.6149332",
"0.6143708",
"0.6000574",
"0.5992394",
"0.59906244",
"0.59896433",
"0.58072",
"0.5794122",
"0.57607776",
"0.5738417",
"0.5729294",
"0.5728218",
"0.5726708",
"0.57107645",
"0.57107645",
"0.57107645",
"0.5696381",
"0.5653131"... | 0.812942 | 0 |
Checkout a ref into the local workspace | def checkout(self, ref, name, track=None):
if name not in self._repo.heads:
self._repo.create_head(name, ref)
else:
self._repo.heads[name].set_commit(ref)
self._repo.heads[name].checkout()
self._repo.head.reset(index=True, working_tree=True)
if track:
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkout_ref(self, commit_id):\n pass",
"def checkout(self, reference):\n\n # Use the reference object directly if it was given\n if isinstance(reference, git.Reference):\n self.obj.head.reference = reference\n\n # If the reference is a known reference, use it\n ... | [
"0.7316755",
"0.66456574",
"0.65174925",
"0.62285864",
"0.61848253",
"0.6139733",
"0.6052548",
"0.60459757",
"0.6006776",
"0.60051256",
"0.59577316",
"0.5908256",
"0.5897842",
"0.5884688",
"0.58289444",
"0.5828324",
"0.5823936",
"0.5820487",
"0.5819222",
"0.5817168",
"0.58089... | 0.7105071 | 1 |
Permissive factory function for vertical separation. | def vertical(first=0, second=None):
if not first and second is None:
return Vertical(0, 0, '', '')
elif isinstance(first, tuple) and second is None:
return Vertical(*first)
if isinstance(first, Vertical):
return first
before = first
after = second if second is not None else f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vertical_char(self):\n ...",
"def stokes_vertical():\n return np.array([1, -1, 0, 0])",
"def fix_vertical(lines):\n\ttag = lambda pred, seq : zip(map(pred, seq), seq)\n\tflatten = it.chain.from_iterable\n\tflatmap = lambda func, seq : flatten(map(func, seq))\n\tlistmap = lambda func, seq : list(m... | [
"0.5739937",
"0.5672949",
"0.5662919",
"0.5527471",
"0.54248136",
"0.53499305",
"0.53448135",
"0.5344366",
"0.53243625",
"0.5322071",
"0.52770567",
"0.5271796",
"0.524553",
"0.524236",
"0.52368134",
"0.521864",
"0.5113471",
"0.5109824",
"0.50739723",
"0.5059686",
"0.5048537",... | 0.6203215 | 0 |
Monitors the current process id (of the loader to see if it is still running) and prints a message if it has exceeded the time limit. | def checkProcess(process_id, time_limit):
# set an arbitrary time limit
t_end = time.time() + 60 * time_limit
while time.time() < t_end:
if not is_process_running(process_id):
print("process {0} terminated".format(process_id))
return
# could be an external integration (s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timer_ffmpeg_process_timeout():\n try:\n if not self.ffmpeg_process_ps.is_alive():\n timer_ffmpeg_process.stop()\n self.w.hide()\n del (self.w)\n self.ffmpeg_process_ps = None\n except:\n ... | [
"0.58479047",
"0.580366",
"0.5775342",
"0.5691083",
"0.56807524",
"0.55688006",
"0.5544538",
"0.5527161",
"0.55261874",
"0.54790705",
"0.54667896",
"0.54511505",
"0.54424274",
"0.5419122",
"0.5398315",
"0.53770185",
"0.5362271",
"0.5350026",
"0.53414977",
"0.5333275",
"0.5322... | 0.65521353 | 0 |
Split an author string into first and last names. Middle names, initials etc go in the first name. | def split_author(author: str) -> Tuple[str, str]:
author = author.split(' ')
if len(author) == 1:
author_first, author_last = None, author[0]
else:
# If len is more than 2, it may be initials or a middle name; group these
# into the first name.
*author_first, author_last = au... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def author_name(text):\n tag = text.split()\n\n \"\"\"\n We take the beginning of the text since the\n author name will likely be there\n \"\"\"\n\n tag = tag[:100]\n author = []\n\n current_tag = 0\n \"\"\"\n We go through each word until we find the first instance\n of the word '... | [
"0.76574874",
"0.7587668",
"0.71249336",
"0.6648968",
"0.6631959",
"0.65986985",
"0.65779316",
"0.6495744",
"0.64773184",
"0.64668727",
"0.641826",
"0.6400414",
"0.63956684",
"0.6359609",
"0.6341643",
"0.63243777",
"0.6291852",
"0.6288259",
"0.62437123",
"0.6229899",
"0.62250... | 0.8320897 | 0 |
The ascii character set we use to replace pixels. It pulls the corresponding font from the fontstyle This takes an image and goes through and replaces it with characters from a font | def img_to_ascii(**kwargs):
ascii_chars = [ 'b', 'd', 'f', 'r', 'K', 'R', 'A', 'F', 'D', 'L', 'B']
path = kwargs.get('path')
font=kwargs.get('font')
fontsize=kwargs.get('fontsize')
output = kwargs.get('output')
# width = kwargs.get('width',100)
im = Image.open(path)
# comment... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, font, color=(255,255,255,255)):\r\n if not font.endswith('.png'):\r\n font += '.png'\r\n super(Pngfont, self).__init__(\"fonts/%s\" % font)\r\n self.font = font\r\n pixels = self.im.load()\r\n\r\n self.glyph_table = {}\r\n # Extract font information from top scanline of fo... | [
"0.6658551",
"0.6353635",
"0.62175673",
"0.6128984",
"0.61211723",
"0.5933718",
"0.591103",
"0.59008235",
"0.58701676",
"0.5858819",
"0.58584905",
"0.5832673",
"0.58267003",
"0.58134127",
"0.57149184",
"0.5665009",
"0.56607306",
"0.56596345",
"0.5647601",
"0.5644729",
"0.5631... | 0.6404019 | 1 |
Function for wrapping longitude to 0 to 360 degrees. | def wrapTo360(lon):
positiveInput = (lon > 0)
lon = np.mod(lon, 360)
lon[(lon == 0) & positiveInput] = 360
return lon | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wrapTo180(lon):\r\n q = (lon < -180) | (180 < lon)\r\n lon[q] = wrapTo360(lon[q] + 180) - 180\r\n return lon",
"def lon360to180(lon):\n\tlon = np.asanyarray(lon)\n\treturn ((lon + 180.) % 360.) - 180.",
"def lng180(lng):\n newlng = float(lng)\n if lng <= -180:\n return lng + 360\n ... | [
"0.8301204",
"0.75152874",
"0.7219929",
"0.7181611",
"0.7099215",
"0.6814086",
"0.6743539",
"0.67144316",
"0.66161627",
"0.6604971",
"0.65650296",
"0.6547305",
"0.6390702",
"0.63811195",
"0.63612247",
"0.6308074",
"0.6224767",
"0.61923146",
"0.6145859",
"0.61117107",
"0.60271... | 0.8401134 | 0 |
Function for wrapping longitude to 180 to 180 degrees. | def wrapTo180(lon):
q = (lon < -180) | (180 < lon)
lon[q] = wrapTo360(lon[q] + 180) - 180
return lon | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lon360to180(lon):\n\tlon = np.asanyarray(lon)\n\treturn ((lon + 180.) % 360.) - 180.",
"def lng180(lng):\n newlng = float(lng)\n if lng <= -180:\n return lng + 360\n if newlng > 180:\n return lng - 360\n return lng",
"def wrapTo360(lon):\r\n positiveInput = (lon > 0)\r\n lon... | [
"0.7541969",
"0.74883854",
"0.7356085",
"0.7216587",
"0.7094588",
"0.69376314",
"0.66976994",
"0.66339785",
"0.6589044",
"0.65758675",
"0.6519436",
"0.64660186",
"0.6390516",
"0.6339829",
"0.63308555",
"0.62105495",
"0.6195576",
"0.61805975",
"0.6138271",
"0.59961796",
"0.586... | 0.8467488 | 0 |
Determines ascending and descending tracks. Defines unique tracks as segments with time breaks > tmax, and tests whether lat increases or decreases w/time. | def track_type(time, lat, tmax=1):
# Generate track segment
tracks = np.zeros(lat.shape)
# Set values for segment
tracks[0:np.argmax(np.abs(lat))] = 1
# Output index array
i_asc = np.zeros(tracks.shape, dtype=bool)
# Loop trough individual tracks
for track... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tracks(self, min_interval=30, max_interval=2700, min_length=0.1):\n # Our waypoints for this jaunt\n waypoints = self.waypoints.all().order_by('gmtime')\n\n # Set up accumulating variables\n previous = False\n length = 0\n track_count = 1\n # Set the firs... | [
"0.5817621",
"0.5614338",
"0.54986846",
"0.54717886",
"0.539285",
"0.5380559",
"0.53706264",
"0.5303629",
"0.52503794",
"0.5233567",
"0.51501393",
"0.5144239",
"0.5092176",
"0.49975133",
"0.49461722",
"0.4940643",
"0.49186486",
"0.49109018",
"0.48954105",
"0.48852363",
"0.487... | 0.69600064 | 0 |
Get Confluence's Content Current Version Number | def get_content_ver(self):
al_ver_req = requests.get(self.al_base, headers=self.headers)
if al_ver_req.status_code != 200:
print(al_ver_req.content)
exit(1)
self.content_ver = str(json.loads(al_ver_req.text)['version']['number']+1)
return self.content_ver | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version(self):\n self._get_latest_content()\n return self._data.get('version', None)",
"def get_version(self):\r\n\r\n return self.versions[0].number",
"def get_version(self):\n return self.bot_data_file[\"version\"]",
"def version(self):\n _, body = self.request('/', '... | [
"0.7699828",
"0.7377042",
"0.7215377",
"0.718699",
"0.7060291",
"0.7052554",
"0.7002287",
"0.69899905",
"0.697049",
"0.6952966",
"0.69293284",
"0.6916697",
"0.69056976",
"0.68921",
"0.68895555",
"0.6868268",
"0.6865195",
"0.6862485",
"0.6862485",
"0.6834367",
"0.6823211",
"... | 0.772983 | 0 |
Get Current Hostname and ip address | def get_host(self):
self.server_name = subprocess.check_output(['hostname', '-s']).split('\n')[0]
self.ip_addr = subprocess.check_output(['hostname', '-i']).split('\n')[0]
return self.server_name, self.ip_addr | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getHostInfo():",
"def getHost():",
"def getHost():",
"def get_local_host_ip(self) -> str:",
"def get_host_name():\n return socket.gethostname()",
"def get_IP(): \n \n return socket.gethostbyname(socket.gethostname())",
"def getLocalhostIP():\n return socket.getaddrinfo('localhost', 0)... | [
"0.80795854",
"0.794866",
"0.794866",
"0.7906338",
"0.7721937",
"0.76840365",
"0.7677205",
"0.76084626",
"0.76025665",
"0.7579721",
"0.74786663",
"0.7469157",
"0.74583626",
"0.7454506",
"0.7447393",
"0.73904765",
"0.7381367",
"0.7367349",
"0.7319261",
"0.72575194",
"0.7233231... | 0.80794996 | 1 |
Get Unravel Version Number From version.txt | def unravel_ver():
unravel_version_path = "/usr/local/unravel/ngui/www/version.txt"
unravel_ver = "UNKNOWN"
if os.path.exists(unravel_version_path):
with open(unravel_version_path, 'r') as f:
version_file = f.read()
f.close()
if re.search('... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_version():\n # code parts were taken from here https://stackoverflow.com/a/67692\n\n path2setup = os.path.dirname(__file__)\n version_file = os.path.abspath(\n os.path.join(path2setup, \"diffusion_maps\", \"version.py\"))\n\n spec = importlib.util.spec_from_file_location(\"version\", ve... | [
"0.72811717",
"0.72619563",
"0.69252807",
"0.6914498",
"0.6901022",
"0.68801546",
"0.68601614",
"0.68503815",
"0.678609",
"0.67569417",
"0.67515266",
"0.6726387",
"0.6655109",
"0.6651228",
"0.6581209",
"0.6548285",
"0.6538026",
"0.6532313",
"0.6505377",
"0.6483599",
"0.647367... | 0.7943636 | 0 |
Convert to a flatten CIGAR, a sequence of each operation. | def flatten(self) -> FlattenCigar:
return FlattenCigar(''.join([op * l for l, op in self])) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten():",
"def flat(self):\n return Op('flat', self)",
"def flatten(self):\n pass",
"def convert_flatten(g, op, block):\n\n x = g.get_node(op.input(\"X\")[0])\n input_shape = list(infer_shape(x))\n\n start = op.attr(\"start_axis\")\n end = op.attr(\"stop_axis\")\n ndim = l... | [
"0.6953859",
"0.6396095",
"0.606501",
"0.6026288",
"0.60117376",
"0.59260994",
"0.57738715",
"0.5750928",
"0.56854236",
"0.5670785",
"0.5666442",
"0.5653072",
"0.5632504",
"0.5632316",
"0.5600894",
"0.5577207",
"0.5574045",
"0.55651146",
"0.5508621",
"0.5503799",
"0.54884386"... | 0.6902479 | 1 |
Name of an dimension columns. | def dim_col(d: int) -> str:
return f"dim_{d}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names(self):\n return self._names_to_cols.keys()",
"def getColumnsNames(self):\r\n ColsName = []\r\n for i in range(len(self.columns)):\r\n ColsName.append(self.columns[i].getColName())\r\n return ColsName",
"def names(self):\n if self.dtype.fields:\n ... | [
"0.718887",
"0.71388614",
"0.69895345",
"0.68121487",
"0.68046474",
"0.6745563",
"0.6733316",
"0.67270404",
"0.6725429",
"0.6724157",
"0.6667658",
"0.66530126",
"0.6648488",
"0.66405857",
"0.661934",
"0.661934",
"0.6606263",
"0.65954393",
"0.6589676",
"0.65468967",
"0.654289"... | 0.752388 | 0 |
Name of an constant columns. | def const_col(dims: Iterable[int]) -> str:
dims = sorted(dims)
dims_str = [str(d) for d in dims]
return f"const_{'_'.join(dims_str)}" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def colNames_string(self):\n # SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'some_table';\n return \"SELECT column_name FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = \"",
"def get_name(self):\n return self.col_name",
"def getColumnsNames(self):\r\n Cols... | [
"0.72595114",
"0.68052804",
"0.6796753",
"0.67853796",
"0.673459",
"0.6648163",
"0.6641423",
"0.66143996",
"0.66143996",
"0.658276",
"0.65583867",
"0.6536313",
"0.6508129",
"0.6486662",
"0.6433136",
"0.63928145",
"0.63897306",
"0.63849294",
"0.6375486",
"0.6366864",
"0.635493... | 0.7313923 | 0 |
Test retrieving one specific document from the supplied dataset | def test_document_retrieval(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_get_document(index_with_documents):\n response = index_with_documents().get_document(\"500682\")\n assert isinstance(response, Document)\n assert hasattr(response, \"title\")\n assert response.title == \"The Highwaymen\"",
"def test_client_document_retrieve(self):\n pass",
"def test... | [
"0.6752735",
"0.6655615",
"0.66369635",
"0.6347907",
"0.6340484",
"0.6331284",
"0.631064",
"0.6279729",
"0.62746775",
"0.62734914",
"0.6231036",
"0.61979085",
"0.6145741",
"0.60775334",
"0.60445297",
"0.6034252",
"0.6025626",
"0.6023892",
"0.60148853",
"0.59996307",
"0.599907... | 0.6851347 | 0 |
Test removing one example index | def test_removing_index(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_remove_one(self):\n pass",
"def test_index_delete(self):\n a = self.test_index()\n a.delete()\n es = self.es\n es.refresh()\n r = es.search(query=StringQuery('zool'))\n eq_(r['hits']['total'], 0, \"We shouldn't get any hits.\")",
"def test_delete_occurr... | [
"0.7241969",
"0.7178209",
"0.6847578",
"0.68288803",
"0.68008983",
"0.6782391",
"0.66770285",
"0.6635241",
"0.6635241",
"0.6618089",
"0.6578015",
"0.6567783",
"0.6561767",
"0.65244013",
"0.6505692",
"0.65053636",
"0.6502126",
"0.64599645",
"0.6423665",
"0.6412666",
"0.6412392... | 0.8702621 | 0 |
Test creating one type in elastic search for dataset | def test_creating_index_type(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_init(self):\n es = elasticsearch.ElasticSearch(server='8.8.8.8',\n user='alice',\n password='iLoveDogs',\n doc_type='someLogCategory')\n\n self.assertTrue(isinstance(es, el... | [
"0.66146964",
"0.6332455",
"0.62205386",
"0.6001013",
"0.5990348",
"0.5960937",
"0.5947248",
"0.5917501",
"0.5906846",
"0.58855873",
"0.5879666",
"0.5876767",
"0.58712596",
"0.58609",
"0.58323514",
"0.58108336",
"0.5795055",
"0.5774519",
"0.57743204",
"0.5758035",
"0.57205737... | 0.7408355 | 0 |
Test exporting one entire index as a type on the new index | def test_export_index(self): | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_creating_index_type(self):",
"def create_index():",
"def _write_index(self):\n # Make sure to only write non-default objects to the index.\n self.store.write_object(\n object=[obj.to_dict() for ns in self.index.values() for obj in ns.values() if not obj.is_default],\n ... | [
"0.8139565",
"0.68929064",
"0.65036553",
"0.65016955",
"0.6436775",
"0.6325476",
"0.62823385",
"0.62609863",
"0.6256043",
"0.6212744",
"0.6190955",
"0.6190955",
"0.6153169",
"0.6110714",
"0.60985196",
"0.6094142",
"0.6072941",
"0.60682577",
"0.60542524",
"0.6053099",
"0.60481... | 0.76715356 | 1 |
Method to convert an input object into the internal format that is understandable by this pp. In this case, we only want data objects! @ In, currentInp, list, an object that needs to be converted @ Out, currentInp, DataObject.HistorySet, input data | def inputToInternal(self, currentInp):
if len(currentInp) > 1:
self.raiseAnError(IOError, 'Expected 1 input HistorySet, but received {} inputs!'.format(len(currentInp)))
currentInp = currentInp[0]
if currentInp.type not in ['HistorySet']:
self.raiseAnError(IOError, 'ValueDuration postprocessor "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inputToInternal(self, currentInputs):\n if type(currentInputs) != list:\n currentInputs = [currentInputs]\n hasPointSet = False\n hasHistorySet = False\n #Check for invalid types\n for currentInput in currentInputs:\n inputType = None\n if hasattr(currentInput, 'type'):\n i... | [
"0.62322766",
"0.5495255",
"0.5473848",
"0.5231171",
"0.5192808",
"0.5162856",
"0.51426804",
"0.51023227",
"0.5061357",
"0.50513566",
"0.5023881",
"0.49732664",
"0.4961982",
"0.49580458",
"0.4949744",
"0.49480736",
"0.48897338",
"0.48828426",
"0.4870697",
"0.48611736",
"0.483... | 0.6651327 | 0 |
Function to place all of the computed data into the output object @ In, finishedJob, JobHandler External or Internal instance, A JobHandler object that is in charge of running this postprocessor @ In, output, DataObject.DataObject, The object where we want to place our computed results @ Out, None | def collectOutput(self, finishedJob, output):
evaluation = finishedJob.getEvaluation()
realizations = evaluation[1]
for rlz in realizations:
output.addRealization(rlz) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collectOutput(self, finishedJob, output):\n evaluation = finishedJob.getEvaluation()\n outputDict = evaluation[1]\n # FIXED: writing directly to file is no longer an option!\n #if isinstance(output, Files.File):\n # availExtens = ['xml']\n # outputExtension = output.getExt().lower()\n # ... | [
"0.72581446",
"0.609117",
"0.59467787",
"0.59434634",
"0.5903588",
"0.5876211",
"0.58171403",
"0.5814163",
"0.5758464",
"0.5747825",
"0.5672238",
"0.56583434",
"0.56543267",
"0.5581852",
"0.55786556",
"0.553822",
"0.5537256",
"0.55357903",
"0.5525918",
"0.5508519",
"0.5493788... | 0.663166 | 1 |
Returns the snapshot for an abstract button. | def snapshot(self):
snap = super(AbstractButton, self).snapshot()
snap['text'] = self.text
snap['checkable'] = self.checkable
snap['checked'] = self.checked
snap['icon_size'] = tuple(self.icon_size)
snap['icon_source'] = self.icon_source
return snap | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetButton(self):\r\n\r\n return self.button",
"def test_get_custom_button(self):\n pass",
"def button(self):\n return self._button",
"def button(self):\n return self._button",
"def GetButtonObj(self):\n\n return self.theButton",
"def get_button(self, button):\n ... | [
"0.5928386",
"0.5769516",
"0.57689387",
"0.57689387",
"0.5747097",
"0.56495136",
"0.55938715",
"0.5526554",
"0.5426148",
"0.5416239",
"0.5321635",
"0.5183309",
"0.5167304",
"0.51316875",
"0.5086194",
"0.504123",
"0.5026571",
"0.50260735",
"0.5001774",
"0.4994775",
"0.49943876... | 0.74919146 | 0 |
Bind the change handlers for an abstract button. | def bind(self):
super(AbstractButton, self).bind()
attrs = ('text', 'checkable', 'checked', 'icon_size', 'icon_source')
self.publish_attributes(*attrs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bind_controls(self):\n self.add_comment_button.Bind(wx.EVT_BUTTON, self.add_comment)\n self.del_comment_button.Bind(wx.EVT_BUTTON, self.remove_comment)\n self.upload_button.Bind(wx.EVT_BUTTON, self.upload_change)\n self.Bind(wx.EVT_CLOSE, self.on_close)",
"def _bind_events(self):\... | [
"0.6256721",
"0.6153286",
"0.60127467",
"0.5784025",
"0.5755935",
"0.5721944",
"0.5678004",
"0.55532223",
"0.54628557",
"0.54395336",
"0.54295486",
"0.54207826",
"0.5404983",
"0.53893524",
"0.53553313",
"0.5351322",
"0.53488547",
"0.5343923",
"0.53417367",
"0.53130454",
"0.53... | 0.6673474 | 0 |
Handle the 'clicked' action from the UI widget. The content will contain the current checked state. | def on_action_clicked(self, content):
checked = content['checked']
self.set_guarded(checked=checked)
self.clicked(checked) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_action_toggled(self, content):\n checked = content['checked']\n self.set_guarded(checked=checked)\n self.toggled(checked)",
"def on_CheckPunish_clicked(self):\n # TODO: not implemented yet\n raise NotImplementedError",
"def on_checkBox_kongtoukai_clicked(self, checked)... | [
"0.7222779",
"0.64753324",
"0.64151967",
"0.61120963",
"0.61120963",
"0.6101192",
"0.6083534",
"0.6083108",
"0.6058051",
"0.59665895",
"0.5943783",
"0.5931398",
"0.5927293",
"0.5911782",
"0.5877102",
"0.58690405",
"0.58421385",
"0.58383846",
"0.582804",
"0.58236194",
"0.58073... | 0.79627955 | 0 |
Handle the 'toggled' action from the UI widget. The payload will contain the current checked state. | def on_action_toggled(self, content):
checked = content['checked']
self.set_guarded(checked=checked)
self.toggled(checked) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _action_toggled(self, action, checked=False):\n self._emit_signal_for_action(self.action_toggled, action, checked)",
"def on_action_clicked(self, content):\n checked = content['checked']\n self.set_guarded(checked=checked)\n self.clicked(checked)",
"def uiCheckboxOnToggled(check... | [
"0.6333562",
"0.5927516",
"0.5564271",
"0.55362374",
"0.53534585",
"0.5258741",
"0.52571255",
"0.5243941",
"0.50819534",
"0.4999429",
"0.49177405",
"0.48819375",
"0.48310617",
"0.48206764",
"0.48191047",
"0.47919643",
"0.47903123",
"0.4774036",
"0.47589263",
"0.47464374",
"0.... | 0.6994243 | 0 |
Applies graph to random task application, performs all required tasks alterings according to graph structure and strategies in nodes | def apply(self, decision_graph: DecisionGraph) -> None:
#takes decision graph and applies them to processors
self.apply_random(False)
logging.debug("application1:", self.application)
logging.debug("connections1:", self.transfer)
Procedures.instance.set_application(self.applicati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_random(self, critical=True) -> None:\n task_order = None\n if critical == True:\n task_order = self.task_graph.find_critical_path()\n else:\n task_order = self.task_graph.DFS()\n for task in task_order:\n self.application[random.choice(self.pro... | [
"0.6415566",
"0.63959754",
"0.6172701",
"0.58932567",
"0.5892386",
"0.5892386",
"0.5814591",
"0.58130676",
"0.573856",
"0.571988",
"0.5719274",
"0.56998295",
"0.5692906",
"0.56837195",
"0.5664215",
"0.5585827",
"0.55821574",
"0.5569843",
"0.55594385",
"0.5550299",
"0.5520545"... | 0.76654094 | 0 |
Infer a boolean from the given value | def infer_bool(input_value):
# Boolean
if isinstance(input_value, bool):
return input_value
# Integer
if isinstance(input_value, int):
return bool(input_value)
# String
if isinstance(input_value, str):
if 'Y' in input_value.upper():
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_bool(value):\n def make_value():\n return verify.Term(verify.BOOLEAN, value)\n return make_value",
"def make_boolean(value):\n if value == '1':\n return True\n return False",
"def explicit_bool(value: bool) -> bool:\n return value",
"def to_bool(value):\n return value... | [
"0.79125327",
"0.79014593",
"0.7893598",
"0.7793019",
"0.7748242",
"0.77398175",
"0.76491034",
"0.76058364",
"0.76022094",
"0.7491123",
"0.74687",
"0.74559116",
"0.743196",
"0.737583",
"0.7338018",
"0.73268956",
"0.7325107",
"0.72968197",
"0.72796243",
"0.7269116",
"0.7257546... | 0.8216076 | 0 |
Make the contents of the basket available in the session | def basket_contents(request):
basket = request.session.get('basket', {})
basket_items = []
order_total = 0
product_count = 0
for id, quantity in basket.items():
product = get_object_or_404(Products, pk=id)
if product.sale_price:
order_total += quantity * product.sale_pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def basket(request):\n return {'basket': Basket(request)}",
"def prepare_basket(self):\n product = self.create_product()\n\n res = self.do_get_basket()\n self.assertEqual(res.status_code, 200)\n basket_id = res.data['id']\n\n res = self.do_add_to_basket(product.id)\n ... | [
"0.67615753",
"0.6654331",
"0.65773946",
"0.6138491",
"0.61340445",
"0.5939876",
"0.5929365",
"0.5925381",
"0.591943",
"0.5915894",
"0.5902565",
"0.5901846",
"0.58771044",
"0.5872021",
"0.5871762",
"0.5871351",
"0.58419406",
"0.58253396",
"0.5824438",
"0.5780245",
"0.57729053... | 0.6888667 | 0 |
Overrides the arrayToQPath function in pyqtgraph to allow plotting np.nan values. The code comes | def fixPyQtGraphNanBehaviour() -> None:
global _hasOverriddenPyQtGraphArrayToQPath
if _hasOverriddenPyQtGraphArrayToQPath:
return
def arrayToQPath(x, y, connect='all'):
"""Convert an array of x,y coordinats to QPainterPath as efficiently as possible.
The *connect* argument may be '... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arrayToQPath(x, y, connect='all'):\n\n ## Create all vertices in path. The method used below creates a binary format so that all\n ## vertices can be read in at once. This binary format may change in future versions of Qt,\n ## so the original (slower) method is left here for emergencies:\... | [
"0.5448099",
"0.5326198",
"0.5265273",
"0.51479477",
"0.50647813",
"0.5053176",
"0.5012883",
"0.49987057",
"0.49709228",
"0.48828948",
"0.48828948",
"0.4866073",
"0.48584303",
"0.48215508",
"0.48174688",
"0.47962016",
"0.4794452",
"0.4786526",
"0.47856283",
"0.478254",
"0.477... | 0.75991076 | 0 |
Convert an array of x,y coordinats to QPainterPath as efficiently as possible. The connect argument may be 'all', indicating that each point should be connected to the next; 'pairs', indicating that each pair of points should be connected, or an array of int32 values (0 or 1) indicating connections. | def arrayToQPath(x, y, connect='all'):
## Create all vertices in path. The method used below creates a binary format so that all
## vertices can be read in at once. This binary format may change in future versions of Qt,
## so the original (slower) method is left here for emergencies:
#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_path(self):\n for point_3d in self.path_coordinates:\n self.connect_point_with_neighbors(point_3d)",
"def connect(data, x1, y1, x2, y2):\n flag1, points1 = oneRoadConnect(data, x1, y1, x2, y2)\n if flag1:\n return flag1, points1\n flag2, points2 = twoRoadConnect(data,... | [
"0.56426346",
"0.56220907",
"0.55049753",
"0.5224002",
"0.50902456",
"0.50598764",
"0.4994972",
"0.49337366",
"0.49123883",
"0.49007034",
"0.488512",
"0.4883937",
"0.48173732",
"0.48149273",
"0.47900003",
"0.47803026",
"0.47625056",
"0.47299063",
"0.4720794",
"0.46916357",
"0... | 0.7157029 | 0 |
Set rank for current document | def set_rank(self,rank):
self._rank = rank | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank(self, rank):\n self._rank = rank",
"def update_rank(self):\n self.__rank += 1",
"def rank(self, value: int) -> None:\n self._rank = value",
"def set_rank_order(self):\n for k in self._run:\n self._run[k].sort(key=lambda x:x.get_rank(),reverse=False)\n ... | [
"0.7983144",
"0.7747372",
"0.7606195",
"0.6716903",
"0.6575003",
"0.652593",
"0.644247",
"0.6362639",
"0.6332209",
"0.6332209",
"0.6332209",
"0.6332209",
"0.6332209",
"0.63256496",
"0.6296967",
"0.62964976",
"0.62941027",
"0.6270591",
"0.6231609",
"0.62001276",
"0.61685216",
... | 0.81353635 | 0 |
initlize a qres from fname | def __init__(self,fname):
self._rid = fname
self._run = defaultdict(list)
self._ties = {}
with open(fname,"r") as fin:
for line in fin:
if len(line.strip()) > 1:
tpl = ResTpl(line)
self._run[tpl.get_qid()].append(tpl)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_fp(*args) -> \"qfile_t *\":\n return _ida_fpro.qfile_t_from_fp(*args)",
"def __init__(self, *args):\n _ida_fpro.qfile_t_swiginit(self, _ida_fpro.new_qfile_t(*args))",
"def from_capsule(*args) -> \"qfile_t *\":\n return _ida_fpro.qfile_t_from_capsule(*args)",
"def __init__(self, ... | [
"0.65891296",
"0.6244424",
"0.6153403",
"0.6140164",
"0.6091018",
"0.6029306",
"0.60188013",
"0.60020274",
"0.5929765",
"0.57235545",
"0.5712652",
"0.5712202",
"0.5679409",
"0.5651802",
"0.55894834",
"0.5541402",
"0.5516756",
"0.54842526",
"0.5479211",
"0.5479211",
"0.5476229... | 0.66654116 | 0 |
check ties up to a rank | def _check_ties(self,rank):
for k in self._run:
curr_dict = defaultdict(list)
qid = self._run[k][0].get_qid()
for t in self._run[k]:
# print t.get_str()
curr_dict[t.get_score()].append(t)
curr_dict = OrderedDict(sorted(curr_dict.ite... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ge__(self, other):\n return int(self.rank) >= int(other.rank)",
"def rank():\n return 0",
"def __rank__(self) -> int:",
"def atiecorrect(rankvals):\r\n sorted,posn = ashellsort(N.array(rankvals))\r\n n = len(sorted)\r\n T = 0.0\r\n i = 0\r\n while (i<n-1):\r\n if sorted[... | [
"0.60811085",
"0.6011107",
"0.5998166",
"0.5982718",
"0.5973679",
"0.59163904",
"0.59009814",
"0.5889696",
"0.5820775",
"0.58151275",
"0.5794162",
"0.57772785",
"0.5763588",
"0.57437915",
"0.5616432",
"0.55973095",
"0.55844724",
"0.5580689",
"0.5533114",
"0.5528302",
"0.55239... | 0.7104773 | 0 |
alter the scores based on rank and print out the qres string | def set_rank_order(self):
for k in self._run:
self._run[k].sort(key=lambda x:x.get_rank(),reverse=False)
tot_res = len(self._run[k])
for r in self._run[k]:
r.set_score(tot_res - int(r.get_rank()) + 1)
print r.get_str() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addRankToLine(self,cols,rank):\n line = \"\"\n ann = \";RankScore=\" + str(self.family_id) + \":\" + str(rank)\n for c in cols:\n line = line + c\n if cols.index(c) == 7: # 0-based index\n line = line + ann\n if cols.index(c) < len(cols):\n line = line + \"\\t\"\n prin... | [
"0.69363713",
"0.6717808",
"0.664743",
"0.6515804",
"0.64451236",
"0.64022344",
"0.6401261",
"0.63426983",
"0.6306259",
"0.6290443",
"0.6244576",
"0.6240333",
"0.6126157",
"0.61052656",
"0.6099187",
"0.6047306",
"0.60464305",
"0.601182",
"0.60089415",
"0.6001234",
"0.5979397"... | 0.67761415 | 1 |
set the qres order in trec way, tie breaking by inverse doc id | def set_trec_order(self):
for k in self._run:
self._run[k].sort(key=lambda x:(x.get_score(),x.get_doc()),reverse=True)
for r in self._run[k]:
print r.get_str() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __resequence(self):\n if self.__reltype_ordering:\n def reltype_key(rel):\n reltype = rel._reltype\n if reltype in self.__reltype_ordering:\n return self.__reltype_ordering.index(reltype)\n return len(self.__reltype_ordering)\n\n... | [
"0.6170424",
"0.593786",
"0.593786",
"0.58088446",
"0.5604717",
"0.5565067",
"0.5432258",
"0.5385826",
"0.5333744",
"0.53287023",
"0.5327521",
"0.53063273",
"0.530294",
"0.5275499",
"0.5255252",
"0.52504146",
"0.52362454",
"0.5229463",
"0.5121875",
"0.5093844",
"0.5089218",
... | 0.66317785 | 0 |
the current res of the given qid | def get_res_by_id(self,qid):
return self._run[qid] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __int__(self):\n return int(self.q[0])",
"def getQValue(self, state, action):\n \"*** YOUR CODE HERE ***\"\n return self.QValueCounter[(state, action)]",
"def get_current_question(self):\n self.logger.info(\"Adapter: Get next question\")\n try:\n return self._c... | [
"0.6413051",
"0.62253684",
"0.6125881",
"0.6045894",
"0.6038377",
"0.5964229",
"0.5940533",
"0.5904057",
"0.58963364",
"0.5789544",
"0.5747255",
"0.5727883",
"0.5719731",
"0.56922334",
"0.5677398",
"0.56696343",
"0.5666584",
"0.5592892",
"0.55854803",
"0.55850106",
"0.5582450... | 0.77879065 | 0 |
Method to load the prediction data. | def load_data(self):
self.logger.log(self.log_file, 'Loading prediction data!')
try:
prediction_data = self.aws_operations.read_csv(self.prediction_file_path)
if prediction_data is None:
return None
self.logger.log(self.log_file, 'Prediction data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_predicted_results(self):\n print(\"\\n\\nLoad prediction answers : \")\n with open(\"predicted_results\", \"rb\") as predicted_results:\n self.predicted_results = pickle.load(predicted_results)",
"def predict(self, datafile):",
"def _load_training_data(self):\n self._sa... | [
"0.7319266",
"0.72729313",
"0.7127742",
"0.7071834",
"0.70359993",
"0.67512",
"0.67477477",
"0.67058074",
"0.6691851",
"0.6621259",
"0.6559002",
"0.65573895",
"0.6529639",
"0.6453592",
"0.6448904",
"0.64453185",
"0.6433791",
"0.64146507",
"0.6412152",
"0.640556",
"0.6389879",... | 0.7613169 | 0 |
Get a set of atributes, use args to get just a sub set of atributes >> client.attributes("mail") | def attributes(self, *args):
kwargs = {}
if args:
kwargs["attributenames"] = args
r = self._token_id_request(urljoin(self._url, Client._attribute_resource), **kwargs)
# parse contennt looking for all attributes
attributes = []
for line in r.text.splitlines()... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ATTRIBUTE():\n return \"author\", \"title\", \"publisher\", \"shelf\", \"category\", \"subject\"",
"def get_attributes():\n bot_id = socket.gethostname().lower().split('.', 1)[0]\n return os_utilities.get_attributes(bot_id)",
"def getAttributes(self):\n pass",
"def readAttributes(self, *args)... | [
"0.63976806",
"0.623837",
"0.61819",
"0.61070275",
"0.595213",
"0.5894523",
"0.58639383",
"0.58302146",
"0.5731521",
"0.57272667",
"0.57254034",
"0.5705496",
"0.56616807",
"0.5653267",
"0.5648749",
"0.56155336",
"0.5613758",
"0.55988157",
"0.5598455",
"0.55981016",
"0.5596471... | 0.62583965 | 1 |
Tests marker detection with Intel Realsense camera | def main():
cam = Realsense()
# cam.access_intr_and_extr()
profile = cam.pipeline.start(cam.config)
depth_sensor = profile.get_device().first_depth_sensor()
depth_scale = depth_sensor.get_depth_scale()
align_to = rs.stream.color
align = rs.align(align_to)
objp = np.zeros((3*4,3), np.flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_marker_camera_interface_implementation() -> None:\n MockMarkerCameraDriver()",
"def test_marker_camera_see() -> None:\n m = MarkerCamera(0, MockMarkerCameraDriver())\n\n reslist = m.see()\n assert isinstance(reslist, MarkerList)\n assert len(reslist) > 0\n\n m1 = reslist[0]\n assert... | [
"0.68500924",
"0.68473023",
"0.68367314",
"0.68088275",
"0.6529371",
"0.63378453",
"0.63343704",
"0.6322237",
"0.6132976",
"0.6111885",
"0.5992033",
"0.59476465",
"0.58069026",
"0.5798742",
"0.5717742",
"0.5684947",
"0.56804395",
"0.5663785",
"0.5661489",
"0.56575364",
"0.565... | 0.6927072 | 0 |
Run the example, asking MOE for ``num_points_to_sample`` optimal points to sample. | def run_example(num_points_to_sample=1000, verbose=True, **kwargs):
exp = Experiment([[1, 52], [0, 6], [1, 52]]) # 2D experiment, we build a tensor product domain
# Bootstrap with some known or already sampled point(s)
exp.historical_data.append_sample_points([
SamplePoint([26, 2, 46], get_fitness... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_example(num_points_to_sample=20, verbose=True, **kwargs):\n exp = Experiment([[0, 2], [0, 4]]) # 2D experiment, we build a tensor product domain\n # Bootstrap with some known or already sampled point(s)\n exp.historical_data.append_sample_points([\n SamplePoint([0, 0], function_to_minimize... | [
"0.7946016",
"0.6558284",
"0.6481605",
"0.6451533",
"0.6144484",
"0.6144484",
"0.6024297",
"0.5998668",
"0.59649837",
"0.5962925",
"0.59532136",
"0.59530586",
"0.594987",
"0.5910949",
"0.5839365",
"0.5837938",
"0.5836724",
"0.5800991",
"0.57838213",
"0.5755561",
"0.5740208",
... | 0.76822025 | 1 |
Gets the json file with the name inputted into this function by looking in all directories ending in '_data'. | def json_get(name, key):
cmpd_file = name + '.json'
data_dirs = [dir for dir in os.listdir('.') if dir.endswith('_data')]
dir = data_dirs[0]
for fname in os.listdir(dir):
if fname.endswith(name + '.json'):
with open(os.path.join(dir,fname)) as f:
data = json.load(f)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_path(name):\n js = open('config.json').read()\n data = json.loads(js)\n return os.path.expanduser(data[name]['data_path'])",
"def fullpath(data_folder, name):\n return os.path.join(data_folder, f\"{alias(name)}.json\")",
"def calc_fullpath(data_folder, name):\n return os.path.join(d... | [
"0.7355385",
"0.71095854",
"0.69942766",
"0.687026",
"0.67114794",
"0.6706718",
"0.66431034",
"0.6563622",
"0.6549521",
"0.6540523",
"0.65212846",
"0.646986",
"0.6465505",
"0.6463847",
"0.6446889",
"0.6443118",
"0.643738",
"0.63788044",
"0.6371897",
"0.6341493",
"0.6340627",
... | 0.78262496 | 0 |
Computes the fitness of a compound, and returns the negative of it (for functionminimizing). | def get_fitness(compound):
#get inputs to fitness function:
cmpd_name = decode(compound) #finds the name of the compound corresponding to next_point_to_sample
#then query for JSON file with same name
return 0 - eval_fitness_complex_product(json_get(cmpd_name, 'gllbsc_dir-gap'), json_get(cmpd_name, 'gllb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_individual_fitness(individual):\r\n fitness = 0\r\n # A COMPLETER\r\n \r\n #Si distance avec le point objectif diminue, alors fitness augmente ?\r\n \r\n return fitness",
"def fitness(self):\n # TO BE DECIDED\n return 1",
"def fitness(individual, target_sum, target_mult)... | [
"0.6706591",
"0.6666288",
"0.65728146",
"0.65722",
"0.6551831",
"0.650068",
"0.63498795",
"0.6245884",
"0.6211196",
"0.6193602",
"0.616395",
"0.6094383",
"0.6080686",
"0.6050155",
"0.60288435",
"0.597314",
"0.5959686",
"0.59449637",
"0.5941557",
"0.59307015",
"0.59256786",
... | 0.7297409 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.