id
stringlengths
20
20
title
stringclasses
1 value
text
stringlengths
8
768k
ff5de21802a41b916cc5
def Assign_Mesh(self, Msh): # Mesh self.Msh = Msh self.norext = FacetNormal(self.Msh) # Explicit coordinates self.xv = Msh.coordinates()[:,0] self.yv = Msh.coordinates()[:,1] self.zv = Msh.coordinates()[:,2] self.Nv = self.Msh.num_vertices() ...
ff5df0b33eb92e9c79a4
def local_log_erfc(fgraph, node): if node.op != log: return False if not node.inputs[0].owner or node.inputs[0].owner.op != erfc: return False if hasattr(node.tag, "local_log_erfc_applied"): # We use that flag to don't apply the rewrite recursively # TODO FIXME: We shouldn't...
ff5e42bde1accaa7c0e9
def get_output(self, X): # re = logistic(X) re = threshold(X) return re
ff5e4d2059105b2f38c7
def connect(self) : try : assert isinstance(self.sock, socket.socket) self.sock.connect((self.server, self.port)) self.sock.setblocking(self.blocking) if not self.blocking : self._register() except AssertionError : raise NoSoc...
ff5e4f10233e6b26f4e2
def remove_child(self, id_, child_id): pass
ff5e5d845bea06693bf6
def update(self, item: Item): pass
ff5e90041d1ae96cdc86
def to_json(model): json = {} # json['fields'] = {} # json['pk'] = getattr(model, 'id') for col in model._sa_class_manager.mapper.mapped_table.columns: # json['fields'][col.name] = getattr(model, col.name) json[col.name] = getattr(model, col.name) # return dumps([json]) return json
ff5e92e794fc25653c4a
def equal_log_spacing(cls, emin, emax, nbins, unit=None): return super(EnergyBounds, cls).equal_log_spacing(emin, emax, nbins + 1, unit)
ff5ebb4a1ddeff5335e2
def save(self, *args, **kwargs): lexer = get_lexer_by_name(self.language) linenos = self.linenos and 'table' or False options = self.title and {'title': self.title} or {} formatter = HtmlFormatter( style=self.style, linenos=linenos, full=True, **options) self.highlighted = highli...
ff5edc32360a93332128
def compile_predict_request_obj(x_test_series): req_obj = {"req_id": "<POST /PREDICT REQUEST ID>"} req_obj["records"] = [{"record": test_phrase} for test_phrase in x_test_series] return req_obj
ff5f25ecffcab42cbbdf
def generate_dataset_for_mytorch_model(mytorch_model, batch_size): in_features = get_mytorch_model_input_features(mytorch_model) out_features = get_mytorch_model_output_features(mytorch_model) x = np.random.randn(batch_size, in_features) y = np.random.randint(out_features, size=(batch_size,)) return...
ff5f26e4b60ae8b4b8bd
def __len__(self): if self.root is None: return 0 return self.root.tree_length()
ff5f48150d602a348c1e
def check_all_constraints(csp) : k = csp.constraints m = csp.assigned_values for i in k: if ((i.var1 in m) and (i.var2 in m)): if i.check(m[i.var1],m[i.var2]) == False: return False return True
ff5f57cf8725b24fba27
def test_commands(host): assert True return
ff5f980eb8ac1011b34f
def run(config, results, plotdir): resultset = RESULTS_READER['PICKLE'](results) #Onur: added this BEGIN lst = resultset.dump() for l in lst: print 'PARAMETERS:\n' printTree(l[0]) print 'RESULTS:\n' printTree(l[1]) #print_lru_probability_results(lst) #print_str...
ff5fa8f65b2df55b4d07
def test_get_webhook_using_get(self): pass
ff5fb4287e356884b11a
def _grouper(iterable, n: int, fillvalue=None) -> Iterable[Tuple[Repeat]]: args = [iter(iterable)] * n return zip_longest(fillvalue=fillvalue, *args)
ff5fc6d4ee60b72d6a45
def handle_download_finished( self, message: Message[int], manager: "Processor" ) -> Response[str]: storage_location = StorageLocation.all_objects.get(pk=message.message_data) # Add files to the downloaded storage location. default_storage_location = ( storage_location.fi...
ff5fe815a38a70b42a4e
def is_reused(self, p): iv = dot11_get_iv(p) seq = dot11_get_seqnum(p) return self.iv == iv and self.seq != seq and p.time >= self.time + 1
ff5ff90775ada99406c5
def build(self): model = CatBoostClassifier( iterations=5000, learning_rate=None, random_seed=42, task_type="GPU", loss_function="Logloss", use_best_model=self.best_model, eval_metric="Logloss", name=self.name, ...
ff6015674527c97ec7bc
def getDescription(self, test): method_name, full_name = [name.strip('*') for name in test.__str__().split()] suite_name, class_name = full_name.strip('()').rsplit('.',1) case_name = class_name + '.' + method_name if self.tinc_normal_output: return case_name return '%...
ff60199f654a48367705
def disassociate_file(self, titan_file): self._associated_files.remove(titan_file) self._finalized_files = False
ff602f67e534982b23a5
def log_setup(app_name, log_path): # Logger initialisation logger = logging.getLogger(app_name) # Create console handler and set level to debug file_handler = logging.FileHandler("{}".format(log_path)) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(pathname)s - %(levelname)s - %...
ff60312ada8a16f27d22
def makeScreenedLaplacian(self, ko=1.0e9, bound = {'N':'value','S':'value','E':'value','W':'value'}): size_rows = self.cents_shape[0] size_cols = self.cents_shape[1] sze = size_rows*size_cols A = np.zeros((sze,sze)) for k, (i,j) in enumerate(self.map_ij2k_cents): ...
ff60676a065503205731
def list_images(directory): labels = os.listdir(directory) # Sort the labels so that training and validation get them in the same order labels.sort() files_and_labels = [] for label in labels: for f in os.listdir(os.path.join(directory, label)): files_and_labels.append((os.path....
ff60848185b6ab237a95
def insert_random_character(s): pos = random.randint(0, len(s)) random_character = chr(random.randrange(32, 127)) # print("Inserting", repr(random_character), "at", pos) return s[:pos] + random_character + s[pos:]
ff608c8f02c82d2a75d3
def is_message_positive(self, message): x,y = sem.call(message) return x==1
ff6099c00f0c68897f11
def post_list_instances( self, response: service.ListInstancesResponse ) -> service.ListInstancesResponse: return response
ff609a7e998d0e260007
def _build_inputs(self): self.instances_placeholder = tf.placeholder( tf.float32, shape=(None, self.dataset.feature_vector_size), name='instances_placeholder') self.labels_placeholder = tf.placeholder( tf.int32, shape=(None, ), name...
ff609ef28ba367363c1a
def setMaxTime(self, newMax, reset=True): self.MAX_TIME = newMax self.mFrameTime = self.MAX_TIME / (self.mGridSize[0] * self.mGridSize[1]) if reset: self.reset()
ff60a8c67ac706cca242
def filter_for_speech(samples, sr=sr): samples = (samples * 2**15).astype(np.int16) sound = pydub.AudioSegment( samples.tobytes(), frame_rate=sr, sample_width=samples.dtype.itemsize, channels=1 ) sound_hi = pydub.effects.high_pass_filter(sound, 85) sound_mid = ...
ff60d6681fce94f4dc0c
def max_power(self): total_power = 0 for bulb in self.bulbs: total_power += bulb.power return total_power
ff60e7765fa1af642b22
def run(): ############## # Create the environment # Flags: # verbose - set to True to display additional output from the simulation # num_dummies - discrete number of dummy agents in the environment, default is 100 # grid_size - discrete number of intersections (columns, rows), def...
ff6128378e0af5714feb
def get_cython_generated_sources(pyx_glob, exts=[".c", ".cpp", ".cc"]): cython_sources = [] for fname in glob(pyx_glob): base_fname = os.path.splitext(fname)[0] # Collect all the files ending in the extensions in # 'exts' if they match a *.pyx file name for fname_ext in exts: ...
ff6138ce628ca696cfd8
def __init__(self, *args, **kwargs): self.handlers = list(args) self._kill = False r, w = os.pipe() self._reader = open(r, "r") self._writer = open(w, "w") super().__init__(**kwargs)
ff617ad88b793057577c
def is_admin(self): return (self.admin == True)
ff6183515b7030dbdafb
def test_analyze_ignore_linter(config): FakeChecker1 = create_fake_checker( check_type=CheckType.attribute, name="name1", result="res1", text="text1", url="url1", ) FakeChecker2 = create_fake_checker( check_type=CheckType.lint, name="name2", re...
ff61930b5d51f927b33c
def mnmx_spchg(ranged,pchg,pbdate): mn, mx, ns = pchg.idxmin(),pchg.idxmax(),pchg.size return [ranged, pbdate.loc[mn],pchg.loc[mn],pbdate.loc[mx],pchg.loc[mx],ns]
ff6198bf0d15efbcfc23
def __mkcopy__(self, dst=None): os.mkdir(dst) ## I have to use make directory rather than copy them ## and consider to move only what is necessary!! commented : (2011-01-27) directories = ['sx', 'texture', 'rot', 'hist'] F = ['VPSC7','VPSC7.exe','p.exe','VPSC7.in'] ...
ff61a2acc81ec655ea8b
def getIndex(self, item): i=0 for child in self._root.ChildNodes: if child._root == item._root: return i i += 1 return -1
ff61db58b91217ec3b2b
def advance_song(self): self.current_song_index += 1 if self.current_song_index >= len(MUSIC_LIST): self.current_song_index = 0
ff61ff2fb8438e5270bf
def get_account_by_id(self, account_id): for account in self.accounts: if account.id == account_id: return account raise HuobiApiException(HuobiApiException.INPUT_ERROR, "[Input] No such account")
ff6225293f4f87f1f64c
def serialize_int32(data): return [ord(a) for a in list(struct.pack('<l', int(data)))]
ff6226e06744b15c7c0d
def upload(cls): rmtree('dist/', ignore_errors=True) # cleanup cls.run_command('clean --all sdist bdist_wheel') # setuptools 'upload' essentially has become broken # https://github.com/python/cpython/issues/89753 # https://github.com/pypa/distutils/issues/25 # using t...
ff6231728ded609211f6
def Resize( image, width, height, resample_filter): # TODO: Automatically change this to ANTIALIAS or BICUBIC depending on the size of the file return image.resize((width, height), eval("Image.%s" % resample_filter))
ff6238292b0a6ef34cbf
def show(self): self.is_enabled = True self.is_visible = True
ff625f611c44c0da691a
def process_song_file(cur, filepath): # open song file df = pd.read_json(filepath, lines=True) # insert song record song_data = list(df[['song_id', 'title', 'artist_id', 'year', 'duration']].values[0]) cur.execute(song_table_insert, song_data) # insert artist record artist_data = list(...
ff6269d6af673085078f
def error_msg(self): raise NotImplementedError
ff626bd7f2299d97569c
def update_mini_batch(self, mini_batch, eta): nabla_b = [np.zeros(b.shape) for b in self.biases] nabla_w = [np.zeros(w.shape) for w in self.weights] for x, y in mini_batch: delta_nabla_b, delta_nabla_w = self.backprop(x, y) nabla_b = [nb+dnb for nb, dnb in zip(nabla_b, delta_nabla_b)] nabla_w = [nw+dnw for nw,...
ff62731ebe23d57c0d9c
def plot_nullility_corr(data, **kwargs): _fully_complete(data) _default_plot_args(**kwargs) msno.heatmap(data, **kwargs)
ff6280cccf87642cbd0c
def decayfile(inputfile, outputfile, decaythese=["111"]): g = open(outputfile, "w") with open(inputfile) as f: comments=f.readline() g.write(comments) for line in f: l = line.split(",") pid = l[1] if pid in decaythese: p1 = float(l[3])...
ff6286da5af3ee3e0e7b
def perror(text): print(bcolors.FAIL + text + bcolors.ENDC)
ff629ebe43c14f4eb79b
def CUIFrame_Create(*args): return _MaxPlus.CUIFrame_Create(*args)
ff629ec06f6816b7bf14
def test_pep8_conformance_codegentest(self): pep8style = pep8.StyleGuide(quiet=False) result = pep8style.check_files(['tests/test_codegen.py']) self.assertEqual(result.total_errors, 0, "Found code style errors (and warnings).")
ff62b683dacec4afd01e
def update(self): if not self.empty: for p in self.particles: p.update()
ff62b8a2a8887304df05
def get_content_type(self): if self._content_type is None and self.count_files() is 1: sources = self.get_files()[0].get_sources() for source in sources: try: file_handle = urlopen(source.get_uri()) self._content_type = file_handle....
ff62bb12c0825fe2ba4a
def ccc(ucd, c): return ucd.canonical_combining_class.get(c, 0)
ff62c2cd1e7ab94e16d1
def _create_dirs(self): # work arrives in here self.inbox_dir = self.parent_dir / f"{self.name}_inbox" self.inbox_dir.mkdir() # I move it here for processing self.inprogress_dir = self.parent_dir / f"{self.name}_inprogress" self.inprogress_dir.mkdir() # And move...
ff62f90626ce211d88e0
def collect_paths(self, package): args = [self.dpkg_query, '--no-pager', '--listfiles', package] rc, out, err = self.module.run_command(args) if rc != 0: log.error('dpkg-query failed', err) self.module.fail_json(msg='dpkg-query failed', rc=rc, err=err) paths = set...
ff6314fbc1351fecafd1
def is_values_file(fname): fname = basename(fname) if fname.startswith('values.yml') or fname.startswith('values.yaml'): return True return False
ff6358d5de022943da85
def is_kite(g, a, d, b, c): return has_undir_edge(g, d, a) and \ has_undir_edge(g, d, b) and \ has_undir_edge(g, d, c) and \ has_dir_edge(g, b, a) and \ has_dir_edge(g, c, a)
ff63692e0dca8b37ba85
def remove(self): Log.debug('Removing %s object from database.' % self.__name__) cursor = Database.db_connection.cursor() table = self.__name__ sql = "DELETE FROM " + table + """ WHERE c_id = """ "'%s'" """ """ % self["c_id"] Log.debug('Will execut...
ff6376e57335f2f536a7
def is_group_id(self): return self._tag == 'group_id'
ff638a665945f1aa5bb0
def push(): with cd(ROOT_DIR): _upload_git_project()
ff638f996ad821c9b9cc
def export(self, locales): rows = [] for ballot in self.ballots: for result in ballot.results: row = OrderedDict() titles = ( ballot.title_translations or self.title_translations or {} ) for locale in loca...
ff6392dae0e8190e37f5
def create_local_files_dictionary(files_dir): result = {} files = os.listdir(files_dir) for file in files: result[bytes_to_numeric( generate_hash(file))] = os.path.join(files_dir, file), file return result
ff639c5c45f5fa69b38e
def make_dir(path): if not os.path.isdir(path): if os.name == 'nt': os.system('md "' + path + '"') elif os.name == 'posix': os.system('mkdir "' + path + '"') delay(3)
ff63a067eed7f0462365
def build_schema(self, fields, language): content_field_name = '' mapping = { DJANGO_CT: {'type': 'string', 'index': 'not_analyzed', 'include_in_all': False}, DJANGO_ID: {'type': 'string', 'index': 'not_analyzed', 'include_in_all': False}, } for field_name, field...
ff63ad5d2c23d164011f
def get_text_from_span(s, (start, end)): return " ".join(s[start: end])
ff63b035f58213b10d80
def first(iterable: Iterable[T], default: T | None = None) -> T | None: for i in iterable: return i return default
ff63ba96c09f40cbded3
def filePosition(self): info = [] lineNumber = self.lineNumber if lineNumber is not None: info.append(str(lineNumber)) columnNumber = self.columnNumber if columnNumber is not None: info.append(str(columnNumber)) return ":".join(info)
ff63db7afd3cdc0d19c2
def close_stream(self): with self.lock: self._close_stream()
ff63e3f1bb1fdc4742de
def test_cancel_everything_test_ecosystem_secondary_secondary(self): entity_a1 = self.entities[1] # 1. A1 starts with 50.0 MSC, 50.0 TMSC, 50 MIndiv1 and 50.0 TDiv1 self.check_balance(entity_a1.address, MSC, '50.00000000', '0.00000000') # SP 1 self.check_balance(entity_a1.address,...
ff63fb578ab2212a9963
def connection_check(): try: r = requests.get(f"{dao_url}/connection_check") return r.content, r.status_code except Exception as e: data = {'message': e, 'code': 'Internal Server Error'} return make_response(jsonify(data), 500)
ff641cd587ab6b5aa319
def _load_splash(self): self._state = App.SPLASH self._splash_title = self._big_font.render("Asteroids", True, WHITE) self._splash_text = self._medium_font.render( "Click or press Enter to begin.", True, GRAY) render_on(self._splash_title, self.screen, set...
ff642df56f0e2be97b56
def parse_input(e): if len(e) == 0: return (BLANK, None) elif e[0] == '#': return (COMMENT, e) elif e[0:5] == "fact:": e = e[5:].replace(")", "").replace("(", "").rstrip().strip().split() return (FACT, e) elif e[0:5] == "rule:": e = e[5:].split("->") rhs =...
ff6437b1d09128cce2ed
def get_value( self, node ): return node.get_data_obj( ).get_name( )
ff6484484015911f2370
def groupby_stats(x, attr='ebeam_photon_energy', drop=False, groupby='evr_code_141', stats=['mean','std','min','max'], dataframe=False): if drop: dag = x[attr].dropna(dim='time').groupby(groupby) print "dag = x['{:}'].dropna(dim='time').groupby('{:}')".format(attr, groupby) else: ...
ff64b552a815f1394d6f
def get_type_binding(value): if isinstance(value, bool): return 'b' if isinstance(value, float): return 'f' if isinstance(value, int): return 'i' if isinstance(value, long): return 'l' if isinstance(value, str): return 's' raise ValueError('Unsupported type %s' % type(value))
ff64cca4f59b580c1eaa
def split_loadDatas(paths, dim_x, n_splits=5, test_size=None, train_size=0.9, random_state=None): nppaths = np.asarray(paths) ss = ShuffleSplit(n_splits=n_splits, test_size=test_size, train_size=train_size, random_state=random_state) for train_index, test_index in ss.split(paths): yield loadDatas_es...
ff64d1652916b30a97cf
def get_dataset(): with open('dataset.pickle', 'rb') as in_file: dataset = pickle.load(in_file) return dataset
ff64dc78b46ab8a5c80e
def cmd_proxylist(self, data, client, cmd=None): services = [] for k in self.settings['services']: enabled = self.settings['services'][k]['enabled'] services.append('%s%s' % ('^2' if enabled else '^1',k)) cmd.sayLoudOrPM(client, self.getMessage('proxy_list', {'services': ...
ff64e133c761e3dd44ea
def write_to_report(self, *args): write_to_report = getattr(self, "write_%s" % args[0]) args = args[1:] #we do not need self.format any more write_to_report(*args)
ff64e99fc2da598e07a0
def initialize(self, params): super().initialize(params) # Here you can use the following default params to initialize your policy # self.stp.cvr_default -- the average historical conversion rate, # you can expect the observed average conversion rate to be similar, # self.stp.r...
ff651768f35d69987951
def Clone(self) -> "itkVotingBinaryIterativeHoleFillingImageFilterISS3_Pointer": return _itkVotingBinaryIterativeHoleFillingImageFilterPython.itkVotingBinaryIterativeHoleFillingImageFilterISS3_Clone(self)
ff655e5b454e6522bb70
def compile(self): assert self.map is not None, 'rule not bound' if self.map.host_matching: domain_rule = self.host or '' else: domain_rule = self.subdomain or '' self._trace = [] self._converters = {} self._weights = [] regex_...
ff6561668dc842b22739
def test_hist_init(): FNAME = 'xonsh-SESSIONID.json' FNAME += '.init' History(filename=FNAME, here='yup', **HIST_TEST_KWARGS) with LazyJSON(FNAME) as lj: obs = lj['here'] assert_equal('yup', obs) os.remove(FNAME)
ff65856eef38319bcba1
def check_if_date(line): try: datetime.datetime.strptime(line.strip(), '%Y-%m-%d') return True except ValueError: return False
ff65a0d374f7c87c76e5
def from_file(cls, filename): yaml = YAML(typ="safe") with open(filename, "r") as f: d = yaml.load(f) return cls.from_dict(d)
ff65da49a3ed88720cc3
def exitFrame(self): #Check whether any grabbed frame is retrievable. #The getter may retrieve and acche the frame. if self.frame is None: self._enteredFrame = False return #Update the FPS estimate and related variables. if self._framesElapsed == 0: self._startTime = time.time() else: ...
ff65e3789d12333ed8bd
def enqueue(queue, element): queue.size = queue.size + 1 newnode = Node(element, None) if is_empty(queue): queue.front = newnode queue.back = newnode else: minimum = queue.back.value.priority if newnode.value.priority <= minimum: queue.back = newnode q...
ff65ea0c8e7e9a3a2e88
def get_nucleotides_with_samtools(mafline, genome_refpath, fusionside): #sequence_list=[] #for item in mafline: if fusionside=='left': if mafline[4]=="-": interval = mafline[0] + ':' + mafline[1] + '-' + str(int(mafline[1])+25) else: interval = mafline[0] + ':' + str(...
ff65f17d22fe634a8bc0
def map(self, function, *sequences): processed = [] for _i, stream in enumerate(self): args = [sequence[_i] for sequence in sequences] processed += [function(stream, *args)] return self.__class__( processed, id=self.id)
ff65f25accee836f5644
def exponentiate(num1, num2): result = pow(num1, num2) return result
ff662923e0c45f28350e
def states(self): from geoid.core import names from geoid.censusnames import geo_names, stusab states = {} for state_no, stusab in stusab.items(): states[stusab] = { 'name': geo_names[(state_no,0)], 'stusab': stusab, 'number' ...
ff6671e1ca58108617d5
def testNextPass(self):
ff66844f63410aa92809
def setup_method(self): self.hmc, self.hmc_resources = standard_test_hmc() self.uris = ( (r'/api/cpcs/([^/]+)/partitions(?:\?(.*))?', PartitionsHandler), (r'/api/partitions/([^/]+)', PartitionHandler), ) self.urihandler = UriHandler(self.uris)
ff66a253d4141c80fb38
def create( cls, course_id, sender, targets, subject, html_message, text_message=None, template_name=None, from_addr=None): # automatically generate the stripped version of the text from the HTML markup: if text_message is None: text_message = html_to_text(html_messag...
ff66a9116b13db71b2e2
def huffman_tree(freq_dict): new_lst = [] if len(freq_dict) == 0: return None else: new_tup = [(freq, key) for (key, freq) in freq_dict.items()] new_tup.sort() for (freq, value) in new_tup: new_lst.append((freq, HuffmanNode(value))) if len(new_lst) == 1: new...
ff66ad1fe1b4829fc382
def clone_devstack(args, helper, server, indent='', last_result=None): machine = helper.machines[server.name] old_path = machine.path("devstack") if not old_path.exists(): with utils.Spinner("%sCloning devstack" " in %s" % (indent, server.hostname), ...