code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def begin_create_or_update( self, resource_group_name, circuit_name, parameters, **kwargs ): <NEW_LINE> <INDENT> polling = kwargs.pop('polling', True) <NEW_LINE> cls = kwargs.pop('cls', None) <NEW_LINE> lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) <NEW_LINE> cont_token = kwargs.pop('conti...
Creates or updates an express route circuit. :param resource_group_name: The name of the resource group. :type resource_group_name: str :param circuit_name: The name of the circuit. :type circuit_name: str :param parameters: Parameters supplied to the create or update express route circuit operation. :type parameters:...
625941c5b57a9660fec3388d
def serialize(self, buff): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self.name <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <INDENT> _x = _x.encode('utf-8') <NEW_LINE> length = len(_x) <NEW_LINE> <DEDENT> if python3: <NEW_LINE> <INDENT> buff.write(struct.pack('<I%sB'%leng...
serialize message into buffer :param buff: buffer, ``StringIO``
625941c5e1aae11d1e749cc0
def compute_node_get_all_by_host(context, host): <NEW_LINE> <INDENT> return IMPL.compute_node_get_all_by_host(context, host)
Get compute nodes by host name :param context: The security context (admin) :param host: Name of the host :returns: List of dictionaries each containing compute node properties
625941c5d268445f265b4e79
def iterMonsters(self): <NEW_LINE> <INDENT> for monster in self.monsters: <NEW_LINE> <INDENT> yield monster
Generator for updating all monsters in list.
625941c51d351010ab855b27
def getHeaders(self, names = None): <NEW_LINE> <INDENT> return self.getAttributes(self.headers, names)
Get the headers of all the columns If names != None we only return the headers related to the specified names
625941c515baa723493c3f7f
@pick_context_manager_writer <NEW_LINE> def certificate_create(context, values): <NEW_LINE> <INDENT> certificate_ref = models.Certificate() <NEW_LINE> for (key, value) in values.items(): <NEW_LINE> <INDENT> certificate_ref[key] = value <NEW_LINE> <DEDENT> certificate_ref.save(context.session) <NEW_LINE> return certific...
Create a certificate from the values dictionary.
625941c5aad79263cf390a4a
def getMin(X, msg, fns, state, smanip=None): <NEW_LINE> <INDENT> if smanip is None: <NEW_LINE> <INDENT> smanip = StateManipulator() <NEW_LINE> <DEDENT> checkVectorSpace("X",X) <NEW_LINE> checkMessaging("msg",msg) <NEW_LINE> Optizelle.Unconstrained.Functions.checkT("fns",fns) <NEW_LINE> Optizelle.Unconstrained.State.che...
Solves an unconstrained optimization problem Basic solve: getMin(X,msg,fns,state) Solve with a state manipulator: getMin(X,msg,fns,state,smanip)
625941c556b00c62f0f14663
def isTearOffEnabled(self): <NEW_LINE> <INDENT> return False
isTearOffEnabled(self) -> bool
625941c556ac1b37e62641dd
def create_new_parameter_distribution_2(par_df, min_max_range): <NEW_LINE> <INDENT> new_par_df = par_df.copy() <NEW_LINE> new_par_df['new_min'] = new_par_df['value'].apply(lambda x: x - abs(x) * min_max_range) <NEW_LINE> new_par_df['new_max'] = new_par_df['value'].apply(lambda x: x + abs(x) * min_max_range) <NEW_LINE> ...
This method takes a par DataFrame and creates extra columns with new min/max ranges (but same std). Parameters ---------- par_df : PANDAS DataFrame DataFrame containing parsed par file. min_max_ratio : float ratio such that new max/min = par_value*(1 +/- min_max_ratio*sign(par_value)). Returns ------- new_pa...
625941c57d43ff24873a2caa
def comment_citations(plain_text): <NEW_LINE> <INDENT> p = "comment" + reg_ref + "-" + digit_dec <NEW_LINE> return [(start, end) for _, start, end in comment.scanString(plain_text)]
Return a list of pairs representing the start and end positions of internal_citations.
625941c563d6d428bbe444fa
def ExportTaskObjectAttach(self,pSelector): <NEW_LINE> <INDENT> pass
ExportTaskObjectAttach(self: CDelegateWrapper,pSelector: dotTaskObjectAttacher_t) -> (int,dotTaskObjectAttacher_t)
625941c550485f2cf553cda4
def set_utc_month_method(self, this, arguments): <NEW_LINE> <INDENT> return self.set_date_component(this, arguments, 2, local=False)
``Date.prototype.`` method implementation. 15.9.5.39
625941c563b5f9789fde70f0
def _get_vmedia_params(): <NEW_LINE> <INDENT> parameters_file = "parameters.txt" <NEW_LINE> vmedia_device_file = "/dev/disk/by-label/ir-vfd-dev" <NEW_LINE> if not os.path.exists(vmedia_device_file): <NEW_LINE> <INDENT> vmedia_device = _get_vmedia_device() <NEW_LINE> if not vmedia_device: <NEW_LINE> <INDENT> msg = "Unab...
This method returns the parameters passed through virtual media floppy. :returns: a partial dict of potential agent configuration parameters :raises: VirtualMediaBootError when it cannot find the virtual media device
625941c567a9b606de4a7ec5
def _remove_dv_tracking_code(self, tracking_code): <NEW_LINE> <INDENT> return '%s%s' % (tracking_code[:-3], tracking_code[-2:])
:param tracking_code: Código de rastreio com digito a ser removido :return: código de rastreio sem digito
625941c563f4b57ef0001127
def get_count( self, level: QueryLevel, node: Optional[DataNode] = None ) -> Optional[int]: <NEW_LINE> <INDENT> if level == QueryLevel.PATIENT: <NEW_LINE> <INDENT> assert node is None <NEW_LINE> return self.n_patients() <NEW_LINE> <DEDENT> elif level == QueryLevel.STUDY: <NEW_LINE> <INDENT> return self.n_studies(node) ...
Get number of nodes at the `level` in the subtree under `node`
625941c58e05c05ec3eea37e
def test_nullable_field(self): <NEW_LINE> <INDENT> field = fields.AdaptedDate('[key]', nullable=True) <NEW_LINE> value = field.deserialize({'key': None}) <NEW_LINE> self.assertTrue(value is None)
Test skipping validation when field is `None`.
625941c5009cb60464c633bd
def simulate(steps): <NEW_LINE> <INDENT> global start_time, time_simulation <NEW_LINE> start_time = datetime.datetime.now() <NEW_LINE> for step in xrange(steps): <NEW_LINE> <INDENT> nest.Simulate(dt) <NEW_LINE> initActivity() <NEW_LINE> updateDistanceAndCheck(step) <NEW_LINE> <DEDENT> time_simulation = datetime.datetim...
Simulation method
625941c516aa5153ce362483
def translate_lines(self, inp_lines, sess, inp_voc, out_voc, max_len=100): <NEW_LINE> <INDENT> state = sess.run(self.initial_state, {self.inp: inp_voc.to_matrix(inp_lines)}) <NEW_LINE> outputs = [[self.out_voc.bos_ix] for _ in range(len(inp_lines))] <NEW_LINE> all_states = [state] <NEW_LINE> finished = [False] * len(in...
Translates a list of lines by greedily selecting most likely next token at each step :returns: a list of output lines, a sequence of model states at each step
625941c599fddb7c1c9de39c
def _setup_project_path(self): <NEW_LINE> <INDENT> self.project_path = configurations.get_setting('Settings', 'ProjectPath') <NEW_LINE> self.default_path = self.project_path <NEW_LINE> self.projectPathLine.setText(self.project_path) <NEW_LINE> self.projectPathTool.clicked.connect(self.project_path_dialog)
Setup Project Path
625941c5fff4ab517eb2f446
def get_reversed_indices(indices): <NEW_LINE> <INDENT> indices.reverse() <NEW_LINE> [ind.reverse() for ind in indices] <NEW_LINE> return indices
Returns reversed list of indices. Each pair in the list is reversed, and the order of the pairs is also reversed.
625941c529b78933be1e56b9
def menu(item): <NEW_LINE> <INDENT> def decorator(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> g.menu = item <NEW_LINE> return f(*args, **kwargs) <NEW_LINE> <DEDENT> return wrapper <NEW_LINE> <DEDENT> return decorator
Sets the active menu item for a view function.
625941c5d58c6744b4257c6b
def adaugaTranzactie(lista,zi,suma,tip): <NEW_LINE> <INDENT> tr=creeazaTranzactie(zi,suma,tip) <NEW_LINE> validareTranzactie(tr) <NEW_LINE> adauga(lista,tr)
functia adauga o tranzactie cu ziua:zi,suma:suma si tipul:tip date ca parametru date in:lista,zi,suma,tip date out:-
625941c530c21e258bdfa4a7
@login_required <NEW_LINE> def new_topic(request): <NEW_LINE> <INDENT> if request.method != 'POST': <NEW_LINE> <INDENT> form = TopicForm() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> form = TopicForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> new_topic = form.save(commit=False) <NEW_LINE> new_to...
Add a new topic.
625941c59c8ee82313fbb77f
def setVisibilityNodes(val, nodeTypeNamesList): <NEW_LINE> <INDENT> pass
Set the visibility of the nodes in nodeTypeNamesList to val (either True or False). This affects the visibility of those nodes in editors.
625941c55510c4643540f3f2
def jsonizable_object(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> a = Article(self.url, language='es') <NEW_LINE> a.download() <NEW_LINE> a.parse() <NEW_LINE> text = a.text.replace('\n',' ') <NEW_LINE> text = text.replace('\t',' ') <NEW_LINE> image = a.top_image <NEW_LINE> publish_date = a.publish_date.strftime...
Return a JSON-serializable dict representing the result entry.
625941c5627d3e7fe0d68e5a
def get_argparser_ctor_args(): <NEW_LINE> <INDENT> return { 'prog': 'CodeChecker cmd', 'formatter_class': argparse.ArgumentDefaultsHelpFormatter, 'description': "The command-line client is used to connect to a " "running 'CodeChecker server' (either remote or " "local) and quickly inspect analysis results, such as " "r...
This method returns a dict containing the kwargs for constructing an argparse.ArgumentParser (either directly or as a subparser).
625941c515fb5d323cde0b19
def test_global_to_vertex(self, obj_test_geo): <NEW_LINE> <INDENT> attribs = obj_test_geo.globalAttribs() <NEW_LINE> geo = hou.Geometry() <NEW_LINE> pt1 = geo.createPoint() <NEW_LINE> pr1 = geo.createPolygon() <NEW_LINE> pr1.addVertex(pt1) <NEW_LINE> vtx1 = pr1.vertex(0) <NEW_LINE> houdini_toolbox.inline.api.batch_copy...
Test copying attribute values between a detail and a vertex.
625941c57d43ff24873a2cab
def test_plot_part_of(): <NEW_LINE> <INDENT> fout_log = "plot_relationship_part_of.log" <NEW_LINE> obj = _Run() <NEW_LINE> names = NAME2GOIDS <NEW_LINE> with open(fout_log, 'w') as prt: <NEW_LINE> <INDENT> for name in names: <NEW_LINE> <INDENT> goids = NAME2GOIDS[name] <NEW_LINE> obj.plot_all(goids, name, prt) <NEW_LIN...
Plot both the standard 'is_a' field and the 'part_of' relationship.
625941c55fdd1c0f98dc023e
@utils.arg('node', metavar='<node>', help=_('ID of the node to delete.')) <NEW_LINE> def do_baremetal_node_delete(cs, args): <NEW_LINE> <INDENT> node = _find_baremetal_node(cs, args.node) <NEW_LINE> cs.baremetal.delete(node)
Remove a baremetal node and any associated interfaces.
625941c599cbb53fe6792bf2
def gracefully_exit(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> confirmation = None <NEW_LINE> while confirmation not in ['y', 'n']: <NEW_LINE> <INDENT> confirmation = raw_input('Really quit? (y/n)').lower() <NEW_LINE> <DEDENT> if confirmation == 'y': <NEW_LINE> <INDENT> print() <NEW_LINE> skip_steps.interpret_text...
Handle forced quit
625941c5d8ef3951e3243548
def history(self): <NEW_LINE> <INDENT> return _blocks_swig3.moving_average_ss_sptr_history(self)
history(moving_average_ss_sptr self) -> unsigned int
625941c5460517430c394194
def device_manufacturer(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Property: Device Manufacturer
625941c599fddb7c1c9de39d
def collect_freqs_freqerr(self): <NEW_LINE> <INDENT> freqs = {} <NEW_LINE> freq_errs = {} <NEW_LINE> for label in self.det_labels: <NEW_LINE> <INDENT> freqs[label] = {} <NEW_LINE> freq_errs[label] = {} <NEW_LINE> for f in self.fkeys: <NEW_LINE> <INDENT> freqs[label][f] = np.array([i[label]['freq'][f] for i in self.shot...
Collect all frequencies and corresponding errorbars and return freqs and freq_err dictionaries
625941c53539df3088e2e355
def __del__(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for group in self.published.itervalues(): <NEW_LINE> <INDENT> group.Reset() <NEW_LINE> <DEDENT> <DEDENT> except dbus.exceptions.DBusException as e: <NEW_LINE> <INDENT> if e.get_dbus_name() != "org.freedesktop.DBus.Error.ServiceUnknown": <NEW_LINE> <INDENT>...
Remove all published records from mDNS.
625941c557b8e32f524834a5
def send_message(service, user_id, message): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> message = ( service.users().messages().send( userId=user_id, body=message).execute() ) <NEW_LINE> delete_message(service, user_id, message['id']) <NEW_LINE> return message <NEW_LINE> <DEDENT> except errors.HttpError as error: <NEW...
Send an email message. Args: service: Authorized Gmail API service instance. user_id: User's email address. The special value "me" can be used to indicate the authenticated user. message: Message to be sent. Returns: Sent Message.
625941c550812a4eaa59c32e
def clear(self): <NEW_LINE> <INDENT> self.my_text.delete(1.0, 'end')
Méthode permettant d'effacer le texte dans le widget text box
625941c5cad5886f8bd26fe5
def parse_format(self, event): <NEW_LINE> <INDENT> if self.is_blank(event): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> def format_date(): <NEW_LINE> <INDENT> date_format = DateFormat(self.string_in, self._locale) <NEW_LINE> return date_format.parse_format(date_format.get_date(event)) <NEW_LINE> <DEDENT> def format_...
Parse the event format string. let the date or place classes handle any sub-format strings
625941c52eb69b55b151c8b8
def delete_non_child_fields(self): <NEW_LINE> <INDENT> parent_only_fields = [ 'description', 'is_discountable', 'brand', 'activity',] <NEW_LINE> for field_name in parent_only_fields: <NEW_LINE> <INDENT> if field_name in self.fields: <NEW_LINE> <INDENT> del self.fields[field_name]
Deletes any fields not needed for child products. Override this if you want to e.g. keep the description field.
625941c5de87d2750b85fd9d
def __init__(self): <NEW_LINE> <INDENT> self.Bitrate = None <NEW_LINE> self.SamplingRate = None <NEW_LINE> self.Codec = None
:param Bitrate: Bitrate of audio stream in bps. Note: this field may return null, indicating that no valid values can be obtained. :type Bitrate: int :param SamplingRate: Sample rate of audio stream in Hz. Note: this field may return null, indicating that no valid values can be obtained. ...
625941c5f7d966606f6aa00e
def setUp(self): <NEW_LINE> <INDENT> super(CommerceConfigurationModelTests, self).setUp() <NEW_LINE> self.site = SiteFactory() <NEW_LINE> self.order_number = "TEST_ORDER_NUMBER"
Create CommerceConfiguration object
625941c597e22403b379cfa5
def module_ec2_describe_elastic_addresses(): <NEW_LINE> <INDENT> describe_elastic_addresses()
This function is used to describe ec2 network addresses. python3 weirdAAL.py -m ec2_describe_addresses -t demo
625941c5f8510a7c17cf9707
def nightly_check_periodic(sql_db_loc, table_name, column_name, time_column_name, expected_num, task_name): <NEW_LINE> <INDENT> utc_time_prev = (dt.datetime.utcnow() + dt.timedelta(days=-1)) <NEW_LINE> utc_time_prev = utc_time_prev.timestamp() <NEW_LINE> rowsQuery = ('select count(distinct %s) from %s where %s > %f ' %...
Compare the amount of data stored in the the previous day to desired amount. Send push notification with the result :param: sql_db_loc: location of the database file :type: sql_db_loc: string :param: table_name: name of table where the data is stored :type: table_name: string :param: column_name: name of the co...
625941c5a8370b77170528ab
def getlogger(): <NEW_LINE> <INDENT> LOGGER=None <NEW_LINE> if LOGGER is None: <NEW_LINE> <INDENT> LOGGER = logging.getLogger('producer') <NEW_LINE> if len(LOGGER.handlers)==0: <NEW_LINE> <INDENT> LOGGER.addHandler(logging.StreamHandler(sys.stdout)) <NEW_LINE> LOGGER.setLevel(logging.DEBUG) <NEW_LINE> <DEDENT> <DEDENT>...
Function getlogger gives the default logger to log the messages.
625941c5e8904600ed9f1f36
def get_keyword_search_json(self, keyword): <NEW_LINE> <INDENT> payload = {} <NEW_LINE> payload['q'] = keyword <NEW_LINE> json_r = self.get_arachne_json(payload) <NEW_LINE> return json_r
gets json data from Arachne in response to a keyword search
625941c52ae34c7f2600d13d
def test_create_user(self): <NEW_LINE> <INDENT> user = MagicMock() <NEW_LINE> user_manager = UserManager() <NEW_LINE> user_manager.model = MagicMock(return_value=user) <NEW_LINE> user_manager._db = "my_test_db" <NEW_LINE> return_user = user_manager.create_user( "test_username", "test_password", test_kwarg="test_kwarg" ...
Tests that create_user saves a new user with a set password.
625941c5507cdc57c6306ce3
def test_jlink_gpio_get_failure(self): <NEW_LINE> <INDENT> self.dll.JLINK_EMU_GPIO_GetState.return_value = -1 <NEW_LINE> with self.assertRaises(JLinkException): <NEW_LINE> <INDENT> self.jlink.gpio_get() <NEW_LINE> <DEDENT> with self.assertRaises(JLinkException): <NEW_LINE> <INDENT> self.jlink.gpio_get([1, 2, 3])
Tests when getting GPIO pin states returns an error. Args: self (TestJLink): the ``TestJLink`` instance Returns: ``None``
625941c523e79379d52ee570
def __init__(self, name=None, parent=None, slug=None): <NEW_LINE> <INDENT> self._name = None <NEW_LINE> self._parent = None <NEW_LINE> self._slug = None <NEW_LINE> self.name = name <NEW_LINE> if parent is not None: <NEW_LINE> <INDENT> self.parent = parent <NEW_LINE> <DEDENT> self.slug = slug
Data82 - a model defined in Swagger
625941c5ec188e330fd5a7ad
def test_reprANDstr(self): <NEW_LINE> <INDENT> sel = 'a > b + c' <NEW_LINE> s = css_parser.css.CSSStyleRule(selectorText=sel) <NEW_LINE> self.assertTrue(sel in str(s)) <NEW_LINE> s2 = eval(repr(s)) <NEW_LINE> self.assertTrue(isinstance(s2, s.__class__)) <NEW_LINE> self.assertTrue(sel == s2.selectorText)
CSSStyleRule.__repr__(), .__str__()
625941c521bff66bcd684960
def get_gain(self): <NEW_LINE> <INDENT> return self._gain
Get the gain
625941c556b00c62f0f14664
def change_password(email, password, new_password, new_password_confirm): <NEW_LINE> <INDENT> if password == new_password: <NEW_LINE> <INDENT> raise AssertionError('New and old passwords are identical') <NEW_LINE> <DEDENT> if len(new_password) < 8: <NEW_LINE> <INDENT> raise AssertionError('New password must be at least...
Changes password of user with specified email :param email: User email :param password: Old password :param new_password: New password :param new_password_confirm: New password confirmation
625941c560cbc95b062c654e
def __init__(self, r=0, g=0, b=0): <NEW_LINE> <INDENT> self._r = r <NEW_LINE> self._g = g <NEW_LINE> self._b = b
Construct self such that it has the given red (r), green (g), and blue (b) components.
625941c57b25080760e39465
def __copy(self, other): <NEW_LINE> <INDENT> copy = lambda items: [i.Update(text=self) for i in items] <NEW_LINE> self._digest = other._digest <NEW_LINE> self.uid = other.uid <NEW_LINE> self._segments = { ns: copy(segments) for ns, segments in other._segments.items() } <NEW_LINE> self._tokens = { ns: copy(tokens) for n...
Deepcopy helper.
625941c55fcc89381b1e16c9
def _get_register(self, cr, uid, ids, fields, args, context=None): <NEW_LINE> <INDENT> register_pool = self.pool.get('event.registration') <NEW_LINE> res = {} <NEW_LINE> for event in self.browse(cr, uid, ids, context=context): <NEW_LINE> <INDENT> res[event.id] = {} <NEW_LINE> for field in fields: <NEW_LINE> <INDENT> re...
Get Confirm or uncofirm register value. @param ids: List of Event registration type's id @param fields: List of function fields(register_current and register_prospect). @param context: A standard dictionary for contextual values @return: Dictionary of function fields value.
625941c550812a4eaa59c32f
def f1(M,N, do_print=True): <NEW_LINE> <INDENT> if do_print: <NEW_LINE> <INDENT> print("--- f1 ---") <NEW_LINE> <DEDENT> def NHR(M,N): <NEW_LINE> <INDENT> tot = 0 <NEW_LINE> for i in range(1,M+1): <NEW_LINE> <INDENT> for j in range(1,N+1): <NEW_LINE> <INDENT> tot += (M - i + 1) * (N - j + 1) <NEW_LINE> <DEDENT> <DEDENT...
First valid solution.
625941c515baa723493c3f80
def gen_raw_submission(file_name, pred_mat, curr_tourney_teams): <NEW_LINE> <INDENT> num_pairs = pred_mat.shape[0] <NEW_LINE> num_tourney_teams = curr_tourney_teams.shape[0] <NEW_LINE> num_tourney_pairs = (num_tourney_teams)*(num_tourney_teams-1)/2 <NEW_LINE> file_mat = numpy.zeros((num_tourney_pairs+1, 2), dtype=objec...
Generates raw submission file. Args: file_name: Name of raw submission file. pred_mat: Matrix of predictions, where first and second columns include IDs of distinct teams; each entry in third column is probability that team in first column defeats team in second column. Only uno...
625941c58e7ae83300e4afd8
def point_on_line(a, b, c, x0, y0): <NEW_LINE> <INDENT> nominator1 = b*(b*x0 - a*y0) - a*c <NEW_LINE> nominator2 = a*(-b*x0 + a*y0) - b*c <NEW_LINE> denominator = a**2 + b**2 <NEW_LINE> return nominator1/denominator, nominator2/denominator
projection of point (x0, y0) on line (ax + by + c = 0)
625941c5eab8aa0e5d26db63
def __new__(cls, extended_fields={}, **kwargs): <NEW_LINE> <INDENT> cls.fields = { 'id': HighriseField(type='id'), 'body': HighriseField(type=str), 'author_id': HighriseField(), 'subject_id': HighriseField(type=int), 'subject_type': HighriseField(type=str, options=('Party', 'Deal', 'Kase')), 'subject_name': HighriseFie...
Set object attributes for subclasses of Party (companies and people)
625941c5a05bb46b383ec82f
def _load_cameras(self, augmented_cameras_path=None): <NEW_LINE> <INDENT> self.cam_dict = cameras.load_cameras(self.cameras_fpath, self.all_subject_ids) <NEW_LINE> if augmented_cameras_path is not None: <NEW_LINE> <INDENT> aug_cams = load(augmented_cameras_path) <NEW_LINE> self.cam_dict.update(aug_cams) <NEW_LINE> <DED...
Loads camera parameters for each subject with each camera. Sets members: self.cam_dict: dictionary of 4 tuples per subject ID containing its camera parameters for the 4 h36m cams
625941c507f4c71912b1148d
def __init__(self, pagination=None, results=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration = Configuration() <NEW_LINE> <DEDENT> self.local_vars_configuration = local_vars_configuration <NEW_LINE> self._pagination = None <NEW_L...
InlineResponseDefault5 - a model defined in OpenAPI
625941c5d10714528d5ffced
def evaluationFunction(self, currentGameState, action): <NEW_LINE> <INDENT> successorGameState = currentGameState.generatePacmanSuccessor(action) <NEW_LINE> newPos = successorGameState.getPacmanPosition() <NEW_LINE> newFood = successorGameState.getFood() <NEW_LINE> newGhostStates = successorGameState.getGhostStates() <...
Design a better evaluation function here. The evaluation function takes in the current and proposed successor GameStates (pacman.py) and returns a number, where higher numbers are better. The code below extracts some useful information from the state, like the remaining food (newFood) and Pacman position after moving...
625941c5e5267d203edcdcaa
def _goToInitialState(self): <NEW_LINE> <INDENT> self.pxpyRoute = [] <NEW_LINE> self.directions = [] <NEW_LINE> self.set('midText', []) <NEW_LINE> self.durationString = None <NEW_LINE> self.start = None <NEW_LINE> self.destination = None <NEW_LINE> self.startAddress = None <NEW_LINE> self.destinationAddress = None <NEW...
restorer initial routing state -> used in init and when rerouting
625941c5fbf16365ca6f61cd
def scale_loss(self, factor): <NEW_LINE> <INDENT> self.acc_loss *= factor
Scale loss with a factor
625941c5fff4ab517eb2f447
@receiver(pre_save, sender=UserProfile) <NEW_LINE> def auto_delete_file_on_change(sender, instance, **kwargs): <NEW_LINE> <INDENT> if not instance.pk: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> old_file = UserProfile.objects.get(pk=instance.pk).avator <NEW_LINE> <DEDENT> except UserPr...
Deletes file from filesystem when corresponding `User` object is changed.
625941c50a366e3fb873e825
def get(self): <NEW_LINE> <INDENT> jwt_token = request.args.get("token", None) <NEW_LINE> try: <NEW_LINE> <INDENT> decoded_payload = decode_cognito_jwt(jwt_token) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> return 400 <NEW_LINE> <DEDENT> if decoded_payload is None: <NEW_LINE> <INDENT> return {"message", "...
Gets user info from an established session via Cognito jwt token
625941c53346ee7daa2b2d77
def test_layer_2(): <NEW_LINE> <INDENT> assert aoc_03.layer_no(2) == (1, 8, 9)
test_layer_2() Test that 1 is in the second layer, 1, and the last in layer is 9.
625941c5283ffb24f3c5590e
def cache(self, CachableItem): <NEW_LINE> <INDENT> _cachedItem = self.get(CachableItem) <NEW_LINE> if not _cachedItem: <NEW_LINE> <INDENT> _cachedItem = self.mapper.get(CachableItem) <NEW_LINE> self._add(_cachedItem) <NEW_LINE> logger.debug("new cachable item added to Splunk KV cache area {id: %s, type: %s}", str(_cach...
Updates caches area with latest item information returning ICachedItem if cache updates were required. Issues ICacheObjectCreatedEvent, and ICacheObjectModifiedEvent for ICacheArea/ICachableItem combo.
625941c5be383301e01b5494
def circles_area_union(circles, intersections=None, brute=False): <NEW_LINE> <INDENT> circs = np.asarray(circles) <NEW_LINE> if brute: <NEW_LINE> <INDENT> xc,yc,r = circs.T <NEW_LINE> def in_circs(x,y): <NEW_LINE> <INDENT> d = dist(x,y,xc,yc) <NEW_LINE> return any(d < r) <NEW_LINE> <DEDENT> xrange = [np.min(xc-r), np.m...
Compute the area of the union of an arbitrary number of circles. The function works by identifying points where circles intersect that are not inside any other circles. These define polygons with a circle segment extending beyond the end of each leg of the polygon. The polygon area and the areas of all the circular se...
625941c5a17c0f6771cbe05d
def cat(self, param, op): <NEW_LINE> <INDENT> pass
Parameters: - param - op
625941c5435de62698dfdc58
def get_heron_config(): <NEW_LINE> <INDENT> opt_list = [] <NEW_LINE> for (key, value) in config_opts.items(): <NEW_LINE> <INDENT> opt_list.append('%s=%s' % (key, value)) <NEW_LINE> <DEDENT> all_opts = (','.join(opt_list)).replace(' ', '%%%%') <NEW_LINE> return all_opts
Get config opts from the global variable :return:
625941c563b5f9789fde70f1
def adjust_font_size(layout, fd, constraint_x, constraint_y): <NEW_LINE> <INDENT> while (layout.get_size()[0] / pango.SCALE < constraint_x and layout.get_size()[1] / pango.SCALE < constraint_y): <NEW_LINE> <INDENT> fd.set_size(int(fd.get_size()*1.2)) <NEW_LINE> layout.set_font_description(fd) <NEW_LINE> <DEDENT> fd.set...
Grow the given font description (20% by 20%) until it fits in designated area and then draw it. Args: layout (pango.Layout): The text block parameters. fd (pango.FontDescriptor): The font object. constraint_x/constraint_y (numbers): The area we want to write into (cairo units).
625941c5bf627c535bc131db
def test_integers(self): <NEW_LINE> <INDENT> ints = self.bkp.parse('+800,-900234,0,27'.encode('ascii')) <NEW_LINE> self.assertTupleEqual(ints, (800, -900234, 0, 27))
Tests integer parsing
625941c5a4f1c619b28b0048
def pick_a_sport(self, sport_list): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> selection = input("Input sport number: ") <NEW_LINE> if selection == "0": <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> selected_sport = sport_list[int(selection)-1] <NEW_LINE> return selected_sport <NEW_LINE> <DED...
Lets you select a sport from the list above. Returns: selected sport object
625941c555399d3f055886bf
def get_player_stats(first_name: str, last_name: str) -> Dict: <NEW_LINE> <INDENT> players = PlayerHelper.find_players_by_full_name("{first_name} {last_name}".format( first_name=first_name, last_name=last_name )) <NEW_LINE> if len(players) > 1 : <NEW_LINE> <INDENT> logger.error("Multiple players found with the name - {...
Returns the stats for a player in standard format :param first_name: :param last_name: :return:
625941c5cc40096d6159595d
def fileoutput( files: FilesArg = None, char_mode: CharMode = None, linesep: CharMode = None, encoding: str = 'utf-8', file_output_type: Callable[..., FileOutput[CharMode]] = TeeFileOutput[CharMode], **kwargs) -> FileOutput[CharMode]: <NEW_LINE> <INDENT> if not files: <NEW_LINE> <INDENT> files = sys.argv[1:]...
Convenience function to create a fileoutput. Args: files: The files to write to. char_mode: The write mode ('t' or b'b'). linesep: The separator to use when writing lines. encoding: The default file encoding to use. file_output_type: The specific subclass of FileOutput to create. kwargs: additi...
625941c54f6381625f114a47
def test_is_multifile(tdef): <NEW_LINE> <INDENT> assert not tdef.is_multifile_torrent() <NEW_LINE> tdef.metainfo = {} <NEW_LINE> assert not tdef.is_multifile_torrent() <NEW_LINE> tdef.metainfo = {b'info': {b'files': [b'a']}} <NEW_LINE> assert tdef.is_multifile_torrent()
Test whether a TorrentDef is correctly classified as multifile torrent
625941c54e4d5625662d43e6
def get_time_domain(self): <NEW_LINE> <INDENT> x_axis = np.linspace(0, self.duration, len(self.freqs)) <NEW_LINE> y_axis = ifft(self.freqs).real <NEW_LINE> return x_axis, y_axis
Return a tuple (X,Y) where X is an array storing the time axis, and Y is an array storing time-domain representation of the signal
625941c591f36d47f21ac4fd
def load_embeddings(self, tokens: List[str] = None, specials: List[str] = None) -> Tuple[nn.Embedding, Vocab]: <NEW_LINE> <INDENT> emb = self.configs.embeddings <NEW_LINE> if not emb.pretrained: <NEW_LINE> <INDENT> assert emb.dim is not None <NEW_LINE> return nn.Embedding(self.vocab_size, emb.dim), None <NEW_LINE> <DED...
Load pre-trained embedding defined in dataset.embeddings :param tokens: if specified, only load embeddings of these tokens :param specials: special tokens :return:
625941c5ac7a0e7691ed40db
def get_issue_ids_from_list(self, data): <NEW_LINE> <INDENT> _xml_of_all_issues = xmltodict.parse(data.content)['issues']['issue'] <NEW_LINE> return {_xml_of_all_issues[item]['@entityId']: _xml_of_all_issues[item]['@id'] for item in range(len(_xml_of_all_issues))}
Returns dict of ids of the issues from xml data in pair key:value=entityId:id
625941c5fb3f5b602dac369e
def writePKA(protein, parameters, filename=None, conformation ='1A',reference="neutral", direction="folding", verbose=False, options=None): <NEW_LINE> <INDENT> verbose = True <NEW_LINE> if filename == None: <NEW_LINE> <INDENT> filename = "%s.pka" % (protein.name) <NEW_LINE> <DEDENT> file = open(filename, 'w') <NEW_LINE...
Write the pka-file based on the given protein
625941c59f2886367277a89a
def test_no_cambiaron_ext_clasificacion(self): <NEW_LINE> <INDENT> self.assertEqual(EXT_CLASIFICACION, ( ('GE', 'Generalizada (>75%)'), ('EX', 'Extensiva (35-74%)'), ('LO', 'Local (10-34%)'), ('PU', 'Puntual (<10%)'), ))
se verifica que nadie cambio ext_clasificacion
625941c5d6c5a10208144056
def close(self): <NEW_LINE> <INDENT> if not self.__opened: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> shelve.Shelf.close(self) <NEW_LINE> self.__opened = False <NEW_LINE> if self.__remove and os.path.exists(self.__filename): <NEW_LINE> <INDENT> if not self.__silent: <NEW_LINE> <INDENT> logger.info('REMOVING: ', sel...
Close the file (and gzip it if required)
625941c58da39b475bd64f7e
def __init__(self, logger, protocol_version) -> None: <NEW_LINE> <INDENT> RealtimeSituationMessages.__init__(self, logger, protocol_version) <NEW_LINE> ScratchpadStatusMessages.__init__(self, logger, protocol_version)
Initialization Args: logger (Logger): logger protocol_version (int): protocol version of authentication and metadata connection
625941c5a934411ee37516a0
def test_split(func_interface): <NEW_LINE> <INDENT> poly = numpoly.polynomial([[1, X, X**2], [X+Y, Y, Y]]) <NEW_LINE> part1, part2 = func_interface.split(poly, 2, axis=0) <NEW_LINE> assert_equal(part1, [[1, X, X**2]]) <NEW_LINE> assert_equal(part2, [[X+Y, Y, Y]]) <NEW_LINE> part1, part2, part3 = func_interface.split(po...
Tests for numpoly.split.
625941c510dbd63aa1bd2bb0
def get_session(self): <NEW_LINE> <INDENT> class session_context: <NEW_LINE> <INDENT> def __enter__(ctx): <NEW_LINE> <INDENT> self.session = self.Session() <NEW_LINE> return self.session <NEW_LINE> <DEDENT> def __exit__(ctx, exc_type, exc_val, exc_tb): <NEW_LINE> <INDENT> if exc_type is not None: <NEW_LINE> <INDENT> se...
Exposes an underlying database session as managed context
625941c5498bea3a759b9abc
def get_parts(line): <NEW_LINE> <INDENT> m = RE_PARTS.match(line) <NEW_LINE> try: <NEW_LINE> <INDENT> return m.group('Label'), m.group('Opcode'), m.group('Operands') <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return None
Break down an instruction into 3 parts: Label, Opcode, Operand
625941c5cdde0d52a9e5303e
def Quantized_ReLu(truncate = False): <NEW_LINE> <INDENT> def layer(x, dummy_parameters): <NEW_LINE> <INDENT> out = np.maximum(0,x) <NEW_LINE> cache = x <NEW_LINE> if truncate: <NEW_LINE> <INDENT> out = truncate_unsigned(x, truncate) <NEW_LINE> <DEDENT> return out, cache <NEW_LINE> <DEDENT> return layer
Implement the RELU function. Arguments: Z -- Output of the linear layer, of any shape Returns: A -- Post-activation parameter, of the same shape as Z cache -- a python dictionary containing "A" ; stored for computing the backward pass efficiently
625941c5442bda511e8be426
def list(self, filter = NotImplemented, pager = NotImplemented): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addObjectIfDefined("filter", filter) <NEW_LINE> kparams.addObjectIfDefined("pager", pager) <NEW_LINE> self.client.queueServiceActionCall("drm_drmprofile", "list", "KalturaDrmProfileListRespo...
List KalturaDrmProfile objects
625941c56aa9bd52df036daf
def split_key(self, key, n, k): <NEW_LINE> <INDENT> assert (n <= 10) <NEW_LINE> chunks = [c for c in key] <NEW_LINE> m = self.primes[:n] <NEW_LINE> M = prod(m[:k]) <NEW_LINE> assert (self.m0 * prod(m[-k + 1:]) < prod(m[:k])) <NEW_LINE> keys = [[mi] for mi in m] <NEW_LINE> for c in chunks: <NEW_LINE> <INDENT> A = random...
Klucz AES dzielony jest na 32 kawałki potem każdy kawałek jest zakodowany używając najmniejszych n liczb pierwszych y = x + A * m0 Key i = [mi, y for kawałek 1, ... , y for kawałek 32]
625941c56aa9bd52df036db0
def validate_positive_integer_or_none(option: str, value: Any) -> Optional[int]: <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> return validate_positive_integer(option, value)
Validate that 'value' is a positive integer or None.
625941c5c432627299f04c51
def clean(my_string): <NEW_LINE> <INDENT> p = re.compile('[0-9]') <NEW_LINE> stop_free = ' '.join(i for i in my_string.lower().split() if i not in stop) <NEW_LINE> numb_free = ''.join(i for i in stop_free if not p.match(i)) <NEW_LINE> punc_free = ''.join(i for i in numb_free if i not in exclude) <NEW_LINE> normalized =...
Clean a string. This function cleans a string, not a file.
625941c5b545ff76a8913e23
def write_4bit_ckt(self, bits, thetas): <NEW_LINE> <INDENT> assert len(bits) == 4 <NEW_LINE> assert len(thetas) == 3 <NEW_LINE> assert bits[0] < bits[1] < bits[2] < bits[3] <NEW_LINE> for theta_index in range(0, 3): <NEW_LINE> <INDENT> theta = ut.centered_rads(thetas[theta_index]) <NEW_LINE> if theta_index == 1: <NEW_L...
This function writes, without the left and right endcaps, a gate representing exp(i sum_{k1 < k2 < k3 < k4} theta_0(k1, k2, k3, k4) a^\dag(k1) a^\dag(k2) a(k3) a(k4) + h.c. theta_1(k1, k2, k3, k4) a^\dag(k1) a(k2) a^\dag(k3) a(k4) + h.c. theta_2(k1, k2, k3, k4) a^\dag(k1) a(k2) a(k3) a^\dag(k4) + h.c. Par...
625941c58e71fb1e9831d7b6
def Rear(self): <NEW_LINE> <INDENT> if self.l: <NEW_LINE> <INDENT> return self.a[(self.r-1) % self.k] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return -1
Get the last item from the queue. :rtype: int
625941c5d268445f265b4e7b
def get_preferred_environment_encoding(): <NEW_LINE> <INDENT> return ( locale.getpreferredencoding() or 'utf-8' )
Get encoding that should be used for decoding environment variables
625941c507d97122c4178895
def get(self, primary_name, key): <NEW_LINE> <INDENT> raise NotImplementedError
Get a single record. :param str primary_name: The name of the primary key. :param key: The value of the primary key.
625941c5627d3e7fe0d68e5b
def dequeue(self): <NEW_LINE> <INDENT> assert not self.is_empty() <NEW_LINE> high = self._qlist[0] <NEW_LINE> count = 0 <NEW_LINE> for i in range(0, len(self)): <NEW_LINE> <INDENT> if self._qlist[i].priority > high.priority: <NEW_LINE> <INDENT> high = self._qlist[i] <NEW_LINE> count = i <NEW_LINE> <DEDENT> <DEDENT> ret...
遍历元素, 找到最高优先级 :return:
625941c51d351010ab855b29
def __null_callback(self): <NEW_LINE> <INDENT> pass
Does nothing, should be overridden
625941c5be8e80087fb20c51
def test_get_tool_dependencies(self): <NEW_LINE> <INDENT> self.api.get_tool_dependencies()
Test case for get_tool_dependencies Get tool dependencies # noqa: E501
625941c50383005118ecf5f0
def is_file(package): <NEW_LINE> <INDENT> if hasattr(package, 'keys'): <NEW_LINE> <INDENT> return any(key for key in package.keys() if key in ['file', 'path']) <NEW_LINE> <DEDENT> if os.path.exists(str(package)): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> for start in SCHEME_LIST: <NEW_LINE> <INDENT> if str(pa...
Determine if a package name is for a File dependency.
625941c5046cf37aa974cd56
@graft(namespace='gateways') <NEW_LINE> def gateways_info(): <NEW_LINE> <INDENT> data = netifaces.gateways() <NEW_LINE> results = {'default': {}} <NEW_LINE> with suppress(KeyError): <NEW_LINE> <INDENT> results['ipv4'] = data[netifaces.AF_INET] <NEW_LINE> results['default']['ipv4'] = data['default'][netifaces.AF_INET] <...
Returns gateways data.
625941c567a9b606de4a7ec8
def __init__(self, model_config_name, model_specific_pa_params, non_gpu_data): <NEW_LINE> <INDENT> self._model_config_name = model_config_name <NEW_LINE> self._model_specific_pa_params = model_specific_pa_params <NEW_LINE> self._non_gpu_data = non_gpu_data <NEW_LINE> self._non_gpu_data_from_tag = { type(metric).tag: me...
model_config_name : string The model config name that was used in the RunConfig model_specific_pa_params: dict Dictionary of PA parameters that can change between models in a multi-model RunConfig non_gpu_data : list of Records Metrics that do not have a GPU UUID associated with them, from either CP...
625941c5e1aae11d1e749cc3