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 |
|---|---|---|---|---|---|---|
Returns (uid, server) keyvalue dict for all known processes. | def get_processes(self):
processes={}
for (server_ip, server_port) in self.hosts:
try:
server = xmlrpclib.ServerProxy("http://%s:%d"%(server_ip, server_port))
uid = server.get_id()
if uid != self.uid:
processes[uid] = server... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_process_list() -> Dict:\n return {proc.pid: proc.name() for proc in psutil.process_iter()}",
"def allprocs(self):\n\n processes = self.getHash( 'nameHash' ) # safely get copy of process name dictionary\n\n allprocs = {}\n\n for p in processes.keys():\n allprocs[p] = pr... | [
"0.73702204",
"0.69452477",
"0.69452477",
"0.6650098",
"0.6525161",
"0.6506986",
"0.6399781",
"0.63756126",
"0.62960565",
"0.62957835",
"0.6276895",
"0.6216729",
"0.6216314",
"0.60462",
"0.60247827",
"0.58855563",
"0.5790434",
"0.576581",
"0.5760869",
"0.5747543",
"0.57474256... | 0.7560922 | 0 |
Checks to see if the current time server is up. If not, starts an election. Returns a string representing the outcome. | def check_server_activity(self):
if (self.am_leader == True):
return "Time server connected."
elif (self.time_server_set == False):
print "I am not aware of a time server. Fetching from existing process."
if (self.fetch_time_server() == False):
print "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_time_server(self):\n ack = self.check_server_activity()\n if self.am_leader:\n t = Timer(5, self.set_offset_for_processes)\n t.daemon = True\n t.start()\n else:\n t = Timer(10, self.check_time_server)\n t.daemon = True\n ... | [
"0.6460506",
"0.639312",
"0.6289982",
"0.6216404",
"0.6212552",
"0.5918272",
"0.5793659",
"0.5746175",
"0.5698483",
"0.5673495",
"0.5602336",
"0.55977553",
"0.5545668",
"0.5543222",
"0.5527316",
"0.5526806",
"0.55103034",
"0.55024165",
"0.5494045",
"0.5488873",
"0.5476198",
... | 0.75908726 | 0 |
Returns True/False whether a time server exists. If time server exists, global_time_server and timer_server_set are updated. | def fetch_time_server(self):
processes = self.get_processes()
if processes:
server = processes.itervalues().next()
host = server.get_leader()
if host:
self.global_time_server = xmlrpclib.ServerProxy("http://%s:%d"%(host[0], host[1]))
se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_server_host(self):\n if self.am_leader:\n return self.host\n if not self.time_server_set:\n return False\n try:\n return self.global_time_server.get_host()\n except socket.error:\n return False",
"def time_server_not_responding(... | [
"0.68373203",
"0.6724485",
"0.64385027",
"0.63708144",
"0.62691534",
"0.5916731",
"0.5878767",
"0.5850901",
"0.5825628",
"0.5803778",
"0.5732875",
"0.57178813",
"0.57104725",
"0.57008606",
"0.56899685",
"0.5673983",
"0.56536955",
"0.56463784",
"0.5595128",
"0.5595128",
"0.559... | 0.763049 | 0 |
Set the offset for all other processes. Only called if server is the time server. | def set_offset_for_processes(self):
processes = self.get_processes()
if (len(processes) == 0):
print "Not enough servers up yet. Cannot synchronize clocks."
return "Cannot synchronize clocks yet."
servers = list(processes.itervalues())
local_time = time.time()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_offset(self, offset):\r\n for b in self.buf:\r\n b.set_offset(offset)",
"def set_offset(self, offset):\n self.offset = offset",
"def set_offset(self, offset):\n self.offset = offset",
"def shift_time_points(self, offset):\n # Note that this is different from what we are d... | [
"0.5898746",
"0.5774189",
"0.5774189",
"0.5741887",
"0.56890404",
"0.56315196",
"0.5576288",
"0.54750437",
"0.5432271",
"0.5422275",
"0.5422237",
"0.53860897",
"0.53832734",
"0.5380859",
"0.5369507",
"0.5366588",
"0.53526783",
"0.5343629",
"0.5316956",
"0.5306941",
"0.5268247... | 0.80705214 | 0 |
test KungfuPerson.get_nearest() It should return KungfuPerson instances in order by distance and not those that are too far away. | def test_get_nearest(self):
switzerland = Country.objects.get(name=u"Switzerland")
uk = Country.objects.get(name=u"United Kingdom")
user1, person1 = self._create_person("user1", "user1@example.com",
country=switzerland.name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_k_nearest(self):\n L = range(100)\n L = [(i, i, i, i) for i in L]\n tree = KdTree(L)\n # remove distance, only keep points from the result\n items = lambda items: [x for (d, x) in items] \n assert items(tree.k_nearest((-1, -1), 1)) == [(0, 0, 0, 0)]\n asser... | [
"0.71879786",
"0.6730738",
"0.6531955",
"0.63879484",
"0.6243739",
"0.6234441",
"0.6173463",
"0.61437106",
"0.6097517",
"0.6083082",
"0.6077313",
"0.60161734",
"0.6013823",
"0.6006508",
"0.59997797",
"0.5999731",
"0.5959799",
"0.59231526",
"0.5909711",
"0.5903137",
"0.5902954... | 0.8085902 | 0 |
Read in species info from a database (Species.csv). Store species information in DataFrame. | def load_database(self, fsp='Species'):
self.df_species = pd.read_csv(fsp + '.csv', header=0,
index_col=0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def known_species(self):\n # Import #\n from forest_puller.conversion.tree_species_info import df as species_info\n # Filter #\n df = species_info[['genus', 'species']]\n # Return #\n return df",
"def _read_dataset(self):\n import pandas as pd\n\n freesolv_... | [
"0.6504103",
"0.6376368",
"0.62806046",
"0.6025438",
"0.5912464",
"0.5885345",
"0.5880654",
"0.5880323",
"0.5858053",
"0.5850845",
"0.5828759",
"0.5827787",
"0.58228755",
"0.58178604",
"0.5780339",
"0.5778272",
"0.5772368",
"0.5760765",
"0.57302934",
"0.57271945",
"0.5721376"... | 0.77850735 | 0 |
Select particle from the database and assign the info. | def select_ptcl(self, sp_name):
if sp_name in self.df_species.index:
self.name = sp_name
self.mass = self.df_species.loc[sp_name]['Mass']
self.charge = self.df_species.loc[sp_name]['Charge']
else:
print(f'\n"{sp_name}" is not found in database, "Species.cs... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self,particle):\n self.par = particle",
"def define_particle(self,line):\n\n pattern=re.compile(r'''^\\s*\n (?P<pid>-?\\d+)\\s+ #PID\n (?P<status>1)\\s+ #status (1 for output particle)\n (?P<mother>-?\\d+)\\s+ #mother\n (?P<du... | [
"0.5440968",
"0.5209481",
"0.5205389",
"0.5103307",
"0.5093841",
"0.5073481",
"0.50707984",
"0.50368375",
"0.50104815",
"0.49951142",
"0.49676955",
"0.49618888",
"0.49618888",
"0.49562407",
"0.49488103",
"0.49210382",
"0.49197465",
"0.4913491",
"0.49004126",
"0.48881242",
"0.... | 0.60598713 | 0 |
Turbinia API commandline tool (turbiniaclient). \b \b \b \b \b , \b \b \b \b %%%%%% \b %%%%%% \b %%%%%%%%%%%%%%% %%%%%% \b %%%%%%%%%%%%%%%%%%%%% %%%%%%% \b %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \b %% %% \b %% (%%%%%%%%%%%%%%%%%%% \b %%%%% %%%%%%%%%%%%%%% \b %%%%%%%%%% %% \b %%% %% %% %%% %%%%, \b %%%... | def cli(ctx: click.Context, config_instance: str, config_path: str) -> None:
ctx.obj = TurbiniaCli(
config_instance=config_instance, config_path=config_path)
# Set up the tool based on the configuration file parameters.
ctx.obj.setup()
# Build all the commands based on responses from the API server.
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main() -> None: # pragma: no cover\n params = demisto.params()\n command = demisto.command()\n args = demisto.args()\n\n server = params.get('server', '')\n rest_port = params.get('rest_port', '')\n api_key = params.get('api_key', {}).get('password', '')\n user = params.get('credentials',... | [
"0.6895696",
"0.642087",
"0.62097526",
"0.6089273",
"0.5987856",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"0.5916232",
"... | 0.65375817 | 1 |
Given a nonnegative integer num, return the number of steps to reduce it to zero. If the current number is even, you have to divide it by 2, otherwise, you have to subtract 1 from it. >>> numberOfSteps(14) 6 >>> numberOfSteps(8) 4 | def numberOfSteps(num):
steps = 0
while num != 0:
if num % 2 == 0:
num /= 2
steps += 1
else:
num -= 1
steps += 1
return steps | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_steps_num():\n return 0",
"def hailstone_steps(num):\n steps = 0\n\n while num > 1:\n steps = steps + 1\n if num % 2 == 1:\n num = int(num * 3 + 1)\n else:\n num = int(num / 2)\n\n return steps",
"def num_steps(self) -> int:\n return sel... | [
"0.67060316",
"0.65045863",
"0.64211863",
"0.63558614",
"0.62579185",
"0.6222189",
"0.6108514",
"0.6107813",
"0.599413",
"0.5948919",
"0.5931085",
"0.59129393",
"0.58275026",
"0.5816107",
"0.57658494",
"0.5765016",
"0.5718969",
"0.5681479",
"0.56620157",
"0.5647658",
"0.56425... | 0.8462701 | 0 |
Converts input pdf file to json | def pdf_to_json(
parser_path: str,
source: str,
destination: str,
verify: bool = False,
metadata: str = None,
multiprocess: int = -1,
ocr_missing_doc: bool = False,
force_ocr: bool = False,
num_ocr_threads: int = 2,
) -> None:
from common.docum... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf_to_json_cmd_wrapper(\n parser_path: str,\n source: str,\n destination: str,\n metadata: str,\n multiprocess: int,\n verify: bool,\n memory_percentage: float,\n ocr_missing_doc: bool,\n force_ocr: bool,\n num_ocr_threads: int,\n) -> None:... | [
"0.6339625",
"0.63191676",
"0.6210769",
"0.61992335",
"0.6009707",
"0.59330887",
"0.5831215",
"0.58070976",
"0.58065647",
"0.5805627",
"0.57916445",
"0.5741168",
"0.5705346",
"0.5676186",
"0.55836666",
"0.558178",
"0.5578739",
"0.55764693",
"0.55671513",
"0.5565098",
"0.55487... | 0.6829818 | 0 |
limits the percentage of memory usage allowed | def memory_limit(memory_percentage: float):
soft, hard = resource.getrlimit(resource.RLIMIT_AS)
print("Memory Hard Limit: " + str(hard) + " Soft Limit: " + str(soft) +
" Maximum of percentage of memory use: " + str(memory_percentage))
resource.setrlimit(resource.RLIMIT_AS, (get_memory()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Limit_GPU_Memory(self,percent):\n import tensorflow as tf\n from keras.backend.tensorflow_backend import set_session\n\n config = tf.ConfigProto()\n config.gpu_options.per_process_gpu_memory_fraction = percent\n set_session(tf.Session(config=config))",
"def ram_percent(self... | [
"0.68921524",
"0.6717087",
"0.64703625",
"0.6439144",
"0.6296501",
"0.62957513",
"0.62836456",
"0.6220874",
"0.6143736",
"0.6067969",
"0.6063018",
"0.60274273",
"0.5987944",
"0.598386",
"0.5956688",
"0.59492916",
"0.5943637",
"0.59409595",
"0.59342563",
"0.59150106",
"0.58559... | 0.7219077 | 0 |
Asynchronously transcribes the audio file specified by the gcs_uri. | def transcribe_gcs(gcs_uri):
if not gcs_uri:
print('You need to specify Google Cloud Storage URL for your audio file')
return
print('Transcribe', gcs_uri)
audio_file_name = gcs_uri.split('/')[-1]
if not audio_file_name:
audio_file_name = 'out'
audio_file_name = audio_file_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transcribe_gcs(gcs_uri):\n from google.cloud import speech\n from google.cloud.speech import enums\n \n client = speech.SpeechClient()\n audio = speech.types.RecognitionAudio(uri = gcs_uri)\n config = speech.types.RecognitionConfig(\n encoding = enums.RecognitionConfig.AudioEncoding.F... | [
"0.75377667",
"0.7335047",
"0.72664374",
"0.6773646",
"0.60017955",
"0.59708667",
"0.5933436",
"0.5820201",
"0.55926186",
"0.5557763",
"0.55325204",
"0.55186015",
"0.55093426",
"0.5504284",
"0.54146355",
"0.53816634",
"0.53233904",
"0.5287892",
"0.5252494",
"0.52493006",
"0.5... | 0.7558915 | 0 |
Tests the case that we have a single tab as sparator between our domain end its prefix. | def tests_with_tabs(self):
for domain in self.domains:
expected = domain
data = f"0.0.0.0\t{domain}"
actual = File(data).get_converted()
self.assertEqual(expected, actual)
for domain in self.domains:
expected = domain
data = f"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests_with_multiple_tabs(self):\n\n for domain in self.domains:\n expected = domain\n\n data = f\"0.0.0.0\\t\\t\\t\\t\\t\\t\\t\\t\\t\\t{domain}\"\n actual = File(data).get_converted()\n\n self.assertEqual(expected, actual)\n\n for domain in self.domains... | [
"0.6723963",
"0.65284526",
"0.6515573",
"0.63055205",
"0.61093354",
"0.59874696",
"0.59579784",
"0.5863491",
"0.5861417",
"0.58012867",
"0.57552594",
"0.5746103",
"0.5714665",
"0.5585775",
"0.55856246",
"0.55833745",
"0.5576475",
"0.55555725",
"0.55369216",
"0.5529827",
"0.54... | 0.6705827 | 1 |
Tests the case that we have multiple tabs as sparator between our domain end its prefix. | def tests_with_multiple_tabs(self):
for domain in self.domains:
expected = domain
data = f"0.0.0.0\t\t\t\t\t\t\t\t\t\t{domain}"
actual = File(data).get_converted()
self.assertEqual(expected, actual)
for domain in self.domains:
expected = do... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tests_with_tabs(self):\n\n for domain in self.domains:\n expected = domain\n\n data = f\"0.0.0.0\\t{domain}\"\n actual = File(data).get_converted()\n\n self.assertEqual(expected, actual)\n\n for domain in self.domains:\n expected = domain\n\n... | [
"0.66813695",
"0.642306",
"0.62173164",
"0.6164266",
"0.6146044",
"0.6113166",
"0.6009066",
"0.5949106",
"0.58977747",
"0.58833486",
"0.5716775",
"0.5703323",
"0.5607324",
"0.5606485",
"0.55673754",
"0.5567333",
"0.55639607",
"0.5551627",
"0.55223966",
"0.5501553",
"0.5483473... | 0.67601305 | 0 |
Given a verse id and, optionally, a Bible version, return the text for that verse. | def get_verse_text(verse_id: int, version: Version = DEFAULT_VERSION) -> Optional[str]:
if verse_id not in VERSE_IDS:
raise InvalidVerseError(verse_id=verse_id)
try:
version_verse_texts: Dict[int, str] = _get_version_verse_texts(version)
except FileNotFoundError as e:
raise MissingV... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_version(self, number: int) -> Text:\n return self.text_versions[number]",
"def get_text(downgrade_titles=False):",
"def get_passage_text(passage, api_key=\"\", html=False, options={},\n cache=default_cache):\n # Set default parameters\n params = {\n \"include-hea... | [
"0.5992339",
"0.55671054",
"0.54239243",
"0.5369089",
"0.5325528",
"0.53006",
"0.51430994",
"0.5125991",
"0.5125315",
"0.5118963",
"0.50938994",
"0.50649977",
"0.5063923",
"0.50212693",
"0.5011961",
"0.5010066",
"0.49990305",
"0.4991622",
"0.497455",
"0.4966079",
"0.49635398"... | 0.7318325 | 0 |
Given a book of the Bible and optionally a version return the book title. | def get_book_titles(
book: Book, version: Version = DEFAULT_VERSION
) -> Optional[BookTitles]:
try:
version_book_tiles: Dict[Book, BookTitles] = _get_version_book_titles(version)
except FileNotFoundError as e:
raise MissingBookFileError(e)
return version_book_tiles.get(book) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, book_title):\n return qh.get_book_title(book_title)",
"def book_title(book_text):\n search = re.search(\"Title:(.*)\", book_text)\n title = search.group(1).replace(\"\\r\", \" \").strip()\n return title",
"def _get_book(s):\n\n s = s.strip()\n if s == '': raise SyntaxError('... | [
"0.7188838",
"0.66815466",
"0.6453347",
"0.64505476",
"0.64491045",
"0.6247853",
"0.62303495",
"0.6164743",
"0.6142084",
"0.6074008",
"0.606841",
"0.59632206",
"0.59232026",
"0.59219164",
"0.5908794",
"0.5856935",
"0.57662",
"0.5727088",
"0.5709356",
"0.56746155",
"0.56181246... | 0.69535595 | 1 |
Return batch_dir & project_dir, which must be the same for all rows. | def extract_batch_info(worklist):
batch_dirs = set(r.batch for r in worklist)
project_dirs = set(r.hgsc_xfer_subdir for r in worklist)
assert len(batch_dirs) == 1, (
'batch must be the same for all BAMs in worklist'
)
assert len(project_dirs) == 1, (
'hgsc_xfer_subdir must be the sam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_project_dir(self):\n return os.path.expanduser(\n self.sqlfluff_config.get_section(\n (self.templater_selector, self.name, \"project_dir\")\n )\n or os.getcwd()\n )",
"def getBatchDir(self):\n return self.batch_subjects",
"def _get_d... | [
"0.6306784",
"0.6090127",
"0.56369096",
"0.5613657",
"0.5565796",
"0.5543564",
"0.5527856",
"0.5489418",
"0.5488515",
"0.5447049",
"0.5419612",
"0.5388157",
"0.5352392",
"0.5341177",
"0.5279018",
"0.5260714",
"0.523097",
"0.5213747",
"0.5176594",
"0.5175597",
"0.5171077",
"... | 0.624977 | 1 |
Method get all columns with class attribute "ngscope nghide" | def get_all_hidden_columns(self):
visible_columns_list = []
column_headers = self.driver.find_elements_by_xpath('//thead/tr/th')
for i in range(len(column_headers)):
if column_headers[i].get_attribute('class') == 'ng-scope ng-hide':
visible_columns_list.append(i + 1)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_show_columns(self, model):\n return [\n getattr(field, 'di_display_name', False) or field.column \n for field in model._meta.get_fields() \n if getattr(field, 'di_show', False)\n ]",
"def get_colnames(self, model):\n return [\n ... | [
"0.62172616",
"0.6046037",
"0.56333613",
"0.55719215",
"0.55592537",
"0.55168355",
"0.5382627",
"0.5278053",
"0.524086",
"0.5205804",
"0.51985335",
"0.51985335",
"0.5197084",
"0.51934296",
"0.5184969",
"0.5141526",
"0.51312137",
"0.5106926",
"0.50712836",
"0.50579554",
"0.504... | 0.68571347 | 0 |
This method searches person by id. | def search_person_by_id(self, person_id):
self.is_this_page()
self.try_get_choose_person_id().click()
self.try_get_input_group().clear()
self.try_get_input_group().send_keys(person_id)
self.try_get_ok_button().click() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_person(self, searched_person_id):\n self.__load_persons_from_file_into_memory()\n return super().find_person(searched_person_id)",
"def get_person(self, id):\n if self.people is None:\n self.people = self.get_people()\n\n for person in self.people:\n if ... | [
"0.73231065",
"0.7106659",
"0.70196325",
"0.6826001",
"0.67659664",
"0.6721247",
"0.6650959",
"0.65485483",
"0.6486762",
"0.6407559",
"0.6323435",
"0.6207865",
"0.6172219",
"0.61624277",
"0.61571515",
"0.6143781",
"0.6130108",
"0.6118835",
"0.60871977",
"0.60792905",
"0.60740... | 0.8097049 | 0 |
Method performs search by surname | def search_person_by_surname(self, given_surname):
self.is_this_page()
self.try_get_choose_surname().click()
self.try_get_input_group().clear()
self.try_get_input_group().send_keys(given_surname)
self.try_get_ok_button().click()
self.wait_until_page_generate() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_by_name(self, name, surname, second_surname):\n elector_query_filter = {\"$and\": [{'nombre': name}, {\n 'primer_apellido': surname}, {'segundo_apellido': second_surname}]}\n searching_result = self.build_searching_result(elector_query_filter)\n return searching_result",
... | [
"0.783882",
"0.7568992",
"0.6772925",
"0.6698619",
"0.66659933",
"0.6494555",
"0.6474384",
"0.6463343",
"0.6416647",
"0.63698715",
"0.63181114",
"0.6260087",
"0.6230477",
"0.6225198",
"0.6220634",
"0.6217795",
"0.6212237",
"0.6200657",
"0.6151486",
"0.61284417",
"0.61202383",... | 0.79293084 | 0 |
For each deployed package service, collect its local variables (e.g. network addresses) and Chef attributes. Return it all as a flat dictionary. | def build_dp_variables(dp):
v = {}
for dps in dp.deployedpackageservice_set.all():
# 1st pass: build network variables
if dps.address:
for net in json.loads(dps.address):
for nn in net: # net name
for a in net[nn]: # address
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def env_dicts(self, package_name):\n ret = {}\n ret_multi = {}\n # First process the global variables\n for package, pairs in self._sorted_data:\n for name, value in pairs.items():\n if package is None:\n if isinstance(value, list):\n ... | [
"0.63497144",
"0.6161984",
"0.5963506",
"0.58469063",
"0.5801466",
"0.5736059",
"0.5721944",
"0.57171506",
"0.5698449",
"0.5690832",
"0.5675632",
"0.561076",
"0.55895954",
"0.55868036",
"0.55722237",
"0.55650455",
"0.5563132",
"0.55273116",
"0.5524288",
"0.5512308",
"0.550187... | 0.73809713 | 0 |
A function that decompressed a runlength encoded lists and returns it | def decompress_encoded_list( nums ):
decompressed = []
for i in range( 0, len(nums), 2 ):
freq = nums[i]
val = nums[i+1]
decompressed.extend( [val] * freq )
return decompressed | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(e):\n return sum([length * [item] for length,item in e],[])",
"def compress(uncompressed):\r\n \r\n # Build the dictionary.\r\n dict_size = 256\r\n dictionary = dict((chr(i), i) for i in range(dict_size))\r\n # in Python 3: dictionary = {chr(i): i for i in range(dict_size)}\r\n \r\n ... | [
"0.66997164",
"0.6375686",
"0.6339384",
"0.61632806",
"0.61041737",
"0.60773414",
"0.5980076",
"0.5960508",
"0.59194285",
"0.5721836",
"0.57113445",
"0.5687808",
"0.5686314",
"0.5679134",
"0.5619676",
"0.56193906",
"0.56043893",
"0.5596316",
"0.55827856",
"0.5541547",
"0.5520... | 0.6967195 | 0 |
Method to parse the lines returned by the ftplib.FTP.dir(), when called on supplied path. Uses callable dirparser attribute. | def parsedir(self, path=''):
if self.dirparser is None:
msg = ('Must set dirparser attribute to a callable '
'before calling this method')
raise TypeError(msg)
dirlines = self._dir(path)
dirdict = self.dirparser(dirlines)
return dirdict | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parsedir(self, path=''):\n \n if self.dirparser is None:\n msg = ('Must set dirparser attribute to a callable '\n 'before calling this method')\n raise TypeError(msg)\n\n dirlines = self._dir(path)\n dirdict = self.dirparser(dirlines)\n ... | [
"0.6881982",
"0.63415074",
"0.62133735",
"0.5811037",
"0.5683501",
"0.5538635",
"0.54616946",
"0.54616946",
"0.5422065",
"0.5405085",
"0.5373462",
"0.52851605",
"0.5270514",
"0.52647555",
"0.52614385",
"0.52099806",
"0.52058494",
"0.5197162",
"0.5194003",
"0.51803714",
"0.516... | 0.6887331 | 0 |
Clean up path remove repeated and trailing separators. | def _cleanpath(self, path):
slashes = self.remotepathsep*2
while slashes in path:
path = path.replace(slashes,self.remotepathsep)
if path.endswith(self.remotepathsep):
path = path[:-1]
return path | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _cleanup_path(path):\n return string.join(filter(None, string.split(path, '/')), '/')",
"def _trim_path(path):\n if path.endswith(\"/\"):\n path = path[:-1] # remove / at the end\n \n return path",
"def clean_path(path: str) -> str:\n previous_path = \"\"\n next_path = path\n whil... | [
"0.7981345",
"0.7315837",
"0.730054",
"0.7190368",
"0.71864",
"0.71373034",
"0.70536107",
"0.7036191",
"0.703579",
"0.6994601",
"0.6941104",
"0.6900043",
"0.68013865",
"0.67445815",
"0.67303747",
"0.6725442",
"0.66509145",
"0.661992",
"0.6524637",
"0.65012586",
"0.64987904",
... | 0.76014835 | 1 |
Recursive nlst(). Return a list of filenames under path. | def rnlst(self, path=''):
filelist = []
return self._rnlst(path,filelist)
#return self._walk(path) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rnlst(self, path=''):\n \n filelist = []\n return self._rnlst(path,filelist)",
"def _rnlst(self, path, filelist):\n \n path = self._cleanpath(path)\n dirdict = self.parsedir(path)\n \n trycwds = dirdict.get('trycwds', [])\n names = dirdict.get('nam... | [
"0.7224549",
"0.70405525",
"0.693822",
"0.66344494",
"0.6500599",
"0.64470035",
"0.64148116",
"0.6408869",
"0.6311148",
"0.6297346",
"0.628773",
"0.62539816",
"0.6252165",
"0.62330514",
"0.6216831",
"0.6210003",
"0.62054855",
"0.6203652",
"0.6165966",
"0.6165697",
"0.6159265"... | 0.7445436 | 0 |
Logs into gmail account and returns an instance of an SMTP server object. | def login(self):
server = smtplib.SMTP("smtp.gmail.com", 587)
server.starttls()
server.login(self.username, self.password)
return server | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_server(self):\n\n server = smtplib.SMTP(self.server_url)\n\n server.ehlo()\n server.starttls()\n server.ehlo()\n\n server.login(self.user, self.password)\n\n return server",
"def get_mail_session(host, port, smtp_user, smtp_secret):\n try:\n # set up ... | [
"0.7158503",
"0.668792",
"0.6146357",
"0.6060473",
"0.59325695",
"0.58998114",
"0.5794449",
"0.56712323",
"0.5619725",
"0.561134",
"0.55717635",
"0.55232126",
"0.55031437",
"0.54700154",
"0.5397206",
"0.53350574",
"0.5334581",
"0.53315955",
"0.5232081",
"0.5188551",
"0.517241... | 0.79171056 | 0 |
Generate a meme given an path and a quote. | def generate_meme(path=None, body=None, author=None):
img = None
quote = None
if path is None:
images = "./_data/photos/dog/"
imgs = []
for root, dirs, files in os.walk(images):
imgs = [os.path.join(root, name) for name in files]
img = random.choice(imgs)
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meme_rand():\n img = random.choice(imgs)\n quotes_list_one = random.choice(quotes)\n quote = random.choice(quotes_list_one)\n if quote and img:\n path = meme.make_meme(img, quote.body, quote.author)\n return render_template('meme.html', path=path)\n else:\n path = meme.make_... | [
"0.56572956",
"0.5341394",
"0.50750494",
"0.5024728",
"0.50216097",
"0.5007591",
"0.49589348",
"0.49092638",
"0.48789895",
"0.48259297",
"0.47576118",
"0.46978873",
"0.46825188",
"0.46806878",
"0.46697906",
"0.4647742",
"0.4642918",
"0.4638311",
"0.46341044",
"0.4620452",
"0.... | 0.6563053 | 0 |
``` Views observations with top losses in validation set. Typically overridden by Learner subclasses. | def view_top_losses(self, n=4, preproc=None, val_data=None):
val = self._check_val(val_data)
# get top losses and associated data
tups = self.top_losses(n=n, val_data=val, preproc=preproc)
# get multilabel status and class names
classes = preproc.get_classes() if preproc is not... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view_top_losses(self, n=4, preproc=None, val_data=None):\n raise NotImplementedError(\n \"view_top_losses must be overriden by Learner subclass\"\n )",
"def view_top_losses(self, n=4, preproc=None, val_data=None):\n val = self._check_val(val_data)\n\n # get top losses a... | [
"0.71138006",
"0.67957073",
"0.66185015",
"0.65254205",
"0.5927037",
"0.58807135",
"0.5685698",
"0.5666037",
"0.5629335",
"0.56240433",
"0.56058156",
"0.5592459",
"0.5591583",
"0.5584454",
"0.5577778",
"0.55605716",
"0.5559057",
"0.5526268",
"0.549828",
"0.54949784",
"0.54944... | 0.6877727 | 1 |
Optional partition Id for notification event hub. If not set, all partitions will be leveraged. | def event_hub_partition_id(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "event_hub_partition_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_hub_partition_id(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_hub_partition_id\")",
"def partition_id(self) -> 'outputs.PreventionJobTriggerInspectJobStorageConfigDatastoreOptionsPartitionId':\n return pulumi.get(self, \"partition_id\")",
"def set_partition(s... | [
"0.64510167",
"0.64320755",
"0.595771",
"0.59098375",
"0.5873819",
"0.5873819",
"0.5822575",
"0.56117356",
"0.5465887",
"0.5439449",
"0.53205454",
"0.53205454",
"0.53138953",
"0.5298383",
"0.527937",
"0.5244177",
"0.5174474",
"0.51160073",
"0.5095547",
"0.50397444",
"0.500904... | 0.6813403 | 0 |
The event hub type. | def event_hub_type(self) -> Optional[pulumi.Input[Union[str, 'EventHubType']]]:
return pulumi.get(self, "event_hub_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_hub_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_hub_type\")",
"def get_type(self):\n return self.event_type",
"def type(self) -> str:\n return self._event.get('type')",
"def event_type(self) -> int:\n return self.data[\"args\"][\"eventTy... | [
"0.8826724",
"0.78366536",
"0.77429354",
"0.7308451",
"0.70576334",
"0.70576334",
"0.69872296",
"0.6939999",
"0.69243646",
"0.6844996",
"0.6731586",
"0.6699463",
"0.66621345",
"0.6596711",
"0.6580311",
"0.65459967",
"0.6535486",
"0.65285516",
"0.65057313",
"0.650167",
"0.6491... | 0.8569165 | 1 |
The event streaming service type | def event_streaming_type(self) -> Optional[pulumi.Input[Union[str, 'EventStreamingType']]]:
return pulumi.get(self, "event_streaming_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_streaming_type(self) -> pulumi.Output[Optional[str]]:\n return pulumi.get(self, \"event_streaming_type\")",
"def get_stream_type(self) -> str:",
"def get_stream_type(self) -> str:\n return self.stream_type",
"def get_type(self):\n return self.event_type",
"def type(self) -> s... | [
"0.78050363",
"0.7146339",
"0.7063095",
"0.7011026",
"0.6729676",
"0.667283",
"0.6577807",
"0.6445917",
"0.6445917",
"0.6337253",
"0.62249833",
"0.6055535",
"0.6046704",
"0.6039866",
"0.60383725",
"0.6022786",
"0.5962143",
"0.5956927",
"0.5941074",
"0.5940048",
"0.5936245",
... | 0.748828 | 1 |
The kafka configuration name. | def kafka_configuration_name(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "kafka_configuration_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name(self):\n return self._config_name",
"def get_config_name(self): # pragma: no cover\n pass",
"def name(self):\n return self._config.get(CONF_NAME)",
"def _getConfigName(self):\n pass",
"def name(self) -> str:\n name = self._config[\"name\"]\n assert isinst... | [
"0.7919919",
"0.7714666",
"0.76922506",
"0.73530555",
"0.72745216",
"0.7196145",
"0.7175958",
"0.7033129",
"0.6942212",
"0.6897144",
"0.6859585",
"0.68502206",
"0.6828225",
"0.67710125",
"0.67710125",
"0.6764214",
"0.6727961",
"0.66964835",
"0.6688361",
"0.6686322",
"0.667769... | 0.8920289 | 0 |
Get an existing KafkaConfiguration resource's state with the given name, id, and optional extra properties used to qualify the lookup. | def get(resource_name: str,
id: pulumi.Input[str],
opts: Optional[pulumi.ResourceOptions] = None) -> 'KafkaConfiguration':
opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))
__props__ = KafkaConfigurationArgs.__new__(KafkaConfigurationArgs)
__props... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(resource_name: str,\n id: pulumi.Input[str],\n opts: Optional[pulumi.ResourceOptions] = None,\n access_configuration_id: Optional[pulumi.Input[str]] = None,\n access_configuration_name: Optional[pulumi.Input[str]] = None,\n description: Optional[pulumi... | [
"0.571254",
"0.56839645",
"0.5649045",
"0.5545997",
"0.5395561",
"0.53015316",
"0.5293933",
"0.5233086",
"0.5203887",
"0.5176693",
"0.51328343",
"0.51226187",
"0.5111622",
"0.50390947",
"0.50277454",
"0.5009167",
"0.5006863",
"0.49989566",
"0.498836",
"0.4985318",
"0.49810046... | 0.6991278 | 0 |
Optional partition Id for notification event hub. If not set, all partitions will be leveraged. | def event_hub_partition_id(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "event_hub_partition_id") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_hub_partition_id(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"event_hub_partition_id\")",
"def partition_id(self) -> 'outputs.PreventionJobTriggerInspectJobStorageConfigDatastoreOptionsPartitionId':\n return pulumi.get(self, \"partition_id\")",
"def set_partition(se... | [
"0.6811714",
"0.6430603",
"0.59570575",
"0.5909561",
"0.5871879",
"0.5871879",
"0.5821864",
"0.56110615",
"0.54646456",
"0.54397935",
"0.53202283",
"0.53202283",
"0.53125244",
"0.5296489",
"0.5277025",
"0.5243476",
"0.51744926",
"0.511466",
"0.5094072",
"0.5039408",
"0.500882... | 0.6449592 | 1 |
The event hub type. | def event_hub_type(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "event_hub_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_hub_type(self) -> Optional[pulumi.Input[Union[str, 'EventHubType']]]:\n return pulumi.get(self, \"event_hub_type\")",
"def get_type(self):\n return self.event_type",
"def type(self) -> str:\n return self._event.get('type')",
"def event_type(self) -> int:\n return self.da... | [
"0.8569165",
"0.78366536",
"0.77429354",
"0.7308451",
"0.70576334",
"0.70576334",
"0.69872296",
"0.6939999",
"0.69243646",
"0.6844996",
"0.6731586",
"0.6699463",
"0.66621345",
"0.6596711",
"0.6580311",
"0.65459967",
"0.6535486",
"0.65285516",
"0.65057313",
"0.650167",
"0.6491... | 0.8826724 | 0 |
The state of the event streaming service | def event_streaming_state(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "event_streaming_state") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stream_status_event(self, event):\r\n pass",
"def event_streaming_state(self) -> Optional[pulumi.Input[Union[str, 'EventStreamingState']]]:\n return pulumi.get(self, \"event_streaming_state\")",
"def get_event_status(self):\n return self.event_status",
"def _get_state(self):\n # g... | [
"0.73347247",
"0.705913",
"0.6722947",
"0.66922796",
"0.66547394",
"0.66547394",
"0.66547394",
"0.661762",
"0.6599132",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
"0.6598627",
... | 0.78612 | 0 |
The event streaming service type | def event_streaming_type(self) -> pulumi.Output[Optional[str]]:
return pulumi.get(self, "event_streaming_type") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def event_streaming_type(self) -> Optional[pulumi.Input[Union[str, 'EventStreamingType']]]:\n return pulumi.get(self, \"event_streaming_type\")",
"def get_stream_type(self) -> str:",
"def get_stream_type(self) -> str:\n return self.stream_type",
"def get_type(self):\n return self.event_t... | [
"0.748828",
"0.7146339",
"0.7063095",
"0.7011026",
"0.6729676",
"0.667283",
"0.6577807",
"0.6445917",
"0.6445917",
"0.6337253",
"0.62249833",
"0.6055535",
"0.6046704",
"0.6039866",
"0.60383725",
"0.6022786",
"0.5962143",
"0.5956927",
"0.5941074",
"0.5940048",
"0.5936245",
"... | 0.78050363 | 0 |
Renders submit form (or link) for specified SubmitReceiver. If the receiver doesn't have form (or link), nothing will be rendered. | def submit_form(receiver, redirect, user, caption=None):
data = {
'user_can_post_submit': receiver.can_post_submit(user),
'receiver': receiver,
'redirect_to': redirect,
}
conf = receiver.configuration
if 'form' in conf:
data['submit_form'] = FileSubmitForm(configuration=... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render(self, h, comp, *args):\n r = var.Var()\n\n return h.form(\n self.msg, ' ',\n h.input.action(r),\n h.input(type='submit', value='Send').action(self.answer, comp, r)\n )",
"def thanks():\n return render_template('submitted.html')",
"def render(self, data, accepted_medi... | [
"0.5407092",
"0.5281097",
"0.5197493",
"0.49705434",
"0.49602216",
"0.49505112",
"0.49066228",
"0.4885421",
"0.48533466",
"0.48422623",
"0.47591016",
"0.4755128",
"0.47480407",
"0.47462115",
"0.47385022",
"0.47243622",
"0.46986744",
"0.46937943",
"0.46451488",
"0.46233627",
"... | 0.6154476 | 0 |
List of all submits for specified user and receiver. | def submit_list(receiver, user):
last_review_for_each_submit = Review.objects.filter(
submit__receiver=receiver, submit__user=user
).order_by(
'-submit__pk', '-time', '-pk'
).distinct(
'submit__pk'
).select_related(
'submit'
)
data = {
'user_has_admin_pr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submit(self):\n dispatcher.utter_template('utter_submit',tracker) \n\n return []",
"async def send_team_submit_forms(self, ctx):\n session = session_creator()\n for team in session.query(Team).all():\n await send_team_submit_form(self, ctx, team)",
"def get_all_submissions(sel... | [
"0.6209556",
"0.5540126",
"0.55389583",
"0.54673916",
"0.5425638",
"0.5366263",
"0.5317789",
"0.5258029",
"0.5196353",
"0.51644766",
"0.5150287",
"0.50875854",
"0.5060054",
"0.50328016",
"0.50142634",
"0.5014149",
"0.5012101",
"0.50082076",
"0.4995",
"0.49802703",
"0.49513",
... | 0.82071334 | 0 |
No NewKeycardScan object with the pk specified in the URL | def test_finished_new_keycard_scan_no_keycardscan_obj_with_pk(self):
new_scan_pk = 1
t_info('Check that there is no NewKeycardScan object with '
'pk specified in the URL', 4)
self.assertFalse(NewKeycardScan.objects.filter(pk=new_scan_pk))
t_info('Getting response..........'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_finished_new_keycard_scan_keycard_with_same_rfid_exists(self):\n # create the RFIDkeycard whose rfid is the same as the one trying to\n # assign; create the lockuser with that rfid\n t_info('Creating new lockuser..........', 3)\n lu = LockUser.objects.create(\n first... | [
"0.55677533",
"0.55124736",
"0.53397256",
"0.5307972",
"0.5287584",
"0.518151",
"0.5163544",
"0.5140947",
"0.5093794",
"0.5047021",
"0.4996789",
"0.49396032",
"0.49047264",
"0.48836765",
"0.487873",
"0.48749593",
"0.48698312",
"0.48395786",
"0.4833648",
"0.48247075",
"0.48231... | 0.66761446 | 0 |
Longer than x minutes to scan new card timed out | def test_finished_new_keycard_scan_timed_out(self):
t_info('Creating NewKeycardScan object; setting creation '
'time to 1 sec more than the time-out time......', 3)
new_nks_obj = NewKeycardScan.objects.create(
rfid='1111111111', assigner_user_id=self.staff_only_user.pk)
min_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeout(self):\n self.timeout_scan_flag=True\n self.timer.stop()\n self.status_sig.emit([\"Update_Status\",\"Timeout during acquisition\",'log'])\n self.status_sig.emit([\"Timeout\"])",
"def checkTimeout(self):\n if TIMEOUT <= (datetime.now() - self.clockCheckStop).total_se... | [
"0.6423987",
"0.6210879",
"0.60957325",
"0.60886",
"0.60726035",
"0.5919813",
"0.58713037",
"0.5867859",
"0.5867859",
"0.57949984",
"0.5780034",
"0.5779118",
"0.57473433",
"0.57182837",
"0.56966144",
"0.5677974",
"0.56695205",
"0.56552595",
"0.56492335",
"0.56431043",
"0.5642... | 0.65992486 | 0 |
A keycard with the same RFID is already assigned to another lockuser | def test_finished_new_keycard_scan_keycard_with_same_rfid_exists(self):
# create the RFIDkeycard whose rfid is the same as the one trying to
# assign; create the lockuser with that rfid
t_info('Creating new lockuser..........', 3)
lu = LockUser.objects.create(
first_name='Jan... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def self_register(self):\n req_url = 'http://{}:{}/api/locks/'.format(\n self.server, self.port,\n )\n while True:\n name = input('Name (required): ')\n if name:\n break\n while True:\n location = input('Location (required): ')\... | [
"0.59950125",
"0.59006095",
"0.5766389",
"0.55508965",
"0.5453411",
"0.5407687",
"0.5340116",
"0.53315514",
"0.53249764",
"0.5320831",
"0.52718025",
"0.5218333",
"0.5207821",
"0.5194192",
"0.5173256",
"0.5165691",
"0.5161233",
"0.51594704",
"0.5132352",
"0.511269",
"0.5096918... | 0.63678735 | 0 |
Return a normalized version of the histogram where the values sum to one. | def normalized(self):
total = self.total()
result = Histogram()
for value, count in self.items():
try:
result[value] = count / float(total)
except UnorderableElements:
result = Histogram.from_dict(dict(result), key=hash)
res... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalise_histogram(histogram):\n total_sum = np.sum(histogram)\n for i in range(len(histogram)):\n histogram[i] /= total_sum\n\n return histogram",
"def normalize(histogram):\n nbins = histogram.GetNbinsX()\n integral = histogram.Integral(1,nbins)\n newhist = histogram.Clone()\n... | [
"0.7275769",
"0.72270113",
"0.71615994",
"0.71396464",
"0.69056654",
"0.6771844",
"0.66773367",
"0.66013765",
"0.6340511",
"0.6327993",
"0.62856925",
"0.621456",
"0.62116945",
"0.60922927",
"0.60827017",
"0.6079007",
"0.606392",
"0.60422677",
"0.6040181",
"0.60372233",
"0.601... | 0.782195 | 0 |
Get given parameter from dictionary as int Not needed so much. | def getIntParam(self, params, name):
try:
return int(params.get(name))
except:
return None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_int(self, item: str) -> int:\n return int(self[item])",
"def getIntParam(self, paramkey, default=None):\n value = self.request.getParameter(paramkey)\n if value is None: return default\n try: return int(value)\n except: return default",
"def getintparam(name, default=... | [
"0.6727846",
"0.6575244",
"0.6536042",
"0.64553547",
"0.64232415",
"0.6333705",
"0.6296128",
"0.62579936",
"0.6236847",
"0.6228051",
"0.61781436",
"0.617149",
"0.6163288",
"0.61497754",
"0.61150664",
"0.6114077",
"0.6110335",
"0.60993785",
"0.60820776",
"0.6061424",
"0.605606... | 0.69979894 | 0 |
Get given parameter from dictionary as boolean. | def getBoolParam(self, params, name):
return params.get(name) in ('True', 'true', '1') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_bool(self, key, default):\n value = self.get(key, default)\n if isinstance(value, bool):\n return value\n return value.lower() in (\"true\", \"t\", \"yes\", \"y\")",
"def param_set(params, param):\n if param in params:\n if params[param] is True:\n ret... | [
"0.6910888",
"0.6814613",
"0.68142986",
"0.68122095",
"0.67293334",
"0.667329",
"0.6640151",
"0.64979553",
"0.64871055",
"0.64550686",
"0.64315814",
"0.6428208",
"0.6418594",
"0.63852715",
"0.63497776",
"0.6332563",
"0.62817174",
"0.62817174",
"0.6279158",
"0.62670916",
"0.62... | 0.74343586 | 0 |
Sharpen the prediction model by removing neutral words and common words from kss dictionary. Return kss_sharpened as the sharpened kss dictionary. | def sharpen_model(common_words_file:TextIO ,kss: Dict[str, List[int]])->Dict:
common_words_file = common_words_file.read().splitlines()
kss_sharpened = {}
for word, value in kss.items():
if (judge(value[0]/value[1]) != 'neutral') or (word not in common_words_file):
kss_sharpened[word] = ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sparsify_model(model, x_test, y_test, k_sparsity, pruning='weight'):\r\n # Copying a temporary sparse model from our original\r\n sparse_model = model #tf.keras.models.clone_model(model)\r\n # sparse_model.set_weights(model.get_weights())\r\n\r\n # Getting a list of the names of each component (w +... | [
"0.54834324",
"0.52607954",
"0.51782763",
"0.50934327",
"0.50032985",
"0.4951075",
"0.4882416",
"0.47661436",
"0.47613484",
"0.47293928",
"0.4707509",
"0.47040564",
"0.4668727",
"0.4639344",
"0.45705387",
"0.45679602",
"0.45527625",
"0.45370546",
"0.45119506",
"0.45108038",
"... | 0.78389454 | 0 |
Get the difference between the actual movie rating and the Predicted Sentiment Score and determine if the difference is larger than 0.05. If the difference is larger than 0.05, return False. If the difference is smaller than or equals to 0.05, return True. >>> is_close_eval(2.05, 2) True >>> is_close_eval(2.02, 2) True... | def is_close_eval(pss_score, actual_rating)-> bool:
return math.isclose(pss_score, actual_rating, abs_tol=0.05) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isclose(valuex, valuey, rel_tol=1e-08, abs_tol=0.0):\n return math.isclose(valuex, valuey, rel_tol=rel_tol, abs_tol=abs_tol)",
"def isClose(self, a, b, rel_tolarance= 1e-09, abs_tol= 0):\n return abs(a - b) <= max(rel_tolarance * max(abs(a), abs(b)), abs_tol)",
"def is_float_close(a, b, rel_tol=1... | [
"0.61099905",
"0.5950663",
"0.5939507",
"0.5935952",
"0.585434",
"0.5806723",
"0.5749302",
"0.5733302",
"0.56989527",
"0.5656389",
"0.54679453",
"0.53912336",
"0.5358862",
"0.53342545",
"0.53124946",
"0.53045547",
"0.52720875",
"0.5261317",
"0.5259593",
"0.5227129",
"0.517641... | 0.7979298 | 0 |
Return the mean abosolute error of a given list of error values. >>> report_mean_error([1.56, 0.24, 0.69]) 0.83 | def report_mean_error(absolute_errors:List[float]):
if len(absolute_errors) != 0:
mean_absolute_error = round(sum(absolute_errors)/len(absolute_errors), 5)
return mean_absolute_error | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean(list_of_values):\r\n # Explicit float(...) to allow for Python 2 division.\r\n return sum(list_of_values) / float(len(list_of_values))",
"def _mean(listvalue):\n\treturn sum(listvalue)/len(listvalue)",
"def mean(list_of_values):\n # so don't have to worry about getting the divisor.\n ... | [
"0.7228381",
"0.6895197",
"0.6815765",
"0.6768199",
"0.66896325",
"0.6626786",
"0.66164106",
"0.65646994",
"0.65381867",
"0.6509628",
"0.65041673",
"0.64992625",
"0.6484826",
"0.6469327",
"0.6456781",
"0.6391081",
"0.6379767",
"0.63600534",
"0.635919",
"0.63354164",
"0.632529... | 0.8188067 | 0 |
Create a csv dataset with the comparison of the scores given by the kss model and the original ones. | def compare_pss_models(test_file:TextIO, common_words_file:TextIO ,kss: Dict[str, List[int]], name_datasets) -> Dict:
scores_comparison = []
original_report_list = []
sharpened_report_list = []
original_absolute_errors = []
sharpened_absolute_errors = []
test_reviews = test_file.readlines()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_performances(self):\r\n nb_datasets = len(self.results)\r\n resu = [[] for k in range(nb_datasets)]\r\n\r\n # fetch results\r\n for k in range(nb_datasets):\r\n best = np.argmax(self.results[k]['mean_test_score'])\r\n resu[k].append(('score', self.results[... | [
"0.6105508",
"0.5982353",
"0.58802956",
"0.5842416",
"0.5740106",
"0.57221544",
"0.5714362",
"0.56901443",
"0.56850505",
"0.5682592",
"0.5673192",
"0.5609764",
"0.55941266",
"0.558551",
"0.55846417",
"0.5580939",
"0.55804974",
"0.5576782",
"0.5534789",
"0.5531908",
"0.5531143... | 0.61025035 | 1 |
Handle GET requests for single movie_night | def retrieve(self, request, pk=None):
try:
movie_night = MovieNight.objects.get(pk=pk)
serializer = MovieNightSerializer(movie_night, context={'request': request})
return Response(serializer.data)
except Exception as ex:
return HttpResponseServerError(ex) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_movie(id):\n if id and request.headers['accept'] == \"application/json\":\n film = mongo_mgr.get_film_by_id (id)\n # handling template movies\n # if the requested film is still a template (name is None), the source\n # and the source_id will be used to get the full data\n ... | [
"0.6591833",
"0.64381367",
"0.63673514",
"0.6328436",
"0.6221485",
"0.6202684",
"0.6124838",
"0.6115374",
"0.60987145",
"0.6098256",
"0.60515827",
"0.60442805",
"0.60283154",
"0.60205585",
"0.59991294",
"0.59891766",
"0.5976948",
"0.5956176",
"0.5924628",
"0.59158766",
"0.589... | 0.7425579 | 0 |
Handle PUT requests for an movie_night | def update(self, request, pk=None):
player = Player.objects.get(user=request.auth.user)
movie_night = MovieNight().objects.get(pk=pk)
movie_night.title = request.data["title"]
movie_night.date = request.data["date"]
movie_night.time = request.data["time"]
movie_night.des... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_movie(movie_name):\n movie_name = movie_name.replace('_', ' ')\n for movie in movies_data:\n if movie.lower() == movie_name.lower():\n if not request.json:\n abort(400)\n\n for key in request.json:\n movies_data[movie][key] = request.json[... | [
"0.6559894",
"0.6494338",
"0.62713224",
"0.6255501",
"0.6231257",
"0.622888",
"0.62211275",
"0.6101095",
"0.6080299",
"0.6056861",
"0.5849588",
"0.5837588",
"0.5715203",
"0.5673529",
"0.56493723",
"0.56353253",
"0.563007",
"0.5624599",
"0.5619248",
"0.5593095",
"0.5558481",
... | 0.7624695 | 0 |
Managing players signing up for movieNights | def signup(self, request, pk=None):
# Django uses the `Authorization` header to determine
# which user is making the request to sign up
player = Player.objects.get(user=request.auth.user) #gets the user from the token
try:
# Handle the case if the client specifies a movie
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_up(self):\n self.log(\"Bot player signing up.\")\n self.subscribe_to_quorum_channel()\n while True:\n url = (\n \"{host}/participant/{self.worker_id}/\"\n \"{self.hit_id}/{self.assignment_id}/\"\n \"debug?fingerprint_hash={hash}&... | [
"0.6431804",
"0.5983013",
"0.59749943",
"0.58958596",
"0.58319604",
"0.58079016",
"0.5693915",
"0.5672184",
"0.56410503",
"0.5619298",
"0.5604032",
"0.5592037",
"0.55639946",
"0.55013764",
"0.54993284",
"0.54848766",
"0.5472325",
"0.54719967",
"0.5466331",
"0.5466331",
"0.546... | 0.6565748 | 0 |
Return a boolean indicating whether given items are in sorted order. | def is_sorted(items):
# TODO: Check that all adjacent items are in order, return early if so
for x in range(len(items)):
if x < len(items)-1:
if items[x+1] < items[x]:
return False
return True | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_sorted(items):\n # TODO: Running time: ??? Why and under what conditions?\n # TODO: Memory usage: ??? Why and under what conditions?\"\"\"\n # Check that all adjacent items are in order, return early if not\n # for i in range(len(items) - 1):\n # if items[i] > items[i + 1]:\n # ... | [
"0.8218438",
"0.82054013",
"0.7429284",
"0.73970175",
"0.7260254",
"0.71971154",
"0.7079509",
"0.70403665",
"0.69723743",
"0.6970533",
"0.69469947",
"0.69445795",
"0.69440234",
"0.68967813",
"0.68493915",
"0.6838795",
"0.6747174",
"0.6713568",
"0.6712401",
"0.6677618",
"0.659... | 0.8400566 | 0 |
Sort given items by swapping adjacent items that are out of order, and repeating until all items are in sorted order. | def bubble_sort(items):
# TODO: Repeat until all items are in sorted order
# TODO: Swap adjacent items that are out of order
for x in range(len(items)-1):
if items[x]>items[x+1]:
temp = items[x]
items[x] = items[x+1]
items[x+1] = temp | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bubble_sort(items):\n # Repeat until all items are in sorted order\n # Swap adjacent items that are out of order\n current = 0\n right = 1\n while not is_sorted(items):\n if current == len(items) - 1:\n current = 0\n right = 1\n\n elif items[current] > items[r... | [
"0.7774924",
"0.7704432",
"0.7438853",
"0.7438092",
"0.733409",
"0.7305797",
"0.7185067",
"0.7120938",
"0.7105576",
"0.7005122",
"0.6956389",
"0.677983",
"0.6776521",
"0.6773033",
"0.674935",
"0.67437667",
"0.6728482",
"0.66992044",
"0.66084075",
"0.66084075",
"0.6589464",
... | 0.78002787 | 0 |
Sort given items by finding minimum item, swapping it with first unsorted item, and repeating until all items are in sorted order. | def selection_sort(items):
# TODO: Repeat until all items are in sorted order
# TODO: Find minimum item in unsorted items
# TODO: Swap it with first unsorted item
for x in range(len(items)):
smallest_index = x
if x!=len(items)-1:
for y in range(x+1, len(items)):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def selection_sort(items):\n # Repeat until all items are in sorted order\n # Find minimum item in unsorted items\n # Swap it with first unsorted item\n current = 0\n minimum = 0\n first = 0\n while not is_sorted(items):\n if items[current] < items[minimum]:\n minimum = curre... | [
"0.82401824",
"0.81208205",
"0.7029974",
"0.69591206",
"0.68900776",
"0.68880105",
"0.6879398",
"0.6878729",
"0.687392",
"0.6846537",
"0.6754572",
"0.67374104",
"0.67181957",
"0.670363",
"0.6684555",
"0.6662071",
"0.66372",
"0.65277344",
"0.6519792",
"0.64845455",
"0.6483028"... | 0.8123447 | 1 |
Sort given items by taking first unsorted item, inserting it in sorted order in front of items, and repeating until all items are in order. | def insertion_sort(items):
# TODO: Repeat until all items are in sorted order
# TODO: Take first unsorted item
# TODO: Insert it in sorted order in front of items
for x in range(1, len(items)):
swap = items[x]
y = x-1
while items[y] > swap and y>=0:
items[y+1] = items... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertion_sort(items):\n # Repeat until all items are in sorted order\n # Take first unsorted item\n # Insert it in sorted order in front of items\n sorted_index = 1\n while not is_sorted(items):\n num = items.pop(sorted_index)\n \n back_index = sorted_index - 1\n for... | [
"0.797718",
"0.7759634",
"0.74620104",
"0.7366552",
"0.7068901",
"0.7045199",
"0.7036924",
"0.69300324",
"0.68185455",
"0.66691256",
"0.6654445",
"0.66307586",
"0.6614762",
"0.65570664",
"0.6492823",
"0.64125615",
"0.64125615",
"0.63699",
"0.6365878",
"0.63540274",
"0.6352421... | 0.78740144 | 1 |
api_use is only True if this module will be used as an API | def __init__(self, api_use=False):
self.api_use = api_use | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_api(self, *apis):\n if not all(apis):\n logger.log('DEBUG', f'{self.source} module is not configured')\n return False\n return True",
"def api_used(self, api_used):\n\n self._api_used = api_used",
"def prepare_api(self):\n return None",
"def maya_use... | [
"0.7204631",
"0.7097794",
"0.6999306",
"0.6942051",
"0.6880872",
"0.6880872",
"0.6879371",
"0.6866349",
"0.6866349",
"0.6866349",
"0.6866349",
"0.6866349",
"0.68445694",
"0.6572421",
"0.6500617",
"0.6449082",
"0.63479656",
"0.6339081",
"0.63177216",
"0.6304564",
"0.6294524",
... | 0.7395975 | 0 |
initializes a new game deal_3 is a boolean that determines whether the stock draws 3 or 1 card at a time auto_flip_tab is a boolean that determines whether newly uncovered cards in the tableaus are automatically flipped up decks is an integer that determines how many decks worth of cards to play with tableau_qty is an ... | def new_game(self, deal_3=False, auto_flip_tab=True, decks=DEFAULT_DECKS, tableau_qty=DEFAULT_TABLEAUS, custom_seed=None, commandline=False):
self.deal_3 = deal_3
self.auto_flip_tab = auto_flip_tab
self.decks = decks
self.tableau_qty = tableau_qty
self.commandline = commandline
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _initial_deal():\n\n # player gets the first card automatically.\n _deal_player()\n\n # deals a card to dealer's hand until they hit 17 or more.\n # > Check the function deal_dealer\n dealer_hand.append(_deal_card(dealer_card_frame))\n\n # show the initial score for the dealer (otherwise it... | [
"0.59825927",
"0.59553343",
"0.5864724",
"0.578338",
"0.569448",
"0.563229",
"0.55461335",
"0.5541444",
"0.5475143",
"0.54708165",
"0.54235077",
"0.54159904",
"0.5415358",
"0.54020375",
"0.53854954",
"0.53348994",
"0.53142476",
"0.5309898",
"0.5308849",
"0.52934873",
"0.52893... | 0.7751552 | 0 |
restarts the game with the option to shuffle a new deck. if a custom seed was entered at the start, the same deck will be used although this will likely be used for purposes other than an API, still prefixing name with 'api' | def api_restart_game(self, reshuffle_deck=True):
if reshuffle_deck:
self.deck = self.deck_copy
self.deck_copy = copy.deepcopy(self.deck)
else:
self.deck = self._init_decks(custom_seed)
start_game() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reinitDeck(self):\n\t\tself.deck = range(52)\n\t\trandom.shuffle(self.deck)",
"def reshuffle(self):\n self.cards = []\n self.fill_standard_deck()\n self.shuffle()",
"def restart_game(self):\n self.play()",
"def restart(self):\n self.set_random_pos('starting')\n s... | [
"0.7040559",
"0.6640181",
"0.64495546",
"0.64115554",
"0.6229494",
"0.6218497",
"0.6162946",
"0.61173373",
"0.6102192",
"0.6071877",
"0.6059706",
"0.6054934",
"0.60133463",
"0.6011941",
"0.60004115",
"0.5992323",
"0.5979549",
"0.5973954",
"0.59078705",
"0.58891875",
"0.588896... | 0.80313027 | 0 |
returns a list of strings that represent what cards are in the waste | def api_read_waste_pile(self):
return [str(card) for card in self.board.wp.cards] if self.board.wp.get_length() > 0 else ['None'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CARD_SUITS() -> tuple:\n return \"Diamonds\", \"Hearts\", \"Clubs\", \"Spades\"",
"def revealAll(aDeck):\r\n cardNames=''\r\n for x in range(len(aDeck)):\r\n card= aDeck[x]\r\n if (card[\"Name\"] == \"Joker\"):\r\n cardNames += card[\"Suite\"] + \" \" + card[\"Name\"]\r\n ... | [
"0.6911928",
"0.64307",
"0.6079951",
"0.6074954",
"0.60612094",
"0.60406923",
"0.60185105",
"0.5997825",
"0.5903853",
"0.5868643",
"0.5863394",
"0.5861533",
"0.5846037",
"0.58303934",
"0.579302",
"0.5776751",
"0.57653254",
"0.5709275",
"0.57069755",
"0.5698183",
"0.5697641",
... | 0.6604498 | 1 |
returns a list of strings that represent what top level cards are in the foundations | def api_read_foundations(self):
return [str(found.get_topmost_card()) for found in self.board.foundations] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revealAll(aDeck):\r\n cardNames=''\r\n for x in range(len(aDeck)):\r\n card= aDeck[x]\r\n if (card[\"Name\"] == \"Joker\"):\r\n cardNames += card[\"Suite\"] + \" \" + card[\"Name\"]\r\n else:\r\n cardNames += card[\"Name\"] + \" of \" +card[\"Suite\"]\r\n ... | [
"0.64296824",
"0.60105616",
"0.59645736",
"0.5843913",
"0.5838946",
"0.5796877",
"0.57865614",
"0.5758125",
"0.5727588",
"0.56930834",
"0.56929547",
"0.5671417",
"0.5604671",
"0.5598215",
"0.55725247",
"0.55721754",
"0.55721754",
"0.5556268",
"0.553498",
"0.5532633",
"0.55294... | 0.7225442 | 0 |
returns a list of lists, with each enclosed list representing a single tableau and its cards | def api_read_tableaus(self):
return [[str(card) for card in tableau.cards][::-1] for tableau in self.board.tableaus] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_deck():\n deck = []\n for suit in Suit:\n for rank in Rank:\n deck.append(Card(suit, rank))\n return deck",
"def scrape_decklist(deck_url):\r\n soup = hot_soup(deck_url)\r\n card_re = re.compile(r\"(\\d+)\\s(.+)\")\r\n deck_table = soup.find_all(class_='Stable')[1]\r\n... | [
"0.662911",
"0.63930756",
"0.6388482",
"0.6293902",
"0.6274713",
"0.6195008",
"0.60779536",
"0.6077609",
"0.60224175",
"0.58070755",
"0.5800629",
"0.5799237",
"0.579461",
"0.5757587",
"0.57291466",
"0.5723572",
"0.56795347",
"0.5676866",
"0.5674475",
"0.5648304",
"0.5619867",... | 0.72504294 | 0 |
stores a list of lists as tableau positions [ [rect object, [TN, M]], ...] with [TN, M] being a move Nth index Tableau, Mth index Card | def get_tab_pos(self):
self.tableaus = []
for tableau_index, tableau in enumerate(self.board.tableaus):
x_pos = TABLEAU_START_POS[0] + tableau_index*(CARD_WIDTH+CARD_HORI_DIST)
if tableau.get_length() == 0:
y_pos = TABLEAU_START_POS[1]
associated_m... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_card_positions(self):\n dealer_y = 350\n player_y = 150\n x_position = 100\n for i in self.dealer_hand:\n i.position = (x_position, dealer_y)\n x_position += 100\n x_position = 100\n for j in self.player_hand:\n j.position = (x_p... | [
"0.5796574",
"0.5766023",
"0.5570978",
"0.5563438",
"0.5545484",
"0.550651",
"0.544765",
"0.542513",
"0.5389927",
"0.53858674",
"0.53825957",
"0.53624654",
"0.5359715",
"0.53505135",
"0.53500634",
"0.5334605",
"0.5323209",
"0.5316428",
"0.5308658",
"0.5299381",
"0.5298655",
... | 0.73446006 | 0 |
For each groundtruth cell find the corresponding 'measured' cell | def match_cells(gt_cells, m_cells, storm_input, filtered_binaries, max_d=3):
img_numbers = np.array([int(re.findall(r'(\d+)', cell.name)[0]) for cell in m_cells])
encoded_gt = encode_intensity(gt_cells)
false_positive = 0
bordering = 0
too_far = 0
max_idx_gt = 0
gt_matched, m_matched = [],... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nb_vals(i, pnts, dem, top_left_cor, cellsize, rows, cols):\n nb_x = np.zeros((5,5)) # this 5 by 5 max would contain the x coordinate of 16 neighbor pixels of a sample point\n nb_y = np.zeros((5,5)) # this 5 by 5 matrix would contain the y coordinate of 16 neighbor pixels of a sample point\n nb_z =... | [
"0.575318",
"0.5654706",
"0.56495064",
"0.56000775",
"0.5596262",
"0.5539961",
"0.54541427",
"0.5441865",
"0.5398301",
"0.53886646",
"0.5385851",
"0.53818816",
"0.5366474",
"0.53600097",
"0.5356197",
"0.53453344",
"0.53306884",
"0.5291357",
"0.5287725",
"0.52592206",
"0.52557... | 0.5719208 | 1 |
For all conditions match all groundtruth cells to measured cells | def match_all(data_dir):
print('Loading GT')
gt_cells = load(os.path.join(data_dir, 'cell_obj', 'cells_final_selected.hdf5'))
storm_i = np.load(os.path.join(data_dir, 'images', 'storm_inner.npy'))
for ph in [10000, 1000, 500]:
print('Photons {}'.format(ph))
m_cells = load(os.path.join(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_cells(gt_cells, m_cells, storm_input, filtered_binaries, max_d=3):\n img_numbers = np.array([int(re.findall(r'(\\d+)', cell.name)[0]) for cell in m_cells])\n encoded_gt = encode_intensity(gt_cells)\n\n false_positive = 0\n bordering = 0\n too_far = 0\n max_idx_gt = 0\n\n gt_matched, ... | [
"0.63448095",
"0.5995166",
"0.5819118",
"0.57720596",
"0.5693835",
"0.569064",
"0.56715006",
"0.5640866",
"0.56365144",
"0.55137783",
"0.5509303",
"0.550072",
"0.54856306",
"0.54164094",
"0.54000235",
"0.5374806",
"0.5353549",
"0.53530276",
"0.5335741",
"0.5327499",
"0.530841... | 0.6585669 | 0 |
Converts and exports a panda dataframe lexicon into a yaml file. This can be used by pyContextNLP. Use filename with .yml extension | def panda_to_yaml(filename, obj_input):
filepath = Path.cwd() / "negation" / "output" / filename
open(filepath, "w")
with open(filepath, "a") as stream:
# Each row represents one document in the yaml file
for row_index in obj_input.index:
# Each column represents one object pe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_as_yaml(dataset, dataset_file):\n\n with open(dataset_file, 'w') as outfile:\n yaml.safe_dump(dataset, outfile, default_flow_style=False)",
"def yaml(self):\n raise NotImplementedError",
"def read_lexicon_into_df(lex_txt_file):\n data = []\n with open(lex_txt_file) as txtf:\n ... | [
"0.6333551",
"0.59277225",
"0.5904702",
"0.5817149",
"0.58033836",
"0.57421863",
"0.5742082",
"0.5728849",
"0.5658983",
"0.5606461",
"0.5599877",
"0.5596807",
"0.557856",
"0.556929",
"0.55310583",
"0.5516301",
"0.54569083",
"0.5440783",
"0.5403216",
"0.53981966",
"0.5389181",... | 0.64324945 | 0 |
Function to transform dataframe with synonyms into regex patterns. First column should be literals, subsequent columns should be synonyms | def gen_regex(df):
# Save synonym columns in list, to loop over synonyms per target
columns = []
for column in df.columns:
columns.append(column)
# Remove category and literal, because these don't contain synonyms
columns.remove("category", "literal")
# Initialize new DataFrame to store... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preprocessing(dataframe):\n dataframe.loc[:, \"content\"] = dataframe.loc[:, \"content\"].str.replace(\"&.*?;\", \"\")\n dataframe.loc[:, \"content\"] = dataframe.loc[:, \"content\"].str.replace(\n r\"[^a-zA-Z\\s.:!?/#\\\"]\", \"\"\n )\n dataframe[\"original_content\"] = dataframe[\"content\... | [
"0.57168955",
"0.54994816",
"0.54137295",
"0.5398948",
"0.52800846",
"0.5279035",
"0.5265679",
"0.5259335",
"0.52565557",
"0.520827",
"0.5201894",
"0.51918244",
"0.51780313",
"0.5163355",
"0.51104397",
"0.5085072",
"0.503343",
"0.5031565",
"0.5025555",
"0.49962905",
"0.498913... | 0.82730967 | 0 |
This is essentially the robustness evaluator, but with the models hardcoded. | def _robustness(
landscape: flexs.Landscape,
make_explorer: Callable[[flexs.Model, float], flexs.Explorer],
):
results = []
for ss in [0.0, 1.0]:
print(f"Evaluating for robustness with model accuracy; signal_strength: {ss}")
model = baselines.models.NoisyAbstractModel(landscape, signal... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluate_model():\n\n # Get the processed data (in proper format to evaluate the NER model)\n data = get_json_from_file_path(PROCESSED_DATA_PATH)\n # Split the dataset for training and test as we did for training\n train_data, test_data = train_test_split(data, train_size=0.7, \n ... | [
"0.65096724",
"0.6374852",
"0.6356179",
"0.60473263",
"0.60337573",
"0.60218567",
"0.60049444",
"0.59879184",
"0.5965253",
"0.5844332",
"0.5832727",
"0.5814296",
"0.5812366",
"0.5785364",
"0.57556593",
"0.57391226",
"0.5733473",
"0.57226384",
"0.57057774",
"0.5702109",
"0.567... | 0.6531017 | 0 |
Return the name of color nearest (red, green, blue) | def nearest(self, red, green, blue):
# BAW: should we use Voronoi diagrams, Delaunay triangulation, or
# octree for speeding up the locating of nearest point? Exhaustive
# search is inefficient, but seems fast enough.
nearest = -1
nearest_name = ''
for name, aliases in s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nearest_color(color):\n\n result = color_re.match(color)\n if result is not None and len(result.groups()) == 5:\n color_red = int(result.groups()[1])\n color_green = int(result.groups()[2])\n color_blue = int(result.groups()[3])\n color_actual = np.array([color_red, color_... | [
"0.72678334",
"0.7190744",
"0.68474764",
"0.68275344",
"0.66425115",
"0.6497939",
"0.62284756",
"0.62250465",
"0.6168186",
"0.6138532",
"0.609768",
"0.60545886",
"0.6016377",
"0.6004818",
"0.5997986",
"0.5997986",
"0.5997986",
"0.5997986",
"0.59737235",
"0.5970706",
"0.595265... | 0.76609373 | 0 |
compute phase function, assuming a polynomial, and account for 14 different possible flux offsets. Input data 'x' must be in units of orbital phase, and must be of size (14xN); if not, it will be reshaped into that. | def phasepoly14(param, x):
# 2011-09-26 10:42 IJMC: Created from phaselamb14
N = len(param) - 14
cparam = array(param[N::], copy=True)
cparam[0] = 1. / prod(1. + cparam[1::]) - 1.
if len(x.shape)==1:
was1d = True
x = x.reshape(14, len(x)/14.)
else:
was1d = False
ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesin14(param, x):\n # 2010-04-27 11:49 IJC: Created.\n # 2011-06-09 16:40 IJMC: Definition slightly changed to be a\n # multiplicative factor.\n cparam = array(param[3::], copy=True)\n cparam[0] = 1. / prod(1. + cparam[1::]) - 1.\n\n param[2] = param[2] % (2*pi)\n\n... | [
"0.65788436",
"0.6460453",
"0.6440747",
"0.61741716",
"0.60197955",
"0.59744406",
"0.57893056",
"0.5708167",
"0.5658748",
"0.55964756",
"0.5560269",
"0.54970884",
"0.54806906",
"0.54710996",
"0.543383",
"0.54151636",
"0.5414345",
"0.53888315",
"0.5380161",
"0.53613776",
"0.53... | 0.7346281 | 0 |
compute phase function with a fixed period=1, assuming a sinusoid, and account for 14 different possible flux offsets. Input data 'x' must therefore be of size (14xN); if not, it will be reshaped into that. p[i,j] = (1. + param[3+j]) (param[0] + param[1]lambertian(2pix[i,j]+param[2])) [note that the first cparameter (i... | def phaselamb14(param, x):
# 2011-09-25 22:24 IJMC: Created from phasesin14
cparam = array(param[3::], copy=True)
cparam[0] = 1. / prod(1. + cparam[1::]) - 1.
param[2] = param[2] % (2*pi)
if len(x.shape)==1:
was1d = True
x = x.reshape(14, len(x)/14.)
else:
was1d = False... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesinsin14_2(param, x):\n # 2011-09-16 09:14 IJMC: Created from phasesinsin14\n cparam = array(param[5::], copy=True)\n cparam[0] = 1. / prod(1. + cparam[1::]) - 1.\n\n if len(x.shape)==1:\n was1d = True\n x = x.reshape(14, len(x)/14.)\n else:\n was1d = False\n\n ret =... | [
"0.7189127",
"0.7064227",
"0.69367695",
"0.6581726",
"0.6518051",
"0.6007314",
"0.5861006",
"0.5672095",
"0.5664369",
"0.55384773",
"0.5528564",
"0.5520631",
"0.54755485",
"0.54718065",
"0.545527",
"0.54518235",
"0.5451698",
"0.5447145",
"0.54427755",
"0.5420388",
"0.5409925"... | 0.7277247 | 0 |
compute phase function with a fixed period=1, assuming a sinusoid and first harmonic, and account for 14 different possible flux offsets. Input data 'x' must therefore be of size (14xN); if not, it will be reshaped into that. p[i,j] = (1. + param[5+j]) \ [ param[0] param[1]cos(2pix[i,j]+param[2]) + \ param[3]cos(4pix[i... | def phasesinsin14(param, x):
# 2011-09-16 09:14 IJMC: Created from phasesin14
cparam = array(param[5::], copy=True)
cparam[0] = 1. / prod(1. + cparam[1::]) - 1.
param[2] = param[2] % (2*pi)
param[4] = param[4] % (2*pi)
if len(x.shape)==1:
was1d = True
x = x.reshape(14, len(x)/1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesinsin14_2(param, x):\n # 2011-09-16 09:14 IJMC: Created from phasesinsin14\n cparam = array(param[5::], copy=True)\n cparam[0] = 1. / prod(1. + cparam[1::]) - 1.\n\n if len(x.shape)==1:\n was1d = True\n x = x.reshape(14, len(x)/14.)\n else:\n was1d = False\n\n ret =... | [
"0.7210996",
"0.7093241",
"0.6444109",
"0.64321125",
"0.6216661",
"0.60148364",
"0.5759242",
"0.56832856",
"0.5552434",
"0.5533145",
"0.55257",
"0.5513097",
"0.5511588",
"0.5510341",
"0.53899145",
"0.5384144",
"0.53826743",
"0.5365052",
"0.5350515",
"0.53438896",
"0.5305954",... | 0.7218989 | 0 |
compute phase function with a fixed period=1, assuming a sinusoid and first harmonic, and account for 14 different possible flux offsets. Input data 'x' must therefore be of size (14xN); if not, it will be reshaped into that. p[i,j] = (1. + param[5+j]) \ [ param[0] param[1]cos(2pix[i,j]) param[2]sin(2pix[i,j]) param[3]... | def phasesinsin14_2(param, x):
# 2011-09-16 09:14 IJMC: Created from phasesinsin14
cparam = array(param[5::], copy=True)
cparam[0] = 1. / prod(1. + cparam[1::]) - 1.
if len(x.shape)==1:
was1d = True
x = x.reshape(14, len(x)/14.)
else:
was1d = False
ret = param[0] - par... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesinsin14(param, x):\n # 2011-09-16 09:14 IJMC: Created from phasesin14\n cparam = array(param[5::], copy=True)\n cparam[0] = 1. / prod(1. + cparam[1::]) - 1.\n\n param[2] = param[2] % (2*pi)\n param[4] = param[4] % (2*pi)\n\n if len(x.shape)==1:\n was1d = True\n x = x.resha... | [
"0.7120096",
"0.7004167",
"0.6376077",
"0.6338129",
"0.6120528",
"0.58977634",
"0.5719755",
"0.56237644",
"0.5496403",
"0.5484071",
"0.54562217",
"0.5453412",
"0.54456705",
"0.54107755",
"0.53912205",
"0.5351835",
"0.5292909",
"0.5275372",
"0.52608365",
"0.52586055",
"0.52314... | 0.7143444 | 0 |
compute phase function with a fixed period=1, assuming a sinusoid, and account for 14 different possible flux offsets and X/Y positional motions. Input data 't','x','y' must therefore be of size (14xN); if not, it will be reshaped into that. "xyord" determines the linear order of the polynomial in x and y. | def phasesin14xymult(param, xyord,crossord,t, x, y):
# 2010-04-27 11:49 IJC: Created
# 2010-05-28 15:42 IJC: Added x*y cross-terms
param = array(param,copy=True)
x = array(x,copy=True)
y = array(y,copy=True)
t = array(t,copy=True)
xparam = zeros((0,14),float)
yparam = zeros((0,14),floa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesin14xymult_cfix(param, xyord,crossord,t, x, y):\n # 2010-04-27 11:49 IJC: Created\n # 2010-05-28 15:42 IJC: Added x*y cross-terms\n # 2010-07-21 13:02 IJC: switched to a mostly-additive model\n\n param = array(param,copy=True)\n x = array(x,copy=True)\n y = array(y,copy=True)\n t = a... | [
"0.65608644",
"0.594515",
"0.58846503",
"0.5867793",
"0.5832695",
"0.58171797",
"0.57470024",
"0.5713417",
"0.56928754",
"0.5662012",
"0.5634451",
"0.55318075",
"0.5516572",
"0.549371",
"0.540846",
"0.53837234",
"0.5356517",
"0.5355941",
"0.5286207",
"0.5279955",
"0.5279816",... | 0.67140144 | 0 |
compute 3parameter eclipse function of a single event, and account for 14 different possible flux offsets and X/Y positional motions. | def eclipse14_single(param, tparam, t, xyord=None, x=None, y=None):
# 2011-05-14 16:06 IJMC: Adapted from upsand phase curve routines;
# also adapting Agol et al. 2010's Spitzer
# work.
param = array(param,copy=True)
tparam = array(tparam,copy=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v2v3event(particlelist, vn_event_sums,\n ptmin=0.2, ptmax=2.0, etacut=1.0,\n particletype=None):\n if len(particlelist) > 1:\n if type(etacut) is tuple:\n etamin = etacut[0]\n etamax = etacut[1]\n else:\n etamin = -etacut\n ... | [
"0.60177284",
"0.5453255",
"0.54184663",
"0.5255606",
"0.51818484",
"0.51708764",
"0.51687217",
"0.5163818",
"0.51495034",
"0.5145504",
"0.51230687",
"0.5119626",
"0.50845283",
"0.5078434",
"0.50371337",
"0.50144976",
"0.4994259",
"0.4993345",
"0.49676356",
"0.49601093",
"0.4... | 0.5598986 | 1 |
compute phase function with a fixed period=1, assuming a sinusoid, and account for 14 different possible flux offsets and X/Y positional motions. Input data 't','x','y' must therefore be of size (14xN); if not, it will be reshaped into that. "xyord" determines the linear order of the polynomial in x and y. | def phasesin14xymult_cfix(param, xyord,crossord,t, x, y):
# 2010-04-27 11:49 IJC: Created
# 2010-05-28 15:42 IJC: Added x*y cross-terms
# 2010-07-21 13:02 IJC: switched to a mostly-additive model
param = array(param,copy=True)
x = array(x,copy=True)
y = array(y,copy=True)
t = array(t,copy=T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def phasesin14xymult(param, xyord,crossord,t, x, y):\n # 2010-04-27 11:49 IJC: Created\n # 2010-05-28 15:42 IJC: Added x*y cross-terms\n\n param = array(param,copy=True)\n x = array(x,copy=True)\n y = array(y,copy=True)\n t = array(t,copy=True)\n\n xparam = zeros((0,14),float)\n yparam = ze... | [
"0.67138314",
"0.5945848",
"0.58877563",
"0.58683467",
"0.58335227",
"0.58184725",
"0.5746876",
"0.57133985",
"0.5695904",
"0.5663573",
"0.5634777",
"0.5532197",
"0.55188274",
"0.54977125",
"0.54095113",
"0.5384878",
"0.53585947",
"0.53561586",
"0.5287892",
"0.52821213",
"0.5... | 0.6561128 | 1 |
Return mean of a nominally unityamplitude lambertian with a given inclination angle, using function 'lambertian'. inc is in radians. | def lambertian_mean(inc,n=5000):
# 2010-03-23 16:56 IJC: Created
phase = linspace(0,2*pi,n)
if hasattr(inc,'__iter__'):
ret = zeros(len(inc),float)
for ii in range(len(inc)):
ret[ii] = lambertian(phase,inc=inc[ii]).mean()
else:
ret= lambertian(phase,inc=inc).mean()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lambertian_amplitude(inc,n=5000):\n # 2010-03-23 16:56 IJC: Created\n phase = [0,pi]\n if hasattr(inc,'__iter__'):\n ret = zeros(len(inc),float)\n for ii in range(len(inc)):\n ret[ii] = diff(lambertian(phase,inc=inc[ii]))[0]\n\n else:\n ret= diff(lambertian(phase,inc... | [
"0.69216895",
"0.6442947",
"0.59567684",
"0.59311223",
"0.58383197",
"0.5665532",
"0.56536484",
"0.5629359",
"0.56233203",
"0.5615936",
"0.5530123",
"0.55230784",
"0.5467007",
"0.5447641",
"0.53501725",
"0.5343745",
"0.534307",
"0.5330659",
"0.5324447",
"0.5308279",
"0.524032... | 0.7554715 | 0 |
Return amplitude of a nominally unityamplitude lambertian with a given inclination angle, using function 'lambertian'. inc is in radians. | def lambertian_amplitude(inc,n=5000):
# 2010-03-23 16:56 IJC: Created
phase = [0,pi]
if hasattr(inc,'__iter__'):
ret = zeros(len(inc),float)
for ii in range(len(inc)):
ret[ii] = diff(lambertian(phase,inc=inc[ii]))[0]
else:
ret= diff(lambertian(phase,inc=inc))[0]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lambertian(ophase, inc=pi/2):\n # 2009-12-16 10:07 IJC: Created based on Hansen 2008 (ApJS 179:484) Eq. 43\n # and Barnes et al. 2007 (MNRAS 379:1097) Eq. 2.\n #\n # 2011-09-25 22:36 IJMC: Added test to speed up inc=pi/2 case.\n # 2011-10-11 17:28 IJMC: Removed that test.\n apparentphase = a... | [
"0.6993683",
"0.65418565",
"0.6221891",
"0.6124694",
"0.5749966",
"0.56889457",
"0.55505353",
"0.55221915",
"0.5376971",
"0.53734297",
"0.5369495",
"0.536165",
"0.5346",
"0.5335469",
"0.5333669",
"0.53249264",
"0.52953833",
"0.5294709",
"0.5269071",
"0.5249275",
"0.5227276",
... | 0.7803191 | 0 |
Compute a slice model via Cowan & Agol (2008). xi is from 0 to 2pi | def slicemodel(param, xi):
# 2009-12-15 15:14 IJC: Created, but doesn't work correctly yet.
const = param[0]
phi0 = param[1]
nslices = len(param)-2
Jcoef = param[2::]
dphi = 2*pi/nslices
phi = phi0+arange(nslices)*dphi
# Gmatrix0 = zeros((len(xi),nslices),float)
# for ii in range(len(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slice(\n sample, \n ei, psi_axis,\n hkl0, hkl_dir, x_axis, \n instrument, erange,\n out):\n from mcvine.workflow.sample import loadSampleYml\n sample = loadSampleYml(sample)\n code = \"from mcvine.workflow.DGS import %s as mod\" % instrument\n d = {}; exec(code, d... | [
"0.5558635",
"0.5491043",
"0.54368687",
"0.54140675",
"0.5383694",
"0.5297831",
"0.52977383",
"0.5295262",
"0.5251312",
"0.51679826",
"0.5158371",
"0.51513",
"0.5134503",
"0.51236784",
"0.5048197",
"0.50368613",
"0.5012144",
"0.50040543",
"0.49866867",
"0.49557027",
"0.495071... | 0.6704374 | 0 |
Wrap parameters that are jointly constrained. | def wrap_joint_params(params, jointpars):
nparam = len(params)
njoint = len(jointpars)
ret_ind = []
ret_par = []
already_joint = []
all_joint = []
for joint_constraint in jointpars:
j0 = joint_constraint[0]
if j0 in already_joint:
ind = already_joint.index(j0)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def potential_parameters(cls):\n raise NotImplementedError()",
"def joint_validation(self, params: Dict, on_error: str) -> Dict:\n # if we have nothing, do nothing\n if not self._joint_constraints:\n return params\n\n exceptions = {}\n validated = params.copy()\n\n ... | [
"0.58329976",
"0.56655735",
"0.547857",
"0.54322416",
"0.53959167",
"0.5361888",
"0.52875906",
"0.52755874",
"0.5236427",
"0.52112186",
"0.51904124",
"0.5160224",
"0.5129974",
"0.5122892",
"0.51214075",
"0.50963515",
"0.50702107",
"0.50649947",
"0.5047309",
"0.5045038",
"0.50... | 0.5729199 | 1 |
Remove the mean files created | def removeMeanFile(indexName,DATA_path):
print 'Finish \n Remove useless files'
tileList = glob.glob(DATA_path +'/' + indexName+'/*')
for tile in tileList:
meanList = glob.glob(tile + '/*_MEAN.tif')
for file in meanList:
os.remove(file)
return 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_leftovers(self):\n for each_file, artist in self.past_songs_db_data:\n if os.path.isfile(each_file): \n os.remove(each_file)\n print \"Deleted \" + each_file\n\n for each_file in os.listdir(\".\"):\n if each_file.endswith(\".jpg\"):\n ... | [
"0.7269089",
"0.720845",
"0.6930391",
"0.686886",
"0.6820549",
"0.68102807",
"0.6809915",
"0.67777205",
"0.6766671",
"0.674512",
"0.6723518",
"0.6714157",
"0.6694325",
"0.6692548",
"0.6684028",
"0.6656658",
"0.66487384",
"0.6648208",
"0.66174626",
"0.66171485",
"0.6614481",
... | 0.7323861 | 0 |
Get the indexName mean value in the tile | def find_indexName(chosenTile, pointSHP, maskCLD, maskWTR):
meanindexName = chosenTile[:-4]+'_MEAN.tif'
if glob.glob(meanindexName) == []: # -- not created yet
#cloud mask
command1 = 'gdal_calc.py -A' + chosenTile + ' -B ' + maskCLD + ' --outfile=out1.tif --calc="A*(B == 0)+99*(B > 0)"'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mean_average_position():\n pass",
"def get_mean(self):\n mean = np.array(np.zeros((4,8)))\n for i,c in enumerate(self.cellLines):\n for j,l in enumerate(self.ligands):\n mean[i][j] = self.aucs[c][l]['mean']\n return mean",
"def _get_average(self):\n ... | [
"0.67386925",
"0.65065646",
"0.6417927",
"0.63048095",
"0.62725115",
"0.6236218",
"0.61919445",
"0.61919445",
"0.6162649",
"0.61430645",
"0.61273414",
"0.6118192",
"0.6105553",
"0.60957664",
"0.60656667",
"0.60380656",
"0.60256815",
"0.60125643",
"0.60125643",
"0.60024476",
"... | 0.67767483 | 0 |
Return path of corresponding cloud mask for date and tile | def getCloudMask(date, Date, indexName, tileName):
mask = date.replace('/' + indexName + '/' + tileName,'/rawData/' + tileName + '/' + Date)
mask = mask.replace('_' + indexName + '_' + Date +'.tif', '_' + Date + '_Sen2corMask.tif')
return mask | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_tile_path(self, **kwargs) -> Union[CloudPath, Path]:\n band = kwargs.pop(\"band\")\n if band == PAN:\n tile_path = self._get_path(\"PAN\", \"tiff\")\n else:\n tile_path = self._get_path(\"MUX\", \"tiff\")\n\n return tile_path",
"def GetMapId(landsat, dat... | [
"0.6408794",
"0.59681356",
"0.59649897",
"0.5712706",
"0.5646497",
"0.5565184",
"0.5560904",
"0.5533625",
"0.5435003",
"0.5329485",
"0.53238004",
"0.531633",
"0.53000957",
"0.52897215",
"0.528203",
"0.52805805",
"0.52708584",
"0.5263488",
"0.5263488",
"0.5225961",
"0.5207441"... | 0.7214702 | 0 |
Test that positional arguments work if multiple extra constraints found only in the output are added. | def test_positionalargs_4(self):
extra_cons = set([Constraint('animal', ['moose', 'kangaroo']),
Constraint('colour', ['blue'])])
the_process_unit = ProcessUnit([self.a_pattern_ds], '/another/%file%/%pattern%_%animal%_%colour%.txt',
'echo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_star_args_with_positional():\n assert arguments.fun_star_params('blue', 'red', 'yellow',\n 'orange') == ('blue', 'red', 'yellow',\n 'orange')",
"def test_variadic_addition_identity(self):\n self.assertIdentit... | [
"0.67235935",
"0.6532054",
"0.65260464",
"0.64505523",
"0.6368854",
"0.6292335",
"0.6286837",
"0.626627",
"0.62465155",
"0.6167805",
"0.61208713",
"0.6073072",
"0.60674345",
"0.6053496",
"0.6047789",
"0.6029346",
"0.6015611",
"0.5999145",
"0.5989706",
"0.5984824",
"0.5966147"... | 0.6653804 | 1 |
Test that datasets/file creators always maintain their correct constraints during constraint overwrites. | def test_overwrites(self):
extra_con = set([Constraint('fake', ['OVERWRITE'])])
the_process_unit = ProcessUnit([self.a_pattern_ds], '/%fake%/%file%/%pattern%.txt',
'echo', extra_constraints=extra_con)
ds_result = the_process_unit.execute(simulate=True)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_constraint_overwrite(self):\n\n extra_con = set([Constraint('fake', [])])\n\n self.assertRaises(EmptyOverwriteError, ProcessUnit, [self.a_pattern_ds], '/%fake%/%file%/%pattern%.txt',\n 'echo', extra_constraints=extra_con)",
"def test_create_existing(setup_tea... | [
"0.6886661",
"0.64232963",
"0.63758135",
"0.63706905",
"0.61134946",
"0.59883267",
"0.5982239",
"0.5977779",
"0.5959533",
"0.5957354",
"0.59331",
"0.5847821",
"0.5828403",
"0.5808258",
"0.5795557",
"0.5779004",
"0.5750403",
"0.5702417",
"0.56890535",
"0.5684893",
"0.56802624"... | 0.6757591 | 1 |
Test that ProcessUnit throw an exception if a constraint is overwritten with nothing. | def test_empty_constraint_overwrite(self):
extra_con = set([Constraint('fake', [])])
self.assertRaises(EmptyOverwriteError, ProcessUnit, [self.a_pattern_ds], '/%fake%/%file%/%pattern%.txt',
'echo', extra_constraints=extra_con) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_empty_system_error():\n system = vermouth.system.System()\n sequence = \"not empty\"\n processor = dssp.AnnotateResidues(\"test\", sequence)\n with pytest.raises(ValueError):\n processor.run_system(system)",
"def test_create_unexpected_problem(self):\n pass"... | [
"0.62136704",
"0.61944026",
"0.61499506",
"0.6117709",
"0.6088426",
"0.60848063",
"0.60480076",
"0.60292757",
"0.59937936",
"0.598061",
"0.5969905",
"0.59661067",
"0.59559244",
"0.5936788",
"0.5934196",
"0.5926956",
"0.588465",
"0.5864898",
"0.58642995",
"0.5858239",
"0.58555... | 0.74219686 | 0 |
Create list of charts to display data from the religion category Args | def create_religion_chart(region_list, comparison):
if comparison == 'field':
qty_data = create_data_by_field_qty(region_list, 'religion')
qty_chart = {
'chartType': 'bar',
'chartName': 'Agama menurut Jumlah Penganut',
'dataFields': qty_data,
'dataOpti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_education_chart(region_list, comparison):\n print('education chart HI')\n print(comparison)\n if comparison == 'field':\n qty_data = create_data_by_field_qty(region_list, 'education')\n qty_chart = {\n 'chartType': 'bar',\n 'chartName': 'Status Pendidikan men... | [
"0.70172465",
"0.6905521",
"0.66877943",
"0.65900254",
"0.6435721",
"0.63904333",
"0.6358763",
"0.6291725",
"0.6223515",
"0.62197506",
"0.6128046",
"0.61085874",
"0.5951552",
"0.59405637",
"0.59371626",
"0.58832854",
"0.5854525",
"0.5841675",
"0.58209586",
"0.5628246",
"0.561... | 0.7173047 | 0 |
Create list of charts to display data from the education category Args | def create_education_chart(region_list, comparison):
print('education chart HI')
print(comparison)
if comparison == 'field':
qty_data = create_data_by_field_qty(region_list, 'education')
qty_chart = {
'chartType': 'bar',
'chartName': 'Status Pendidikan menurut Jumlah ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_demographics_chart(region_list, comparison):\n if comparison == 'field':\n data = create_data_by_field_qty(region_list, 'demographics')\n \n age_labels = [(data['labels'][index].split(' ')[0] + ' Tahun') \n for index in range(0, len(data['labels']),2)]\n a... | [
"0.6447085",
"0.6299024",
"0.61784834",
"0.6113023",
"0.60966355",
"0.60863423",
"0.6046734",
"0.599045",
"0.58958644",
"0.58944225",
"0.5827547",
"0.57964367",
"0.5763116",
"0.57579774",
"0.5738665",
"0.5702705",
"0.56980443",
"0.56602824",
"0.5641582",
"0.56340563",
"0.5573... | 0.7156188 | 0 |
Create list of charts to display data from the marriage category Args | def create_marriage_chart(region_list, comparison):
if comparison == 'field':
qty_data = create_data_by_field_qty(region_list, 'marriage')
qty_chart = {
'chartType': 'bar',
'chartName': 'Status Pernikahan menurut Jumlah Orang',
'dataFields': qty_data,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_figures(): \n # extract data needed for visuals\n # TODO: Below is an example - modify to extract data for your own visuals\n genre_counts = df.groupby('genre').count()['message']\n genre_names = list(genre_counts.index)\n \n # create visuals\n # TODO: Below is an example - modify t... | [
"0.65612787",
"0.6427614",
"0.6392532",
"0.63900304",
"0.63766056",
"0.6248469",
"0.61734885",
"0.6173287",
"0.61542183",
"0.61362606",
"0.61185265",
"0.6094418",
"0.60209054",
"0.59958816",
"0.59523547",
"0.5905493",
"0.5886236",
"0.5879398",
"0.5715373",
"0.5681156",
"0.562... | 0.71163476 | 0 |
Create list of charts to display data from the occupation category Args | def create_occupation_chart(region_list, comparison):
if comparison == 'field':
qty_data = create_data_by_field_qty(region_list, 'occupation')
qty_data['labels'] = \
[label for label, value in
sorted(zip(qty_data['labels'], qty_data['values']),
key=lamb... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_education_chart(region_list, comparison):\n print('education chart HI')\n print(comparison)\n if comparison == 'field':\n qty_data = create_data_by_field_qty(region_list, 'education')\n qty_chart = {\n 'chartType': 'bar',\n 'chartName': 'Status Pendidikan men... | [
"0.68827295",
"0.6521634",
"0.64433783",
"0.6385488",
"0.6384769",
"0.5967891",
"0.59375775",
"0.5937433",
"0.5919973",
"0.5913179",
"0.58811724",
"0.5861581",
"0.577935",
"0.57618207",
"0.56972474",
"0.5675738",
"0.5636817",
"0.56209934",
"0.55947834",
"0.5578305",
"0.552543... | 0.685819 | 1 |
Create list of charts to display data from the demographics category Args | def create_demographics_chart(region_list, comparison):
if comparison == 'field':
data = create_data_by_field_qty(region_list, 'demographics')
age_labels = [(data['labels'][index].split(' ')[0] + ' Tahun')
for index in range(0, len(data['labels']),2)]
age_values =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_figures(): \n # extract data needed for visuals\n # TODO: Below is an example - modify to extract data for your own visuals\n genre_counts = df.groupby('genre').count()['message']\n genre_names = list(genre_counts.index)\n \n # create visuals\n # TODO: Below is an example - modify t... | [
"0.64887035",
"0.6425454",
"0.6188165",
"0.6107745",
"0.6030863",
"0.59806335",
"0.5975805",
"0.59084123",
"0.5892305",
"0.5885794",
"0.587466",
"0.5826502",
"0.5806763",
"0.57905096",
"0.5759637",
"0.56902796",
"0.56612587",
"0.56610143",
"0.5616925",
"0.5599751",
"0.5592356... | 0.66999614 | 0 |
Secret hash that is required for the AWS Cognito API to approve messages in the requests. | def secret_cognito_hash(
username: str,
cognito_client_id: str,
cognito_secret: str
) -> str:
message = bytes(username + cognito_client_id, encoding='utf-8')
key = bytes(cognito_secret, encoding='utf-8')
secret_hash = base64.b64encode(
hmac.new(
key=key,
msg=mess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_secret(self) -> str:",
"def hash_secret(secret):\n\n hashed = hashlib.sha256(secret.encode('UTF-8')).hexdigest()\n return hashed",
"def signature(self, params):\n string = ''.join(key + params[key] for key in sorted(params.keys()))\n return md5(string + self.cfg('secret'))",
"d... | [
"0.6285952",
"0.61680335",
"0.60634404",
"0.59742576",
"0.59260404",
"0.59242195",
"0.59174734",
"0.5913009",
"0.58721924",
"0.58720773",
"0.58693504",
"0.5836242",
"0.58053625",
"0.57602227",
"0.5759636",
"0.57243097",
"0.5721848",
"0.5721848",
"0.57196796",
"0.57111394",
"0... | 0.6382242 | 0 |
Get GC content from regions in fasta | def get_gc_content(regions, fasta):
nuc_count = {"T":0, "t":0, "A":0, "a":0, "G":1, "g":1, "C":1, "c":1}
gc = 0
total = 0
fasta_obj = pysam.FastaFile(fasta)
for region in regions:
seq = fasta_obj.fetch(region.chrom, region.start, region.end)
gc += sum([nuc_count.get(nuc, 0.5) for nuc in seq])
total... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_GC_content(fasta_file_name):\n\twith open(fasta_file_name) as fasta:\n\t\tGC_content = {}\n\t\tfor line in fasta:\n\n\t\t\t# Each line (bar the last) ends with '\\n'\n\t\t\tloc_line = line.replace('\\n', '')\n\n\t\t\t# Finds '>' at opening of line (FASTA seq title)\n\t\t\tif re.match(r'^>', loc_line):\n\t... | [
"0.69666755",
"0.65681994",
"0.62846404",
"0.6065371",
"0.60270053",
"0.59997725",
"0.59997725",
"0.5958652",
"0.58082724",
"0.57539946",
"0.5740331",
"0.5737429",
"0.57314235",
"0.5707113",
"0.5666827",
"0.5587664",
"0.55418855",
"0.553439",
"0.55216134",
"0.5511533",
"0.547... | 0.7642288 | 0 |
Processes single TFBS to split into bound/unbound and write out overview file | def process_tfbs(TF_name, args, log2fc_params): #per tf
#begin_time = datetime.now()
logger = TobiasLogger("", args.verbosity, args.log_q) #sending all logger calls to log_q
#Pre-scanned sites to read
bed_outdir = os.path.join(args.outdir, TF_name, "beds")
filename = os.path.join(bed_outdir, TF_name + "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main():\n summary = dict()\n gba_file = open('gettysburg.txt', 'r')\n for line in gba_file:\n Process_line(line, summary)\n Pretty_print(summary)",
"def go(self):\n num_fofs = self.fofs['fofid'].max()\n fof_splits = split.get_splits(num_fofs, self['chunksize'])\n\n for... | [
"0.59334326",
"0.5838689",
"0.5430998",
"0.5381692",
"0.53748393",
"0.53658724",
"0.5320097",
"0.5310378",
"0.5285263",
"0.5274821",
"0.5272687",
"0.5225805",
"0.5211069",
"0.51871365",
"0.5178446",
"0.5165865",
"0.5155472",
"0.51101565",
"0.5104917",
"0.50947344",
"0.5080871... | 0.6334211 | 0 |
Print words in all uppercase | def print_upper_words(words):
for word in words:
print(word.upper()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_upper_words(words):\n \n for word in words:\n print(word.upper())",
"def print_upper_words2(words):\n for word in words:\n if word.startswith('e') or word.startswith('E'):\n print(word.upper())",
"def print_upper_words(words, must_start_with):\r\n \r\n for word... | [
"0.84949166",
"0.76259404",
"0.7411538",
"0.73948556",
"0.7313403",
"0.71412116",
"0.70311576",
"0.6924786",
"0.6773954",
"0.67362446",
"0.6689822",
"0.66091335",
"0.6556132",
"0.6523016",
"0.6489142",
"0.64868987",
"0.64784133",
"0.64351785",
"0.64197814",
"0.63866544",
"0.6... | 0.8553235 | 0 |
Print words in all uppercase if it begins with 'e' or 'E' | def print_upper_words2(words):
for word in words:
if word.startswith('e') or word.startswith('E'):
print(word.upper()) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_upper_words_e(words):\n\n for word in words:\n if(word[0] == 'e' or word[0] == 'E'):\n print(word.upper())",
"def print_upper_words(words, must_start_with):\r\n \r\n for word in words:\r\n for letter in must_start_with:\r\n if word[0] == letter.lower() or word... | [
"0.85844994",
"0.7171785",
"0.7049642",
"0.70463455",
"0.6846043",
"0.67495584",
"0.67078906",
"0.6392759",
"0.62752545",
"0.62278193",
"0.61258984",
"0.61216027",
"0.6093943",
"0.6024315",
"0.6018429",
"0.6017567",
"0.60026884",
"0.6002622",
"0.5961179",
"0.5953035",
"0.5916... | 0.85592884 | 1 |
Render login page if user session doesn't exist. Otherwise, redirect to the main page. | def ShowLogin():
current_user = helpers.get_current_user()
if current_user is None:
return render_template('login.html')
else:
return redirect('/') | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index(self):\n\n # try and pull the user's data\n user = get_active_user_data()\n\n if not user:\n # they are not logged in give them the login form\n return render('/login_form.html')\n\n # they are logged in, pass them to the home page\n redirect('/')"... | [
"0.7577337",
"0.7542035",
"0.730404",
"0.7300982",
"0.7300982",
"0.72884965",
"0.72276837",
"0.7225841",
"0.7164196",
"0.71400774",
"0.7128193",
"0.71249926",
"0.7120856",
"0.7114936",
"0.71015465",
"0.71001863",
"0.7081934",
"0.7061329",
"0.70453066",
"0.70076215",
"0.699769... | 0.8165388 | 0 |
Sets credentials for oauth2callback and checks access token | def set_credentials(self, provider):
session['provider'] = provider
if 'credentials' not in session:
return redirect(url_for('login_ext.oauth2callback'))
credentials = OAuth2Credentials.from_json(session['credentials'])
if credentials.access_token_expired or not helpers.get_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_oauth(self, consumer_token, access_token):\n self.consumer_token = consumer_token\n self.access_token = access_token",
"def setup_oauth():\n # Request token\n oauth = OAuth1(CONSUMER_KEY, client_secret=CONSUMER_SECRET)\n r = requests.post(url=REQUEST_TOKEN_URL, auth=oauth)\n cre... | [
"0.70436364",
"0.6970619",
"0.6942008",
"0.6815597",
"0.6687587",
"0.6664585",
"0.6640964",
"0.6640964",
"0.65808064",
"0.6577609",
"0.65702975",
"0.6562963",
"0.6458676",
"0.6458676",
"0.64108735",
"0.6385271",
"0.6319517",
"0.6297945",
"0.6284185",
"0.6284185",
"0.6223342",... | 0.72411394 | 0 |
Get post by id. | def get_object(self, id):
try:
return Post.objects.get(id=id)
except Post.DoesNotExist:
raise Http404 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_post_by_id(self, id):\n post = None\n posts = self.session.query(Post).filter(Post.id == id).all()\n if len(posts) > 0:\n post = posts[0]\n return post",
"def get(self, id):\t\t\n\t\ttry:\n\t\t\treturn post_service.get(id)\n\t\texcept AssertionError as e:\n\t\t\tpo... | [
"0.8234621",
"0.81388056",
"0.7921888",
"0.7705977",
"0.7705673",
"0.7563272",
"0.7400398",
"0.73637426",
"0.7332798",
"0.7327831",
"0.7312274",
"0.7272618",
"0.72005653",
"0.71774244",
"0.7149527",
"0.71482265",
"0.71187687",
"0.70622504",
"0.70004386",
"0.6981111",
"0.69611... | 0.8489071 | 0 |
Compute the distance from obstacle boundary to agent Return a pair dist, point where point is the closet point on the obstacle to the agent | def agent_distance(self, agent):
if self.type == 'Line':
return self._line_intersection(self.params, (agent._position.x, agent._position.y))
elif self.type == 'Circle':
return self._circle_intersection(self.params, (agent._position.x, agent._position.y))
elif self.type ==... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_dist_to_poi(self,agent):\n mini_dist = 100000 \n for poi in self.poi_pos_list:\n mini_dist = np.linalg.norm(agent.get_pos() - poi)\n\n return mini_dist",
"def get_distance(self):\n print(\"voici la distance à l'obstacle\")",
"def DISTANCE(x,y,x2=0,y2=0):\n\tretu... | [
"0.68618286",
"0.6708586",
"0.65224326",
"0.6509963",
"0.64708257",
"0.6443723",
"0.6410915",
"0.6381989",
"0.6381989",
"0.63730466",
"0.633672",
"0.63200283",
"0.6307206",
"0.6283662",
"0.6268296",
"0.6262235",
"0.62569535",
"0.6251067",
"0.6250498",
"0.624112",
"0.61976177"... | 0.6740069 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.