code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def frb_output_params(obj: str, quiet: bool = False): <NEW_LINE> <INDENT> p = object_params_frb(obj=obj, quiet=quiet) <NEW_LINE> if p is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return load_params(p['data_dir'] + 'output_values', quiet=quiet)
:param obj: The FRB title, FRBXXXXXX :return:
625941f36aa9bd52df0373ab
def getParameter(pset, param, nopop = False): <NEW_LINE> <INDENT> params = param.split(".") <NEW_LINE> if not nopop: <NEW_LINE> <INDENT> params.pop(0) <NEW_LINE> <DEDENT> lastParam = pset <NEW_LINE> for param in params: <NEW_LINE> <INDENT> lastParam = getattr(lastParam, param, None) <NEW_LINE> if lastParam == None: <NE...
_getParameter_ Retrieve the specified parameter from the PSet Provided given the attribute chain returns None if not found
625941f3a219f33f34628f64
def calc_dc_for_density(self, orb, dc_init, dens_mat, density=None, precision=0.01): <NEW_LINE> <INDENT> def F(dc): <NEW_LINE> <INDENT> self.calc_dc(dens_mat=dens_mat, U_interact=0, J_hund=0, orb=orb, use_dc_value=dc) <NEW_LINE> if dens_req is None: <NEW_LINE> <INDENT> return self.total_density(mu=mu) <NEW_LINE> <DEDEN...
Searches for DC in order to fulfill charge neutrality. If density is given, then DC is set such that the LOCAL charge of orbital orb coincides with the given density.
625941f394891a1f4081c0b0
def markup(notice): <NEW_LINE> <INDENT> context_dict = dict(notice) <NEW_LINE> sxs_template = loader.get_template('regulations/notice-sxs.html') <NEW_LINE> context_dict['sxs_markup'] = [ sxs_markup(child, 3, sxs_template) for child in notice['section_by_section']] <NEW_LINE> return loader.get_template('regulations/noti...
Convert a notice's JSON into associated markup
625941f3ad47b63b2c50a583
def match(url, rules): <NEW_LINE> <INDENT> split_result = urlsplit(url) <NEW_LINE> path = split_result.path <NEW_LINE> qs = split_result.query <NEW_LINE> for rule in rules: <NEW_LINE> <INDENT> url_regex = regex_from_rule(rule) <NEW_LINE> match = url_regex.match(path) <NEW_LINE> if match: <NEW_LINE> <INDENT> query = dic...
找到 path 对应的 rule,并解析其中的参数 >>> match('/local/songs', rules=['/<p>/songs']) ('/<p>/songs', {'p': 'local'}, {}) >>> match('/search?q=hello+world', rules=['/search']) ('/search', {}, {'q': 'hello world'}) :return: (rule, params) or None
625941f360cbc95b062c6b47
def reset(report=MAIN_REPORT): <NEW_LINE> <INDENT> report[TOOL_NAME] = { 'analyses': {}, 'latest': None, 'instance': Tifa(report=report) } <NEW_LINE> return report[TOOL_NAME]
Remove all the information associated with this tool. Args: report:
625941f330dc7b7665901f63
def instance_update(self, context, instance_uuid, **updates): <NEW_LINE> <INDENT> return self._manager.instance_update(context, instance_uuid, updates)
Perform an instance update in the database
625941f363d6d428bbe44af5
def cleanupCancelledRender(classObject, context, killPython=True): <NEW_LINE> <INDENT> wm = context.window_manager <NEW_LINE> wm.event_timer_remove(classObject._timer) <NEW_LINE> for j in range(len(classObject.processes)): <NEW_LINE> <INDENT> if classObject.processes[j]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cla...
Kills running processes when render job cancelled
625941f3d486a94d0b98e74a
@csrf_protect <NEW_LINE> def index(request): <NEW_LINE> <INDENT> data = dict() <NEW_LINE> if 'token' in request.COOKIES and User.objects.filter(token=request.COOKIES['token']).exists(): <NEW_LINE> <INDENT> token = request.COOKIES['token'] <NEW_LINE> print("\n COOKIE TOKEN: " + request.COOKIES['token']) <NEW_LINE> <DEDE...
Renders the page '/'
625941f3cc0a2c11143dd495
def classFactory(iface): <NEW_LINE> <INDENT> from .Comprar import Comprar <NEW_LINE> return Comprar(iface)
Load Comprar class from file Comprar. :param iface: A QGIS interface instance. :type iface: QgisInterface
625941f3711fe17d82542961
def sample(self,df: pd.DataFrame): <NEW_LINE> <INDENT> start_t, end_t = self._sample.get_sample() <NEW_LINE> temp_raw = df.loc[start_t:end_t,:] <NEW_LINE> return temp_raw
Trích xuất phân đoạn thứ i
625941f3e64d504609d74e43
def get_slo_list(self, array): <NEW_LINE> <INDENT> slo_list = [] <NEW_LINE> slo_dict = self.get_resource(array, SLOPROVISIONING, 'slo') <NEW_LINE> if slo_dict and slo_dict.get('sloId'): <NEW_LINE> <INDENT> slo_list = slo_dict['sloId'] <NEW_LINE> <DEDENT> return slo_list
Retrieve the list of slo's from the array :param array: the array serial number :returns: slo_list -- list of service level names
625941f307f4c71912b11a89
def calculate(self, deep_exploration): <NEW_LINE> <INDENT> if not isinstance(deep_exploration, int): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> for i in range(1, deep_exploration + 1): <NEW_LINE> <INDENT> tmp = math.ceil( self.resource_types[self.resource.item_id] * (self.base + i) * 50000 ) <NEW_LINE> sel...
Calculate exploration costs
625941f3ad47b63b2c50a584
def parse_beam_search_result(self,predict_ids): <NEW_LINE> <INDENT> all_result=[] <NEW_LINE> for single_predict in predict_ids: <NEW_LINE> <INDENT> one_beam_result=[] <NEW_LINE> for i in range(self.beam_search_size): <NEW_LINE> <INDENT> predict_list = np.ndarray.tolist(single_predict[:, i]) <NEW_LINE> one_beam_result.a...
将beam_search返回的结果去掉unk,截断EOS后面得内容 :param predict_ids: 列表,长度为batch_size,每个元素都是decode_len*beam_size的数组 :param id2word: vocab字典 :return:
625941f329b78933be1e5ca8
def analyse(self, ctx): <NEW_LINE> <INDENT> for c in self.children: c.analyse(ctx.copy()) <NEW_LINE> return ctx
Top-down semantic analysis of the tree. 'ctx' is the opening Context (pre-context) of the current node. Returns closing context (post-context) of the node, which may be the same object 'ctx' (!), but doesn't have to. Parent nodes shall NEVER assume that 'ctx' doesn't get modified when passed down to a child. If this...
625941f3be7bc26dc91cdbf8
def install_cert(target_key, source_key, owner_name, permissions): <NEW_LINE> <INDENT> target_path = config[target_key] <NEW_LINE> target_dir = os.path.dirname(target_path) <NEW_LINE> source_path = config[source_key] <NEW_LINE> user = pwd.getpwnam(owner_name) <NEW_LINE> if os.path.lexists(target_path): <NEW_LINE> <INDE...
Carefully install a certificate with the given key from the given source path, then set ownership and permissions as given. Record each directory and file created by this process into the config dictionary; do so immediately after creation, so that the remove_cert() function knows exactly what to remove/restore.
625941f3f548e778e58cdb84
def headblur(clip,fx,fy,r_zone,r_blur=None): <NEW_LINE> <INDENT> if r_blur==None: r_blur = 2*r_zone/3 <NEW_LINE> def fl(gf,t): <NEW_LINE> <INDENT> im = gf(t) <NEW_LINE> h,w,d = im.shape <NEW_LINE> x,y = int(fx(t)),int(fy(t)) <NEW_LINE> x1,x2 = max(0,x-r_zone),min(x+r_zone,w) <NEW_LINE> y1,y2 = max(0,y-r_zone),min(y+r_z...
Returns a filter that will blurr a moving part (a head ?) of the frames. The position of the blur at time t is defined by (fx(t), fy(t)), the radius of the blurring by ``r_zone`` and the intensity of the blurring by ``r_blur``. Requires OpenCV for the circling and the blurring. Automatically deals with the case where p...
625941f34d74a7450ccd47c9
def __init__(self): <NEW_LINE> <INDENT> self.graphics = 0 <NEW_LINE> self.resource_SPRITES = 0 <NEW_LINE> self.resource_SOUNDS = 0 <NEW_LINE> self.resource_IMAGES = 0 <NEW_LINE> self.resource_TEXTURES = 0 <NEW_LINE> self.resource_3DMODELS = 0 <NEW_LINE> pass
Constructor
625941f3ab23a570cc25078c
def bani(registers, a, b, c): <NEW_LINE> <INDENT> registers[c] = registers[a] & b
bani (bitwise AND immediate) stores into register C the result of the bitwise AND of register A and value B. >>> registers = [3, 2, 1, 0] >>> bani(registers, 0, 1, 2) >>> registers [3, 2, 1, 0]
625941f3b5575c28eb68e60a
def icnswitch2 (address='127.0.0.1', port = 6633, max_retry_delay = 16, dpid = "456", extra = None, __INSTANCE__ = None): <NEW_LINE> <INDENT> print(" DATAPATH : ICN Switch Function") <NEW_LINE> from pox.core import core <NEW_LINE> print(" DATAPATH : Registering in core") <NEW_LINE> core.register("datapaths", {}) <NEW_L...
Launches a ICNSwitch Not particularly useful, since ICNSwitch doesn't do much.
625941f363f4b57ef000170b
def remove_module(self, node): <NEW_LINE> <INDENT> self._objs.remove(node)
Removes a PySynth node from the collection. :param node: PySynth node to remove
625941f35e10d32532c5f529
def pred_sc_beam(s_sc, beam_size): <NEW_LINE> <INDENT> pr_sc_beam = [] <NEW_LINE> for s_sc1 in s_sc: <NEW_LINE> <INDENT> val, idxes = s_sc1.topk(k=beam_size) <NEW_LINE> pr_sc_beam.append(idxes.tolist()) <NEW_LINE> <DEDENT> return pr_sc_beam
return: [ pr_wc1_i, pr_wc2_i, ...]
625941f3dc8b845886cb5b3b
def concatWCB(m=4, n=4): <NEW_LINE> <INDENT> if n < 2 or m < 2: <NEW_LINE> <INDENT> raise TestsError("number of states must be both greater than 1") <NEW_LINE> <DEDENT> d1, d2 = DFA(), DFA() <NEW_LINE> d1.setSigma(["a", "b"]) <NEW_LINE> d1.States = range(m) <NEW_LINE> d1.setInitial(0) <NEW_LINE> d1.addFinal(m - 1) <NEW...
Worst case automata for catenation(DFA,DFA) with m,n > 1, k=2, ..seealso::Jirásek, J., Jiráaskováa, G., Szabari, A., 2005. State complexity of concatenation and complementation of regular languages. Int. J. Found. Comput. Sci. 16 (3), 511–529. :arg m: number of states :arg n: number of states :type m: integer :type ...
625941f3fff4ab517eb2fa45
def loadCachedJson(self, path): <NEW_LINE> <INDENT> raise NotImplementedError
Load precomputed JSON
625941f3a8370b7717052ea1
def set_worker_encryption_key(self, worker_encryption_key): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.params_obj["workerEncryptionKey"] = worker_encryption_key.encode("UTF-8").hex() <NEW_LINE> <DEDENT> except Exception as err: <NEW_LINE> <INDENT> raise TypeError("Worker Encryption Key not valid")
Set workerEncryptionKey work order parameter.
625941f3e5267d203edce299
def AddUser(self, ): <NEW_LINE> <INDENT> TableName = "User_Table" <NEW_LINE> Columns = { "External_User_Id": self.UserId, "User_Name": self.UserName, "First_Name": self.UserFirstName, "Last_Name": self.UserLastName } <NEW_LINE> self.SqlObject.InsertEntry(self.SqlCursor, TableName, Columns) <NEW_LINE> self.SqlObject.Com...
This method will add a new user to the database. Variables: \-
625941f3ff9c53063f47c7f4
@snippet <NEW_LINE> def topic_iam_policy(client, to_delete): <NEW_LINE> <INDENT> TOPIC_NAME = 'topic_iam_policy-%d' % (_millis(),) <NEW_LINE> topic = client.topic(TOPIC_NAME) <NEW_LINE> topic.create() <NEW_LINE> to_delete.append(topic) <NEW_LINE> policy = topic.get_iam_policy() <NEW_LINE> assert len(policy.viewers) == ...
Fetch / set a topic's IAM policy.
625941f37b25080760e39a59
def axis_size(ax=None): <NEW_LINE> <INDENT> ax = plt.gca() if ax is None else ax <NEW_LINE> fig = ax.figure <NEW_LINE> bbox = ax.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) <NEW_LINE> return bbox.width * fig.dpi, bbox.height * fig.dpi
Get axis width and height in pixels. Based on a StackOverflow response: https://stackoverflow.com/questions/19306510/determine-matplotlib-axis-size-in-pixels Parameters ---------- ax : axis object The axes to determine the size of. Defaults to current axes. Returns ------- width : float Width of axes in pixe...
625941f324f1403a92601165
def view_type_error(self): <NEW_LINE> <INDENT> raise UNTLFormException( 'Element "%s" needs a view type' % (self.name) )
Throw an error if no view type is used.
625941f376d4e153a657f137
@command(help=PUTGIST_DESC) <NEW_LINE> @option("--yes-to-all", "-y", is_flag=True, help="Assume yes to all prompts.") <NEW_LINE> @option("--private", "-p", is_flag=True, help="Create new gist as private") <NEW_LINE> @argument("user") <NEW_LINE> @argument("filename") <NEW_LINE> def run_putgist(filename, user, **kwargs):...
Passes user inputs to GetGist() and calls put()
625941f3a79ad161976cc74a
def get_stocks(intent, session): <NEW_LINE> <INDENT> card_title = intent['name'] <NEW_LINE> session_attributes = {} <NEW_LINE> should_end_session = False <NEW_LINE> stock_list = ['CMCSA', 'TWTR'] <NEW_LINE> for elem in stock_list: <NEW_LINE> <INDENT> link = "http://dev.markitondemand.com/Api/v2/Quote/json?symbol=" + el...
Gets the price per currency
625941f34c3428357757c928
def dlqr_with_arimoto_potter(Ad, Bd, Q, R): <NEW_LINE> <INDENT> n = len(Bd) <NEW_LINE> Ac = (Ad - np.eye(n)) / dt <NEW_LINE> Bc = Bd / dt <NEW_LINE> Ham = np.vstack( (np.hstack((Ac, - Bc * la.inv(R) * Bc.T)), np.hstack((-Q, -Ac.T)))) <NEW_LINE> eigVals, eigVecs = la.eig(Ham) <NEW_LINE> V1 = None <NEW_LINE> V2 = None <N...
Solve the discrete time lqr controller. x[k+1] = Ad x[k] + Bd u[k] cost = sum x[k].T*Q*x[k] + u[k].T*R*u[k] # ref Bertsekas, p.151
625941f3bf627c535bc137d4
def triplet_loss(y_true, y_pred): <NEW_LINE> <INDENT> alpha = 0.1 <NEW_LINE> anchor = y_pred[0, :] <NEW_LINE> positive = y_pred[1,:] <NEW_LINE> negative = y_pred[2,:] <NEW_LINE> loss = K.sqrt(K.sum(K.square(anchor-positive))) - K.sqrt(K.sum(K.square(anchor-negative))) + alpha <NEW_LINE> loss = K.maximum(0.0, loss) <NEW...
y_true : FAKE y_pred : (3,embedding_units) vector
625941f3e8904600ed9f253c
def getOrdering(self, conOrder, oneSided, noEquality=False): <NEW_LINE> <INDENT> if self.nCon == 0: <NEW_LINE> <INDENT> if self.dummyConstraint: <NEW_LINE> <INDENT> return [], [-INFINITY], [INFINITY], None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.array([], "d") <NEW_LINE> <DEDENT> <DEDENT> indices = [] <...
Internal function that is used to produce a index list that reorders the constraints the way a particular optimizer needs. Parameters ---------- conOrder : list This must contain the following 4 strings: 'ni', 'li', 'ne', 'le' which stand for nonlinear inequality, linear inequality, nonlinear equality and ...
625941f3a17c0f6771cbe653
def initialiser_echiquier_depart(self): <NEW_LINE> <INDENT> self.dictionnaire_pieces = { 'a1': Tour('blanc'), 'b1': Cavalier('blanc'), 'c1': Fou('blanc'), 'd1': Dame('blanc'), 'e1': Roi('blanc'), 'f1': Fou('blanc'), 'g1': Cavalier('blanc'), 'h1': Tour('blanc'), 'a2': Pion('blanc'), 'b2': Pion('blanc'), 'c2': Pion('blan...
Initialise l'échiquier à son contenu initial. Pour faire vos tests pendant le développement, nous vous suggérons de vous fabriquer un échiquier plus simple, en modifiant l'attribut dictionnaire_pieces de votre instance d'Echiquier.
625941f3ac7a0e7691ed46c4
def reading_colums (ws, column_num, crit, crit_value): <NEW_LINE> <INDENT> AAA = [] <NEW_LINE> i = 2 <NEW_LINE> while ws.cell(row = i,column = 1).value != None or i == 2000: <NEW_LINE> <INDENT> if ws.cell(row = i,column = crit).value == crit_value: <NEW_LINE> <INDENT> if ws.cell(row = i,column = column_num).value == No...
Reading column in the list, max nb of items 2000, till the end of the 1st column in excel
625941f399fddb7c1c9de992
def convert_to_irreversible(model,reactions_to_convert): <NEW_LINE> <INDENT> reactions_to_add = [] <NEW_LINE> convertedlist = [] <NEW_LINE> atp_metabolites = [ model.metabolites.ppi_c, model.metabolites.pi_c, model.metabolites.atp_c, model.metabolites.adp_c, model.metabolites.adp_c] <NEW_LINE> for r in reactions_to_con...
Split reversible reactions into two irreversible reactions. cobra_model: A Cobra model object which will be modified in place. reactions_to convert: list of reaction_id to convert
625941f3c4546d3d9de7303f
def import_dataset_find_shapefiles(dataset_id, dataset_conf): <NEW_LINE> <INDENT> destination_table = 'geodata_{0}'.format(dataset_id) <NEW_LINE> create_table_sqls = [] <NEW_LINE> import_data_sqls = [] <NEW_LINE> with TemporaryDir() as tempdir: <NEW_LINE> <INDENT> for resource in dataset_conf['resources']: <NEW_LINE> <...
Find all the Shapefiles from archives listed as dataset resources. :param dataset_id: The dataset id :param dataset_conf: The dataset configuration
625941f3d8ef3951e3243b42
def send_gift(self, users: List[str]): <NEW_LINE> <INDENT> result, _ = self.post("giftSend", users=users) <NEW_LINE> return self.parse_error(result)
Sends gift to users.
625941f356b00c62f0f14c62
def guardar_palabras(ruta_texto, ruta_palabras): <NEW_LINE> <INDENT> lista_de_palabras = [] <NEW_LINE> with open(ruta_texto, "r") as e: <NEW_LINE> <INDENT> linea = e.readline() <NEW_LINE> while linea != "": <NEW_LINE> <INDENT> palabras_de_linea = linea.split("\n") <NEW_LINE> palabras_de_linea = linea.split(" ") <NEW_LI...
Recibe donde esta el archivo texto y donde se van a guardar las palabras del archivo texto. Selecciona donde estan las palabras y las guarda en la segunda ruta
625941f3be7bc26dc91cdbf9
def main(): <NEW_LINE> <INDENT> pass
Entry point for the application script
625941f323e79379d52eeb60
def init_hub(self): <NEW_LINE> <INDENT> self.hub = Hub( ip=self.hub_ip, port=self.hub_port, base_url=self.hub_prefix, cookie_name='jupyter-hub-token', public_host=self.subdomain_host, )
Load the Hub config into the database
625941f321a7993f00bc8300
def getdetailedresults(self): <NEW_LINE> <INDENT> return self.detailedresults
Return the detailed results string. @return string : @author D. Kennel
625941f3b5575c28eb68e60b
def getitem(v,k): <NEW_LINE> <INDENT> return v.f[k] if k in v.D else 0
Return the value of entry k in v. Be sure getitem(v,k) returns 0 if k is not represented in v.f. >>> v = Vec({'a','b','c', 'd'},{'a':2,'c':1,'d':3}) >>> v['d'] 3 >>> v['b'] 0
625941f3009cb60464c639b2
def test_idl_struct_init(self): <NEW_LINE> <INDENT> test_name = 'test_name' <NEW_LINE> test_parent = 'test_parent' <NEW_LINE> test_parent_mock = Mock(spec=['full_path']) <NEW_LINE> test_parent_mock.full_path = test_parent <NEW_LINE> idl_struct = struct.IDLStruct(test_name, test_parent_mock) <NEW_LINE> self.assertEqual(...
test for IDLStruct.__init__
625941f3236d856c2ad44de8
def add_members_to_listener(self, listener, members): <NEW_LINE> <INDENT> listener = self._get_resource(_listener.Listener, listener) <NEW_LINE> return listener.add_members(self._session, members)
Add backend members for a listener :param listener: Either the ID of a listener or an instance of :class:`~openstack.load_balancer.v1.listener.Listener` :param members: list of dicts which contain the server_id and address. server_id is ECS service id, address is ECS server internal IP. [{"server_id": ...
625941f3aad79263cf39104f
def test_field_with_dictionary(self): <NEW_LINE> <INDENT> serializer = PersonSerializer(self.person) <NEW_LINE> expected = self.person_data <NEW_LINE> self.assertEquals(serializer.data['info'], expected)
Make sure that dictionaries from fields are left intact
625941f34428ac0f6e5badfd
def preprocess(self): <NEW_LINE> <INDENT> if self._indices is None or len(self._indices) <= 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Verifies that this ModuleRequest can be fulfilled.
625941f3711fe17d82542962
def __init__( self, reasoning_module: AbstractReasoningModule, question_module: AbstractQuestionModule, scene_graph_module: AbstractSceneGraphModule, question_embeddings: Optional[torch.nn.Embedding] = None, scene_graph_embeddings: Optional[torch.nn.Embedding] = None, ) -> None: <NEW_LINE> <INDENT> super().__init__() <...
Create a `VQA` model.
625941f3293b9510aa2c3895
def test_product_out_of_range_formatter_ref_error(self): <NEW_LINE> <INDENT> cleanup_tmpdir() <NEW_LINE> s = StringIO() <NEW_LINE> pipeline_printout(s, [test_product_out_of_range_formatter_ref_error_task], verbose=3, wrap_width = 10000, pipeline= "main") <NEW_LINE> self.assertIn("Warning: Input substitution failed:", s...
{path[2][0]} when len(path) == 1 Requires verbose >= 3 or an empty jobs list
625941f3a934411ee3751c9a
def get_listenpolicy(self): <NEW_LINE> <INDENT> return self.options['listenpolicy']
Use this parameter to specify the listen policy for LB Vserver. The string can be either an existing expression name (configured using add policy expression command) or else it can be an in-line expression with a maximum of 1500 characters. Default value: "none"
625941f3ff9c53063f47c7f5
def load_data(self,filename,vertical=False): <NEW_LINE> <INDENT> if(filename==None): <NEW_LINE> <INDENT> raise Exception("No file name given!") <NEW_LINE> <DEDENT> save=codecs.open(filename,"r",encoding="utf-8") <NEW_LINE> mydata = list(u""+save.read()) <NEW_LINE> save.close() <NEW_LINE> w,h = ord(mydata.pop(0)), ord(m...
Load and create a new charamatrix if not called on one instance vertical is for compatibility with old version
625941f3be383301e01b5a7f
def __init__(self, device): <NEW_LINE> <INDENT> self.wrapped = device
create a device from the same device in a different representation
625941f356ac1b37e62647c8
def remove_client(self, export_point, host): <NEW_LINE> <INDENT> if export_point not in self.exports: <NEW_LINE> <INDENT> raise ClientNotFoundException("No acl defined for " "'{0:s}'".format(export_point)) <NEW_LINE> <DEDENT> export = self.exports[export_point] <NEW_LINE> if host not in export.clients: <NEW_LINE> <INDE...
Remove access for a client to an export. The filesystem is unexported if there are no clients left. :param export_point: export to remove access from :type export_point: string (unicode) :param host: ip address, network or domain name for removal :type host: string (unicode)
625941f363b5f9789fde76eb
def generate_csrf_token(self): <NEW_LINE> <INDENT> if 'csrf' not in self.session: <NEW_LINE> <INDENT> self.session['csrf'] = sha1(os.urandom(64)).hexdigest() <NEW_LINE> <DEDENT> secret_key = config.CONFIG['csrf']['secret_key'] <NEW_LINE> time_limit = config.CONFIG['csrf']['time_limit'] <NEW_LINE> time_format = config.C...
Generate a csrf token and store it in the user's session.
625941f3507cdc57c63072ef
def test_group_events( self, client, user_token, event, group_with_user ): <NEW_LINE> <INDENT> response = client.get( f'/api/groups/{group_with_user.pk}/events', **user_token ) <NEW_LINE> assert response.data == [ { 'id': 1, 'title': event.title, 'place': event.place, 'description': event.description, 'created_by': eve...
Given group, And event with group, When list group events, Then response contains given event.
625941f391af0d3eaac9c022
def test_datastore_info(self): <NEW_LINE> <INDENT> data = iiqtools_gather_info.datastore_info() <NEW_LINE> the_json = json.loads(data) <NEW_LINE> expected_endpoint = '/api/datastore/usage?current_dir=true' <NEW_LINE> self.assertEqual(the_json['endpoint'], expected_endpoint)
Function `datastore_info` calls the correct API endpoint
625941f330bbd722463cc3cf
def parse_values(keyvals): <NEW_LINE> <INDENT> for key,value in keyvals: <NEW_LINE> <INDENT> if key=='message_id': <NEW_LINE> <INDENT> yield key, clean_docid(value) <NEW_LINE> continue <NEW_LINE> <DEDENT> if key=='message_template': <NEW_LINE> <INDENT> if re.search(r'^\d+$', value): <NEW_LINE> <INDENT> yield key, int(v...
Takes key,value pairs as input, where the values are unparsed. Filter down to the slots we want, and parse their values as well.
625941f3283ffb24f3c55eff
def get_num_cols(self)->int: <NEW_LINE> <INDENT> return self._num_cols.get()
Gets the number of columns set for a game. return: The number of columns for an othello game. rtype: int
625941f3d7e4931a7ee9e525
def uniquePaths(self, m, n): <NEW_LINE> <INDENT> dp = [[1 if p == 0 else 0 for p in range(n)] for _ in range(m)] <NEW_LINE> for k in range(1, n): <NEW_LINE> <INDENT> dp[0][k] = 1 <NEW_LINE> <DEDENT> for i in range(1, m): <NEW_LINE> <INDENT> for j in range(1, n): <NEW_LINE> <INDENT> dp[i][j] = dp[i-1][j] + dp[i][j-1] <N...
:type m: int :type n: int :rtype: int
625941f3f8510a7c17cf9d07
def p_elseGroup(self, args): <NEW_LINE> <INDENT> elseNode = astElseNode(args[0].line) <NEW_LINE> if len(args) == 2: <NEW_LINE> <INDENT> elseNode.children.append(args[1]) <NEW_LINE> <DEDENT> return elseNode
elseGroup ::= else group elseGroup ::= else
625941f350812a4eaa59c920
@pytest.fixture <NEW_LINE> def admin_browser(request, browser_instance_getter): <NEW_LINE> <INDENT> return browser_instance_getter(request, admin_browser)
Admin browser fixture.
625941f3ab23a570cc25078d
def Omega_phi_n(self, N): <NEW_LINE> <INDENT> ophi1 = self.sol()[:, 1] <NEW_LINE> ophi2 = UnivariateSpline(self.n1, ophi1, k=3, s=0) <NEW_LINE> return ophi2(N)
Density parameter for scalar field as a function of log(a) where 'a' is the scale factor of the Universe. Input: N: log(a) Output: Omega_phi(N): density parameter for scalar field as a function of e-folding ------------------ Examples: 1) Calculating Omega_phi for scalar field with power law potential V=phi^n with ...
625941f3a4f1c619b28b062f
def test_chromedriver_process_exists(): <NEW_LINE> <INDENT> selenium_helper.kill_chromedriver_process() <NEW_LINE> result_bool = selenium_helper.chromedriver_process_exists() <NEW_LINE> assert_false(result_bool)
Notes ----- If test this process with selenium running, it will be disconnected from the browser and will need to close it manually, so will not do such a test pattern. Test Command ------------ $ python run_tests.py --module_name plot_playground.tests.test_selenium_helper:test_chromedriver_process_exists
625941f3bde94217f36833f0
def _template_unique_number(number: int): <NEW_LINE> <INDENT> seed = _salt() <NEW_LINE> number = int(number) <NEW_LINE> while seed < number: <NEW_LINE> <INDENT> seed *= _salt() <NEW_LINE> <DEDENT> return int(str(seed)[: len(str(number))])
A pseudo-random number generator helper function. An alternative method of constructing unique numbers. The length of the number argument will be the same as the length of the number that's returned.
625941f3a934411ee3751c9b
def test_update_simple(self): <NEW_LINE> <INDENT> users = self.tables.users <NEW_LINE> result = testing.db.execute(users.update().values(name="peter").where(users.c.id == 10)) <NEW_LINE> expected = [ (7, 'jack'), (8, 'ed'), (9, 'fred'), (10, 'peter') ] <NEW_LINE> assert result.rowcount == 1 <NEW_LINE> self._assert_us...
test simple update and assert that exasol returns the right rowcount
625941f31d351010ab856120
def pingpong(n): <NEW_LINE> <INDENT> def switch_number(n): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> for i in range(n): <NEW_LINE> <INDENT> if i%7 == 0 or has_seven(i): <NEW_LINE> <INDENT> result += 1 <NEW_LINE> <DEDENT> return result <NEW_LINE> <DEDENT> if n == 1: <NEW_LINE> <INDENT> return n <NEW_LINE> <DEDENT> elif ...
Returns the nth element of the ping-pong sequence: the sequence that begins by counting up from one and switches direction when the place in the sequence is a multiple of 7 or contains the digit 7
625941f394891a1f4081c0b2
def check_job_exists(self, job): <NEW_LINE> <INDENT> if job not in self.jobs: <NEW_LINE> <INDENT> raise NoSuchJobError(job)
Sends back a standard erorr response if the job doesn't exist.
625941f37d43ff24873a32ab
def parse_hyperslab(hyperslab): <NEW_LINE> <INDENT> dimensions = [] <NEW_LINE> slices = [] <NEW_LINE> to_split = hyperslab <NEW_LINE> while to_split: <NEW_LINE> <INDENT> rbracket = to_split.find(']') + 1 <NEW_LINE> dimensions.append(to_split[:rbracket]) <NEW_LINE> to_split = to_split[rbracket:] <NEW_LINE> <DEDENT> for ...
Parse a hyperslab into a Python tuple of slice objects. OpenDAP subsetting indices are different than NumPy's, See https://goo.gl/swVCdN >>> parse_hyperslab("[36]") (slice(36, 37, None)) >>> parse_hyperslab("[1:2]") (slice(1, 3, None)) >>> parse_hyperslab("[1:2:6][][3:5:]") (slice(1, 7, 2), slice(None, None, None), sl...
625941f3d268445f265b5475
def cws(theString): <NEW_LINE> <INDENT> if re.search("\s+",theString): <NEW_LINE> <INDENT> theString = theString.replace("\\", "\\\\") <NEW_LINE> theString = theString.replace("\"", "\\\"") <NEW_LINE> theString = "\"" + theString + "\"" <NEW_LINE> <DEDENT> return theString
If theString contains whitespace, theString is returned enclosed in"" Else, theString is returned.
625941f323e79379d52eeb61
def reset_cli(self, **kwargs): <NEW_LINE> <INDENT> return self.api_request(self._get_method_fullname("reset_cli"), kwargs)
Reset CLI Credentials **Inputs** **Outputs**
625941f367a9b606de4a84bb
def get_cjsum(num): <NEW_LINE> <INDENT> if num <= 100: <NEW_LINE> <INDENT> sq_sum = 0 <NEW_LINE> for i in range(num+1): <NEW_LINE> <INDENT> sq_sum += i**2 <NEW_LINE> <DEDENT> return sq_sum <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "This number is over our range 100."
A funtion to sum range 1-100,and return a int type answer.
625941f3ec188e330fd5ad97
def high_path(chessboard, from_pos, to_pos): <NEW_LINE> <INDENT> sequence_list = [] <NEW_LINE> safe_height = 0.2 <NEW_LINE> low_height = 0.1 <NEW_LINE> (from_x, from_y, from_z) = board_position_to_cartesian(chessboard, from_pos) <NEW_LINE> (to_x, to_y, to_z) = board_position_to_cartesian(chessboard, to_pos) <NEW_LINE> ...
Computes the high path that the arm can take to move a piece from one place on the board to another. :param chessboard: Chessboard object :param from_pos: [a1-h8] :param to_pos: [a1-h8] :return: Returns a list of instructions for the GUI.
625941f37d847024c06be8c7
def append(self, key, val, time=0, min_compress_len=0): <NEW_LINE> <INDENT> return self._set("append", key, val, time, min_compress_len)
Append the value to the end of the existing key's value. Only stores in memcache if key already exists. Also see L{prepend}. @return: Nonzero on success. @rtype: int
625941f397e22403b379d5a2
def is_node_equal(node_1, node_2): <NEW_LINE> <INDENT> return node_1.__repr__() == node_2.__repr__()
check if two expression AST nodes are equal since pycparser doesn't provide such property :param node_1: First expression node :param node_2: Second expression node :return: Boolean
625941f3566aa707497f4b65
def test_index_view_with_a_past_poll(self): <NEW_LINE> <INDENT> past_poll = self.create_poll(question="Past poll.", days=-30, creator=self.u1) <NEW_LINE> response = self.client.get(reverse('polls:index')) <NEW_LINE> self.assertContains(response, past_poll.question) <NEW_LINE> self.assertQuerysetEqual( response.context[...
Polls with a pub_date in the past should be displayed on the index page.
625941f38c0ade5d55d3efc6
def test_install_with_branch_testing(tmpdir): <NEW_LINE> <INDENT> base_dir = str(tmpdir.mkdir('test_perrepo_env')) <NEW_LINE> test_env = os.path.join(base_dir, 'env') <NEW_LINE> working_dir = os.path.join(base_dir, 'working_dir') <NEW_LINE> logging.info('creating ' + test_env) <NEW_LINE> os.mkdir(working_dir) <NEW_LINE...
Create a package with some editable requirements and install using a branch and check that one repo with the branch gets checked out using the branch and the other ends up on master (this is how testing is often done).
625941f3711fe17d82542963
def new_user(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.user_id, drink_credits, admin_status = connector.user_info( self.current_ibutton) <NEW_LINE> self.logged_in = True <NEW_LINE> self.ser.write('a') <NEW_LINE> Publisher.sendMessage('updateNewUser', message=(self.user_id, drink_credits, admin_status)) <...
Tells the gui a user's information when a new iButton is pressed. The Publisher message has to be run in a seperate method so that it will be run in the main thread by the GUI thread.
625941f3e64d504609d74e45
def _computePressPos(container, coeff): <NEW_LINE> <INDENT> margins = container.layout().contentsMargins() <NEW_LINE> button_width = 50 <NEW_LINE> max_x = container.width() - margins.right() - button_width <NEW_LINE> test_x = int(coeff * container.width()) <NEW_LINE> new_x = max(margins.left() + 5, min(test_x, max_x)) ...
Compute the press position for a title bar. Parameters ---------- container : QDockContainer The dock container which owns the title bar of interest. coeff : float A floating point value between 0.0 and 1.0 which is the proportional x-offset of the mouse press in the title bar.
625941f329b78933be1e5caa
def _read_in(self): <NEW_LINE> <INDENT> rules = [] <NEW_LINE> atype = None <NEW_LINE> def _nul(s): <NEW_LINE> <INDENT> if s: <NEW_LINE> <INDENT> return s.strip("\"'") or 0 <NEW_LINE> <DEDENT> return 0 <NEW_LINE> <DEDENT> while self._get_line(): <NEW_LINE> <INDENT> m = self.type_re.search(self.line) <NEW_LINE> if m: <NE...
Reads in and parses affix file
625941f3baa26c4b54cb171e
def route(request, route_id): <NEW_LINE> <INDENT> route = get_object_or_404(Route, id=route_id) <NEW_LINE> data = json.dumps({ 'id': route.id, 'name': route.name, 'places': [ { 'id': place.id, 'name': place.name } for place in route.places.all() ] }) <NEW_LINE> return HttpResponse(data, mimetype="application/json")
Return a single route
625941f34527f215b584ca57
def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.state = 0 <NEW_LINE> self.walls = {'N': True, 'E': True, 'S': True, 'W': True}
Initialize the cell at (x,y). At first it is surrounded by walls. States; 0: path 1: Question point 2: End Point 3: Start Point
625941f3099cdd3c635f125e
def LengthSqrd( vec ): <NEW_LINE> <INDENT> return vec[0]**2 + vec[1]**2
Returns the length of a vector sqaured. Faster than Length(), but only marginally
625941f3f548e778e58cdb86
def acyclic(self, args='', copy=False): <NEW_LINE> <INDENT> data = self._run_prog('acyclic', args) <NEW_LINE> if copy: <NEW_LINE> <INDENT> return self.__class__(string=data.decode(self.encoding)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.from_string(data)
Reverse sufficient edges in digraph to make graph acyclic. Modifies existing graph. To create a new graph use >>> A=AGraph() >>> B=A.acyclic(copy=True) # doctest: +SKIP See the graphviz "acyclic" program for details of the algorithm.
625941f323849d37ff7b3690
def __init__(self, server_addr, session, timeout): <NEW_LINE> <INDENT> self._server_addr = server_addr <NEW_LINE> self._session = session <NEW_LINE> self._timeout = timeout
Request handler init. :param server_addr: connection string :type server_addr: str :param session: connection session ID :type session: str
625941f33c8af77a43ae3dae
def manual_sequence_input(): <NEW_LINE> <INDENT> home = os.path.join(os.path.expanduser('~')) <NEW_LINE> file_dir = os.path.join("/", input("Refer to ***documentation_url*** for proper formatting\n\n" "---> If the file is in the Desktop folder, enter the file name.\n" "---> Otherwise enter the full file path beyond {}:...
Prompts user to enter file path to upload sequence information Returns: file path for formatted input file
625941f35fcc89381b1e1cca
def zonemapalt_xml(ref_path, hyp_path, threshold, mask_path=None): <NEW_LINE> <INDENT> ref_zones = zones_from_gedi_xml(ref_path) <NEW_LINE> sys_zones = zones_from_gedi_xml(hyp_path) <NEW_LINE> scores, n_scores = zonemapalt(ref_zones, sys_zones, threshold, mask_path) <NEW_LINE> return scores, n_scores
Read xml files before performing the zonemapalt algorithm.
625941f38e7ae83300e4b5d5
def move(self): <NEW_LINE> <INDENT> self.x += self.Vx*dt <NEW_LINE> self.y += self.Vy*dt <NEW_LINE> if self.x - self.r <= 0: <NEW_LINE> <INDENT> self.Vx = -self.Vx <NEW_LINE> self.x = self.r + 1 <NEW_LINE> <DEDENT> if self.x + self.r >= screen_width: <NEW_LINE> <INDENT> self.Vx = -self.Vx <NEW_LINE> self.x = screen_wid...
сдвинуть шарик на его скорость
625941f396565a6dacc8fccf
def unpack(self, buf): <NEW_LINE> <INDENT> (self.syncbyte, pid_full, counter_full) = self.packetstrut.unpack_from(buf) <NEW_LINE> if self.syncbyte != 0x47: <NEW_LINE> <INDENT> self.invalidsync = True <NEW_LINE> <DEDENT> self.pid = pid_full % 8192 <NEW_LINE> self.continuitycounter = counter_full % 16 <NEW_LINE> self.pa...
Converts a buffer into an MPEGTS packet :param buf: The buffer to unpack into an MPEG Packet :type buf: str :rtype: bool
625941f344b2445a33932697
def webtoon_list(self): <NEW_LINE> <INDENT> for title, webtoon in self.webtoon_dict.items(): <NEW_LINE> <INDENT> print(title)
웹툰 전체 목록을 웹툰 제목으로 출력한다.
625941f399cbb53fe67931ea
def one_hot_decision_function(y): <NEW_LINE> <INDENT> z = np.zeros_like(y) <NEW_LINE> z[np.arange(len(z)), np.argmax(y, axis=1)] = 1 <NEW_LINE> return z
Examples -------- >>> y = [[0.1, 0.4, 0.5], ... [0.8, 0.1, 0.1], ... [0.2, 0.2, 0.6], ... [0.3, 0.4, 0.3]] >>> one_hot_decision_function(y) array([[0., 0., 1.], [1., 0., 0.], [0., 0., 1.], [0., 1., 0.]])
625941f3ab23a570cc25078e
def get_config(): <NEW_LINE> <INDENT> cfg = VersioneerConfig() <NEW_LINE> cfg.VCS = "git" <NEW_LINE> cfg.style = "pep440" <NEW_LINE> cfg.tag_prefix = "" <NEW_LINE> cfg.parentdir_prefix = "" <NEW_LINE> cfg.versionfile_source = "dsdev_utils/_version.py" <NEW_LINE> cfg.verbose = False <NEW_LINE> return cfg
Create, populate and return the VersioneerConfig() object.
625941f3bd1bec0571d90c35
def __init__(self, lcnn_extractor_weights='FINE_TUNED/LCNN/EXTRACTOR/WEIGHTS.hdf5', base_filters=64, gpus=1, generator_weights=None, classifier_weights=None, discriminator_weights=None): <NEW_LINE> <INDENT> self.gpus = gpus <NEW_LINE> self.base_filters = base_filters <NEW_LINE> self.generator_weights = generator_weight...
initialize TP-GAN network with given weights file. if weights file is None, the weights are initialized by default initializer. Args: lcnn_extractor_weights (str): Light-CNN weights file which is trained with celeb-1M and fine-tuned with MULTI-PIE. base_filters (int): base filters count of TP-GAN. default 64. ...
625941f3656771135c3ebe7c
def json_to_anime_list(data): <NEW_LINE> <INDENT> anime_list = models.AnimeList() <NEW_LINE> anime_list.anime = [] <NEW_LINE> d = json.loads(data) <NEW_LINE> entries = d['anime'] <NEW_LINE> anime_list.statistics = d['statistics'] <NEW_LINE> for entry in entries: <NEW_LINE> <INDENT> anime = models.Anime() <NEW_LINE> for...
Transforms a JSON blob to an AnimeList object. Keyword arguments: data -- the json blob
625941f392d797404e304793
def __init__(self,app=None, runningVersion=None): <NEW_LINE> <INDENT> self.app=app <NEW_LINE> if runningVersion is None: self.runningVersion=psychopy.__version__ <NEW_LINE> else: self.runningVersion=runningVersion <NEW_LINE> self.latest=None <NEW_LINE> if web.proxies is None: <NEW_LINE> <INDENT> web.setupProxy()
The updater will check for updates and download/install them if necess. Several dialogs may be created as needed during the process. Usage:: if app.prefs['AutoUpdate']: app.updates=Updater(app) app.updater.checkForUpdates()#if updates are found further dialogs will prompt
625941f30a50d4780f66749d
@hook.command("librefm", "librelast", "librenp", autohelp=False) <NEW_LINE> def librefm(text, nick, db, bot, notice): <NEW_LINE> <INDENT> dontsave = text.endswith(" dontsave") <NEW_LINE> if dontsave: <NEW_LINE> <INDENT> user = text[:-9].strip().lower() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> user = text <NEW_LINE...
[user] [dontsave] - displays the now playing (or last played) track of libre.fm user [user]
625941f344b2445a33932698
def update(self): <NEW_LINE> <INDENT> AnimationMixin.update(self)
updates fire's state (in this case, swaps out image for animation) also spawns fire statuses on anything that touches it :return: None
625941f3e5267d203edce29b
def test_dimes(): <NEW_LINE> <INDENT> test_path = tempfile.mkdtemp() <NEW_LINE> x_train, metadata = dimes(test_path) <NEW_LINE> try: <NEW_LINE> <INDENT> assert x_train.shape == (30, 2) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> shutil.rmtree(test_path) <NEW_LINE> raise()
Test module dimes.py by downloading dimes.csv and testing shape of extracted data has 30 rows and 2 columns
625941f3004d5f362079a935
def set_idle(self): <NEW_LINE> <INDENT> self.log("idle %s" % self.pos) <NEW_LINE> self.status = Status.Idle <NEW_LINE> self.data = None
helper function to idle the cart
625941f3cc0a2c11143dd498
def adiciona_aresta(self, a,peso): <NEW_LINE> <INDENT> if self.aresta_valida(a): <NEW_LINE> <INDENT> i_a1 = self.__indice_primeiro_vertice_aresta(a) <NEW_LINE> i_a2 = self.__indice_segundo_vertice_aresta(a) <NEW_LINE> if i_a1 < i_a2: <NEW_LINE> <INDENT> self.M[i_a1][i_a2] += peso <NEW_LINE> <DEDENT> else: <NEW_LINE> <I...
Adiciona uma aresta ao grafo no formato X-Y, onde X é o primeiro vértice e Y é o segundo vértice :param a: a aresta no formato correto :raise: lança uma exceção caso a aresta não estiver em um formato válido
625941f3a4f1c619b28b0630