code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def time_function(func2time, n): <NEW_LINE> <INDENT> tStart = time.time() <NEW_LINE> func2time(n) <NEW_LINE> elapsed = time.time() - tStart <NEW_LINE> return elapsed
Computation time test for any function 'func2time' that takes one positional argument 'n'. Used here for factorial and factorial_recursive.
625941efd18da76e23532a55
def plot_histogram(data_series, data_labels, file_name, data_colors=None, figure_title='', figure_text='', file_ext='.png'): <NEW_LINE> <INDENT> if data_colors == None: <NEW_LINE> <INDENT> data_colors = 'k' * len(data_labels) <NEW_LINE> <DEDENT> if figure_title == '': <NEW_LINE> <INDENT> figure_title = file_name <NEW_L...
Takes a data series and plots the count of each event given in data labels list. The plot is saved to file. :param title: string :param data_series: a list of values. Type of values must match elements in data labels. :param data_labels: list of values. Types must match elements in the data series. :...
625941efcc40096d61595ec6
def attach_lines(self, lines_list): <NEW_LINE> <INDENT> lines = lines_list.by_nodes[self.node_from_code, self.node_to_code] <NEW_LINE> if lines: <NEW_LINE> <INDENT> self.lines += lines <NEW_LINE> <DEDENT> lines = lines_list.by_nodes[self.node_to_code, self.node_from_code] <NEW_LINE> if lines: <NEW_LINE> <INDENT> self.l...
attach lines group
625941ef435de62698dfe1c5
def votesrv_bizdev(sql): <NEW_LINE> <INDENT> db = cx_Oracle.connect("votesrvuser/votesrvuser@10.10.11.82:1521/BIZDEV") <NEW_LINE> cr = db.cursor() <NEW_LINE> try: <NEW_LINE> <INDENT> cr.execute(sql) <NEW_LINE> if re.search('SELECT',sql[0:6],re.I): <NEW_LINE> <INDENT> return cr.fetchall() <NEW_LINE> <DEDENT> <DEDENT> fi...
基础服务库BIZDEV "votesrvuser/votesrvuser@10.10.11.82:1521/BIZDEV"
625941efbe7bc26dc91cdb6d
def cache_num(key: str, cache: str = None) -> Optional[int]: <NEW_LINE> <INDENT> pass
Gets the 64bit number from the specified item. * http://uwsgi.readthedocs.io/en/latest/Changelog-1.9.9.html#math-for-cache :param key: The cache key to get value for. :param cache: Cache name with optional address (if @-syntax is used).
625941ef4f6381625f114fb3
def getMaxBirthProb(self): <NEW_LINE> <INDENT> maxprob = self.maxBirthProb <NEW_LINE> return maxprob
Returns the max birth probability.
625941ef3cc13d1c6d3c78ef
def test_write(self): <NEW_LINE> <INDENT> class FakeStats(object): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> stats = FakeStats() <NEW_LINE> stats.save = mock.Mock() <NEW_LINE> config = {} <NEW_LINE> ctx = self.create_ctx() <NEW_LINE> o = FileOutput(config) <NEW_LINE> o.write(ctx, stats) <NEW_LINE> stats.save.assert_...
Tests for the write method
625941ef046cf37aa974d2b9
def test_colors(): <NEW_LINE> <INDENT> data = [(random.random(), random.random(), random.random()) for x in range(1000)] <NEW_LINE> test_data = [(random.random(), random.random(), random.random()) for x in range(1000)] <NEW_LINE> som = BasicSOM(data, 20, 20, init_variance=10) <NEW_LINE> som.train(iterations=1000) <NEW_...
Quickly tests the SOMS for uniformly distributed random data in three dimensions. They are represented as colors.
625941ef45492302aab5e841
def __str__(self): <NEW_LINE> <INDENT> return "Http client unavailable - %s" % self.message
Returns the string representation of the class. @rtype: String @return: The string representation of the class.
625941ef21bff66bcd684ec5
def items(self): <NEW_LINE> <INDENT> return self.__dict__.items()
Returns a list of the key-value pairs.
625941efa05bb46b383ecd94
def __init__(self, osc_server_port=None): <NEW_LINE> <INDENT> self._account_utils = None <NEW_LINE> self.merged_logs = {} <NEW_LINE> self.last_roll_activity = None <NEW_LINE> self.osc_app_client = None <NEW_LINE> if osc_server_port is not None: <NEW_LINE> <INDENT> self.osc_app_client = OscAppClient('localhost', osc_ser...
Set `osc_server_port` to enable UI synchronization with service.
625941ef9f2886367277ae01
def accept(self): <NEW_LINE> <INDENT> self.jig.try_rename(self.nameLineEdit.text()) <NEW_LINE> self.jig.assy.w.win_update() <NEW_LINE> self.jig.assy.changed() <NEW_LINE> QDialog.accept(self)
Slot for the 'OK' button
625941ef656771135c3ebdee
def StopNow(self): <NEW_LINE> <INDENT> self.stop()
stop motor as soon as possible
625941ef462c4b4f79d1dc47
def testSetupTwice(self): <NEW_LINE> <INDENT> self.op.EraserLabelValue.setValue(255) <NEW_LINE> self.testOutput()
If one of the inputs to the label array is changed, the output should not change (including max label value!)
625941efa17c0f6771cbe5c7
@bp.route('/category', methods=['POST']) <NEW_LINE> def category(): <NEW_LINE> <INDENT> data = request.get_json() <NEW_LINE> user_id = data.get('id') <NEW_LINE> category = data.get('category') <NEW_LINE> datein = data.get('datein') <NEW_LINE> dateout = data.get('dateout') <NEW_LINE> transaction = Transactions.query.fil...
Retorna transações por categoria e um intervalo de tempo
625941efbde94217f3683364
def __eval_fimpl(self,u,t): <NEW_LINE> <INDENT> tmp = fenics_mesh(self.V) <NEW_LINE> tmp.values = df.Function(self.V,-1.0*self.nu*self.K*u.values.vector()) <NEW_LINE> fimpl = self.__invert_mass_matrix(tmp) <NEW_LINE> return fimpl
Helper routine to evaluate the implicit part of the RHS Args: u: current values t: current time (not used here) Returns: implicit part of RHS
625941ef377c676e9127271f
def NonConstPointer(self): <NEW_LINE> <INDENT> pass
NonConstPointer(self: ClassArrayOnObjRef) -> IntPtr Gets the non-const pointer (for modification) of this array. Returns: The non-const pointer.
625941ef1f5feb6acb0c50c1
def optimize(self, start_values, experimental_data, simulation_processor=None, **opt_keywords): <NEW_LINE> <INDENT> parameters = lmfit.Parameters() <NEW_LINE> for i in range(len(self.cell_modeller.optimizer_boundaries())): <NEW_LINE> <INDENT> parameters.add('transformation' + str(i), value=start_values[i], min=self.cel...
Run an optimization. Parameters ---------- **opt_keywords All keyword arguments are passed to lmfits lbfgsb method. Returns ------- result : tuple (array of optimized parameters, RMSD) The result of the optimization. Notes ----- Use with epsilon=1e-3, or a value suiting your needs, depending on what you are o...
625941efc432627299f051c2
def peek(self): <NEW_LINE> <INDENT> if self.top: <NEW_LINE> <INDENT> return self.top.value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise IndexError('peek from empty stack')
Return the value from the top of the stack without removing it. Time: O(1)
625941effff4ab517eb2f9b8
def RegressorHyperParameterSearch(x,y,folds = 5): <NEW_LINE> <INDENT> params = { 'lr': [0.001,0.005, 0.01, 0.05, 0.1, 0.2, 0.3], 'max_epochs': list(range(500,5500,500))} <NEW_LINE> num_folds = 5 <NEW_LINE> min_error = 1e7 <NEW_LINE> best_lr = 0 <NEW_LINE> best_epoch = 0 <NEW_LINE> kfold = KFold(n_splits = num_folds) <N...
Performs a hyper-parameter for fine-tuning the regressor implemented in the Regressor class. Arguments: Add whatever inputs you need. Returns: The function should return your optimised hyper-parameters.
625941efbe8e80087fb211b2
def mb_n_bl(n_tr): <NEW_LINE> <INDENT> return n_tr * (n_tr-1) / 2
Returns number of baselines, based on given number of tracks
625941efa8370b7717052e16
def should_update(u_from, u_to): <NEW_LINE> <INDENT> my_version = LooseVersion(u_from) <NEW_LINE> proposed_version = LooseVersion(u_to) <NEW_LINE> return proposed_version > my_version
Compare the versions and tell if u_to is newer than u_from.
625941ef73bcbd0ca4b2c5ee
def setup_job_logging(job_id): <NEW_LINE> <INDENT> process_name = multiprocessing.current_process().name <NEW_LINE> mdc = java.jclass('MDC') <NEW_LINE> mdc.put('job_id', job_id) <NEW_LINE> mdc.put('processName', process_name) <NEW_LINE> logs.AMQPHandler.MDC['job_id'] = job_id <NEW_LINE> logs.AMQPHandler.MDC['processNam...
Make job id and process name available to the Java and Python loggers
625941efb7558d58953c5480
def set_filter(self, wfs_filter): <NEW_LINE> <INDENT> if wfs_filter.count("(") != wfs_filter.count(")"): <NEW_LINE> <INDENT> raise Exception( "Anzahl der öffnenden und schließenden Klammern unterscheidet sich") <NEW_LINE> <DEDENT> self._wfs_filter = "<ogc:Filter>" + self.__to_filter(wfs_filter) + "</ogc:Filt...
Setzt einen Filter :param wfs_filter: Filter im Excelstyle UND(GLEICH(vnk, "123456789"),GROESSERGLEICH(BST, "5") Werte sind immer anzugeben in "" (auch Zahlen) Felder ohne Funktionen: UND, ODER, KLEINER, KLEINERGLEICH, GROESSER, GROESSERGLEICH, GLEICH, NIC...
625941ef66673b3332b92609
def test_queue_res_release_upon_suspension(self): <NEW_LINE> <INDENT> attr = {ATTR_RESC_TYPE: 'long', ATTR_RESC_FLAG: 'q'} <NEW_LINE> self.server.manager(MGR_CMD_CREATE, RSC, attr, id='foo') <NEW_LINE> self.server.manager(MGR_CMD_CREATE, RSC, attr, id='bar') <NEW_LINE> a = {ATTR_restrict_res_to_release_on_suspend: 'ncp...
Create 2 consumable resources and set it on queue, set one of those resouces in restrict_res_to_release_on_suspend, submit a job requesting these resources, check if the resource set in restrict_res_to_release_on_suspend shows up as released on the queue
625941efbaa26c4b54cb1692
def svn_io_sleep_for_timestamps(*args): <NEW_LINE> <INDENT> return _core.svn_io_sleep_for_timestamps(*args)
svn_io_sleep_for_timestamps(char const * path, apr_pool_t pool)
625941ef29b78933be1e5c1d
def credentials(): <NEW_LINE> <INDENT> username = os.environ.get('OS_USERNAME') <NEW_LINE> password = os.environ.get('OS_PASSWORD') <NEW_LINE> tenant_name = os.environ.get('OS_TENANT_NAME') <NEW_LINE> auth_url = os.environ.get('OS_AUTH_URL') <NEW_LINE> config = six.moves.configparser.RawConfigParser() <NEW_LINE> if con...
Retrieves credentials to run functional tests Credentials are either read from the environment or from a config file ('functional_creds.conf'). Environment variables override those from the config file. The 'functional_creds.conf' file is the clean and new way to use (by default tox 2.0 does not pass environment vari...
625941ef07f4c71912b119fd
def to_section(self, ignore_keys = []): <NEW_LINE> <INDENT> special_keys = {'id': 'ID', 'uuid': 'UUID', 'jdbc': 'JDBC', 'direct_io': 'DirectIO', 'ssh_port': 'SSHPort', 'bucketfs': 'BucketFS'} <NEW_LINE> def to_camelcase(key): <NEW_LINE> <INDENT> if key in special_keys: <NEW_LINE> <INDENT> return special_keys[key] <NEW_...
Returns a dictionary with all members converted so it can be assigned to a ConfigObj section.
625941efe64d504609d74db8
def f8(self, n=10**8): <NEW_LINE> <INDENT> def is_valid(N, pdict): <NEW_LINE> <INDENT> for d in range(1, int(math.sqrt(N))+1): <NEW_LINE> <INDENT> if not N % d and (d + N/d) not in pdict: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return True <NEW_LINE> <DEDENT> composites = {} <NEW_LINE> pdict = {2:...
Go back to semi brute force, with some optimizations.
625941ef07d97122c4178e11
def fail(msg, required=True): <NEW_LINE> <INDENT> sys.stdout.write(' ' + msg + '\n') <NEW_LINE> if required: <NEW_LINE> <INDENT> sys.exit(1)
Print an error message and exit
625941efe8904600ed9f24af
def plot_energy(self, color_classes=True): <NEW_LINE> <INDENT> fig, ax = plt.subplots() <NEW_LINE> if color_classes: <NEW_LINE> <INDENT> short = self._df['T90'] < 2. <NEW_LINE> ax.scatter( self._df['T90'][short], self._df['energy HR'][short], c='#e41a1c', label='sGRBs', alpha=0.8) <NEW_LINE> ax.scatter( self._df['T90']...
Plot the HR vs T90 for energy :param color_classes: (bool) color the classes separately
625941efcb5e8a47e48b8019
def _validated(self, value): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if isinstance(value, uuid.UUID): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return uuid.UUID(value) <NEW_LINE> <DEDENT> except (ValueError, AttributeError): <NEW_LINE...
Format the value or raise a :exc:`ValidationError` if an error occurs.
625941efa79ad161976cc6be
@view.command(name=cmd_contourmap['name'], short_help=cmd_contourmap['desc']) <NEW_LINE> @add_argument('files', type=click.Path(exists=True), nargs=-1) <NEW_LINE> @add_option('-o', '--save_fig', type=click.Path(), default=None, help='Save figure to path. (None)') <NEW_LINE> @add_option('-l', '--label', type=click.Choic...
Draw contour maps of the data in FILES. The contour levels are by default chosen automatically, but can be controlled by setting the number of lines to draw or by supplying limits for curves to be drawn within. Additionally the curve levels can be supplied explicitly. Note that this option overrides both the input lim...
625941efbf627c535bc13748
@response_result(method='POST') <NEW_LINE> def photo_upload(request, user): <NEW_LINE> <INDENT> if not request.body: <NEW_LINE> <INDENT> return HttpResponseBadRequest() <NEW_LINE> <DEDENT> name_photo = request.GET.get('name') <NEW_LINE> border_color = request.GET.get('border-color') <NEW_LINE> alpha = request.GET.get('...
Загрузить фото
625941ef0a50d4780f66740f
def isPalindrome(self, x): <NEW_LINE> <INDENT> if x < 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> a, res = x, 0 <NEW_LINE> while a > 0: <NEW_LINE> <INDENT> res = res * 10 + a % 10 <NEW_LINE> a /= 10 <NEW_LINE> <DEDENT> if res == x: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
:type x: int :rtype: bool
625941ef596a89723608a031
def flatten(d, parent_key='', sep='_'): <NEW_LINE> <INDENT> items = [] <NEW_LINE> for k, v in d.items(): <NEW_LINE> <INDENT> new_key = parent_key + sep + k if parent_key else k <NEW_LINE> if isinstance(v, dict): <NEW_LINE> <INDENT> items.extend(flatten(v, new_key, sep=sep).items()) <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
Flatten multi-layer dictionary. From: https://stackoverflow.com/questions/6027558/
625941ef1f037a2d8b946775
def get_host_settings(self): <NEW_LINE> <INDENT> return [ { 'url': "http://{server}.swagger.io:{port}/v2", 'description': "petstore server", 'variables': { 'server': { 'description': "No description provided", 'default_value': "petstore", 'enum_values': [ "petstore", "qa-petstore", "dev-petstore" ] }, 'port': { 'descri...
Gets an array of host settings :return: An array of host settings
625941efadb09d7d5db6cd05
def clear_labels(self): <NEW_LINE> <INDENT> if len(self.label_actors) == 0: <NEW_LINE> <INDENT> self.log.warning('No actors to clear') <NEW_LINE> return <NEW_LINE> <DEDENT> icase = self.icase <NEW_LINE> if icase not in self.label_actors: <NEW_LINE> <INDENT> self.log.warning('No actors to clear') <NEW_LINE> return <NEW_...
This clears out all labels from all result cases.
625941ef187af65679ca5698
def _historyRangeTIDs(self, rtids): <NEW_LINE> <INDENT> tids = set() <NEW_LINE> last_end = -1 <NEW_LINE> for mtid in sorted(rtids): <NEW_LINE> <INDENT> if mtid[0] < last_end: <NEW_LINE> <INDENT> msg = _('Skipping merged transaction %d to %d, as it overlaps') <NEW_LINE> logger.warning(msg, mtid[0], mtid[1]) <NEW_LINE> c...
Convert a list of ranged tid typles into all the tids needed, Eg. [(2,4), (6,8)] == [2, 3, 4, 6, 7, 8].
625941ef5f7d997b87175015
def ban_zone(self, x, z, r): <NEW_LINE> <INDENT> self._bannedZoneX += list(x) <NEW_LINE> self._bannedZoneZ += list(z) <NEW_LINE> self._bannedZoneR += list(r) <NEW_LINE> self._counter += 1
every time rabbit is spawned we should ban it's coordinates for other rabbits :param x: int or list :param z: int or list :param r: int or list
625941ef3539df3088e2e8c4
def read_data(filename): <NEW_LINE> <INDENT> data = [] <NEW_LINE> spanish_words = set(stopwords.words('spanish')) <NEW_LINE> x = 0 <NEW_LINE> with zipfile.ZipFile(filename) as f: <NEW_LINE> <INDENT> with f.open(f.namelist()[0]) as d: <NEW_LINE> <INDENT> for i, line in enumerate(d): <NEW_LINE> <INDENT> text = tf.compat....
Extract the first file enclosed in a zip file as a list of words.
625941eff8510a7c17cf9c79
def get_kubeconfig(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = _kubectl(["config", "view", "-o", "json", "--raw"]) <NEW_LINE> kubeconfig = json.dumps(json.loads(result)) <NEW_LINE> action_set({"kubeconfig": kubeconfig}) <NEW_LINE> <DEDENT> except json.JSONDecodeError as e: <NEW_LINE> <INDENT> action_fail("...
Read the kubeconfig on the master and return it as JSON
625941ef01c39578d7e753b4
def build_plan(self, build_id): <NEW_LINE> <INDENT> return self.get_build_plan(build_id)
Leaving this here for backwards compatibility.
625941ef57b8e32f52483a17
def export(ignore_obsolete=False, export_utf8=False): <NEW_LINE> <INDENT> pass
Export this PO file as string. :param ignore_obsolete: Whether the exported PO file does not have obsolete entries. :param export_utf8: Whether the exported PO file should be exported as UTF-8.
625941ef711fe17d825428d7
def contact_view(request): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> form = ContactForm() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> form = ContactForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> subject = form.cleaned_data['subject'] <NEW_LINE> email = form.cleaned_dat...
Accepts GET and POST requests and returns the corresponding template. For POST requests, contact_view() will check form validity, send an email to the given email address, and redirect the user to the 'success' page. In the case of a GET request, contact_view() will load a blank form for the user. :param request: ...
625941efff9c53063f47c769
def filter(self, match): <NEW_LINE> <INDENT> yield match
Perform some post-processing on matched lines, and iterate over result. Iterate over resulting objects. In particular, it can iterate zero objects (to discard argument), or iterate over several objects (if argument corresponds to several objects). This function is to be overloaded, if necessary, by subclasses.
625941ef3d592f4c4ed1d5d7
def __int__(self,*args): <NEW_LINE> <INDENT> pass
__int__(x: UInt64) -> int
625941ef566aa707497f4ad9
@users.route('/users/<int:user_id>', methods=['PUT']) <NEW_LINE> @auto.doc(groups=['users']) <NEW_LINE> def put_user(user_id: int): <NEW_LINE> <INDENT> (data, errors) = user_validate() <NEW_LINE> if errors: <NEW_LINE> <INDENT> return resp(400, {"errors": errors}) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> num_updated...
Изменить информацио о Пользователе. :param user_id: Идентификатор пользователя :return: Пустой словарь {} при успехе, иначе Возникшие ошибки
625941efd7e4931a7ee9e498
def en(self,k): <NEW_LINE> <INDENT> return -2 * (np.cos(2*pi*k[0]) + np.cos(2*pi*k[1]) + np.cos(2*pi*(k[1]-k[0])))
Energy dispersion
625941efb5575c28eb68e57e
def test_kazeeki(self): <NEW_LINE> <INDENT> pipe_name = "kazeeki" <NEW_LINE> pipeline = self._get_pipeline(pipe_name) <NEW_LINE> example = { "description": ( "We are looking for freelancers ( individuals and companies ) " "who offer their services related to Architecture Walkthrough " "and 3D animations. Please conside...
Tests the kazeeki pipeline
625941ef3346ee7daa2b32ea
def template(func): <NEW_LINE> <INDENT> codes = [] <NEW_LINE> codes.append(func['main']) <NEW_LINE> select = Selector(func['name']) <NEW_LINE> for key in func['templates']: <NEW_LINE> <INDENT> f = func['templates'][key] <NEW_LINE> code = subtemplate(name=func['name'], top=f['top'], loop=f['loop'], axisNone=f['axisNone'...
Convert template dictionary `func` to a pyx file.
625941ef566aa707497f4ada
def assert_compatible(spec, value): <NEW_LINE> <INDENT> def validate_spec(s, v): <NEW_LINE> <INDENT> if not isinstance(s, tf.TensorSpec): <NEW_LINE> <INDENT> raise TypeError('Each value in `spec` must be a tf.TensorSpec.') <NEW_LINE> <DEDENT> return s.is_compatible_with(v) <NEW_LINE> <DEDENT> compatible = tf.nest.map_s...
Asserts that values are compatible with given specs. Args: spec: A structure compatible with `tf.nest`, with `tf.TensorSpec` values. value: A collection of values that should be compatible with `spec`. Must be the same structure as `spec`. Raises: TypeError: If `spec` does not contain only `tf.TensorSpec` o...
625941ef796e427e537b0b43
def assert_contains_tlv(tlvs, check_type, tlv_type): <NEW_LINE> <INDENT> tlvs = [tlv for tlv in tlvs if isinstance(tlv, tlv_type)] <NEW_LINE> if check_type is CheckType.CONTAIN: <NEW_LINE> <INDENT> assert tlvs <NEW_LINE> return tlvs[0] <NEW_LINE> <DEDENT> elif check_type is CheckType.NOT_CONTAIN: <NEW_LINE> <INDENT> as...
Assert a tlv list contains specific tlv and return the first qualified.
625941ef07d97122c4178e12
def new_navpoint(self, node, level, incr=True): <NEW_LINE> <INDENT> if incr: <NEW_LINE> <INDENT> self.playorder += 1 <NEW_LINE> <DEDENT> self.tocid += 1 <NEW_LINE> return NavPoint('navPoint%d' % self.tocid, self.playorder, node['text'], node['refuri'], [])
Create a new entry in the toc from the node at given level.
625941efad47b63b2c50a4f8
def _filter(self, FT): <NEW_LINE> <INDENT> filterSize = numpy.max(self._mysize) <NEW_LINE> pin=filters.makeRadialMatrix(matrixSize=filterSize, center=(0,0), radius=1.0) <NEW_LINE> pin[int(filterSize / 2)][int(filterSize / 2)] = 0.00000001 <NEW_LINE> FT = numpy.multiply(FT,(pin) ** self.noiseFractalPower) <NEW_LINE> if ...
Helper function to apply Butterworth filter in frequensy domain.
625941ef57b8e32f52483a18
def _make_complex(self): <NEW_LINE> <INDENT> rcomplex_coeffs = _shtools.SHrtoc(self.coeffs, convention=1, switchcs=0) <NEW_LINE> complex_coeffs = _np.zeros((2, self.lmax+1, self.lmax+1), dtype=_np.complex128) <NEW_LINE> complex_coeffs[0, :, :] = (rcomplex_coeffs[0, :, :] + 1j * rcomplex_coeffs[1, :, :]) <NEW_LINE> comp...
Convert the real SHCoeffs class to the complex class.
625941ef66673b3332b9260a
def testCrossBorderQuotesResponseLineRates(self): <NEW_LINE> <INDENT> inst_req_only = self.make_instance(include_optional=False) <NEW_LINE> inst_req_and_optional = self.make_instance(include_optional=True)
Test CrossBorderQuotesResponseLineRates
625941efd4950a0f3b08c8c0
def test_to_string(self): <NEW_LINE> <INDENT> sd = data_io.StackDatum(0, ('A', 'B')) <NEW_LINE> expected = self.standard_field <NEW_LINE> actual = str(sd) <NEW_LINE> self.assertEqual(expected, actual, msg='Expected {}, got {}' .format(expected, actual))
Test datapoints are correctly converted to strings.
625941ef627d3e7fe0d693cb
def t_view_updated(self,collection,view): <NEW_LINE> <INDENT> pass
the view has been updated
625941efd58c6744b42581d6
def is_dna(string): <NEW_LINE> <INDENT> DNA = ['A','T','G','C'] <NEW_LINE> return False if False in [ str in DNA for str in string] else True
Checks a string using list comprehension for any unallowed characters (DNA can only contain C, T, A, and G) and returns True if it only contains those 4 characters, and False otherwise For Example: is_dna("CCCAAATTTGGG") should return True is_dna("CCCAAATTTGGGXXX") should return False :return: Boolean
625941ef8a349b6b435e86eb
def test_scheduled_status_command(self): <NEW_LINE> <INDENT> self.assert_initialize_driver() <NEW_LINE> self.assert_set(EngineeringParameter.ACQUIRE_STATUS_INTERVAL, "00:00:20") <NEW_LINE> self.assert_async_particle_generation(DataParticleType.CONFIG, self.assert_config_parameters, timeout=60) <NEW_LINE> self.assert_se...
Verify the device status command can be triggered and run in command
625941efbe7bc26dc91cdb6e
def _make_histo_data_weighted(self, summary_function, n_toys, test_split=None): <NEW_LINE> <INDENT> start_event, end_event, correction_factor = self._train_test_split(True, test_split) <NEW_LINE> x, weights_benchmarks = self.weighted_events(start_event=start_event, end_event=end_event, n_draws=n_toys) <NEW_LINE> weight...
Low-level function that creates weighted histogram data
625941ef009cb60464c63926
def add_result_to_existing_csv(file_path, result_run): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> df = pd.read_csv(file_path, index_col=0) <NEW_LINE> next_ = len(df) <NEW_LINE> df.loc[next_] = result_run <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> df = pd.DataFrame.from_dict(result_run, orient='index').T <NEW_LIN...
Input: - File_path: str, a valid absolute file path leading to the place where the file is stored. If it does not exist yet, it creates one. - Result_run: dict, the output value of `iterative_base_det` function, so a dict with model -> {LOF, KNN}, K -> {1, ..., 10}, etc. Output: - None, a csv is appended or written
625941efcad5886f8bd27551
def reset(self): <NEW_LINE> <INDENT> self.holidays = [] <NEW_LINE> self.write_ical() <NEW_LINE> if self.app.calendar: <NEW_LINE> <INDENT> self.app.update_calendar()
Resets and updates the holidays file
625941ef94891a1f4081c025
def shortest_word(text): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> text = re.sub('[^A-Za-z0-9]+', ' ', text).lower() <NEW_LINE> text_list = list(set(text.split(' '))) <NEW_LINE> if "" in text_list: <NEW_LINE> <INDENT> text_list.remove("") <NEW_LINE> <DEDENT> matches = [] <NEW_LINE> if len(text_list) != 0: <NEW_LINE>...
This functions finds & returns the shortest word in a sentence and its length. :param text: input sentence :return: shortest word in a sentence and its length
625941efec188e330fd5ad0c
def length_remaining(self, rotation_count): <NEW_LINE> <INDENT> length = 0 <NEW_LINE> i = 0 <NEW_LINE> try: <NEW_LINE> <INDENT> while rotation_count > self.layer_signals[i]: <NEW_LINE> <INDENT> length += (self.layer_signals[i] * self.length_per_signal[i]) <NEW_LINE> rotation_count -= self.layer_signals[i] <NEW_LINE> i ...
Takes rotation_count and returns distance to 0 in cm.
625941efd7e4931a7ee9e499
def get_authorization_url(): <NEW_LINE> <INDENT> oauth = OAuth2Session( client_id, redirect_uri=redirect_uri, scope=scope ) <NEW_LINE> authorization_url, state = oauth.authorization_url( auth_url ) <NEW_LINE> oauth.close() <NEW_LINE> return authorization_url
return Authorization URL for CILogon :return:
625941ef71ff763f4b549c0f
def encode_halfsigneddatatransop(name, flags, condcode, operands, address, labeldict): <NEW_LINE> <INDENT> (writeback, preindexed, loadflag, upflag, iflag, rd, rn, offset) = parse_datatrans(name, operands, address, labeldict) <NEW_LINE> assert not (offset & 0xF00) <NEW_LINE> assert (not iflag) or not (offset & 0xFF0) <...
check_halfsigneddatatransop must be called before this. Encode the instruction and return it as a bytearray object.
625941ef8a349b6b435e86ec
def update_batch(self, loss_per_instance): <NEW_LINE> <INDENT> if self.batch_indices is None: <NEW_LINE> <INDENT> raise TensorForceError("Need to call get_batch before each update_batch call.") <NEW_LINE> <DEDENT> for index, loss in zip(self.batch_indices, loss_per_instance): <NEW_LINE> <INDENT> new_priority = (np.abs(...
Computes priorities according to loss. Args: loss_per_instance:
625941efe8904600ed9f24b0
def read_pdb(fileobj, index=-1, alt_structure='A'): <NEW_LINE> <INDENT> if isinstance(fileobj, str): <NEW_LINE> <INDENT> with open(fileobj,'r') as fileobj: <NEW_LINE> <INDENT> lines = fileobj.readlines() <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> lines = fileobj.readlines() <NEW_LINE> <DEDENT> data_path=get...
Read PDB files. The format is assumed to follow the description given in http://www.wwpdb.org/documentation/format32/sect9.html.
625941efd99f1b3c44c67afe
def hide_sqli_flag(): <NEW_LINE> <INDENT> admincursor = get_admin_cursor() <NEW_LINE> admincursor.execute('SELECT flag FROM flag WHERE id = 4') <NEW_LINE> hideflag = admincursor.fetchall()[0][0] <NEW_LINE> active_flags['sqli_flag'] = hideflag
Speichere Flag in active_flags damit das shopadmin panel diese auslesen kann :return: None
625941ef97e22403b379d515
def iterate(queue): <NEW_LINE> <INDENT> __validate_queue(queue) <NEW_LINE> redis_conn = __get_connection() <NEW_LINE> current = 0 <NEW_LINE> interval = 100 <NEW_LINE> max = redis_conn.llen(queue) <NEW_LINE> while current < max: <NEW_LINE> <INDENT> batch = redis_conn.lrange(queue, current, current + interval - 1) <NEW_L...
Returns a generator for iterating over a redis queue. :param queue: queue name to iterate over :return: generator
625941ef8c0ade5d55d3ef39
def evaluate(board, maximizing_color): <NEW_LINE> <INDENT> if maximizing_color == WHITE: <NEW_LINE> <INDENT> return board.whiteScore - board.blackScore <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return board.blackScore - board.whiteScore
Provides a number representing the value of the board at a given state :param board: the current board being used for the game (Board) :param maximizing_color: color associated with maximizing player (tuple) :return: integer representing boards value
625941ef3317a56b8693a1c4
def get( self, policy_id ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> resp = self.call_api("/policies/get", { "policy_id": policy_id }) <NEW_LINE> return resp <NEW_LINE> <DEDENT> except Exception as err: <NEW_LINE> <INDENT> raise err
Get policy with specify id or with current id. Parameters ---------- policy_id : str A policy id. Returns ------- dict Policy.
625941ef4e4d5625662d4949
def perturb(self, distance=0.2): <NEW_LINE> <INDENT> def get_rand_vec(): <NEW_LINE> <INDENT> vector = np.random.randn(3) <NEW_LINE> vnorm = np.linalg.norm(vector) <NEW_LINE> return vector / vnorm * distance if vnorm != 0 else get_rand_vec() <NEW_LINE> <DEDENT> for i in range(len(self._sites)): <NEW_LINE> <INDENT> self....
Performs a random perturbation of the sites in a structure to break symmetries. Args: distance (float): Distance in angstroms by which to perturb each site.
625941ef7c178a314d6ef9e2
def delete(self): <NEW_LINE> <INDENT> self._provider.azure_client.delete_disk(self.id)
Delete this volume.
625941ef4c3428357757c89e
def MAIN(): <NEW_LINE> <INDENT> for fileName in fileList: <NEW_LINE> <INDENT> sleep(1) <NEW_LINE> print(fileName) <NEW_LINE> progress.step(step) <NEW_LINE> progress.update() <NEW_LINE> <DEDENT> pencere3.destroy()
Put your loop in here
625941efe64d504609d74db9
@numba.jit('int64[:](uint8[:], int64[:], int64[:], int64)', nopython=True, nogil=True) <NEW_LINE> def _overflow_correct_allch(detectors, timestamps, t_start, overflow): <NEW_LINE> <INDENT> overflow_corr = t_start <NEW_LINE> overflow_marker = 0 <NEW_LINE> for i in range(timestamps.size): <NEW_LINE> <INDENT> is_overflow ...
Apply overflow correction to all channels.
625941ef91f36d47f21aca72
def setup_platform(hass, config, add_devices, discovery_info=None): <NEW_LINE> <INDENT> locks = [] <NEW_LINE> if discovery_info is not None: <NEW_LINE> <INDENT> device = {'name': discovery_info['name'], 'mac': discovery_info['mac']} <NEW_LINE> locks.append(YaleLock(hass, device, None)) <NEW_LINE> <DEDENT> else: <NEW_LI...
Set up the Yale lock platform.
625941efd6c5a102081445c9
def test_add_with_username_sshkeyfile(isolated_filesystem): <NEW_LINE> <INDENT> name = utils.uuid4() <NEW_LINE> username = utils.uuid4() <NEW_LINE> sshkeyfile = Path(utils.uuid4()) <NEW_LINE> sshkeyfile.touch() <NEW_LINE> auth_add({"name": name, "username": username, "sshkeyfile": sshkeyfile.name}) <NEW_LINE> rho_auth_...
Add an auth with username and sshkeyfile. :id: 0f709bf8-a1bf-4181-a392-428e6d9400b3 :description: Add an auth entry providing the ``--name``, ``--username`` and ``--sshkeyfile`` options. :steps: Run ``rho auth add --name <name> --username <username> --sshkeyfile <sshkeyfile>`` :expectedresults: A new auth entr...
625941ef236d856c2ad44d5c
@pytest.mark.parametrize( 'version, build, version_code', [ ('0.1', None, '10000'), ('0.1a3', None, '10000'), ('1.2', None, '1020000'), ('1.2a3', None, '1020000'), ('1.2.3', None, '1020300'), ('1.2.3a3', None, '1020300'), ('1.2.3b4', None, '1020300'), ('1.2.3rc5', None, '1020300'), ('1.2.3.dev6', None, '1020300'), ('1....
Validate that create adds version_code to the template context.
625941ef56b00c62f0f14bd7
def moveZeroes(self, nums: List[int]) -> None: <NEW_LINE> <INDENT> last=0 <NEW_LINE> i=0 <NEW_LINE> while(i<len(nums)): <NEW_LINE> <INDENT> if nums[i]!=0: <NEW_LINE> <INDENT> nums[last]=nums[i]; <NEW_LINE> last+=1 <NEW_LINE> <DEDENT> i+=1 <NEW_LINE> <DEDENT> for i in range(last,len(nums)): <NEW_LINE> <INDENT> nums[i]=0...
Do not return anything, modify nums in-place instead.
625941ef91af0d3eaac9bf97
def create_service(*, client: HttpClient, name: str=None, plan_id: str, offering_id: str, params: dict): <NEW_LINE> <INDENT> metadata = [{"key": "PLAN_ID", "value": plan_id}] <NEW_LINE> if params is not None: <NEW_LINE> <INDENT> metadata = metadata + [{"key": key, "value": val} for key, val in params.items()] <NEW_LINE...
POST /services
625941efbd1bec0571d90ba8
def delete(self): <NEW_LINE> <INDENT> params = {'dlDir':'true'} <NEW_LINE> r = self.jfs.post(self.path, params) <NEW_LINE> self.sync() <NEW_LINE> return r
Delete this folder and return a deleted JFSFolder
625941efcc40096d61595ec8
def init_from_file(self, key_man): <NEW_LINE> <INDENT> assert isinstance(key_man, bean.KeyManager.KeyManager) <NEW_LINE> for k, _ in self._db.RangeIter(): <NEW_LINE> <INDENT> key_man.push(k)
每一次启动的时候应该从本地文件当中获取所有的key到内存当中去
625941efd18da76e23532a57
def p_conditional_expression_not_name(self, p): <NEW_LINE> <INDENT> lineno = p.lexer.lineno <NEW_LINE> if len(p) == 2: <NEW_LINE> <INDENT> p[0] = p[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> p[0] = Conditional(p[1], p[3], p[5]) <NEW_LINE> p[0].line_number = lineno
conditional_expression_not_name : conditional_or_expression_not_name | conditional_or_expression_not_name '?' expression ':' conditional_expression | name '?' expression ':' conditional_expression
625941ef2c8b7c6e89b35d36
@app.route('/type') <NEW_LINE> def type(): <NEW_LINE> <INDENT> liked_tweets_dict = {} <NEW_LINE> client = MongoClient(url) <NEW_LINE> db = client['twitter_police_db'] <NEW_LINE> for police_handle in tweet_users: <NEW_LINE> <INDENT> collection = db[police_handle] <NEW_LINE> liked_tweets = {'image+text': 0, 'image': 0, '...
types of tweets
625941ef6e29344779a62b8a
def seq_view_shot(self, ): <NEW_LINE> <INDENT> if not self.cur_seq: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> i = self.seq_shot_tablev.currentIndex() <NEW_LINE> item = i.internalPointer() <NEW_LINE> if item: <NEW_LINE> <INDENT> shot = item.internal_data() <NEW_LINE> self.view_shot(shot)
View the shot that is selected in the table view of the sequence page :returns: None :rtype: None :raises: None
625941ef15baa723493c44f4
def flatten_records(data, order="C"): <NEW_LINE> <INDENT> size, *shape = data.shape <NEW_LINE> return data.reshape((size, prod(shape or 1)), order=order)
Flatten or expand nD array into a 2D (row, record) array.
625941efde87d2750b860313
def t400230_x20(): <NEW_LINE> <INDENT> if GetEventStatus(74000583) == 1: <NEW_LINE> <INDENT> assert t400230_x5(text1=23002800, flag2=0, mode1=1) <NEW_LINE> <DEDENT> elif (GetEventStatus(73301160) == 1 and GetEventStatus(73301140) == 1 and GetEventStatus(73301150) == 1 and GetEventStatus(73301170) == 1): <NEW_LINE> <IND...
State 0,1
625941ef3c8af77a43ae3d21
def test_a_Gregorian_March_1st(self): <NEW_LINE> <INDENT> self.check_both_conversions( (1500, 2, 20), (1500, 3, 1) )
This Gregorian date is March 1st, of a Julian-only leap year. Although the Julian date falls before the leap day, since the Gregorian date falls after it, the number of days difference between the dates in the two calendars depends which calendar you use to measure it.
625941ef26068e7796caf261
def __show_app_choose_windows__(self, *args): <NEW_LINE> <INDENT> choose_app_window = app_choose.Apps_Choose_Window(self.info_about_file['Type']) <NEW_LINE> choose_app_window.show_all()
Запуск окна выбора приложения
625941ef1b99ca400220b02e
def get_closed_facilities(self, closest_zipcodes): <NEW_LINE> <INDENT> facilities = self.df[self.df['ZIP_CD'].isin(closest_zipcodes)] <NEW_LINE> return facilities[facilities['TRMNTN_EXPRTN_DT'].notnull()]
Retrieves closed facilities, when there exists an termination date on a row
625941ef63d6d428bbe44a6b
def doInit(self, *args, **kwargs): <NEW_LINE> <INDENT> self.refresh_period = DHT_RECORD_REFRESH_INTERVAL <NEW_LINE> self.refresh_task = LoopingCall(self._on_queue_keeper_dht_refresh_task)
Action method.
625941ef60cbc95b062c6abe
def create_is_valid_field(log): <NEW_LINE> <INDENT> ids = sorted(log['ids']) <NEW_LINE> query_ids = re.findall(r"id=(\d+)", log['query_string']) <NEW_LINE> query_int_ids = sorted([int(query_id) for query_id in query_ids]) <NEW_LINE> is_valid = (ids == query_int_ids) <NEW_LINE> if is_valid: <NEW_LINE> <INDENT> return "v...
Check if log is valid. Log is valid if 'query_string' contains exactly the same set of id as in the array 'ids' Args: log (pandas.core.series.Series). Returns: "valid" if string valid; "non_valid" otherwise.
625941ef377c676e91272721
def is_proxy(opts): <NEW_LINE> <INDENT> return ( salt.utils.platform.is_proxy() and opts.get("proxy", {}).get("proxytype") == "napalm" )
Is this a NAPALM proxy?
625941ef442bda511e8be98a
def test_retrieve_submission_with_partial_permissions_as_anotheruser(self): <NEW_LINE> <INDENT> self._log_in_as_another_user() <NEW_LINE> partial_perms = { PERM_VIEW_SUBMISSIONS: [{'_submitted_by': 'anotheruser'}] } <NEW_LINE> self.asset.assign_perm(self.anotheruser, PERM_PARTIAL_SUBMISSIONS, partial_perms=partial_perm...
someuser is the owner of the project. anotheruser has partial view access to someuser's data. They can only see their own data.
625941efa219f33f34628edc
def _end(self): <NEW_LINE> <INDENT> self._cursor = len(self.get_text())
Go to end of line
625941ef1f5feb6acb0c50c3
def find_resource_class(record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> record = record.connection <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> for resource in _registry: <NEW_LINE> <INDENT> if resource.is_match(record, record.properties.get('resource_class_name')): <NEW...
Find the resource class for this `record`. Parameters ---------- record : :class:`~.record_types.EquipmentRecord` or :class:`~.record_types.ConnectionRecord` A record type. If the :attr:`~.record_types.ConnectionRecord.properties` attribute contains a ``resource_class_name`` key with a value that is equal to t...
625941ef73bcbd0ca4b2c5ef
def read(self): <NEW_LINE> <INDENT> while len(self.rcv_data) == 0: <NEW_LINE> <INDENT> sleep(0) <NEW_LINE> <DEDENT> if self.rcv_data[0] is None: <NEW_LINE> <INDENT> raise DAPAccessIntf.DeviceError("Device %s read thread exited unexpectedly" % self.serial_number) <NEW_LINE> <DEDENT> return self.rcv_data.pop(0)
! @brief Read data on the IN endpoint.
625941ef5166f23b2e1a56d3