code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_hzrdi_read_schema(self): <NEW_LINE> <INDENT> classes = [Rupture, Source, SimpleFault, MfdEvd, MfdTgr, ComplexFault, RDepthDistr, RRateMdl, FocalMechanism] <NEW_LINE> expected_db = 'reslt_writer' <NEW_LINE> self._db_for_read_helper(classes, expected_db)
For each model in the 'hzrdi' schema, test for proper db routing for read operations.
625941c3ab23a570cc25014d
def __init__(self, env, stack): <NEW_LINE> <INDENT> self.stack_cf = '' <NEW_LINE> self.env = env <NEW_LINE> self.stack = stack <NEW_LINE> self.bucket_name = '{}-kiwi-cloudformation-scripts'.format(env) <NEW_LINE> self.output_folder = './output/' <NEW_LINE> self.common_files_folder = './common_cloudformation/' <NEW_LINE...
init function :param env: :param stack:
625941c33eb6a72ae02ec4a5
def tabStopWidth(self): <NEW_LINE> <INDENT> return 0
QTextEdit.tabStopWidth() -> int
625941c3cdde0d52a9e52ffe
def searchOneShotFullBinPairsAttrFromNode(_session, _beg, _attr, _const): <NEW_LINE> <INDENT> return searchOneShot(searchFullBinPairsAttrFromNode(_session, _beg, _attr, _const))
Searches full data for a binary orient pairs with specified begin element and attribute @see: searchOneShot @see: searchFullBinPairsAttrFromNode
625941c38a349b6b435e8140
def test_create_with_def(self): <NEW_LINE> <INDENT> sqlite_file = 'my_first_db.sqlite' <NEW_LINE> table_def = [{"AUTHOR_ID": "TEXT PRIMARY KEY"}, {"AUTHOR_NM": "TEXT"}, {"TWEET_COUNT": "INTEGER"}] <NEW_LINE> print(table_def) <NEW_LINE> table_created = create_table.Sqlite_Table(sq...
Testing simple author table creation
625941c3851cf427c661a4dd
def dnwm(self, freq="0.056"): <NEW_LINE> <INDENT> dnwm_df = self.data.xs(freq, level="frequency") <NEW_LINE> dnwm_df = dnwm_df.xs(max(self.nmax), level="nmax", axis=1) <NEW_LINE> dnwm_df = dnwm_df.xs(max(self.npoints), level="npoints", axis=1) <NEW_LINE> return dnwm_df[500][FIRST_HARMONIC_LABELS].iloc[-1]
return the degenerate n wave mixing terms of the chis
625941c3091ae35668666f2e
def get_response(self): <NEW_LINE> <INDENT> if self.last_status and len(self.response["data"]) > 0: <NEW_LINE> <INDENT> return self.response["data"] <NEW_LINE> <DEDENT> return None
Return the response data for the last command if the last command was successful.
625941c37b180e01f3dc47cd
def similarity(self, w1, w2): <NEW_LINE> <INDENT> if self.normalized: <NEW_LINE> <INDENT> return self.represent(w1).dot(self.represent(w2)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> e1=self.represent(w1) <NEW_LINE> e2=self.represent(w2) <NEW_LINE> return e1.dot(e2)/(norm(e1)*norm(e2))
Assumes the vectors have been normalized.
625941c30fa83653e4656f88
def code(language, source_code): <NEW_LINE> <INDENT> formatter = HtmlFormatter(**settings["SYNTAX_HIGHLIGHT_OPTIONS"]) <NEW_LINE> return highlight(source_code, _get_lexer(language, source_code), formatter)
Formats the given source code snippet as HTML.
625941c3a934411ee3751660
def load_dataset(form='c'): <NEW_LINE> <INDENT> data_X = load_files('data', categories='Fixed Judgements') <NEW_LINE> data_y = pd.read_csv('data/Interview_Mapping.csv').values <NEW_LINE> vectorizer = None <NEW_LINE> if form == 'tf': <NEW_LINE> <INDENT> vectorizer = TfidfVectorizer(decode_error='ignore') <NEW_LINE> prin...
Loads data set into np.array (term frequency weighting or counts). Returns (X_train, y_Train, X_test) form : 'tf' or 'c' for term-freq/counts
625941c3a4f1c619b28b000a
def queue_length(self, rho, max_depth=1000): <NEW_LINE> <INDENT> if (rho >= 1): <NEW_LINE> <INDENT> return max_depth <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> avg = rho / (1 - rho) <NEW_LINE> return avg if avg < max_depth else max_depth
expected average queue depth as a function of load rho -- average fraction of time CPU is busy max_depth -- the longest the queue can possibly be
625941c34527f215b584c426
def __unicode__(self): <NEW_LINE> <INDENT> return u'%s %s' % (self.user.first_name, self.user.last_name)
unicode string representation of the model
625941c3ec188e330fd5a76f
def _wait_for_indexes(self): <NEW_LINE> <INDENT> leap_assert_type(self.wait_for_indexes, list) <NEW_LINE> methods = self.wait_for_indexes <NEW_LINE> self.waiting = [] <NEW_LINE> self.stored = {} <NEW_LINE> def makeWrapper(method): <NEW_LINE> <INDENT> def wrapper(*args, **kw): <NEW_LINE> <INDENT> d = defer.Deferred() <N...
Make the marked methods to wait for the indexes to be ready. Heavily based on http://blogs.fluidinfo.com/terry/2009/05/11/a-mixin-class-allowing-python-__init__-methods-to-work-with-twisted-deferreds/ :param methods: methods that need to wait for the indexes to be ready :type methods: tuple(str)
625941c3627d3e7fe0d68e1b
def list_scores(self, request): <NEW_LINE> <INDENT> db_session = SchemaManager.session() <NEW_LINE> user_scores_rs = UserScores(db_session) <NEW_LINE> user_score_records = user_scores_rs.get_all_user_scores() <NEW_LINE> out = [] <NEW_LINE> for user_score_record in user_score_records: <NEW_LINE> <INDENT> out.append({ 'u...
Scores listing handler. --- Retrieves a list of scores. Parameters: - request: The HTTP request received in the REST endpoint. Returns: A tuple with the following values: - (200, list of score records) when the list was successfully retrieved.
625941c326068e7796caeca8
def get_policy_index(req_headers, res_headers): <NEW_LINE> <INDENT> header = 'X-Backend-Storage-Policy-Index' <NEW_LINE> policy_index = res_headers.get(header, req_headers.get(header)) <NEW_LINE> if isinstance(policy_index, six.binary_type) and not six.PY2: <NEW_LINE> <INDENT> policy_index = policy_index.decode('ascii'...
Returns the appropriate index of the storage policy for the request from a proxy server :param req_headers: dict of the request headers. :param res_headers: dict of the response headers. :returns: string index of storage policy, or None
625941c39c8ee82313fbb741
def __init__( self, data_source: Iterable, batch_size: int, get_length_fn: Callable[[Any], int], bucket_boundaries: List[int], min_length: int = 0, max_length: int = None, drop_tail: bool = False, required_batch_size_multiple: int = 1 ) -> None: <NEW_LINE> <INDENT> super().__init__(data_source) <NEW_LINE> if not bucket...
Initialises the iterator. Args: data_source: a dataset object as data source. batch_size: batch size. get_length_fn: a function to evaluate the size of a given sample. bucket_boundaries: a list of ints that defines the buckets. Should be sorted in strictly ascending order. min_length: an int value ...
625941c33539df3088e2e318
def show_corrections(self, status=None, nids=None): <NEW_LINE> <INDENT> nrows, ncols = get_terminal_size() <NEW_LINE> count = 0 <NEW_LINE> for task in self.iflat_tasks(status=status, nids=nids): <NEW_LINE> <INDENT> if task.num_corrections == 0: continue <NEW_LINE> count += 1 <NEW_LINE> print(make_banner(str(task), widt...
Show the corrections applied to the flow at run-time. Args: status: if not None, only the tasks with this status are select. nids: optional list of node identifiers used to filter the tasks. Return: The number of corrections found.
625941c385dfad0860c3ae27
def data_analysis(self): <NEW_LINE> <INDENT> dir_name = self.get_current_date_time("%Y-%m-%d") <NEW_LINE> if not os.path.isdir(dir_name): <NEW_LINE> <INDENT> os.makedirs(dir_name) <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> trend = self.get_current_trend <NEW_LINE> print(trend) <NEW_LINE> if float(trend) >= 0.3...
- Based on the trend this method will go and analyse the market - Trend is > 0.3 bullish trend - Trend < 0.3 bearish trend
625941c3e1aae11d1e749c82
def __init__(self, url, token, name=''): <NEW_LINE> <INDENT> self.token = token <NEW_LINE> self.name = name <NEW_LINE> self.url = url <NEW_LINE> self.metadata = self.__md() <NEW_LINE> self.field_names = self.filter_metadata('field_name') <NEW_LINE> self.def_field = self.field_names[0] <NEW_LINE> self.field_labels = sel...
Must init with your token
625941c3099cdd3c635f0c28
def person_dto_payload(person_dto, person_id, status_code=200): <NEW_LINE> <INDENT> person_dto_links(person_dto, person_id) <NEW_LINE> p = PersonDtoSerializer(object=person_dto) <NEW_LINE> p.validate() <NEW_LINE> return json_response(p.data, status_code=status_code)
Construct payload for person dto. :param person_dto: Data transfer object to target. :type person_dto: PersonDto :param person_id: Resource identifier. :type person_id: Resource identifier. :return: Response
625941c330dc7b7665901935
def FindAll(self, match): <NEW_LINE> <INDENT> pass
FindAll(self: List[T], match: Predicate[T]) -> List[T] Retrieves all the elements that match the conditions defined by the specified predicate. match: The System.Predicate delegate that defines the conditions of the elements to search for. Returns: A System.Collections.Generic.List containing all the...
625941c324f1403a92600b35
def get_all_tenants(self): <NEW_LINE> <INDENT> session = self.login_to_apic() <NEW_LINE> tenants = Tenant.get(session) <NEW_LINE> self.assertTrue(len(tenants) > 0) <NEW_LINE> return tenants
Test Tenant.get
625941c3d486a94d0b98e112
def _address_from_socket(sock): <NEW_LINE> <INDENT> addr_type = sock.recv(1) <NEW_LINE> if addr_type == b'\x01': <NEW_LINE> <INDENT> ipv4_addr = _read_exactly(sock, 4) <NEW_LINE> return socket.inet_ntoa(ipv4_addr) <NEW_LINE> <DEDENT> elif addr_type == b'\x04': <NEW_LINE> <INDENT> ipv6_addr = _read_exactly(sock, 16) <NE...
Returns the address from the SOCKS socket
625941c3ab23a570cc25014e
def Create_Possible_GB_Plane_List(uvw, m=5, n=1, lim=5): <NEW_LINE> <INDENT> uvw = np.array(uvw) <NEW_LINE> Theta = get_cubic_theta(uvw, m, n) <NEW_LINE> Sigma = get_cubic_sigma(uvw, m, n) <NEW_LINE> R1 = rot(uvw, Theta) <NEW_LINE> x = np.arange(-lim, lim + 1, 1) <NEW_LINE> y = x <NEW_LINE> z = x <NEW_LINE> indice = (n...
generates GB planes and specifies the character. arguments: uvw -- axis of rotation. m,n -- the two necessary integers lim -- upper limit for the plane indices
625941c33c8af77a43ae376b
def forward(self): <NEW_LINE> <INDENT> self.value = 0 <NEW_LINE> for idx,val in enumerate(self.inbound_nodes[0].value): <NEW_LINE> <INDENT> self.value += val * self.inbound_nodes[1].value[idx] <NEW_LINE> <DEDENT> self.value = self.value + self.inbound_nodes[2].value
Set self.value to the value of the linear function output. Your code goes here!
625941c34d74a7450ccd4190
def pathSum(self, root, sum_int): <NEW_LINE> <INDENT> lst = [] <NEW_LINE> if root==None: <NEW_LINE> <INDENT> return lst <NEW_LINE> <DEDENT> self.traverse(root, lst) <NEW_LINE> return [x for x in lst if sum(x)==sum_int]
:type root: TreeNode :type sum: int :rtype: List[List[int]]
625941c30383005118ecf5b1
def list_all_keys(args, list): <NEW_LINE> <INDENT> if args.list_keys: <NEW_LINE> <INDENT> all_keys = set().union(*(d.keys() for d in list)) <NEW_LINE> pp.pprint(all_keys) <NEW_LINE> sys.exit(1)
List all valid keys
625941c3656771135c3eb839
def subdomain(symbol, start, end, filter='history'): <NEW_LINE> <INDENT> subdoma="/quote/{0}/history?period1={1}&period2={2}&interval=1d&filter={3}&frequency=1d" <NEW_LINE> subdomain = subdoma.format(symbol, start, end, filter) <NEW_LINE> return subdomain
Parameters ---------- symbol : stock symbol - canada should end with '.to' start : start date in epoch time end : end date in epoch time filter : history or div DESCRIPTION. The default is 'History'. Returns ------- subdomain : url
625941c315fb5d323cde0ada
def test_timefreq_consistent(): <NEW_LINE> <INDENT> data_idx = 1 <NEW_LINE> x = _load_example_data(data_idx=data_idx) <NEW_LINE> Fs = 1000 <NEW_LINE> f_range = (13, 30) <NEW_LINE> pha_true = np.load(os.path.dirname(neurodsp.__file__) + '/tests/data/sample_data_' + str(data_idx) + '_pha.npy') <NEW_LINE> amp_true = np.lo...
Confirm consistency in estimation of instantaneous phase, amp, and frequency with computations in previous versions
625941c396565a6dacc8f698
def showWarning(self, arg0): <NEW_LINE> <INDENT> return _Client.StreamApplication_showWarning(self, arg0)
showWarning(StreamApplication self, char const * arg0)
625941c3cad5886f8bd26fa7
def test_create_network(self): <NEW_LINE> <INDENT> resource = 'network' <NEW_LINE> cmd = CreateNetwork(MyApp(sys.stdout), None) <NEW_LINE> name = 'myname' <NEW_LINE> myid = 'myid' <NEW_LINE> args = [name, ] <NEW_LINE> position_names = ['name', ] <NEW_LINE> position_values = [name, ] <NEW_LINE> self._test_create_resourc...
Create net: myname.
625941c3b57a9660fec3384f
def testVectorLayerExporterDeferredSpatialIndexSpatialIndexDisallowed(self): <NEW_LINE> <INDENT> ds = self._testVectorLayerExporterDeferredSpatialIndex(['SPATIAL_INDEX=NO'], False) <NEW_LINE> filename = ds.GetDescription() <NEW_LINE> del ds <NEW_LINE> gdal.Unlink(filename)
Check that a deferred spatial index is NOT created when explicit disallowed
625941c345492302aab5e28f
def imageSmoother(self, M): <NEW_LINE> <INDENT> n = len(M) <NEW_LINE> m = len(M[0]) <NEW_LINE> N = [[0.5] + i + [0.5] for i in M] <NEW_LINE> N = [[0.5] * (m + 2)] + N + [[0.5] * (m + 2)] <NEW_LINE> A = [] <NEW_LINE> for i in range(1, n + 1): <NEW_LINE> <INDENT> for j in range(1, m + 1): <NEW_LINE> <INDENT> A.append(N[i...
:type M: List[List[int]] :rtype: List[List[int]]
625941c3cc40096d6159591e
def prepare_batch(self, batch_info, dst_curs): <NEW_LINE> <INDENT> if self.hash_key is not None: <NEW_LINE> <INDENT> if not self.hash_mask: <NEW_LINE> <INDENT> self.load_shard_info(dst_curs) <NEW_LINE> <DEDENT> <DEDENT> TableHandler.prepare_batch(self, batch_info, dst_curs)
Called on first event for this table in current batch.
625941c36e29344779a625e1
def can_pawn_move(): <NEW_LINE> <INDENT> position_pawn_in_starting = "27" <NEW_LINE> if is_capture(move): <NEW_LINE> <INDENT> return moved_by in [(1, 1)] <NEW_LINE> <DEDENT> elif current_pos[1] in position_pawn_in_starting: <NEW_LINE> <INDENT> return moved_by in [(0, 1), (0, 2)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
Checks condition for pawn's movement Returns: boolean value -- returns True if piece can be moved else False
625941c3dd821e528d63b177
def open(self, source, colnames={}, filename=None): <NEW_LINE> <INDENT> return Reader.File(self, source, colnames, filename)
Returns an open Reader.File object.
625941c350812a4eaa59c2f0
def Activate(self): <NEW_LINE> <INDENT> pass
Your plugin should run any code necessary to get ready to deal with searches or other operations your plugins do. Bind hotkeys, authorize to an API, whatever.
625941c33c8af77a43ae376c
def _import_sequences(request, issue_id, changeset, lines, running_number): <NEW_LINE> <INDENT> for fields in lines: <NEW_LINE> <INDENT> story_type, failure = _find_story_type(request, changeset, fields) <NEW_LINE> if failure: <NEW_LINE> <INDENT> return story_type <NEW_LINE> <DEDENT> title = fields[TITLE].strip() <NEW_...
Processing of story lines happens here. lines is a list of lists. This routine is independent of a particular format of the file, as long as the order of the fields in lines matches.
625941c394891a1f4081ba76
@resource.register(config['stats']['pattern'], priority=config['stats']['priority']) <NEW_LINE> @pivot <NEW_LINE> @annotate_by_uri <NEW_LINE> def resource_bamtools_stats(uri, **kwargs): <NEW_LINE> <INDENT> def _parse(): <NEW_LINE> <INDENT> data = [] <NEW_LINE> with open(uri) as fh: <NEW_LINE> <INDENT> for x in fh.readl...
Parse bamtools stats text output file. Args: uri (str): filename Returns: DataFrame: DataFrame for requested section
625941c38c3a873295158386
def send_activation_email_using_post_with_http_info(self, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['body'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LIN...
sendActivationEmail # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.send_activation_email_using_post_with_http_info(body, async_req=True) >>> result = thread.get() :param async_req bool :param str body: sendActiva...
625941c3287bf620b61d3a32
def dumps(obj, sort_keys=False): <NEW_LINE> <INDENT> data, idx = index(obj, sort_keys=sort_keys) <NEW_LINE> jdx = json.dumps(idx, sort_keys=sort_keys) <NEW_LINE> iloc = 69 <NEW_LINE> ilen = len(jdx) <NEW_LINE> dloc = iloc + ilen + 11 <NEW_LINE> dlen = len(data) <NEW_LINE> s = JSON_FORMAT.format(index=jdx, data=data, il...
Dumps an object to JSON with an index.
625941c35fdd1c0f98dc0200
def reset(self) -> None: <NEW_LINE> <INDENT> for pdim in self.dims.values(): <NEW_LINE> <INDENT> pdim.reset() <NEW_LINE> <DEDENT> log.debug("Reset ParamSpace and ParamDims.")
Resets the paramter space and all of its dimensions to the initial state, i.e. where all states are None.
625941c3de87d2750b85fd5e
def __init__(self, pipeline=None, parent=None, show_sub_pipelines=False, allow_open_controller=False, logical_view=False, enable_edition=False): <NEW_LINE> <INDENT> super(PipelineDevelopperView, self).__init__(parent) <NEW_LINE> self.setAlignment(QtCore.Qt.AlignCenter) <NEW_LINE> self.centerOn(0,0) <NEW_LINE> self.setR...
PipelineDevelopperView Parameters ---------- pipeline: Pipeline (optional) pipeline object to be displayed If omitted an empty pipeline will be used, and edition mode will be activated. parent: QWidget (optional) parent widget show_sub_pipelines: bool (optional) if set, sub-pipelines will appear...
625941c3711fe17d8254233c
def gb_tune(train, target, n_jobs): <NEW_LINE> <INDENT> from sklearn.ensemble import GradientBoostingRegressor <NEW_LINE> model = GradientBoostingRegressor(max_features='sqrt') <NEW_LINE> learning_rate = [round(float(x), 2) for x in np.linspace(start = .01, stop = .1, num = 10)] <NEW_LINE> n_estimators = [int(x) for x ...
Tunes hyperparameters for a GradientBoostingRegressor model. Keyword Arguments ----------------- train -- Training set as pandas DataFrame (without target) target -- Target as pandas DataFrame n_jobs -- Number of cpu cores to use for computation, use -1 for all
625941c33cc13d1c6d3c7348
def __init__(self, prefix = 'trace'): <NEW_LINE> <INDENT> self.__prefix = prefix.strip('.')
Construct a new "PrependLoggerFactory" instance that prepends the value ar{prefix} to the name of each logger to be created by this class.
625941c36fb2d068a760f069
def extload(self, helper, file, log=None): <NEW_LINE> <INDENT> return False
charge des objets en base de donnees par dbload
625941c3b5575c28eb68dfcc
def test(args, encoder, decoder, x, prev_hidden_temporal_list): <NEW_LINE> <INDENT> T = args.maxseqlen <NEW_LINE> hidden_spatial = None <NEW_LINE> hidden_temporal_list = [] <NEW_LINE> out_masks = [] <NEW_LINE> encoder.eval() <NEW_LINE> decoder.eval() <NEW_LINE> feats = encoder(x) <NEW_LINE> for t in range(0, T): <NEW_L...
Runs forward, computes loss and (if train mode) updates parameters for the provided batch of inputs and targets
625941c37b25080760e39427
def CheckPoised_(X,Dist,theta1,maxdelta,xkin,radius,nmp,Intind,ModelIn): <NEW_LINE> <INDENT> ModelIn = np.array(ModelIn,dtype='int') <NEW_LINE> nf,n = X.shape <NEW_LINE> GPoints = np.zeros((n,n)) <NEW_LINE> if nmp is not 0: <NEW_LINE> <INDENT> R = (X[ModelIn[0:nmp],:] - np.repeat([X[xkin,:]],nmp,axis=0)) / radius <NEW_...
Obtains additional affine indep points and generates geom-imp pts if nec Parameters ---------- X = [dbl] [nf-by-n] Matrix whose rows are points Dist = [dbl] [nf-by-1] Vector of distances to X(xkin,:) theta1 = [dbl] Positive validity threshold maxdelta = [dbl] Maximum distance to look for points xkin = [int] I...
625941c360cbc95b062c6510
def get_encoder_anotation_grid(self, x): <NEW_LINE> <INDENT> B, C, H_prime, W_prime = x.shape <NEW_LINE> x = x.permute(0, 2, 3, 1).contiguous().view(B*H_prime, W_prime, C) <NEW_LINE> encoder_outputs, (hn, cn) = self.encoder(x) <NEW_LINE> encoder_outputs = encoder_outputs.view(B, H_prime, W_prime, -1).contiguous() <NEW_...
input: > x: cnn feature map (batch, C, H', W') return: > encoder_outputs: top layer hidden states of encoder applied on H' row of x (batch, H', W', directions * encoder_hidden_size) > hn, cn: last hidden states of encoder applied on H' row of x (#layers, batch, H', deco...
625941c3293b9510aa2c3265
def calc_lines(self, _indi_handle, _fams_handle, workinglines): <NEW_LINE> <INDENT> subst = SubstKeywords(self.database, _indi_handle, _fams_handle) <NEW_LINE> lines = subst.replace_and_clean(workinglines) <NEW_LINE> lns = [] <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> for pair in self.display_repl: <NEW_LINE> <I...
In this pass we will: 1. make our text and do our replacements 2. remove any extra (unwanted) lines with the compres option
625941c344b2445a33932064
def __readControlsSounds(self, xmlCtx): <NEW_LINE> <INDENT> controlsSection = _xml.getSubsection(xmlCtx, xmlCtx, self.CONTROLS) <NEW_LINE> self.__default = doc_loaders.readDict(xmlCtx, controlsSection, self.CONTROLS_DEFAULT) <NEW_LINE> controlsOverridesSection = _xml.getSubsection(xmlCtx, controlsSection, self.CONTROLS...
Reading controls sounds data @param xmlCtx: [xml data section] xml context document
625941c3d53ae8145f87a240
def settings(self, nodialog=False): <NEW_LINE> <INDENT> if 'Raster' not in self.indata: <NEW_LINE> <INDENT> self.showprocesslog('No Raster Data.') <NEW_LINE> return False <NEW_LINE> <DEDENT> tst = np.unique([i.data.shape for i in self.indata['Raster']]) <NEW_LINE> if tst.size > 2: <NEW_LINE> <INDENT> self.showprocesslo...
Entry point into item. Parameters ---------- nodialog : bool, optional Run settings without a dialog. The default is False. Returns ------- bool True if successful, False otherwise.
625941c3a17c0f6771cbe020
def _lock_services_except(self, services): <NEW_LINE> <INDENT> for service in self.entities: <NEW_LINE> <INDENT> if service not in services: <NEW_LINE> <INDENT> self.entities[service].status = LOCKED
Lock all services except those provided.
625941c3442bda511e8be3e8
def p_Expression(p): <NEW_LINE> <INDENT> p[0] = mytuple(["Expression"]+p[1:])
Expression : LambdaExpression | AssignmentExpression | IDENT
625941c33617ad0b5ed67ec6
def _compute_mean(self, C, rup, dists, sites, imt): <NEW_LINE> <INDENT> mean = (self._get_magnitude_scaling_term(C, rup.mag) + self._get_distance_scaling_term(C, rup.mag, dists.rrup) + self._get_site_amplification_term(C, sites.vs30)) <NEW_LINE> if isinstance(imt, PGA): <NEW_LINE> <INDENT> mean = np.log((10 ** mean) * ...
Returns the mean ground motion acceleration and velocity
625941c33eb6a72ae02ec4a6
def run_command(command, time_out): <NEW_LINE> <INDENT> args = shlex.split(command) <NEW_LINE> proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid) <NEW_LINE> with TimeoutThread.processTimeout(time_out, proc.pid): <NEW_LINE> <INDENT> stdout, stderr = proc.communicate() <NE...
Runs command with a time_out and return the resultcode, stdout and stderr Parameters ---------- command : String Represents the command that has to be run_command time_out : int How long it takes until the subprocess times out Returns ------- resultcode : int The resultcode of the subprocess stdout : stri...
625941c31d351010ab855aea
def __repr__(self): <NEW_LINE> <INDENT> param = "{},".format(self.directory.entity_type_number) <NEW_LINE> param += "{},{},{},{},".format(self.K1, self.K2, self.M1, self.M2) <NEW_LINE> param += "{},{},{},{},{},".format(self.PROP1, self.PROP2, self.PROP3, self.PROP4, self.PROP5) <NEW_LINE> for u in self.S: <NEW_LINE> <I...
Generate raw ASCII record without sequence number. :return: Raw ASCII record. :rtype: str
625941c3d10714528d5ffcaf
def addSetup(self, setup): <NEW_LINE> <INDENT> self.setup_fns.append(setup)
Setup functions as callbacks: arguments - none returns: must return True if the setup step was successful, or False otherwise.
625941c37cff6e4e81117954
def getblame(repo_name, blamefile, **options): <NEW_LINE> <INDENT> reporeader = getmodule("blamethrower.reporeaders", repo_name) <NEW_LINE> if not reporeader: <NEW_LINE> <INDENT> raise ValueError("Unknown repo file type '{0}'".format(repo_name)) <NEW_LINE> <DEDENT> return blamethrower.reporeaders._check_reporeader_outp...
:Return: a dict mapping a filename to a list of authors. :param str repo_name: The name of the module to use to read `blamefile`. :param file blamefile: VCS "blame" output from VCS `repo_name`. :param dict(str,str) options: Any keyword arguments for the `read` method. :rtype: dict(str: list(str))
625941c329b78933be1e567c
def cmain_thread(self): <NEW_LINE> <INDENT> log.debug("PY: cmain_thread") <NEW_LINE> ret = hm_pyc.cmain_thread()
thread function dedicated to c thread operations
625941c30a366e3fb873e7e6
def test_get_cost_for_decimal_gives_two_places_with_single_decimal_float(self): <NEW_LINE> <INDENT> self.assertEqual(Plan.get_cost_for_decimal(Decimal('20.1')), '20.10')
Test that the get_cost_for_decimal places returns 20.10 with decimal 20.1 Float -> Currency
625941c321a7993f00bc7cba
def show(self, **kwargs): <NEW_LINE> <INDENT> return self.api_request(self._get_method_fullname("show"), kwargs)
Shows the details for the specified notification. **Inputs** | ``api version min:`` None | ``api version max:`` None | ``required:`` True | ``default:`` None :param id: The internal NetMRI identifier for the notification. :type id: Integer **Outputs** | ``api version min:`` None | ``api version max:`` None...
625941c3d6c5a10208144017
def create_gen_build_cost(gen_project, gen_legacy, ext='.tab', path=default_path, **kwargs): <NEW_LINE> <INDENT> if ext == '.tab': sep='\t' <NEW_LINE> output_file = output_path + 'gen_build_costs' + ext <NEW_LINE> periods = read_yaml(path, 'periods.yaml') <NEW_LINE> output_costs = [] <NEW_LINE> gen_legacy.rename(colum...
Create gen build cost output file Args: data (pd.DataFrame): dataframe witht dates, ext (str): output extension to save the file. Note(s): * .tab extension is to match the switch inputs,
625941c338b623060ff0adbc
def load_mutation_data(filename, patientFile=None, geneFile=None, minFreq=0, subtypeFile=None): <NEW_LINE> <INDENT> if patientFile: <NEW_LINE> <INDENT> with open(patientFile) as f: <NEW_LINE> <INDENT> patients = set( l.rstrip().split()[0] for l in f if not l.startswith("#") ) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LIN...
Loads the mutation data in the given file. :type filename: string :param filename: Location of mutation data file. :type patient_file: string :param patient_file: Location of patient (whitelist) file. :type gene_file: string :param gene_file: Location of gene (whitelist) file. :rtype: Tuple **Returns:** * **m** (*i...
625941c356b00c62f0f14626
def is_synced(self, delay_return_until_synced: bool = True) -> bool: <NEW_LINE> <INDENT> json_data = json.loads( requests.get( "https://explorer.globaltoken.org/api/status?q=getTxOutSetInfo" ).text ) <NEW_LINE> block_height_global: int = json_data["txoutsetinfo"]["height"] <NEW_LINE> remote_block_heights: object = self...
Check if remote wallets are synced (+- 100 blocks). The remote block height will be specified as the minimum block height of all remote wallets. Args: delay_return_until_synced: if True, the function will not return unitl all instances are synced Returns: bool: True if synced, False otherwise
625941c32c8b7c6e89b35790
@keras_export('keras.backend.cast_to_floatx') <NEW_LINE> @dispatch.add_dispatch_support <NEW_LINE> def cast_to_floatx(x): <NEW_LINE> <INDENT> if isinstance(x, (ops.Tensor, variables_module.Variable, sparse_tensor.SparseTensor)): <NEW_LINE> <INDENT> return math_ops.cast(x, dtype=floatx()) <NEW_LINE> <DEDENT> return np.a...
Cast a Numpy array to the default Keras float type. Arguments: x: Numpy array or TensorFlow tensor. Returns: The same array (Numpy array if `x` was a Numpy array, or TensorFlow tensor if `x` was a tensor), cast to its new type. Example: >>> tf.keras.backend.floatx() 'float32' >>> arr = np.array([1.0, 2....
625941c3be383301e01b5457
def check_condition(self): <NEW_LINE> <INDENT> self.shots_incurred = randrange(1, 101, 10) <NEW_LINE> self.health_level = self.health_level - self.shots_incurred <NEW_LINE> if self.health_level in range(1, 31) and self.charge_level in range(1, round(self.charge_capacity / 3)): <NEW_LINE> <INDENT> self.condition = 'crit...
check the robots current health status
625941c33346ee7daa2b2d39
def dataset_test(): <NEW_LINE> <INDENT> filename = "dataset/iris.data" <NEW_LINE> dataset = NN.Dataset(filename) <NEW_LINE> eq_((148,5),np.shape(dataset.data))
Test function that loads dataset
625941c3091ae35668666f2f
def __getitem__(self, index): <NEW_LINE> <INDENT> sample = [] <NEW_LINE> for framePath in self.framesPath[index]: <NEW_LINE> <INDENT> image = _pil_loader(framePath) <NEW_LINE> if self.transform is not None: <NEW_LINE> <INDENT> image = self.transform(image) <NEW_LINE> <DEDENT> sample.append(image) <NEW_LINE> <DEDENT> re...
Returns the sample corresponding to `index` from dataset. The sample consists of two reference frames - I0 and I1 - and a intermediate frame between I0 and I1. Parameters ---------- index : int Index Returns ------- tuple (sample, returnIndex) where sample is [I0, intermediate_frame,...
625941c391f36d47f21ac4bf
def create_workarea(self): <NEW_LINE> <INDENT> stats = StatsEngine() <NEW_LINE> stats.__settings = self.__settings <NEW_LINE> return stats
Creates and returns a new empty stats engine object. This would be used to distill stats from a single web transaction before then merging it back into the parent under a thread lock.
625941c3287bf620b61d3a33
def maximum_likelihood_estimation(self) -> (np.ndarray, np.ndarray): <NEW_LINE> <INDENT> pos_tags_counts = self.pos_count[1:] <NEW_LINE> pos_prob = pos_tags_counts / pos_tags_counts.sum() <NEW_LINE> emission_prob = np.zeros(shape=(self.pos_size, self.words_size), dtype=np.float32) <NEW_LINE> for i in range(1, self.pos_...
Calculate the Maximum Likelihood estimation of the multinomial and emission probabilities for the baseline model. :return: two numpy arrays - one is the multinomial distribution over the pos-tags, and the other is the emission probabilities.
625941c399fddb7c1c9de360
def lmul(self, x): <NEW_LINE> <INDENT> return T.dot(x, self._W)
.. todo:: WRITEME Parameters ---------- x : ndarray, 1d or 2d The input data
625941c34f88993c3716c037
@depends(HAS_PYVMOMI) <NEW_LINE> @supports_proxies('esxvm', 'esxcluster', 'esxdatacenter') <NEW_LINE> @gets_service_instance_via_proxy <NEW_LINE> def power_off_vm(name, datacenter=None, service_instance=None): <NEW_LINE> <INDENT> log.trace('Powering off virtual machine {0}'.format(name)) <NEW_LINE> vm_properties = [ 'n...
Powers off a virtual machine specified by it's name. name Name of the virtual machine datacenter Datacenter of the virtual machine service_instance Service instance (vim.ServiceInstance) of the vCenter. Default is None. .. code-block:: bash salt '*' vsphere.power_off_vm name=my_vm
625941c3a934411ee3751661
def get_balance(self, select=1): <NEW_LINE> <INDENT> cmds = [ { 'cmd': 'transfer/assets', 'body': {'select': select} } ] <NEW_LINE> return self.signed_request('POST', 'transfer', cmds)
查询余额 :param select: :return:
625941c39c8ee82313fbb742
def _read_HTK_feats_SCP(self, file_name=None): <NEW_LINE> <INDENT> if (file_name == None or not os.path.exists(file_name)): <NEW_LINE> <INDENT> message = "An error occur while reading SCP file({0}), code:{1}, File Non-exists".format(file_name, 1) <NEW_LINE> raise Exception(message) <NEW_LINE> <DEDENT> feats = [] <NEW_L...
Read the SCP files in HTK format: xxxxxxx.feats=/path/to/xxxxxx.feats[start_position, end_position] Output: code, feats(dictionary, ('name(xxxxxx)':['path(/path/to/xxxxxx.feats)', length] ) ), feats_list(list, all feats names), feat_nframes(int list, num of frames of each utt) code: 0: Success 1: Fi...
625941c330bbd722463cbd93
def _parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description="Execute the ParallelCluster DCV External Authenticator") <NEW_LINE> parser.add_argument("--port", help="The port in which you want to start the HTTP server", type=int) <NEW_LINE> parser.add_argument("--certificate", help="The certifica...
Parse command line arguments.
625941c3e76e3b2f99f3a7dc
def settings(): <NEW_LINE> <INDENT> device_id = _get_device_id() <NEW_LINE> request_edit = request.vars.edit == 'y' <NEW_LINE> is_edit = device_id is None or request_edit <NEW_LINE> form = SQLFORM.factory(Field('device_id', default=device_id), readonly=not is_edit) <NEW_LINE> if is_edit: <NEW_LINE> <INDENT> form.add_bu...
Settings page for the device to set device ID.
625941c38c0ade5d55d3e988
def test_0099_cleanup(self): <NEW_LINE> <INDENT> TestStaticRoute._client.logout()
Release all resources held by this object for testing purposes.
625941c39f2886367277a85d
@ZKConnection(config) <NEW_LINE> def vm_start(zkhandler, name): <NEW_LINE> <INDENT> retflag, retdata = pvc_vm.start_vm(zkhandler, name) <NEW_LINE> if retflag: <NEW_LINE> <INDENT> retcode = 200 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> retcode = 400 <NEW_LINE> <DEDENT> output = {"message": retdata.replace('"', "'")}...
Start a VM in the PVC cluster.
625941c3460517430c394158
def raw(self, cells, N): <NEW_LINE> <INDENT> d = {} <NEW_LINE> k = {} <NEW_LINE> start = 0 <NEW_LINE> step = 0 <NEW_LINE> for i in range(8): <NEW_LINE> <INDENT> start = start | (cells[i] << i) <NEW_LINE> <DEDENT> d[start] = step <NEW_LINE> k[step] = start <NEW_LINE> nn = 0 <NEW_LINE> while nn < N: <NEW_LINE> <INDENT> s...
:type cells: List[int] :type N: int :rtype: List[int]
625941c3091ae35668666f30
def __init__(self, adapter, host_uuid): <NEW_LINE> <INDENT> self.adapter = adapter <NEW_LINE> self.host_uuid = host_uuid <NEW_LINE> self._validate_vopt_vg() <NEW_LINE> self.vios_uuid = ConfigDrivePowerVM._cur_vios_uuid <NEW_LINE> self.vios_name = ConfigDrivePowerVM._cur_vios_name <NEW_LINE> self.vg_uuid = ConfigDrivePo...
Creates the config drive manager for PowerVM. :param adapter: The pypowervm adapter to communicate with the system. :param host_uuid: The UUID of the host system.
625941c31b99ca400220aa80
def get_intermediate_timestamp(self, divisor: int=2, factor: int=1) -> int: <NEW_LINE> <INDENT> start = Util.get_timestamp_from_datetime_str(self.statistics.get_pcap_timestamp_start()) <NEW_LINE> end = Util.get_timestamp_from_datetime_str(self.statistics.get_pcap_timestamp_end()) <NEW_LINE> if factor > divisor: <NEW_LI...
Calculates a timestamp, which lays within the input pcap. By default a timestamp in the middle of the pcap. :param divisor: The number of intervals in which the pcap length should be divided. :param factor: The number of the interval from which to get the timestamp. :return: The calculated timestamp.
625941c3ec188e330fd5a771
def transcode_to_jpeg(image, path, width, height): <NEW_LINE> <INDENT> i_width, i_height = image.size <NEW_LINE> new_width = i_width if width is None else width <NEW_LINE> new_height = i_height if height is None else height <NEW_LINE> new_path = new_rendered_path(path, width, height, ext='jpg') <NEW_LINE> if is_rendere...
Transcodes an image to JPEG. @param image: Opened image to transcode to jpeg. @type image: PIL.Image @param path: Path to the opened image. @type path: u"/path/to/image" @param width: Desired width of the transcoded image. @type width: int @param height: Desired height of the transcoded image. @type height: int...
625941c326068e7796caecaa
def enumerate_configs(config_dir, extension='.cfg'): <NEW_LINE> <INDENT> if not os.path.isdir(config_dir): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for item in os.listdir(config_dir): <NEW_LINE> <INDENT> if item.endswith(extension): <NEW_LINE> <INDENT> yield item
List configuration files from ``config_dir`` with ``extension``. :param str config_dir: path to the configuration directory :param str extension: configuration file's extension (default to ``.cfg``) :return: a list of configuration filenames found in ``config_dir`` with the correct ``extension`` :rtype: list ...
625941c3379a373c97cfab13
def allow_trunk_vlans_on_port(self, port, vlan_range, action_map=None, error_map=None): <NEW_LINE> <INDENT> return CommandTemplateExecutor(cli_service=self._cli_service, command_template=add_remove_vlan.ALLOW_TRUNK_VLAN_ON_PORT, action_map=action_map, error_map=error_map).execute_command(port=port, vlan_range=vlan_rang...
:param port: :param vlan_range: :param action_map: :param error_map: :return:
625941c350485f2cf553cd68
def on_ready(self): <NEW_LINE> <INDENT> if self.keys: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
If there is no input queued, we return True to indicate that we are waiting for input (and therefore blocked).
625941c30a50d4780f666e5f
def __init__(self, attribute_type_id=None, id=None, max=None, min=None): <NEW_LINE> <INDENT> self._attribute_type_id = None <NEW_LINE> self._id = None <NEW_LINE> self._max = None <NEW_LINE> self._min = None <NEW_LINE> self.discriminator = None <NEW_LINE> if attribute_type_id is not None: <NEW_LINE> <INDENT> self.attrib...
XmlNs0ComplexRelationAttributeTypeRequest - a model defined in Swagger
625941c33539df3088e2e31a
def check_int(value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ivalue = int(value) <NEW_LINE> if ivalue < 0: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> <DEDENT> except ValueError: <NEW_LINE> <INDENT> raise argparse.ArgumentTypeError("n must be a non-negative integer or max") <NEW_LINE> <DEDENT> return...
Check if value is a non-negative integer. Raises a ValueError if it is not. value: value to check return: value as an int This function is used in the ArgumentParser to check for valid input.
625941c35fdd1c0f98dc0201
def test_unroll_config_no_batch(self): <NEW_LINE> <INDENT> tmp = tempfile.NamedTemporaryFile(delete=False) <NEW_LINE> tmp.write(self.config_file) <NEW_LINE> tmp.close() <NEW_LINE> kwargs = {"config": tmp.name} <NEW_LINE> res = substitute_config(**kwargs) <NEW_LINE> res = unroll_config(res) <NEW_LINE> self.assertTrue("t...
test whether config is not unrolled if batch is not defined
625941c3d8ef3951e324350c
def step(self): <NEW_LINE> <INDENT> dt = self.gravsys.dt <NEW_LINE> a = self.acc() <NEW_LINE> self.vel = self.vel + dt * a <NEW_LINE> xOld, yOld = self.pos() <NEW_LINE> self.setpos(self.pos() + dt * self.vel) <NEW_LINE> xNew, yNew = self.pos() <NEW_LINE> if self.gravsys.bodies.index(self) == 1: <NEW_LINE> <INDENT> dir_...
Calculate position, orientation, and velocity of a body.
625941c3925a0f43d2549e44
def __init__(self, cond_samples=None): <NEW_LINE> <INDENT> self.condition_counts = defaultdict(int) <NEW_LINE> self.sample_counts = defaultdict(int) <NEW_LINE> super(ConditionalFreqDist, self).__init__(cond_samples)
Construct a new empty conditional frequency distribution. In particular, the count for every sample, under every condition, is zero. :param cond_samples: The samples to initialize the conditional frequency distribution with :type cond_samples: Sequence of (condition, sample) tuples
625941c3566aa707497f453a
def submit_job(user, **kwargs): <NEW_LINE> <INDENT> if 'jobDefinition' not in kwargs: <NEW_LINE> <INDENT> raise ValueError("no jobDefinition set") <NEW_LINE> <DEDENT> if not can_submit(user, kwargs['jobDefinition']): <NEW_LINE> <INDENT> msg = "You don't have permission to run a job with this task role" <NEW_LINE> raise...
A proxy for the submit_job call on boto3's batch client. Injects the username into an environment variable. Args: user -- The username we are submitting on behalf of. kwargs -- Arguments passed through to boto3.batch.submit_job() Returns: Whatever boto3.batch.submit_job returns. Raises: Whatever boto3.batch.sub...
625941c3a219f33f3462893b
def combine(self, source1, source2): <NEW_LINE> <INDENT> v = 0 <NEW_LINE> while len(source1._values)>0 or len(source2._values)>0: <NEW_LINE> <INDENT> if len(source1._values)>0 and len(source2._values)>0: <NEW_LINE> <INDENT> if v%2==0: <NEW_LINE> <INDENT> value = source1._values[len(source1._values)-1] <NEW_LINE> source...
------------------------------------------------------- Combines two source stacks into the current target stack. When finished, the contents of source1 and source2 are interlaced into target and source1 and source2 are empty. Use: target.combine(source1, source2) -------------------------------------------------------...
625941c3d6c5a10208144018
def auth_zone_update_with_http_info(self, id, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['id', 'body'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> par...
Update the Auth Zone object. # noqa: E501 Use this method to update an Auth Zone object. This object (dns/auth_zone) represents an authoritative zone. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.auth_zone_upda...
625941c3ad47b63b2c509f4e
def update_input(self, e, r, y, dt=0.01): <NEW_LINE> <INDENT> k0 = [0.0 for _ in range(4)] <NEW_LINE> k1 = [0.0 for _ in range(4)] <NEW_LINE> k2 = [0.0 for _ in range(4)] <NEW_LINE> k3 = [0.0 for _ in range(4)] <NEW_LINE> functions = [self._func_theta_1, self._func_u_1, self._func_theta_2, self._func_u_2] <NEW_LINE> fo...
calculating the input Parameters ------------ e : float error value of system r : float reference value y : float output the model value dt : float in seconds, optional sampling time of simulation, default is 0.01 [s]
625941c363b5f9789fde70b4
def t_F_TRIG_CAR(t): <NEW_LINE> <INDENT> return t
\\sin\^|\\cos\^|\\tan\^
625941c34d74a7450ccd4192
def tearDown(self): <NEW_LINE> <INDENT> DeleteWorkspace(self._sample_ws) <NEW_LINE> DeleteWorkspace(self._res_ws)
Remove workspaces from ADS.
625941c33317a56b86939c2b
def _converters_for(to_types): <NEW_LINE> <INDENT> return [_strict_converter_for(_type) for _type in to_types]
Return a list of converters based on the target types in to_types
625941c371ff763f4b549657
@pytest.fixture(scope='function') <NEW_LINE> def new_entry(request, dbtransaction, entry_dict): <NEW_LINE> <INDENT> new_model = Entry(**entry_dict) <NEW_LINE> with transaction.manager: <NEW_LINE> <INDENT> DBSession.add(new_model) <NEW_LINE> <DEDENT> def teardown(): <NEW_LINE> <INDENT> with transaction.manager: <NEW_LIN...
Create an entry to test db.
625941c39b70327d1c4e0da3
def test_create_filediffs_commit_file_count(self): <NEW_LINE> <INDENT> repository = self.create_repository() <NEW_LINE> diffset = DiffSet.objects.create_empty(repository=repository) <NEW_LINE> commits = [ DiffCommit.objects.create( diffset=diffset, filename='diff', author_name='Author Name', author_email='author@exampl...
Testing create_filediffs() with a DiffSet and a DiffCommit
625941c37d43ff24873a2c6e