code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def process_data(self, data): <NEW_LINE> <INDENT> raise NotImplementedError()
Process Data from SerialDevice
625941f1bde94217f36833ac
def testZoomRoomList(self): <NEW_LINE> <INDENT> pass
Test ZoomRoomList
625941f15fcc89381b1e1c84
def __repr__(self): <NEW_LINE> <INDENT> return ''.join(["Master [ ", self.name, "]" "\n uri: ", self.uri, "\n timestamp: ", self.timestamp, "\n syncts: ", self.syncts])
Produce a string representation of the master item.
625941f150485f2cf553d35c
def test_user(self): <NEW_LINE> <INDENT> testuser = TeamMemberFactory.create().user <NEW_LINE> video, tv = self._create_tv_with_original_subs(self.user, self.team) <NEW_LINE> self._upload_sv_translation(video, testuser, complete=True) <NEW_LINE> report = BillingFactory(start_date=(datetime.date.today() - datetime.timed...
User credit with subtitles is listed in the record.
625941f1596a89723608a079
def step(self): <NEW_LINE> <INDENT> self.phi += np.random.uniform(self.d_theta_range[0], self.d_theta_range[1]) <NEW_LINE> self.theta += np.random.uniform(self.d_theta_range[0], self.d_theta_range[1]) <NEW_LINE> dx, dy, dz = self.get_dx_dy_dz() <NEW_LINE> oldx = self.x <NEW_LINE> oldy = self.y <NEW_LINE> oldz = self.z ...
Update the angle (phi), x- and y-locations and obtain fluid velocity :return: new (x,y)-location and fluid velocity
625941f18c3a873295158983
def insert(self): <NEW_LINE> <INDENT> attrs = self.get_attr(self) <NEW_LINE> if attrs[self.__pk] is None: <NEW_LINE> <INDENT> last = self.last() <NEW_LINE> last_pk = 0 if last is None else eval('last.' + self.__pk) <NEW_LINE> exec('self.{} = last_pk + 1'.format(self.__pk, self.__pk)) <NEW_LINE> attrs[self.__pk] = eval(...
Create object information in file.
625941f166656f66f7cbc76d
def test_init(self): <NEW_LINE> <INDENT> from Perspectives import Notary
Test basic creation of Notary class
625941f123e79379d52eeb1c
def control_1_23_no_active_initial_access_keys_with_iam_user(credreport): <NEW_LINE> <INDENT> result = True <NEW_LINE> failReason = "" <NEW_LINE> offenders = [] <NEW_LINE> control = "1.23" <NEW_LINE> description = "Do not setup access keys during initial user setup for all IAM users that have a console password" <NEW_L...
Summary Returns: TYPE: Description
625941f1c4546d3d9de72ffa
def _get_cell(self, address, call_handler=True): <NEW_LINE> <INDENT> block, cell = self.get_address_tuple(address) <NEW_LINE> if call_handler: <NEW_LINE> <INDENT> self.handler(block, cell) <NEW_LINE> <DEDENT> return self._cells[block][cell]
Grąžina atminties ląstelę, kuri yra nurodyta adresu.
625941f10a50d4780f667458
def __set__(self, media_file, value): <NEW_LINE> <INDENT> frame = self.frame_type(encoding=3, text=value) <NEW_LINE> media_file.mg_file[self.frame_name] = frame
Set the field in the mutagen file
625941f14e4d5625662d4990
def get_assembly_size(self): <NEW_LINE> <INDENT> self.assembly_size = sum((len(str(seq)) for seq in self.contigs))
Calculate the sum of all contig lengths
625941f185dfad0860c3b41e
def forward(self, words_idx, batch_size, hidden, cell): <NEW_LINE> <INDENT> embeds = self.vocab.vectors[words_idx].to(glob.device) <NEW_LINE> if glob.run_embed_tests: <NEW_LINE> <INDENT> self.embed_test.test_embedLookup(embeds=embeds, words_idx=words_idx, vocab=self.vocab) <NEW_LINE> <DEDENT> embeds = embeds.view(-1, b...
batch_size words are fed in parallel to the network, with shape (1xbatch_size). After embedding lookup, the output has shape (1, batch_size, embedding_dim)
625941f14428ac0f6e5badb8
def remove_vlan_int(self, vlan_id, nexus_host, nexus_user, nexus_password, nexus_ports, nexus_ssh_port): <NEW_LINE> <INDENT> man = self.nxos_connect(nexus_host, int(nexus_ssh_port), nexus_user, nexus_password) <NEW_LINE> for ports in nexus_ports: <NEW_LINE> <INDENT> self.disable_vlan_on_trunk_int(man, ports, vlan_id)
Remove vlan. Removes a vlan from interfaces on the Nexus switch given the VLAN ID.
625941f1cc40096d61595f0e
def _getCommand(self, *args, **kw): <NEW_LINE> <INDENT> hostname, port = openoffice.getAddress() <NEW_LINE> kw['hostname'] = hostname <NEW_LINE> kw['port'] = port <NEW_LINE> python = path.join(self.office_binary_path, "python") <NEW_LINE> command_list = [path.exists(python) and python or "python", pkg_resources.resourc...
Transforms all parameters passed in a command
625941f14a966d76dd5515d6
def test_random(): <NEW_LINE> <INDENT> for method in [uniform, latin, sobol]: <NEW_LINE> <INDENT> yield check_random, method
Test all the random generators.
625941f130c21e258bdfaa65
def h_bubble(heigth_layer, epsi_vapor): <NEW_LINE> <INDENT> return heigth_layer / (1 - epsi_vapor)
Calculates the heigth of bubble layer. Parameters ---------- epsi_vapor : float The vapor content of bubble layer, [dimensionless] heigth_layer : float The heigth ligth layer of the liquid, [m] Returns ------- h_bubble : float The heigth of of bubble layer. [m] References ---------- Дытнерский, страница 24...
625941f1f548e778e58cdb41
@task(pre=[clean]) <NEW_LINE> def docbuild(c): <NEW_LINE> <INDENT> os.chdir("docs") <NEW_LINE> build_dir = os.environ.get("BUILD_DIR", "_build/html") <NEW_LINE> c.run("python -msphinx -W -b html -d _build/doctrees . %s" % build_dir)
Build documentation.
625941f15fcc89381b1e1c85
def calc_eofs(data, num_eigs, ret_pcs=False, var_stats_dict=None): <NEW_LINE> <INDENT> if is_dask_array(data): <NEW_LINE> <INDENT> pcs, full_svals, eofs = da.linalg.svd_compressed(data, num_eigs) <NEW_LINE> var = da.var(data, axis=0) <NEW_LINE> out_svals = np.zeros(num_eigs) <NEW_LINE> out_eofs = np.zeros((num_eigs, da...
Method to calculate the EOFs of given dataset. This assumes data comes in as an m x n matrix where m is the temporal dimension and n is the spatial dimension. Parameters ---------- data: ndarray Dataset to calculate EOFs from num_eigs: int Number of eigenvalues/vectors to return. Must be less than min(m, n)...
625941f126238365f5f0f437
def decodeString(self, s): <NEW_LINE> <INDENT> s = list(s) <NEW_LINE> from collections import defaultdict <NEW_LINE> temp = defaultdict(str) <NEW_LINE> right = 0 <NEW_LINE> while s: <NEW_LINE> <INDENT> c = s.pop() <NEW_LINE> if 'a'<= c <= 'z': <NEW_LINE> <INDENT> temp[right] = c + temp[right] <NEW_LINE> <DEDENT> elif c...
:type s: str :rtype: str
625941f17b25080760e39a16
def error_report(self, step, expect_value, monitor_value, guest_value): <NEW_LINE> <INDENT> logging.error("Memory size mismatch %s:\n" % step) <NEW_LINE> error_msg = "Wanted to be changed: %s\n" % abs(self.old_mmem - expect_value) <NEW_LINE> error_msg += "Changed in monitor: %s\n" % abs(self.old_mmem - monitor_value) <...
Generate the error report :param step: the step of the error happen :param expect_value: memory size assign to the vm :param monitor_value: memory size report from monitor :param guest_value: memory size report from guest
625941f123e79379d52eeb1d
def modelMatrix( self, direction=None, inverse=False ): <NEW_LINE> <INDENT> if direction is None: <NEW_LINE> <INDENT> direction = getattr( self,'direction',None) <NEW_LINE> <DEDENT> if direction: <NEW_LINE> <INDENT> rot = vectorutilities.orientToXYZR( (0,0,-1), direction ) <NEW_LINE> rotate = transformmatrix.rotMatrix(...
Calculate our model-side matrix
625941f1be383301e01b5a3b
def run(self, command): <NEW_LINE> <INDENT> os.system(f"multipass exec {command}")
list function will execute mulitpass exec command
625941f115fb5d323cde10da
def get_rsa_signature(self, digest: str, key: RSA._RSAobj) -> str: <NEW_LINE> <INDENT> log.info("Generating RSA signature using private key") <NEW_LINE> log.info("\t Performing encryption") <NEW_LINE> cipher = PKCS1_v1_5.new(key) <NEW_LINE> sig_as_bin_str = cipher.sign(digest) <NEW_LINE> sig_as_base16_str = base64.b16e...
Generates a digital signature by signing a message digest with a private key. Please note that while any type of data can be signed, only data that corresponds to one of the PyCrypto.Hash types can be later verified. This method also tests for encoding errors bu making sure that the digital signature can be veri...
625941f1097d151d1a223417
def _visit_infix2(self, ctx, operation: str): <NEW_LINE> <INDENT> lhs = self.visit_infix2(ctx) <NEW_LINE> rhs = self.visit_infix3(ctx) <NEW_LINE> return f'{lhs} {operation} {rhs}'
:param operation: Operation as a string.
625941f1293b9510aa2c3851
def _use_alua(self, initiator_name, multipath_type): <NEW_LINE> <INDENT> url = "/iscsi_initiator" <NEW_LINE> data = json.dumps({"ID": initiator_name, "MULTIPATHTYPE": multipath_type}) <NEW_LINE> result = self.call(url, data, "PUT") <NEW_LINE> self._assert_rest_result( result, _('Use ALUA to associate initiator to host ...
Use ALUA when adding initiator to host.
625941f12c8b7c6e89b35d7d
def __init__( self, engine: Engine, compute_service: ComputeService, project: Project ): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.engine = engine <NEW_LINE> self.compute_service = compute_service <NEW_LINE> self.project = project
Default constructor to be inherited by subclasses. Not intended for direct use: use :py:meth:`from_compute_service` instead.
625941f10a366e3fb873ede1
def plotOutline(self, maptype=None, colour='#AAAAAA', **kwargs): <NEW_LINE> <INDENT> if maptype is None: <NEW_LINE> <INDENT> maptype=self.defaultMap <NEW_LINE> <DEDENT> xarr = [] <NEW_LINE> yarr = [] <NEW_LINE> radec = self.currentRaDec <NEW_LINE> for ch in [20,4,11,28,32, 71,68, 84, 75, 60, 56, 15 ]: <NEW_LINE> <INDEN...
Plot an outline of the FOV.
625941f1656771135c3ebe37
def __gt__(self,other): <NEW_LINE> <INDENT> return self._cs > getCase(other)
Comparison greater than.
625941f1167d2b6e31219156
def __matmul__(self, other: Any) -> "Model": <NEW_LINE> <INDENT> if "@" not in self._context_operators.get(): <NEW_LINE> <INDENT> raise TypeError("Undefined operator: @") <NEW_LINE> <DEDENT> return self._context_operators.get()["@"](self, other)
Apply the function bound to the '@' operator.
625941f15166f23b2e1a571a
def test_can_twice_allocate_ng_purchase2(self): <NEW_LINE> <INDENT> batch = Batch('batch-001', 'ELEGANT-LAMP', 20, eta=date.today()) <NEW_LINE> batch.allocate(OrderLine('order-123', 'ELEGANT-LAMP', 2)) <NEW_LINE> batch.allocate(OrderLine('order-1233', 'ELEGANT-LAMPP', 2)) <NEW_LINE> self.assertEqual(18, batch.available...
オーダー番号が違っても商品が違うと受け付けない
625941f123849d37ff7b364b
def do_implicit_flow_authorization(self, session): <NEW_LINE> <INDENT> logger.info('Doing implicit flow authorization, app_id=%s', self.app_id) <NEW_LINE> auth_data = { 'client_id': self.app_id, 'display': 'mobile', 'response_type': 'token', 'scope': self.scope, 'redirect_uri': 'https://oauth.vk.com/blank.html', 'v': s...
Standard OAuth2 authorization method. It's used for getting access token More info: https://vk.com/dev/implicit_flow_user
625941f13617ad0b5ed684b7
def get_vms_statistics(self): <NEW_LINE> <INDENT> log.debug('Enter') <NEW_LINE> if self.hypervisor_type == 'kvm': <NEW_LINE> <INDENT> self._get_processes_kvm() <NEW_LINE> self._get_vms_system_kvm() <NEW_LINE> self._get_vms_disk_kvm() <NEW_LINE> <DEDENT> elif self.hypervisor_type == 'esx': <NEW_LINE> <INDENT> self._buil...
Get server VMS related statistics Return: json
625941f1462c4b4f79d1dc90
def update_phantom_labeler(self, temperature = 3, verbose= 2): <NEW_LINE> <INDENT> if verbose >=2: <NEW_LINE> <INDENT> print (".. Creating the labeler network") <NEW_LINE> <DEDENT> self.phantom_labeler = network () <NEW_LINE> if not temperature is None: <NEW_LINE> <INDENT> self.temperature = temperature <NEW_LINE> <DED...
This method sets up the phantom labeler network which is basically the same network that takes the GAN as input and produces softmaxes.
625941f19c8ee82313fbbd39
def atacarOponente(self,jogador,pos): <NEW_LINE> <INDENT> posicaoLetra = pos[0].upper() <NEW_LINE> posicaoNum = int(pos[1:]) <NEW_LINE> posicao = pos.upper() <NEW_LINE> if (posicaoLetra in LETRAS_TABULEIRO) and (posicaoNum >= 1 and posicaoNum <= TAM_PADRAO) and (not (posicao in jogador.tabuleiro.listaJaAtingidas)): <NE...
Método que executa a jogada do jogador perante ao oponente. *Parâmetros: -jogador: Jogador Oponente -pos: Posição do ataque. Ex: "A1", "J9", "E4" *Retorno: (boolean,boolean,boolean) -> 1) Operação sucedida ou não; 2) Acertou ou não um navio (serve para mant...
625941f1498bea3a759ba06e
def _list_streams(self): <NEW_LINE> <INDENT> stream_names = [] <NEW_LINE> params = {'Limit': 20} <NEW_LINE> while 1: <NEW_LINE> <INDENT> response = self._client.list_streams(**params) <NEW_LINE> if not utils.is_http_ok(response): <NEW_LINE> <INDENT> msg = 'Failed to list Kinesis streams, errorcode={}'.format( utils.htt...
:return: a list of stream names in this region
625941f10fa83653e4657578
def test_compile_strange_glyph_order(self): <NEW_LINE> <INDENT> NEW_ORDER = ['b', 'a', 'c', 'space', '.notdef'] <NEW_LINE> EXPECTED_ORDER = ['.notdef', 'b', 'a', 'c', 'space'] <NEW_LINE> self.ufo.lib['public.glyphOrder'] = NEW_ORDER <NEW_LINE> compiler = OutlineTTFCompiler(self.ufo) <NEW_LINE> compiler.compile() <NEW_L...
Move space and .notdef to end of glyph ids ufo2ft always puts .notdef first.
625941f17cff6e4e81117f47
def get_episode_number(self): <NEW_LINE> <INDENT> return self.__episode_number
Get the episode number of this episode.
625941f115baa723493c453c
def generatePackageString(self, packageList): <NEW_LINE> <INDENT> packageString = "" <NEW_LINE> for p in packageList: <NEW_LINE> <INDENT> packageString = p + ' ' + packageString <NEW_LINE> <DEDENT> return packageString
Generates String from supplied List
625941f1283ffb24f3c55ebc
def polygon_subgraph(G, polygon, nneighbours=0, copy=True): <NEW_LINE> <INDENT> nodes = set(n for n, p in iteritems(G.nodes) if polygon.contains(Point(p['pos']))) <NEW_LINE> if nneighbours > 0: <NEW_LINE> <INDENT> nodes.update(reduce(set.union, islice(BreadthFirstLevels(G, nodes), 1, 1+nneighbours))) <NEW_LINE> <DEDENT...
Cut out portion of graph `G`s nodes contained in shapely.geometry.Polygon `polygon` and their `nneighbours`th neighbours (which are partly outside of polygon).
625941f13617ad0b5ed684b8
def CopyTo(self,array,index): <NEW_LINE> <INDENT> pass
CopyTo(self: ICollection,array: Array,index: int) Copies the elements of the System.Collections.ICollection to an System.Array,starting at a particular System.Array index. array: The one-dimensional System.Array that is the destination of the elements copied from System.Collections.ICollection. The Syst...
625941f1a8ecb033257d368c
def parse_filename(self, txt): <NEW_LINE> <INDENT> arr = txt.split('; ') <NEW_LINE> data = {} <NEW_LINE> for item in arr: <NEW_LINE> <INDENT> arr1 = item.split('=') <NEW_LINE> if len(arr1) == 2: <NEW_LINE> <INDENT> data[arr1[0]] = arr1[1].replace('"', '') <NEW_LINE> <DEDENT> <DEDENT> if 'name' in data: <NEW_LINE> <INDE...
# form-data; name="file"; filename="部署高可用性MySQL.docx"
625941f194891a1f4081c06e
def ReadNode(self): <NEW_LINE> <INDENT> if 'pos' in self._node.props: <NEW_LINE> <INDENT> self.Raise("Please use 'offset' instead of 'pos'") <NEW_LINE> <DEDENT> self.offset = fdt_util.GetInt(self._node, 'offset') <NEW_LINE> self.size = fdt_util.GetInt(self._node, 'size') <NEW_LINE> self.orig_offset = fdt_util.GetInt(se...
Read entry information from the node This must be called as the first thing after the Entry is created. This reads all the fields we recognise from the node, ready for use.
625941f110dbd63aa1bd3163
def get_class_all_instances(self, class_): <NEW_LINE> <INDENT> return self.call("get-class-all-instances", class_)
Get all frames that are direct or indirect instances of class. Arguments --------- class_: A class frame. Returns ------- A list of all frames that are direct or indirect instances of class_. Example ------- >>> ecocyc.get_class_all_instances('|Reactions|') ['RXN0-6505', 'RXN0-3002', 'RXN0-3141', 'R131-RXN', ... ] ...
625941f1dc8b845886cb5af8
def measure_offset(img1, img2, method="numpy", withLog=False, withCorr=False): <NEW_LINE> <INDENT> method = str(method) <NEW_LINE> shape = img1.shape <NEW_LINE> logs = [] <NEW_LINE> assert img2.shape == shape <NEW_LINE> t0 = time.time() <NEW_LINE> i1f = numpy.fft.fft2(img1) <NEW_LINE> i2f = numpy.fft.fft2(img2) <NEW_LI...
Measure the actual offset between 2 images @param img1: ndarray, first image @param img2: ndarray, second image, same shape as img1 @param withLog: shall we return logs as well ? boolean @return: tuple of floats with the offsets
625941f166673b3332b92652
def tdm_send_file_stop(self): <NEW_LINE> <INDENT> user_event = "Stop Send File" <NEW_LINE> gclist = list() <NEW_LINE> return self.cas_event(user_event, gclist, timeout_default)
Stop file transmission on the line :returns: boolean
625941f10383005118ecfba2
def setZeroResettableKWH(self, password="00000000"): <NEW_LINE> <INDENT> result = False <NEW_LINE> self.setContext("setZeroResettableKWH") <NEW_LINE> try: <NEW_LINE> <INDENT> if not self.requestA(): <NEW_LINE> <INDENT> self.writeCmdMsg("Bad read CRC on setting") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not self...
Serial call to zero resettable kWh registers. Args: password (str): Optional password. Returns: bool: True on completion and ACK.
625941f124f1403a92601122
def test_cenario_14(self): <NEW_LINE> <INDENT> pass
Rubrica 484 - Desconto VA/VR DADO um funcionário com Desconto VA/VR de R$ 6,04 E com Salário Base de R$ 14.413,96 QUANDO trabalhar por 30 dias ENTÃO o cálculo da Rubrica 484-Desconto VA/VR deve ser R$ 6,04
625941f12ae34c7f2600d6f2
def test_dataset_03(self): <NEW_LINE> <INDENT> dna = 'CCGGGT' <NEW_LINE> min_skew_indices = get_minimum_skews(dna) <NEW_LINE> expected = '2' <NEW_LINE> self.assertEqual(expected, ToSingleLineOfString(min_skew_indices))
This dataset makes sure you are not accidentally finding the maximum skew instead of the minimum skew.
625941f1f9cc0f698b140bb8
def wait_for_bitcoind_start(process, url, i): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> if process.poll() is not None: <NEW_LINE> <INDENT> raise Exception('mitocoind exited with status %i during initialization' % process.returncode) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> rpc = get_rpc_proxy(url, i) <NEW...
Wait for bitcoind to start. This means that RPC is accessible and fully initialized. Raise an exception if bitcoind exits during initialization.
625941f17b180e01f3dc4db2
def __init__(self, v, dtype=None): <NEW_LINE> <INDENT> if dtype is None: <NEW_LINE> <INDENT> dtype = aesara.config.floatX <NEW_LINE> <DEDENT> self.dtype = dtype <NEW_LINE> v = v.astype(self.dtype) <NEW_LINE> s = v**0.5 <NEW_LINE> self.s = s <NEW_LINE> self.inv_s = 1.0 / s <NEW_LINE> self.v = v
Use a vector to represent a diagonal matrix for a covariance matrix. Parameters ---------- v: vector, 0 <= ndim <= 1 Diagonal of covariance matrix for the potential vector
625941f14f6381625f114ffc
def test_file(self): <NEW_LINE> <INDENT> self.assertTrue(os.path.exists("file.json")) <NEW_LINE> x = 0 <NEW_LINE> u1 = City() <NEW_LINE> u1.save() <NEW_LINE> models.storage.reload() <NEW_LINE> d = models.storage.all() <NEW_LINE> for k in d.keys(): <NEW_LINE> <INDENT> if u1.id in k: <NEW_LINE> <INDENT> x = 1 <NEW_LINE> ...
test storege
625941f1b5575c28eb68e5c7
def apStarPath(loc_id,apogee_id,dr=None): <NEW_LINE> <INDENT> if dr is None: dr= _default_dr() <NEW_LINE> specReduxPath= apogeeSpectroReduxDirPath(dr=dr) <NEW_LINE> if dr == '10': <NEW_LINE> <INDENT> return os.path.join(specReduxPath,'r3','s3', '%i' % loc_id, 'apStar-s3-%s.fits' % apogee_id) <NEW_LINE> <DEDENT> elif dr...
NAME: apStarPath PURPOSE: returns the path of the apStar file INPUT: loc_id - location ID (field for 1m targets) apogee_id - APOGEE ID of the star dr= return the path corresponding to this data release OUTPUT: path string HISTORY: 2015-01-13 - Written - Bovy (IAS)
625941f13346ee7daa2b3333
def _do_import_image(namespace: str, image: str, stdout: Any = None) -> None: <NEW_LINE> <INDENT> parts = image.rsplit("/", maxsplit=1) <NEW_LINE> parts = parts[-1].rsplit(":", maxsplit=1) <NEW_LINE> imagestream_name = parts[0] <NEW_LINE> subcommand = _subprocess_run( ["oc", "import-image", "--namespace", namespace, im...
Import an image to namespace.
625941f1956e5f7376d7142d
def build_prediction(tracefile_lines, src, dst): <NEW_LINE> <INDENT> tcp_packet_size = 1000 <NEW_LINE> prediction = {} <NEW_LINE> throughput_history = [] <NEW_LINE> avg_throughput_history = 0 <NEW_LINE> events = trace.get_prediction_events(tracefile_lines, src, dst) <NEW_LINE> for time, packet_size in events.iteritems(...
Provided tracefile data in nstrace format, predict if dst node will fall out of range from src.
625941f167a9b606de4a8478
def differentiate( self, coord: Hashable, edge_order: int = 1, datetime_unit: str = None ) -> "DataArray": <NEW_LINE> <INDENT> ds = self._to_temp_dataset().differentiate(coord, edge_order, datetime_unit) <NEW_LINE> return self._from_temp_dataset(ds)
Differentiate the array with the second order accurate central differences. .. note:: This feature is limited to simple cartesian geometry, i.e. coord must be one dimensional. Parameters ---------- coord: hashable The coordinate to be used to compute the gradient. edge_order: 1 or 2. Default 1 N-th or...
625941f1be7bc26dc91cdbb6
def revoke_signature(self, signatureID): <NEW_LINE> <INDENT> myContract.functions.revokeSignature( signatureID ).transact()
Send a transaction to revoke a signature. signatureID: the ID of the signature.
625941f107d97122c4178e5b
def iter_children(self, root, **kwargs): <NEW_LINE> <INDENT> return <NEW_LINE> yield
Generate child nodes for the root.
625941f1187af65679ca56e2
def ddt_named(parent, child): <NEW_LINE> <INDENT> args = RenamedTuple([parent, child]) <NEW_LINE> setattr(args, '__name__', 'parent_{}_child_{}'.format(parent, child)) <NEW_LINE> return args
Helper to get more readable dynamically-generated test names from ddt.
625941f1be7bc26dc91cdbb7
def __init__(self): <NEW_LINE> <INDENT> self.qlist = []
Initializes 1 attribute: a list to keep track of the queue's elements
625941f1d99f1b3c44c67b46
def as_dict(self): <NEW_LINE> <INDENT> return {field: serialize(getattr(self, field)) for field in self.get_field_names()}
Return a dictionary mapping field names to their values only for fields specified in the constructor
625941f1cdde0d52a9e535fa
def _format_exception(exc_info): <NEW_LINE> <INDENT> sio = StringIO() <NEW_LINE> traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], None, sio) <NEW_LINE> s = sio.getvalue() <NEW_LINE> sio.close() <NEW_LINE> if s[-1:] == "\n": <NEW_LINE> <INDENT> s = s[:-1] <NEW_LINE> <DEDENT> return s
Prettyprint an `exc_info` tuple. Shamelessly stolen from stdlib's logging module.
625941f1aad79263cf39100c
def get_headers(self): <NEW_LINE> <INDENT> if self.content_disposition: <NEW_LINE> <INDENT> sub_collection = self.collection.results[0] <NEW_LINE> if sub_collection.stop == math.inf: <NEW_LINE> <INDENT> if sub_collection.start: <NEW_LINE> <INDENT> page = f"{sub_collection.start}-end" <NEW_LINE> <DEDENT> else: <NEW_LINE...
Return the response headers
625941f1796e427e537b0b8d
def __init__(self, constructor, pool_size, overflow = 0, timeout = 60, destructor = lambda x: x): <NEW_LINE> <INDENT> self.session_constructor = constructor <NEW_LINE> self.conn_queue = Queue.Queue(pool_size) <NEW_LINE> max_conns = pool_size + overflow <NEW_LINE> self.conn_tokens = Queue.Queue(max_conns) <NEW_LINE> for...
Generic connection pool class. Give it a constructor for a session and tell it how big you want the pool to be. Something like this-- my_pool = ConnectionPool(lambda: get_some_shitty_conn(some_shitty_arg), pool_size = 6) If the connections don't get closed cleanly by garbage collection and need to be explicitly clos...
625941f132920d7e50b28797
def efficientnet(model_name, pretrained=False, override_params=None): <NEW_LINE> <INDENT> _check_model_name_is_valid(model_name, pretrained) <NEW_LINE> blocks_args, global_params, input_size = get_model_params(model_name, override_params) <NEW_LINE> model = EfficientNet(blocks_args, global_params) <NEW_LINE> if pretrai...
Constructs EfficientNet model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet override_params (namedtuple): override the original global params
625941f14527f215b584ca14
def _run_callable_with_postamble(postamble, callable_, *args, **kwargs): <NEW_LINE> <INDENT> def fn(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return callable_(*args, **kwargs) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> postamble() <NEW_LINE> <DEDENT> <DEDENT> return fn
Returns a callable of no args that invokes callable_ (with the specified args and kwargs) and then invokes postamble (with no args). The callable returns the result of (or exception thrown by) callable_.
625941f1fff4ab517eb2fa02
def __init__(self, args=None): <NEW_LINE> <INDENT> GlancesPlugin.__init__(self, args=args) <NEW_LINE> self.glancesgrabhddtemp = GlancesGrabHDDTemp() <NEW_LINE> self.display_curse = False <NEW_LINE> self.reset()
Init the plugin.
625941f199cbb53fe67931a7
def find_lcv(self): <NEW_LINE> <INDENT> self.lcv = np.ravel_multi_index(np.where(self.labels == -1), self.labels.shape) <NEW_LINE> if self.lcv.shape[0] == 0: <NEW_LINE> <INDENT> self.no_lcv = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.no_lcv = False <NEW_LINE> lcv = np.argwhere(self.labels == -1) <NEW_LINE...
Find the low-confidence voxels. Also initialize the 6-voxel neighborhood and the 26-voxel neighborhood for each low-confidence voxel.
625941f14d74a7450ccd4788
def update(num, navdata, line, line_forward, lms_data = None, lms_line = None, predict_data = None, predict_line = None, predict_lines = None): <NEW_LINE> <INDENT> ax.set_xlim(navdata[num,0]-20.0,navdata[num,0]+20.0) <NEW_LINE> ax.set_ylim(navdata[num,1]-20.0,navdata[num,1]+20.0) <NEW_LINE> ax.figure.canvas.draw() <NEW...
Feed(update) data to the ploted vectors
625941f1925a0f43d254a43f
def command(self, node, command, message=None, exitcode=None, steps=True, bash=None, *args, **kwargs): <NEW_LINE> <INDENT> with By("executing command", description=command, format_description=False) if steps else NullStep(): <NEW_LINE> <INDENT> if bash is None: <NEW_LINE> <INDENT> bash = self.bash(node) <NEW_LINE> <DED...
Execute and check command. :param bash: :param node: name of the service :param command: command :param message: expected message that should be in the output, default: None :param exitcode: expected exitcode, default: None :param steps: don't break command into steps, default: True
625941f129b78933be1e5c67
def __call__(self, Rij): <NEW_LINE> <INDENT> if Rij > self.Rc: <NEW_LINE> <INDENT> return 0. <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0.5 * (np.cos(np.pi * Rij / self.Rc) + 1.)
Parameters ---------- Rij : float Distance between pair atoms. Returns ------- float The value of the cutoff function.
625941f155399d3f05588c7a
def test_re_flags(self): <NEW_LINE> <INDENT> module = SimpleModule('g.remove', flags='re', type='raster', pattern='xxxyyyzzz') <NEW_LINE> self.assertModuleFail(module) <NEW_LINE> stderr = module.outputs.stderr <NEW_LINE> self.assertIn('-r', stderr) <NEW_LINE> self.assertIn('-e', stderr)
Test that -r and -e flags are exclusive
625941f1711fe17d82542920
def test_markuptools_Markup___init___03(): <NEW_LINE> <INDENT> markup = markuptools.Markup(27) <NEW_LINE> assert str(markup) == '\\markup { 27 }'
Initialize markup with nonstring and nonmarkup instance.
625941f1ad47b63b2c50a542
def link(icon=True, tooltip=False, classes=None, attrs=None, icon_only=False): <NEW_LINE> <INDENT> if classes is None: <NEW_LINE> <INDENT> classes = [] <NEW_LINE> <DEDENT> if attrs is None: <NEW_LINE> <INDENT> attrs = {} <NEW_LINE> <DEDENT> assert isinstance(classes, list) <NEW_LINE> assert isinstance(attrs, dict) <NEW...
Generates a helper. Attributes: icon -- Shows a content type icon. tooltip -- Adds a "title" attribute and a "rollover" class. classes -- A list of additional classes. attrs -- A dict of additional attributes.
625941f116aa5153ce362a3b
def peek(self): <NEW_LINE> <INDENT> if(is_empty(self)): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.first
Returns item on the top of the stack but does not remove it
625941f1851cf427c661aacc
@asserdb <NEW_LINE> def search(args): <NEW_LINE> <INDENT> obj = Iface(args.db, False, args.debug) <NEW_LINE> obj.find(args.search_words) <NEW_LINE> obj.close()
Find
625941f150485f2cf553d35e
def splitEntityTone(self, entity): <NEW_LINE> <INDENT> entity = unicodedata.normalize("NFD", unicode(entity)) <NEW_LINE> if self.toneMarkType == 'none': <NEW_LINE> <INDENT> plainEntity = entity <NEW_LINE> tone = None <NEW_LINE> <DEDENT> elif self.toneMarkType == 'numbers': <NEW_LINE> <INDENT> matchObj = re.search(u"[12...
Splits the entity into an entity without tone mark and the entity's tone index. The plain entity returned will always be in Unicode's *Normalization Form C* (NFC, see http://www.unicode.org/reports/tr15/). :type entity: str :param entity: entity with tonal information :rtype: tuple :return: plain entity without tone ...
625941f1fff4ab517eb2fa03
def __init__(self, id=None, id_customer=None, fingerprint=None, type=None, os=None, application=None, date_add=None, date_upd=None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': 'int', 'id_customer': 'int', 'fingerprint': 'str', 'type': 'str', 'os': 'str', 'application': 'str', 'date_add': 'str', 'date_upd': 'str' ...
DeviceResponse - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition.
625941f1d10714528d6002ad
def solveB(grid): <NEW_LINE> <INDENT> max_x = max_y = max_pow = max_size = 0 <NEW_LINE> for square_size in tqdm(range(1, len(grid))): <NEW_LINE> <INDENT> x, y, pw = max_power_square(grid, square_size) <NEW_LINE> if pw > max_pow: <NEW_LINE> <INDENT> max_x, max_y, max_pow, max_size = x, y, pw, square_size <NEW_LINE> <DED...
Solve second part of puzzle: brute force.
625941f17c178a314d6efa2c
def _get_range_size(self): <NEW_LINE> <INDENT> return self.__range_size
Getter method for range_size, mapped from YANG variable /network_instances/network_instance/protocols/protocol/ospfv2/areas/area/lsdb/lsa_types/lsa_type/lsas/lsa/opaque_lsa/router_information/tlvs/tlv/segment_routing_sid_label_range/tlvs/tlv/state/range_size (uint32) YANG Description: The number of entries wit...
625941f1eab8aa0e5d26e11d
def pick(self, start, direction, mat): <NEW_LINE> <INDENT> if self.selected_node is not None: <NEW_LINE> <INDENT> self.selected_node.select(False) <NEW_LINE> self.selected_node = None <NEW_LINE> <DEDENT> mindist = sys.maxint <NEW_LINE> closest_node = None <NEW_LINE> for node in self.node_list: <NEW_LINE> <INDENT> hit, ...
Executes selection of a node. :param start: Describes a ray. This is where the ray starts from. Is a numpy array. :param direction: Describes a ray. This is the direction of the ray. Is a numpy array. :param mat: The inverse of the current modelview matrix for the scene. :return: None
625941f12c8b7c6e89b35d7e
def test_bandit_tool_plugin_scan_valid(): <NEW_LINE> <INDENT> btp = setup_bandit_tool_plugin() <NEW_LINE> package = Package( "valid_package", os.path.join(os.path.dirname(__file__), "valid_package") ) <NEW_LINE> package["python_src"] = [ os.path.join(os.path.dirname(__file__), "valid_package", "b404.py") ] <NEW_LINE> i...
Integration test: Make sure the bandit output hasn't changed.
625941f176e4537e8c351c3a
def setLongColorCycle(ax=None): <NEW_LINE> <INDENT> if ax == None: <NEW_LINE> <INDENT> ax = plt.gca() <NEW_LINE> <DEDENT> ax.set_color_cycle(maximumContrastList)
Call this function to set a 22 color long color cycle for the current axis, or for a specified axis.
625941f191f36d47f21acabc
def test_get_public_flu_models(self): <NEW_LINE> <INDENT> with self.app.app_context(): <NEW_LINE> <INDENT> for idx in range(1, 3): <NEW_LINE> <INDENT> flu_model = FluModel() <NEW_LINE> flu_model.id = idx <NEW_LINE> flu_model.name = 'Test model %d' % idx <NEW_LINE> flu_model.source_type = 'google' <NEW_LINE> flu_model.i...
Scenario: Retrieve a list of public FluModel entities
625941f15f7d997b87175060
def run_provider(provider, payload, method, start_time, timeout): <NEW_LINE> <INDENT> log.debug("[%s] Processing %s with %s method" % (provider, provider, method)) <NEW_LINE> filterInstance = Filtering() <NEW_LINE> if method == 'movie': <NEW_LINE> <INDENT> filterInstance.use_movie(provider, payload) <NEW_LINE> <DEDENT>...
Provider thread entrypoint Args: provider (str): Provider ID payload (dict): Search payload from Elementum method (str): Type of search, can be ``general``, ``movie``, ``show``, ``season`` or ``anime`` start_time (int): Time when search has been started timeout (int): Time limit for sear...
625941f121bff66bcd684f10
def main(): <NEW_LINE> <INDENT> jura_data = np.genfromtxt('data.txt', names=True) <NEW_LINE> print('Cobalt concentration (mg/kg) basic statistics') <NEW_LINE> print('Number of points:', np.size(jura_data['Co'])) <NEW_LINE> print('Minimum:', np.min(jura_data['Co'])) <NEW_LINE> print('Mean', np.mean(jura_data['Co'])) <NE...
Prints basic statistics of cobalt concentration (mg/kg)
625941f18a349b6b435e8735
def acorn_finder(t): <NEW_LINE> <INDENT> if label(t) == 'acorn': <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for branch in branches(t): <NEW_LINE> <INDENT> if acorn_finder(branch) == True: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return False
Returns True if t contains a node with the value 'acorn' and False otherwise. >>> scrat = tree('acorn') >>> acorn_finder(scrat) True >>> sproul = tree('roots', [tree('branch1', [tree('leaf'), tree('acorn')]), tree('branch2')]) >>> acorn_finder(sproul) True >>> numbers = tree(1, [tree(2), tree(3, [tree(4), tree(5)]), t...
625941f1046cf37aa974d304
def logger(ctx, *args, **kwargs): <NEW_LINE> <INDENT> nipfile = nipfile_selector(ctx) <NEW_LINE> echo = echo_selector(ctx) <NEW_LINE> echo('nipfile -> ', pformat_json(nipfile)) <NEW_LINE> echo('args -> ', args) <NEW_LINE> echo('kwargs -> ', pformat_json(kwargs))
Logging hook
625941f14e4d5625662d4992
def run(*args): <NEW_LINE> <INDENT> self.sub_to_bitsevents() <NEW_LINE> self.keep_alive(ws)
send the sub message, and keep alive our connection to Twitch pubsub service
625941f185dfad0860c3b420
def __eq__(self, other): <NEW_LINE> <INDENT> return EquivalenceExpression(self, other)
Constructs a new EquivalenceExpression with this expression as the left hand side and ``other`` as the right hand side. :param other: The other thing to check for equivalence with this expression when evaluated. :type other: Expression :return: A new equivalence expression :rtype: EquivalenceExpression
625941f160cbc95b062c6b06
def __init__(self, master, x, y): <NEW_LINE> <INDENT> global data <NEW_LINE> Button.__init__(self, width=2, height=1, relief='groove', bg=data[1], command=self.pop) <NEW_LINE> self.popped = False <NEW_LINE> self.x, self.y = x, y <NEW_LINE> self.bind('<Button-3>', self.unpop)
GolCell(master, x, y) -> None creates new Game of Life Cell
625941f1d7e4931a7ee9e4e2
def toPrimitive(self, message): <NEW_LINE> <INDENT> pass
Create a string representation of a message @param message: The message object @type message: message.Message @return: The message's primitive representation in a particular messaging format @rtype: str, int, list or dict
625941f1090684286d50f2b3
def _recursive_series(self, series_path): <NEW_LINE> <INDENT> for patch_name in self._non_recursive_series(series_path): <NEW_LINE> <INDENT> if not patch_name.startswith('-i '): <NEW_LINE> <INDENT> yield patch_name <NEW_LINE> continue <NEW_LINE> <DEDENT> series_rel_path = patch_name.split(' ', 1)[1].strip() <NEW_LINE> ...
Emit patch_names from series file, handling -i recursion.
625941f126238365f5f0f439
def ScreenFromDetails(details,mol=None): <NEW_LINE> <INDENT> if not mol: <NEW_LINE> <INDENT> if not details.probeMol: <NEW_LINE> <INDENT> smi = details.probeSmiles <NEW_LINE> try: <NEW_LINE> <INDENT> mol = Chem.MolFromSmiles(smi) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> import traceback <NEW_LINE> FingerprintMol...
Returns a list of results
625941f1b57a9660fec33e4f
def update(self, other=None, **kwargs): <NEW_LINE> <INDENT> def _set(key, value): <NEW_LINE> <INDENT> if key in _ATTR2FIELD and value: <NEW_LINE> <INDENT> self.set(self._convert_name(key), value) <NEW_LINE> <DEDENT> <DEDENT> if not other: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif hasattr(other, 'keys'): <NEW_LI...
Set metadata values from the given iterable `other` and kwargs. Behavior is like `dict.update`: If `other` has a ``keys`` method, they are looped over and ``self[key]`` is assigned ``other[key]``. Else, ``other`` is an iterable of ``(key, value)`` iterables. Keys that don't match a metadata field or that have an empt...
625941f1c432627299f0520d
def create_container(uri, turtle, auth=None): <NEW_LINE> <INDENT> headers = {'Content-Type': 'text/turtle; charset=utf-8'} <NEW_LINE> r = requests.put(uri, headers=headers, auth=auth, data=turtle) <NEW_LINE> r.raise_for_status() <NEW_LINE> return r
Create basic container for an item.
625941f19c8ee82313fbbd3a
def save(self, name=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> prefix = 'checkpoints/' + self.model_name + '_' <NEW_LINE> name = time.strftime(prefix + '%m%d_%H:%M:%S.pth') <NEW_LINE> <DEDENT> torch.save(self.state_dict(), name) <NEW_LINE> return name
保存模型,默认使用“模型名字+时间”作为文件名 :param name: :return:
625941f167a9b606de4a8479
def get_all_vms_for_user(self, username): <NEW_LINE> <INDENT> for vapp in self.list_vapps(): <NEW_LINE> <INDENT> if vapp.attrib.get('ownerName') != username: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> vapp_id = 'vapp-' + vapp.attrib.get('id')[16:] <NEW_LINE> resp2 = ET.fromstring(self.get_vapp(vapp_id)) <NEW_LINE...
Obtain all VMs for a given user, assuming that each VApp has only one VM
625941f1097d151d1a223419
def read_from_json(): <NEW_LINE> <INDENT> with open('books.json', 'r') as book_fd: <NEW_LINE> <INDENT> return json.load(book_fd)
Reads data from JSON file
625941f13539df3088e2e90e
def replace(self, word): <NEW_LINE> <INDENT> result = '' <NEW_LINE> while word: <NEW_LINE> <INDENT> ret = self._match_not_equiv(word) <NEW_LINE> if ret: word = ret[1] <NEW_LINE> ret = self._match_once(word) <NEW_LINE> if not ret: return result + word <NEW_LINE> before, idx, word = ret <NEW_LINE> result += before + '$' ...
Replace any substring of word with ${equivClass}. :param word: str to process :return: equivalized string
625941f1287bf620b61d4023
def __call__(self, *args, **kw): <NEW_LINE> <INDENT> self.exchange.start(self.callable, *args, **kw)
Invoke the callable with the supplied arguments.
625941f17cff6e4e81117f48