query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Renders lambda2 contours of droplet data from Michael or Pablo's simulations, given a case config file and render config file.
def lambda2(case_config_filepath, render_config_filepath): # Load config file with all common directory names dirname_config = configparser.ConfigParser() dirname_config.read("dirname.cfg") # Get information from config files cconfd = load_config.get_config_params(case_config_filepath) rconfd ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(config):\n file_paths_info = [('GLOFRIS','WATCH','ARG_inunriver_historical_000000000WATCH_1980_rp01000.tif'),\n \t\t\t\t('GLOFRIS','RCP45','ARG_inunriver_rcp4p5_0000GFDL-ESM2M_2030_rp01000.tif'),\n \t\t\t\t('GLOFRIS','RCP85','ARG_inunriver_rcp8p5_0000GFDL-ESM2M_2030_rp01000.tif'),\n \t\t\t\t('...
[ "0.6074889", "0.574469", "0.5545353", "0.52796954", "0.52744776", "0.518162", "0.51216215", "0.5116855", "0.51122236", "0.50734866", "0.50516486", "0.5032492", "0.50160444", "0.49768373", "0.49333197", "0.4913025", "0.4899455", "0.4876432", "0.48720288", "0.48589456", "0.4857...
0.7535855
0
Calculates the distance between to points in the circular time.
def norm(self, XA, XB): d1 = abs(XA - XB) d2 = abs(XA - XB - 7*24*60) return np.vstack([d1, d2]).min(axis = 0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_to(self, circle):\n diff = tuple(map(sub, self.pos, circle.pos))\n return math.hypot(*diff)", "def _calculate_distance(self):\n xy = list(zip(self.x, self.y))\n\n dist = [0]\n for i in range(1, len(xy)):\n dist.append(self.distance_between_two_points(xy[...
[ "0.6774109", "0.6655058", "0.62920964", "0.62672186", "0.6257815", "0.6186058", "0.6183667", "0.61678165", "0.6142931", "0.6087921", "0.6072777", "0.6030249", "0.6014272", "0.60124606", "0.60053617", "0.59909576", "0.59702396", "0.5964829", "0.5959583", "0.5924536", "0.590831...
0.0
-1
Map time into an integer interval [0; 7 24 60[ representing the time of day and day of week with 1 minute granuality.
def transform_ix(self, ix): return (ix.dayofweek.values * self.timesteps_per_day + ix.map(lambda x: pd.to_timedelta(x.time().isoformat())).values / self.freq)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_min_to_day(time):\n return str(round(int(time) / (60 * 8), 1))", "def scaledTime():\n #return (time.gmtime().tm_wday, time.gmtime().tm_hour)\n epoch = time.strptime(\"2013-02-21 11:30:00\", \"%Y-%m-%d %H:%M:%S\")\n timeInSec = time.mktime(time.gmtime()) - time.mktime(epoch)\n hourSince = ...
[ "0.6587727", "0.6093808", "0.60330206", "0.5678907", "0.56553", "0.56367296", "0.55319023", "0.5520177", "0.5512654", "0.54910684", "0.5483596", "0.54657775", "0.53240174", "0.53161484", "0.52447605", "0.52369124", "0.51902425", "0.5186119", "0.51574695", "0.5155435", "0.5128...
0.4983597
32
remove white space & comments & unnecessary fields
def clean_data(self): for line in self.file: if line.startswith('//') or line.isspace(): continue if '//' in line: line = line.split('//')[0] line = line.replace('\n', '') line = line.replace(' ','') self.commands.append...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip(self):\n self.document_type = self.document_type.strip()\n self.document_reg_id = self.document_reg_id.strip()\n self.owner_cross_reference = self.owner_cross_reference.strip()\n self.routing_slip_number = self.routing_slip_number.strip()\n self.bcol_account = self.bcol...
[ "0.70774215", "0.6626586", "0.6582071", "0.64799535", "0.64024925", "0.63783985", "0.62964535", "0.6291502", "0.62791693", "0.62556684", "0.61780673", "0.61647797", "0.61475337", "0.61393124", "0.611319", "0.6105898", "0.6082494", "0.60794055", "0.60245603", "0.6024032", "0.6...
0.5920418
33
Unpack each command into it's underlying fields
def parse(self, command): split_command = command.split('=') semi = 1 dest = None if len(split_command) > 1: dest = split_command[0] else: semi = 0 c_or_j = split_command[semi].split(';') comp = c_or_j[0] jump = c_or_j[1] if len(c_o...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _extract_command(fields: List[bytes]) -> Tuple[Any, List[Any]]:\n cmd = encode_command(fields[0])\n if cmd in COMMANDS_WITH_SUB and len(fields) >= 2:\n cmd += \" \" + encode_command(fields[1])\n cmd_arguments = fields[2:]\n else:\n cmd_arguments = fields[1:]\n return cmd, cmd_a...
[ "0.6795791", "0.63592345", "0.6357638", "0.61161965", "0.59982604", "0.5759801", "0.57257724", "0.5696698", "0.56799316", "0.56750417", "0.5649418", "0.56269705", "0.5588096", "0.55799854", "0.5574093", "0.55649465", "0.5564419", "0.55429655", "0.55273384", "0.5524686", "0.55...
0.0
-1
Convert any decimal number into 16bit binary number
def convert_A_instruction(self, instruction): number = int(instruction) binary = bin(number).replace("0b", "") return binary.zfill(16)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dec2bin(num):\n bin = ''\n\n while num != 0:\n quotient = num // 2\n remainder = num % 2\n if remainder == 1:\n bin = '1' + bin\n else:\n bin = '0' + bin\n num = quotient\n\n # Pad with 0's to match 16 bits\n bin = '0' + (15 - len(bin)) * '0'...
[ "0.74449545", "0.71901727", "0.7109376", "0.7017403", "0.6926526", "0.6862779", "0.68603647", "0.6841977", "0.68113583", "0.67758965", "0.6762503", "0.6728445", "0.6727819", "0.66603327", "0.66486925", "0.6604718", "0.65684354", "0.6564815", "0.6509841", "0.64841473", "0.6461...
0.57144743
93
Translate any C instruction
def convert_C_instruction(self, instruction): comp, dest, jump = self.parse(instruction) return f"111{convert_comp(comp)}{convert_dest(dest)}" \ f"{convert_jump(jump)}"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compileInstruction(self, ins):\n pass", "def process(opcode):\n opcode.process()", "def gen_c_code(self, comp, dest, jump):\r\n return '111' + self.comp(comp) + self.dest(dest) + self.jump(jump)", "def c_instruction_parser(c_instruction):\n binary_res = '111'\n dest, comp, jmp = ''...
[ "0.6561874", "0.61943746", "0.60784996", "0.58676004", "0.58119315", "0.56691813", "0.5659387", "0.5633192", "0.5589402", "0.5568986", "0.55381376", "0.5535437", "0.5509358", "0.55061597", "0.549903", "0.5427867", "0.5420783", "0.54128903", "0.5401546", "0.5383139", "0.538116...
0.67511356
0
Translates line by line
def translate_line_by_line(self): for command in self.commands: if command.startswith('@'): # is A instruction number = command.split('@')[-1] instruction = self.convert_A_instruction(number) else: # is C instruction instruction = self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self):\n self.clean_data()\n self.clean_symbols()\n self.translate_line_by_line()", "def translate_direct(\n self,\n line: str,\n from_relative: bool = True,\n unmask: bool = True,\n ) -> str:\n\n # Try ITL translation\n translated_l...
[ "0.6953802", "0.6668016", "0.65168977", "0.63958037", "0.6371038", "0.6291207", "0.6279356", "0.6183269", "0.6148969", "0.6125871", "0.612013", "0.61089617", "0.6097882", "0.60840136", "0.6024646", "0.6024646", "0.59851706", "0.5943913", "0.5907185", "0.58994555", "0.5879098"...
0.6114247
11
Finds labels inside commands and fills the symbol table with labels
def add_labels(self): counter = 0 labels_list = [] for i in range(len(self.commands)): command = self.commands[i] if command.startswith('('): raw_value = command.replace('(', '').replace(')', '') self.symbol_table[raw_value] = str(counter) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_symbols(self):\n self.add_labels()\n variable_counter = 16\n for i in range(len(self.commands)):\n command = self.commands[i]\n if command.startswith('@'): # symbols always reside in A instructions\n value = command.split('@')[1]\n ...
[ "0.6857181", "0.59875345", "0.5967218", "0.59576654", "0.59051675", "0.5721235", "0.5716886", "0.5536359", "0.5536359", "0.5535116", "0.5508334", "0.5488973", "0.54202247", "0.5391605", "0.53611904", "0.53439146", "0.5304387", "0.5279485", "0.5262439", "0.5260879", "0.5241737...
0.7957542
0
Cleans and replace symbol commands with corresponding numerical values
def clean_symbols(self): self.add_labels() variable_counter = 16 for i in range(len(self.commands)): command = self.commands[i] if command.startswith('@'): # symbols always reside in A instructions value = command.split('@')[1] if not valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_num(quote):\n for char in ROMAN:\n quote = quote.replace(*char)\n return quote", "def _hill_normalize_symbol(symb):\n symb = ptab.to_symbol(symb)\n if symb == 'C':\n symb = ''\n if symb == 'H':\n symb = '1'\n return symb", "def clean_inpu...
[ "0.6367131", "0.5781873", "0.57104903", "0.569682", "0.5692085", "0.5543413", "0.55233794", "0.5514841", "0.55030894", "0.55004317", "0.54772264", "0.53819984", "0.5351693", "0.5292913", "0.52664244", "0.52580327", "0.5227113", "0.5208533", "0.5203274", "0.5201695", "0.519784...
0.6928754
0
Translate the whole file into language machine
def translate(self): self.clean_data() self.clean_symbols() self.translate_line_by_line()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate(self, filepath):\n pass", "def translate(self, language=None):", "def translate():\n pass", "def load_language(self, file: str):\n from App import App\n\n try:\n qm_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'translate', '{0}.qm'.form...
[ "0.7801424", "0.69807875", "0.6772875", "0.66117966", "0.6548898", "0.6513693", "0.635359", "0.63453436", "0.63216937", "0.63002735", "0.62734467", "0.62678146", "0.62483066", "0.62475544", "0.623506", "0.6229862", "0.6215358", "0.6189174", "0.61711746", "0.6167787", "0.61544...
0.5770561
48
Recursively convert a class instance into a dict
def instance_to_dict(obj): if isinstance(obj, (int, float, complex, bool, str)): return obj if isinstance(obj, dict): new = {} for k in obj: new[k] = instance_to_dict(obj[k]) return new if isinstance(obj, (list, tuple)): new = [] for val ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classToDict(obj=None):\n\tif obj == None:\n\t\treturn {}\n\n\t_obj = {}\n\t_obj.update(obj.__dict__)\n\n\treturn _obj", "def _reconstruct_object(deserialized_data):\n for key, value in deserialized_data.items():\n key = key.strip('__')\n if key in registry:\n # Gat...
[ "0.72499406", "0.66734415", "0.6611861", "0.6565489", "0.65465987", "0.650528", "0.650528", "0.6496662", "0.6496662", "0.6496662", "0.6496662", "0.6496662", "0.6496662", "0.6496662", "0.6447857", "0.641881", "0.6401291", "0.6376264", "0.6236578", "0.6230756", "0.6205352", "...
0.63586015
18
Select the top directory of a local repository
def _cdrepo(self, cmdp): topdir = cmdp.get("P1") if cmdp.missing_options(): # syntax error return False if not FileUtil(topdir).isdir(): Msg().out("Warning: localrepo directory is invalid: ", topdir, l=Msg.WAR) return False...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topdir(self):\n if self._topdir:\n return self._topdir\n\n topleveldata = self.git(\"rev-parse\", \"--show-toplevel\")\n self._topdir = topleveldata[0]\n return self._topdir", "def download_and_expand(self):\n top_dir_name = None\n if self.git_branch:\n ...
[ "0.6676338", "0.63332224", "0.6175567", "0.5963609", "0.59066826", "0.5878462", "0.58573663", "0.5803019", "0.57918125", "0.5761793", "0.5724602", "0.567481", "0.56393355", "0.5614459", "0.556418", "0.5514977", "0.54896814", "0.5479407", "0.54178846", "0.5404872", "0.53940415...
0.51087016
49
Check image repository syntax
def _check_imagerepo(self, imagerepo, def_imagerepo=None): if (not imagerepo) and def_imagerepo: imagerepo = def_imagerepo if not (imagerepo and self.dockerioapi.is_repo_name(imagerepo)): Msg().err("Error: enter image or repository/image without tag") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_is_image(self):\n os.chdir(\"testimages/\")\n self.assertTrue(fileactions.is_image(\"arch_001.jpg\"))\n self.assertFalse(fileactions.is_image(\"not_an_image.jpg\"))", "def test_retag_valid_image(self):\n alpine = self.docker.images.get(constant.ALPINE)\n self.assertTru...
[ "0.6336709", "0.6169546", "0.6166247", "0.6060373", "0.60160655", "0.5999812", "0.59383214", "0.59234333", "0.59208727", "0.5914319", "0.58909905", "0.58080614", "0.5795945", "0.5780402", "0.5769773", "0.57520026", "0.5743581", "0.57263833", "0.57217544", "0.5716045", "0.5688...
0.5792978
13
Split image repo into hostname, repo, tag
def _split_imagespec(self, imagerepo): if not imagerepo: return ("", "", "", "") transport = "" hostname = "" image = imagerepo tag = "" try: if "://" in imagerepo: (transport, dummy, hostname, image) = imagerepo.split('/', 4) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_tag(image_name):\n image = image_name.split(\":\", maxsplit=1)\n if len(image) > 1:\n image_repo = image[0]\n image_tag = image[1]\n else:\n image_repo = image[0]\n image_tag = None\n return image_repo, image_tag", "def parse_repository_tag(repo_path):\n tag_s...
[ "0.7415347", "0.6681896", "0.5815166", "0.57984143", "0.57817656", "0.5764575", "0.56510293", "0.56285614", "0.56158316", "0.55907804", "0.5500821", "0.5430561", "0.5380617", "0.5327849", "0.5274233", "0.52718174", "0.5269566", "0.52640927", "0.52619106", "0.5259118", "0.5233...
0.6290939
2
Print search results from v1 or v2 API
def _search_print_lines(self, repo_list, lines, fmt): for repo in repo_list["results"]: if "is_official" in repo and repo["is_official"]: is_official = "[OK]" else: is_official = "----" description = "" for dfield in ("description",...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printSearchResults(results):\n Log.Debug('Search produced %d results:' % len(results))\n index = 0\n for result in results:\n Log.Debug(' ... %d: id=\"%s\", name=\"%s\", year=\"%s\", score=\"%d\".' %\n (index, result.id, result.name, str(result.year), result.score))\n index += 1", "def ...
[ "0.6891991", "0.6512108", "0.64644086", "0.64285165", "0.6408339", "0.6385779", "0.6382697", "0.63571036", "0.63463515", "0.632945", "0.6305969", "0.62940735", "0.62740153", "0.62194717", "0.6185647", "0.6170451", "0.6154677", "0.61358446", "0.6106197", "0.6106097", "0.607557...
0.0
-1
Print search header and loop over search results
def _search_repositories(self, expression, pause="", no_trunc=""): term_lines, dummy = HostInfo().termsize() term_lines -= 2 fmt = "%-55.80s %8.8s %-70.70s %5.5s" if no_trunc: fmt = "%-55s %8s %-70s %5s" while True: lines = term_lines while lin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_results(self, results):\n for index, item in enumerate(results):\n print '[%s] %s (%s) {%s}' % (\n index, \n self._color(item.title), \n self._color(item.year, 'RED'), \n self._color(item.imdbid, 'GREEN'))", ...
[ "0.6988774", "0.6842301", "0.6819385", "0.6422996", "0.6367422", "0.6351076", "0.63353205", "0.6321667", "0.62416255", "0.6154546", "0.6148038", "0.61424947", "0.61287236", "0.61008203", "0.60572964", "0.60315955", "0.59376514", "0.59365815", "0.5913392", "0.5906492", "0.5887...
0.0
-1
List tags for repository
def _list_tags(self, expression): try: for tag in self.dockerioapi.get_tags(expression): Msg().out(tag) return self.STATUS_OK except (KeyError, TypeError, ValueError): return self.STATUS_ERROR
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_list_tags(cs, args):\n resp, tags = cs.repositories.list_tags(args.repository)\n tags = [{\"Tag\": t} for t in tags]\n utils.print_list(tags, [\"Tag\"], sortby=\"Tag\")", "def list_tags():\r\n tags = Tag.query.order_by(Tag.name).all()\r\n return render_template('tags.html', tags=tags)", "...
[ "0.8235992", "0.7776253", "0.7739009", "0.77201414", "0.7666957", "0.7369898", "0.7295655", "0.727383", "0.72511375", "0.7148935", "0.7112638", "0.70888156", "0.7034062", "0.7034062", "0.70196223", "0.7003448", "0.6994803", "0.69832987", "0.6953225", "0.691466", "0.68806005",...
0.6908422
20
Auxiliary to create(), performs the creation
def _create(self, imagespec): if not self.dockerioapi.is_repo_name(imagespec): Msg().err("Error: must specify image:tag or repository/image:tag") return False (imagerepo, tag) = self._check_imagespec(imagespec) if imagerepo: return ContainerStructure(self.loca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create():", "def create():", "def create(self):", "def create(self):\n ...", "def create(self):\n pass", "def create(self):\n pass", "def create(self):\n pass", "def create(self):\n\n pass", "def create(self):\n\t\tself.creating += 1\n\t\ttry:\n\t\t\tself.adop...
[ "0.8645303", "0.8645303", "0.8227992", "0.8027747", "0.80269367", "0.80269367", "0.80269367", "0.7952623", "0.78722525", "0.7861714", "0.77917415", "0.760546", "0.74487746", "0.7309258", "0.720753", "0.7173948", "0.7096899", "0.69178706", "0.6909517", "0.69019216", "0.6900514...
0.0
-1
Read command line options into variables
def _get_run_options(self, cmdp, exec_engine=None): cmdp.declare_options("-v= -e= -w= -u= -p= -i -t -a -P") cmd_options = { "netcoop": { "fl": ("-P", "--publish-all", "--netcoop",), "act": "R", "p2": "CMD_OPT", "p3": False }, "portsmap"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReadOptions(self, args):\n (opts, args) = getopt.getopt(args, 'vxi:p:h:', ('help',))\n for (key, val) in opts:\n if key == '-h': self.hash = val\n elif key == '-i': self.input = val\n elif key == '-v':\n self.verbose = True\n util.verbose = True\n elif key == '-x':\n ...
[ "0.76137817", "0.7174512", "0.717139", "0.71648765", "0.71123534", "0.70884395", "0.7085598", "0.70027703", "0.69947946", "0.69752973", "0.69248885", "0.6923879", "0.6922594", "0.68928343", "0.68559855", "0.68326515", "0.68276066", "0.682651", "0.68139195", "0.6798384", "0.67...
0.0
-1
Build process trees from the process events.
def extract_process_tree( procs: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 debug: bool = False, ) -> pd.DataFrame: # Clean data procs_cln, schema = _clean_proc_data(procs, schema) # Merge parent-child merged_procs = _merge_parent_by_time(procs_cln, schema) if deb...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pslist(self) -> Generator[dict, None, None]:\n\n # Function to switch fields to represent a parent\n def _convert_to_parent_fields(process: dict) -> dict:\n output = {}\n for left, right in [\n (FieldNames.PROCESS_IMAGE, FieldNames.PARENT_PROCESS_IMAGE),\n ...
[ "0.5943494", "0.55186284", "0.5474236", "0.5396079", "0.5336486", "0.52977246", "0.5260086", "0.5252163", "0.5249161", "0.5246989", "0.5233202", "0.5203509", "0.5188407", "0.513476", "0.5126268", "0.51151633", "0.51142776", "0.5088811", "0.50620705", "0.49990997", "0.49866286...
0.56409377
1
Return cleaned process data.
def _clean_proc_data( procs: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 ) -> pd.DataFrame: procs = ensure_df_datetimes(procs, columns=schema.time_stamp) procs_cln = ( procs.drop_duplicates().sort_values(schema.time_stamp, ascending=True).copy() ) # Filter out any ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process(proc_data: List[Dict]) -> List[Dict]:\n return proc_data", "def process(proc_data):\n\n # No further processing\n return proc_data", "def post_process(cls, data):\n return data", "def clean_data(self):\n return self.instance.data", "def cleanData(self):\n clean_da...
[ "0.6538192", "0.64839023", "0.6480206", "0.63939846", "0.63180095", "0.6111915", "0.6008082", "0.60056484", "0.59588325", "0.59334844", "0.5918431", "0.59002125", "0.5883267", "0.5865411", "0.5735515", "0.5679415", "0.56767935", "0.56424737", "0.56317866", "0.56111044", "0.56...
0.0
-1
Change any numeric columns in our core schema to strings. Some columns like PID arrive as float or int types. We need to convert the floats to ints (since we want to get rid of the ".0") and then convert the int columns to str. We need to do this since we build parent/child keys by concatenating some of these value int...
def _num_cols_to_str( procs_cln: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 ) -> pd.DataFrame: # Change float/int cols in our core schema to force int schema_cols = [ col for col in attr.asdict(schema).values() if col and col in procs_cln.columns ] force_int_cols =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_int_to_str(df):", "def test__convert_to_str_dtype(self):\n new_column_types = process_mutation._convert_to_str_dtype(\n self.column_types, [\"foo\"]\n )\n assert new_column_types == {\"foo\": \"object\", \"bar\": \"object\"}", "def create_dtypes_str(df, max_size_stri...
[ "0.6355142", "0.62572265", "0.5918403", "0.58653873", "0.5677377", "0.55409217", "0.5471425", "0.54174095", "0.5401915", "0.538344", "0.5363697", "0.53505415", "0.5312164", "0.531032", "0.5267433", "0.52460843", "0.524159", "0.5227334", "0.521012", "0.5177431", "0.5173282", ...
0.6362964
0
Merge procs with parents using merge_asof.
def _merge_parent_by_time( procs: pd.DataFrame, schema: "ProcSchema", # type: ignore # noqa: F821 ) -> pd.DataFrame: parent_procs = ( procs[ [ schema.process_id, Col.EffectiveLogonId, Col.new_process_lc, Col.source_index, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example_staypoints_merge():\n p1 = Point(8.5067847, 47.4)\n\n t1 = pd.Timestamp(\"1971-01-01 00:00:00\", tz=\"utc\")\n t2 = pd.Timestamp(\"1971-01-02 05:00:00\", tz=\"utc\")\n t3 = pd.Timestamp(\"1971-01-02 06:45:00\", tz=\"utc\")\n t4 = pd.Timestamp(\"1971-01-02 08:55:00\", tz=\"utc\")\n t45...
[ "0.53150934", "0.51900065", "0.5058164", "0.5057662", "0.4970098", "0.48208147", "0.4743613", "0.4735923", "0.47224164", "0.4721508", "0.47203505", "0.47181934", "0.471794", "0.47002944", "0.4695418", "0.46933174", "0.46843734", "0.4682874", "0.46639788", "0.46583503", "0.465...
0.6610868
0
Find any inferred parents and creates rows for them.
def _extract_inferred_parents( merged_procs: pd.DataFrame, schema: "ProcSchema" # type: ignore # noqa: F821 ) -> pd.DataFrame: tz_aware = merged_procs.iloc[0][schema.time_stamp].tz time_zero = pd.Timestamp(0) if tz_aware is None else pd.Timestamp(0, tz=0) # Fill in missing values for root processes ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_parents_table(self) -> None:\n self.parents[\"A\"] = \"start\"\n self.parents[\"B\"] = \"start\"\n self.parents[\"fin\"] = None", "def add_parent(session, df):\n try:\n for _, row in df.iterrows():\n parent = Parent()\n parent.name = row['parent_name']...
[ "0.6303411", "0.6012777", "0.5910273", "0.58215433", "0.5800772", "0.5713827", "0.57043797", "0.56871605", "0.5639912", "0.559866", "0.5598546", "0.55693436", "0.55462885", "0.55434126", "0.551806", "0.54864657", "0.5474503", "0.5440947", "0.5439221", "0.5435651", "0.54315716...
0.5918984
2
Create process and parent keys for unambiguous parchild relation.
def _assign_proc_key( proc_data: pd.DataFrame, key_name: str, proc_name_col: str, proc_id_col: str, timestamp_col: str, ): proc_data[key_name] = ( proc_data[proc_name_col] + "|" + proc_data[proc_id_col].astype(str) + "|" + proc_data[timestamp_col].dt.round...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_to_parent_dict(self,):\n\n self.ParentMap = dict((c, p) for p in self.tree.iter() for c in p)\n self.ParentMap[self.tree.getroot()] = None\n return self.ParentMap", "def create_parent_dic(self):\n d = {}\n for tier_ID in self.tier_hierarchy:\n for child in self.tier_hi...
[ "0.57572216", "0.5712835", "0.5690991", "0.55551386", "0.5526629", "0.54811114", "0.5480439", "0.54562485", "0.5440117", "0.5391533", "0.5368373", "0.531684", "0.53044134", "0.5304233", "0.5288312", "0.5284614", "0.52710897", "0.52686024", "0.52510065", "0.52493143", "0.52471...
0.48914105
53
Returns the top 5 most similar winners from our pokemon league data, given a single winning team. myTeam list of 6 pokemon names. league league to be considering pokedex dictionary with pokemon names as keys to pokemon instances as values
def get_sim_winners(teamNames,league,pokedex): bData, wHtml = loadBattleData(league) similarities = loadSims() results = [] myTeam = [getSimPokemon(pkm,similarities) for pkm in teamNames] for d in bData: winner, loser = determineWinner(d) score = 0 for pkm in myTeam: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted):\n battleData, htmlData = loadBattleData(league)\n similarities = loadSims() \n \n #If not given an opponent team then simply randomly choose losers from the dataset to compare to.\n if len(oppTeam) == 0:\n picks = set([])\n ...
[ "0.68629056", "0.6324324", "0.6290573", "0.59425783", "0.57627666", "0.5678293", "0.5615375", "0.5570595", "0.55454636", "0.55168325", "0.55126613", "0.54787564", "0.54584044", "0.54436314", "0.54137397", "0.53918636", "0.53845763", "0.5351121", "0.5300444", "0.52985793", "0....
0.64874274
1
Returns loaded data associated with the league levels, or none if associated with no league data and also returns the associated winhtml file. league one of the 11 supported leagues
def loadBattleData(league): path = os.path.dirname(os.path.realpath(__file__)) fString = None try: idx = LEAGUERANKS.index(league) fString = path+RANKSTOWINLOSEFILES[idx] except: #No file associated with the league. return None, None try: with open(fString, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_leagues(self):\n here = os.path.dirname(os.getcwd())\n with open(os.path.join(here, self.LEAGUES_FILENAME)) as json_file:\n data = json.load(json_file)\n return data['leagues']", "def league(request,league_id=1):\n\n\t#define variables\n\targs = {}\n\tnews = []\n\n\t#gett...
[ "0.62932193", "0.61747855", "0.59221417", "0.58471715", "0.573756", "0.5722305", "0.5631495", "0.5613551", "0.55308914", "0.54132277", "0.5383598", "0.53657496", "0.5340374", "0.5316855", "0.5304499", "0.5278375", "0.52435386", "0.5204638", "0.5202595", "0.5198321", "0.512471...
0.74904084
0
Returns NUMTEAMSRETURN number of teams from curTeams as 'top' teams based on social data, along with a list of their scores. curTeams list of pokemon teams to consider oppTeam team of pokemon representing opponent team pokedex dictionary with pokemon names as keys to pokemon instances as values league one of the 11 sup...
def scoreTeams(curTeams, oppTeam, pokedex, league, minDistWanted): battleData, htmlData = loadBattleData(league) similarities = loadSims() #If not given an opponent team then simply randomly choose losers from the dataset to compare to. if len(oppTeam) == 0: picks = set([]) while (le...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_teams_score(self):\n for game in self._get_live_games():\n teams_playing = [x['abbreviation'] for index, x in game['teams'].items()]\n if self.team in teams_playing:\n # Our team is playing in this game, get the score \n ret...
[ "0.64131546", "0.6392766", "0.6295676", "0.6139448", "0.6011329", "0.5956912", "0.5847488", "0.5829533", "0.5760881", "0.57603544", "0.5741986", "0.57035077", "0.56517524", "0.56435174", "0.55979204", "0.55692106", "0.5568594", "0.55622953", "0.5561629", "0.555497", "0.555348...
0.74281716
0
Flip [to_swap] case each time it appears in phrase. >>> flip_case('Aaaahhh', 'a') 'aAAAhhh' >>> flip_case('Aaaahhh', 'A') 'aAAAhhh' >>> flip_case('Aaaahhh', 'h') 'AaaaHHH'
def flip_case(phrase, to_swap): swapped_phrase = "" uppercase = to_swap.upper() lowercased = to_swap.lower() for char in phrase: if char == uppercase: swapped_phrase = swapped_phrase + lowercased elif char == lowercased: swapped_phrase = swapped_phrase + uppercase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_case(phrase, to_swap):\n list_a_to_z = list(map(chr, range(ord('a'), ord('z')+1)))\n list_A_to_Z = list(map(chr, range(ord('A'), ord('Z')+1)))\n lam_down = lambda x: x.lower() if x.lower() == to_swap.lower() else x\n lam_up = lambda x: x.upper() if x.lower() == to_swap.lower() else x\n ltes...
[ "0.84883106", "0.82165617", "0.82154304", "0.6197163", "0.6135013", "0.60620505", "0.58573896", "0.58465344", "0.5793862", "0.5756991", "0.57033134", "0.5691282", "0.5594358", "0.5591244", "0.55755985", "0.5574078", "0.551618", "0.5500948", "0.5500948", "0.5396453", "0.538270...
0.8178259
3
Return the current visualization. Default is no visualization
def get_visualization(): if Visualization.__current_visualization is None: Visualization.set_visualization(NoVisualization()) return Visualization.__current_visualization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_graph(self):\n if self._linear_viewer.isVisible():\n return self._linear_viewer\n else:\n return self._flow_graph", "def get_default_plot(self):\n return self.default_plot", "def vis(self):\n \treturn self._vis", "def visual_reference(self) -> pulumi....
[ "0.7015167", "0.66728127", "0.6522938", "0.6354091", "0.6350514", "0.62987596", "0.6281821", "0.6218688", "0.62015843", "0.6179625", "0.61453456", "0.61453456", "0.61198264", "0.60377395", "0.60220164", "0.5964381", "0.5920324", "0.5883091", "0.5869931", "0.58525586", "0.5811...
0.85380006
0
Sets a new visualization.
def set_visualization(visualization): Visualization.__current_visualization = visualization
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_visualization(self, vis):\n # Destroy the old visualization to avoid leaking memory\n try:\n self.sizer.Remove(self.vis)\n self.vis.Destroy()\n except AttributeError:\n # Don't crash if there was no old visualization\n pass\n # Set the...
[ "0.75664", "0.67613727", "0.67532706", "0.67054766", "0.6348466", "0.6195793", "0.5890382", "0.58264846", "0.581631", "0.5799407", "0.5764887", "0.5696465", "0.5681003", "0.56570977", "0.565017", "0.56282824", "0.56247157", "0.56245434", "0.55731523", "0.5568358", "0.55621314...
0.775578
0
Sets a new node size
def set_node_size(self, new_node_size: float): self.node_size = new_node_size
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setsize(self, size):\n self.__size = size", "def onSize(self, event): \n\t\tw, h = self.GetClientSizeTuple()\n\t\tself.tree.SetDimensions(0, 0, w, h)", "def set_size(self, new_size: int):\n self.__tab_size = new_size\n self.__check_interpreter()\n self.__vals = [0...
[ "0.75852895", "0.7240643", "0.72272944", "0.7107579", "0.7069425", "0.6965684", "0.69520694", "0.69520694", "0.69520694", "0.69520694", "0.6937632", "0.69327074", "0.69160384", "0.6872866", "0.68569905", "0.684477", "0.6836281", "0.68328637", "0.6781417", "0.6777022", "0.6776...
0.89625835
0
Sets a new output directory
def set_output_directory(self, new_output_directory: str): self.output_directory = new_output_directory
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setOutputDir(self, outputdir):\n self.outputdir = outputdir\n if not os.path.isdir(outputdir):\n os.makedirs(outputdir)", "def setOutputDir(self,outdir):\n\n logger = self.logger\n runstring = self.runstring\n force = self.force\n\n logger.info(runstring + \"Output...
[ "0.82821107", "0.79771626", "0.79613644", "0.79485244", "0.7578691", "0.7565269", "0.75264466", "0.749439", "0.7429396", "0.732117", "0.731421", "0.72510153", "0.72462237", "0.72454363", "0.7220839", "0.7162419", "0.7140022", "0.6970236", "0.6948216", "0.6944635", "0.68645376...
0.8459192
0
Gives the visualization the oppertunity to prepare a node
def prepare_node(self, node): # Every change at the position of node will be recognized aexpr(lambda: node.position, globals(), locals())\ .on_change(lambda obs, oldv, newv: self.set_node_position(node, *newv))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_nodes(self):", "def draw_nodes(self):\n pass", "def draw(self):\n\n self.transform()\n\n node_object_age, proj_object_age = self._create_nodes_and_projections(nodetype='age')\n node_object_depth, proj_object_depth = self._create_nodes_and_projections(nodetype='depth')\n ...
[ "0.6763387", "0.65652966", "0.6554879", "0.60727996", "0.60079736", "0.6000999", "0.59870166", "0.58894426", "0.58782125", "0.58391124", "0.58299655", "0.58040935", "0.5766652", "0.57188344", "0.57129437", "0.5675168", "0.5668845", "0.566694", "0.56625974", "0.5605432", "0.56...
0.0
-1
Set the position of the node in the visualization.
def set_node_position(self, node, x, y, z=0): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_node_positions(self):", "def setPosition(self):\n self.data['pos-x'] = \"%s\" % self.x()\n self.data['pos-y'] = \"%s\" % self.y()", "def setPos(self, pos):\n self.cameraNode.setPos(pos)", "def set_node(self, index, node):\r\n self.loc.coord[index] = node", "def set_node_...
[ "0.80316544", "0.76723444", "0.7639938", "0.7504539", "0.7441997", "0.7374458", "0.7365325", "0.73483866", "0.73460287", "0.7272101", "0.72263426", "0.7222932", "0.7220022", "0.7213865", "0.721017", "0.71766853", "0.7170008", "0.71616125", "0.7080263", "0.7057288", "0.7053259...
0.85538656
0
Takes vtkRenderer instance and returns an IPython Image with the rendering.
def vtk_show(renderer, width = 400, height = 300): renderWindow = vtk.vtkRenderWindow() renderWindow.SetOffScreenRendering(1) renderWindow.AddRenderer(renderer) renderWindow.SetSize(width, height) renderWindow.Render() windowToImageFilter = vtk.vtkWindowToImageFilter() windowToImageFilter.Se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vtk_show(renderer, width=400, height=300):\n\t renderWindow = vtk.vtkRenderWindow()\n\t renderWindow.SetOffScreenRendering(1)\n\t renderWindow.AddRenderer(renderer)\n\t renderWindow.SetSize(width, height)\n\t renderWindow.Render()\n\t \n\t windowToImageFilter = vtk.vtkWindowToImageFilter(...
[ "0.66868466", "0.62471", "0.61158806", "0.6034977", "0.6034977", "0.5885496", "0.58395505", "0.579548", "0.57799315", "0.57737356", "0.5725774", "0.5700969", "0.56834227", "0.56787825", "0.5672762", "0.5659876", "0.56589764", "0.5652964", "0.5641683", "0.5605039", "0.56031024...
0.5572259
22
Method for populating a SimObject from a dictionary.
def from_dict(cls, dictionary): instance = cls() for key, value in dictionary.items(): instance.__dict__[key] = value return instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_dict(dict):\n return SIO_SDC(**dict)", "def from_dict(self, dict_=None):\n for key in dict_:\n if hasattr(self, key):\n setattr(self, key, dict_[key])", "def from_dict(cls, obj):\r\n raise NotImplementedError", "def _from_dict(self, data=None):\n ...
[ "0.6614978", "0.650077", "0.64925647", "0.6438353", "0.6405005", "0.6405005", "0.63604647", "0.63278633", "0.6316172", "0.62846863", "0.6272756", "0.62303245", "0.6150155", "0.61341256", "0.61329454", "0.61329454", "0.6121385", "0.6121385", "0.6121385", "0.6121385", "0.612138...
0.6175366
12
Return a dictionary version of the SimObject.
def to_dict(self): return self.__dict__
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(self) -> Dict[str, Any]:\n return json.loads(self.__sim.to_json())", "def to_obj(self):\n return dict()", "def get_dict(self):\n return", "def serial(self) -> dict:\n return self.__dict__", "def dict(self):\n return objToDict(self)", "def asdict():\n ...
[ "0.7300974", "0.71566254", "0.7147086", "0.71343255", "0.7122973", "0.7105217", "0.71000385", "0.70494294", "0.6987932", "0.6983818", "0.69807756", "0.69807756", "0.69807756", "0.69807756", "0.69807756", "0.69807756", "0.69807756", "0.6973431", "0.6933753", "0.69021446", "0.6...
0.68923783
24
Finds SNPs with respect to the reference genome and writes the SNPs to the answer file.
def find_and_write_snps(answer_file, ref_genome, reads, lookup_table, thresh=0.6): # Use the consensus algorithm to determine SNPs relative to the reference genome # Write the SNPs to the answer file # TODO use the thresh param print "Finding SNPs..." read_map = __map_reads__(ref_genome, reads, loo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_ssearch36_df(name, ssearch_df, fasta_inputs, out_dir):\n\n fasta_in = [x for x in fasta_inputs if name.split(\".fasta.ss\")[0] == re.sub(\".fasta$\",\"\",os.path.basename(x))][0]\n fasta_file = pyfasta.Fasta(fasta_in)\n print(name) \n try:\n os.mkdir(out_dir)\n except:\n pa...
[ "0.5883539", "0.5657296", "0.5609451", "0.558543", "0.55291706", "0.5528156", "0.55074143", "0.5490762", "0.544737", "0.54255885", "0.53950757", "0.5362691", "0.534965", "0.5343809", "0.53275824", "0.5321692", "0.53178936", "0.5309606", "0.5297632", "0.5287152", "0.52773654",...
0.80086577
0
Maps the given read to the best position in the reference genome, if possible. Returns the best matching position in the reference genome, or None if no match is found
def get_best_read_position(ref_genome, read, positions, thresh): least = 100 best_pos = None for p in positions: num_mismatches = get_num_mismatches(read, ref_genome, p) if num_mismatches < thresh and num_mismatches < least: least = num_mismatches best_pos = p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_read(self, ref, read, ref_offset=0):\n\n if read.alignment.mapping_quality < self.config.min_mapq:\n return\n\n ref_pos = read.alignment.position.position - ref_offset\n read_pos = 0\n # Use set(), as some cigar operations might generate duplicated positions,\n # E.g. for insertions...
[ "0.5876357", "0.5854108", "0.57206434", "0.5676287", "0.5448705", "0.53857327", "0.5371495", "0.534903", "0.5319156", "0.52762634", "0.5226709", "0.5220328", "0.51804584", "0.5161435", "0.5159765", "0.51551884", "0.5149118", "0.51190424", "0.50989544", "0.50494", "0.502948", ...
0.72140175
0
Returns the number of mismatches between the reference genome starting at the specified position and the given sequence
def get_num_mismatches(sequence, ref_genome, position): characters = list(sequence) num_mismatches = 0 for i in range(0, len(characters)): if position + i >= len(ref_genome): break if characters[i] != ref_genome[position + i]: num_mismatches += 1 return num_misma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_sequence_mismatches(seq):\n trans_table = str.maketrans('ACGT', 'TGCA')\n half_len = len(seq) // 2\n second_half = seq[-half_len:].translate(trans_table)\n mismatches = 0\n for i in range(half_len):\n if seq[i] != second_half[-i - 1]:\n mismatches += 1\n return mismatc...
[ "0.7436655", "0.6384281", "0.63605845", "0.6251416", "0.6141242", "0.61273175", "0.60552704", "0.59271526", "0.58729815", "0.5872581", "0.5860833", "0.5816268", "0.5784733", "0.5768097", "0.5741856", "0.5740558", "0.5737593", "0.5729271", "0.5711081", "0.5703184", "0.56574935...
0.86014587
0
Returns the allele with the highest count.
def get_consensus_allele(alleles): allele_counts = {} for a in alleles: assert a in __allele_alphabet__ try: allele_counts[a] += 1 except KeyError: allele_counts[a] = 1 keys = allele_counts.keys() win_count = 0 winner = None for k in keys: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_visited_child(self):\n return max(self.children, key=lambda c: c.explore_count)", "def max(self):\n max = 0\n a = self.array_form\n for i in xrange(len(a)):\n if a[i] != i and a[i] > max:\n max = a[i]\n return max", "def count_max(alon):\n re...
[ "0.6655936", "0.66463107", "0.66287166", "0.65923226", "0.6573795", "0.6566374", "0.6550086", "0.6542098", "0.6534818", "0.6492612", "0.6476472", "0.6468543", "0.646583", "0.643348", "0.6418689", "0.64110184", "0.6385331", "0.6378105", "0.6372417", "0.6361048", "0.6359925", ...
0.0
-1
Execute shell command, piping output by default to base64, return output.
def runOpensslCmd( cmd1Args, cmd2Args ): p1 = subprocess.Popen( cmd1Args, stdout=subprocess.PIPE ) p2 = subprocess.Popen( cmd2Args, stdin=p1.stdout, stdout=subprocess.PIPE ) # Close p1.stdout so only process(p2) attached to the pipe; if p2 exits, # p1 will receive a SIGPIPE. p1.stdout.close() output =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shell(cmd):\n return subprocess.check_output(cmd, shell=True).decode(\"utf-8\")", "def native_cmd(cmd, whitespace=False):\n result = subprocess.check_output(cmd, shell=True).decode()\n\n result = subprocess.run(cmd, stdout=subprocess.PIPE).stdout.decode('utf-8')\n\n return result", "def run_cmd...
[ "0.69443566", "0.6795026", "0.67916363", "0.6679746", "0.6538609", "0.6487913", "0.64708656", "0.6440487", "0.6401089", "0.63661236", "0.6365907", "0.6349508", "0.63177407", "0.6306536", "0.62950313", "0.6276265", "0.62589514", "0.6241605", "0.6207926", "0.6176467", "0.613766...
0.0
-1
Create a DER encoded CMS data type given a conveyedinfo file and base64encode the response.
def opensslCmsDataCreate( conveyedInfoFile ): opensslCmdArgs = [ "openssl", "cms", "-data_create", "-in", conveyedInfoFile, "-outform", "der" ] conveyedInfoCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ "base64" ] ) return conveyedInfoCmsDerBase64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_internal_value(self, data):\n try: # ToDo penetrate in order test if it has any security flaws\n decoded = base64.b64decode(data)\n mime_type = magic.from_buffer(decoded, mime=True)\n file_ext = mimetypes.guess_extension(mime_type)\n except TypeError:\n ...
[ "0.6028859", "0.5847619", "0.5839393", "0.5480351", "0.53368914", "0.5330984", "0.5247696", "0.5235479", "0.5232634", "0.5227278", "0.5222667", "0.52152556", "0.521113", "0.5203105", "0.5159984", "0.5137093", "0.51293385", "0.5050312", "0.5014207", "0.50107014", "0.49795356",...
0.6957099
0
Create a signed CMS encoded object given a conveyedinfo file and base64 encode the response.
def opensslCmsSignedDataCreate( conveyedInfoFile, cert, privateKey ): opensslCmdArgs = [ "openssl", "cms", "-sign", "-in", conveyedInfoFile, "-signer", cert, "-inkey", privateKey, "-outform", "der", "-nodetach" ] conveyedInfoCmsSignedDerBase64 = ru...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opensslCmsDataCreate( conveyedInfoFile ):\n opensslCmdArgs = [ \"openssl\", \"cms\", \"-data_create\", \"-in\", conveyedInfoFile,\n \"-outform\", \"der\" ]\n conveyedInfoCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ \"base64\" ] )\n return conveyedInfoCmsDerBase64", "def open_and...
[ "0.68802476", "0.57600963", "0.56639785", "0.56213754", "0.55112994", "0.54730743", "0.5465122", "0.5425926", "0.5361701", "0.5321274", "0.5312067", "0.5278479", "0.52773", "0.52584666", "0.52542394", "0.5243983", "0.52368605", "0.5193875", "0.51854706", "0.5185009", "0.51680...
0.6407271
1
Create a degenerate CMS encoded object given a cert file and base64encode the response.
def opensslCmsCertCreate( ownerCertFile ): opensslCmdArgs = [ "openssl", "crl2pkcs7", "-certfile", ownerCertFile, "-nocrl", "-outform", "der" ] ownerCertCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ "base64" ] ) return ownerCertCmsDerBase64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def opensslCmsDataCreate( conveyedInfoFile ):\n opensslCmdArgs = [ \"openssl\", \"cms\", \"-data_create\", \"-in\", conveyedInfoFile,\n \"-outform\", \"der\" ]\n conveyedInfoCmsDerBase64 = runOpensslCmd( opensslCmdArgs, [ \"base64\" ] )\n return conveyedInfoCmsDerBase64", "def opensslC...
[ "0.62944597", "0.6059549", "0.5580201", "0.5461812", "0.54521674", "0.54492855", "0.54234695", "0.53850746", "0.53842735", "0.53842735", "0.53802806", "0.5374783", "0.5361761", "0.53443146", "0.5234495", "0.5207088", "0.518509", "0.51816165", "0.5171256", "0.51675254", "0.516...
0.58668345
2
Extract base64 value from pinneddomaincert file; i.e. given a PEM encoded cert, strip header and footer.
def getBase64PinnedDomainCert( pinnedDomainCertFile ): tailCmdArgs = [ "tail", "-n", "+2", pinnedDomainCertFile ] headCmdArgs = [ "head", "-n", "-1" ] pinnedDomainCertBase64 = runOpensslCmd( tailCmdArgs, headCmdArgs ) return pinnedDomainCertBase64
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_ca_crt_bytes_from_pem(pem_content):\n begin_search = pem_content.find(constants.BEGIN_CERTIFICATE_MARKER)\n if begin_search < 0:\n raise exception.InvalidKubernetesCA\n\n end_search = pem_content.find(constants.END_CERTIFICATE_MARKER)\n if end_search < 0:\n raise exception.Inv...
[ "0.606301", "0.5976179", "0.58105767", "0.5476757", "0.54603827", "0.5449754", "0.5434406", "0.5392469", "0.53901625", "0.53467846", "0.52828676", "0.52781343", "0.52742517", "0.5256527", "0.522737", "0.5226231", "0.52005994", "0.5152916", "0.5138789", "0.513565", "0.5134552"...
0.714601
0
Create a file within httpd directory containing response for uri
def createHttpdResponseFile( responseXml, restconfDir="/restconf/operations" ): if not os.path.exists( restconfDir ): os.makedirs( restconfDir ) responseXmlFile = "{}/ietf-sztp-bootstrap-server:get-bootstrapping-data".\ format( restconfDir ) with open( responseXmlFile, "w" ) as respF...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_file(self, response):\r\n # Extract filename from response url\r\n filename = re.search('[^/]+(?=/$|$)', response.url).group(0)\r\n\r\n # Prepend download folder name to the filename\r\n filename = self.config[\"folder\"] + filename\r\n os.makedirs(os.path.dirname(filena...
[ "0.6425665", "0.6304316", "0.62894547", "0.627631", "0.61327916", "0.6088824", "0.6078078", "0.5965769", "0.5963274", "0.5880248", "0.587777", "0.58741266", "0.5837021", "0.576541", "0.5713638", "0.57001615", "0.5658703", "0.56253684", "0.5589897", "0.55822724", "0.5550171", ...
0.69076777
0
Verify dict value types correspond to template
def verifyDictTypes( template, dictToCheck ): for key in dictToCheck: if not ( ( isinstance( dictToCheck[ key ], list ) and isinstance( template[ key ], list ) ) or ( isinstance( dictToCheck[ key ], dict ) and isinstance( template[ key ], dict ) ) or ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dictionary_coerce():\n\n @type_checked\n def _run_test(something:{int: str}):\n for key, value in something.items():\n assert isinstance(key, int)\n assert isinstance(value, str)\n\n _run_test(something={123: \"abc\", 2314: 12312, \"123\": \"abc\"})", "def check_for...
[ "0.66782385", "0.66468674", "0.6595941", "0.6493282", "0.6471941", "0.6394708", "0.62859756", "0.62481934", "0.61028117", "0.6082978", "0.60659516", "0.60586894", "0.60274726", "0.6018177", "0.60154957", "0.6013911", "0.59892005", "0.5982993", "0.59721565", "0.596949", "0.596...
0.7521832
0
Generate file containing bootstrap redirect information (json). sztpRedirectServers is a list of dictionaries, of the template below.
def genConvRedirectInfoJsonFile( sztpRedirectServers, redirectFileJson ): template = { "address": str, "port": int, "trust-anchor": str } mandatory = [ "address" ] # verify redirect-server list is correctly constructed assert isinstance( sztpRedirectServers, list ), "Expec...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genSztpBootstrapResponseFile( conveyedInfoFileJson, reportingLevel ):\n\n # CMS wrap this data (unsigned)\n conveyedInfoCms = opensslCmsDataCreate( conveyedInfoFileJson )\n\n # XML encode the artifacts (conveyedInfo only)\n return genBootstrappingDataResponseFile( conveyedInfo=conveyedInfoCms,\n ...
[ "0.5130368", "0.50381947", "0.49691543", "0.48931608", "0.48542204", "0.48228222", "0.4813354", "0.48039177", "0.47937784", "0.47869673", "0.4624361", "0.45916578", "0.45715594", "0.45654586", "0.45513126", "0.45467854", "0.45035234", "0.4503066", "0.45007342", "0.44736442", ...
0.7551597
0
Generate file containing bootstrap onboarding information (json).
def genConvOnboardingInfoJsonFile( sztpOnboardingInfo, onboardingFileJson ): template = { "boot-image": { "os-name": str, "os-version": str, "download-uri": list, # of uri strings "image-verification": [ { "hash-algorithm": str, "hash-value": str } ],...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api():\n return send_file('templates/bootstrapper.swagger.json')", "def write_bootstrap(self):\n\n for line in Bootstrap.BOOTSTRAP:\n self.write_line(line)\n\n self.write_call(\"Sys.init\", 0)", "def create_newfile():\n date = datetime.today().strftime('%d_%m_%Y').replace(\" ...
[ "0.59714407", "0.5859425", "0.5583089", "0.5551649", "0.5481499", "0.54219496", "0.5345955", "0.53165185", "0.5276273", "0.5172367", "0.50922686", "0.5084571", "0.50319684", "0.50302076", "0.50239533", "0.5008993", "0.50066954", "0.50027114", "0.49786752", "0.4978495", "0.497...
0.60188127
0
Verify boot image is correct
def verifyBootImage( template, sztpBootImage ): def verifyImageVerification( imageVerification ): """Verify instance of image-verification is correct""" if "hash-algorithm" in imageVerification: assert imageVerification[ "hash-algorithm" ] == \ "ietf-sztp-conveyed-info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_exist(self):\n helper.RbdImageOperator._check_rbd_image(self.real_path)", "def testCheckAvailable(self):\n img = self.img\n img.inspect()\n with converter.RootMounted(img.converter._h,\n '/dev/VolGroup00/LogVol00'):\n c = img.conv...
[ "0.6479312", "0.64290893", "0.6369703", "0.635404", "0.6286041", "0.6180226", "0.61096185", "0.608363", "0.60541505", "0.60480213", "0.6047562", "0.5977092", "0.5966454", "0.5957976", "0.58941513", "0.58904773", "0.58685666", "0.58676755", "0.5859996", "0.5856276", "0.5854957...
0.7287546
0
Verify instance of imageverification is correct
def verifyImageVerification( imageVerification ): if "hash-algorithm" in imageVerification: assert imageVerification[ "hash-algorithm" ] == \ "ietf-sztp-conveyed-info:sha-256",\ "Unsupported hash-algorithm" assert "hash-value" in imageVerification, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_binary_image(self, image_path):\n raise NotImplementedError", "def verify_image(self, image_location):\n checksum = self._hash_algo.hexdigest()\n LOG.debug('Verifying image at %(image_location)s against '\n '%(algo_name)s checksum %(checksum)s',\n ...
[ "0.69870156", "0.69740856", "0.69246584", "0.6673187", "0.6650353", "0.66449857", "0.66413474", "0.6540088", "0.6524494", "0.6524494", "0.6514677", "0.64813495", "0.6438443", "0.6420936", "0.6389883", "0.6361156", "0.63330185", "0.63297325", "0.631254", "0.6260492", "0.617737...
0.7009416
0
Verify imageverification list is correct
def verifyImageVerificationList( template, sztpImageVerification ): assert isinstance( sztpImageVerification, list ), \ "Expected list" for imageVer in sztpImageVerification: assert verifyDictTypes( template, imageVer ), "Unexpected value types" assert set( imageVer...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verifyImageVerification( imageVerification ):\n if \"hash-algorithm\" in imageVerification:\n assert imageVerification[ \"hash-algorithm\" ] == \\\n \"ietf-sztp-conveyed-info:sha-256\",\\\n \"Unsupported hash-algorithm\"\n assert \"hash-value\" in imageVer...
[ "0.6735049", "0.672671", "0.67036074", "0.6464152", "0.6445585", "0.6409907", "0.6409425", "0.632909", "0.62680525", "0.6239925", "0.6215872", "0.620192", "0.6181599", "0.6175062", "0.6162376", "0.60837007", "0.60530126", "0.60342985", "0.60265696", "0.60118407", "0.6010814",...
0.7673073
0
Convert ownershipvoucher dictionary to json and write to file. ownershipVoucher is a dictionary of the template below with values as per RFC8366.
def genOwnershipVoucherJsonFile( ownershipVoucher, voucherFileJson ): template = { "created-on": str, "expires-on": str, "assertion": str, "serial-number": str, "pinned-domain-cert": str, "domain-cert-revocation-checks": bool, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _write(self):\n raw_data = {'file_version': 1}\n raw_creds = []\n raw_data['data'] = raw_creds\n for (cred_key, cred) in self._data.items():\n raw_key = dict(cred_key)\n raw_cred = json.loads(cred.to_json())\n raw_creds.append({'key': raw_key, 'crede...
[ "0.57161313", "0.55950993", "0.55210066", "0.5401349", "0.5320288", "0.52819663", "0.5272004", "0.5208323", "0.517391", "0.51711", "0.5164001", "0.5157927", "0.5157889", "0.5153851", "0.5132664", "0.5128681", "0.51168865", "0.51157135", "0.5086597", "0.50822693", "0.50820655"...
0.79461914
0
Verify a dateTime string conforms to RFC3339 format (only Z TZ accepted)
def validDateTime( dateTime ): try: datetime.strptime( dateTime, "%Y-%m-%dT%H:%M:%S.%fZ" ) return True except ValueError: return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid(string: str, format_: str) -> bool:\n try:\n datetime.strptime(string, format_)\n return True\n except ValueError:\n return False", "def is_time_in_given_format(time_string, time_format):\n try:\n datetime.strptime(time_string, time_format)\n ...
[ "0.697065", "0.6781034", "0.6582872", "0.654285", "0.65413713", "0.65014714", "0.64805967", "0.6473195", "0.6417286", "0.6412882", "0.6391962", "0.6389369", "0.6366332", "0.63501763", "0.6320752", "0.6294031", "0.62899727", "0.6254448", "0.62397885", "0.6235958", "0.6208644",...
0.77382153
0
Generate SZTP redirect response for response to following https uri
def genBootstrappingDataResponseFile( conveyedInfo, ownerCertificate=None, ownershipVoucher=None, reportingLevel="verbose" ): # enclose the base64 encoded data in XML response if not conveyedInfo: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(self) -> bytes:\n self.logger.debug(\"--- In SSO Redirect ---\")\n _info = self.unpack_redirect()\n self.logger.debug(\"Unpacked redirect :\\n{!s}\".format(pprint.pformat(_info)))\n\n ticket = _get_ticket(self.context, _info, BINDING_HTTP_REDIRECT)\n return self._red...
[ "0.64003", "0.61148995", "0.6106962", "0.6028019", "0.5923971", "0.5665826", "0.56172425", "0.5564584", "0.5510682", "0.5488643", "0.54605424", "0.5430665", "0.54139304", "0.53932416", "0.5389347", "0.5357595", "0.5305892", "0.5294571", "0.5279046", "0.5268421", "0.52389425",...
0.0
-1
Generate unsigned bootstrap restconf response that will only contain cmsunsigned(conveyedinformation(json)).
def genSztpBootstrapResponseFile( conveyedInfoFileJson, reportingLevel ): # CMS wrap this data (unsigned) conveyedInfoCms = opensslCmsDataCreate( conveyedInfoFileJson ) # XML encode the artifacts (conveyedInfo only) return genBootstrappingDataResponseFile( conveyedInfo=conveyedInfoCms, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_bytes_signed_canonical(request) -> bytes:\n return get_test_data(request, __name__, \"config_signed_canonical.json\")", "def output_config() -> Response:\n c = dict(config)\n c['password'] = \"*********\"\n return jsonify(c)", "def json_bytes_canonical(request) -> bytes:\n r...
[ "0.5601099", "0.5574756", "0.5386519", "0.53467643", "0.5309439", "0.52807665", "0.5100658", "0.507131", "0.505884", "0.50188506", "0.50153613", "0.5012313", "0.49823737", "0.49588287", "0.4944935", "0.4926129", "0.49111423", "0.4890859", "0.48762876", "0.4869981", "0.4867255...
0.55271125
2
generate signed bootstrap restconf file that will contain cmssigned(conveyedinformation(json), ownercert) cms(ownercertificate) cmssigned(ownershipvoucher, manufacturercert).
def genSztpSignedBootstrapResponseFile( conveyedInfoFileJson, ownerCert, ownerKey, ownershipVoucher, manufacturerCert, manufacturerKey, reportingLevel ): # CMS sign and wrap the conveyed-info usin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genSztpBootstrapResponseFile( conveyedInfoFileJson, reportingLevel ):\n\n # CMS wrap this data (unsigned)\n conveyedInfoCms = opensslCmsDataCreate( conveyedInfoFileJson )\n\n # XML encode the artifacts (conveyedInfo only)\n return genBootstrappingDataResponseFile( conveyedInfo=conveyedInfoCms,\n ...
[ "0.5879794", "0.5550124", "0.55329037", "0.55057335", "0.54887927", "0.5484706", "0.5392402", "0.53486747", "0.52842027", "0.52580327", "0.52540106", "0.5248883", "0.52446467", "0.5234645", "0.5156566", "0.5097495", "0.50847185", "0.50532186", "0.5051961", "0.5005859", "0.500...
0.6441284
0
Support batch or single str.
def encode(self, text): if isinstance(text, str): text = [ self.dict[char.lower() if self._ignore_case else char] for char in text ] length = [len(text)] elif isinstance(text, collections.Iterable): length = [len(s) for s in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_string(item: Any) -> bool:\n if isinstance(item, (bytes, bytearray, str)):\n return True\n elif (isinstance(item, (tuple, list)) and all(is_string(x) for x in item)):\n return True\n elif (isinstance(item, np.ndarray) and # binary or unicode\n (item.dtype.kind in (\"U\", \"S\") or item.dtype...
[ "0.59293324", "0.57749236", "0.5725571", "0.5672212", "0.5647407", "0.5600418", "0.5586601", "0.5541914", "0.5517008", "0.5511494", "0.54992914", "0.5480194", "0.5423163", "0.5420587", "0.538898", "0.5375193", "0.5359677", "0.535159", "0.53473085", "0.53355134", "0.53303206",...
0.0
-1
Decode encoded texts back into strs.
def decode(self, t, length, raw=False): if length.numel() == 1: length = length[0] assert t.numel() == length, "text with length: {} does not match declared length: {}".format(t.numel(), length) if raw: return ''.join([self.alphabet[i - 1] for i in t]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(text: str) -> str:\n # Reverse of reverse is original text.\n return encode(text)", "def decode(self, s):", "def decode(self, s):", "def decode(self, text):\r\n\r\n decoded = \"\".join([self.chars[int(x)] for x in text if x > -1])\r\n decoded = self.remove_tokens(decoded)\r\n ...
[ "0.69890255", "0.6748986", "0.6748986", "0.66816735", "0.66223574", "0.6482883", "0.6418105", "0.635815", "0.6332993", "0.6277069", "0.62237376", "0.6220144", "0.6183788", "0.611471", "0.60138935", "0.5979148", "0.5967565", "0.5965492", "0.5949346", "0.5940196", "0.5926245", ...
0.0
-1
Ask for a number within a range.
def ask_number(question, low, high): response = None while response not in range(low, high, 1): response = input(question) return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ask_user_range(question, first, last, default):\n\n while True:\n answer = input(question)\n if answer == \"\":\n answer = default\n break\n if re.findall(r\"[0-9+]\", answer):\n if int(answer) in range(first, last + 1):\n ...
[ "0.7841275", "0.7828361", "0.78230804", "0.78229994", "0.78229994", "0.74295723", "0.7367835", "0.72900355", "0.7220681", "0.71590334", "0.7132747", "0.70865697", "0.7029022", "0.69903183", "0.686251", "0.6826732", "0.6756153", "0.6675132", "0.6604543", "0.6598367", "0.657736...
0.77285206
5
Loads an image file (.jpg, .png, etc) into a numpy array
def load_image_file(file): file = cv2.imread(file) return cv2.cvtColor(file, cv2.COLOR_BGR2RGB)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_img(path: str) -> np.ndarray:\n \n return np.array(Image.open(path))", "def load_image_into_numpy_array(path):\n return np.array(Image.open(path))", "def load_image_into_numpy_array(path):\n return np.array(Image.open(path))", "def load_image_as_array(filename):\n im = Image.open(file...
[ "0.85898346", "0.84998584", "0.84998584", "0.8495261", "0.8432109", "0.81946313", "0.81913364", "0.8181416", "0.81582314", "0.8153489", "0.8080318", "0.8075615", "0.8068236", "0.800013", "0.79243386", "0.7916516", "0.7852631", "0.7842063", "0.77801836", "0.7757637", "0.771590...
0.0
-1
Test case for dev_fetch_api_key Fetch an API key (development only)
async def test_dev_fetch_api_key(client): params = [('username', 'iago@zulip.com')] headers = { 'Accept': 'application/json', } response = await client.request( method='POST', path='/api/v1/dev_fetch_api_key', headers=headers, params=params, ) assert ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_api_key(api_key):\n api.get(api_key)", "async def test_fetch_api_key(client):\n params = [('username', 'iago@zulip.com'),\n ('password', 'abcd1234')]\n headers = { \n 'Accept': 'application/json',\n }\n response = await client.request(\n method='POST',\n ...
[ "0.7381364", "0.71456134", "0.7035455", "0.70299584", "0.7007611", "0.6980134", "0.6950013", "0.6817723", "0.6753935", "0.67477185", "0.67321575", "0.6708487", "0.66948825", "0.66835815", "0.667592", "0.66686666", "0.66462886", "0.6633064", "0.6630445", "0.6614227", "0.660011...
0.7871407
0
Test case for fetch_api_key Fetch an API key (production)
async def test_fetch_api_key(client): params = [('username', 'iago@zulip.com'), ('password', 'abcd1234')] headers = { 'Accept': 'application/json', } response = await client.request( method='POST', path='/api/v1/fetch_api_key', headers=headers, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def test_dev_fetch_api_key(client):\n params = [('username', 'iago@zulip.com')]\n headers = { \n 'Accept': 'application/json',\n }\n response = await client.request(\n method='POST',\n path='/api/v1/dev_fetch_api_key',\n headers=headers,\n params=params,\n ...
[ "0.77039844", "0.75367063", "0.7186696", "0.71464", "0.7127396", "0.6907098", "0.68854934", "0.6865004", "0.68365717", "0.68285173", "0.6815571", "0.68041676", "0.67992896", "0.6788098", "0.67636013", "0.6748777", "0.6725473", "0.67237955", "0.6715165", "0.66871226", "0.66794...
0.7483697
2
Starting point of the program execution.
def start(key, value, p): graph = nx.read_edgelist(value, comments='%', create_using=nx.Graph(), nodetype=int) columns = ['Percentage', 'Degree', 'EigenVector'] df = pd.DataFrame(columns=columns) methods = {'Degree': SampledGraphDegree, 'EigenVector': SampledGraphEigenVector, 'Katz': SampledGraphK...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start(self):\n self.start_time = dt.datetime.now()\n self.call = ' '.join(sys.argv)\n self.commands = []", "def start():", "def start():", "def start():", "def start():", "def main():\n run_program()", "def main():\n print(\"is Running!\")", "def _start(self):\n ...
[ "0.75052106", "0.7434513", "0.7434513", "0.7434513", "0.7434513", "0.73392045", "0.7312847", "0.7280139", "0.7224378", "0.7224378", "0.72091603", "0.72091603", "0.72091603", "0.71912843", "0.7174693", "0.71579653", "0.71579653", "0.71579653", "0.71579653", "0.71579653", "0.71...
0.0
-1
Register a class as a custom Keras object. Taken from
def register_keras_custom_object(cls): tf.keras.utils.get_custom_objects()[cls.__name__] = cls return cls
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __create_custom_objects():\n # make some preparation to properly load objects from keras_contribute\n instance_holder = {\"instance\": None}\n\n class ClassWrapper(CRF):\n def __init__(self, *args, **kwargs):\n instance_holder[\"instance\"] = self\n super(ClassWrapper, sel...
[ "0.62000954", "0.6195566", "0.6027426", "0.58367825", "0.58193207", "0.5803586", "0.57035977", "0.56791914", "0.5632764", "0.5585904", "0.55756676", "0.550057", "0.5462705", "0.5437095", "0.54250425", "0.5399139", "0.5376054", "0.537521", "0.53704894", "0.53660065", "0.533990...
0.8505611
0
Get the MySQL password from the config file or an interactive prompt.
def get_mysql_pwd(config): # Two ways to get the password are supported. # # 1. Read clear-text password from config file. (least secure) # 2. Read password as entered manually from a console prompt. (most secure) # First try the config file. This is the least secure method. Protect the file. m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_auth_password():\n password = AUTH_PASSWORD_SCRIPT.get()\n if password:\n return password\n return DEFAULT_AUTH_PASSWORD.get()", "def _password(self):\n if 'password' in self._config:\n return self._config['password']\n else:\n while True:\n passwo...
[ "0.67284405", "0.66505927", "0.6536618", "0.64365983", "0.6373743", "0.6365045", "0.6323383", "0.6244692", "0.6244692", "0.62446654", "0.622668", "0.6200899", "0.6192647", "0.61393917", "0.61063206", "0.6070788", "0.60662985", "0.60662985", "0.60662985", "0.6052463", "0.60440...
0.8176631
0
Configure the MySQL database connection.
def get_mysql_conn(config): mysql_conn_type = config.get('mysql', 'mysql_conn_type', 0) mysql_user = config.get('mysql', 'mysql_user', 0) mysql_pwd = config.get('mysql', 'mysql_pwd', 0) if mysql_user == '': mysql_user = getpass.getuser() if mysql_conn_type == 'pyodbc': mysql_pwd = g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(self):\n # Defaults\n self.db_type = DB_TYPE.POSTGRES\n self.db_name = \"ambari\"\n self.db_user = \"ambari\"\n self.db_password = \"bigdata\"\n self.db_host = \"localhost\"\n self.db_url = None\n\n if os.path.exists(AMBARI_PROPERTIES_LOCATION):\n self.ambari_props = self...
[ "0.72382593", "0.7163564", "0.6989661", "0.69011605", "0.68877184", "0.6850185", "0.67999387", "0.678691", "0.6682894", "0.66508764", "0.6618729", "0.66107994", "0.6609478", "0.6585064", "0.6578558", "0.65282506", "0.6515145", "0.6494794", "0.6466084", "0.6464563", "0.6457128...
0.0
-1
Get REDCap data as a CSV file with an API key, URL and content type.
def get_data(csv_file, redcap_key, redcap_url, content): with open(csv_file, 'wb') as f: c = pycurl.Curl() c.setopt(pycurl.CAINFO, certifi.where()) c.setopt(c.URL, redcap_url) c.setopt(c.FOLLOWLOCATION, True) post_data = {'token': redcap_key, 'content': content, \ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _csv(content):\n response = _data_frame(content).to_csv(index=False)\n return response", "def outputapidata_csv(filename, data, headers=None):\n with open(filename,'w',encoding='utf-8',newline = \"\", ) as f:\n if headers:\n writer = csv.DictWriter(f,fieldnames = headers)\n ...
[ "0.65286213", "0.629478", "0.6248273", "0.6128851", "0.60974103", "0.60966414", "0.607682", "0.5992442", "0.5988515", "0.59847116", "0.5964392", "0.58780026", "0.5857897", "0.5815782", "0.58133936", "0.58087337", "0.57530344", "0.5727235", "0.5678315", "0.5674862", "0.5665332...
0.6629378
0
Get the sha1 hash of the previously uploaded data for a table.
def get_prev_hash(project, mysql_table, log_table, conn = conn): # See if the database contains the log_table (REDCap transfer log) table. rs = sql.execute('SHOW TABLES LIKE "' + log_table + '";', conn) row0 = rs.fetchone() res = '' if (row0 is not None) and (len(row0) != 0): res = row0[0] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sha1(self):\n return hashlib.sha1(self._blob).hexdigest()", "def sha1(self) -> str:\n return self.data.sha1", "def get_hash(self):\n source = \"\"\n for cell in self.original_cells:\n source += \"\\n\".join(get_source(cell))\n return hashlib.sha256(source.encode(\...
[ "0.73520637", "0.73342705", "0.7033737", "0.6831397", "0.68296325", "0.67296165", "0.66682285", "0.66600823", "0.66417396", "0.6601814", "0.6600231", "0.6562733", "0.6552531", "0.6552531", "0.65496504", "0.6544282", "0.6515358", "0.64558566", "0.6447111", "0.6425509", "0.6413...
0.6402452
22
Parse a CSV file with Pandas, with basic checks and error handling.
def parse_csv(csv_file): if os.path.isfile(csv_file) == True: num_lines = sum(1 for line in open(csv_file)) if num_lines > 1: try: data = pd.read_csv(csv_file, index_col=False) data.insert(0, 'id', range(1, 1 + len(data))) return(data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse_csv(csv_file: str) -> pd.DataFrame:\n return pd.read_csv(csv_file, header=0)", "def parse_csv_file(self, csv_file: str):\n try:\n df = pd.read_csv(csv_file)\n\n if not set(['Question', 'Answer']).issubset(df.columns):\n raise BadCSVFile(\n ...
[ "0.76834667", "0.7188155", "0.6934689", "0.68426764", "0.680124", "0.67912734", "0.66539997", "0.66152054", "0.6598606", "0.65964824", "0.65925705", "0.65395904", "0.6534839", "0.65285635", "0.6503657", "0.6473891", "0.6422277", "0.641079", "0.63820785", "0.63384444", "0.6332...
0.6573268
11
Create a hash of a file.
def hash_file(file_name): BLOCKSIZE = 65536 hasher = hashlib.sha1() with open(file_name, 'rb') as afile: buf = afile.read(BLOCKSIZE) while len(buf) > 0: hasher.update(buf) buf = afile.read(BLOCKSIZE) return(hasher.hexdigest())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashfile(file):\n\n hasher = hashlib.sha256()\n\n with open(file, 'rb') as afile:\n buf = afile.read(BLOCKSIZE)\n hasher.update(buf)\n\n return(hasher.hexdigest())", "def hash_file(filename):\n # make a hash object\n h = hashlib.sha1()\n \n # open file for reading in binary mod...
[ "0.78154737", "0.77822936", "0.77822936", "0.7758422", "0.7737324", "0.7732539", "0.77142304", "0.76906806", "0.76843214", "0.7680886", "0.76533586", "0.75843215", "0.75759465", "0.74643785", "0.7459393", "0.74388117", "0.74151087", "0.73923045", "0.73651123", "0.735946", "0....
0.7568438
13
Send data from REDCap to a MySQL (or MariaDB) database.
def send_to_db(data_path, project, csv_file, dataset, mysql_table, log_table, rcform = '', redcap_key = redcap_key, redcap_url = redcap_url, conn = conn, mysql_user = mysql_user, redcap_event_name_maxlen = redcap_event_name_maxlen): if project != '': # Prepend p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_to_rds(data, conn):\n if (len(data) < 9):\n return\n cursor = conn.cursor()\n header_data = [\"date_mutation\", \"code_postal\", \"valeur_fonciere\", \"code_type_local\", \"surface_reelle_bati\", \"nombre_pieces_principales\",\"surface_terrain\",\"longitude\",\"latitude\",\"message\"]\n ...
[ "0.6284455", "0.5762473", "0.5693748", "0.5663926", "0.56158596", "0.5567874", "0.555843", "0.54980505", "0.54530215", "0.543758", "0.5424383", "0.53975487", "0.5354361", "0.53487647", "0.5336851", "0.5290581", "0.5286743", "0.52733654", "0.5267045", "0.5251107", "0.5250329",...
0.54948854
8
Track changes to transferred data files in local git repository.
def commit_changes(repo, project = ''): cmd = repo.git cmd.add(all=True) try: cmd.commit(m="redcap2mysql.py data sync for project " + project) except git.exc.GitCommandError, err: logging.info([traceback.format_exc(limit=1).splitlines()[-1]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_git_repo():\n # get the current dir of this script\n current_dir = os.path.dirname(os.path.realpath(sys.argv[0]))\n repo_path = os.path.join(current_dir,REPO_NAME)\n logging.info(\"Repository path is: \"+repo_path)\n # check to see if a repo has been init already\n try: \n repo = ...
[ "0.604152", "0.58758867", "0.5846359", "0.5827327", "0.57683486", "0.5729317", "0.569714", "0.5673685", "0.56440496", "0.56263894", "0.5590547", "0.55631435", "0.5532549", "0.55281574", "0.55133027", "0.55071926", "0.5496068", "0.5489203", "0.54795736", "0.5460182", "0.545487...
0.5350369
33
Get REDCap data and send to MySQL.
def send_data(data_path, project = ''): # Send metadata send_to_db(data_path, project, 'rcmeta.csv', 'metadata', 'rcmeta', 'rcxfer', 'rcform') # Send events #send_to_db(data_path, project, 'rcevent.csv', 'event', 'rcevent', 'rcxfer') # Send arms #send_to_db(data_path, project, 'rcarm.csv', 'a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zkDBRrq(self):\n\tattendance = []\n\tcommand = CMD_DB_RRQ\t\n\tcommand_string = '\\x01'\n\tchksum = 0\n\tsession_id = self.session_id\n\n\treply_id = unpack('HHHH', self.data_recv[:8])[3]\n\n\tbuf = self.createHeader(command,chksum, session_id,reply_id, command_string)\n\tself.zkclient.sendto(buf,self.address)...
[ "0.60449487", "0.5786203", "0.57803607", "0.5699076", "0.5666099", "0.5502018", "0.54632294", "0.5455676", "0.5343841", "0.530779", "0.5262251", "0.5247411", "0.5186783", "0.5174497", "0.51127726", "0.5084188", "0.5075033", "0.5058062", "0.5055873", "0.5050829", "0.50432366",...
0.47858062
55
Sort tree contents when a column is clicked on.
def sortby(self, col, descending): # grab values to sort tree = self.albumList data = [(tree.set(child, col), child) for child in tree.get_children('')] # reorder data data.sort(reverse=descending) for indx, item in enumerate(data): tree.move(item[1], '', indx) # switch the heading so that it will...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnColumnClick(self, event):\r\n columns = self.data.getParam('columns')\r\n self.SortItems(columns[event.GetColumn()],'INVERT')", "def SortBy(self,tree, col, descending):\n \n # grab values to sort\n data = [(tree.set(child, col), child) for child in tree.get_children('')]\...
[ "0.7671702", "0.7512669", "0.73402053", "0.7283163", "0.7257272", "0.7168303", "0.7089924", "0.7055548", "0.6968464", "0.68744236", "0.66391414", "0.65222603", "0.64561796", "0.6448045", "0.6439114", "0.64182967", "0.6410943", "0.64092404", "0.6358155", "0.6345279", "0.634142...
0.6909063
9
Validate data from user signup and login forms
def validation_form(username=None, password=None, email=None, verify=None): params = dict() if not valid_username(username): params['error_username'] = 'Login too short. Min 3 char, max 20 char' if not valid_password(password): params['error_password'] = 'Password too ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(self):\n\n # Fetch cleaned email and username data.\n email = self.cleaned_data.get('email')\n username = self.cleaned_data.get('username')\n\n # Fetch possible user objects from the database\n # based on provided and email and password.\n user_email = User.objec...
[ "0.7158038", "0.7136447", "0.70500565", "0.69671035", "0.69375116", "0.69036317", "0.6692755", "0.66822165", "0.6665879", "0.6650788", "0.66077256", "0.65853673", "0.6573391", "0.6573136", "0.65564835", "0.65473014", "0.6545641", "0.65413994", "0.64977664", "0.6493529", "0.64...
0.0
-1
Return user if user is valid None otherwise
def valid_username(u): return u and USER_RE.match(u)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user():\n try:\n userId = request.args.get('login_as')\n return users[int(userId)]\n except Exception:\n return None", "def get_one_user():", "def user(self):\n u = self.user_info\n return self.user_model.get_by_id(u['user_id']) if u else None", "def get_user(self):\n...
[ "0.7758432", "0.75366116", "0.73947096", "0.7326417", "0.72544", "0.72544", "0.7202691", "0.7201735", "0.71991974", "0.7096658", "0.70897675", "0.706437", "0.7033647", "0.7019137", "0.6991952", "0.6981977", "0.6954479", "0.695263", "0.69280744", "0.69052994", "0.6899382", "...
0.0
-1
Construct filename and create directories as necessary.
def _get_filename(self, type_: str, name: str) -> str: if not os.path.isdir(self._datadir): os.mkdir(self._datadir, mode=0o700) type_dir = os.path.join(self._datadir, type_) if not os.path.isdir(type_dir): os.mkdir(type_dir, mode=0o700) fn = os.path.join(type_di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makefilename(self):\n fp= (pathlib.Path(self.vr_folder).expanduser()/(time.strftime(self.vr_filename))).with_suffix('')\n fp.parent.mkdir(parents=True, exist_ok=True)\n print('files setup', str(fp))\n return fp", "def _create_dir(filename):\n head = os.path.dirname(filename)\n ...
[ "0.73006874", "0.72687113", "0.693885", "0.6914036", "0.68972456", "0.6837264", "0.68120617", "0.6750221", "0.6749781", "0.67243695", "0.6702448", "0.6655797", "0.662857", "0.65972126", "0.6564863", "0.6562969", "0.65181285", "0.6508705", "0.6491542", "0.6468973", "0.644841",...
0.0
-1
Remove an order and all it's resources.
def purge_order(self, order_id): order = self.load_order(order_id) for authz_id in order.authorization_ids: authz = self.load_authorization(authz_id) for chall_id in authz.challenge_ids: self.delete('challenge', chall_id) self.delete('authorization', a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_order():", "def clear(self):\r\n self.orderitem_set.all().delete()", "def _delete_all_orders(self):\n for order_ref in self.created_entities['order']:\n order = self.barbicanclient.orders.get(order_ref)\n if order.secret_ref:\n self.barbicanclient.s...
[ "0.69970745", "0.67937535", "0.67173916", "0.66631436", "0.6454474", "0.64174116", "0.6353764", "0.63377964", "0.6304071", "0.61717874", "0.61426693", "0.609751", "0.60466385", "0.60095173", "0.5967705", "0.5885886", "0.58851284", "0.5855012", "0.5821319", "0.57647246", "0.57...
0.726116
0
Gets a node tree from the given string.
def getNodeTreeFromStr(string): document = publish_doctree(string) return list([node for node in document.traverse()[1:] if node.parent == document]) # we've to return the chidren of the document, as returning the document itself, seems to duplicate the content of the current file being processed.
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_tree(s):\n return parser.parse(lexer=lexer, input=s)", "def read_tree(cls, string):\n \n # first, remove the brackets ()\n string = string.strip()\n if len(string) == 0:\n raise ValueError(\"empty string cannot be a Synstactic Tree\")\n if string[0] == \...
[ "0.73093045", "0.70739913", "0.6900079", "0.66125304", "0.6608044", "0.65639174", "0.65057653", "0.6496888", "0.64140177", "0.6338099", "0.62794083", "0.6224039", "0.6153235", "0.6035289", "0.601913", "0.5981887", "0.59077924", "0.58890414", "0.58856773", "0.5878001", "0.5825...
0.795937
0
Restore to original value.
def _clear( self ): self.value = ( '', ) # *Not* '()', which won't do at all! self.operator = None
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_data(self):\n self.R = self._Ro\n del self._Ro", "def restore(self):\n raise NotImplementedError", "def restore(self, restore):\n self._restore = restore", "def restore(self):\n self.weight = self._backup_weight", "def _restore_default(self):\n self._da...
[ "0.77998513", "0.77732843", "0.74923337", "0.74721766", "0.74181354", "0.731303", "0.724172", "0.723836", "0.71995175", "0.7137183", "0.71307516", "0.71219724", "0.70887434", "0.70396805", "0.699821", "0.6943587", "0.6934261", "0.68882245", "0.6881654", "0.6796656", "0.678008...
0.0
-1
Return the name of skin method which renders the form used to edit this kind of criterion.
def getEditForm( self ): return "listc_edit"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(self):\n # type: () -> Text\n\n return \"advice_form\"", "def form_name(self):\n \n # Unpack\n request = self.request\n context = request.context\n \n # Prepare\n first_btn = len(self.buttons) and self.buttons[0]\n btn_is_create = fir...
[ "0.6674236", "0.65364265", "0.6175527", "0.59753966", "0.5915975", "0.58678293", "0.5806205", "0.5771903", "0.5759645", "0.57106274", "0.5694327", "0.5591224", "0.55854917", "0.5552111", "0.5548712", "0.5472779", "0.54639256", "0.54545367", "0.5444614", "0.54379505", "0.54134...
0.5890521
5
Update the value we match against.
def edit( self, value=None, operator=None ): if value is None: self._clear() else: if type( value ) == type( '' ): value = value.split('\n') self.value = tuple( value ) if not operator: operator = None self.operator = oper...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def updated(self, value):\n pass", "def _update_value(self, value):\n old_hash = get_hash(self._value)\n new_hash = get_hash(value)\n self._value = value\n if old_hash is None or new_hash is None or (old_hash != new_hash):\n self.is_dirty = True", "def update...
[ "0.6900959", "0.66881514", "0.662792", "0.6566491", "0.6534293", "0.639026", "0.62795675", "0.6251601", "0.6240275", "0.6180104", "0.61638635", "0.6101243", "0.60290325", "0.60176915", "0.60130274", "0.6004048", "0.59539163", "0.59539163", "0.59539163", "0.59539163", "0.59494...
0.0
-1
Return a tuple of query elements to be passed to the catalog (used by 'Topic.buildQuery()').
def getCriteriaItems( self ): # filter out empty strings result = [] value = tuple( filter( None, self.value ) ) if not value: return () result.append( ( self.field, self.value ), ) if self.operator is not None: result.append( ( '%s_operator' % s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self):\n if bool(self._query_parameters): # ApiGateway set key value None in case of absence params, not an empty dict\n payload = {inflection.underscore(k): v for k, v, in self._query_parameters.items()}\n else:\n payload = dict()\n QueryTuple = namedtuple('Qu...
[ "0.6507253", "0.642685", "0.59497595", "0.590914", "0.5836972", "0.5767123", "0.57669634", "0.57419294", "0.5726026", "0.56799763", "0.55797607", "0.55152404", "0.54958004", "0.54945856", "0.5494529", "0.5469922", "0.5443926", "0.54248416", "0.54075605", "0.53540444", "0.5350...
0.5601633
10
Compute a superset of the true target tract with kNN.
def compute_superset_with_k(true_bundle, kdt, prototypes, k=1000, distance_func=bundles_distances_mam): true_bundle = np.array(true_bundle, dtype=np.object) dm_true_bundle = distance_func(true_bundle, prototypes) D, I = kdt.query(dm_true_bundle, k=k) superset_idx = np.unique(I.flat) # recompute the ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_superset(true_tract, kdt, prototypes, k=1000, distance_func=bundles_distances_mam):\n true_tract = np.array(true_tract, dtype=np.object)\n dm_true_tract = distance_func(true_tract, prototypes)\n D, I = kdt.query(dm_true_tract, k=k)\n superset_idx = np.unique(I.flat)\n return superset_idx...
[ "0.6441935", "0.61719203", "0.58573407", "0.57999724", "0.5726697", "0.57163185", "0.5672652", "0.56291544", "0.5529054", "0.55143523", "0.55143523", "0.5510025", "0.5475415", "0.54626054", "0.5443", "0.54321223", "0.5406091", "0.53836495", "0.53636736", "0.5355484", "0.53139...
0.670607
0
Compute a superset of the true target tract with kNN.
def compute_superset_with_r(true_bundle, kdt, prototypes, r=1, distance_func=bundles_distances_mam): true_bundle = np.array(true_bundle, dtype=np.object) dm_true_bundle = distance_func(true_bundle, prototypes) I = kdt.query_radius(dm_true_bundle, r) superset_idx = [] for arr in I: for e in a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_superset_with_k(true_bundle, kdt, prototypes, k=1000, distance_func=bundles_distances_mam):\n true_bundle = np.array(true_bundle, dtype=np.object)\n dm_true_bundle = distance_func(true_bundle, prototypes)\n D, I = kdt.query(dm_true_bundle, k=k)\n superset_idx = np.unique(I.flat)\n # reco...
[ "0.670574", "0.6441951", "0.61715454", "0.58573383", "0.58003443", "0.5726443", "0.5716722", "0.56723654", "0.56273323", "0.5529329", "0.5513812", "0.5513812", "0.5510223", "0.5474325", "0.5462067", "0.5443153", "0.54321855", "0.54066193", "0.5383252", "0.5364684", "0.535411"...
0.5006581
68
Compute the dissimilarity representation of the tract and build the kdtree.
def compute_kdt_and_dr(tract, num_prototypes=None): tract = np.array(tract, dtype=np.object) print("Computing dissimilarity matrices...") if num_prototypes is None: num_prototypes = 40 print("Using %s prototypes as in Olivetti et al. 2012." % num_prototypes) else: p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_kdtree(self):\n if self.method==2:\n coordinates = self.unassigned_data[0:3,:]\n else:\n coordinates = self.unassigned_data[0:2,:]\n tree = cKDTree(coordinates.T)\n\n return tree", "def compute_kdtree_and_dr_tractogram(tractogram, num_prototypes=None):\n tractogram = np....
[ "0.63991743", "0.627999", "0.5658187", "0.56529063", "0.5617922", "0.5457617", "0.5414897", "0.53491503", "0.523481", "0.51466924", "0.5110569", "0.51012075", "0.5071617", "0.50715053", "0.5054275", "0.50493664", "0.5049205", "0.5047612", "0.50431067", "0.50336504", "0.502728...
0.59463567
2
deletes the specified keys not atomic across shards.
def delete(self, *names): return [shard.delete(*keys) for shard, keys in self.gather_keys_by_shard(names)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_many(self, keys):\n raise NotImplementedError()", "async def delete(self, *keys, **kwargs):\n\n def gen_keys(keys):\n all_keys = []\n for key in keys:\n if isinstance(key, list):\n all_keys += gen_keys(keys=key)\n els...
[ "0.7468936", "0.7286904", "0.71825546", "0.7122302", "0.70103353", "0.70015174", "0.69674885", "0.688871", "0.68676025", "0.68633324", "0.68574625", "0.68523395", "0.6762416", "0.67384684", "0.6734635", "0.6674827", "0.6622758", "0.65964293", "0.6570637", "0.6519055", "0.6515...
0.66377497
16
Gather all keys that match pattern, by shard, then invoke shardfn once per shard, passing the shard, and the list of matching keys on that shard.
def with_keys_by_shard(self, shardfn, pattern='*'): for shard in self.shards: keys = shard.keys(pattern) shardfn(shard, keys)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_by_key(fileset, keyfunc, min_group_size=2, workers=16):\n pool = ThreadPool(workers)\n\n def evaluate(entry):\n return keyfunc(entry), entry\n\n keyed_fileset = pool.map(evaluate, fileset)\n files_by_key = {}\n for key, entry in keyed_fileset:\n if key is None:\n c...
[ "0.48097777", "0.47111169", "0.47066587", "0.47066587", "0.46778187", "0.46645233", "0.4651981", "0.4619422", "0.45933166", "0.45721135", "0.45453283", "0.4536613", "0.4532428", "0.45301318", "0.4529499", "0.45236236", "0.45110145", "0.45036453", "0.44981468", "0.44917077", "...
0.8449861
0
Generates scenario 1. Todo define scenario 1
def generate_scenario_1(seed=1996, permanent_save=True, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1): # specify seed to be able repeat example start_time = datetime.now() np.random.seed(seed) # combine two 1-D CV models to create a 2-D CV model transition_model = CombinedLinearGaussia...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_create_scenario1(self):\n pass", "def test_create_scenario(self):\n pass", "def TestOneStep(self):\n pass", "def test_get_scenario(self):\n pass", "def test_2nd_scenario():\n start_entered_scenario(config.MERAKI_CAMERAS[0][\"serial\"])\n return \"ok\"", "def tes...
[ "0.7691797", "0.707937", "0.67126054", "0.6650521", "0.65280485", "0.64290357", "0.6334851", "0.62848485", "0.62843955", "0.62091523", "0.6069071", "0.6062225", "0.599871", "0.5980599", "0.59706324", "0.595907", "0.5943288", "0.5943288", "0.59366554", "0.593", "0.5900602", ...
0.0
-1
Generates scenario 2. Scenario 2 consists of radar and ais measurements with the same sampling rate.
def generate_scenario_2(seed=1996, permanent_save=True, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1, timesteps=20): start_time = datetime.now() # specify seed to be able repeat example np.random.seed(seed) # combine two 1-D CV models to create a 2-D CV model tr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sampling2 () :\n delta = 2 * np.pi / 3\n r = Reward(partial(stepFunction, \n xRange=(-delta/2, delta/2), \n yRange=(-delta/2, delta/2)), \n (-1, 0))\n states = []\n xs = np.arange(-np.pi, np.pi, delta)\n ys = np.arange(-np.pi, np.pi,...
[ "0.6115581", "0.59218746", "0.591556", "0.5793499", "0.5779642", "0.56699425", "0.5625599", "0.5473677", "0.54238087", "0.54228085", "0.53844553", "0.5353695", "0.5347016", "0.5287351", "0.52831525", "0.52646875", "0.5255052", "0.5238365", "0.5234221", "0.52184963", "0.521451...
0.6111027
1
Generates scenario 3. Scenario 3 consists of radar and ais measurements with different sampling rate. The sampling rate is specified in the input params. A groundtruth is generated for each second.
def generate_scenario_3(seed=1996, permanent_save=True, radar_meas_rate=1, ais_meas_rate=5, sigma_process=0.01, sigma_meas_radar=3, sigma_meas_ais=1, timesteps=20): start_time = datetime.now() # specify seed to be able to repeat the example np.random.seed(seed) # combine two 1-...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param_scenario3():\n nb_carre_x = 42\n nb_carre_y = 45\n largeur_x = 0.825\n largeur_y = 0.645\n z1 = np.array([[11], [32], [17.26]])\n z2 = np.array([[12], [32], [18.43]])\n z3 = np.array([[13], [32], [23.2]])\n z4 = np.array([[15], [31], [23.4]])\n z5 = np.array([[16], [30], [2...
[ "0.61304635", "0.6005348", "0.59966356", "0.5971647", "0.5719661", "0.5554706", "0.5553684", "0.54804504", "0.5467986", "0.54541695", "0.5442281", "0.53921455", "0.5386651", "0.537223", "0.535773", "0.5339545", "0.5323583", "0.53214395", "0.52994394", "0.52926755", "0.5286437...
0.69548637
0
Create a Simple Good Turing estimator for the given N_r values (as specified in the 'N' kwarg). N[r] == N_r, so N[0] should be blank.
def __init__(self, N, *args, **kwargs): self.N = copy.copy(N) if isinstance(self.N, list): self.max_r = len(self.N) elif isinstance(self.N, dict) or isinstance(self.N, defaultdict): self.max_r = max(self.N.keys()) super(Estimator, self).__init__(*args, **kwargs) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _uniform_number(self, N=None):\n num_frames = self.data.shape[0]\n if not N:\n N = int(np.floor(\n Constants.DEFAULT_SAMPLE_PERCENTAGE * num_frames\n ))\n k = int(np.floor(num_frames / N))\n if k == 0:\n k = 1\n elif...
[ "0.559078", "0.55552906", "0.5441996", "0.5357272", "0.53438485", "0.5331821", "0.5251055", "0.5232737", "0.52025616", "0.5200852", "0.5196297", "0.51273173", "0.51019603", "0.5092297", "0.5092026", "0.5085834", "0.5084632", "0.5060103", "0.504482", "0.50389826", "0.5034161",...
0.56046593
0
Do the necessary precomputation to compute estimates
def _precompute(self): N = self.N # Store 'N' as used by Gale in N[0] --- this is the total # of # occurrences. N[0] = sum(N[r] * r for r in range(1, self.max_r + 1)) self.Z = Z = averaging_transform.transform(N, self.max_r) # Z[r] = Z_r self.b, self.a = self._regress(Z)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def precalculate():\n pass", "def precalculate():\n pass", "def E_step_precompute(self, model_params, my_suff_stat, my_data):", "def run():\n return estimate(0,1,0)", "def _conventional_precalculation(self):\n # Run all modules\n for module in self._conventional_modules:\n ...
[ "0.737464", "0.737464", "0.73522526", "0.6641263", "0.6628966", "0.6564368", "0.6496165", "0.6365002", "0.63627005", "0.60393345", "0.5983021", "0.5978751", "0.58568126", "0.58324635", "0.5828639", "0.58230853", "0.58050996", "0.5781569", "0.5775128", "0.5764755", "0.5760743"...
0.7158729
3
Perform linear regression on the given points in loglog space, return result
def _regress(self, Z): # Make a set of the nonempty points in log scale x, y = zip(*[(log(r), log(Z[r])) for r in range(1, self.max_r + 1) if Z[r]]) self.x, self.y = x, y matrix = numpy.array((x, numpy.ones(len(x)))).T return numpy.linalg.lstsq(matr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_reg(x_train, y_train):\n\n log_reg_classifier = LogisticRegression(max_iter=1000, solver='lbfgs')\n log_reg_classifier.fit(x_train, y_train)\n return log_reg_classifier\n\n # log_reg_classifier.fit(x_train, y_train)", "def loglf2py(store):\n loglike=0.0\n return loglinear.logl(store['xb...
[ "0.6908991", "0.67901516", "0.6748823", "0.6555421", "0.6537084", "0.65136236", "0.6442761", "0.64340353", "0.6420213", "0.64125615", "0.63817775", "0.6373047", "0.63200843", "0.6316748", "0.62856615", "0.6277802", "0.6261285", "0.6257053", "0.62509704", "0.62499064", "0.6237...
0.6528573
5
Find first r value s.t. the linear and turing estimates of r are not significantly different.
def _find_cutoff(self): cutoff = 1 while ((self.linear_rstar_unnorm(cutoff) - self.turing_rstar_unnorm(cutoff))**2 > self.approx_turing_variance(cutoff)): cutoff += 1 return cutoff
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_rs(v, j):\r\n v_s, j_s = np.sort([v, j], axis=1)\r\n m = np.polyfit(v_s[-10:], j_s[-10:], 1)\r\n return 1/abs(m[0]) * 1000 #[Ohm cm^2]\r", "def b_vs_r(r, t=.97):\n min_b = (np.log(1-t))/(np.log(1-.95**r))\n return min_b", "def __find_r_corr_in_points(arr):\n n = len(arr)\n ...
[ "0.60582757", "0.5931805", "0.59098005", "0.5888322", "0.5841924", "0.5819919", "0.5704931", "0.5644729", "0.564107", "0.56170464", "0.5602746", "0.5596635", "0.55957025", "0.5592062", "0.55595565", "0.5538356", "0.5533621", "0.55293804", "0.5513773", "0.55079275", "0.5502329...
0.0
-1
Parse features from byteencoding to the correct type and shape.
def parse_train(self, proto, height, width): _, sequence_parsed = tf.io.parse_single_sequence_example( proto, context_features=self._context_features, sequence_features=self._sequence_features) # Deserialize images to float32 tensors. images = tf.map_fn( _deserialize_png, se...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_and_decode(example_proto,data_shape,dtypes):\n features = {}\n for name in data_shape:\n features[name] = tf.FixedLenFeature([], tf.string)\n parsed_features = tf.parse_single_example(example_proto, features)\n count = 0\n res = {}\n for name in data_s...
[ "0.68898326", "0.67393595", "0.6622843", "0.6522131", "0.6400133", "0.635168", "0.63479924", "0.62762094", "0.6270513", "0.6163678", "0.61197406", "0.60895497", "0.6085604", "0.60802996", "0.6062965", "0.600735", "0.5974631", "0.5960345", "0.5915046", "0.5915046", "0.5887663"...
0.0
-1