code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def build_gameover_interface(self, players: list): <NEW_LINE> <INDENT> self.clear_console() <NEW_LINE> print("___________________________________________________________________________________") <NEW_LINE> print("Fim de jogo") <NEW_LINE> print("__________________________________________________________________________...
Constrói a interface do fim do jogo
625941e463f4b57ef000151d
def area(self): <NEW_LINE> <INDENT> return self.__size * self.__size
finds the area of the square
625941e46aa9bd52df0371b6
def stamp(self,type): <NEW_LINE> <INDENT> stamp = self.get_stamp(type) <NEW_LINE> if stamp is None: <NEW_LINE> <INDENT> stamp = type(contentItem=self) <NEW_LINE> <DEDENT> stamp.isActive = True <NEW_LINE> return stamp
Return activated (and possibly new) stamp of `type`
625941e4f7d966606f6aa418
def set_choices(self, choices, notify=True): <NEW_LINE> <INDENT> choices = [deserialize_object(c, str_) for c in choices] <NEW_LINE> self.set_endpoint_data("choices", choices, notify)
Set the choices list
625941e426068e7796caf0f5
def __init__(self, prev_layer, curr_layer, filter_shape, padding=None, params=None): <NEW_LINE> <INDENT> super().__init__(prev_layer) <NEW_LINE> self._curr_layer = curr_layer <NEW_LINE> self._filter_shape = [filter_shape[0], filter_shape[2], filter_shape[1], filter_shape[3], filter_shape[4]] <NEW_LINE> self._padding = ...
Prev layer is the 3D hidden layer
625941e4aad79263cf390e57
@sig(H[(Floating, "a")]/ "a" >> "a") <NEW_LINE> def sinh(x): <NEW_LINE> <INDENT> return Floating[x].sinh(x)
sinh :: Floating a => a -> a
625941e4d99f1b3c44c67997
def gumbel(loc=0.0, scale=1.0, size=None, ctx=None, out=None): <NEW_LINE> <INDENT> from ._symbol import _Symbol as np_symbol <NEW_LINE> input_type = (isinstance(loc, np_symbol), isinstance(scale, np_symbol)) <NEW_LINE> if ctx is None: <NEW_LINE> <INDENT> ctx = current_context() <NEW_LINE> <DEDENT> if size == (): <NEW_L...
Draw samples from a Gumbel distribution. Parameters ---------- loc : float or array_like of floats, optional The location of the mode of the distribution. Default is 0. scale : float or array_like of floats, optional The scale parameter of the distribution. Default is 1. Must be non- negative. size : int o...
625941e42c8b7c6e89b35bcd
def writeReg(self, reg, val): <NEW_LINE> <INDENT> reg &= 0x3f <NEW_LINE> val &= 0xff <NEW_LINE> if self.mode == self.MODE_I2C: <NEW_LINE> <INDENT> self.bus.write(self.i2c_addr, [reg, val]) <NEW_LINE> <DEDENT> elif self.mode == self.MODE_SPI: <NEW_LINE> <INDENT> self.bus.setClockMode(self.spi_cs, self.SPI_CLOCK_MODE) <N...
Writes the given value to the given register.
625941e497e22403b379d3ab
def set_debug(debug): <NEW_LINE> <INDENT> global _ENABLE_DEBUG <NEW_LINE> _ENABLE_DEBUG = debug
Set global debug mode
625941e4507cdc57c63070f3
def time_step(self, delta_t): <NEW_LINE> <INDENT> pass
Move the ISS along the orbit by the given time step. The probability distribution of generate_photon will reflect this change
625941e44428ac0f6e5bac05
def toHex(self, num): <NEW_LINE> <INDENT> result = [] <NEW_LINE> hex_mapping = '0123456789abcdef' <NEW_LINE> if num < 0: <NEW_LINE> <INDENT> num += 0x100000000 <NEW_LINE> <DEDENT> while num: <NEW_LINE> <INDENT> result.append(hex_mapping[num % 16]) <NEW_LINE> num /= 16 <NEW_LINE> <DEDENT> return ''.join(result[::-1]) if...
:type num: int :rtype: str
625941e4cc40096d61595d5e
def decode_jwt_token(self, token, decode_options: dict = None): <NEW_LINE> <INDENT> res = jwt_decode( token, self.application.get_secret_key(), decode_options ) <NEW_LINE> return res
Decode payload from JWT token :param token: token :param decode_options: options :return:
625941e48c3a8732951587cf
def has_group(self, name): <NEW_LINE> <INDENT> return self._r.has_group(name)
@param name str: Name of movegroup @rtype: bool
625941e48da39b475bd65388
def file_list(*packages, **kwargs): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> ret = [] <NEW_LINE> cmd = ["pacman", "-Ql"] <NEW_LINE> if len(packages) > 0 and os.path.exists(packages[0]): <NEW_LINE> <INDENT> packages = list(packages) <NEW_LINE> cmd.extend(("-r", packages.pop(0))) <NEW_LINE> <DEDENT> cmd.extend(packages...
List the files that belong to a package. Not specifying any packages will return a list of _every_ file on the system's package database (not generally recommended). CLI Examples: .. code-block:: bash salt '*' pkg.file_list httpd salt '*' pkg.file_list httpd postfix salt '*' pkg.file_list
625941e4656771135c3ebc83
def vm_info(vm_=None): <NEW_LINE> <INDENT> def _info(vm_): <NEW_LINE> <INDENT> dom = _get_dom(vm_) <NEW_LINE> raw = dom.info() <NEW_LINE> return {'cpu': raw[3], 'cputime': int(raw[4]), 'disks': get_disks(vm_), 'graphics': get_graphics(vm_), 'nics': get_nics(vm_), 'maxMem': int(raw[1]), 'mem': int(raw[2]), 'state': VIRT...
Return detailed information about the vms on this hyper in a list of dicts: .. code-block:: python [ 'your-vm': { 'cpu': <int>, 'maxMem': <int>, 'mem': <int>, 'state': '<state>', 'cputime' <int> }, ... ] If you pass a...
625941e438b623060ff0b1fd
def handle_inclusion_failed(self, event: Event) -> None: <NEW_LINE> <INDENT> pass
Process an inclusion failed event.
625941e43c8af77a43ae3bb4
def download_object_range(self, obj, destination_path, start_bytes, end_bytes=None, overwrite_existing=False, delete_on_failure=True): <NEW_LINE> <INDENT> raise NotImplementedError( 'download_object_range not implemented for this driver')
Download part of an object. :param obj: Object instance. :type obj: :class:`libcloud.storage.base.Object` :param destination_path: Full path to a file or a directory where the incoming file will be saved. :type destination_path: ``str`` :param start_bytes: Start byte offset (inclusive) for t...
625941e432920d7e50b285e3
def longestValidParentheses(self, s): <NEW_LINE> <INDENT> stack = [] <NEW_LINE> flags = [False for _ in range(0, len(s))] <NEW_LINE> for idx, l in enumerate(s): <NEW_LINE> <INDENT> if not stack: <NEW_LINE> <INDENT> stack.append((l, idx)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if stack[-1][0] == '(' and l == ')':...
:type s: str :rtype: int
625941e43617ad0b5ed68306
def _pack_body (self): <NEW_LINE> <INDENT> return struct.pack("!I", self.format)
Pack body.
625941e415fb5d323cde0f25
@cli.command('config-advanced') <NEW_LINE> @click.argument('cluster') <NEW_LINE> @click.option('-d', '--delete', is_flag=True, help='Delete the cluster\'s advanced.config file.') <NEW_LINE> @click.option('--file', 'advanced_file', type=click.Path(exists=True, file_okay=True, resolve_path=True), help='Cluster advanced.c...
Gets or sets the advanced.config configuration for a cluster, specify config file location with --file.
625941e429b78933be1e5ab7
def add_operation(name, code): <NEW_LINE> <INDENT> global _custom_operations <NEW_LINE> _custom_operations[text_type(name)] = code <NEW_LINE> _expose_operations()
Add a custom common JsonLogic operation. Operation code must only take positional arguments that are absolutely necessary for its execution. JsonLogic will run it using the array of provided values, like: code(*values) Example: {"my_operation": [1, 2, 3]} will be called as code(1, 2, 3) Can also be used to add custo...
625941e4bf627c535bc135df
def _security_group_rule_exists(self, security_group, values): <NEW_LINE> <INDENT> for rule in security_group.rules: <NEW_LINE> <INDENT> is_duplicate = True <NEW_LINE> keys = ('group_id', 'cidr', 'from_port', 'to_port', 'protocol') <NEW_LINE> for key in keys: <NEW_LINE> <INDENT> if rule.get(key) != values.get(key): <NE...
Indicates whether the specified rule values are already defined in the given security group.
625941e426238365f5f0f284
def pytest_xyz(self, arg): <NEW_LINE> <INDENT> pass
X
625941e430dc7b7665901d72
def getLossMask(outputs, node_first, seq_list, using_cuda=False): <NEW_LINE> <INDENT> if outputs.dim() == 3: <NEW_LINE> <INDENT> seq_length = outputs.shape[0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> seq_length = outputs.shape[1] <NEW_LINE> <DEDENT> node_pre = node_first <NEW_LINE> lossmask = torch.zeros(seq_lengt...
Get a mask to denote whether both of current and previous data exist. Note: It is not supposed to calculate loss for a person at time t if his data at t-1 does not exist.
625941e4d486a94d0b98e556
def process_notebooks(nbfile_or_path, execute=True, force=False, link=False, cleanup=False, filename_pattern='', remove_gh=False, **kwargs): <NEW_LINE> <INDENT> overall_status = 0 <NEW_LINE> if os.path.isdir(nbfile_or_path): <NEW_LINE> <INDENT> for root, dirs, files in os.walk(nbfile_or_path): <NEW_LINE> <INDENT> for n...
Execute and optionally convert the specified notebook file or directory of notebook files. Wrapper for `NotebookConverter` class that does all the file handling. Parameters ---------- nbfile_or_path : str Either a single notebook filename or a path containing notebook files. execute : bool Whether or not to exe...
625941e423849d37ff7b349c
def cleanup_report_iam_policies(self, output_file): <NEW_LINE> <INDENT> tb_ret = TextBlock("Iam Policies") <NEW_LINE> tb_ret.blocks.append(self.cleanup_report_iam_unused_policies()) <NEW_LINE> tb_ret.blocks.append(self.cleanup_report_iam_policies_statements_optimize()) <NEW_LINE> with open(output_file, "w+") as file_ha...
Clean IAM policies @return:
625941e4e64d504609d74c50
def get_val(self, option, default): <NEW_LINE> <INDENT> return self.get(self.DUMMY_SECTION, option, fallback=default)
Get the value for a specified option key. Option is case-insensitive. There's only one section, so fill that in automatically.
625941e47c178a314d6ef876
def __init__(self): <NEW_LINE> <INDENT> self.states = [] <NEW_LINE> self.threads = 0
Basic initializer; must be called in subclasses.
625941e43d592f4c4ed1d472
def setUp(self): <NEW_LINE> <INDENT> self.num = 20 <NEW_LINE> theta = numpy.linspace(0.0, 2 * numpy.pi, num=self.num + 1)[:-1] <NEW_LINE> self.x, self.y = numpy.cos(theta), numpy.sin(theta) <NEW_LINE> self.ds = numpy.sqrt((self.x[1] - self.x[0])**2 + (self.y[1] - self.y[0])**2)
Setup.
625941e471ff763f4b549aa2
def start(self, count=1): <NEW_LINE> <INDENT> list_camera = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for i in range(self.list_size): <NEW_LINE> <INDENT> camera = Camera(self.libuvc, self.list_devices[i], i) <NEW_LINE> list_camera.append(camera) <NEW_LINE> <DEDENT> for i in range(count): <NEW_LINE> <INDENT> for camera in ...
Starts the serial capture mode :param count: Count of captures to be performed :return: None
625941e407f4c71912b11895
def check_balance(characters): <NEW_LINE> <INDENT> openers = { '(': ')', '{': '}', '[': ']' } <NEW_LINE> closers = set(openers.values()) <NEW_LINE> stack = [] <NEW_LINE> for i, c in enumerate(characters, start=1): <NEW_LINE> <INDENT> if c in openers: <NEW_LINE> <INDENT> stack.append(openers[c]) <NEW_LINE> <DEDENT> elif...
Return -1 if all delimiters are balanced or the char number of the first delimiter mismatch.
625941e46fb2d068a760f4b3
def setPosition(self, position): <NEW_LINE> <INDENT> self.setPos(position) <NEW_LINE> self.position = position
Nastavenie polohy komponentu.
625941e46e29344779a62a20
def _normalize_patches(patches): <NEW_LINE> <INDENT> patches = array_ops.concat(patches, 0) <NEW_LINE> mean, variance = nn.moments(patches, [1, 2, 3], keep_dims=True) <NEW_LINE> patches = (patches - mean) / math_ops.sqrt(variance) <NEW_LINE> return array_ops.reshape(patches, [array_ops.shape(patches)[0], -1])
Normalize patches by their mean and standard deviation. Args: patches: (tensor) The batch of patches (batch, size, size, channels). Returns: Tensor (batch, size, size, channels) of the normalized patches.
625941e4293b9510aa2c36a2
def initialize(): <NEW_LINE> <INDENT> DATABASE.connect(reuse_if_open=True) <NEW_LINE> DATABASE.create_tables([Todo], safe=True) <NEW_LINE> DATABASE.close()
start up the database
625941e4bf627c535bc135e0
def move(self, x, y): <NEW_LINE> <INDENT> l, t, w, h = self.getPosSize() <NEW_LINE> l = l + x <NEW_LINE> t = t + y <NEW_LINE> self.setPosSize((l, t, w, h))
Move the object by **x** units and **y** units.
625941e4596a897236089ecb
def _configLoad( self, lastOverlay:int=99999999 ): <NEW_LINE> <INDENT> def readConfig( filename:str ): <NEW_LINE> <INDENT> if osp.isfile( filename ): <NEW_LINE> <INDENT> with open( filename, 'r') as f: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> config = json.load( f ) <NEW_LINE> self._config = dict_merge(self._config...
Konfiguration aus config.json einlesen. Die Datei muss sich ab _basedir im Verzeichniss config befinden Alle config Dateien bis zu der durch _overlayLast gebildeten einlesen Parameters ---------- lastOverlay : int Default is 99999999
625941e45e10d32532c5f335
def processResult(result): <NEW_LINE> <INDENT> if self.debug: <NEW_LINE> <INDENT> log.msg("VT scanfile result: {}".format(result)) <NEW_LINE> <DEDENT> j = json.loads(result) <NEW_LINE> log.msg("VT: {}".format(j["verbose_msg"])) <NEW_LINE> if j["response_code"] == 0: <NEW_LINE> <INDENT> log.msg("VT: response=0: this is ...
Extract the information we need from the body
625941e4e76e3b2f99f3ac15
def groupby(self, values): <NEW_LINE> <INDENT> from .multi import MultiIndex <NEW_LINE> if isinstance(values, MultiIndex): <NEW_LINE> <INDENT> values = values.values <NEW_LINE> <DEDENT> values = ensure_categorical(values) <NEW_LINE> result = values._reverse_indexer() <NEW_LINE> result = {k: self.take(v) for k, v in com...
Group the index labels by a given array of values. Parameters ---------- values : array Values used to determine the groups. Returns ------- groups : dict {group name -> group labels}
625941e476d4e153a657ef42
def __patchVarStatements(node, firstVarStatement): <NEW_LINE> <INDENT> if node is firstVarStatement: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif node.type == "function": <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> elif node.type == "var": <NEW_LINE> <INDENT> __rebuildAsAssignment(node, firstVarStatement) <NE...
Patches all variable statements in the given node (works recursively) and replace them with assignments.
625941e455399d3f05588ac6
def detag(tweet): <NEW_LINE> <INDENT> y = re.search("<a.*?>(.*?)</a>", tweet) <NEW_LINE> if y: <NEW_LINE> <INDENT> tweet = re.sub("<a.*?>(.*?)</a>", y.group(1), tweet, 1) <NEW_LINE> tweet = detag(tweet) <NEW_LINE> <DEDENT> return tweet
Removes html tags from the passed in string. Returns a string.
625941e4d268445f265b527f
def get_merge_indices(cen, imglen, ks_h, ker_shp): <NEW_LINE> <INDENT> left = cen - ks_h; right = cen + ks_h + 1 <NEW_LINE> if left < 0: <NEW_LINE> <INDENT> img_l = 0; g_l = -left <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> img_l = left; g_l = 0 <NEW_LINE> <DEDENT> if right > imglen: <NEW_LINE> <INDENT> img_r = imgle...
Helper function that returns indices for merging gaussian with base image, including edge case handling. x and y are identical, so code is axis-neutral. Assumes INTEGER values for all inputs!
625941e42c8b7c6e89b35bce
def load_tracks(spotify_api_dict): <NEW_LINE> <INDENT> for i in range(len(spotify_api_dict['album_info'])): <NEW_LINE> <INDENT> album_id = spotify_api_dict['album_info'][i]['album_id'] <NEW_LINE> for n in range(len(spotify_api_dict['album_info'][i]['album_tracks_uris'])): <NEW_LINE> <INDENT> album_track_uri = spotify_a...
Load album track uris from spotify_api_dict into database.
625941e432920d7e50b285e4
def print_queue(): <NEW_LINE> <INDENT> print("Printing the entire list...") <NEW_LINE> x = 0 <NEW_LINE> for i in queue.get_queue(): <NEW_LINE> <INDENT> name_in_list = queue.get_queue()[x]["name"] <NEW_LINE> print(f"({x+1}) {name_in_list}") <NEW_LINE> x+=1
This function: imprime en la consola la lista completa de la cola(queue), indicando la posición y el nombre del cliente.
625941e45fdd1c0f98dc0645
def __init__(self, environment, position=None, initial_network=None, ind_id=None, reproduction_mode='asexual', reproduction_cost=0.5, reproductive_threshold=10, data_cutoff=None, global_time_born=0, *args, **kwargs): <NEW_LINE> <INDENT> self.internal = [] <NEW_LINE> self.motor_activations = [] <NEW_LINE> self._sensory_...
Class used to simulate the how a 'SensorMover' individual operates in the environment it is placed in.
625941e4a8ecb033257d34dc
@receiver(post_save, sender=User, dispatch_uid="user_post_save_uid") <NEW_LINE> def user_post_save(sender, **kwargs): <NEW_LINE> <INDENT> user = kwargs['instance'] <NEW_LINE> if kwargs['created'] and not user.is_staff: <NEW_LINE> <INDENT> Character.objects.create(user=user)
Create character for each non-admin user.
625941e473bcbd0ca4b2c486
def __init__(self, delimiter='=', comment_marker='#', line_terminator='\r\n', value_quoting=False, value_quote_char="'", bool_case=BOOL_PYTHON, big_ints=False, hidden_marker=None): <NEW_LINE> <INDENT> self._delimeter = delimiter <NEW_LINE> self._comment_marker = comment_marker <NEW_LINE> self._line_terminator = line_te...
:param delimiter: string placed between key and value :param comment_marker: string indicating comment line in file :param line_terminator: string placed between lines :param value_quoting: whether or not to quote string values :param value_quote_char: character used to quote string values :param bool_case...
625941e41f037a2d8b94660d
def sample_seqrun_path(self, libprepid, seqrunid): <NEW_LINE> <INDENT> return os.path.join(self.sample_data_path(), libprepid, seqrunid)
:param libprepid: the libprep id whose data the path will refer to :param seqrunid: the seqrun id whose data the path will refer to :return: the path to the data for a particular libprep and seqrun combo
625941e4435de62698dfe05d
def expand_select_list(self): <NEW_LINE> <INDENT> is_expanded = self.is_expanded() <NEW_LINE> if not is_expanded: <NEW_LINE> <INDENT> self._el.click()
Expands the Select list only if it's collapsed
625941e40fa83653e46573c9
def transform_coord(bbox, src='center', dst='corner'): <NEW_LINE> <INDENT> flag = False <NEW_LINE> if len(bbox.size()) == 1: <NEW_LINE> <INDENT> bbox = bbox.unsqueeze(0) <NEW_LINE> flag = True <NEW_LINE> <DEDENT> bbox_transformed = bbox.new(bbox.size()) <NEW_LINE> if src == 'center' and dst == 'corner': <NEW_LINE> <IND...
Transform bbox coordinates |---------| (x1,y1) *---------| | | | | | (x,y) h | | | | | | |____w____| |_________* (x2,y2) center corner Args bbox: (Tensor)...
625941e41b99ca400220aec3
def download(self): <NEW_LINE> <INDENT> p = self.language.project <NEW_LINE> with pysftp.Connection(p.bravo_server.address, username=p.bravo_server.account, private_key=settings.PRIVATE_KEY) as conn: <NEW_LINE> <INDENT> remote_path = self.filepath() <NEW_LINE> filename = "{0}.wav".format(str(uuid.uuid4())) <NEW_LINE> l...
Downloads a file from the remote server and returns the path on the local server
625941e4097d151d1a223268
def appendEpisode(self, episode): <NEW_LINE> <INDENT> lastep = self.episodes_[-1] <NEW_LINE> if len(lastep) == 0: <NEW_LINE> <INDENT> self.episodes_ = self.episodes_[:-1] <NEW_LINE> <DEDENT> self.episodes_.append(episode) <NEW_LINE> self.newEpisode()
This will append a full episode to the history rather than single samples with append(). If the last episode was open and not finished yet, it will be finished and a new episode starts after the added episode. Example (. is the empty episode): history => [aaaaa bb cccc] history.appendEpisode([ddd]) history => [aaaaa ...
625941e430c21e258bdfa8b1
def CreateOrganization(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!')
Create a organization.
625941e4236d856c2ad44bf0
def test_check_health(self): <NEW_LINE> <INDENT> cache = DummyCache() <NEW_LINE> ok, msg = cache.check_health() <NEW_LINE> self.assertTrue(ok)
Base check_health returns True
625941e45f7d997b87174eac
def initialize_solver_directories(self): <NEW_LINE> <INDENT> unix.mkdir(self.getpath) <NEW_LINE> unix.cd(self.getpath) <NEW_LINE> unix.mkdir('bin') <NEW_LINE> unix.mkdir('DATA') <NEW_LINE> unix.mkdir('traces/obs') <NEW_LINE> unix.mkdir('traces/syn') <NEW_LINE> unix.mkdir('traces/adj') <NEW_LINE> unix.mkdir(self.databas...
Creates directory structure expected by SPECFEM2D, copies executables, and prepares input files. Executables must be supplied by user as there is currently no mechanism to automatically compile from source.
625941e45fdd1c0f98dc0646
def __get_memorie(self): <NEW_LINE> <INDENT> memorie = Memorie() <NEW_LINE> while self.__get_line() and self.level > 1: <NEW_LINE> <INDENT> if self.tag == "TITL": <NEW_LINE> <INDENT> memorie.description = self.__get_text() <NEW_LINE> <DEDENT> elif self.tag == "FILE": <NEW_LINE> <INDENT> memorie.url = self.__get_text() ...
Parse a memorie
625941e43346ee7daa2b317f
def run(program, noun, verb): <NEW_LINE> <INDENT> program.reset() <NEW_LINE> program.memory[1] = noun <NEW_LINE> program.memory[2] = verb <NEW_LINE> program.run() <NEW_LINE> return program.memory[0]
Execute program with given noun and verb.
625941e4e5267d203edce0a8
def test_getitem(self): <NEW_LINE> <INDENT> for s in self._strings(): <NEW_LINE> <INDENT> for i in six.moves.range(len(s)): <NEW_LINE> <INDENT> self.assertEquals(Caseless(s)[i], s[i]) <NEW_LINE> self.assertEquals(Caseless(s)[:i], s[:i]) <NEW_LINE> self.assertEquals(Caseless(s)[i:], s[i:]) <NEW_LINE> <DEDENT> self.asser...
L{Caseless} should delegate indexing/slicing.
625941e4cc0a2c11143dd2a2
def get_windows_version(): <NEW_LINE> <INDENT> if sys.platform == 'win32': <NEW_LINE> <INDENT> win_ver = sys.getwindowsversion() <NEW_LINE> return win_ver.major, win_ver.minor <NEW_LINE> <DEDENT> return None
Returns the major, minor version of the Windows OS, or None if not on Windows.
625941e401c39578d7e7524c
def toggle_activate(self): <NEW_LINE> <INDENT> active = self.isActiveWindow() <NEW_LINE> if active: <NEW_LINE> <INDENT> self.hide() <NEW_LINE> if osutils is not None: <NEW_LINE> <INDENT> osutils.make_app_background() <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.activate()
Toggles visibility when systray icon is clicked.
625941e46aa9bd52df0371b7
def update(self, transitions, sess): <NEW_LINE> <INDENT> reward = 0.0 <NEW_LINE> if not transitions[-1].done: <NEW_LINE> <INDENT> reward = self.value_net.predict_value(transitions[-1].next_state) <NEW_LINE> <DEDENT> if LSTM_POLICY: <NEW_LINE> <INDENT> init_lstm_state = self.policy_net.get_init_features() <NEW_LINE> <DE...
Updates global policy and value networks based on collected experience Args: transitions: A list of experience transitions sess: A Tensorflow session
625941e4cc0a2c11143dd2a3
def isEmpty(self): <NEW_LINE> <INDENT> return (self.length == 0)
check if the queue is empty
625941e4283ffb24f3c55d0e
def test_get_public_directory_user_locked(self): <NEW_LINE> <INDENT> dir_dao = self.vgw.change_public_access( self.dir.id, True, allow_directory=True) <NEW_LINE> self.assertNotEquals(dir_dao.public_id, None) <NEW_LINE> self.assertNotEquals(dir_dao.public_uuid, None) <NEW_LINE> public_id = dir_dao.public_id <NEW_LINE> p...
get_public_directory also works with locked user.
625941e456b00c62f0f14a6c
def _update_fit_line(self): <NEW_LINE> <INDENT> if self._debug: <NEW_LINE> <INDENT> print('Update_start_fit_line called') <NEW_LINE> <DEDENT> y_fit_start = self._fit_func_v(self.chi2.x, *self.m.args) <NEW_LINE> self._fit_line[0].set_data( self.chi2.x, y_fit_start ) <NEW_LINE> self._update_fit_result_box() <NEW_LINE> se...
Update the fit line in the gui.
625941e4fb3f5b602dac3aa8
def _delete(self, by_word = False): <NEW_LINE> <INDENT> if self._selecting: <NEW_LINE> <INDENT> start, end = sorted((self.cursor_pos, self._selection_pos)) <NEW_LINE> self.cursor_pos = start <NEW_LINE> self._remove_char(start, end) <NEW_LINE> <DEDENT> elif by_word: <NEW_LINE> <INDENT> start = self.cursor_pos <NEW_LINE>...
Deletes the currently selected text, or the text at the current cursor position. If *by_word* is specified, the rest of the word is deleted too.
625941e4de87d2750b8601a7
def update_number_hits(query_results, df): <NEW_LINE> <INDENT> df_out = pd.read_json(query_results, orient='split') <NEW_LINE> total_documents = df.shape[0] <NEW_LINE> if df_out.shape[0] == 0: <NEW_LINE> <INDENT> total_hits = total_documents <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> df_out = df_out.query('score > 0...
[summary] Parameters ---------- query_results : [type] [description] df : [type] [description] Returns ------- [type] [description]
625941e430c21e258bdfa8b2
def cache_folder_clean_up(self): <NEW_LINE> <INDENT> import shutil <NEW_LINE> if self.use_cache: <NEW_LINE> <INDENT> shutil.rmtree(self.cache_path, True) <NEW_LINE> os.mkdir(self.cache_path)
有脚本根据需要删除缓存的文件夹
625941e44527f215b584c863
def test_incoming_send_packet(self): <NEW_LINE> <INDENT> self.setup_nodes() <NEW_LINE> def my_cb(data_packet): <NEW_LINE> <INDENT> self.stuff = data_packet.dict_obj <NEW_LINE> self.stop_event_reactors() <NEW_LINE> <DEDENT> self.nc[1].receive_callback = my_cb <NEW_LINE> self.nc[0].send(self.nc[1].server_address, {'hello...
Server 0 should send a packet to server 1
625941e47cff6e4e81117d96
def test_target(self): <NEW_LINE> <INDENT> rv = self.app.post("/target") <NEW_LINE> response_dict = json.loads(rv.data) <NEW_LINE> self.assertTrue(response_dict['running']) <NEW_LINE> rv = self.app.post("/stoptarget") <NEW_LINE> response_dict = json.loads(rv.data) <NEW_LINE> self.assertFalse(response_dict['running'])
Verify starting and stopping the scanner in targeting mode
625941e44e696a04525c985e
def juros_compostos(principal, taxa, periodo): <NEW_LINE> <INDENT> calculo_juros = principal * (pow((1 + taxa / 100), periodo)) <NEW_LINE> return calculo_juros
Função para calcular juros compostos Juros compostos = P (1 + R / 100)t #Formula para o calculo Onde, P é a quantidade do principal R é a taxa e T é o período de tempo :param principal: float :param taxa: inteiro/float :param periodo: inteiro :return: float (resultado)
625941e47047854f462a1816
def __init__(self, els_object): <NEW_LINE> <INDENT> self._id = els_object.meta.id <NEW_LINE> self._name = els_object.Name
Constructor :param els_object: Elasticsearch object document :type els_object: object
625941e4f548e778e58cd990
def register_lv2_path(conf, path): <NEW_LINE> <INDENT> if 'LV2_PATH' not in conf.run_env and 'LV2_PATH' not in os.environ: <NEW_LINE> <INDENT> conf.run_env['LV2_PATH'] = [conf.env['LV2DIR']] <NEW_LINE> <DEDENT> conf.run_env.append_unique('LV2_PATH', path)
Return the default LV2_PATH to use for this system
625941e423849d37ff7b349d
def run(self, parent, blocks): <NEW_LINE> <INDENT> block = blocks.pop(0) <NEW_LINE> match = self.RE.search(block) <NEW_LINE> settings = self.getSettings(match.group('settings')) <NEW_LINE> div = self.createFloatElement(settings) <NEW_LINE> parent.append(div) <NEW_LINE> slider = etree.Element('div') <NEW_LINE> slider.se...
Called when it is determined that we can process this block. This will convert the markdown into HTML
625941e4b545ff76a8914226
def _test_render_single_contour_2(): <NEW_LINE> <INDENT> _test_render( "resources/example_single_contour_2.gbr", "golden/example_single_contour.gbr" )
Umaco exapmle of a single contour, alternate contour end order The resulting image for this test is used by other tests because they must generate the same output.
625941e4f548e778e58cd991
def to_naive_datetime(value): <NEW_LINE> <INDENT> return value.replace(tzinfo=timezone.utc).astimezone(tz=None)
Convertir une date avec informations de fuseau horaire en datetime naïf
625941e42eb69b55b151ccc6
def updateAnnotationDict_Track(annotationdict,imagename,bbox): <NEW_LINE> <INDENT> im_width=640 <NEW_LINE> im_height=480 <NEW_LINE> annotationdict[imagename]={} <NEW_LINE> annotationdict[imagename]['name']=imagename <NEW_LINE> annotationdict[imagename]['width']=im_width <NEW_LINE> annotationdict[imagename]['height']=im...
update annotation dictionary using the result of object tracker. only save one 'leading' bbox into annotation. bbox format:[xmin,ymin,width,height] this is not for detection!
625941e43eb6a72ae02ec8f9
def test_track_order_with_valid_order_id(self): <NEW_LINE> <INDENT> order_id = 'a6d8c3a4-b84d-4f7c-86f6-68805837b51b' <NEW_LINE> order_service_response = order_service.request( RequestType.GET, order_details_url( order_id=order_id)) <NEW_LINE> logging.info('test_track_order_with_valid_order_id') <NEW_LINE> logging.info...
testing with valid order to get order details
625941e47d847024c06be6d1
def convert_Gamma_cm_Tau_s(toto): <NEW_LINE> <INDENT> return 1./(3e8*toto*1e2)
Convertit un taux d'amortissement gamma en cm-1 en un temps de collision tau en seconde. gamma prop (1/tau) et vice-versa
625941e4c432627299f0505a
def getConfiguration(self): <NEW_LINE> <INDENT> configuration = c_int() <NEW_LINE> mayRaiseUSBError(libusb1.libusb_get_configuration( self.__handle, byref(configuration), )) <NEW_LINE> return configuration.value
Get the current configuration number for this device.
625941e4293b9510aa2c36a3
def useDefaultRenderLayer(): <NEW_LINE> <INDENT> useDefaultRL = cmds.checkBox('defaultRenderLayerCB', query=True, value=True) <NEW_LINE> if useDefaultRL: <NEW_LINE> <INDENT> cmds.editRenderLayerGlobals(currentRenderLayer='defaultRenderLayer')
Analisys if must use the Default Render Layer (masterLayer) checking the option in the UI. Set to use it if need.
625941e46aa9bd52df0371b8
def bmpOrTif(filename, files): <NEW_LINE> <INDENT> for f in files: <NEW_LINE> <INDENT> if f[:-4] == filename and f.endswith(('.tif', '.bmp', '.tiff', '.jpg', '.jpeg')): <NEW_LINE> <INDENT> return f <NEW_LINE> <DEDENT> <DEDENT> return None
Finds original files if they end with one of these file extensions :param filename: filename of png (str) :param files: list of files in this folder (list) :return: original file name (str)
625941e4498bea3a759b9ebf
def getItemsList(self): <NEW_LINE> <INDENT> pass
Field Caption
625941e463d6d428bbe44902
def set_bdev_qos_limit( client, name, rw_ios_per_sec=None, rw_mbytes_per_sec=None, r_mbytes_per_sec=None, w_mbytes_per_sec=None): <NEW_LINE> <INDENT> params = {} <NEW_LINE> params['name'] = name <NEW_LINE> if rw_ios_per_sec is not None: <NEW_LINE> <INDENT> params['rw_ios_per_sec'] = rw_ios_per_sec <NEW_LINE> <DEDENT> i...
Set QoS rate limit on a block device. Args: name: name of block device rw_ios_per_sec: R/W IOs per second limit (>=10000, example: 20000). 0 means unlimited. rw_mbytes_per_sec: R/W megabytes per second limit (>=10, example: 100). 0 means unlimited. r_mbytes_per_sec: Read megabytes per second limit (>=1...
625941e4507cdc57c63070f5
def Menu(): <NEW_LINE> <INDENT> pass
Main Menu of Project
625941e44e696a04525c985f
def itkImageSpatialObject3UL_cast(*args): <NEW_LINE> <INDENT> return _itkImageSpatialObjectPython.itkImageSpatialObject3UL_cast(*args)
itkImageSpatialObject3UL_cast(itkLightObject obj) -> itkImageSpatialObject3UL
625941e4d99f1b3c44c67999
def inverse_normal_transform(M): <NEW_LINE> <INDENT> R = stats.mstats.rankdata(M, axis=1) <NEW_LINE> if isinstance(M, pd.DataFrame): <NEW_LINE> <INDENT> Q = pd.DataFrame(stats.norm.ppf(R/(M.shape[1]+1)), index=M.index, columns=M.columns) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> Q = stats.norm.ppf(R/(M.shape[1]+1))...
Transform rows to a standard normal distribution
625941e4090684286d50f0fd
def find_list_of_possible_words_from_letter_in_matrix(): <NEW_LINE> <INDENT> pass
aka: boggle_solver ref: https://stackoverflow.com/questions/746082/how-to-find-list-of-possible-words-from-a-letter-matrix-boggle-solver
625941e42c8b7c6e89b35bcf
def calculateArea(feature,kmiserver,session_cookies,options): <NEW_LINE> <INDENT> if not settings.CALCULATE_AREA_IN_SEPARATE_PROCESS: <NEW_LINE> <INDENT> return _calculateArea(feature,kmiserver,session_cookies,options,False) <NEW_LINE> <DEDENT> parent_conn,child_conn = Pipe(True) <NEW_LINE> p = Process(target=calculat...
return:{ status { "invalid" : invalid message; "failed" : failed message; "overlapped" : overlap message } data: { total_area: 100 //exist if status_code = 1 other_area: 10 //exist if status_code = 1 and len(layers) > 0 layers: { //exist if status_c...
625941e4f8510a7c17cf9b10
def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, owner=None, group=None, logger=None): <NEW_LINE> <INDENT> tar_compression = {'gzip': 'gz', None: ''} <NEW_LINE> compress_ext = {'gzip': '.gz'} <NEW_LINE> if _BZ2_SUPPORTED: <NEW_LINE> <INDENT> tar_compression['bzip2'] = 'bz2' <NEW_LINE> compr...
Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output ta...
625941e49b70327d1c4e11e8
def close(self): <NEW_LINE> <INDENT> if len(Container._construction_stack) > 0: <NEW_LINE> <INDENT> if self != Container._construction_stack[-1]: <NEW_LINE> <INDENT> raise smach.InvalidStateError('Attempting to close a container that is not currently open.') <NEW_LINE> <DEDENT> <DEDENT> Container._construction_stack.po...
Close the container.
625941e4377c676e912725b8
def __init__(self, apikey, endpoint): <NEW_LINE> <INDENT> self.apikey = apikey <NEW_LINE> self.endpoint = endpoint + '/storage' <NEW_LINE> self.headers = {"apikey": apikey}
Pilw.io S3 storage api Arguments: apikey {String} -- Api key endpoint {String} -- PilwIO api endpoint
625941e4eab8aa0e5d26df6b
def backpropagation(self, final_outputs, hidden_outputs, X, y, delta_weights_i_h, delta_weights_h_o): <NEW_LINE> <INDENT> error = y-final_outputs <NEW_LINE> output_error_term = error * 1.0 <NEW_LINE> hidden_error = np.dot(self.weights_hidden_to_output, output_error_term) <NEW_LINE> hidden_error_term = hidden_error * (h...
Implement backpropagation Arguments --------- final_outputs: output from forward pass y: target (i.e. label) batch delta_weights_i_h: change in weights from input to hidden layers delta_weights_h_o: change in weights from hidden to output layers
625941e4ad47b63b2c50a390
def test_info_combined(self): <NEW_LINE> <INDENT> self.assertEqual( deduplicate_msisdns( OrderedDict( ( ( "identity1", { "msisdns": ["+27820001001"], "item1": "value1", "listitem": ["list1"], }, ), ( "identity2", { "msisdns": ["+27820001001"], "item2": "value2", "listitem": ["list2"], }, ), ) ) ), { "+27820001001": { "...
If there are 2 identities with the same msisdn, their info should be combined
625941e429b78933be1e5ab8
def time_learn(rows, cols): <NEW_LINE> <INDENT> x, y = get_test_data(rows, cols) <NEW_LINE> net = rpropnetwork(x.shape[1], 8, 1) <NEW_LINE> connect_feedforward(net) <NEW_LINE> net.maxError=0 <NEW_LINE> net.maxEpochs=1000 <NEW_LINE> start = time.time() <NEW_LINE> net.learn(x, y) <NEW_LINE> elapsed = time.time() - start ...
Return time elapsed to learn 10000 iterations on data
625941e4b7558d58953c531d
def zipf_pdf(k, n, s=1): <NEW_LINE> <INDENT> num = 1.0 / (k ** s) <NEW_LINE> den = sum([1.0 / ((ii + 1) ** s) for ii in range(n)]) <NEW_LINE> return num / den
return the probability of nth rank Parameters: ---------- k: {int} kth rank n: {int} total number of elemnets s: {float} distribution parameter
625941e46fece00bbac2db55
def _get_padded_shape(self, orig_shape): <NEW_LINE> <INDENT> trans_shape = self.pData.meta_data.get("transfer_shape") <NEW_LINE> pad = [] <NEW_LINE> for i, shape in enumerate(orig_shape): <NEW_LINE> <INDENT> mod = shape % trans_shape[i] <NEW_LINE> mod = (trans_shape[i] - mod) % trans_shape[i] <NEW_LINE> diff = trans_sh...
Get the (fake) shape of the data if it was exactly divisible by mft.
625941e4097d151d1a223269
def test_import(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import hanish <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> self.fail("could not import the hanish library")
Assert that we can import the hanish library
625941e438b623060ff0b1ff
def broken_1(m): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> for k in range(2 * m): <NEW_LINE> <INDENT> if is_prime(m): <NEW_LINE> <INDENT> count = count + 1 <NEW_LINE> <DEDENT> <DEDENT> main()
What comes in: a positive integer m that is at least 2. What goes out: Returns the number of prime numbers between m and (2m + 1) inclusive. Side effects: None. Examples: If m is 3, this function returns 3 since there are 3 primes between 3 and 7 (namely: 3, 5, and 7). If m is 10, then this function re...
625941e432920d7e50b285e5
def handle_request(self, request): <NEW_LINE> <INDENT> data = json.loads(request.body.decode('utf-8')) <NEW_LINE> if data['code'] not in widgets: <NEW_LINE> <INDENT> raise LookupError('Widget does not exists') <NEW_LINE> <DEDENT> widget = widgets.get(data['code'])() <NEW_LINE> if not widget.is_visible(self.request): <N...
Get widget data
625941e40a50d4780f6672a7
def add(self, rulefactory): <NEW_LINE> <INDENT> for rule in rulefactory.get_rules(self): <NEW_LINE> <INDENT> rule.bind(self) <NEW_LINE> self._rules.append(rule) <NEW_LINE> self._rules_by_endpoint.setdefault(rule.endpoint, []).append(rule) <NEW_LINE> <DEDENT> self._remap = True
Add a new rule or factory to the map and bind it. Requires that the rule is not bound to another map. :param rulefactory: a :class:`Rule` or :class:`RuleFactory`
625941e49f2886367277ac9c
def clone(self): <NEW_LINE> <INDENT> return _DataModel.CompositeTime_clone(self)
clone(CompositeTime self) -> Object
625941e415fb5d323cde0f27