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 |
|---|---|---|---|---|---|---|
Reads an attribute container entry from a data stream. | def _ReadAttributeContainerFromStreamEntry(self, data_stream, container_type):
entry_data = data_stream.ReadEntry()
return self._DeserializeAttributeContainer(container_type, entry_data) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ReadAttributeContainersFromStream(self, data_stream, container_type):\n attribute_container = self._ReadAttributeContainerFromStreamEntry(\n data_stream, container_type)\n\n while attribute_container:\n yield attribute_container\n\n attribute_container = self._ReadAttributeContainerFrom... | [
"0.69889224",
"0.6222384",
"0.61784005",
"0.59485114",
"0.5948287",
"0.5591526",
"0.5510185",
"0.54602104",
"0.5459362",
"0.545885",
"0.54197294",
"0.53025556",
"0.5288381",
"0.51752573",
"0.513272",
"0.51044303",
"0.5075486",
"0.5058507",
"0.50403076",
"0.5032661",
"0.503068... | 0.84585357 | 0 |
Reads attribute containers from a data stream. | def _ReadAttributeContainersFromStream(self, data_stream, container_type):
attribute_container = self._ReadAttributeContainerFromStreamEntry(
data_stream, container_type)
while attribute_container:
yield attribute_container
attribute_container = self._ReadAttributeContainerFromStreamEntry(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _ReadAttributeContainerFromStreamEntry(self, data_stream, container_type):\n entry_data = data_stream.ReadEntry()\n return self._DeserializeAttributeContainer(container_type, entry_data)",
"def read(self, istream):\n super(GetAttributeListResponsePayload, self).read(istream)\n tstream = u... | [
"0.7511703",
"0.6235817",
"0.614548",
"0.60561013",
"0.60418844",
"0.57938653",
"0.5704795",
"0.5673734",
"0.5646796",
"0.5470428",
"0.54278445",
"0.54159945",
"0.53527635",
"0.5276783",
"0.5264718",
"0.52491045",
"0.52163726",
"0.5211251",
"0.520845",
"0.5204959",
"0.5170587... | 0.8091421 | 0 |
Reads event data into the event. This function is intended to offer backwards compatible event behavior. | def _ReadEventDataIntoEvent(self, event):
if self.storage_type != definitions.STORAGE_TYPE_SESSION:
return
if (hasattr(event, u'event_data_stream_number') and
hasattr(event, u'event_data_entry_index')):
event_data_identifier = identifiers.SerializedStreamIdentifier(
event.event_da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read(self):\n event = os.read(self._fd, self._EVENT_SIZE)\n (tv_sec, tv_usec, evtype, code, value) = struct.unpack(self._FORMAT, event)\n return (tv_sec, tv_usec, evtype, code, value)",
"def inReadEvent(self):\r\n try:\r\n self._checkAssert()\r\n if self.hand... | [
"0.67047715",
"0.65566206",
"0.6405366",
"0.63358164",
"0.63347095",
"0.6250807",
"0.6104516",
"0.60877067",
"0.60501796",
"0.60416806",
"0.60346985",
"0.59807837",
"0.59353125",
"0.5918557",
"0.5914954",
"0.5910027",
"0.58915746",
"0.5891256",
"0.5890705",
"0.58696884",
"0.5... | 0.74858975 | 0 |
Reads the serializer stream. Note that the serializer stream has been deprecated in format version 20160501 in favor of the the store metadata stream. | def _ReadSerializerStream(self):
stream_name = 'serializer.txt'
if not self._HasStream(stream_name):
return
serialization_format = self._ReadStream(stream_name)
if serialization_format != definitions.SERIALIZER_FORMAT_JSON:
raise ValueError(
'Unsupported stored serialization forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _OpenRead(self):\n has_storage_metadata = self._ReadStorageMetadata()\n if not has_storage_metadata:\n # TODO: remove serializer.txt stream support in favor\n # of storage metadata.\n if self._read_only:\n logging.warning('Storage file does not contain a metadata stream.')\n\n ... | [
"0.6528527",
"0.6091562",
"0.607454",
"0.5913418",
"0.57026047",
"0.56498206",
"0.56205845",
"0.56068987",
"0.55920726",
"0.556777",
"0.55575585",
"0.546324",
"0.5461905",
"0.5422025",
"0.53662753",
"0.53624374",
"0.5356865",
"0.533224",
"0.53168803",
"0.5314529",
"0.52861947... | 0.7866037 | 0 |
Reads the storage metadata. | def _ReadStorageMetadata(self):
stream_name = 'metadata.txt'
if not self._HasStream(stream_name):
return False
stream_data = self._ReadStream(stream_name)
storage_metadata_reader = _StorageMetadataReader()
storage_metadata = storage_metadata_reader.Read(stream_data)
ZIPStorageFile._Chec... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_metadata(self):\n return self._storage_metadata",
"def read_metadata(self):\n return self.parent.controller.get_tag_metadata()",
"def _read_metadata(self):\n self._wait_for_read_with_timeout(self.metadata_read_fd)\n flat_json = os.read(self.metadata_read_fd, MAX_METADATA... | [
"0.74399936",
"0.6792893",
"0.6547794",
"0.6474655",
"0.64490026",
"0.64270985",
"0.64231867",
"0.6321233",
"0.63122684",
"0.6309229",
"0.6265343",
"0.6251131",
"0.623931",
"0.6180494",
"0.61594146",
"0.6141005",
"0.6141005",
"0.61363184",
"0.61298025",
"0.61181056",
"0.61131... | 0.7656292 | 0 |
Reads data from a stream. | def _ReadStream(self, stream_name):
file_object = self._OpenStream(stream_name)
if not file_object:
return b''
try:
data = file_object.read()
finally:
file_object.close()
return data | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_stream(schema, stream, *, buffer_size=io.DEFAULT_BUFFER_SIZE):\n reader = _lancaster.Reader(schema)\n buf = stream.read(buffer_size)\n remainder = b''\n while len(buf) > 0:\n values, n = reader.read_seq(buf)\n yield from values\n remainder = buf[n:]\n buf = stream.r... | [
"0.7241966",
"0.696196",
"0.67158127",
"0.6692125",
"0.65686023",
"0.6513731",
"0.64190596",
"0.6386935",
"0.6367304",
"0.63237697",
"0.6246636",
"0.6173181",
"0.61542946",
"0.6151841",
"0.61490333",
"0.60570306",
"0.60353374",
"0.603133",
"0.5992851",
"0.596842",
"0.5966091"... | 0.70737976 | 1 |
Writes a serialized attribute container list. | def _WriteSerializedAttributeContainerList(self, container_type):
container_list = self._GetSerializedAttributeContainerList(container_type)
if not container_list.data_size:
return
stream_name_prefix = self._STREAM_NAME_PREFIXES.get(container_type)
stream_number = self._last_stream_numbers[contai... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_list_to_xml(self, attribute_name, xmlwriter, write_empty=False):\r\n attribute_list = getattr(self, attribute_name)\r\n xmlwriter.WriteStartElement(attribute_name)\r\n for item in attribute_list:\r\n if item or write_empty:\r\n xmlwriter.WriteElementString(\... | [
"0.6592788",
"0.5867104",
"0.57639366",
"0.55036765",
"0.5459424",
"0.5459424",
"0.5426225",
"0.5411055",
"0.53648096",
"0.53200495",
"0.52975076",
"0.5287119",
"0.52698064",
"0.5258567",
"0.52418464",
"0.5240508",
"0.52232784",
"0.5222053",
"0.5192017",
"0.5190727",
"0.51592... | 0.71272206 | 0 |
Writes the serialized events. | def _WriteSerializedEvents(self):
if not self._serialized_event_heap.data_size:
return
self._WriteSerializedEventHeap(
self._serialized_event_heap, self._last_stream_numbers['event'])
self._last_stream_numbers['event'] += 1
self._serialized_event_heap.Empty() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _save_events_summary(self):\n for name, events in self._events.items():\n dict_events = [event.to_dict() for event in events]\n dump_data(dict_events, self._make_event_filename(name))",
"def write_event(self, event):\n self.events_written.append(event)",
"def write(self, fil... | [
"0.67206657",
"0.6460282",
"0.6365395",
"0.63306725",
"0.6308226",
"0.6219239",
"0.61752754",
"0.6143774",
"0.60168386",
"0.60119885",
"0.5959529",
"0.59209573",
"0.58797693",
"0.5725844",
"0.5724634",
"0.56738305",
"0.56485116",
"0.558438",
"0.5574038",
"0.5564741",
"0.55639... | 0.7853536 | 0 |
Writes the contents of an serialized event heap. | def _WriteSerializedEventHeap(self, serialized_event_heap, stream_number):
stream_name = 'event_index.{0:06d}'.format(stream_number)
offset_table = _SerializedDataOffsetTable(self._zipfile, stream_name)
stream_name = 'event_timestamps.{0:06d}'.format(stream_number)
timestamp_table = _SerializedDataTime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _WriteSerializedEvents(self):\n if not self._serialized_event_heap.data_size:\n return\n\n self._WriteSerializedEventHeap(\n self._serialized_event_heap, self._last_stream_numbers['event'])\n\n self._last_stream_numbers['event'] += 1\n self._serialized_event_heap.Empty()",
"def __init... | [
"0.8327066",
"0.6355011",
"0.6245255",
"0.5490536",
"0.5413625",
"0.5378578",
"0.5329441",
"0.5315227",
"0.5304822",
"0.5293191",
"0.5211427",
"0.5201333",
"0.5193247",
"0.51882166",
"0.5187492",
"0.51809126",
"0.5177775",
"0.51724005",
"0.51623875",
"0.51480484",
"0.50975573... | 0.7831806 | 1 |
Writes a session completion attribute container. | def _WriteSessionCompletion(self, session_completion):
if self.storage_type != definitions.STORAGE_TYPE_SESSION:
raise IOError('Session completion not supported by storage type.')
stream_name = 'session_completion.{0:06d}'.format(self._last_session)
if self._HasStream(stream_name):
raise IOErro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteSessionCompletion(self, session_completion):\n self._RaiseIfNotWritable()\n\n self.Flush()\n\n self._WriteSessionCompletion(session_completion)\n self._last_session += 1",
"def _WriteTaskCompletion(self, task_completion):\n if self.storage_type != definitions.STORAGE_TYPE_TASK:\n rai... | [
"0.70599973",
"0.60919684",
"0.55830437",
"0.5293169",
"0.48405552",
"0.48402056",
"0.48036018",
"0.47497064",
"0.4621039",
"0.45495558",
"0.4392914",
"0.4392215",
"0.43867823",
"0.43867823",
"0.43867823",
"0.43605176",
"0.43552446",
"0.43293583",
"0.43153325",
"0.43144256",
... | 0.7816399 | 0 |
Writes a session start attribute container | def _WriteSessionStart(self, session_start):
if self.storage_type != definitions.STORAGE_TYPE_SESSION:
raise IOError('Session completion not supported by storage type.')
stream_name = 'session_start.{0:06d}'.format(self._last_session)
if self._HasStream(stream_name):
raise IOError('Session star... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteSessionStart(self, session_start):\n self._RaiseIfNotWritable()\n\n self._WriteSessionStart(session_start)",
"def WriteSessionStart(self):\n self._RaiseIfNotWritable()\n\n if self._storage_type != definitions.STORAGE_TYPE_SESSION:\n raise IOError('Unsupported storage type.')\n\n # TO... | [
"0.6974629",
"0.61432815",
"0.5983373",
"0.5866698",
"0.57663536",
"0.5694584",
"0.55106896",
"0.5501925",
"0.5384576",
"0.52811885",
"0.52413344",
"0.52413344",
"0.5225179",
"0.51927954",
"0.5153541",
"0.5153541",
"0.51364094",
"0.51356184",
"0.51356184",
"0.51356184",
"0.51... | 0.7347402 | 0 |
Writes the storage metadata. | def _WriteStorageMetadata(self):
stream_name = 'metadata.txt'
if self._HasStream(stream_name):
return
stream_data = (
'[plaso_storage_file]\n'
'format_version: {0:d}\n'
'serialization_format: {1:s}\n'
'storage_type: {2:s}\n'
'\n').format(
self._FORM... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, storage, name, meta):\n with closing(self.open()) as handle:\n storage.save(name, handle)",
"def storage_metadata(self, storage_metadata):\n self._storage_metadata = storage_metadata",
"def WriteMetadata(self, metadata, overwrite=True):\n if not overwrite and 'meta' i... | [
"0.70204455",
"0.6898015",
"0.68496215",
"0.68199617",
"0.67361575",
"0.66632473",
"0.66105163",
"0.6587691",
"0.64822817",
"0.645735",
"0.6430792",
"0.64155865",
"0.6413932",
"0.6349999",
"0.63242394",
"0.6283786",
"0.6279864",
"0.6246822",
"0.6206902",
"0.6146817",
"0.61466... | 0.83782583 | 0 |
Writes a task completion attribute container. | def _WriteTaskCompletion(self, task_completion):
if self.storage_type != definitions.STORAGE_TYPE_TASK:
raise IOError('Task completion not supported by storage type.')
stream_name = 'task_completion.{0:06d}'.format(self._last_task)
if self._HasStream(stream_name):
raise IOError('Task completion... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteTaskCompletion(self, task_completion):\n self._RaiseIfNotWritable()\n\n self.Flush()\n\n self._WriteTaskCompletion(task_completion)",
"def _WriteSessionCompletion(self, session_completion):\n if self.storage_type != definitions.STORAGE_TYPE_SESSION:\n raise IOError('Session completion n... | [
"0.6950068",
"0.5977772",
"0.56340414",
"0.51924425",
"0.4876512",
"0.4876512",
"0.4876512",
"0.4844609",
"0.47390857",
"0.472567",
"0.46709073",
"0.45725057",
"0.4548898",
"0.45407832",
"0.45048776",
"0.44969794",
"0.44601467",
"0.44586048",
"0.4446392",
"0.44140568",
"0.439... | 0.7548105 | 0 |
Writes a task start attribute container. | def _WriteTaskStart(self, task_start):
if self.storage_type != definitions.STORAGE_TYPE_TASK:
raise IOError('Task start not supported by storage type.')
stream_name = 'task_start.{0:06d}'.format(self._last_task)
if self._HasStream(stream_name):
raise IOError('Task start: {0:06d} already exists.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def WriteTaskStart(self, task_start):\n self._RaiseIfNotWritable()\n\n self._WriteTaskStart(task_start)",
"def WriteTaskStart(self):\n self._RaiseIfNotWritable()\n\n if self._storage_type != definitions.STORAGE_TYPE_TASK:\n raise IOError('Unsupported storage type.')\n\n task_start = self._tas... | [
"0.69772726",
"0.6404777",
"0.5731407",
"0.5243647",
"0.49919006",
"0.49192506",
"0.4800367",
"0.4782943",
"0.47770754",
"0.4756747",
"0.4728338",
"0.46982858",
"0.46845204",
"0.4679135",
"0.4679135",
"0.4679135",
"0.4679135",
"0.46462893",
"0.46186978",
"0.4594834",
"0.45940... | 0.7271418 | 0 |
Adds an analysis report. | def AddAnalysisReport(self, analysis_report):
self._RaiseIfNotWritable()
analysis_report_identifier = identifiers.SerializedStreamIdentifier(
self._analysis_report_stream_number, 0)
analysis_report.SetIdentifier(analysis_report_identifier)
stream_name = 'analysis_report_data.{0:06}'.format(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addAnalysis(self, analysis):\n targetuid = analysis.getRawInstrument()\n if not targetuid:\n return\n if targetuid != self.UID():\n raise Exception(\"Invalid instrument\")\n ans = self.getRawAnalyses() if self.getRawAnalyses() else []\n ans.append(analys... | [
"0.65385896",
"0.63931835",
"0.6386053",
"0.637322",
"0.59877646",
"0.59736437",
"0.5943771",
"0.5942856",
"0.593412",
"0.5844011",
"0.5749736",
"0.5729979",
"0.5702671",
"0.5686006",
"0.56660867",
"0.565026",
"0.5628879",
"0.56235725",
"0.5535109",
"0.5485418",
"0.54507554",... | 0.76410955 | 0 |
Adds an event source. | def AddEventSource(self, event_source):
self._RaiseIfNotWritable()
self._AddAttributeContainer('event_source', event_source) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddSource(self, source):\n self._sources.append(source)",
"def _add_source(self, source: _Source) -> None:\n\n self._sources.append(source)",
"def add_source(self, group_source):\n if group_source.name in self._sources:\n raise ValueError(\"GroupSource '%s': name collision\"... | [
"0.7849447",
"0.7753545",
"0.69812846",
"0.6972584",
"0.6963642",
"0.69145167",
"0.6467963",
"0.6467963",
"0.64362776",
"0.64074296",
"0.63354796",
"0.6246238",
"0.6147895",
"0.6127096",
"0.60978353",
"0.60660404",
"0.6054926",
"0.6040867",
"0.58803403",
"0.587292",
"0.587231... | 0.8051251 | 0 |
Adds an event tag. If the event referenced by the tag is already tagged, the comment and labels will be appended to the existing tag. | def AddEventTag(self, event_tag):
self._RaiseIfNotWritable()
event_identifier = event_tag.GetEventIdentifier()
if not isinstance(
event_identifier, identifiers.SerializedStreamIdentifier):
raise IOError('Unsupported event identifier type: {0:s}'.format(
type(event_identifier)))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def AddEventTag(self, event_tag):\n self._RaiseIfNotWritable()\n\n # TODO: refactor to use AddOrUpdateAttributeContainer\n self._storage_file.AddEventTag(event_tag)\n\n self._UpdateEventLabelsSessionCounter(event_tag)",
"def add_tag(self, tag):\n self.tags.append(tag)",
"def add(self, tag):\... | [
"0.76205707",
"0.7197949",
"0.70600927",
"0.6859003",
"0.68588567",
"0.66722727",
"0.6652051",
"0.646306",
"0.63962156",
"0.6211466",
"0.6185781",
"0.6138977",
"0.6014083",
"0.593904",
"0.59362257",
"0.5926929",
"0.59011835",
"0.58703506",
"0.5855975",
"0.5824863",
"0.5814485... | 0.7990911 | 0 |
Checks is the storage file format is supported. | def CheckSupportedFormat(cls, path):
try:
zip_file = zipfile.ZipFile(
path, mode='r', compression=zipfile.ZIP_DEFLATED, allowZip64=True)
with zip_file.open('metadata.txt', mode='r') as file_object:
stream_data = file_object.read()
storage_metadata_reader = _StorageMetadataReade... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _CheckStorageMetadata(cls, storage_metadata):\n if not storage_metadata.format_version:\n raise IOError('Missing format version.')\n\n if storage_metadata.format_version < cls._COMPATIBLE_FORMAT_VERSION:\n raise IOError(\n 'Format version: {0:d} is too old and no longer supported.'.for... | [
"0.71983224",
"0.6487661",
"0.64190996",
"0.6410403",
"0.6235479",
"0.61871797",
"0.617527",
"0.61338186",
"0.6120604",
"0.6119826",
"0.6106874",
"0.60792696",
"0.60760444",
"0.6065472",
"0.6048093",
"0.6008773",
"0.60074675",
"0.6000641",
"0.59919214",
"0.5979038",
"0.597258... | 0.7199038 | 0 |
Forces the serialized attribute containers to be written to file. | def Flush(self):
if not self._is_open:
raise IOError('Unable to flush a closed storage file.')
if not self._read_only:
self._WriteSerializedAttributeContainerList('event_source')
self._WriteSerializedAttributeContainerList('event_data')
self._WriteSerializedEvents()
self._WriteSer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flush(self):\n with open(self.fname, \"w\") as f:\n yaml.dump(list(self), f)",
"def _write_ce_collector_attributes_file(self, attributes_file):\n attributes_file_contents = (\n \"# Do not edit - file generated by osg-configure\\n\"\n + self.ce_attributes_str + \... | [
"0.6238798",
"0.61786866",
"0.6148997",
"0.6144327",
"0.594614",
"0.5898613",
"0.5867246",
"0.58666116",
"0.58666116",
"0.58665735",
"0.5837765",
"0.58063835",
"0.57248884",
"0.57136965",
"0.56978863",
"0.56976837",
"0.5690862",
"0.5652623",
"0.5638608",
"0.5636188",
"0.56353... | 0.67248154 | 0 |
Retrieves the analysis reports. | def GetAnalysisReports(self):
for stream_name in self._GetStreamNames():
if not stream_name.startswith('analysis_report_data.'):
continue
data_stream = _SerializedDataStream(
self._zipfile, self._temporary_path, stream_name)
for analysis_report in self._ReadAttributeContainersF... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_xml_reports(self):\n self.logger.info('[INFO] Retrieving all existing OpenVAS reports...')\n params = {\n 'cmd': 'get_reports',\n 'token': self.token,\n 'details': 0,\n 'filter': 'sort-reverse=date first=1 rows=10'\n }\n url = self.bas... | [
"0.6921372",
"0.6789204",
"0.676547",
"0.66809887",
"0.665928",
"0.65569043",
"0.6500685",
"0.6498081",
"0.6451396",
"0.6330145",
"0.63212025",
"0.6235607",
"0.6217733",
"0.6197565",
"0.6194489",
"0.61601114",
"0.61594766",
"0.615701",
"0.61129993",
"0.6105251",
"0.6093578",
... | 0.7073373 | 0 |
Retrieves the event data. | def GetEventData(self):
return self._GetAttributeContainers('event_data') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data(self) -> dict:\n return self._event.get('data')",
"def get_event():\n data = _get_process_detail_expanded_data()[\"event\"]\n return data",
"def get(self, request):\n return self.serviceHandler.getEvent(request.data)",
"def event_data(self) -> Optional[str]:\n if event_dat... | [
"0.7987123",
"0.73014694",
"0.720904",
"0.69828004",
"0.69385296",
"0.66899306",
"0.66899306",
"0.66899306",
"0.6677889",
"0.6650381",
"0.6650381",
"0.6650381",
"0.6650381",
"0.6614675",
"0.6613044",
"0.6613044",
"0.6564268",
"0.6560976",
"0.6556419",
"0.6541663",
"0.6527969"... | 0.73096675 | 1 |
Retrieves the event sources. | def GetEventSources(self):
return self._GetAttributeContainers('event_source') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sources(self) -> Sequence[Any]:\n return pulumi.get(self, \"sources\")",
"def sources(self):\n return self._sources",
"def sources(self):\n return self._sources.keys()",
"def Sources(self):\n return self._sources",
"def Sources():\n return _sources",
"def source_list(se... | [
"0.75830734",
"0.7418453",
"0.7290604",
"0.7280123",
"0.72522444",
"0.7034809",
"0.6999006",
"0.6979817",
"0.6966182",
"0.68763244",
"0.6821695",
"0.6655865",
"0.6601156",
"0.6564456",
"0.6528454",
"0.6503854",
"0.6494292",
"0.6455453",
"0.64304405",
"0.64304405",
"0.6411429"... | 0.8521639 | 0 |
Retrieves the event tags. | def GetEventTags(self):
for event_tag in self._GetAttributeContainers('event_tag'):
event_identifier = identifiers.SerializedStreamIdentifier(
event_tag.event_stream_number, event_tag.event_entry_index)
event_tag.SetEventIdentifier(event_identifier)
del event_tag.event_stream_number
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Optional[Sequence['outputs.EventSubscriptionTag']]:\n return pulumi.get(self, \"tags\")",
"def get_tags(self):\n return self.tags",
"def get_tags(self):\n resp = self.get(_u.build_uri(\"tags\", domain=self.domain))\n return utils.handle_response(resp)",
"def getT... | [
"0.7233624",
"0.718957",
"0.71583307",
"0.7136407",
"0.7045743",
"0.7043326",
"0.7041641",
"0.70070577",
"0.68949217",
"0.68949217",
"0.68949217",
"0.68949217",
"0.68949217",
"0.68949217",
"0.68949217",
"0.68949217",
"0.6889467",
"0.6805879",
"0.67974454",
"0.67785454",
"0.67... | 0.75097305 | 0 |
Retrieves the number event sources. | def GetNumberOfEventSources(self):
event_source_stream_number = self._last_stream_numbers['event_source']
number_of_event_sources = 0
for stream_number in range(1, event_source_stream_number):
offset_table = self._GetSerializedDataOffsetTable(
'event_source', stream_number)
number_of... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetEventSources(self):\n return self._GetAttributeContainers('event_source')",
"def num_sources(self):\n return len(self._sources)",
"def get_data_source_identifiers(self):\n _identifiers = []\n for lang, feed in config.RSS_NEWS_FEEDS.items():\n logger.debug(u\"consultand... | [
"0.6661163",
"0.6169244",
"0.6008212",
"0.5958574",
"0.5907551",
"0.5890889",
"0.5812237",
"0.57710767",
"0.57634705",
"0.57416856",
"0.5719241",
"0.5713429",
"0.5687834",
"0.56768656",
"0.5616146",
"0.5570782",
"0.5511642",
"0.547027",
"0.54613316",
"0.5439857",
"0.5432122",... | 0.7526929 | 0 |
Determines if a storage contains analysis reports. | def HasAnalysisReports(self):
for name in self._GetStreamNames():
if name.startswith('analysis_report_data.'):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_report(self):\n return self.report is not None",
"def exists(self):\n return len(list(self.measures)) > 0",
"def has_result(self):\n return len(self.__analysis_items) > 0",
"def has_measurement(self, filepath):\n entries = self.get_measurement(file_path=filepath, select_li... | [
"0.65954286",
"0.6223063",
"0.5999505",
"0.575136",
"0.56979525",
"0.56876224",
"0.5678352",
"0.56229055",
"0.558188",
"0.5508879",
"0.54931474",
"0.5459114",
"0.5452544",
"0.5400587",
"0.53851336",
"0.5354171",
"0.5260373",
"0.5257465",
"0.52561134",
"0.524629",
"0.52190936"... | 0.7837875 | 0 |
Determines if a store contains extraction errors. | def HasErrors(self):
for name in self._GetStreamNames():
if name.startswith('error_data.'):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_errors(self) -> bool:",
"def has_errors(self):\n return len(self.get_errors()) > 0",
"def hasErrors(self):\n return False",
"def has_errors(self):\n return self.exc_info != None",
"def check_corrupted_files(self):\r\n for store in STORES:\r\n path = f\"{self.s... | [
"0.67993927",
"0.65091723",
"0.63864994",
"0.6384781",
"0.63408303",
"0.63324267",
"0.628819",
"0.62151074",
"0.61032575",
"0.6102644",
"0.6085206",
"0.599267",
"0.59717846",
"0.5929835",
"0.5876473",
"0.5865957",
"0.58622825",
"0.5823931",
"0.580793",
"0.57927567",
"0.579233... | 0.66062623 | 1 |
Determines if a store contains event tags. | def HasEventTags(self):
for name in self._GetStreamNames():
if name.startswith('event_tag_data.'):
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_tag(self, tag):\n return tag in self.tags",
"def has_tag(self, tag):\n return tag in self.tags",
"def has_tags(self):\n return bool(self.tags)",
"def tag_push_events(self) -> bool:\n return pulumi.get(self, \"tag_push_events\")",
"def is_tagged(self,tag_name,element):\n ... | [
"0.6327343",
"0.6327343",
"0.6281228",
"0.6247088",
"0.6086548",
"0.5970882",
"0.5912927",
"0.5846111",
"0.58425444",
"0.58379984",
"0.5793907",
"0.5728825",
"0.56669146",
"0.5661681",
"0.5638894",
"0.56291234",
"0.56207544",
"0.5589858",
"0.5585546",
"0.55487937",
"0.5544867... | 0.7468961 | 0 |
Reads preprocessing information. The preprocessing information contains the system configuration which contains information about various system specific configuration data, for example the user accounts. | def ReadPreprocessingInformation(self, knowledge_base):
for stream_number in range(1, self._last_preprocess):
stream_name = 'preprocess.{0:06d}'.format(stream_number)
if not self._HasStream(stream_name):
raise IOError('No such stream: {0:s}'.format(stream_name))
data_stream = _SerializedD... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_preprocess(self) -> Dict:\n input_shape = get_input_shape(self.deploy_cfg)\n cfg = process_model_config(self.model_cfg, [''], input_shape)\n preprocess = cfg.data.test.pipeline\n return preprocess",
"def preprocess(config: Config) -> None:\n print(colored(\"preprocessing:\"... | [
"0.6242298",
"0.62286866",
"0.6083191",
"0.59809077",
"0.595083",
"0.57360613",
"0.5706195",
"0.5660718",
"0.56427324",
"0.5382124",
"0.53710824",
"0.5353663",
"0.53282666",
"0.5289456",
"0.5284319",
"0.5284319",
"0.5284319",
"0.5240413",
"0.52208734",
"0.5206525",
"0.5193773... | 0.71403676 | 0 |
Writes session completion information. | def WriteSessionCompletion(self, session_completion):
self._RaiseIfNotWritable()
self.Flush()
self._WriteSessionCompletion(session_completion)
self._last_session += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _WriteSessionCompletion(self, session_completion):\n if self.storage_type != definitions.STORAGE_TYPE_SESSION:\n raise IOError('Session completion not supported by storage type.')\n\n stream_name = 'session_completion.{0:06d}'.format(self._last_session)\n if self._HasStream(stream_name):\n r... | [
"0.7823665",
"0.6673823",
"0.6360151",
"0.62387955",
"0.5577296",
"0.54917103",
"0.5396783",
"0.5344463",
"0.52608216",
"0.52128804",
"0.5198021",
"0.5189507",
"0.5185818",
"0.51548254",
"0.5150567",
"0.51436865",
"0.5114942",
"0.5070476",
"0.50364995",
"0.503444",
"0.5019208... | 0.78640306 | 0 |
Writes session start information. | def WriteSessionStart(self, session_start):
self._RaiseIfNotWritable()
self._WriteSessionStart(session_start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _WriteSessionStart(self, session_start):\n if self.storage_type != definitions.STORAGE_TYPE_SESSION:\n raise IOError('Session completion not supported by storage type.')\n\n stream_name = 'session_start.{0:06d}'.format(self._last_session)\n if self._HasStream(stream_name):\n raise IOError('S... | [
"0.7723903",
"0.75372565",
"0.6444815",
"0.60409415",
"0.6009195",
"0.6009195",
"0.5963674",
"0.5962101",
"0.5856418",
"0.57502675",
"0.5743126",
"0.5740319",
"0.5695669",
"0.56913924",
"0.5688742",
"0.5640327",
"0.5634623",
"0.5634623",
"0.56212616",
"0.56212616",
"0.5621261... | 0.7783428 | 0 |
Writes task completion information. | def WriteTaskCompletion(self, task_completion):
self._RaiseIfNotWritable()
self.Flush()
self._WriteTaskCompletion(task_completion) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _WriteTaskCompletion(self, task_completion):\n if self.storage_type != definitions.STORAGE_TYPE_TASK:\n raise IOError('Task completion not supported by storage type.')\n\n stream_name = 'task_completion.{0:06d}'.format(self._last_task)\n if self._HasStream(stream_name):\n raise IOError('Task... | [
"0.79263794",
"0.7206771",
"0.6113033",
"0.59012973",
"0.58079386",
"0.57999647",
"0.57804745",
"0.57656544",
"0.5761853",
"0.5688386",
"0.5643675",
"0.5643675",
"0.56264406",
"0.56245214",
"0.5594058",
"0.5532725",
"0.551941",
"0.55034614",
"0.54860115",
"0.54616725",
"0.544... | 0.79203457 | 1 |
Writes task start information. | def WriteTaskStart(self, task_start):
self._RaiseIfNotWritable()
self._WriteTaskStart(task_start) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _WriteTaskStart(self, task_start):\n if self.storage_type != definitions.STORAGE_TYPE_TASK:\n raise IOError('Task start not supported by storage type.')\n\n stream_name = 'task_start.{0:06d}'.format(self._last_task)\n if self._HasStream(stream_name):\n raise IOError('Task start: {0:06d} alre... | [
"0.8021836",
"0.7855516",
"0.7364299",
"0.6193676",
"0.58861095",
"0.5835174",
"0.5814982",
"0.5797533",
"0.5718188",
"0.5675635",
"0.56735414",
"0.56376076",
"0.5614991",
"0.5614338",
"0.554593",
"0.55233437",
"0.5512431",
"0.5501707",
"0.54853034",
"0.54591626",
"0.5457021"... | 0.8007252 | 1 |
Creates a storage file. | def _CreateStorageFile(self):
if self._storage_type == definitions.STORAGE_TYPE_TASK:
return gzip_file.GZIPStorageFile(storage_type=self._storage_type)
return ZIPStorageFile(
maximum_buffer_size=self._buffer_size,
storage_type=self._storage_type) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _CreateStorageFile(self):\n return sqlite_file.SQLiteStorageFile(storage_type=self._storage_type)",
"def create(self):\n self.create_file()",
"def create_file(self, filename):\n self.response.write('Creating file %s\\n' % filename)\n\n write_retry_params = gcs.RetryParams(backoff_factor=1.1... | [
"0.75127065",
"0.7293009",
"0.6958212",
"0.69303864",
"0.68748605",
"0.6800408",
"0.67757326",
"0.6713447",
"0.6618461",
"0.6422884",
"0.6396458",
"0.6376631",
"0.63447905",
"0.63321555",
"0.63223684",
"0.6278823",
"0.62736267",
"0.62588155",
"0.6228026",
"0.6190709",
"0.6111... | 0.74270225 | 1 |
Creates a task storage merge reader. | def _CreateTaskStorageMergeReader(self, path):
return gzip_file.GZIPStorageMergeReader(self, path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, session, storage_writer, task_storage_reader):\n super(StorageMergeReader, self).__init__()\n self._active_container_type = None\n self._active_generator = None\n self._container_types = []\n self._event_data_identifier_mappings = {}\n self._event_data_parser_mappings = {}\n ... | [
"0.6713358",
"0.64108163",
"0.5615521",
"0.52308583",
"0.51918554",
"0.5165484",
"0.5102821",
"0.5072666",
"0.5019426",
"0.4985811",
"0.4886272",
"0.48803064",
"0.4828319",
"0.4788022",
"0.4778609",
"0.47550967",
"0.4739019",
"0.46901476",
"0.46882945",
"0.465802",
"0.4654160... | 0.7269934 | 0 |
Creates a task storage writer. | def _CreateTaskStorageWriter(self, path, task):
return ZIPStorageFileWriter(
self._session, path, buffer_size=self._buffer_size,
storage_type=definitions.STORAGE_TYPE_TASK, task=task) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _CreateStorageFile(self):\n if self._storage_type == definitions.STORAGE_TYPE_TASK:\n return gzip_file.GZIPStorageFile(storage_type=self._storage_type)\n\n return ZIPStorageFile(\n maximum_buffer_size=self._buffer_size,\n storage_type=self._storage_type)",
"def _CreateStorageFile(sel... | [
"0.6415262",
"0.614518",
"0.6050379",
"0.5823632",
"0.5812288",
"0.5760296",
"0.5664288",
"0.561689",
"0.55858594",
"0.5561826",
"0.5377137",
"0.5362557",
"0.53191864",
"0.5285125",
"0.52829856",
"0.52504057",
"0.5250336",
"0.5240221",
"0.5237571",
"0.5207537",
"0.51788354",
... | 0.82884496 | 0 |
Look for MPs who do not have a related Constituency | def _find_homeless_mps(self):
mps = Person.objects.filter(
active=True,
house__name=HOUSE_OF_COMMONS,
constituency=None,
)
self.stdout('MPs with missing constituency:')
for mp in mps:
self.stdout(f' [{mp.parliamentdotuk}] {mp.name} has no ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_memberless_constituencies(self):\n constituencies = Constituency.objects.filter(\n end=None, # Constituency currently exists/is not historical\n mp=None,\n )\n\n self.stdout('Constituencies with missing MP:')\n for constituency in constituencies:\n ... | [
"0.76170367",
"0.5829021",
"0.5756624",
"0.5606345",
"0.5606345",
"0.54469514",
"0.5405976",
"0.5301419",
"0.52981687",
"0.525292",
"0.525292",
"0.521668",
"0.52096975",
"0.5197598",
"0.51684356",
"0.51608056",
"0.5140465",
"0.5087299",
"0.5086249",
"0.5006192",
"0.5002842",
... | 0.6189591 | 1 |
Look for constituencies that do not have a related MP. | def _find_memberless_constituencies(self):
constituencies = Constituency.objects.filter(
end=None, # Constituency currently exists/is not historical
mp=None,
)
self.stdout('Constituencies with missing MP:')
for constituency in constituencies:
self.std... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _find_homeless_mps(self):\n mps = Person.objects.filter(\n active=True,\n house__name=HOUSE_OF_COMMONS,\n constituency=None,\n )\n\n self.stdout('MPs with missing constituency:')\n for mp in mps:\n self.stdout(f' [{mp.parliamentdotuk}] {mp... | [
"0.65262073",
"0.58401227",
"0.58401227",
"0.5789466",
"0.5687406",
"0.5613603",
"0.5296705",
"0.5180554",
"0.51251245",
"0.5118681",
"0.51051486",
"0.509341",
"0.508355",
"0.50430495",
"0.5039772",
"0.50376207",
"0.50227773",
"0.50118464",
"0.49933347",
"0.49915892",
"0.4990... | 0.8207443 | 0 |
Takes a list of words, and a list of teams. Attempts to find a team name in the first couple words in the words list. returns the team and the list of remaining words. | def check_valid_team(words, teams):
# <= 1 since if we only get "jets" it doesn't mean anything,
# same as only mentioning us in a comment.
if len(words) <= 1:
return None, []
# this is either a legit single team name and stat, or a two name team that
# isn't valid since ther... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(self, word_list, expecting):\n\n if word_list:\n\n word = word_list.pop(0)\n\n if word[0] == expecting:\n return word\n else:\n return None\n else:\n return None",
"def check_player_name(words):\n\n # check for a... | [
"0.6371898",
"0.5840516",
"0.5719892",
"0.56747544",
"0.56489897",
"0.5604297",
"0.55830276",
"0.55691195",
"0.5549665",
"0.55308324",
"0.5522546",
"0.5490373",
"0.5468722",
"0.54535407",
"0.5449729",
"0.5449677",
"0.54273826",
"0.54152775",
"0.5406112",
"0.53974634",
"0.5356... | 0.73230296 | 0 |
takes a list of words and trys to find a player in the NHL that has this name. this function will return any players that share this name. | def check_player_name(words):
# check for a player by looking at all the words as a string then working backwards.
for x in reversed(range(len(words) + 1)):
name = words[:x]
remaining = words[x:]
if name == []:
continue
player = nhl_players.get_player(_make_name(n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_player_by_name(players_table, name):\r\n result = players_table.search(Query().Nom == name)\r\n print(result)",
"def find_player(self, name):\n for index in range(0, len(self.player_list)):\n if self.player_list[index].name == name:\n return self.player_l... | [
"0.64932746",
"0.6394125",
"0.63679504",
"0.6127331",
"0.6064719",
"0.60376877",
"0.59716505",
"0.5939126",
"0.5878761",
"0.583335",
"0.5804437",
"0.57025254",
"0.5682146",
"0.559104",
"0.5587993",
"0.5571553",
"0.55691564",
"0.5552805",
"0.55349034",
"0.553366",
"0.5515469",... | 0.68504566 | 0 |
Tests that search_type='scan' is not added to the search parameters | def test_scroll_no_searchtype_scan(self):
self._validate_scroll_search_params({}, {"sort": "_doc"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_validate_search_no_input():\n payload = {\"search_object_types\": []}\n result = validate_search_payload(payload)\n assert result[\"errors\"] == \"No search_input string for search received.\"",
"def test_search_no_params_error(self):\n self.assertRaises(\n TypeError,\n ... | [
"0.64626616",
"0.6450026",
"0.63939446",
"0.63468224",
"0.6336124",
"0.6315028",
"0.6292723",
"0.6217686",
"0.6217686",
"0.6217686",
"0.61544555",
"0.61242384",
"0.610538",
"0.6100472",
"0.59511054",
"0.59406",
"0.59285086",
"0.5917705",
"0.5905275",
"0.5874371",
"0.5845932",... | 0.7018856 | 0 |
Tests that a provided ``sort`` query will not be overwritten | def test_scroll_query_sort_safe(self):
self._validate_scroll_search_params({"sort": "_id"}, {"sort": "_id"}) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sortby_invalid(self):\n qs = {'a': 1, 'w': 4, 'format': 'json', 'sortby': ''}\n response = self.client.get(reverse('search.advanced'), qs)\n eq_(200, response.status_code)",
"def testSorting(self):\n if self.sorting in tools.SORTINGS:\n self.assertEqual(\n ... | [
"0.67506635",
"0.6684771",
"0.6630986",
"0.65249383",
"0.6444581",
"0.6326027",
"0.6189432",
"0.6140709",
"0.61213666",
"0.6117645",
"0.61084646",
"0.60952646",
"0.6035216",
"0.6018825",
"0.59534085",
"0.59374356",
"0.5930617",
"0.58961",
"0.58918804",
"0.5847658",
"0.5795765... | 0.7175575 | 0 |
Call adapter.scroll() and test that the resulting API search parameters match what we expect. | def _validate_scroll_search_params(self, scroll_query, search_query):
scroll_kw = {
"scroll": "1m",
"size": 10,
}
with patch.object(self.adapter._es, "search", return_value={}) as search:
list(self.adapter.scroll(scroll_query, **scroll_kw))
search.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_scroll_query_extended(self):\n self._validate_scroll_search_params({\"_id\": \"abc\"},\n {\"_id\": \"abc\", \"sort\": \"_doc\"})",
"def test_search(self):\n self.elasticsearch_cls().search.return_value = {\n 'hits': {\n '... | [
"0.7380494",
"0.6532563",
"0.6387419",
"0.61652106",
"0.6150378",
"0.6123976",
"0.5961826",
"0.5892444",
"0.5882124",
"0.5758778",
"0.57417923",
"0.5724716",
"0.57166857",
"0.5702444",
"0.56914574",
"0.5600665",
"0.5547989",
"0.5517076",
"0.54866207",
"0.5485684",
"0.5485426"... | 0.7646427 | 0 |
Ensure the ``bulk()`` method supports generators and does not attempt to iterate over its ``actions`` argument more than once. | def test_bulk_iterates_actions_only_once(self):
doc = self._make_doc()
actions = OneshotIterable([BulkActionItem.index(doc)])
self.adapter.bulk(actions) # does not raise IterableExhaustedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_bulk(self, args):\n pass",
"def test_bulk(es_bulk, mock_es_client):\n actions = []\n chunk_size = 10\n elasticsearch.bulk(actions=actions, chunk_size=chunk_size)\n\n es_bulk.assert_called_with(\n mock_es_client.return_value,\n actions=actions,\n chunk_size=chunk_siz... | [
"0.6888053",
"0.65075827",
"0.63100237",
"0.6070495",
"0.5917244",
"0.5878336",
"0.57130563",
"0.56787074",
"0.5614333",
"0.5557834",
"0.54342365",
"0.54131556",
"0.5381655",
"0.5379164",
"0.5373076",
"0.53695256",
"0.5328438",
"0.5297943",
"0.5284468",
"0.52780294",
"0.52678... | 0.7530292 | 0 |
Ensure the ``bulk_index()`` method supports generators and does not attempt to iterate over its ``docs`` argument more than once. | def test_bulk_index_iterates_docs_only_once(self):
doc = self._make_doc()
docs = OneshotIterable([doc])
self.adapter.bulk_index(docs) # does not raise IterableExhaustedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bulk_iterates_actions_only_once(self):\n doc = self._make_doc()\n actions = OneshotIterable([BulkActionItem.index(doc)])\n self.adapter.bulk(actions) # does not raise IterableExhaustedError",
"def test_bulk_delete_iterates_doc_ids_only_once(self):\n doc = self._index_new_doc... | [
"0.71149594",
"0.668128",
"0.6562171",
"0.644726",
"0.64404184",
"0.64075756",
"0.6267306",
"0.62624854",
"0.6133205",
"0.58717734",
"0.5862288",
"0.5850662",
"0.58085126",
"0.5773968",
"0.5756377",
"0.5747866",
"0.5746752",
"0.5736576",
"0.5711189",
"0.570794",
"0.5699223",
... | 0.7930352 | 0 |
Ensure the ``bulk_delete()`` method supports generators and does not attempt to iterate over its ``doc_ids`` argument more than once. | def test_bulk_delete_iterates_doc_ids_only_once(self):
doc = self._index_new_doc()
doc_ids = OneshotIterable([doc["_id"]])
self.adapter.bulk_delete(doc_ids) # does not raise IterableExhaustedError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_delete_many(self):\n\n # That one fails in r5 (because of improper handling of batches)\n\n doc_count = 10\n ids = [get_rand_string() for x in range(doc_count)]\n\n # Same data and user_id for all documents\n data = user_id = get_rand_string()\n\n for id in ids:\n... | [
"0.67693573",
"0.6430098",
"0.6292055",
"0.6242182",
"0.6121968",
"0.6090345",
"0.6039538",
"0.60038257",
"0.59494203",
"0.58510923",
"0.58231217",
"0.57536626",
"0.57399625",
"0.5732809",
"0.5723127",
"0.5711139",
"0.5649903",
"0.56208956",
"0.5608193",
"0.5540394",
"0.55207... | 0.80195016 | 0 |
Convenience method for getting a ``dict`` of search results. | def _search_hits_dict(self, query):
return docs_to_dict(docs_from_result(self.adapter.search(query))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serializeSearchResult( result ):\n print( result.__dict__ )\n return { k: getattr( result, k ) for k in result.__dict__ }",
"def do_search(self, *args, **kwargs):\n return [{}]",
"def json(self) -> dict:\n search = {\n 'criteria': self.search_criteria,\n 'matchesEx... | [
"0.70341396",
"0.6879238",
"0.66619337",
"0.6646562",
"0.6543596",
"0.6522685",
"0.65081024",
"0.65023595",
"0.6500883",
"0.6442507",
"0.6406612",
"0.6370556",
"0.6321378",
"0.6273123",
"0.6213167",
"0.615721",
"0.6127758",
"0.6113815",
"0.6110201",
"0.6075903",
"0.60754114",... | 0.71762836 | 0 |
Bulk delete items are not equal when instantiated via different args because the BulkActionItem cannot know that an ID belongs to a specifc document (the ID alone does not carry sufficient information to make this connection). | def test_delete_delete_and_delete_id_not_equal(self):
doc = TestDoc("1", "test")
self.assertNotEqual(
BulkActionItem.delete(doc),
BulkActionItem.delete_id(doc.id),
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_bulk_delete_iterates_doc_ids_only_once(self):\n doc = self._index_new_doc()\n doc_ids = OneshotIterable([doc[\"_id\"]])\n self.adapter.bulk_delete(doc_ids) # does not raise IterableExhaustedError",
"def test_delete_item_using_delete(self):\n pass",
"def delete(self, *item_... | [
"0.6772048",
"0.64505893",
"0.63310134",
"0.627077",
"0.62238544",
"0.6027178",
"0.5809681",
"0.5803224",
"0.5750932",
"0.57376575",
"0.57266676",
"0.5709165",
"0.5687424",
"0.565716",
"0.5650103",
"0.5596356",
"0.5593409",
"0.558353",
"0.55536926",
"0.55391777",
"0.55347383"... | 0.74139714 | 0 |
First creates a CellReference to subcell, then adds this to topcell at location center | def add(topcell, subcell, center=(0,0)):
topcell.add(gdspy.CellReference(subcell, origin=center)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cell(self, top_elt, left_elt, content, color=None):\n assert left_elt in self._cells[top_elt], (\n \"%s in not a valid row in the chart %s\" % (left_elt, self._tag))\n if color:\n this_content = r\"\\cellcolor{%s}%s\" % (color, str(content))\n else:\n t... | [
"0.5927414",
"0.57632285",
"0.56992185",
"0.55965304",
"0.5561871",
"0.5544715",
"0.546917",
"0.542453",
"0.53410935",
"0.533207",
"0.53060174",
"0.52948546",
"0.5258717",
"0.52494925",
"0.5188421",
"0.51743203",
"0.5166687",
"0.51633114",
"0.51422215",
"0.51369154",
"0.51346... | 0.8201878 | 0 |
Builds the appropriate mask according to the resist specifications and fabrication type. Does this by applying a boolean 'XOR' or 'AND' operation on the waveguide and clad masks. | def build_mask(cell, wgt, final_layer=None, final_datatype=None):
fl = wgt.clad_layer+1 if final_layer==None else final_layer
fd = 0 if final_datatype==None else final_datatype
polygons = cell.get_polygons(by_spec=True)
try:
pWG = polygons[(wgt.wg_layer, wgt.wg_datatype)]
pCLAD = polygo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmask(self):\n mask = np.zeros(18)\n if 'full' in self.CONS: mask[:] = 1\n if 'f0' in self.CONS: mask[0] = 1\n if 'f1' in self.CONS: mask[1:4] = 1\n if 'f2' in self.CONS: mask[4:10] = 1\n if 'vx' in self.CONS: mask[10] = 1\n if 'vy' in self.CONS: mask[11] = 1\n ... | [
"0.65925026",
"0.6328036",
"0.62108564",
"0.6125552",
"0.60688376",
"0.60229695",
"0.60171306",
"0.6016303",
"0.59844947",
"0.589246",
"0.58711827",
"0.5852325",
"0.5832413",
"0.5784308",
"0.57785887",
"0.57758254",
"0.57392377",
"0.5727882",
"0.57004464",
"0.56932414",
"0.56... | 0.6793375 | 0 |
Returns the total length of a curved waveguide trace. | def get_trace_length(trace, wgt):
length = 0.0
dbr = 2*wgt.bend_radius - 0.5*np.pi*wgt.bend_radius
for i in range(len(trace)-1):
pt2, pt1 = trace[i+1], trace[i]
length += np.sqrt((pt2[0]-pt1[0])**2 + (pt2[1]-pt1[1])**2)
length = length - (dbr*(len(trace)-1))
return length | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_length(self):\n # YOUR CODE HERE\n return abs(self.radius*self.angle)",
"def __CalculateLength(self, curve):\r\n return cv2.arcLength(curve, True)",
"def getLength(self) -> float:\n return self.length",
"def Length(self):\n xyza = self.ga_ref.get_position() + self... | [
"0.69565266",
"0.681674",
"0.67585766",
"0.6701987",
"0.6646274",
"0.66441643",
"0.66255116",
"0.6536774",
"0.65123326",
"0.6497994",
"0.6489925",
"0.64561856",
"0.6409758",
"0.6345553",
"0.6330297",
"0.6301652",
"0.6295034",
"0.62904",
"0.6266506",
"0.62480396",
"0.6236588",... | 0.7113614 | 0 |
Returns a list of the keys available in a portlist, such as 'input', 'output', 'top_output', etc. Only works for picwriter components. | def get_keys(cell):
return list(cell.portlist.keys()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def return_keys(self):\r\n\r\n keys = list(self.piDD.keys())\r\n return keys",
"def get_key_list(self) -> list:\n return self.key_functs.keys()",
"def list_configuration_keys() -> Tuple[List[str], Dict[int, str]]:\n lookup = {i: v for (i, v) in enumerate(PipetteConfigurations.__fields__... | [
"0.6549322",
"0.6312085",
"0.6295959",
"0.6220043",
"0.6163193",
"0.61553943",
"0.6134469",
"0.6060982",
"0.6049936",
"0.60410315",
"0.602976",
"0.5957348",
"0.59338564",
"0.59169537",
"0.58780706",
"0.5874372",
"0.58608025",
"0.58448017",
"0.58134276",
"0.5797621",
"0.579745... | 0.78791136 | 0 |
Returns a cardinal direction (``'NORTH'``, ``'WEST'``, ``'SOUTH'``, and ``'EAST'``) that corresponds to a cartesian point `pt1 (tuple), pointing TOWARDS a second point `pt2` | def get_direction(pt1, pt2):
dx, dy = pt2[0]-pt1[0], pt2[1]-pt1[1]
if abs(dx)<=TOL and dy>0:
return "NORTH"
elif abs(dy)<=TOL and dx<0:
return "WEST"
elif abs(dx)<=TOL and dy<0:
return "SOUTH"
else:
return "EAST" | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_direction(self, c1, c2):\n \n if c2[0] == c1[0]+1: return NORTH\n elif c2[1] == c1[1]+1: return EAST\n elif c2[0] == c1[0]-1: return SOUTH\n elif c2[1] == c1[1]-1: return WEST\n\n raise ValueError",
"def direction(point0, point1):\n d = [0, 0, 0]\n vect... | [
"0.67694086",
"0.6562339",
"0.6437842",
"0.6371046",
"0.63692033",
"0.6339243",
"0.610926",
"0.60857844",
"0.6046521",
"0.6014199",
"0.5969566",
"0.59546286",
"0.5938745",
"0.5931146",
"0.5860227",
"0.583957",
"0.58263224",
"0.58075404",
"0.57712764",
"0.5770579",
"0.576815",... | 0.76247746 | 0 |
Returns an angle (+pi/2 or pi/2) corresponding to the CW or CCW turns that takes you from direction `dir1` to `dir2`, where each direction is either ``'NORTH'``, ``'WEST'``, ``'SOUTH'``, or ``'EAST'`` | def get_turn(dir1, dir2):
if (dir1=="NORTH" and dir2=="WEST") or (dir1=="WEST" and dir2=="SOUTH") or (dir1=="SOUTH" and dir2=="EAST") or (dir1=="EAST" and dir2=="NORTH"):
return np.pi/2.0
elif (dir1=="NORTH" and dir2=="EAST") or (dir1=="EAST" and dir2=="SOUTH") or (dir1=="SOUTH" and dir2=="WEST") or (di... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compute_angle(self, direction):\n scaled_cosine = self.w1.dot(direction) # ||direction|| cos(theta)\n scaled_sine = self.w2.dot(direction) # ||direction|| sin(theta)\n return np.arctan2(scaled_sine, scaled_cosine)",
"def direction(point0, point1):\n d = [0, 0, 0]\n vector = [poin... | [
"0.78944105",
"0.69353914",
"0.69078493",
"0.69036925",
"0.6821168",
"0.68017197",
"0.6770645",
"0.6692052",
"0.66724586",
"0.6666434",
"0.6609828",
"0.65811193",
"0.65788823",
"0.65763617",
"0.6569194",
"0.65182817",
"0.6517897",
"0.6512662",
"0.64895123",
"0.6486397",
"0.64... | 0.79123646 | 0 |
Returns the point (tuple) corresponding to `pt` translated by distance `length` in direction `direction` where each direction is either ``'NORTH'``, ``'WEST'``, ``'SOUTH'``, or ``'EAST'`` | def translate_point(pt, length, direction):
if isinstance(direction,float):
# direction is a float (in radians)
return (pt[0]+length*np.cos(direction), pt[1]+length*np.sin(direction))
elif str(direction)=="NORTH":
return (pt[0], pt[1]+length)
elif str(direction)=="SOUTH":
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def point (p, direction: str):\n def wrap (magnitude: int):\n change = changes [direction]\n return (\n p [0] + (change [0] * magnitude),\n p [1] + (change [1] * magnitude),\n )\n return wrap",
"def point(pt, angle, dist):\n x, y = pt\n return dist * cos(ang... | [
"0.61325675",
"0.5985042",
"0.57694566",
"0.56129307",
"0.55129373",
"0.5511356",
"0.5483419",
"0.5347633",
"0.5319454",
"0.52783155",
"0.526859",
"0.5253147",
"0.52256113",
"0.52186066",
"0.5215894",
"0.5181785",
"0.5146408",
"0.5129545",
"0.5102451",
"0.5100147",
"0.5081336... | 0.8260877 | 0 |
Could not import the GUI. For instructions on how to install the GUI, check the docs janclemenslab.org/das/install.html. | def no_xb_gui():
logger.warning("Could not import the GUI.")
logger.warning("For instructions on how to install the GUI,")
logger.warning("check the docs janclemenslab.org/das/install.html.") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gui(start=True,exit_on_quit=True):\n if matplotlib_imported:\n from holoviews.plotting import mpl\n plt.switch_backend('TkAgg')\n auto_import_commands()\n if start:\n import topo.tkgui\n topo.tkgui.start(exit_on_quit=exit_on_quit)",
"def load_gui():\r\n\r\n print(\"\\n... | [
"0.63088745",
"0.61080617",
"0.610396",
"0.60894454",
"0.5990365",
"0.58796054",
"0.5829545",
"0.57710797",
"0.5676334",
"0.5651206",
"0.56315875",
"0.5568978",
"0.5568608",
"0.55680704",
"0.55376726",
"0.55376214",
"0.5520617",
"0.54997945",
"0.54975086",
"0.54588825",
"0.54... | 0.7626027 | 0 |
Create new models for all of the collaborators in the experiment. | def setup(self, num_collaborators, **kwargs):
return [
FederatedModel(
self.build_model,
optimizer=self.lambda_opt,
loss_fn=self.loss_fn,
data_loader=data_slice,
**kwargs
)
for data_slice in self.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collaborators(self, collaborators):\n\n self._collaborators = collaborators",
"def create_models( self ):",
"def create_models(self):\n model_list = []\n for i in range(0, len(self.X.cluster.unique())):\n foo_model = self.model\n foo_model.set_params(**self.best_p... | [
"0.6216371",
"0.6174882",
"0.6096427",
"0.6025518",
"0.5875234",
"0.5855447",
"0.5767507",
"0.5735939",
"0.5735939",
"0.5705685",
"0.5647111",
"0.5572333",
"0.55581456",
"0.555594",
"0.5530825",
"0.5510627",
"0.55028343",
"0.54727226",
"0.54011875",
"0.54011875",
"0.5389237",... | 0.68120235 | 0 |
Compute a tensor by combining two tensors with a mask | def masked_tensor(tensor0, tensor1, mask):
s = tensor0.size()
assert s[0] == mask.size()[0]
m = mask
for i in range(len(s) - 1):
m = mask.unsqueeze(-1)
m = m.repeat(1, *s[1:])
m = m.float()
out = ((1.0 - m) * tensor0 + m * tensor1).type(tensor0.dtype)
return out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_real_mask(tf_rep, mask, dim=1):\n return tf_rep * mask",
"def apply_mag_mask(tf_rep, mask, dim=1):\n mask = torch.cat([mask, mask], dim=dim)\n return tf_rep * mask",
"def compute_attention_mask(x_mask, mem_mask, x_word_dim, key_word_dim):\r\n if x_mask is None and mem_mask is None:\r\n ... | [
"0.6636588",
"0.6570612",
"0.6520569",
"0.6519512",
"0.65085775",
"0.6434695",
"0.63612396",
"0.63472354",
"0.6309858",
"0.625605",
"0.6235168",
"0.61855304",
"0.6182539",
"0.6148149",
"0.6096267",
"0.6069685",
"0.6059654",
"0.6058385",
"0.6029975",
"0.6025629",
"0.60237974",... | 0.80703586 | 0 |
Initilize pitch predictor module. | def __init__(self, idim, n_layers=5, n_chans=384, odim=2, kernel_size=5,
dropout_rate=0.1, padding="SAME"):
super(PitchPredictor, self).__init__()
self.conv = torch.nn.ModuleList()
self.kernel_size = kernel_size
self.padding = padding
for idx in range(n_layers):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, idim, n_layers=5, n_chans=384, odim=2, kernel_size=5, dropout_rate=0.1, padding='SAME'):\n super(PitchPredictor, self).__init__()\n self.conv = torch.nn.ModuleList()\n self.kernel_size = kernel_size\n self.padding = padding\n for idx in range(n_layers):\n ... | [
"0.6609146",
"0.64983785",
"0.64858454",
"0.63311934",
"0.62553966",
"0.6239923",
"0.62093085",
"0.6152067",
"0.6119865",
"0.5979409",
"0.59680265",
"0.59477574",
"0.5943124",
"0.5943124",
"0.5943124",
"0.59424174",
"0.592197",
"0.5891267",
"0.5889453",
"0.5868705",
"0.586870... | 0.6656067 | 1 |
This function checks the found candidates if we can set the session.auto_start to 1 by finding a length of the header to overwrite the HTTP_EBUT to PHP_VALUE. | def test_QSL_candidates(candidates, header_value_length):
print("⚙️ Testing found candidates")
r = True
# Set session.auto_start=1 and find a length of the header to have a buffer overflow
# %0A for newline \n <LF>
for candidate in candidates:
print("\t[Test] QSL Candidate: ", candidate)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deactivate_sessionAutoStart():\n\n # Trying to set session.auto_start=0\n for candidate in qsl_candidates:\n res = requests.get(target+\"/PHP_VALUE%0Asession.auto_start=0;;;?\"+(repeat_to_length(postfix, candidate-2)), headers={\"User-Agent\":\"CVE-2019-11043\",\"TUD\":(\"A\"*session_hvl), hash_st... | [
"0.6631584",
"0.48900947",
"0.4850976",
"0.48310906",
"0.4779397",
"0.4776581",
"0.47642475",
"0.4761517",
"0.47516435",
"0.47266003",
"0.47130746",
"0.46921724",
"0.4677502",
"0.4676652",
"0.46671832",
"0.46578994",
"0.46578994",
"0.4633294",
"0.46251807",
"0.45843682",
"0.4... | 0.6562646 | 1 |
This method tries to set the session.auto_start to 0 for all found candidates | def deactivate_sessionAutoStart():
# Trying to set session.auto_start=0
for candidate in qsl_candidates:
res = requests.get(target+"/PHP_VALUE%0Asession.auto_start=0;;;?"+(repeat_to_length(postfix, candidate-2)), headers={"User-Agent":"CVE-2019-11043","TUD":("A"*session_hvl), hash_strndup:header_value}... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_automatic_session_management(self):\n self._session_management = AUTOMATIC",
"def use_automatic_session_management(self):\n self._session_management = AUTOMATIC",
"def pytest_sessionstart(self, session):\n self.nodemanager = NodeManager(self.config)\n nodes = self.nodemanage... | [
"0.62653315",
"0.62653315",
"0.5944506",
"0.5874306",
"0.57984257",
"0.57610595",
"0.57610595",
"0.5595754",
"0.5467378",
"0.545285",
"0.5434523",
"0.54305",
"0.541961",
"0.5397855",
"0.5370155",
"0.5358177",
"0.5343956",
"0.5337176",
"0.5287941",
"0.5275531",
"0.5275216",
... | 0.7006267 | 0 |
Constructs a matplotlib patch from a geometric object The `polygon` may be a Shapely or GeoJSONlike object with or without holes. The `kwargs` are those supported by the matplotlib.patches.Polygon class constructor. Returns an instance of matplotlib.patches.PathPatch. | def PolygonPatch(polygon, **kwargs):
return PathPatch(PolygonPath(polygon), **kwargs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def PolygonPath(polygon):\n\n def coding(ob):\n # The codes will be all \"LINETO\" commands, except for \"MOVETO\"s at the\n # beginning of each subpath\n n = len(getattr(ob, 'coords', None) or ob)\n vals = ones(n, dtype=Path.code_type) * Path.LINETO\n vals[0] = Path.MOVETO\n ... | [
"0.699025",
"0.672891",
"0.62968045",
"0.6182232",
"0.6067647",
"0.6019486",
"0.597143",
"0.58860385",
"0.58334553",
"0.5767161",
"0.5625599",
"0.5540032",
"0.5481153",
"0.54650736",
"0.5408059",
"0.54055893",
"0.5385157",
"0.53399146",
"0.5315714",
"0.531045",
"0.53038687",
... | 0.8349795 | 0 |
! Open the session. This method does everything necessary to begin a debug session. It first loads the user script, if there is one. The user script will be available via the _user_script_proxy_ property. Then it opens the debug probe and sets the clock rate from the `frequency` user option. Finally, it inits the board... | def open(self, init_board=True):
if not self._inited:
assert self._probe is not None, "Cannot open a session without a probe."
assert self._board is not None, "Must have a board to open a session."
# Load the user script just before we init everything.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_if_needed(self):\n if self.session is None:\n raise RunnerTerminalSessionClosed()\n self.session.initialize_if_needed()",
"def __init__(self):\n\n # For now, we'll connect to the target via the Apollo debug controller.\n # This should be replaced by a high-sp... | [
"0.5535472",
"0.54796183",
"0.54561996",
"0.5398516",
"0.5320873",
"0.5299165",
"0.5254467",
"0.52143246",
"0.5199583",
"0.51786506",
"0.5173664",
"0.5166555",
"0.51175183",
"0.50994337",
"0.5094854",
"0.50927037",
"0.50809133",
"0.5080023",
"0.50782865",
"0.5064851",
"0.5051... | 0.7415482 | 0 |
! Close the session. Uninits the board and disconnects then closes the probe. | def close(self):
if self._closed:
return
self._closed = True
LOG.debug("uninit session %s", self)
if self._inited:
try:
self.board.uninit()
self._inited = False
except:
LOG.error("exception during board ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quit(self):\n \n if 'driver' in self.__dict__:\n self.driver.quit()\n if 'session' in self.__dict__:\n self.session.close()\n if 'conn' in self.__dict__:\n self.conn.close()",
"def close_session(self):\n self.driver.close()",
"def close(self):\n\n\t\t# close connecti... | [
"0.65809786",
"0.6405194",
"0.6341858",
"0.62943995",
"0.6223247",
"0.6132271",
"0.61127883",
"0.60823303",
"0.6060978",
"0.60451585",
"0.6040185",
"0.6038261",
"0.6018699",
"0.60169506",
"0.6015885",
"0.6010859",
"0.6007185",
"0.6000283",
"0.59820074",
"0.5980707",
"0.597711... | 0.83011067 | 0 |
Apply scaling to application | def scale(self, app: Application) -> bool:
pass | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale(self):",
"def handle_scaling():\n os_type = platform.system()\n if os_type == \"Windows\":\n from ctypes import windll\n windll.user32.SetProcessDPIAware()",
"def scale(self, _: Application) -> bool:\n return False",
"def map_to_app_autoscale(self, app):\n self.aut... | [
"0.7441644",
"0.69552535",
"0.687245",
"0.6790628",
"0.66800094",
"0.6496485",
"0.6487396",
"0.64467245",
"0.64451",
"0.6362966",
"0.635604",
"0.6317762",
"0.630603",
"0.6301924",
"0.62845886",
"0.6266795",
"0.625103",
"0.62478894",
"0.62371075",
"0.6232715",
"0.62135124",
... | 0.72541636 | 1 |
Searches attribute table based on search bar test | def searchAttributes(self):
search_string = self.attr_search.text()
for rowIndex in range(self.attributeTable.rowCount()):
twItem = self.attributeTable.item(rowIndex, 0)
if twItem.text().startswith(search_string):
self.attributeTable.setRowHidden(rowIndex, False)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute_search(self, attribute, filters):\n for i in self.response_info['results']:\n if filters in i[attribute]:\n self.output.append(i)\n self.counter += 1",
"def testMclPclSearch(self):\n driver = self.driver\n #finds the parent cell line field a... | [
"0.64711237",
"0.6180629",
"0.61647904",
"0.60364985",
"0.59957033",
"0.5961341",
"0.585961",
"0.58473295",
"0.5847208",
"0.5822899",
"0.5776655",
"0.57664746",
"0.5762024",
"0.5762017",
"0.57546693",
"0.57392174",
"0.57390314",
"0.5735067",
"0.57270515",
"0.57251036",
"0.571... | 0.74283737 | 0 |
Given the current Attribute(param) and a new value entered in the gui, update the current symobject's value for the parameter | def modifyParam(self, currentAttribute, updatedValue):
instance_params = self.state.selectedSymObjects[0].instanceParams
# if the value is name or connected objects, set the param instead of
# the dict
if currentAttribute not in instance_params:
instance_params[currentAttribu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updateMyGUIValue(self, attributeName, newValue):\n if self.myGalaxy.shipSelected == self:\n d = {attributeName:newValue}\n self.myGalaxy.shipInfo.updateAttributes(d)",
"def do_update(self, arg):\n obj = self.verify(arg, 1)\n if obj:\n args = arg.split(\" ... | [
"0.72806495",
"0.66137034",
"0.64815664",
"0.64511174",
"0.6400563",
"0.6339075",
"0.63130903",
"0.62620664",
"0.62204444",
"0.62022936",
"0.6195337",
"0.6191742",
"0.61900795",
"0.6061048",
"0.6043569",
"0.6042399",
"0.60343313",
"0.6013683",
"0.6011751",
"0.6000503",
"0.593... | 0.72548467 | 1 |
The first pass at the tokens is to deal with blocks. | def __parse_blocks_pass(self):
self.stack = [DocumentStackToken()]
self.tokenized_document = []
token_to_use = self.source_provider.get_next_line()
did_start_close = False
did_started_close = False
requeue = []
ignore_link_definition_start = False
POGGER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _consume(self, block: str) -> None:\n self.buffer = []\n self.level = 0\n last_char = \"START\"\n for ch in char_iter(block):\n if ch in \"\\n\\r\":\n self._check_body_level()\n self.line_number += 1\n if self.in_comment:\n ... | [
"0.6457899",
"0.62142354",
"0.61452246",
"0.61254406",
"0.6057843",
"0.5986507",
"0.597771",
"0.59636855",
"0.58821774",
"0.586457",
"0.57403666",
"0.57367676",
"0.57098573",
"0.5701107",
"0.56916136",
"0.5677475",
"0.56770104",
"0.56770104",
"0.5662916",
"0.5638019",
"0.5637... | 0.722209 | 0 |
Returns whether front matter parsing is enabled. | def is_front_matter_enabled(self):
return self.__front_matter_enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_preprocessing(self):\r\n return conf.lib.clang_isPreprocessing(self)",
"def is_comprehensive_theming_enabled():\n ENABLE_COMPREHENSIVE_THEMING = SettingToggle(\"ENABLE_COMPREHENSIVE_THEMING\", default=False)\n\n if ENABLE_COMPREHENSIVE_THEMING.is_enabled() and current_request_has_associated_s... | [
"0.62514204",
"0.5768051",
"0.57448626",
"0.5679302",
"0.55469245",
"0.5536452",
"0.552237",
"0.55181825",
"0.5471888",
"0.54673195",
"0.546557",
"0.54616",
"0.5419903",
"0.5361117",
"0.53372157",
"0.5282104",
"0.5276461",
"0.5269326",
"0.52571386",
"0.5195801",
"0.5194547",
... | 0.80138654 | 0 |
Returns whether pragma parsing is enabled. | def is_pragmas_enabled(self):
return self.__pragmas_enabled | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pragma(self):\n initial_pos = self.pos\n try:\n self.match_value(Identifier, \"pragma\")\n expr = self.tokens[self.pos:]\n self.pos = len(self.tokens)\n\n return PragmaNode(expr)\n except ParseError:\n self.pos = initial_pos\n ... | [
"0.5830434",
"0.54803693",
"0.53693527",
"0.5305556",
"0.51940244",
"0.51645476",
"0.50622195",
"0.5047295",
"0.5031789",
"0.5024937",
"0.49353558",
"0.4871321",
"0.48240516",
"0.4808786",
"0.47958007",
"0.4747869",
"0.47380838",
"0.47360966",
"0.47341162",
"0.47271025",
"0.4... | 0.6409369 | 0 |
updates the sprite to match the camera position | def update(self, dt):
x, y = self.pos
cx, cy = self.camera.pos
tx, ty = self.camera.target
self.sprite.x = ((x-tx) * self.camera.zoom) + (cx * self.dist)+ (tx)
self.sprite.y = ((y-ty) * self.camera.zoom) + (cy * self.dist)+ (ty)
self.sprite.scale = self.camera.zoom * self.radius | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(self):\n self.moving_sprites.update() \n self.static_sprites.update()\n self.camera.update(self.player)",
"def update(self):\n self.syncSpriteCoordinates()\n self.moveBasedOnCurrentMomentum()\n #self.decelerate()\n self.checkCanvasBoundsAndWrap()",
"d... | [
"0.77708364",
"0.7135605",
"0.6989129",
"0.6885165",
"0.6780152",
"0.67463005",
"0.67295384",
"0.6697945",
"0.6697789",
"0.667911",
"0.6638797",
"0.6618048",
"0.66064084",
"0.65962285",
"0.6586995",
"0.656958",
"0.6563384",
"0.6524323",
"0.65242493",
"0.65108246",
"0.650665",... | 0.76551634 | 1 |
Get the coordinates of the cell that pt = (x,y) falls in. | def get_cell_coords(self, pt):
return int(pt[0] // self.a), int(pt[1] // self.a) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cell_coords(pt):\n\n return int(pt[0] // a), int(pt[1] // a)",
"def get_xy(self, x, y):\r\n\t\treturn self.grid[y, x]",
"def cell_index(self, coord):\n\n for x in range(len(self.cell_x)):\n if coord[0] >= self.cell_x[x] and coord[0] <= self.cell_x[x] + self.cell_size:\n ... | [
"0.8011303",
"0.7618935",
"0.75055915",
"0.7366091",
"0.7238822",
"0.71133727",
"0.7108227",
"0.6990128",
"0.6972853",
"0.69670075",
"0.69417137",
"0.68902224",
"0.6863175",
"0.68588525",
"0.68542373",
"0.6847495",
"0.68400073",
"0.68253475",
"0.6804576",
"0.6797296",
"0.6751... | 0.82759666 | 0 |
Return the indexes of points in cells neighbouring cell at coords. For the cell at coords = (x,y), return the indexes of points in the cells | def get_neighbours(self, coords):
dxdy = [(-1,-2),(0,-2),(1,-2),(-2,-1),(-1,-1),(0,-1),(1,-1),(2,-1),
(-2,0),(-1,0),(1,0),(2,0),(-2,1),(-1,1),(0,1),(1,1),(2,1),
(-1,2),(0,2),(1,2),(0,0)]
neighbours = []
for dx, dy in dxdy:
neighbour_coords = coords[0] + dx, coords[1] +... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neighbours(coords):\n\n dxdy = [(-1,-2),(0,-2),(1,-2),(-2,-1),(-1,-1),(0,-1),(1,-1),(2,-1),\n (-2,0),(-1,0),(1,0),(2,0),(-2,1),(-1,1),(0,1),(1,1),(2,1),\n (-1,2),(0,2),(1,2),(0,0)]\n neighbours = []\n for dx, dy in dxdy:\n neighbour_coords = coo... | [
"0.8076163",
"0.75070435",
"0.7503129",
"0.74385846",
"0.7434275",
"0.72765297",
"0.7090918",
"0.704459",
"0.7040659",
"0.70099366",
"0.69819355",
"0.6981541",
"0.69437623",
"0.6933522",
"0.6919118",
"0.6845234",
"0.6818972",
"0.68184626",
"0.6815866",
"0.68102586",
"0.680056... | 0.7829657 | 1 |
Try to find a candidate point relative to refpt to emit in the sample. We draw up to k points from the annulus of inner radius r, outer radius 2r around the reference point, refpt. If none of them are suitable (because they're too close to existing points in the sample), return False. Otherwise, return the pt. | def get_point(self, k, refpt, samples):
i = 0
while i < k:
rho, theta = np.random.uniform(self.r, 2*self.r), np.random.uniform(0, 2*np.pi)
pt = refpt[0] + rho*np.cos(theta), refpt[1] + rho*np.sin(theta)
if not (0 <= pt[0] < self.width and 0 <= pt[1] < self.height):
# Th... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_point(k, refpt):\n i = 0\n while i < k:\n rho, theta = np.random.uniform(r, 2*r), np.random.uniform(0, 2*np.pi)\n pt = refpt[0] + rho*np.cos(theta), refpt[1] + rho*np.sin(theta), 0\n if not (0 <= pt[0] < width and 0 <= pt[1] < height):\n # This ... | [
"0.7855567",
"0.6392318",
"0.6225563",
"0.59341717",
"0.5707494",
"0.56993514",
"0.56591207",
"0.56058246",
"0.5588008",
"0.5577352",
"0.5572389",
"0.5569945",
"0.55235946",
"0.54991233",
"0.54926103",
"0.5489657",
"0.547376",
"0.5439452",
"0.54009247",
"0.53480774",
"0.53329... | 0.78931254 | 0 |
Design of an Aweighting filter. Return ITUR 468 analog weighting filter numerator, denominator | def A_weighting_analog():
# Definition of analog A-weighting filter according to IEC/CD 1672.
f1 = 20.598997
f2 = 107.65265
f3 = 737.86223
f4 = 12194.217
A1000 = 1.9997
NUMs = [(2*pi * f4)**2 * (10**(A1000/20)), 0, 0, 0, 0]
DENs = polymul([1, 4*pi * f4, (2*pi * f4)**2],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def A_weighting(fs):\n b, a = A_weighting_analog()\n\n # Use the bilinear transformation to get the digital filter.\n return bilinear(b, a, fs)",
"def weighting(wb, m, a):\n s = control.tf([1, 0], [1])\n return (s/m + wb) / (s + wb*a)",
"def A_weight(signal, fs):\n\n b, a = A_weighting(fs)\n ... | [
"0.7322773",
"0.62311167",
"0.6183636",
"0.61836326",
"0.6101015",
"0.6100975",
"0.6078972",
"0.5995047",
"0.59867376",
"0.59743464",
"0.59443414",
"0.59075034",
"0.59029573",
"0.58591735",
"0.58132136",
"0.5806905",
"0.57029647",
"0.5692939",
"0.56525636",
"0.5648612",
"0.56... | 0.69731486 | 1 |
Design of an Aweighting filter. Designs a digital Aweighting filter for | def A_weighting(fs):
b, a = A_weighting_analog()
# Use the bilinear transformation to get the digital filter.
return bilinear(b, a, fs) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self, filt,\n objname=\"obj\",\n src=\"A0V\",\n chooseholes=None,\n affine2d=None,\n bandpass=None,\n **kwargs):\n self.chooseholes = chooseholes\n self.objname = objname\n self.filt = ... | [
"0.6569912",
"0.65038925",
"0.6415223",
"0.6181262",
"0.6019618",
"0.601262",
"0.60107213",
"0.59714496",
"0.5906382",
"0.58665305",
"0.58463794",
"0.5827675",
"0.5827091",
"0.5799605",
"0.5798868",
"0.5780697",
"0.577296",
"0.5761894",
"0.5761869",
"0.5757669",
"0.5754511",
... | 0.7483246 | 0 |
Return the given signal after passing through an Aweighting filter | def A_weight(signal, fs):
b, a = A_weighting(fs)
return lfilter(b, a, signal) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def A_weighting(fs):\n b, a = A_weighting_analog()\n\n # Use the bilinear transformation to get the digital filter.\n return bilinear(b, a, fs)",
"def __call__(self, dt, **kwargs):\n return self.signal_weights",
"def smooth_signal(self, signal, window=7, order=3):\n\n from scipy.signal impor... | [
"0.6984835",
"0.65022004",
"0.62012637",
"0.6148687",
"0.6077277",
"0.6062124",
"0.59403896",
"0.57477665",
"0.5710442",
"0.5689476",
"0.56857884",
"0.5653684",
"0.5644475",
"0.5639329",
"0.56359994",
"0.56354624",
"0.56249815",
"0.5599163",
"0.5584839",
"0.55711144",
"0.5547... | 0.7641531 | 0 |
Append a loss after each batch ends. | def on_batch_end(self, batch, logs={}):
self.losses.append(logs.get('loss'))
self.accuracies.append(logs.get('acc')) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss_(self, batch):\n raise NotImplementedError",
"def on_epoch_end(self, epoch, logs={}):\n self.losses.append(logs.get(\"loss\"))\n self.val_losses.append(logs.get(\"val_loss\"))",
"def update(self, loss):\n self.st.batch_update(self.last_sampled, loss ** 2 / self.p)",
"def ... | [
"0.7067912",
"0.7044912",
"0.6732714",
"0.67143524",
"0.66966206",
"0.6696044",
"0.6637225",
"0.6601903",
"0.659688",
"0.6539566",
"0.651419",
"0.64874387",
"0.6466933",
"0.64440995",
"0.642833",
"0.6426717",
"0.6426036",
"0.64216197",
"0.6419046",
"0.63740927",
"0.63517237",... | 0.7326845 | 0 |
Shuffle an array in place, from beginning to end | def knuth_shuffle_forward(arr):
for i in range(0, len(arr)-2): # i from 0..n-2
j = random.randint(i, len(arr)-1) # Pick randomly i <= j < n
arr[i], arr[j] = arr[j], arr[i] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shuffle(arr):\n for i in range(len(arr)):\n j = int(math.floor(random.random() * len(arr)))\n arr[i], arr[j] = arr[j], arr[i]",
"def shuffle(self) -> List[int]:\n for i in range(len(self.array)):\n tmp_idx = randrange(i, len(self.array))\n self.array[i], self.arr... | [
"0.7728941",
"0.7545032",
"0.7415438",
"0.73867315",
"0.73441535",
"0.71861196",
"0.7185641",
"0.71788245",
"0.71292466",
"0.6982159",
"0.6962624",
"0.6937716",
"0.68565536",
"0.6825381",
"0.68117046",
"0.6811178",
"0.67986035",
"0.67778164",
"0.67754346",
"0.67681015",
"0.67... | 0.7629986 | 1 |
Count number of inversions in a nearsorted array | def count_inversions_brute_force(arr):
inversions = 0
for i, j in itertools.combinations(range(len(arr)), 2):
if arr[i] > arr[j]:
inversions += 1
return inversions | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inversions(self):\n inversions = 0\n a = self.array_form\n n = len(a)\n if n < 130:\n for i in xrange(n - 1):\n b = a[i]\n for c in a[i + 1:]:\n if b > c:\n inversions += 1\n else:\n ... | [
"0.8144279",
"0.76396203",
"0.74354494",
"0.7238741",
"0.69011575",
"0.6788903",
"0.6665684",
"0.6656185",
"0.64139915",
"0.6360644",
"0.63449407",
"0.62602097",
"0.6213365",
"0.6187934",
"0.6106535",
"0.5959761",
"0.59045106",
"0.5886727",
"0.58668625",
"0.5866232",
"0.58447... | 0.798417 | 1 |
Count the Kendall tau distances btw 2 rankings | def kendall_tau_brute_force(ranking1, ranking2):
distance = 0
for i, j in itertools.combinations(range(len(ranking1)), 2):
a = ranking1[i] - ranking1[j]
b = ranking2[i] - ranking2[j]
# If discordant (different signs)
if a * b < 0:
distance += 1
return distance | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_kendell_tau(ys):\n\n from scipy.stats import kendalltau\n\n # calculate Kendall tau\n tau, p = kendalltau(range(len(ys)), ys)\n\n return tau, p",
"def Kendalls_Tau2(xlist, ylist):\n\tif len(xlist) != len(ylist):\n\t\traise StatsError(\"Data sets have different lengths.\")\n\txdata = xlist\n\t... | [
"0.6186429",
"0.60932827",
"0.60371983",
"0.5837042",
"0.5802842",
"0.5706151",
"0.56986207",
"0.5663267",
"0.5622382",
"0.56213963",
"0.56189555",
"0.5593399",
"0.5575869",
"0.5567498",
"0.55531096",
"0.5546939",
"0.5546542",
"0.5546345",
"0.55401653",
"0.55209863",
"0.54825... | 0.69952583 | 0 |
Spider function crawls on the page of TheVerge to find links to articles and print the titles of first 10 articles to the console. The crawling on specific articles is multithreaded | def spider(articles):
article_links = []
page = 1
while len(article_links) < articles:
url = 'https://www.theverge.com/games/archives/'+str(page)
source_code = requests.get(url)
plain_text = source_code.text
soup = bs(plain_text, features="html.parser")
for article_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n articles = []\n\n # Get main page and get links to all article pages\n \n br = mechanize.Browser()\n br.set_cookiejar(cookielib.LWPCookieJar())\n br.set_handle_equiv(True)\n br.set_handle_gzip(True)\n br.set_handle_redirect(True)\n br.set_handle_referer(True)\n br.set_ha... | [
"0.7058324",
"0.69924873",
"0.6679451",
"0.65234154",
"0.65226656",
"0.6504224",
"0.64889425",
"0.64575523",
"0.6414046",
"0.64096487",
"0.6357198",
"0.63197327",
"0.62850827",
"0.6277172",
"0.62630916",
"0.6216997",
"0.6212319",
"0.6191555",
"0.61630934",
"0.6155763",
"0.615... | 0.7929097 | 0 |
spider_thread function prints the title of a TheVerge article | def spider_thread(link):
article_soup = bs(requests.get(link).text, features="html.parser")
text = article_soup.find('h1', class_="c-page-title").getText()
print(text) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_title():",
"def get_title(self, article: BeautifulSoup):\n return self.get_text(article, self.parsing_template.title)",
"def title(self):\n # Use the first line of the articles text as title, if not title\n # exists.\n title = self._text[:min(32, self._text.find(\"\\n\"))]\n... | [
"0.6525632",
"0.627607",
"0.6262908",
"0.6031903",
"0.6009225",
"0.59984565",
"0.59799635",
"0.5960674",
"0.5957176",
"0.592491",
"0.5900527",
"0.58422124",
"0.5841945",
"0.5818805",
"0.5772316",
"0.57323605",
"0.5726817",
"0.5717429",
"0.57064646",
"0.5682712",
"0.56710607",... | 0.7864699 | 0 |
Creates shallow copy of the link. | def copy(self):
obj = DecaLink()
for k in self.__dict__.keys():
obj.__setattr__(k, self.__getattribute__(k))
return obj | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clone(self) -> \"Link\":\n cls = self.__class__\n return cls(\n rel=self.rel,\n target=self.target,\n media_type=self.media_type,\n title=self.title,\n )",
"def copy(self):\n return self.__class__(\n self.kind, self.link_ids.c... | [
"0.72963417",
"0.7149722",
"0.67833304",
"0.6688596",
"0.6586897",
"0.65375316",
"0.64440805",
"0.64440805",
"0.64440805",
"0.6436893",
"0.63943595",
"0.63759804",
"0.6362039",
"0.63537383",
"0.6324614",
"0.6318122",
"0.6314163",
"0.6302977",
"0.6251881",
"0.6250623",
"0.6238... | 0.74456525 | 0 |
Convert (list of )+ tokens to a padded LongTensor. | def get_long_tensor(tokens_list, batch_size, pad_id=constant.PAD_ID):
sizes = []
x = tokens_list
while isinstance(x[0], list):
sizes.append(max(len(y) for y in x))
x = [z for y in x for z in y]
tokens = torch.LongTensor(batch_size, *sizes).fill_(pad_id)
for i, s in enumerate(tokens_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_long_tensor(tokens_list, batch_size, pad_id=PAD_ID):\r\n sizes = []\r\n x = tokens_list\r\n while isinstance(x[0], list):\r\n sizes.append(max(len(y) for y in x))\r\n x = [z for y in x for z in y]\r\n tokens = torch.LongTensor(batch_size, *sizes).fill_(pad_id)\r\n for i, s in e... | [
"0.8210955",
"0.8012064",
"0.741115",
"0.645929",
"0.6339111",
"0.6146659",
"0.6094179",
"0.60548025",
"0.5995981",
"0.5975593",
"0.59623677",
"0.59397143",
"0.59219885",
"0.5850022",
"0.575946",
"0.57324886",
"0.5686426",
"0.5680188",
"0.56618726",
"0.563921",
"0.5634147",
... | 0.8199274 | 1 |
Handles get requests to the HDFS Browser Fetches the webHDFS from the configured ports | def get(self):
# Without protocol and trailing slash
# baseurl = os.environ.get("HDFS_NAMENODE_HOST", "p01001532067275.cern.ch")
baseurl = os.environ.get("HDFS_NAMENODE_HOST", self.get_active_namenode)
port = os.environ.get("HDFS_NAMENODE_PORT", "50070")
url = "http://" + baseurl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client():\n return hdfs.connect()",
"def do_GET(self):\n self.log.debug('do_GET called')\n self.HeadGet('GET')",
"def do_GET(self):\r\n self.logger.debug(\"SseHTTPRequestHandler(Thread-%s): do_GET, path=%s\",\r\n threading.current_thread().ident, self.path)\r\n ... | [
"0.6206478",
"0.585591",
"0.5853507",
"0.5831467",
"0.5827586",
"0.5793467",
"0.5764116",
"0.57021207",
"0.5585128",
"0.54943705",
"0.5489919",
"0.54804265",
"0.54420096",
"0.5432906",
"0.54288214",
"0.54235816",
"0.540665",
"0.53912735",
"0.5354657",
"0.53401744",
"0.5339614... | 0.7204486 | 0 |
Join components of url into a relative url Use to prevent double slash when joining subpath. This will leave the initial and final / in place | def url_path_join(*pieces):
initial = pieces[0].startswith("/")
final = pieces[-1].endswith("/")
stripped = [s.strip("/") for s in pieces]
result = "/".join(s for s in stripped if s)
if initial:
result = "/" + result
if final:
result = result + "/"
if result == "//":
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def urljoin(base, *path):\n return reduce(_join, path, base)",
"def _url_join(self, *parts):\n return \"/\".join(map(lambda fragment: fragment.rstrip('/'), parts))",
"def full_url(self, path):\n if path[0] == '/':\n path = path[1:]\n return urljoin(self.absolute_root, path)",... | [
"0.750273",
"0.74749786",
"0.7463351",
"0.7461864",
"0.74336535",
"0.73645765",
"0.73354805",
"0.73094445",
"0.73057014",
"0.72956157",
"0.7289869",
"0.71865994",
"0.7186508",
"0.7176108",
"0.71693957",
"0.7166752",
"0.71409905",
"0.70767",
"0.70707947",
"0.7021509",
"0.70210... | 0.7498108 | 1 |
Gets ratings from s3 file | def get_ratings_from_s3():
s3 = boto3.resource('s3', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
s3_object = s3.Object(S3_BUCKET_NAME, S3_FILE_NAME)
ratings_string = s3_object.get()['Body'].read()
rating_string_io = io.BytesIO(ratings_string)
ratings_dict_reader... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_amazon_adj_cls_from_s3(s3_resource, bucket_name, prefix='') -> dict:\n amzn_filename = \"AMZN.json\"\n complete_path = os.path.join(prefix, amzn_filename)\n json_object = s3_resource.Object(bucket_name, complete_path)\n file_content = json_object.get()['Body'].read().decode('utf-8')\n json_c... | [
"0.65872055",
"0.64466316",
"0.6328395",
"0.61623025",
"0.6091756",
"0.596042",
"0.5872652",
"0.5793283",
"0.57476056",
"0.5707173",
"0.5700715",
"0.56971705",
"0.5695306",
"0.5691914",
"0.5688184",
"0.5667566",
"0.56575465",
"0.5638604",
"0.5617987",
"0.5613711",
"0.5609317"... | 0.7956033 | 0 |
Save ratings file to s3 | def store_ratings_to_s3(ratings_dict):
s3 = boto3.resource('s3', aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY)
s3_object = s3.Object(S3_BUCKET_NAME, S3_FILE_NAME)
ratings_string = RATINGS_FORMAT + '\r\n'
for key, value in ratings_dict:
ratings_string = rating... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_to_s3(filename, contents):\n s3 = boto3.resource('s3')\n obj = s3.Object(BUCKET_NAME, S3_PATH.format(filename))\n obj.put(Body=contents)",
"def write_to_s3(df, bucket, path):\n pass",
"def save_file_aws(obj, file_path, aws_credentials):\n bucket_engine = S3Bucket(*aws_credentials)\n ... | [
"0.6977207",
"0.67674613",
"0.676226",
"0.6642222",
"0.6615998",
"0.6583558",
"0.64306045",
"0.6419164",
"0.63721097",
"0.63639176",
"0.6350763",
"0.6346801",
"0.63313705",
"0.6241247",
"0.61707157",
"0.6097771",
"0.60476875",
"0.6006685",
"0.5965917",
"0.5954893",
"0.5953145... | 0.77866983 | 0 |
Print a nice heading to the console. | def heading(s):
line = '-' *60
print('\n' + line + '\n' + s + '\n' + line) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_heading(text):\n writer(f\"\\n[+] {text}\\n{'=' * 20}\", FORMAT['HEADING'])",
"def print_title():\n print(\" ##################\")\n print(\" # #\")\n print(\" # ===== ===== #\")\n print(\" # | | #\")\n print... | [
"0.7554524",
"0.74135596",
"0.738712",
"0.7335654",
"0.7259712",
"0.7207488",
"0.72005874",
"0.700688",
"0.69849104",
"0.6966117",
"0.6914079",
"0.6912388",
"0.6847288",
"0.6838787",
"0.68233186",
"0.6823089",
"0.68193513",
"0.6794741",
"0.6768738",
"0.676742",
"0.6761142",
... | 0.8142509 | 0 |
Perform one step of a simple recurrent network returning the current hidden activations and the output. `i_t` is the input at the current timestep, `h_tm1` and `o_tm1` are the hidden values and outputs of the previous timestep. `h_bias` is the bias for the hidden units. `W_in`, `W_out` and `W_rec` are the weight matric... | def one_step(i_t, h_tm1):
h_t = self.activation(T.dot(i_t, self.W) + T.dot(h_tm1, self.W_rec) + self.b)
return h_t | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forward(self, inp, hidden=None, give_gates=False, debug=False, readout_time=None):\n\n if self.recoder is None:\n emb = inp\n else:\n emb = self.recoder(inp)\n\n if hidden is None:\n hidden = self.init_hidden(inp.shape[1])\n # if emb.dim()<3:\n ... | [
"0.6009464",
"0.57988393",
"0.5604709",
"0.55983216",
"0.55822414",
"0.55286384",
"0.54668283",
"0.5460738",
"0.54534274",
"0.5418739",
"0.5393745",
"0.5375099",
"0.53578275",
"0.53386915",
"0.5337197",
"0.53202283",
"0.5288725",
"0.52595395",
"0.5256244",
"0.52468455",
"0.52... | 0.7037838 | 0 |
Simulate a connection error with requests. | def simulate_connection_error(valid_connection):
path = "YesssSMS.api.YesssSMS._login"
with mock.patch(path, side_effect=requests.exceptions.ConnectionError()):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_request_connection_err(self, method, m_requests, nosleep):\n # Dummies for K8s API URL and `requests` session.\n url = 'http://examples.com/'\n client = k8s.requests.Session()\n\n # Construct the ConnectionError exception with a fake request object.\n # The fake is neces... | [
"0.787153",
"0.7590832",
"0.7590832",
"0.7247765",
"0.7229652",
"0.7216194",
"0.7153172",
"0.7042087",
"0.69859815",
"0.6931169",
"0.6834769",
"0.6834678",
"0.6812487",
"0.6811063",
"0.6783842",
"0.6783834",
"0.6720455",
"0.6715329",
"0.66398406",
"0.663563",
"0.65934634",
... | 0.76016754 | 1 |
Simulate a suspended error. | def simulate_suspended_error(valid_connection):
path = "YesssSMS.api.YesssSMS._login"
with mock.patch(path, side_effect=YesssSMS.YesssSMS.AccountSuspendedError()):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_failure_result(self):\n dr = EventualResult(fail(RuntimeError()), None)\n self.assertRaises(RuntimeError, dr.wait, 0.1)",
"def test_ComputerPartition_error_SetupResource_StoppedState(self):\n sequence_list = SequenceList()\n sequence_string = self.prepare_installed_computer_partition... | [
"0.62899673",
"0.6132548",
"0.61276555",
"0.6093517",
"0.6084958",
"0.6069421",
"0.6046651",
"0.60104096",
"0.5989038",
"0.59228003",
"0.5906591",
"0.5903851",
"0.5902143",
"0.5898535",
"0.58962256",
"0.5874677",
"0.58161724",
"0.57657933",
"0.57559544",
"0.57558465",
"0.5748... | 0.7010311 | 0 |
Simulate a sending error. | def simulate_sending_error(valid_connection):
path = "YesssSMS.api.YesssSMS.send"
with mock.patch(path, side_effect=YesssSMS.YesssSMS.SMSSendingError()):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_error(self, e):\n self._send({'error': e.payload})",
"def send_error(msg):\n\n print(msg)",
"def sendError():\n exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()\n\n self.sendData((\n RPC_ERROR,\n request_id,\n ... | [
"0.74607784",
"0.73497325",
"0.7299124",
"0.71674657",
"0.7101413",
"0.706223",
"0.70545214",
"0.70302254",
"0.6844338",
"0.6701889",
"0.66883534",
"0.6661738",
"0.663433",
"0.65941894",
"0.65861315",
"0.6504642",
"0.6377325",
"0.63726634",
"0.6359107",
"0.63209057",
"0.63186... | 0.7504461 | 0 |
Simulate a empty_message error. | def simulate_empty_message_error(valid_connection):
path = "YesssSMS.api.YesssSMS.send"
with mock.patch(path, side_effect=YesssSMS.YesssSMS.EmptyMessageError):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_message(config, valid_connection):\n sms = YesssSMS.YesssSMS(LOGIN, YESSS_PASSWD)\n with pytest.raises(ValueError):\n sms.send(YESSS_TO, \"\")\n with pytest.raises(sms.EmptyMessageError):\n sms.send(YESSS_TO, \"\")",
"def test_empty(self):\n self.assertRaisesInternalE... | [
"0.74081314",
"0.71794844",
"0.68508774",
"0.6687455",
"0.66844046",
"0.65958583",
"0.6514391",
"0.64839536",
"0.644663",
"0.630132",
"0.62799245",
"0.6259732",
"0.6257444",
"0.6257394",
"0.6246804",
"0.624465",
"0.621328",
"0.6205938",
"0.6204584",
"0.61874664",
"0.61708534"... | 0.75729877 | 0 |
Mock config file with erroneous data. | def mocked_config_file_error():
data = """
LOGIN = 06501234567
PASSWD = MySecre3tPassw0rd
"""
with mock.patch(
"configparser.open",
# "builtins.open",
mock.mock_open(read_data=data),
):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set_config__invalid_datafile(self):\n\n test_datafile = json.dumps(self.config_dict_with_features)\n mock_logger = mock.Mock()\n mock_notification_center = mock.Mock()\n\n with mock.patch('optimizely.config_manager.BaseConfigManager._validate_instantiation_options'):\n ... | [
"0.7730992",
"0.7496227",
"0.7395642",
"0.7386029",
"0.7376061",
"0.7355063",
"0.7342643",
"0.7338819",
"0.7295874",
"0.72808695",
"0.72607595",
"0.72263473",
"0.72111607",
"0.7208132",
"0.71791977",
"0.7141326",
"0.7137899",
"0.7129651",
"0.71215516",
"0.71083426",
"0.710012... | 0.7843521 | 0 |
Mock config file with data. | def mocked_config_file():
data = """[YESSSSMS]
LOGIN = 03211234567
PASSWD = MySecr3t
DEFAULT_TO = +43664123123123
MVNO = GOOOD
"""
with mock.patch(
"configparser.open",
# "builtins.open",
mock.mock_open(read_data=data),
):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config():\n data = \"\"\"[YESSSSMS]\nLOGIN = 03211234567\nPASSWD = MySecr3t\nDEFAULT_TO = +43664123123123\nMVNO = YESSS\n\"\"\"\n with mock.patch(\n \"configparser.open\",\n # \"builtins.open\",\n mock.mock_open(read_data=data),\n ):\n yield",
"def mock_config(temp_dir):... | [
"0.79090804",
"0.7575244",
"0.7567183",
"0.7473759",
"0.74734664",
"0.7447285",
"0.7379738",
"0.736771",
"0.7291572",
"0.7251801",
"0.7195049",
"0.7184121",
"0.71810627",
"0.7123552",
"0.70573056",
"0.7047511",
"0.6997905",
"0.6959004",
"0.69373757",
"0.693424",
"0.6910059",
... | 0.8124044 | 0 |
Mock config file with data. | def config():
data = """[YESSSSMS]
LOGIN = 03211234567
PASSWD = MySecr3t
DEFAULT_TO = +43664123123123
MVNO = YESSS
"""
with mock.patch(
"configparser.open",
# "builtins.open",
mock.mock_open(read_data=data),
):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mocked_config_file():\n data = \"\"\"[YESSSSMS]\nLOGIN = 03211234567\nPASSWD = MySecr3t\nDEFAULT_TO = +43664123123123\nMVNO = GOOOD\n\"\"\"\n with mock.patch(\n \"configparser.open\",\n # \"builtins.open\",\n mock.mock_open(read_data=data),\n ):\n yield",
"def mock_confi... | [
"0.8124044",
"0.7575244",
"0.7567183",
"0.7473759",
"0.74734664",
"0.7447285",
"0.7379738",
"0.736771",
"0.7291572",
"0.7251801",
"0.7195049",
"0.7184121",
"0.71810627",
"0.7123552",
"0.70573056",
"0.7047511",
"0.6997905",
"0.6959004",
"0.69373757",
"0.693424",
"0.6910059",
... | 0.79090804 | 1 |
Mock config file read. | def mocked_read_config():
# login, passwd, DEFAULT_RECIPIENT, PROVIDER, CUSTOM_PROVIDER_URLS
data = ("03141592653", "MySecr3t", None, "yesss", None)
with mock.patch("YesssSMS.CLI.CLI.read_config_files", return_value=data):
yield | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mocked_config_file():\n data = \"\"\"[YESSSSMS]\nLOGIN = 03211234567\nPASSWD = MySecr3t\nDEFAULT_TO = +43664123123123\nMVNO = GOOOD\n\"\"\"\n with mock.patch(\n \"configparser.open\",\n # \"builtins.open\",\n mock.mock_open(read_data=data),\n ):\n yield",
"def mocked_con... | [
"0.81102324",
"0.7651985",
"0.76369894",
"0.75925875",
"0.7482274",
"0.73461837",
"0.73363054",
"0.7323925",
"0.73101515",
"0.7195141",
"0.7166423",
"0.7116797",
"0.7115923",
"0.71069026",
"0.70564044",
"0.7046745",
"0.70329523",
"0.6975612",
"0.6912903",
"0.69101936",
"0.689... | 0.7856965 | 1 |
Test CLI suspended error. | def test_cli_suspended_error(
valid_mock_connection, mocked_config_file_custom_provider, suspended_error, capsys
):
if int(sys.version.split(".")[1]) < 7: # don't run test on 3.6
pytest.skip("issue with mock_open")
testargs = ["yessssms", "-m", "Bilde mir nicht ein was rechts zu wissen"]
with ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_sleep_invalid_mode(mocker):\n runner = CliRunner()\n result = runner.invoke(main, ['sleep', '2'])\n\n assert result.exit_code == 2\n assert 'Usage:' in result.output\n assert 'invalid choice: 2' in result.output",
"def testFailure():\n run(\"chariot-me\") #Start management-engine without... | [
"0.7031953",
"0.702131",
"0.6879532",
"0.68319005",
"0.674456",
"0.6712443",
"0.6672416",
"0.66398305",
"0.6637617",
"0.6630587",
"0.6544687",
"0.6520034",
"0.65031624",
"0.64791536",
"0.64769584",
"0.6443208",
"0.64363325",
"0.6386083",
"0.63777137",
"0.63605237",
"0.6338948... | 0.7675874 | 0 |
Test CLI SMS sending error. | def test_cli_sending_error(
valid_mock_connection, mocked_config_file_custom_provider, sending_error, capsys
):
if int(sys.version.split(".")[1]) < 7: # don't run test on 3.6
pytest.skip("issue with mock_open")
testargs = ["yessssms", "-m", "Bilde mir nicht ein was rechts zu wissen"]
with mock... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testSendSmsPduModeError(self):\n\n # setup expectation to raise a non-timeout error with prompt\n when(self.mockDevice).read_lines().thenRaise(Exception(\"something other than timeout\"))\n self.gsm.send_sms(\"1234\", \"Test Message\")\n \n # must see command with size\n ... | [
"0.7662868",
"0.70648944",
"0.6984065",
"0.68828356",
"0.68354136",
"0.68181217",
"0.6798068",
"0.67497706",
"0.6694625",
"0.6646652",
"0.6590535",
"0.65809005",
"0.6578139",
"0.65031534",
"0.64960974",
"0.64787066",
"0.64684457",
"0.6457954",
"0.64388466",
"0.64294183",
"0.6... | 0.7515139 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.