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
1 convolution from f {l1}{r1} 2 transposed convolution from f {l} {k} 3 convolution the one to be summed with result of f {l}{k} (2) convolution 4 convolution the one to be producted with result of f {l}{k} (2) convolution
def __init__(self, in_channels_1, in_channels_2, out_channels, kernel_size_1, kernel_size_2, stride_1, up_stride_2, padding_1, up_padding_2, output_padding=0, activation_in='relu', activation_out='lrelu', norm_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convolve_one_image(self,input4D, one_image, image_shape, \n Pstruct, filter_shape,\n image_index,\n channel_index): \n \n \n ## We look at the composition for the first channel in the beginning \n ...
[ "0.65440655", "0.63747793", "0.6343745", "0.6302786", "0.62567025", "0.6233646", "0.61736387", "0.61276245", "0.6091118", "0.60858166", "0.60557085", "0.60371697", "0.6027836", "0.60214156", "0.6019738", "0.6014391", "0.59943557", "0.598205", "0.59798104", "0.5973679", "0.595...
0.0
-1
Return the contents of file f_relative_path as a string, or a list of strings if read_lines is True.
def read(f_relative_path: str) -> str: here = path.dirname(path.abspath(__file__)) with io.open(path.join(here, f_relative_path), mode="rt", encoding="utf8") as f: return f.read()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_txt_file(relative_path_to_txt_file: str):\n with open(file=relative_path_to_txt_file) as f:\n lines = f.read()\n return lines", "def read(rel_path):\n here = os.path.abspath(os.path.dirname(__file__))\n with open(os.path.join(here, rel_path), \"r\") as fp:\n return ...
[ "0.70846015", "0.6535189", "0.6128279", "0.6120097", "0.60881114", "0.60569876", "0.60376364", "0.60376364", "0.6030412", "0.6026531", "0.60046923", "0.5990986", "0.59522074", "0.5950833", "0.5945287", "0.5945108", "0.59425455", "0.5916451", "0.5888799", "0.58768487", "0.5855...
0.7501114
0
Return the package version as defined in kx_core/__init__.py.
def get_version() -> str: version = read("pdf_utils/__version__.py") return re.search(r"__version__ = \"(.*?)\"", version).group(1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_package_version():\n major, minor, micro, patch, tag, relnum = __version_info__\n\n version = '%s.%s' % (major, minor)\n\n if micro or patch:\n version += '.%s' % micro\n\n if patch:\n version += '.%s' % patch\n\n if tag != 'final':\n version += '%s%s' % (\n ...
[ "0.78866553", "0.7815516", "0.7810721", "0.77791893", "0.7775338", "0.7742583", "0.77370197", "0.7723235", "0.772063", "0.772063", "0.772063", "0.7707923", "0.76899326", "0.7682685", "0.7641668", "0.7622068", "0.7620161", "0.7611079", "0.7575101", "0.7563609", "0.75628847", ...
0.71431565
62
Run model prediction on image
def predict(model, img, target_size): if img.size != target_size: img = img.resize(target_size) x = image.img_to_array(img) x = np.expand_dims(x, axis=0) x = preprocess_input(x) preds = model.predict(x) return preds[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(model, img):\n\tx = image.img_to_array(img)\n\tx = np.expand_dims(x, axis=0)\n\tx = preprocess_input(x)\n\tpreds = model.predict(x)\n\treturn preds[0]", "def singlePrediction(self,img):\n self.optimizer = SGD(lr = 0,momentum=0,decay = 0)\n self.createModel()\n output = self.model...
[ "0.8034563", "0.78639364", "0.78413767", "0.78063333", "0.77723986", "0.77677476", "0.7742839", "0.7671268", "0.7654957", "0.76024014", "0.7555368", "0.7520583", "0.7502367", "0.7493451", "0.7483869", "0.7474726", "0.7407818", "0.74024296", "0.7376098", "0.73710203", "0.72536...
0.75804126
11
Displays image and the topn predicted probabilities in a bar graph
def plot_preds(image, preds): plt.imshow(image) plt.axis('off') plt.figure() """labels = ("BEANS", "CAKE","CANDY","CEREAL","CHIPS", "CHOCOLATE", "COFFEE", "CORN", "FISH", "FLOUR", "HONEY", "JAM", "JUICE", "MILK", "NUTS","OIL","PASTA", "RICE", "SODA", "SPICES", "SUGAR", "TEA"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_preds(image, preds): \r\n #image\r\n plt.imshow(image)\r\n plt.axis('off')\r\n \r\n #bar graph\r\n plt.figure() \r\n order = list(reversed(range(len(preds)))) \r\n bar_preds = [pr[2] for pr in preds]\r\n labels = (pr[1] for pr in preds)\r\n plt.barh(order, bar_preds, alpha=0.5)\r\n plt.ytick...
[ "0.7922684", "0.77978665", "0.7721485", "0.769006", "0.76070917", "0.71370405", "0.70984143", "0.7009505", "0.68326867", "0.6766593", "0.6606671", "0.6594294", "0.6510035", "0.64082754", "0.63103276", "0.63035893", "0.62614477", "0.6234734", "0.6204136", "0.62028116", "0.6188...
0.7603528
5
dynamic programmin + memoryless > status machine
def minSwap(self, A: List[int], B: List[int]) -> int: n = len(A) # x, s: num of swaps if A[i], B[i] stay at place, swap with each other. x0, s0 = 0, 1 for i in range(1, n): x1 = s1 = float('inf') if A[i] > A[i - 1] and B[i] > B[i - 1]: x1, s1 = min(x1, x0), min(s1, s0 + 1) if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_system_resources(node):\n\n min_sys_res = True\n\n # CPUs\n if \"layout\" in node[\"cpu\"]:\n total_cpus = len(node[\"cpu\"][\"layout\"])\n if total_cpus < 2:\n print(\n \"\\nThere is only {} CPU(s) available on this system. \"\n ...
[ "0.6102139", "0.6019507", "0.58828735", "0.58289593", "0.5748978", "0.5737699", "0.57305235", "0.56923175", "0.56910443", "0.56457454", "0.55919945", "0.5578943", "0.55744416", "0.55678797", "0.5566923", "0.5564943", "0.5564556", "0.5538612", "0.55296224", "0.5498537", "0.549...
0.0
-1
Place this in a function to avoid circular imports
def get_user_model(): try: from django.contrib.auth import get_user_model User = get_user_model() except ImportError: from django.contrib.auth.models import User return User
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _to_be_wrapped(self) -> None:", "def __call__( self ):\n pass", "def __call__(self) -> None:", "def __call__(self):\n\t\treturn", "def __call__(self):\n pass", "def __call__(self):\n pass", "def use(self):", "def __call__(self):\n raise NotImplementedError", "def __c...
[ "0.66183394", "0.65979433", "0.6568104", "0.65579677", "0.6547573", "0.6547573", "0.64392775", "0.6418379", "0.6324917", "0.6324917", "0.6324917", "0.6324917", "0.6324917", "0.6271522", "0.6164478", "0.6067886", "0.60657114", "0.60547066", "0.59856945", "0.59455687", "0.59242...
0.0
-1
callback function for the 'min,max' entry
def on_entry(): try: # try to parse the entry string as a couple of integer values minvalue, maxvalue = win.entry.state.split(',') minvalue, maxvalue = int(minvalue), int(maxvalue) win.min, win.max = min(minvalue, maxvalue), max(minvalue, maxvalue) except Exception: pass # keep previous values...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minmin_maxmax( *args ):\n rmin = min( [ mv.min() for mv in args ] )\n rmax = max( [ mv.max() for mv in args ] )\n rmv = cdms2.createVariable( [rmin,rmax] )\n return rmv", "def min_max(my_list):\n print(\"Min = \",min(my_list,key = abs))\n print(\"Max = \",max(my_list,key = abs))", "def __...
[ "0.7155907", "0.68623936", "0.658245", "0.658245", "0.6571199", "0.6566627", "0.65426695", "0.65389234", "0.65389234", "0.65389234", "0.65389234", "0.65244204", "0.64892435", "0.6459422", "0.64441377", "0.643262", "0.6422386", "0.64124906", "0.6403266", "0.6400628", "0.637073...
0.6654227
2
callback function for the 'RANDOM' button
def on_random(): on_entry() # reparse the entry string as user may forget to hit 'ENTER' minvalue, maxvalue, size = win.min, win.max, len(win.box) values = ["%2s" % randrange(minvalue,maxvalue+1) for loop in range(size+1)] win.box.append(' '.join(values)) # append new values as a single line #win.box(' '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def OnButton(self, event):\n chicloVrach = random.randint(123, 130)\n\n print('chislo',chicloVrach )\n self.Glavnaja()", "def _random_function(self, random_state):\n return random_state.rand", "def getRandom(self) -> int:", "def getRandom(self) -> int:", "def sample_action(self,...
[ "0.6767691", "0.65743977", "0.6498399", "0.6498399", "0.6495831", "0.6441599", "0.6363457", "0.6363457", "0.63090175", "0.62606764", "0.62202805", "0.62098545", "0.6183875", "0.61090285", "0.6106403", "0.6105227", "0.6073028", "0.60634625", "0.6058298", "0.6045589", "0.604384...
0.61859345
12
callback function for the 'DELETE' button
def on_delete(): del win.box[-1] # delete last line #del win.box[0:-1] # delete all lines
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_callback(self):\n pass", "def delete():\n click.echo('delete was called.')", "def delete(self, *args, **kwargs):\n return 0", "def delete(self):\n ...", "def delete(self, *args, **kwargs):\n pass", "def delete(self, *args, **kwargs):\n pass", "de...
[ "0.7944691", "0.78292483", "0.746378", "0.7459333", "0.7426043", "0.7426043", "0.74164665", "0.7381844", "0.7363654", "0.7208855", "0.71957994", "0.71466476", "0.713544", "0.7100271", "0.70068383", "0.69945234", "0.69591475", "0.6939772", "0.688547", "0.68721384", "0.68721384...
0.0
-1
create the main window and pack the widgets
def main(minvalue=0, maxvalue=99): global win win = Win(title='RANDOM', op=5) # ---------------------------------------------------------------------------- frame1 = Frame(win, border=1, op=5, grow=False) Label(frame1, text='Enter min,max :', grow=False) Entry(frame1, width=10, command=on_entry) fr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createWidgets(self):\r\n top = self.winfo_toplevel()\r\n top.rowconfigure(0, weight=1)\r\n top.columnconfigure(0, weight=1)\r\n self.rowconfigure(0, weight=1)\r\n self.columnconfigure(0, weight=1) \r\n\r\n self.button_quit = tk.Button(self, text='Quit', command=self.qu...
[ "0.7809217", "0.7317288", "0.72833616", "0.7258088", "0.7197436", "0.7180559", "0.71751744", "0.71621305", "0.7132849", "0.7054788", "0.704204", "0.7019027", "0.69854087", "0.6966003", "0.69308066", "0.6913024", "0.68897957", "0.6888335", "0.6886561", "0.685545", "0.6836567",...
0.0
-1
Yield job postings in common schema format
def postings(self, quarter, stats_counter=None): logging.info('Finding postings for %s', quarter) for posting in self._iter_postings(quarter): transformed = self._transform(posting) transformed['id'] = '{}_{}'.format( self.partner_id, self._id(post...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_schedd_jobs(schedd_classad=None, job_attrs=JOB_ATTRS.keys()):\n job_records = []\n schedd = htcondor.Schedd(schedd_classad)\n timezone = pytz.timezone(get_timezone())\n current_time = timezone.localize(datetime.datetime.now())\n jobs = schedd.query(\"True\", job_attrs)\n for job in jobs:\...
[ "0.63377845", "0.59094715", "0.5628101", "0.5623778", "0.5564661", "0.5475286", "0.54702526", "0.5438533", "0.5423452", "0.54123676", "0.54086095", "0.5400352", "0.5397553", "0.53925645", "0.5333178", "0.5325623", "0.5307127", "0.530603", "0.5302847", "0.52863455", "0.5273875...
0.50936055
55
Given a document, compute a sourcespecific id for the job posting. To be implemented by subclasses
def _id(self, document): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resourceDocumentId(self, resource: Resource) -> str:", "def getDocumentId(self): #$NON-NLS-1$\r", "def doc_id(self):\n return self._id", "def get_doc_id(self):\n return self.__doc_id", "def source_id(self) -> str:\n return self._source_id", "def source_id(self) -> str:\n r...
[ "0.6282072", "0.60269284", "0.5852061", "0.5735901", "0.5694973", "0.5694973", "0.5641792", "0.5626624", "0.562359", "0.56151587", "0.56097937", "0.55504596", "0.5522015", "0.5411822", "0.5347779", "0.5347779", "0.5342647", "0.5319721", "0.5319721", "0.52834874", "0.52826506"...
0.694908
0
Given a quarter, yield all relevant raw job posting documents. To be implemented by subclasses
def _iter_postings(self, quarter): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postings(self, quarter, stats_counter=None):\n logging.info('Finding postings for %s', quarter)\n for posting in self._iter_postings(quarter):\n transformed = self._transform(posting)\n transformed['id'] = '{}_{}'.format(\n self.partner_id,\n se...
[ "0.73558885", "0.51440305", "0.5119742", "0.49251112", "0.48970717", "0.48621002", "0.48428088", "0.47837812", "0.4715076", "0.47008112", "0.4682589", "0.46730265", "0.46716323", "0.46703556", "0.46643853", "0.4660238", "0.4606574", "0.46021757", "0.45960665", "0.45927292", "...
0.72257715
1
Given a job posting document, transform it into the common schema.
def _transform(self, document): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preprocess_post(self, post):\n # tokenize, clean, & tag part-of-speech for all words\n if self.document_level == 'postwise':\n\n doc_text = all_comments_from_post(post)\n # leave early if there's nothing there\n if doc_text == '':\n return []\n\n ...
[ "0.53246874", "0.5321279", "0.53042996", "0.5169809", "0.50002706", "0.49604833", "0.49088973", "0.48935318", "0.48701125", "0.4867622", "0.48573858", "0.4856788", "0.4853556", "0.4847017", "0.48415366", "0.4838086", "0.47773227", "0.47739896", "0.47737083", "0.47646734", "0....
0.51903456
3
Look up the numerical gate representation and a proposed 'noisy' name.
def get_modified_noisy_gate(gate_name: str, params: Iterable[ParameterDesignator]) -> Tuple[np.ndarray, str]: params = tuple(params) if gate_name == "I": assert params == () return np.eye(2), "NOISY-I" if gate_name == "RX": angle, = params if np.isclose(angle, np.pi / 2, atol...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_nonphylogenetic_metric(name):\r\n # looks for name, inserting possible dist_ to find functions\r\n # in distance_transform.py named e.g.:\r\n # binary_dist_chisq / dist_bray_curtis\r\n try:\r\n return getattr(distance_transform, 'dist_' + name.lower())\r\n except AttributeError:\r\n ...
[ "0.6031811", "0.6019712", "0.5505304", "0.5480643", "0.5449328", "0.53937733", "0.53687114", "0.53385764", "0.5300645", "0.5300645", "0.5279134", "0.52615255", "0.5232032", "0.5215277", "0.51930237", "0.515612", "0.51222146", "0.50935143", "0.5086529", "0.5076165", "0.5069962...
0.6819791
0
The default noise parameters T1 = 30 us T2 = 30 us 1q gate time = 50 ns 2q gate time = 150 ns are currently typical for nearterm devices. This function will define new gates and add Kraus noise to these gates. It will translate the input program to use the noisy version of the gates.
def _modified_decoherence_noise_model( gates: Sequence[Gate], T1: Union[Dict[int, float], float] = 30e-6, T2: Union[Dict[int, float], float] = 30e-6, gate_time_1q: float = 50e-9, gate_time_2q: float = 150e-09, ro_fidelity: Union[Dict[int, float], float] = 0.95, ) -> NoiseModel: all_qubits = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_modified_decoherence_noise(\n prog: \"Program\",\n T1: Union[Dict[int, float], float] = 30e-6,\n T2: Union[Dict[int, float], float] = 30e-6,\n gate_time_1q: float = 50e-9,\n gate_time_2q: float = 150e-09,\n ro_fidelity: Union[Dict[int, float], float] = 0.95,\n) -> \"Program\":\n gates ...
[ "0.6628927", "0.58579427", "0.5831026", "0.56987023", "0.55713624", "0.5551751", "0.5513629", "0.54612297", "0.5435982", "0.53606707", "0.53522336", "0.53512543", "0.5348637", "0.5332393", "0.53229153", "0.52960086", "0.5282946", "0.52718014", "0.52508575", "0.5249883", "0.52...
0.7118521
0
Generate the header for a pyquil Program that uses ``noise_model`` to overload noisy gates.
def _modified_noise_model_program_header(noise_model: NoiseModel) -> "Program": from pyquil.quil import Program p = Program() defgates: Set[str] = set() for k in noise_model.gates: # obtain ideal gate matrix and new, noisy name by looking it up in the NOISY_GATES dict try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_model_header(env: jinja2.environment.Environment, model: onnx.ModelProto) -> str:\n header_template = env.get_template(\"model_header.dml.jinja\")\n header_infos = dict()\n\n header_infos[\"ir_version\"] = model.ir_version\n opset_import = list()\n for opset in model.opset_import:\n i...
[ "0.6443", "0.60880536", "0.5795828", "0.56925726", "0.56897265", "0.56873477", "0.5668974", "0.5653915", "0.5571958", "0.5570082", "0.55554986", "0.55474067", "0.55420685", "0.5530725", "0.550911", "0.54856914", "0.5472454", "0.5466979", "0.5424813", "0.5413869", "0.54122144"...
0.79720664
0
Apply a noise model to a program and generated a 'noisyfied' version of the program.
def apply_modified_noise_model(prog: "Program", noise_model: NoiseModel) -> "Program": new_prog = _modified_noise_model_program_header(noise_model) for i in prog: if isinstance(i, Gate) and noise_model.gates: try: _, new_name = get_modified_noisy_gate(i.name, tuple(i.params))...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _modified_noise_model_program_header(noise_model: NoiseModel) -> \"Program\":\n from pyquil.quil import Program\n\n p = Program()\n defgates: Set[str] = set()\n for k in noise_model.gates:\n\n # obtain ideal gate matrix and new, noisy name by looking it up in the NOISY_GATES dict\n tr...
[ "0.71081764", "0.6942209", "0.67204815", "0.65276885", "0.6525033", "0.6456866", "0.63153213", "0.6242626", "0.6212918", "0.61854535", "0.6173296", "0.61590374", "0.6148146", "0.61058336", "0.60990524", "0.6093618", "0.6059789", "0.6057936", "0.6054125", "0.6036168", "0.60214...
0.73493963
0
Add generic damping and dephasing noise to a program. This highlevel function is provided as a convenience to investigate the effects of a generic noise model on a program. For more finegrained control, please investigate the other methods available in the ``pyquil.noise`` module. In an attempt to closely model the QPU...
def add_modified_decoherence_noise( prog: "Program", T1: Union[Dict[int, float], float] = 30e-6, T2: Union[Dict[int, float], float] = 30e-6, gate_time_1q: float = 50e-9, gate_time_2q: float = 150e-09, ro_fidelity: Union[Dict[int, float], float] = 0.95, ) -> "Program": gates = _get_program_ga...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _modified_decoherence_noise_model(\n gates: Sequence[Gate],\n T1: Union[Dict[int, float], float] = 30e-6,\n T2: Union[Dict[int, float], float] = 30e-6,\n gate_time_1q: float = 50e-9,\n gate_time_2q: float = 150e-09,\n ro_fidelity: Union[Dict[int, float], float] = 0.95,\n) -> NoiseModel:\n ...
[ "0.6818638", "0.61347294", "0.6079218", "0.58847916", "0.58088034", "0.57671183", "0.5764723", "0.5756611", "0.5714665", "0.5685358", "0.56427485", "0.561027", "0.56034786", "0.5563276", "0.5559172", "0.5557005", "0.5536149", "0.5534381", "0.5500958", "0.5471309", "0.54573405...
0.70419616
0
Give the zerobased index of first occurrence of object in queryset. Return 1 if not found
def index(queryset, obj): for index, item in enumerate(queryset): if item == obj: return index return -1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index(self, obj):\n return self.model.indexlist[obj]", "def _get_first_occurrence_for(iterable, wanted_object):\n for i, value in enumerate(iterable):\n if value is wanted_object:\n return i", "def _findIndex(self, x):\n if x< self[0][0] or x> self[-1][0]:\n return ...
[ "0.66508794", "0.66319877", "0.6196297", "0.60581875", "0.60506517", "0.60432094", "0.5979738", "0.5903687", "0.5892405", "0.5842994", "0.58137876", "0.5810193", "0.57849294", "0.5744563", "0.57441866", "0.5736628", "0.57161486", "0.56848454", "0.5655904", "0.56100047", "0.56...
0.77490765
0
Make all city names lowercase with '_' over ' '.
def clean_city_names(metadata, min_count=3): metadata = metadata.copy() metadata['city'] = metadata['city'].apply(lambda el: '_'.join(str(el).lower().split())) counts = metadata['city'].value_counts() cities = counts[counts >= min_count].index metadata = metadata.loc[metadata['city'].isin(cities)] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_city_name(name):\r\n if ', WA' or ',WA' in name:\r\n name = name.rstrip (', WA')\r\n return string.capwords(name)", "def standardize_name_for_look_up(name: Any) -> str:\n if not isinstance(name, str):\n return name\n\n name = name.lower().strip()\n name = \" \".join(name.s...
[ "0.7799803", "0.7071588", "0.6999649", "0.683", "0.675845", "0.66921234", "0.6659343", "0.6636172", "0.66248566", "0.66193634", "0.6587236", "0.65828824", "0.6553963", "0.65467453", "0.6536803", "0.65269345", "0.6501677", "0.6496434", "0.6496434", "0.6496434", "0.647725", "...
0.0
-1
Return a pandas dataframe with metadata and MetaSUB ontologies.
def add_ontology(metadata): metadata = add_surface_ontology(metadata) metadata = add_place_ontology(metadata) return metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pandas(self):\n self.meta = pd.DataFrame(self.meta)\n return", "def get_reactome_hierarchy_df() -> pd.DataFrame:\n return pd.read_csv(REACTOME_HIERARCHICAL_MAPPINGS_PATH, sep='\\t')", "def metadata(self) -> dict:\n\n meta = {}\n meta['name'] = self.name\n meta['pote...
[ "0.6497855", "0.60787183", "0.6017884", "0.5992482", "0.5976122", "0.59745234", "0.5965062", "0.596002", "0.59586555", "0.59495765", "0.5940849", "0.59402424", "0.5906102", "0.5879486", "0.5869907", "0.5868608", "0.58679336", "0.58338434", "0.58194155", "0.58183753", "0.58117...
0.0
-1
Return a pandas dataframe with metadata and surface ontologies.
def add_surface_ontology(metadata): metadata, tbl = metadata.copy(), {} for val in metadata['surface_material'].unique(): if has_keyword(val, 'glass', 'metal', 'steel', 'copper'): tbl[val] = ('metal', 'impermeable') elif has_keyword(val, 'stone', 'marble', 'ceramic', 'concrete', 'cem...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reactome_hierarchy_df() -> pd.DataFrame:\n return pd.read_csv(REACTOME_HIERARCHICAL_MAPPINGS_PATH, sep='\\t')", "def construct_data_frame(self) -> pd.DataFrame:\n data_frame = self.base_data_frame[\n [self.name_col, self.description_col]\n ].reset_index()\n data_frame.c...
[ "0.60447127", "0.6039541", "0.6001335", "0.5996675", "0.5960313", "0.59217834", "0.59108263", "0.58964396", "0.5884625", "0.585568", "0.58455336", "0.5842718", "0.58412975", "0.5839708", "0.58279854", "0.5820714", "0.5808", "0.5792523", "0.57793206", "0.5778404", "0.5764533",...
0.55766314
42
Return a pandas dataframe with metadata and place ontologies.
def add_place_ontology(metadata): metadata = metadata.copy() metadata['coastal'] = metadata.apply(coastal, reduce=True, axis=1) return metadata
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_reactome_hierarchy_df() -> pd.DataFrame:\n return pd.read_csv(REACTOME_HIERARCHICAL_MAPPINGS_PATH, sep='\\t')", "def df(self) -> \"pandas.DataFrame\":\n titles = []\n comments = []\n alternative_codes = []\n for cat in self.values():\n titles.append(cat.title)\n ...
[ "0.61115766", "0.6036481", "0.60349274", "0.6032239", "0.5998811", "0.5992482", "0.58942795", "0.58796895", "0.5872876", "0.5821394", "0.57974946", "0.57712907", "0.574482", "0.56860524", "0.56507355", "0.56507015", "0.5649417", "0.56457484", "0.5640005", "0.5638351", "0.5621...
0.5587395
26
Test blending colors together.
def test_merge_colors(self): for case in self.__class__.SCALES: with self.subTest(case=case): self.assertEqual(colors.merge_colors(case[0][0], case[0][1]), case[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_blending(self, data, blending_first, blending_second):\n layer = Points(data)\n assert layer.blending == \"translucent\"\n\n layer.blending = blending_first\n assert layer.blending == blending_first\n\n layer = Points(data, blending=blending_first)\n assert layer....
[ "0.77926445", "0.65757734", "0.6558904", "0.6457233", "0.6376555", "0.63488525", "0.6238908", "0.6215282", "0.6200828", "0.62001896", "0.6191478", "0.61771214", "0.61244303", "0.61071944", "0.60679585", "0.606215", "0.6010298", "0.5975439", "0.5948333", "0.59447193", "0.59387...
0.62966686
6
Test converting color text codes to integer trios.
def test_color_str_to_trio(self): for case in self.__class__.TEXTS: with self.subTest(case=case): self.assertEqual(colors.color_str_to_trio(case[0]), case[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_toInt(self):\r\n self.assertEqual(self.black.toInt(), 0)\r\n self.assertEqual(self.red.toInt(), 16711680)\r\n self.assertEqual(self.pink.toInt(), 6553600)", "def test_color_trio_to_str(self):\n for case in self.__class__.TRIOS:\n with self.subTest(case=case):\n ...
[ "0.68440133", "0.668924", "0.63109994", "0.6197401", "0.61614543", "0.61015356", "0.6036581", "0.6017181", "0.6007153", "0.5982131", "0.5978146", "0.5911295", "0.58729845", "0.58344436", "0.5826692", "0.5734345", "0.57341844", "0.5688235", "0.56828016", "0.564937", "0.5624364...
0.7008089
0
Test converting integer trios to color text codes.
def test_color_trio_to_str(self): for case in self.__class__.TRIOS: with self.subTest(case=case): self.assertEqual(colors.color_trio_to_str(case[0]), case[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_color_str_to_trio(self):\n for case in self.__class__.TEXTS:\n with self.subTest(case=case):\n self.assertEqual(colors.color_str_to_trio(case[0]), case[1])", "def test_toInt(self):\r\n self.assertEqual(self.black.toInt(), 0)\r\n self.assertEqual(self.red.to...
[ "0.69274575", "0.6589749", "0.63529044", "0.63369346", "0.62156", "0.61823004", "0.6172301", "0.61215353", "0.6078759", "0.6035878", "0.6024409", "0.59644485", "0.5952612", "0.59047055", "0.5881229", "0.58397704", "0.58161825", "0.5805346", "0.5793865", "0.5763105", "0.576165...
0.69545627
0
Return random coordinate for an object rounded to accuracy of delta (float).
def RandomCoordinate(): return ReturnRounded(np.random.uniform(-10,10))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __randomize_coord((ref_x, ref_y)):\n radius = numpy.random.normal(scale=DataGen.stdev_distance)\n angle = random.uniform(0, 2 * math.pi)\n rand_x = ref_x + radius * math.cos(angle)\n rand_y = ref_y + radius * math.sin(angle)\n return rand_x, rand_y", "def randomize_position...
[ "0.6204", "0.60160416", "0.59795004", "0.5935111", "0.5867318", "0.5796637", "0.5642895", "0.5557663", "0.5556598", "0.5540177", "0.55266476", "0.55259424", "0.5512448", "0.5476977", "0.54743147", "0.54636455", "0.5447325", "0.54414725", "0.5432466", "0.5425684", "0.5400466",...
0.69313
0
Return distance between two 2D points
def CalculateDistance(q1, q2): return np.sqrt((q1[0] - q2[0])**2 + (q1[1] - q2[1])**2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __get_distance(point1: np.ndarray, point2: np.ndarray) -> float:\n return np.sqrt(np.sum(np.square(point1 - point2)))", "def distance_between_points(p1,p2):\n return math.sqrt((p2.x-p1.x)**2+(p2.y-p1.y)**2)", "def distance(p1,p2):\n return ((p1.x - p2.x)**2 + (p1.y - p2.y)**2)**0.5", "def di...
[ "0.8477306", "0.8340189", "0.8255356", "0.82520866", "0.8246107", "0.82405436", "0.82405436", "0.8232755", "0.82311654", "0.8228505", "0.8207565", "0.81974113", "0.8191894", "0.8168252", "0.8168167", "0.8163704", "0.81575453", "0.8154237", "0.81475264", "0.81466746", "0.81378...
0.0
-1
Return F_att for point q, from finish_point q_k
def AttractionForce(q,q_k): return k_p*CalculateDistance(q,q_k)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sigma_xx_to_a_to_ff(self, Q, f):\n if f == \"e\":\n mf = me\n # gall = self.gaee\n elif f == \"mu\":\n mf = mmu\n # gall = self.gamumu\n mx = self.mx\n if Q >= 2.0 * mf and Q >= 2.0 * mx:\n # gaxx = self.gaxx\n # ma =...
[ "0.5644244", "0.53550917", "0.5309267", "0.5231378", "0.5200815", "0.5191348", "0.5150725", "0.4982281", "0.4951254", "0.4942593", "0.4912569", "0.4855299", "0.48428315", "0.4836259", "0.483546", "0.48336896", "0.48231852", "0.48079002", "0.47921115", "0.47866088", "0.4777043...
0.6347686
0
Return repulsion force on point q, from obstacle q_oi
def RepulsionForceFromObstacle(q,q_oi): d_i = CalculateDistance(q,q_oi) # Distance to the obstacle if (d_i < d_0): # Point within obstacle influence F_oi = k_o * (1/d_i - 1/d_0) /d_i**2 if (F_oi > F_rep_MaxValue): # F_rep won't exceed set constant return F_rep_MaxVal...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RepulsionForcesInAPoint(q,ObstVector):\r\n F_rep = 0\r\n for q_oi in ObstVector: # For each obstacle...\r\n F_rep += RepulsionForceFromObstacle(q,q_oi) #... add its repulsion to net F_rep\r\n return F_rep", "def ban_Force(q):\n \n x = q[0]\n y = q[1]\n dx =...
[ "0.67056006", "0.66570973", "0.6394435", "0.6346173", "0.61297435", "0.6093138", "0.6078021", "0.5982097", "0.5887824", "0.58862346", "0.5841583", "0.5840448", "0.5832472", "0.5810463", "0.5783585", "0.57715243", "0.57642233", "0.5764123", "0.5747722", "0.57469237", "0.570358...
0.8176501
0
Return net repulsion force acting on a point q, based on a list of obstacles ObstVector
def RepulsionForcesInAPoint(q,ObstVector): F_rep = 0 for q_oi in ObstVector: # For each obstacle... F_rep += RepulsionForceFromObstacle(q,q_oi) #... add its repulsion to net F_rep return F_rep
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def RepulsionForceFromObstacle(q,q_oi):\r\n d_i = CalculateDistance(q,q_oi) # Distance to the obstacle\r\n if (d_i < d_0): # Point within obstacle influence\r\n F_oi = k_o * (1/d_i - 1/d_0) /d_i**2 \r\n if (F_oi > F_rep_MaxValue): # F_rep won't exceed set constant\r\n retu...
[ "0.61033577", "0.59260166", "0.58975464", "0.5893999", "0.58747244", "0.57450384", "0.5693517", "0.55875623", "0.5544491", "0.5539944", "0.55349374", "0.55225456", "0.5517202", "0.5507373", "0.5500563", "0.54926264", "0.54701596", "0.5453624", "0.5442819", "0.5395531", "0.536...
0.7295841
0
Calculate net force on a point q
def ForcesInAPoint(WhichForce, q,q_k,ObstVector): """WhichForce determines what kind of forces: F_att "A"; F_rep "R", F_net "N""" return { 'N': AttractionForce(q,q_k) + RepulsionForcesInAPoint(q, ObstVector), 'A': AttractionForce(q,q_k), 'R': RepulsionForcesInAPoint(q, ObstVector) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ban_Force(q):\n \n x = q[0]\n y = q[1]\n dx = 2*(8*x**3-16*x*y+x-1)\n dy = 16 * (2*y-x**2)\n return np.array([-dx,-dy])", "def AttractionForce(q,q_k):\r\n return k_p*CalculateDistance(q,q_k)", "def ForwardDynamics(\n self,\n dt,\n q,\n ...
[ "0.64064276", "0.6406263", "0.6079351", "0.6052035", "0.6042578", "0.602331", "0.59386", "0.5869529", "0.5850708", "0.5833285", "0.5828675", "0.5808702", "0.5802026", "0.57823694", "0.5769641", "0.57633626", "0.5757132", "0.574005", "0.5739287", "0.573875", "0.5720081", "0....
0.5354164
58
returns list of all tracks (need also to read the 'next' for getting ALL tracks)
def readSavedTracks(self)->'list': scope = 'user-library-read' self.saved_tracks_list = [] self.sp_data = self.sp_client.Connect(scope) if self.sp_client.isConnected() == True: print('We are connected to Spotify!!!!') try: tracks_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_tracks(num=1):\n pass", "def get_all_tracks():\n query_format = f\"track:\"\n\n search_string_letter_ids = [0]\n\n tracks = {}\n\n total = 0\n\n while search_string_letter_ids is not None:\n search_string = construct_search_string(search_string_letter_ids)\n count = tr...
[ "0.77134794", "0.7594046", "0.74213517", "0.7341831", "0.7068435", "0.7040398", "0.7029339", "0.67667544", "0.6711516", "0.66247386", "0.6592173", "0.6532199", "0.64493704", "0.642554", "0.6419652", "0.63989365", "0.63813907", "0.63417333", "0.63248986", "0.62960994", "0.6293...
0.704814
5
Function collects information from the specified resources and generates a response page for the collect_info endpoint
async def collect_info(request: web.Request, city="Kiev"): async with ClientSession() as session: covid_19_data = await (covid_19("https://covid-19-data.p.rapidapi.com/totals", session)) weather_data = await (weather("https://community-open-weather-map.p.rapidapi.com/weather", session, city=city)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resources():\n return Response(f\"{Resource.get_all_resources()}\", 200, mimetype='text/plain')", "def process_resource_listing(self, resources, context):\n pass", "def process_resource_listing_api(self, resources, listing_api, context):\n pass", "def print_resources(self) -> None:\n...
[ "0.6543069", "0.6129639", "0.6126633", "0.59852785", "0.5875669", "0.5855671", "0.58320254", "0.57904845", "0.57737786", "0.56922066", "0.5685085", "0.56788135", "0.56689215", "0.5666231", "0.5656492", "0.5648536", "0.56214523", "0.56104", "0.5565291", "0.55504084", "0.553617...
0.56006503
18
Endpoint processes a post request from the form to get the weather for the specified city
async def city_weather(request: web.Request): data = await request.post() current_city = data["city"] return await collect_info(request, city=current_city)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(self, city: str):\n # Make a call to the OpenWeatherMap API and check the units inserted at the query parameter.\n units = request.args.get('unit', '').casefold()\n weather_data, query_units = self.get_weather(city, units)\n temp = self.check_unit(query_units)\n\n # Get t...
[ "0.72298294", "0.67077965", "0.6676318", "0.6553933", "0.6520883", "0.6472788", "0.64574057", "0.6442259", "0.6378601", "0.62982494", "0.62931186", "0.6264356", "0.6211222", "0.6193483", "0.613255", "0.61181283", "0.61084616", "0.60750145", "0.60643506", "0.60150003", "0.5989...
0.78677696
0
Function sends a request to obtain information about the incidence statistics of covid and returns a data dictionary or False
async def covid_19(url, session): params = {"format": "json"} headers = { 'x-rapidapi-key': API_KEY, 'x-rapidapi-host': "covid-19-data.p.rapidapi.com" } response = await session.get(url, params=params, headers=headers) if response.status == 200: covid_19_info = await response...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covid_fetch():\n #Sets the structure of the data retrieved from the API\n cases_and_deaths = {\n \"date\": \"date\",\n \"areaName\": \"areaName\",\n \"areaCode\": \"areaCode\",\n \"newCasesByPublishDate\": \"newCasesByPublishDate\",\n \"cumCasesByPublishDate\": \"cumCasesByPublishDate\",\n...
[ "0.6947889", "0.6343356", "0.6228284", "0.61825156", "0.6079988", "0.600137", "0.5968241", "0.58464897", "0.5826876", "0.57421815", "0.5700513", "0.56654406", "0.56482095", "0.56417716", "0.54925734", "0.5482195", "0.54576546", "0.54522425", "0.5449562", "0.54344255", "0.5378...
0.6200049
3
Function sends a request to obtain information about the weather in current city and returns a data dictionary or False
async def weather(url, session, city): params = {"q": city, "lang": "ru", "units": "metric", "mode": "json"} headers = { 'x-rapidapi-key': API_KEY, 'x-rapidapi-host': "community-open-weather-map.p.rapidapi.com" } response = await session.get(url, params=params, headers=headers) if re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def city_weather(request: web.Request):\n data = await request.post()\n current_city = data[\"city\"]\n return await collect_info(request, city=current_city)", "def get(self, city: str):\n # Make a call to the OpenWeatherMap API and check the units inserted at the query parameter.\n ...
[ "0.78325963", "0.75393945", "0.73343176", "0.7309696", "0.7283628", "0.7208504", "0.7185058", "0.7183764", "0.7180932", "0.71728384", "0.70717156", "0.7044659", "0.70226324", "0.7012848", "0.69257617", "0.68630844", "0.6844851", "0.68423885", "0.68418497", "0.67672926", "0.67...
0.7699957
1
This function creates a partial function for sampling random clients.
def randomly_select_clients_for_round( population: int, num_of_clients: int, replace: bool = False, seed: int = None ) -> functools.partial: def select(round_number, seed, replace): return np.random.RandomState().choice( population, num_of_clients, replace=replace ) return func...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_dataset_fn(\n dataset: tf.data.Dataset,\n number_of_clients_per_round: int,\n seed: int = None,\n) -> Callable[[], tf.data.Dataset]:\n sample_clients = randomly_select_clients_for_round(\n dataset.client_ids,\n num_of_clients=number_of_clients_per_round,\n replace=Fa...
[ "0.6248188", "0.57352465", "0.56887686", "0.5630404", "0.5566855", "0.55375606", "0.5520642", "0.5461235", "0.54593724", "0.5446919", "0.54420066", "0.54274714", "0.5406328", "0.5400366", "0.5398023", "0.5383204", "0.53441745", "0.53429705", "0.5331215", "0.5330419", "0.53158...
0.6496539
0
This function generates a function for selecting clientdatasets for each round number.
def get_client_dataset_fn( dataset: tf.data.Dataset, number_of_clients_per_round: int, seed: int = None, ) -> Callable[[], tf.data.Dataset]: sample_clients = randomly_select_clients_for_round( dataset.client_ids, num_of_clients=number_of_clients_per_round, replace=False, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_client_fn(dataset_partitions):\n\n def client_fn(cid: str) -> fl.client.Client:\n \"\"\"Construct a FlowerClient with its own dataset partition.\"\"\"\n\n # Extract partition for client with id = cid\n x_train, y_train = dataset_partitions[int(cid)]\n # Use 10% of the client'...
[ "0.57062846", "0.5575745", "0.54757863", "0.5445093", "0.5359454", "0.5346562", "0.5344329", "0.5338417", "0.5323915", "0.5321573", "0.5308771", "0.52902603", "0.52606547", "0.5251963", "0.5250017", "0.5224285", "0.51744944", "0.51469755", "0.51442826", "0.51338434", "0.51288...
0.71754587
0
Converts dataset to tupled dataset.
def _convert_fn(dataset: tf.data.Dataset) -> tf.data.Dataset: spec = dataset.element_spec if isinstance(spec, collections.abc.Mapping): return dataset.map(lambda observation: (observation["x"], observation["y"])) else: return dataset.map(lambda x, y: (x, y))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DatasetToTuple(sample):\n \n X_elem = []\n Y_elem = []\n for x,y in sample:\n X_elem.append(x if x.dim() > 0 else x.item())\n Y_elem.append(y if y.dim() > 0 else y.item()) \n return (torch.stack(X_elem),torch.stack(Y_elem))", "def DatasetToTuple(sample):\n \n X_ele...
[ "0.6248781", "0.6248781", "0.61366004", "0.56621313", "0.56125337", "0.56117225", "0.56018174", "0.5594659", "0.5593983", "0.55647784", "0.5509093", "0.5505307", "0.54940504", "0.5486532", "0.5484437", "0.5482926", "0.54735357", "0.5470663", "0.5461278", "0.5420747", "0.53988...
0.60262614
3
This function makes a function for evaluating a model while training.
def get_validation_fn( test_dataset: tf.data.Dataset, model_fn: Callable[[], tf.keras.models.Model], loss_fn: Callable[[], tf.keras.losses.Loss], metrics_fn: Callable[[], tf.keras.metrics.Metric], ) -> Callable[[], tf.data.Dataset]: def compiled_model() -> tf.keras.Model: val_model = model_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def _evaluate_during_fit(self, test_loader, epoch):", "def evaluate(model, optimizer, loss_function, loader, device, labels, log_every_n=10):\n\n model.eval()\n\n batch_wise_true_labels = []\n batch_w...
[ "0.7027224", "0.69508666", "0.69354415", "0.6925504", "0.6851042", "0.6831912", "0.6831396", "0.68186605", "0.68149203", "0.678271", "0.6761923", "0.67494124", "0.67410195", "0.67235774", "0.67157817", "0.6713486", "0.6704787", "0.6704224", "0.67013925", "0.6694381", "0.66826...
0.0
-1
Draws the block on the screen
def draw(self, screen, size_block): pos = self.board.coordinate_to_position(self.coordinate) screen.blit(pygame.transform.scale(self.image, (size_block, size_block)), (pos[0], pos[1]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self):\n\t\tself.screen.fill(pygame.Color('black'))\n\t\tfor column in self.model.blocks:\n\t\t\tfor block in column:\n\t\t\t\tr = pygame.Rect(block.left,\n\t\t\t\t\t\t\t\tblock.top,\n\t\t\t\t\t\t\t\tblock.size,\n\t\t\t\t\t\t\t\tblock.size)\n\t\t\t\tpygame.draw.rect(self.screen, block.color,r)\n\t\tpygame...
[ "0.8203293", "0.8183783", "0.8012238", "0.7881209", "0.7751677", "0.77117234", "0.76349616", "0.7580952", "0.7553323", "0.7543676", "0.7497097", "0.7388594", "0.73665094", "0.73665094", "0.73665094", "0.73665094", "0.73603535", "0.73522764", "0.733408", "0.73245215", "0.73075...
0.73898596
11
Turns the tetromino if it is possible to turn the tetromino
def turn(self): new_shape = [] for shape in self.shape: new_shape.append([-shape[1], shape[0]]) old_shape = self.shape[:] self.shape = new_shape if not self.board.is_valid_tetromino(self): self.shape = old_shape
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn(self):\n pass", "def on_turnover(self):\n return True if self.rotor_setting in self.turnover_characters else False", "def turn():\n \n robottype = get_type()\n if robottype == RobotType.PAWN:\n pawn_turn()\n else:\n overlord_turn()\n bytecode = get_bytecode()", ...
[ "0.6341206", "0.6177607", "0.60730696", "0.60730696", "0.60421073", "0.59296685", "0.59253603", "0.57909256", "0.5623556", "0.5606334", "0.5600717", "0.55685407", "0.5567788", "0.5556943", "0.5554544", "0.554343", "0.5536502", "0.551141", "0.54977953", "0.54977953", "0.546125...
0.0
-1
Checks whether or not it is possible for the tetromino to move in the given direction
def possible_to_move(self, down=False, left=False, right=False): old_coordinate = self.coordinate[:] possible = False self.move(down, left, right) if self.board.is_valid_tetromino(self): possible = True self.coordinate = old_coordinate return possible
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_move(self,direction):\r\n if direction in self.current_room.return_directions():\r\n print('move into the next room')\r\n # makes next room \r\n self.next_room(direction)\r\n return True\r\n else:\r\n print(\"Can't move that way\")\r\n ...
[ "0.77156323", "0.7412554", "0.7255705", "0.72216725", "0.72207654", "0.7070611", "0.70556986", "0.7025435", "0.7002111", "0.69619906", "0.69618464", "0.695139", "0.6950972", "0.69369805", "0.6889356", "0.6767303", "0.6745534", "0.67047703", "0.66705626", "0.66464067", "0.6637...
0.7346903
2
Moves the tetromino in the given direction
def move(self, down=False, left=False, right=False): if down: self.coordinate[1] += 1 if left: self.coordinate[0] -= 1 if right: self.coordinate[0] += 1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self, direction):\n pass", "def move(self, direction):\n # replace with your code\n pass", "def move(self, direction):\n # replace with your code\n pass", "def move(self, direction):\r\n self.stored_direction = direction", "def move(self, direction, cycles...
[ "0.75184554", "0.721334", "0.721334", "0.71937394", "0.69057107", "0.68894845", "0.6826645", "0.6798342", "0.6787107", "0.6783627", "0.67751926", "0.67722917", "0.676465", "0.67043746", "0.6697022", "0.66434586", "0.6640295", "0.66062504", "0.6598739", "0.65892506", "0.655517...
0.6284004
39
Gets all coordinates of every block of the tetromino
def get_all_coordinates(self): coordinates = [] for relative_coordinate in self.shape: co = [self.coordinate[0] + relative_coordinate[0], self.coordinate[1] + relative_coordinate[1]] coordinates.append(co) return coordinates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block_coords(self):\n ## Create list to store coordinates in\n block_coords = []\n\n ## Loop through rel coords of each block element\n for x, y in self.block_elements:\n \n ## Calculate new coordinates based of rotation\n if self.rotate == 1:\n ...
[ "0.70269287", "0.6747942", "0.6534447", "0.6477485", "0.6469486", "0.6398605", "0.6367172", "0.6330839", "0.62647754", "0.6236041", "0.6225642", "0.6222044", "0.6191737", "0.6187245", "0.61803955", "0.61800015", "0.61642903", "0.6134628", "0.61178136", "0.61087054", "0.609816...
0.6641297
2
Draws the tetromino on screen with the given size of one block
def draw(self, screen, size_block): for co in self.get_all_coordinates(): pos = self.board.coordinate_to_position(co) screen.blit(pygame.transform.scale(self.image, (size_block, size_block)), pos)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_block(position, color):\n x = position.col*DX+DX+2\n y = position.row*DY+DY+2\n width = DX-4\n height = DY-4\n pygame.draw.rect(screen, color, (x,y,width,height), 0)", "def draw_t(self):\r\n pen.forward(20)\r\n pen.left(90)\r\n pen.down()\r\n pen.forward(40)\r\...
[ "0.6730433", "0.664555", "0.6513848", "0.6497331", "0.6483195", "0.645657", "0.6445222", "0.64065385", "0.63871247", "0.6328781", "0.63229257", "0.62838465", "0.6246731", "0.6245732", "0.6236885", "0.6236651", "0.60426277", "0.60426277", "0.6032478", "0.60321236", "0.6006253"...
0.64454854
6
At this moment `name` bound to the group of "positive events" defined in config (i.e. "settings_yaml.yaml"). But in future implementation the naming principle could be changed.
def train_model(self, name): if self.data_provider.get_events_count > 10: logging.debug("Start training model") events = self.data_provider.get_events() df = self.data_provider.events_to_dataframe(events) logging.info('Started parsing configs: {}'.format(df.shape...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_name(self, event_name):\n self['event_name'] = event_name", "def configName(name):\n s.setConfigName(name)", "def name(self, name):\n pass", "def name(self):\n return self.config[\"name\"]", "def _getConfigName(self):\n pass", "def set_sysmon_events(self, event_na...
[ "0.6007125", "0.5761646", "0.5601685", "0.56003094", "0.5599171", "0.5488947", "0.5475686", "0.53462094", "0.53240913", "0.53206116", "0.53188646", "0.5305123", "0.53017944", "0.52758616", "0.5275524", "0.52629584", "0.52628016", "0.5255684", "0.5232966", "0.5196814", "0.5167...
0.0
-1
Returns the casing of a word
def get_casing(word): if len(word) == 0: return "other" elif word.isdigit(): # Is a digit return "numeric" elif word.islower(): # All lower case return "allLower" elif word.isupper(): # All upper case return "allUpper" # is a tit...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCasing(word):\n casing = 'other'\n \n numDigits = 0\n for char in word:\n if char.isdigit():\n numDigits += 1\n \n digitFraction = numDigits / float(len(word))\n \n if word.isdigit(): #Is a digit\n casing = 'numeric'\n elif digitFraction > 0.5:\n ...
[ "0.77150095", "0.7627981", "0.75995153", "0.7345379", "0.70581454", "0.70581454", "0.70366627", "0.70266676", "0.6998077", "0.6934372", "0.68606347", "0.68557906", "0.68520325", "0.6814516", "0.680668", "0.67812794", "0.678011", "0.67116076", "0.67093617", "0.67058736", "0.66...
0.8539075
0
Checks the sanity of the sentence. If the sentence is for example all uppercase, it is rejected
def check_sentence_sanity(self, sentence): case_dist = nltk.FreqDist() for token in sentence: case_dist[self.get_casing(token)] += 1 if case_dist.most_common(1)[0][0] != "allLower": return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sentence_input(self, sentence):\n if len(sentence.strip()) == 0:\n return False\n # Decode unicode, mainly to normalize fancy quotation marks\n decoded = unidecode(sentence)\n # Sentence shouldn't contain problematic characters\n if self.well_formed and self.r...
[ "0.72757673", "0.6896224", "0.66803765", "0.6666935", "0.6642678", "0.65529424", "0.65316814", "0.6467364", "0.64504784", "0.64176303", "0.6370217", "0.63567257", "0.6353151", "0.6348308", "0.6311175", "0.62783295", "0.6248707", "0.6111707", "0.61105114", "0.6082513", "0.6035...
0.75520724
0
return a logger that prints to the screen if it's interactive and a file if not
def get_logger(name='some script'): #timestamp for filename timestamp = datetime.now().strftime('%Y-%m-%d') logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) #custom formatter formatter = logging.Formatter( '%(asctime)s %(name)s %(levelname)s %(filename)s ' '%(f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_main_logger():\n\n # Use verbose debug logging for now.\n console_loglevel = VERBOSITY_LEVELS[2]\n file_loglevel = VERBOSITY_LEVELS[2]\n\n console_fmt = logging.Formatter(\n '%(name)s: %(levelname)s %(message)s')\n file_fmt = logging.Formatter(\n '%(asctime)s - %(name)s: %(leve...
[ "0.60888046", "0.60173994", "0.5929699", "0.58889014", "0.5855779", "0.5853313", "0.5852736", "0.5819368", "0.5804063", "0.5800967", "0.5776022", "0.57705855", "0.57650095", "0.5753275", "0.5744197", "0.5717597", "0.57117486", "0.5706986", "0.5679158", "0.56692344", "0.566720...
0.6818312
0
Helper method; It converts a python string to Base64 (using utf8)
def _encode_partitial_parameter(data): return base64.b64encode(data.encode("utf-8")).decode()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_to_base64(str):\n str_bytes = str.encode(\"utf-8\")\n str_bytes_base64 = base64.b64encode(str_bytes)\n str_base64 = str_bytes_base64.decode(\"utf-8\")\n return str_base64", "def my_base64encode(s):\n return base64.b64encode(s).decode(\"utf-8\")", "def _encode_base64(data: str) -> str...
[ "0.8389969", "0.8057397", "0.78310317", "0.7827948", "0.7767125", "0.7755934", "0.7712392", "0.76610965", "0.76608723", "0.76020265", "0.7411061", "0.740894", "0.7408367", "0.74067724", "0.74067724", "0.73230964", "0.7314781", "0.72995573", "0.72735476", "0.71804476", "0.7170...
0.0
-1
Embedds a Partitial without initiial loading, or updates
def direct_partitial(context, selector, **kwargs): data = __("selector at template not defined in view error message", "Sorry unable to get Element to display Data") if "partitial" not in context: raise PartitialNotFound("No Partitials defined") if selector in context["partitial"]: data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embed():", "def _embed(slug):\n context = get_factcheck_context();\n context['slug'] = slug\n contents = context['contents']\n annotations = [post for post in contents if post['type'] == 'annotation' and post['published'] == 'yes']\n filtered = [post for post in annotations if post['slug'] == ...
[ "0.66283685", "0.6207319", "0.618819", "0.5957484", "0.5544892", "0.55282795", "0.5496768", "0.53691417", "0.52928776", "0.52521026", "0.52320933", "0.52225244", "0.5213902", "0.51485777", "0.51114625", "0.5105177", "0.5098499", "0.5066612", "0.50501794", "0.5033288", "0.5021...
0.51954544
13
This view should return a list of all the Posting for the currently authenticated user.
def get_queryset(self): #print("request", self.request) user = self.request.user return Experience.objects.filter(person=user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_posts(self):\n return Post.select().where (Post.user == self)", "def get_queryset(self):\r\n\r\n user = get_object_or_404(User, username=self.kwargs.get('username'))\r\n return Post.objects.filter(author=user).order_by('-date_posted')", "def get_queryset(self):\n return Post...
[ "0.76364285", "0.7276207", "0.7069362", "0.69786215", "0.69439435", "0.69179547", "0.6832055", "0.67505515", "0.6747695", "0.6714803", "0.6682357", "0.6659434", "0.6610183", "0.66069597", "0.6564537", "0.65382445", "0.65202713", "0.65202713", "0.650429", "0.6504121", "0.64706...
0.0
-1
Tests the return of `__virtual__` function
def test_virtual(self): self.assertEqual(containerd.__virtual__(), "containerd")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __virtual__():\n return True", "def __virtual__():\n return True", "def is_virtual_method(self):\r\n return conf.lib.clang_CXXMethod_isVirtual(self)", "def __virtual__():\n if get_configured_provider() is False:\n return False\n\n if get_dependencies() is False:\n return ...
[ "0.743135", "0.743135", "0.6307949", "0.6301381", "0.6288245", "0.62270534", "0.61580956", "0.6037573", "0.6030253", "0.60108423", "0.599295", "0.5986602", "0.5950467", "0.59479356", "0.5926023", "0.5900328", "0.5807527", "0.58043253", "0.57900876", "0.5771885", "0.57596844",...
0.71836746
2
Tests the return of `load_cri_image` function
def test_load_cri_image(self, path): cmd = utils.cmd_output( stderr='time="2020-07-02T08:02:46Z" ' 'level=debug msg="unpacking 1 images"', stdout="unpacking k8s.gcr.io/my-image:3.1 (sha256:3efe4ff64c93123e" "1217b0ad6d23b4c87a1fc2109afeff55d2f27d70c55d8f73)...done...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_read_image(self):\n pass", "def test_CreateROI1(self):\r\n\r\n self.delayDisplay(\"Starting the test\")\r\n #\r\n # first, get some data\r\n #\r\n import urllib\r\n downloads = (\r\n ('http://slicer.kitware.com/midas3/download?items=5767', 'FA.nrrd', slicer.util.loadVolum...
[ "0.69967496", "0.6590686", "0.65902233", "0.6497048", "0.6327282", "0.6300939", "0.62152237", "0.62148", "0.62034553", "0.61346054", "0.6108102", "0.6102628", "0.6064511", "0.60624236", "0.60367256", "0.60231346", "0.60110754", "0.59880245", "0.5982799", "0.59773093", "0.5951...
0.8183807
0
Gives full list of users
def user_list(request): if request.method == 'GET': user_info = UserData.objects.all() serializer = UserProfileSerializer(user_info, many=True) return JSONResponse(serializer.data) else: return JSONResponse('Using wrong api.', status=404)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_users():", "def user_list(ctx):\n data = ctx.obj.get_all_users()\n output_json_data(data)", "def list_users(self):\n raise NotImplementedError", "def list_users():\n check_admin()\n results = User.query.order_by(-User.id)\n return render_template('user_list.html', users=resu...
[ "0.87828565", "0.857862", "0.8309675", "0.8255022", "0.82229847", "0.82012045", "0.8174902", "0.81455934", "0.81301534", "0.812645", "0.81152916", "0.8111818", "0.8095608", "0.80905443", "0.80861485", "0.80800664", "0.80800664", "0.80800664", "0.80800664", "0.80800664", "0.80...
0.0
-1
Retrieve, update or delete a code snippet.
def user_detail(request, pk): try: user_ = UserData.objects.get(pk=pk) print (user_) except user_.DoesNotExist: return HttpResponse(status=404) if request.method == 'GET': serializer = UserProfileSerializer(user_) return JSONResponse(serializer.data) elif reques...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snippet_detail(request, pk):\n try:\n snippet = Snippet.objects.get(pk=pk)\n except Snippet.DoesNotExist:\n return Response(status=status.HTTP_404_NOT_FOUND)\n\n if request.method == 'GET':\n serializer = SnippetSerializer(snippet)\n return Response(serializer.data)\n\n ...
[ "0.6433456", "0.6433456", "0.6343488", "0.62826616", "0.6222594", "0.6008561", "0.5910034", "0.5902556", "0.5866052", "0.58183044", "0.58100134", "0.5747753", "0.57476574", "0.57111764", "0.5676638", "0.5585475", "0.5561278", "0.54968476", "0.54310095", "0.5384304", "0.531098...
0.0
-1
Run main script for running usage examples of oop bank management system.
def simple_banking_management_oop(): bank = Bank('My_bank') # Initiate bank # Create users, choose between private and company, return user directly if needed ricky = bank.register_user('private', 'Ricky', 'Wysocki', 222222) bank.register_user('company', 'E_will_inc', 666666) bank.register_user('p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_script(self) -> None:\n main()", "def main():\n run_test_all()", "def main():\n subcommands = {\n \"train\": train.train,\n \"tune\": train_tune.train,\n \"predict\": predict.cli_predict,\n \"evaluate\": evaluate.cli_evaluate,\n \"version\": version,\n ...
[ "0.7118854", "0.7015572", "0.69641906", "0.694683", "0.6810904", "0.68077016", "0.6798183", "0.678402", "0.67734224", "0.676862", "0.67376447", "0.67187804", "0.6693901", "0.6651322", "0.6651248", "0.6629834", "0.6620381", "0.66107005", "0.6601279", "0.66009575", "0.66003424"...
0.0
-1
Run main script for running usage examples of functional bank management system.
def simple_banking_management_functional(): create_user('private', **USERS['Andreas']) create_user('company', **USERS['carrot_inc']) result = search_private_user('Andreas', 'Gustafsson') result_2 = search_company_user('carrot') register_account('savings', USERS['Andreas']['id_nr']) register_ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_script(self) -> None:\n main()", "def main():\n subcommands = {\n \"train\": train.train,\n \"tune\": train_tune.train,\n \"predict\": predict.cli_predict,\n \"evaluate\": evaluate.cli_evaluate,\n \"version\": version,\n }\n\n try:\n import xarra...
[ "0.74007034", "0.72510475", "0.72342753", "0.7057424", "0.6932121", "0.68748486", "0.68650436", "0.68547904", "0.68173623", "0.681692", "0.6806443", "0.67829275", "0.6768481", "0.6758717", "0.6732231", "0.672012", "0.6716059", "0.6714295", "0.6706323", "0.6684578", "0.6660309...
0.0
-1
Evaluate predicted target values for X relative to y_true.
def __call__(self, estimator, X, y_true, sample_weight=None, offsets=None): return self._score( partial(_cached_call, None), estimator, X, y_true, sample_weight=sample_weight, offsets=offsets )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate(self, y_true, y_pred):\n pass", "def eval(y_pred, y_true):\n return torch.mean((torch.argmax(y_pred, dim=1) == y_true).float())", "def __call__(self, y_true: np.ndarray, y_pred: np.ndarray) -> float:", "def score(self, y_true, y_pred):\r\n pass", "def evaluate(self):\n ...
[ "0.79254335", "0.7540403", "0.7483366", "0.7202576", "0.711361", "0.7073816", "0.7023629", "0.6981823", "0.68864375", "0.68682206", "0.6821785", "0.6793407", "0.67515427", "0.67452955", "0.67347604", "0.6717862", "0.6714996", "0.6702411", "0.66589254", "0.6625839", "0.6618985...
0.0
-1
Evaluate predicted target values for X relative to y_true.
def _score(self, method_caller, estimator, X, y_true, sample_weight=None, offsets=None): if offsets is not None: assert check_accepts_offsets(estimator.predict) y_pred = method_caller(estimator, "predict", X=X, offsets=offsets) else: y_pred = method_ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate(self, y_true, y_pred):\n pass", "def eval(y_pred, y_true):\n return torch.mean((torch.argmax(y_pred, dim=1) == y_true).float())", "def __call__(self, y_true: np.ndarray, y_pred: np.ndarray) -> float:", "def score(self, y_true, y_pred):\r\n pass", "def evaluate(self):\n ...
[ "0.7926719", "0.7540681", "0.7483446", "0.72028357", "0.71124786", "0.70752966", "0.7024636", "0.69827354", "0.68863964", "0.6867903", "0.6822651", "0.67943895", "0.6750956", "0.6745403", "0.6733662", "0.67168826", "0.6715787", "0.6702082", "0.66582286", "0.6625811", "0.66188...
0.0
-1
Evaluate predicted probabilities for X relative to y_true.
def _score(self, method_caller, clf, X, y, sample_weight=None, offsets=None): if offsets is not None: assert check_accepts_offsets(clf.predict_proba) y_pred = method_caller(clf, "predict_proba", X=X, offsets=offsets) else: y_pred = method_caller(clf, "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate(self, y_true, y_pred):\n pass", "def eval(y_pred, y_true):\n return torch.mean((torch.argmax(y_pred, dim=1) == y_true).float())", "def __call__(self, y_true: np.ndarray, y_pred: np.ndarray) -> float:", "def precision_score(y_true, y_pred):\n return ((y_true == 1) * (y_pred == 1)).s...
[ "0.7751502", "0.7422736", "0.72359395", "0.719578", "0.71556616", "0.7150211", "0.71005857", "0.70785266", "0.69823", "0.69728625", "0.6960776", "0.69178027", "0.6908371", "0.69034386", "0.68494487", "0.6835456", "0.6827891", "0.68223083", "0.68122584", "0.67999685", "0.67967...
0.0
-1
Evaluate decision function output for X relative to y_true.
def _score(self, method_caller, clf, X, y, sample_weight=None, offsets=None): y_type = type_of_target(y) if y_type not in ("binary", "multilabel-indicator"): raise ValueError("{0} format is not supported".format(y_type)) if is_regressor(clf): if offsets ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _evaluate(self, y_true, y_pred):\n pass", "def __call__(self, y_true: np.ndarray, y_pred: np.ndarray) -> float:", "def decision_function(self, X):\n y = self.__cls.decision_function(X)\n return y", "def evaluate(tag, x, y_true):\n y_pred = model(x, is_training=False)\n\n accura...
[ "0.78084064", "0.7493824", "0.7323878", "0.71945673", "0.7180778", "0.71042687", "0.7060395", "0.69529766", "0.6877816", "0.6865516", "0.6852216", "0.6846135", "0.6768673", "0.6759729", "0.6759208", "0.6758773", "0.67231613", "0.67215425", "0.66968197", "0.667077", "0.6653818...
0.0
-1
Get a scorer from string.
def get_scorer(scoring): if isinstance(scoring, str): try: scorer = SCORERS[scoring] except KeyError: raise ValueError( "%r is not a valid scoring value. " "Use sorted(sklearn.metrics.SCORERS.keys()) " "to get valid options." % ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scorer(scoring, compute=True):\n # This is the same as sklearns, only we use our SCORERS dict,\n # and don't have back-compat code\n if isinstance(scoring, six.string_types):\n try:\n scorer = SCORERS[scoring]\n except KeyError:\n raise ValueError('{} is not a v...
[ "0.7410293", "0.6213774", "0.6117247", "0.5969417", "0.59498906", "0.5834008", "0.57948613", "0.57125705", "0.5691819", "0.5677424", "0.5553856", "0.5519682", "0.5454422", "0.5444198", "0.53747046", "0.5372519", "0.5332151", "0.53248066", "0.52808905", "0.5260689", "0.5242217...
0.7338515
1
Make a scorer from a performance metric or loss function. This factory function wraps scoring functions for use in
def make_scorer( score_func, *, greater_is_better=True, needs_proba=False, needs_threshold=False, **kwargs, ): sign = 1 if greater_is_better else -1 if needs_proba and needs_threshold: raise ValueError( "Set either needs_proba or needs_threshold to True, but not both....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_scorer(scoring, compute=True):\n # This is the same as sklearns, only we use our SCORERS dict,\n # and don't have back-compat code\n if isinstance(scoring, six.string_types):\n try:\n scorer = SCORERS[scoring]\n except KeyError:\n raise ValueError('{} is not a v...
[ "0.68151456", "0.65854603", "0.65313846", "0.6162087", "0.6153191", "0.61268836", "0.6123337", "0.6015906", "0.586069", "0.58467746", "0.5845448", "0.5719968", "0.5628305", "0.5599996", "0.5546353", "0.54967225", "0.5482464", "0.54398274", "0.543661", "0.5424008", "0.54104716...
0.78375727
0
Event of submit button
def submit_command(): global amount_point_var, amount_relationship_var, data, list_position, canvas, \ list_point, label_frame_matrix_relationship, list_label_distance, list_best_label_distance, label_text_result """Delete old data from screen""" if len(list_elements_matrix) != 0: """Delete ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_submit(self, request: http.Request):\n self._on_form_submit(request)", "def _resubmit_button_fired(self):\n self.resubmit()", "def submit(self):\n self.driver.find_element(*BaseLocators.SUBMIT_BUTTON).click()", "def set_submit_event(self, onsubmit):\n self._onsubmit = ons...
[ "0.6977783", "0.69723505", "0.692153", "0.6906102", "0.6870872", "0.67922825", "0.6780209", "0.6702129", "0.65223724", "0.6422919", "0.63936025", "0.61794597", "0.61497706", "0.6100532", "0.60977656", "0.6091912", "0.6091912", "0.6063564", "0.5982731", "0.5947766", "0.5935841...
0.0
-1
Event of choose point button Handling to make sure user choose 2 point to find best line After choose 2 points, fine best line and draw it on canvas
def choose_point_command(a): global canvas, best_line, list_best_label_distance, label_text_result if choose_point[0] != a and choose_point[1] != a: # if a was not be choose if choose_point[0] == -1 and choose_point[1] == -1: choose_point[0] = a list_point[a].configure(bg=point_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onClick(self, event):\n if event.inaxes:\n if event.button == 3:\n if len(self.baslin) < 2:\n # Cannot delete if there less than 2 points\n return\n elif event.button != 1:\n return\n else:\n retu...
[ "0.644487", "0.6414169", "0.63994014", "0.6279453", "0.6074503", "0.6039465", "0.5936192", "0.5895433", "0.58924294", "0.5869574", "0.58490586", "0.584594", "0.584594", "0.58347243", "0.58235395", "0.58041525", "0.5790136", "0.57632446", "0.57615465", "0.5746828", "0.5745401"...
0.73080593
0
Event of off_all_line button Function to show or hide all lines off all points (keep hose best line with 2 point)
def hide_all_line(): global canvas, button_off_all_line, best_line, button_off_best_line if button_off_all_line['text'] == "Hide all line": # If current status is show and want to hide canvas.delete("all_line_tag") # Delete all lines from canvas ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_all_bestline():\n global canvas, button_off_best_line, best_line\n if best_line is not None:\n if button_off_best_line['text'] == \"Hide best line\": # If current status is show and want to hide\n canvas.delete(\"best_line_tag\") ...
[ "0.7622647", "0.68477213", "0.65928304", "0.658819", "0.6270692", "0.62433136", "0.6175596", "0.61608386", "0.5985505", "0.5888555", "0.58602905", "0.58566725", "0.5833649", "0.5795332", "0.5786222", "0.575878", "0.57369995", "0.5720687", "0.5713423", "0.57112813", "0.5651486...
0.81036454
0
Event of off_best_line button Function to show or hide best lines of 2 points
def hide_all_bestline(): global canvas, button_off_best_line, best_line if best_line is not None: if button_off_best_line['text'] == "Hide best line": # If current status is show and want to hide canvas.delete("best_line_tag") # Delete best...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_best_distance():\n global canvas, list_label_distance, data, list_position, list_best_label_distance\n if len(list_best_label_distance) != 0:\n if button_off_best_label_distance['text'] == \"Hide best distance\": # If current status is show and want to hide\n for i in range(len(li...
[ "0.6818651", "0.66486394", "0.60474133", "0.604604", "0.59081006", "0.5839253", "0.5635505", "0.56088", "0.5502675", "0.54919034", "0.5474902", "0.5400621", "0.5398919", "0.5303749", "0.527624", "0.5274308", "0.52618957", "0.52533096", "0.5252591", "0.52440584", "0.5228172", ...
0.77532905
0
Event of button_off_all_label_distance button Function to show or hide all distance value
def hide_all_distance(): global canvas, button_off_all_label_distance, list_label_distance, data, list_position, \ list_best_label_distance, button_off_best_label_distance if button_off_all_label_distance['text'] == "Hide all distance": # If current status is show and want to hide for i in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_best_distance():\n global canvas, list_label_distance, data, list_position, list_best_label_distance\n if len(list_best_label_distance) != 0:\n if button_off_best_label_distance['text'] == \"Hide best distance\": # If current status is show and want to hide\n for i in range(len(li...
[ "0.75043434", "0.59171087", "0.5838485", "0.5706002", "0.56357735", "0.5474313", "0.545505", "0.5445648", "0.5394187", "0.53430897", "0.5258339", "0.5220189", "0.5196048", "0.51593065", "0.51419675", "0.5132579", "0.5116383", "0.5098416", "0.50940084", "0.50889766", "0.507515...
0.8398894
0
Event of off_best_distance button Function to show or hide best distance of dijkstra
def hide_best_distance(): global canvas, list_label_distance, data, list_position, list_best_label_distance if len(list_best_label_distance) != 0: if button_off_best_label_distance['text'] == "Hide best distance": # If current status is show and want to hide for i in range(len(list_best_lab...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_all_distance():\n global canvas, button_off_all_label_distance, list_label_distance, data, list_position, \\\n list_best_label_distance, button_off_best_label_distance\n if button_off_all_label_distance['text'] == \"Hide all distance\": # If current status is show and want to hide\n ...
[ "0.6756336", "0.6017361", "0.5828534", "0.5650388", "0.55981857", "0.55409235", "0.5525183", "0.5472911", "0.5458907", "0.524283", "0.5239041", "0.5234307", "0.52263236", "0.51862323", "0.5134129", "0.51089394", "0.51026577", "0.50943565", "0.5082267", "0.5062372", "0.5059855...
0.7727631
0
Use the `msmd` tool to identify the individual SPW ID numbers for a common baseband and spectral window pair, which should always be consistent between the 12m & 7m MSs, as setup by the OT.
def get_spw_from_name(vis, spw=None): msmd.open(vis) labels = msmd.namesforspws() if spw is None: ot_name = '#BB_4#SW-01' if type(spw) is str: ot_name = spw else: ot_name = spw.ot_name ot_name = ot_name + '#FULL_RES' spws = ','.join([ str(i) for i,s in enumera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def msid(self):\n return self.msids[0]", "def get_spw_id(self, spw):\n spw_ids = []\n for vis in self.vis:\n msmd.open(vis)\n labels = msmd.namesforspws()\n obs_spws = msmd.spwsforintent('OBSERVE_TARGET#ON_SOURCE')\n id_str = ','.join([\n ...
[ "0.60724604", "0.5911711", "0.5634371", "0.54764205", "0.5465989", "0.54030174", "0.5358231", "0.5350375", "0.5244999", "0.5191615", "0.51499647", "0.5144052", "0.50523376", "0.49507278", "0.49175915", "0.4904271", "0.49021316", "0.48907432", "0.48903045", "0.4868042", "0.485...
0.5467314
4
Check for and remove (if they exist) files created by clean such as '.flux', '.image', etc.
def check_delete_image_files(imagename, preserve_mask=False): print(':: Check for and remove existing files') exts = [ '.flux', '.pb', '.image', '.weight', '.model', '.pbcor', '.psf', '.sumwt', '.residual', '.flux.pbcoverage' ] if not preserve_mask: exts += ['.mask'] for ext ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean():\n clean_files()", "def clean_data():\n for clean_file in clean_files:\n file_list = [f for f in os.listdir(\".\") if f.endswith(clean_file)]\n for f in file_list:\n os.remove(f)", "def _clean_workdir(self):\n\t\ttoremove = [self._get_config_filepath(), self._get_para...
[ "0.80557466", "0.77625537", "0.7661359", "0.76540726", "0.7619263", "0.7616365", "0.76152307", "0.7600073", "0.7457803", "0.7456741", "0.7451228", "0.74188185", "0.74021995", "0.73550963", "0.73337966", "0.72935754", "0.7285965", "0.728489", "0.7283844", "0.7281332", "0.72612...
0.0
-1
Image the continuum using only the single continuum TDM spectral window, or the linefree channels.
def clean_continuum(imc, linefree=False, remove_existing=True, export=False): if linefree: vis = imc.vislf spw = '' imagename = imc.path_base else: vis = imc.vis spw = imc.get_cont_spw() imagename = imc.path_base +'_single' if remove_existing: check_de...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_continuum(self, refresh=False):\n\n try:\n index = self.current_order_index\n except AttributeError:\n return None\n\n meta = self.parent.session.metadata[\"normalization\"]\n continuum = meta[\"continuum\"][index]\n kwds = meta[\"normalization_kwar...
[ "0.5239789", "0.52032614", "0.5161228", "0.5058049", "0.5052641", "0.5048927", "0.5047654", "0.5028256", "0.50035876", "0.5001316", "0.500073", "0.49987286", "0.49860814", "0.49765074", "0.4948414", "0.49153182", "0.49145216", "0.49112833", "0.4899455", "0.48870373", "0.48785...
0.45338288
84
Split out the linefree continuum channels from the measurement set and apply channel averaging (for the higher resolution line channels). The flags are backed up, line channels flagged, measurement set split, and the flag state restored. It should be OK to initialize the weight each time, since when found will noop.
def split_linefree(imc): now = str(datetime.datetime.utcnow()) comment = 'Flags before split for line-free (UTC: {0})'.format(now) print(':: Saving flag backup : `before_split`') flagmanager(vis=imc.vis, mode='save', versionname='before_split', comment=comment) initweights(vis=imc.vi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineDetectThread(self):\n \n while True:\n\n tmpList = self.octo.analog_read_all()\n avg = 0\n for x in tmpList:\n avg = avg + x\n\n avg = avg / len(tmpList)\n\n if avg <= self.cutoff:\n if not self.seenLine: # f...
[ "0.48285812", "0.48112413", "0.4758139", "0.47020394", "0.469053", "0.46687457", "0.46044582", "0.45869437", "0.45790747", "0.4564418", "0.45641688", "0.45589712", "0.44781768", "0.44485095", "0.44375643", "0.44301227", "0.4421234", "0.44173494", "0.4417143", "0.44007793", "0...
0.5999584
0
Self Calibration. Initiate the selfcalibration process with a shallow clean to start. Here clean only the secure detections of emission.
def selfcal_image(imc, trial='0'): if trial == '0': mask = '' else: mask = imc.path_base + '_p{0}.mask'.format(int(trial)-1) vis = imc.vislf imagename = imc.path_base + '_p{0}'.format(trial) check_delete_image_files(imagename) tclean(vis=vis, imagename=imagename, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rm_calibration(self):\n\n self.bin_edges_kev = None", "def _doCalibration(self):\n self._cmdCalibration(2)", "def reset(self):\n self.resetPos()\n self.vx, self.vy = 0, 0\n self.accel, self.dangle = 0, 0\n self.crashed = False\n self.timeDriving, self.score...
[ "0.629341", "0.60715276", "0.6038059", "0.5894017", "0.5803302", "0.5768634", "0.5759604", "0.5733961", "0.57175505", "0.57133883", "0.56535786", "0.56385595", "0.55656916", "0.555237", "0.5471464", "0.5434825", "0.54325277", "0.54210687", "0.54147273", "0.5398735", "0.538167...
0.57821494
5
Self Calibration. Generate a per observation solution first.
def selfcal_pcal(imc, combine='spw,scan', trial='1'): if trial == '1': solint = 'inf' # Sum entire scheduling block elif trial == '2': solint = '1800s' # Half block else: raise ValueError('Invalid pcal trial: {0}'.format(trial)) caltable = imc.path_base + '.pcal' + trial rm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doCalibration(self):\n self._cmdCalibration(2)", "def fit_once(self,random_restart=True):\n \n if random_restart:\n ## Main mode of operation\n \n # Initializations\n n_iterations = int(np.ceil(np.log2(self.K))) # log_2(K) iterations\n ...
[ "0.61429644", "0.61369985", "0.6008194", "0.58990324", "0.58952606", "0.58914626", "0.58276385", "0.5809843", "0.58021075", "0.5751495", "0.57445574", "0.5744396", "0.5744055", "0.57362515", "0.57333183", "0.56920046", "0.5677356", "0.56640816", "0.5659343", "0.5646199", "0.5...
0.0
-1
Self Calibration. Check the solution
def selfcal_pcal_plot(imc, trial='1'): plotcal(caltable=imc.path_base+'.pcal'+trial, xaxis='time', yaxis='phase', timerange='', iteration='', subplot=111, plotrange=[0,0,-180,180])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calibration(self) -> int:", "def _doCalibration(self):\n self._cmdCalibration(2)", "def convergence_check(self):\n air = self.air_alias.val\n flue_gas = self.fuel_alias.val + '_fg'\n fuel = self.fuel_alias.val\n\n for c in self.outl:\n if not c.fluid.val_set[ai...
[ "0.7105522", "0.6993151", "0.66071844", "0.6589474", "0.6569091", "0.652657", "0.64698505", "0.6425824", "0.64135945", "0.63717103", "0.63714695", "0.6335183", "0.6329859", "0.62983537", "0.62881285", "0.62694263", "0.62132275", "0.6187541", "0.6185712", "0.6161007", "0.61610...
0.0
-1
Self Calibration. Apply the calibration from the phase only solution
def selfcal_apcal(imc, trial='1'): flagmanager(imc.vislf, mode='restore', versionname='startup') applycal(vis=imc.vislf, spwmap=np.zeros(54), interp='linearPDperobs', gaintable=[imc.path_base+'.pcal'+trial], calwt=False, flagbackup=False)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _doCalibration(self):\n self._cmdCalibration(2)", "def photometric_calibration():\n pass", "def calibration(self) -> int:", "def calibration_wheel(self):\n self.spectrum = self.spectrum", "def calibration(self, cal: int, /) -> None:", "def calibrate(self, master):\n if mas...
[ "0.67444855", "0.64102155", "0.62887526", "0.62739146", "0.62539726", "0.61133844", "0.6096612", "0.6041767", "0.5968712", "0.5952701", "0.59089845", "0.58992106", "0.58605576", "0.5847041", "0.5796397", "0.57910454", "0.57832146", "0.5780262", "0.57560104", "0.5751728", "0.5...
0.5608362
27
Use `tclean` to CLEAN a spectral cube. Additional keyword arguements are passed to `tclean`.
def clean_line(imc, spw, contsub=False, fullcube=False, interactive=True, export=False, use_existing_psf=False, automask=False, **kwargs): vis = imc.viscs if contsub else imc.vis imagename = '{0}_{1}'.format(imc.path_base, spw.name) tclean_kwargs = { 'interactive': interactive, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(args):\n with_dataset(args, Dataset._clean)", "def test_clean_line_target(cfg, spw, ext=None, iterzero=False, fullcube=False,\n parallel=False):\n imagename = cfg.get_basename(spw, ext=ext)\n spw_id = cfg.get_spw_id(spw)\n log_post(':: Running clean for {0}'.format(imagename))\n n...
[ "0.6328925", "0.5590112", "0.55339396", "0.5511219", "0.5465729", "0.5374298", "0.5327649", "0.528877", "0.526185", "0.5248659", "0.5220694", "0.52137625", "0.5190913", "0.5170219", "0.51530504", "0.5150577", "0.5133238", "0.5131207", "0.51212543", "0.5066113", "0.5057564", ...
0.539494
5
A utility function that converts an attribute name string into the corresponding attribute tag.
def convert_attribute_name_to_tag(value): if not isinstance(value, six.string_types): raise ValueError("The attribute name must be a string.") for entry in attribute_name_tag_table: if value == entry[0]: return entry[1] raise ValueError("Unrecognized attribute name: '{}'".forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_attribute_tag_to_name(value):\n if not isinstance(value, Tags):\n raise ValueError(\"The attribute tag must be a Tags enumeration.\")\n\n for entry in attribute_name_tag_table:\n if value == entry[1]:\n return entry[0]\n\n raise ValueError(\"Unrecognized attribute tag:...
[ "0.74248964", "0.71455866", "0.6820382", "0.6814265", "0.6467705", "0.6433419", "0.63990474", "0.6338518", "0.6189894", "0.60293674", "0.6026002", "0.6026002", "0.6018459", "0.5988461", "0.5980702", "0.59706277", "0.5942196", "0.5880535", "0.58307683", "0.58123", "0.58119905"...
0.80393004
0
A utility function that converts an attribute tag into the corresponding attribute name string.
def convert_attribute_tag_to_name(value): if not isinstance(value, Tags): raise ValueError("The attribute tag must be a Tags enumeration.") for entry in attribute_name_tag_table: if value == entry[1]: return entry[0] raise ValueError("Unrecognized attribute tag: {}".format(valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_attribute_name_to_tag(value):\n if not isinstance(value, six.string_types):\n raise ValueError(\"The attribute name must be a string.\")\n\n for entry in attribute_name_tag_table:\n if value == entry[0]:\n return entry[1]\n\n raise ValueError(\"Unrecognized attribute n...
[ "0.73351747", "0.72900105", "0.7044817", "0.700109", "0.6944922", "0.6706183", "0.66464186", "0.6546524", "0.6434635", "0.6434635", "0.6406859", "0.63961947", "0.63639677", "0.63639677", "0.6242204", "0.6229339", "0.6229339", "0.62258285", "0.6216158", "0.62033", "0.62025344"...
0.7753604
0
A utility function that computes a bit mask from a collection of enumeration values.
def get_bit_mask_from_enumerations(enumerations): return functools.reduce( lambda x, y: x | y, [z.value for z in enumerations] )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_enumerations_from_bit_mask(enumeration, mask):\n return [x for x in enumeration if (x.value & mask) == x.value]", "def parse_mask(value, mask_enum):\n masks = []\n for mask in mask_enum:\n if value & mask:\n masks.append(mask.name)\n value ^= mask\n if value:\n ...
[ "0.7744489", "0.66913533", "0.6403534", "0.61704373", "0.61267203", "0.5990406", "0.58188605", "0.5776456", "0.5742034", "0.57257146", "0.5702052", "0.5667115", "0.5648651", "0.54798436", "0.54597044", "0.54477435", "0.5405333", "0.53865755", "0.53729063", "0.53284824", "0.53...
0.8022848
0
A utility function that creates a list of enumeration values from a bit mask for a specific mask enumeration class.
def get_enumerations_from_bit_mask(enumeration, mask): return [x for x in enumeration if (x.value & mask) == x.value]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_mask(value, mask_enum):\n masks = []\n for mask in mask_enum:\n if value & mask:\n masks.append(mask.name)\n value ^= mask\n if value:\n masks.append(hex(value))\n\n return masks", "def get_bit_mask_from_enumerations(enumerations):\n return functools.r...
[ "0.69542855", "0.6844899", "0.6179964", "0.6085858", "0.60515696", "0.58843184", "0.5866593", "0.5610187", "0.5600955", "0.5540577", "0.54730654", "0.5454916", "0.5427376", "0.538644", "0.5377461", "0.5375424", "0.5373737", "0.5363888", "0.5209238", "0.5204924", "0.51944685",...
0.81864226
0
A utility function that checks if the provided value is a composite bit mask of enumeration values in the specified enumeration class.
def is_bit_mask(enumeration, potential_mask): if not isinstance(potential_mask, six.integer_types): return False mask_enumerations = ( CryptographicUsageMask, ProtectionStorageMask, StorageStatusMask ) if enumeration not in mask_enumerations: return False ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_enum_value(enumeration, potential_value):\n try:\n enumeration(potential_value)\n except ValueError:\n return False\n\n return True", "def get_enumerations_from_bit_mask(enumeration, mask):\n return [x for x in enumeration if (x.value & mask) == x.value]", "def _is_equal_to_enu...
[ "0.5870301", "0.58618695", "0.553218", "0.5408903", "0.5404764", "0.53083646", "0.5269919", "0.5266223", "0.521553", "0.51871705", "0.5102369", "0.50527793", "0.5026475", "0.49758133", "0.4956287", "0.49388525", "0.4901828", "0.48965237", "0.48832533", "0.48725867", "0.480630...
0.6198896
0
A utility function that checks if the enumeration class contains the provided value.
def is_enum_value(enumeration, potential_value): try: enumeration(potential_value) except ValueError: return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contains(cls, value):\n return value in cls.values()", "def contains(cls, value):\n return any(value == item.value for item in cls)", "def has_value(cls, value):\n return any(value == item.value for item in cls)", "def has_value(cls, value):\n return any(value == item.value fo...
[ "0.7130909", "0.6671945", "0.66446143", "0.66446143", "0.6463414", "0.64291495", "0.64076877", "0.63996106", "0.61606634", "0.613417", "0.61334", "0.6130707", "0.6110766", "0.6105736", "0.6105704", "0.60750055", "0.60390246", "0.6028632", "0.602763", "0.60264736", "0.60111135...
0.7098082
1
A utility function that checks if the tag is a valid attribute tag.
def is_attribute(tag, kmip_version=None): kmip_1_0_attribute_tags = [ Tags.UNIQUE_IDENTIFIER, Tags.NAME, Tags.OBJECT_TYPE, Tags.CRYPTOGRAPHIC_ALGORITHM, Tags.CRYPTOGRAPHIC_LENGTH, Tags.CRYPTOGRAPHIC_PARAMETERS, Tags.CRYPTOGRAPHIC_DOMAIN_PARAMETERS, Tag...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_attribute(self, attr):\n try:\n self.validate_attribute(attr)\n return True\n except etal.LabelsSchemaError:\n return False", "def is_valid_attribute(self, attr):\n try:\n self.validate_attribute(attr)\n return True\n ...
[ "0.71051097", "0.71051097", "0.68592334", "0.67489237", "0.6746817", "0.6668083", "0.6662779", "0.66370493", "0.6567249", "0.6491474", "0.64705056", "0.6454897", "0.64076465", "0.6375244", "0.6368247", "0.62872916", "0.622392", "0.61547047", "0.61213416", "0.6109168", "0.6107...
0.6629096
8
Creates a graph from saved GraphDef file and returns a saver.
def create_graph(): # Creates graph from saved graph_def.pb. with tf.gfile.FastGFile(os.path.join( '/home/ubuntu/hdd/tensorFlowDic/', 'classify_image_graph_def.pb'), 'rb') as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) _ = tf.import_graph_def(graph_def, name='')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_graph():\n # Creates graph from saved graph_def.pb.\n with tf.gfile.FastGFile(modelFullPath, 'rb') as f:\n graph_def = tf.GraphDef()\n graph_def.ParseFromString(f.read())\n _ = tf.import_graph_def(graph_def, name='')", "def create_graph():\n # Creates graph from saved graph...
[ "0.7384441", "0.7379355", "0.7351019", "0.7343615", "0.72198755", "0.71940976", "0.6887917", "0.67413443", "0.6659918", "0.65888435", "0.6583613", "0.65483147", "0.65417933", "0.65368557", "0.6521374", "0.644651", "0.6392589", "0.6357744", "0.63401663", "0.6299159", "0.628872...
0.64245
16
fonction pour instancier notre classe Chat
def __init__(self, name="", life_point=100, attack_point=25, voice="Cat-myaw", nb_of_legs=4): super().__init__(name=name, life_point=life_point, attack_point=attack_point, voice=voice, nb_of_legs=nb_of_legs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, chat: WebElement):\n super().__init__(chat.parent, chat.id)\n if not chat.get_attribute(\"class\") == \"_2aBzC\":\n raise TypeError(\"Element is not a chat\")\n self.chat = chat", "def chat(self) -> \"api.Chat\":\n raise NotImplementedError", "def creat...
[ "0.6862843", "0.67190725", "0.6709747", "0.6695545", "0.6543384", "0.6491909", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64774585", "0.64605165", "0.63651735", "...
0.0
-1
Display notification to the desktop
def notification(message: str): # initialize the notification notify2.init("notifywhenLOAD") notifyObj = notify2.Notification("Emergency Alert!", message) notifyObj.set_timeout(12000) return notifyObj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_notifications(self):\n self.android_device_driver.adb.exec_adb_cmd(\n \"shell cmd statusbar expand-notifications\").wait()", "def show_notification(self, message: str, also_cmd: bool = False):\n if platform_string == \"Linux\":\n try:\n notification = notify2.N...
[ "0.6929462", "0.66672254", "0.66309613", "0.65788645", "0.64223236", "0.6387376", "0.6368331", "0.63421816", "0.6315346", "0.6290845", "0.6279278", "0.6196264", "0.6121753", "0.6016449", "0.6004377", "0.5964229", "0.5962187", "0.5953753", "0.5938636", "0.5907336", "0.5901497"...
0.56673187
43
BuilderConfig for RuBQ 2.0.
def __init__(self, data_url, data_dir, **kwargs): super(RuBQ2Config, self).__init__(**kwargs) self.data_url = data_url self.data_dir = data_dir
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBuilder():", "def buildersConf() :\n return dict(_buildersConf)", "def getBuilder(name):", "def getBuilder(name):", "def build_configs():", "def build(config):", "def configure_bot(self, builders_dict, additional_configs=None):\n additional_configs = additional_configs or []\n\n # TODO:...
[ "0.71267474", "0.70139384", "0.6695297", "0.6695297", "0.6452325", "0.61890537", "0.58279073", "0.5709033", "0.5683073", "0.5581039", "0.5581039", "0.55700415", "0.5538782", "0.5537797", "0.55327755", "0.5504798", "0.5504798", "0.549545", "0.5481937", "0.5481937", "0.54747856...
0.0
-1
Get the specified JSON input file's contents as a dict
def get_inputs_from_file(filename=""): import json with open(filename) as input_text: json_obj = json.load(input_text) return json_obj
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file, 'rb') as f:\n return json.load(f)", "def _read_json(cls, input_file):\n with open(input_file) as f:\n return json....
[ "0.7587827", "0.7587827", "0.7569293", "0.7569293", "0.75602573", "0.753806", "0.7389315", "0.7381221", "0.73781174", "0.7354496", "0.7349716", "0.73322374", "0.73126495", "0.7310526", "0.7288044", "0.728155", "0.7277607", "0.7270094", "0.7233338", "0.7233158", "0.72300816", ...
0.7359419
9
Convention for saving the elev arrays to file.
def save_lists_to_file(filename, elev_list, dist_list): import numpy as np np.save(file=filename,arr=np.array([elev_list, dist_list]))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_enu(self, filename):\n x, y, z = self.get_coords_enu()\n coords = np.vstack([x, y, z]).T\n np.savetxt(filename, coords, fmt=b'%.12e')", "def save_iantconfig(self, filename_root):\n x, y, z = self.get_coords_enu()\n d = np.ones_like(x) # set to 1 to avoid shadowing in ...
[ "0.7392277", "0.6695063", "0.6674351", "0.644882", "0.63625616", "0.6278154", "0.6215802", "0.62093705", "0.6171282", "0.61635345", "0.610858", "0.61081475", "0.601042", "0.60060334", "0.6003838", "0.59577906", "0.59309465", "0.59160286", "0.59078306", "0.5905936", "0.5888497...
0.7149724
1
Convention for loading according to saving function above.
def get_lists_from_file(filename): import numpy as np elev_arrays = np.load(file=filename) return list(elev_arrays[0]), list(elev_arrays[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n pass", "def load(self):\n pass", "def load(self):\n pass", "def load(self):\n pass", "def load(self):", "def _load(self):\n raise NotImplementedError()", "async def load(cls, save_file, *args, **kwargs):\n raise NotImplementedError()", "def ...
[ "0.6482302", "0.6482302", "0.6482302", "0.6482302", "0.63209206", "0.62857485", "0.62781924", "0.6270234", "0.62581646", "0.62424845", "0.6232893", "0.61957574", "0.6152661", "0.6152661", "0.6097419", "0.60608494", "0.60358715", "0.602136", "0.602136", "0.60017306", "0.599765...
0.0
-1
Writing a csv file of the keywordspecified lists.
def write_output_csv(filename, **kwargs): import csv import time intermediate = kwargs.pop("intermediate", False) keys = sorted(kwargs.keys()) num_vars = len(keys) if intermediate: full_filename = filename + "_interm" else: dot_index = filename.rfind('.') if dot_in...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self, key_list, word_list):\n # Write out data\n out_data = []\n # Match filtered indexes to words\n for i in key_list.index:\n subset = word_list[word_list['key'] == i]\n # Add to aggregate list\n out_data.append(subset['word'].tolist())\n...
[ "0.7690983", "0.7156317", "0.70057595", "0.699873", "0.69436884", "0.6937405", "0.68834347", "0.6880354", "0.6851179", "0.6808864", "0.6744166", "0.6703595", "0.6695695", "0.6665467", "0.66601634", "0.66530514", "0.6650442", "0.66289073", "0.66165644", "0.6579203", "0.6561281...
0.6339406
44
Generate a bunch of input JSON files from a template and a bunch of elevation files
def generate_input_files(elevation_folder_path, template_input_file_path): import pathlib json_dict = get_inputs_from_file(template_input_file_path) path_to_match = pathlib.Path(elevation_folder_path) for heightfile in path_to_match.glob("*.npy"): dot_index = str(heightfile).rfind('.') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_main():\n for template in templates:\n main([\"-g\", template])\n\n # One at a time\n for xyz_file in example_xyz_files:\n main([template, xyz_file])\n\n # All at once\n main([template] + list(example_xyz_files))\n\n # Allow use of template in the parent...
[ "0.6439445", "0.6329011", "0.6317232", "0.6279043", "0.62260956", "0.60334027", "0.60176724", "0.60137415", "0.60113746", "0.59920955", "0.59756476", "0.5974208", "0.59657097", "0.5964929", "0.596335", "0.59502697", "0.5911967", "0.58968824", "0.5894371", "0.5880914", "0.5866...
0.80537117
0
Renames .json files for height files that have too steep gradients for driving. Due to tunnels in mountatin roads, sometimes the surface elevation at a road does not correspond to the actual road elevation. Therefore, the heightmap may be that of a road trying to climb an _actual_ mountain. This is undesired behaviour ...
def seed_out_too_steep(config_folder_path, max_gradient): import pathlib import os path_to_match = pathlib.Path(config_folder_path) for config_file in path_to_match.glob("*.json"): config_filename = str(config_file) json_config = get_inputs_from_file(config_filename) try: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renamefile(filename):\n new_data_list = []\n with open(filename, 'r') as f:\n data_list = f.read().split('\\n')\n\n print('Generating new data list..')\n for data in tqdm(data_list):\n if len(data) == 0:\n continue\n data_info = data.split(' ')\n\...
[ "0.55360186", "0.5124106", "0.5096552", "0.5074441", "0.5036425", "0.49875963", "0.49749434", "0.4938649", "0.4931775", "0.49261597", "0.48441556", "0.4823751", "0.47443646", "0.46914992", "0.46750745", "0.46672103", "0.46231896", "0.46168032", "0.45954028", "0.4571667", "0.4...
0.5183655
1