code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def AddBackPropIndexedSlicesAccumulator(self, op, grad): <NEW_LINE> <INDENT> values = grad.values <NEW_LINE> indices = grad.indices <NEW_LINE> dense_shape = grad.dense_shape <NEW_LINE> self.Exit() <NEW_LINE> if self.outer_context: self.outer_context.Enter() <NEW_LINE> if values.get_shape().is_fully_defined(): <NEW_LINE...
This is used for accumulating gradients that are IndexedSlices. This is essentially the equavalent of AddBackPropAccumulator but optimized for things like updating embeddings from within a while loop. Args: op: The Enter op for a loop invariant. grad: The partial gradients represented as an IndexedSlices. Return...
625941e396565a6dacc8faad
def __init__(self, cachedir): <NEW_LINE> <INDENT> self.entries = {} <NEW_LINE> self.filename = "phonebook.txt" <NEW_LINE> self.file_cache = open(os.path.join(str(cachedir), self.filename), "w")
The constructor for the Phonebook class.
625941e3711fe17d82542745
def __init__(self, session, nick, account, command_queue): <NEW_LINE> <INDENT> Requester.__init__(self, session, 'http://www.msn.com/webservices/AddressBook/ABContactUpdate', 'omega.contacts.msn.com', 443, '/abservice/abservice.asmx', XmlManager.get('changenick', get_key(session), 'Me', nick)) <NEW_LINE> self.nick = ni...
command_queue is a reference to a queue that is used by the worker to get commands that other threads need to send
625941e366656f66f7cbc58f
def petitions(): <NEW_LINE> <INDENT> output = "Yay, signing petitions is a great way to push for change!" <NEW_LINE> output += "\n \t I sent you to a list of petitions that have yet to reach their goals." <NEW_LINE> output += "\n \t Is there anything else I can help you with? To quit, reply with 'QUIT'." <NEW_LINE> web...
Helper method to create chatbot response about petitions Parameters ---------- NONE Returns ------- output: string Chatbot response
625941e34f88993c3716c446
@login_required <NEW_LINE> def log_ajax(request, obj_type, obj, action): <NEW_LINE> <INDENT> if request.is_ajax() and request.method == "GET": <NEW_LINE> <INDENT> return HttpResponse() <NEW_LINE> <DEDENT> raise Http404
Simple AJAX view for logging actions. Note that since the logger intercepts requests and responses, this method just returns a success response.
625941e34527f215b584c836
def _listen(self, hostname): <NEW_LINE> <INDENT> self._server = _LogServer((hostname, 0), _LogHandler) <NEW_LINE> self._port = self._server.server_address[1] <NEW_LINE> logging.info('Listening for log messages at %s:%s', hostname, self._port) <NEW_LINE> atexit.register(self._stop, os.getpid()) <NEW_LINE> self._started....
Listen for log messages.
625941e37047854f462a17e8
def _mem_info_windows(): <NEW_LINE> <INDENT> global _MEMINFO <NEW_LINE> if not _MEMINFO: <NEW_LINE> <INDENT> total = psutil.virtual_memory().total // 1024 <NEW_LINE> swap = psutil.swap_memory().total // 1024 <NEW_LINE> _MEMINFO = namedtuple('memory', 'total swap')(total, swap) <NEW_LINE> <DEDENT> return _MEMINFO
Return total/swap memory info
625941e34f6381625f114e1e
def make_tests(): <NEW_LINE> <INDENT> assert find_hash('abcdef', 5) == 609043 <NEW_LINE> assert find_hash('pqrstuv', 5) == 1048970
Performs tests on the provided examples to check the result of the computation functions is ok.
625941e31d351010ab855efe
def p_valueList_single(self, p): <NEW_LINE> <INDENT> p[0] = p[1]
valueList : VALUE NEWLINES
625941e3099cdd3c635f103c
def display_score_board(self): <NEW_LINE> <INDENT> text_surface = FONT.render( "SCORE: "+ str(self.score), True, pygame.Color("white"), pygame.Color("black")) <NEW_LINE> self.screen.fill(pygame.Color("black"), self._rect_score_board) <NEW_LINE> self.screen.blit(text_surface, self._rect_score_board)
Displaying the score board while running the game
625941e321bff66bcd684d32
def destroy(name, call=None): <NEW_LINE> <INDENT> if call == 'function': <NEW_LINE> <INDENT> raise SaltCloudSystemExit( 'The destroy action must be called with -d, --destroy, ' '-a or --action.' ) <NEW_LINE> <DEDENT> salt.utils.cloud.fire_event( 'event', 'destroying instance', 'salt/cloud/{0}/destroying'.format(name), ...
Destroy a node. CLI Example:: salt-cloud --destroy mymachine
625941e3287bf620b61d3e44
def generate_prime_number(user_seed, length=1024): <NEW_LINE> <INDENT> seed(user_seed) <NEW_LINE> p = generate_prime_cadidate(length) <NEW_LINE> while not is_prime(p, 10): <NEW_LINE> <INDENT> p = generate_prime_cadidate(length) <NEW_LINE> <DEDENT> return p
Generate a prime Args: user_seed: seed use for randomization length int: length of the prime to generate, int bits (default is 1024) return a prime number with high properbility
625941e39f2886367277ac6d
def has_time_coord(wrfnc): <NEW_LINE> <INDENT> return "XTIME" in wrfnc.variables
Return True if the input file or sequence contains the time coordinate variable. The time coordinate is named 'XTIME'. Args: wrfnc (:class:`netCDF4.Dataset` or :class:`Nio.NioFile`): A single NetCDF file object. Returns: :obj:`bool`: True if the netcdf file contains the time coordinate v...
625941e3d53ae8145f87a64b
def _find_user(self, login): <NEW_LINE> <INDENT> for user in self._find_users(): <NEW_LINE> <INDENT> if login == user["login"]: <NEW_LINE> <INDENT> return user["id"] <NEW_LINE> <DEDENT> <DEDENT> for user in self._find_users(100): <NEW_LINE> <INDENT> if login == user["login"]: <NEW_LINE> <INDENT> return user["id"]
Find a specific Redmine user
625941e3d8ef3951e3243921
def time_str(secs): <NEW_LINE> <INDENT> if not secs: return 'no time at all' <NEW_LINE> D, H, M = 86400, 3600, 60 <NEW_LINE> d = int(secs // D); secs -= d * D <NEW_LINE> h = int(secs // H); secs -= h * H <NEW_LINE> m = int(secs // M); secs -= m * M <NEW_LINE> if int(secs) == secs: ss = str(int(secs)) <NEW_LINE> else: s...
70 -> '1 minute, 10 seconds'
625941e35510c4643540f7bd
def trace_next(self, blk, node, reg): <NEW_LINE> <INDENT> for ref_addr in self.get_all_ref(blk.start_ea): <NEW_LINE> <INDENT> block = self.get_blk(ref_addr) <NEW_LINE> if block: <NEW_LINE> <INDENT> FELogger.info("基本块跳转\t"+hexstr(ref_addr)+"\t"+idc.generate_disasm_line(ref_addr, 0)) <NEW_LINE> node_t = self.create_tree_...
下一轮回溯
625941e3a17c0f6771cbe432
def CreateLib(self): <NEW_LINE> <INDENT> self.WriteDefFile() <NEW_LINE> subprocess.call(['lib', '/nologo', '/machine:X86', '/def:' + self.DefFilePath(), '/out:' + self.LibFilePath()])
Creates a windows library file. Calling this function will create a lib file in the outdir_path that exports the signatures passed into the object.
625941e3b830903b967e9cea
def _parse_timings(self, entry, resource): <NEW_LINE> <INDENT> resource.timings.duration = float(entry.get('time', 0)) <NEW_LINE> resource.timings.timestamp = dateparser.parse(entry.get('startedDateTime', None)) <NEW_LINE> resource.timings.elapsed['from_start'] = (resource.timings.timestamp - self...
Parses the timings into HtmlResource :param entry: :param HtmlResource resource: :return: None
625941e3f7d966606f6aa3ec
def write(self, data): <NEW_LINE> <INDENT> if isinstance(data, int): <NEW_LINE> <INDENT> data = bytes((data,)) <NEW_LINE> <DEDENT> result = self.channel.write(data) <NEW_LINE> if result != len(data): <NEW_LINE> <INDENT> raise Exception('write timeout') <NEW_LINE> <DEDENT> self.channel.flush()
Write a sequence of bytes
625941e3cb5e8a47e48b7e87
def ignore_after(seconds, coro=None, *, timeout_result=None): <NEW_LINE> <INDENT> if coro is None: <NEW_LINE> <INDENT> return _TimeoutAfter(seconds, ignore=True, timeout_result=timeout_result) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return _timeout_after_func(seconds, coro, ignore=True, timeout_result=timeout_res...
Stop the enclosed task or block of code after seconds have elapsed. No exception is raised when time expires. Instead, None is returned. This is often more convenient that catching an exception. You can apply the function to a single coroutine: if ignore_after(5, coro(args)) is None: # A timeout occurre...
625941e38c3a8732951587a2
def daemonize(): <NEW_LINE> <INDENT> if os.fork(): <NEW_LINE> <INDENT> os._exit(0) <NEW_LINE> <DEDENT> os.setsid() <NEW_LINE> if os.fork(): <NEW_LINE> <INDENT> os._exit(0) <NEW_LINE> <DEDENT> os.umask(0) <NEW_LINE> std_in = open("/dev/null", 'r') <NEW_LINE> std_out = open(config.SOPDS_SERVER_LOG, 'a+') <NEW_LINE> os.du...
Detach from the terminal and continue as a daemon.
625941e3925a0f43d254a25e
def mutation_histogram(self, records, mut, filename): <NEW_LINE> <INDENT> if os.path.exists(filename + '.npz'): <NEW_LINE> <INDENT> logging.critical(filename + '.npz esists.') <NEW_LINE> return filename <NEW_LINE> <DEDENT> if records.shape[0] < self.min_seqs: <NEW_LINE> <INDENT> return '' <NEW_LINE> <DEDENT> igs = [IgR...
Records is a pd.Dataframe.
625941e38e71fb1e9831db8b
def PopState(self, **_): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.state = self.state_stack.pop() <NEW_LINE> logging.debug(u'Returned state to {0:s}'.format(self.state)) <NEW_LINE> return self.state <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> self.Error( u'Tried to pop the state but failed - poss...
Pop the previous state from the stack.
625941e35fc7496912cc3d61
def test_login_required(self): <NEW_LINE> <INDENT> response = self.client.get(PRODUCTS_URL) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED)
Test the login is required for retrieving products
625941e3de87d2750b860179
def wait(self, timeout=None): <NEW_LINE> <INDENT> return_code = self._process.wait(timeout) <NEW_LINE> if self._recorder is not None: <NEW_LINE> <INDENT> self.logger.info('Saving the UndoDB recording; it may take a few minutes...') <NEW_LINE> recorder_return = self._recorder.wait(timeout) <NEW_LINE> if recorder_return ...
Wait until process has terminated and all output has been consumed by the logger pipes.
625941e323e79379d52ee942
def move(self, move_tuple): <NEW_LINE> <INDENT> if move_tuple[0]<0 or move_tuple[0]>=self.bsize or move_tuple[1]<0 or move_tuple[1]>=self.bsize: <NEW_LINE> <INDENT> return False, False <NEW_LINE> <DEDENT> if self.board[move_tuple[0]][move_tuple[1]] == 0: <NEW_LINE> <INDENT> if self.ply in [1,3]: <NEW_LINE> <INDENT> if ...
Performs the provided move. The move is a tuple of an x and y position on the board.
625941e32eb69b55b151cc98
def _listen_for_response(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> response = self.client_socket.recv(1024) <NEW_LINE> if response: <NEW_LINE> <INDENT> response = pickle.loads(response) <NEW_LINE> return response
The method waits and listens for a response from the server. Returns: Response: When the response has been received from the server.
625941e3a219f33f34628d47
def show(self): <NEW_LINE> <INDENT> self.emit('show') <NEW_LINE> super(GUI, self).show()
Show the window.
625941e360cbc95b062c6927
def __init__(__self__, *, game_session_activation_timeout_seconds: Optional[pulumi.Input[int]] = None, max_concurrent_game_session_activations: Optional[pulumi.Input[int]] = None, server_processes: Optional[pulumi.Input[Sequence[pulumi.Input['FleetRuntimeConfigurationServerProcessArgs']]]] = None): <NEW_LINE> <INDENT> ...
:param pulumi.Input[int] game_session_activation_timeout_seconds: Maximum amount of time (in seconds) that a game session can remain in status `ACTIVATING`. :param pulumi.Input[int] max_concurrent_game_session_activations: Maximum number of game sessions with status `ACTIVATING` to allow on an instance simultaneously. ...
625941e3bde94217f36831d0
def initializeGame(): <NEW_LINE> <INDENT> session_attributes = {} <NEW_LINE> card_title = intent['name'] <NEW_LINE> speech_output = "Let's play Mad Libs, " "I'm choosing an awesome script." "Goodbye." <NEW_LINE> should_end_session = True <NEW_LINE> return build_response(session_att...
If we wanted to initialize the session to have some attributes we could add those here
625941e38e05c05ec3eea75b
def __init__(self, shaderConfig): <NEW_LINE> <INDENT> self._shaderConfig = shaderConfig
Creates a new instance of ShaderMixer.
625941e326238365f5f0f257
def list_files(project, files): <NEW_LINE> <INDENT> inputs, outputs, built_by, graph = parse_graph(project.graph) <NEW_LINE> if len(files) == 0: <NEW_LINE> <INDENT> fuzzed = sorted([f for f in inputs - outputs if project.filter_in(f)]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fuzzed = [os.path.abspath(f) for f in ...
Lists the files in the project to be fuzzed.
625941e301c39578d7e7521f
def send_codehilite_style(self, theme='default', dest=None): <NEW_LINE> <INDENT> if dest == None: <NEW_LINE> <INDENT> dest = self.staticpath <NEW_LINE> <DEDENT> hl = HtmlFormatter(style=theme).get_style_defs('.codehilite') <NEW_LINE> fname = path.join(dest, 'codehilite.css') <NEW_LINE> with open(fname, 'w') as f: <NEW_...
Send Pygments stylesheet to dest directory
625941e3cb5e8a47e48b7e88
def euler_phi(n, rand=False): <NEW_LINE> <INDENT> if n == 1: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> primefactors = prime_divisor_decomposition(n, rand) <NEW_LINE> phi = 1 <NEW_LINE> for p, a in primefactors: <NEW_LINE> <INDENT> phi *= pow(p, a-1) * (p - 1) <NEW_LINE> <DEDENT> return phi
Return Euler's totient value of n http://oeis.org/A000010 Details see: https://en.wikipedia.org/wiki/Euler's_totient_function
625941e3a17c0f6771cbe433
def save_metrics(self, split, metrics, combined=True): <NEW_LINE> <INDENT> if not self.is_world_process_zero(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> path = os.path.join(self.args.output_dir, f"{split}_results.json") <NEW_LINE> with open(path, "w") as f: <NEW_LINE> <INDENT> json.dump(metrics, f, indent=4, sort...
Save metrics into a json file for that split, e.g. ``train_results.json``. Under distributed environment this is done only for a process with rank 0. Args: split (:obj:`str`): Mode/split name: one of ``train``, ``eval``, ``test``, ``all`` metrics (:obj:`Dict[str, float]`): The metrics returned...
625941e35510c4643540f7be
def resize_image(img, width, height): <NEW_LINE> <INDENT> with open(img, 'r+b') as f_image: <NEW_LINE> <INDENT> with Image.open(f_image) as image: <NEW_LINE> <INDENT> cover = resizeimage.resize_cover(image, [width, height]) <NEW_LINE> cover.save(img, image.format) <NEW_LINE> <DEDENT> <DEDENT> return img
This method resizes the image.
625941e3656771135c3ebc57
def is_done_moving(self, robot_id: int) -> bool: <NEW_LINE> <INDENT> robot_pos = self.gs.get_robot_position(self._team, robot_id) <NEW_LINE> commands = self.gs.get_robot_commands(self._team, robot_id) <NEW_LINE> waypoints = commands.waypoints <NEW_LINE> if waypoints: <NEW_LINE> <INDENT> destination = waypoints[-1] <NEW...
Check if robot has arrived at final waypoint, angle included
625941e3293b9510aa2c3675
def _GetUnderlyingPrimitiveType(t): <NEW_LINE> <INDENT> if t.kind == fidl.TypeKind.PRIMITIVE: <NEW_LINE> <INDENT> return t.subtype <NEW_LINE> <DEDENT> elif t.kind == fidl.TypeKind.STRING: <NEW_LINE> <INDENT> return 'string' <NEW_LINE> <DEDENT> elif t.kind == fidl.TypeKind.IDENTIFIER: <NEW_LINE> <INDENT> return None <NE...
Returns the underlying FIDL primitive type for a higher level type.
625941e3dd821e528d63b589
def respond_and_save(users: Users) -> None: <NEW_LINE> <INDENT> respond_to_all(service, users) <NEW_LINE> save_users(users)
Respond to all messages, then save the user state
625941e357b8e32f52483881
def run(self): <NEW_LINE> <INDENT> if sickrage.srCore.WEBSERVER: <NEW_LINE> <INDENT> sickrage.srCore.WEBSERVER.server_shutdown() <NEW_LINE> return _responds(RESULT_SUCCESS, msg="SiCKRAGE is shutting down...") <NEW_LINE> <DEDENT> return _responds(RESULT_FAILURE, msg='SiCKRAGE can not be shut down')
Shutdown SiCKRAGE
625941e3167d2b6e31218f78
def status(name=None, user=None, conf_file=None, bin_env=None): <NEW_LINE> <INDENT> all_process = {} <NEW_LINE> for line in status_raw(name, user, conf_file, bin_env).splitlines(): <NEW_LINE> <INDENT> if len(line.split()) > 2: <NEW_LINE> <INDENT> process, state, reason = line.split(None, 2) <NEW_LINE> <DEDENT> else: <N...
List programs and its state user user to run supervisorctl as conf_file path to supervisord config file bin_env path to supervisorctl bin or path to virtualenv with supervisor installed CLI Example: .. code-block:: bash salt '*' supervisord.status
625941e3ad47b63b2c50a362
def forward(self, x): <NEW_LINE> <INDENT> M = torch.mm(x, self.T.view(self.in_features, -1)) <NEW_LINE> M = M.view(-1, self.out_features, self.intermediate_features).unsqueeze(0) <NEW_LINE> M_t = M.permute(1, 0, 2, 3) <NEW_LINE> out = torch.sum(torch.exp(-(torch.abs(M - M_t).sum(3))), dim=0) - 1 <NEW_LINE> return torch...
Computes the output of the Minibatch Discrimination Layer Args: x (torch.Tensor): A Torch Tensor of dimensions :math: `(N, infeatures)` Returns: 3D Torch Tensor of size :math: `(N,infeatures + outfeatures)` after applying Minibatch Discrimination
625941e3cad5886f8bd273bc
def __gt__(self, other)-> bool: <NEW_LINE> <INDENT> if isinstance(other, Polygon): <NEW_LINE> <INDENT> return self._numedges > other._numedges <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
implements > comparison
625941e34e696a04525c9831
def convert_num(num_str: str): <NEW_LINE> <INDENT> num, sign = num_str[:-1], num_str[-1] <NEW_LINE> if sign == "-": <NEW_LINE> <INDENT> return -int(num) <NEW_LINE> <DEDENT> return int(num_str)
>>> convert_num("12345") 12345 >>> convert_num("-12345") -12345 >>> convert_num("12345-") -12345 >>> convert_num("-12345-") 12345
625941e3cad5886f8bd273bd
def id(self): <NEW_LINE> <INDENT> return 'dzetsaka'
Returns the unique provider id, used for identifying the provider. This string should be a unique, short, character only string, eg "qgis" or "gdal". This string should not be localised.
625941e385dfad0860c3b23f
def query_create_or_restore(self, wallet_kinds): <NEW_LINE> <INDENT> vbox = QVBoxLayout() <NEW_LINE> main_label = QLabel(_("Electrum could not find an existing wallet.")) <NEW_LINE> vbox.addWidget(main_label) <NEW_LINE> grid = QGridLayout() <NEW_LINE> grid.setSpacing(5) <NEW_LINE> gb1 = QGroupBox(_("What do you want to...
Ask the user what they want to do, and to what wallet kind. wallet_kinds is an array of tuples (kind, description). Return a tuple (action, kind). Action is 'create' or 'restore', and kind is one of the wallet kinds passed.
625941e3be383301e01b5862
def hist_examples_091616(request): <NEW_LINE> <INDENT> context = {} <NEW_LINE> return render(request, 'irg_viz/hist_examples_091616.html', context=context)
Historical example page focusing on unassociated slide 9/16/2016.
625941e373bcbd0ca4b2c459
def get_revision_with_http_info(self, id, rev, **kwargs): <NEW_LINE> <INDENT> all_params = ['id', 'rev'] <NEW_LINE> all_params.append('callback') <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> params = l...
Get specific audited revision of this build configuration This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function to be invoked when receiving the response. >>> def callback_function(response): >>> pprint(response) >>> >>> thread = api.get_...
625941e34e4d5625662d47b6
def test_generates_genomes_according_to_genome_params_for_value_type_genes(self): <NEW_LINE> <INDENT> number = 10 <NEW_LINE> population_generator = PopulationGenerator(self.value_genome_params, {}) <NEW_LINE> random_genomes = population_generator.generate_random_genomes(number) <NEW_LINE> self.assertEqual(len(random_ge...
generate_random_genomes generates `number` genomes with values according to each gene's initial_distribution function
625941e33c8af77a43ae3b88
def enter(self): <NEW_LINE> <INDENT> self.turnOffLightboxes() <NEW_LINE> self.installShortcutKeys() <NEW_LINE> self.parameterNode = self.editUtil.getParameterNode() <NEW_LINE> self.parameterNodeTag = self.parameterNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.updateGUIFromMRML) <NEW_LINE> if self.helper: <NEW_LIN...
When entering the module, check that the lightbox modes are off and that we have the volumes loaded
625941e326068e7796caf0c9
def verify_stage(self, stage): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> if 'match' not in stage: <NEW_LINE> <INDENT> errors.append('No "match" argument in stage.') <NEW_LINE> <DEDENT> if errors: <NEW_LINE> <INDENT> return errors <NEW_LINE> <DEDENT> return stage
Verify that the stage is valid, return the stage, or a list of errors
625941e3e64d504609d74c24
def toString(): <NEW_LINE> <INDENT> pass
Returns the string representation of the property name. @return: a string
625941e37d43ff24873a3087
def scale(it, multiplier): <NEW_LINE> <INDENT> for i in it: <NEW_LINE> <INDENT> num = i * multiplier <NEW_LINE> yield num
Yield elements of the iterable it scaled by a number multiplier. >>> m = scale([1, 5, 2], 5) >>> type(m) <class 'generator'> >>> list(m) [5, 25, 10] >>> m = scale(naturals(), 2) >>> [next(m) for _ in range(5)] [2, 4, 6, 8, 10]
625941e3e1aae11d1e74a09f
def find_in_path(name, path): <NEW_LINE> <INDENT> for dir in path.split(os.pathsep): <NEW_LINE> <INDENT> binpath = pjoin(dir, name) <NEW_LINE> if os.path.exists(binpath): <NEW_LINE> <INDENT> return os.path.abspath(binpath) <NEW_LINE> <DEDENT> <DEDENT> return None
Find a file in a search path
625941e3435de62698dfe031
def _args_convertTo_id(self, args): <NEW_LINE> <INDENT> args_id = [] <NEW_LINE> for arg in args: <NEW_LINE> <INDENT> if isinstance(arg, ProxyDataContainer): <NEW_LINE> <INDENT> arg_id = ProxyDataContainer() <NEW_LINE> for item in arg: <NEW_LINE> <INDENT> if isinstance(arg[item], ProxyDataContainer): <NEW_LINE> <INDENT>...
All args sent from client to server must be either built-in types (int, str...) or ProxyID (or ProxyDataContainer), never ClientProxyObject
625941e356b00c62f0f14a40
def switch_to_default_frame(self): <NEW_LINE> <INDENT> self.driver.switch_to_default_content()
method to return base frame :return: base url
625941e39c8ee82313fbbb5a
def _htmldecode(self, text): <NEW_LINE> <INDENT> return ENTITY_SUB(self._decode_entity, text)
Decode HTML entities in the given text.
625941e357b8e32f52483882
def activate(self, actions: List[Action]) -> List[Action]: <NEW_LINE> <INDENT> return self.register(actions, add_files, after="define_structure")
Activate extension, see :obj:`~pyscaffold.extension.Extension.activate`.
625941e3498bea3a759b9e92
def length(self): <NEW_LINE> <INDENT> return len(self.__data)
return the stack length
625941e3236d856c2ad44bc3
def calculate_FD(rp_text_file,write_dir, sub_id,**template_dict): <NEW_LINE> <INDENT> realignment_parameters = np.loadtxt(rp_text_file) <NEW_LINE> rot_indices = range(3, 6) <NEW_LINE> rad = 50 <NEW_LINE> rot = realignment_parameters[:, rot_indices] <NEW_LINE> rdist = rad * np.tan(rot) <NEW_LINE> realignment_parameters[...
Calculates Framewise displacement from realignment parameters. realignment parameters is calculated from realignment of raw nifti Args: realignment parameters.txt file Returns: Mean of RMS of Framewise displacement Comments: Framewise Displacement of a time series is defined as the sum of the absolute value...
625941e3be8e80087fb21021
def gd(x, y_org, rate, num_iter,lam,Islasso,Isdegree): <NEW_LINE> <INDENT> beta=np.ones((x.shape[1],1)) <NEW_LINE> rate=rate/(x.shape[0]) <NEW_LINE> y_train=x.dot(beta) <NEW_LINE> diff=y_train-y_org <NEW_LINE> count=0 <NEW_LINE> costs = [] <NEW_LINE> for j in range(0,num_iter): <NEW_LINE> <INDENT> i= random.randint(0,x...
Function to apply Gradient descent on training data, and find beta
625941e3090684286d50f0ce
def printMirrorDict(self, short=True): <NEW_LINE> <INDENT> self.getMirrorSets() <NEW_LINE> if not short: <NEW_LINE> <INDENT> print('\nCentre MirrorLists =====================================================') <NEW_LINE> for i in r9Core.sortNumerically(list(self.mirrorDict['Centre'].keys())): <NEW_LINE> <INDENT> print('...
Pretty print the Mirror Dict
625941e30383005118ecf9c5
def fillna(self, value=None, method='pad'): <NEW_LINE> <INDENT> if value is None: <NEW_LINE> <INDENT> result = {} <NEW_LINE> for col, s in self.iteritems(): <NEW_LINE> <INDENT> result[col] = s.fillna(method=method, value=value) <NEW_LINE> <DEDENT> return WidePanel.fromDict(result) <NEW_LINE> <DEDENT> else: <NEW_LINE> <...
Fill NaN values using the specified method. Member Series / TimeSeries are filled separately. Parameters ---------- value : any kind (should be same type as array) Value to use to fill holes (e.g. 0) method : {'backfill', 'pad', None} Method to use for filling holes in new inde Returns ------- y : DataMatri...
625941e3d99f1b3c44c6796d
def complexroot(b): <NEW_LINE> <INDENT> r = random.randint(-1 * b, b) <NEW_LINE> i = random.randint(1, b) <NEW_LINE> root = complex(r, i) <NEW_LINE> return (root, root.conjugate())
Creates a pair of conjugated complex roots for an upcoming polynomial. Real part will lie between [-b;b]; imaginary between [1,b] :param b: int number, bordering values for complex roots :return: pair of two conjugated complex roots
625941e3bd1bec0571d90a13
def test_kb_list_shells_rfi_2181(self): <NEW_LINE> <INDENT> w3af_core = w3afCore() <NEW_LINE> vuln = MockVuln() <NEW_LINE> url = URL('http://moth/?a=1') <NEW_LINE> freq = FuzzableRequest(url) <NEW_LINE> exploit_mutant = QSMutant.create_mutants(freq, [''], [], False, {})[0] <NEW_LINE> shell = RFIShell(vuln, w3af_core.ur...
:see: https://github.com/andresriancho/w3af/issues/2181
625941e315fb5d323cde0ef9
def setTrainTail(self, pos, prevTI = None): <NEW_LINE> <INDENT> if pos == -1: <NEW_LINE> <INDENT> self._trainTail = -1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if prevTI == self._previousItem: <NEW_LINE> <INDENT> self._trainTail = pos <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._trainTail = self._realLength...
Same as setTrainHead() but with the trainTail information.
625941e396565a6dacc8faae
def t200800_x10(val1=5, mode1=1, mode2=1, mode3=1, mode4=0, mode5=0): <NEW_LINE> <INDENT> ClearPlayerDamageInfo() <NEW_LINE> TurnCharacterToFaceEntity(-1, 10000, -1) <NEW_LINE> call = t200800_x18(mode2=mode2, mode4=mode4) <NEW_LINE> def WhilePaused(): <NEW_LINE> <INDENT> c1_117(mode1, 10000) <NEW_LINE> c1_117(1000000, ...
State 0,2
625941e391f36d47f21ac8db
def parse_data_point(string): <NEW_LINE> <INDENT> red = int(string[1]) <NEW_LINE> green = int(string[3]) <NEW_LINE> blue = int(string[5]) <NEW_LINE> return (red, green, blue)
(1,2,3)
625941e391af0d3eaac9be00
def eventFilter(self, obj, evt): <NEW_LINE> <INDENT> if evt.type() == QEvent.MouseButtonRelease: <NEW_LINE> <INDENT> self._mouseButton = evt.button() <NEW_LINE> self._keyboardModifiers = evt.modifiers() <NEW_LINE> act = obj.defaultAction() <NEW_LINE> idx = self.index(act) <NEW_LINE> if idx.isValid(): <NEW_LINE> <INDENT...
Public method to handle event for other objects. @param obj reference to the object (QObject) @param evt reference to the event (QEvent) @return flag indicating that the event should be filtered out (boolean)
625941e3c4546d3d9de72e1b
def test_get_verify_mode_wrong_args(self): <NEW_LINE> <INDENT> context = Context(TLSv1_METHOD) <NEW_LINE> self.assertRaises(TypeError, context.get_verify_mode, None)
:py:obj:`Context.get_verify_mode` raises :py:obj:`TypeError` if called with any arguments.
625941e3ff9c53063f47c5d6
def transform(structure: modgrammar.Grammar, output_format: str) -> str: <NEW_LINE> <INDENT> return globals().get("_" + output_format + "_transform")(structure)
Transforms the given structure into the given output format. :param modgrammar.Grammar structure: :param str output_format: the output format
625941e34a966d76dd5513f7
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <...
Returns the model properties as a dict
625941e3d8ef3951e3243922
def init_input_output(self): <NEW_LINE> <INDENT> self.alpha = 0.6 <NEW_LINE> self.beta = 0.5 <NEW_LINE> self.x = np.random.uniform(0.1, 1, [2, 15, 4]).astype(self.dtype) <NEW_LINE> self.out = np.copy(self.x) <NEW_LINE> batch_size = self.x.shape[0] <NEW_LINE> max_length = self.x.shape[1] <NEW_LINE> enc_size = self.x.sha...
init the input and output for test cases
625941e3d6c5a10208144432
def __exit__(self, *args): <NEW_LINE> <INDENT> self.end = default_timer() <NEW_LINE> self.elapsed = self.end - self.start <NEW_LINE> print('Elapsed time is %f seconds.' % self.elapsed)
On exit, printing time elapsed since entering context manager.
625941e355399d3f05588a9b
def nativeTextUnderline(self): <NEW_LINE> <INDENT> return self.textUnderline()
TOWRITE :rtype: bool
625941e392d797404e304570
@app.route("/flights/<int:flight_id>") <NEW_LINE> def flight(flight_id): <NEW_LINE> <INDENT> flight = Flight.query.all() <NEW_LINE> if flight is None: <NEW_LINE> <INDENT> return render_template("error.html", message="No such flight.") <NEW_LINE> <DEDENT> passengers = flight.passengers <NEW_LINE> return render_template(...
Lists details about a single flight.
625941e3d6c5a10208144433
def load_data(data_file): <NEW_LINE> <INDENT> data = [] <NEW_LINE> f = open(data_file) <NEW_LINE> for line in f.readlines(): <NEW_LINE> <INDENT> sample = [] <NEW_LINE> lines = line.strip().split("\t") <NEW_LINE> for x in lines: <NEW_LINE> <INDENT> sample.append(float(x)) <NEW_LINE> <DEDENT> data.append(sample) <NEW_LIN...
导入训练数据 input: data_file(string):保存训练数据的文件 output: data(list):训练数据
625941e3925a0f43d254a25f
def get_users_mentions(ids, order_by=None, start_date=None, end_date=None): <NEW_LINE> <INDENT> path = "users/%s/mentioned" % __join(ids) <NEW_LINE> params = __translate(locals().copy(), ("creation", "name")) <NEW_LINE> return _site.fetch(path, "comments", **params)
Gets comments that are directed at a set of users.
625941e344b2445a33932478
def reverseInteger(self, n): <NEW_LINE> <INDENT> if n < -2147483648 or n > 2147483647: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> if n >= 0: <NEW_LINE> <INDENT> n = int(str(n)[::-1]) <NEW_LINE> if n < -2147483648 or n > 2147483647: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return ...
413. 反转整数 将一个整数中的数字进行颠倒,当颠倒后的整数溢出时,返回 0 (标记为 32 位整数)。 样例 给定 x = 123,返回 321 给定 x = -123,返回 -321
625941e350812a4eaa59c702
def get_all(self, sql, param=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if param is None: <NEW_LINE> <INDENT> count = self._cursor.execute(sql) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> count = self._cursor.execute(sql, param) <NEW_LINE> <DEDENT> if count > 0: <NEW_LINE> <INDENT> result = self._cursor.fetc...
@summary: 执行查询,并取出所有结果集 @param sql:查询SQL,如果有查询条件,请只指定条件列表,并将条件值使用参数[param]传递进来 @param param: 可选参数,条件列表值(元组/列表) @return: result list(字典对象)/boolean 查询到的结果集
625941e397e22403b379d380
def remove_proposed_group(self, group): <NEW_LINE> <INDENT> position = (group.left_object.string_number, group.right_object.string_number) <NEW_LINE> items = self.proposed_groups.get(position, []) <NEW_LINE> if group in items: <NEW_LINE> <INDENT> self.proposed_groups[position].remove(group)
Remove a proposed group from the string.
625941e3ad47b63b2c50a363
def update_sbc(**kwargs): <NEW_LINE> <INDENT> return q.update_sbc(**kwargs)
:menu: (enable=True, name=UPDATE SBC, section=Upgrade, num=7, args={'menu': True})
625941e30383005118ecf9c6
def list(self, **params): <NEW_LINE> <INDENT> _, _, archives = self.http_client.get("/archive", params=params) <NEW_LINE> return archives
Retrieve all Archives Returns all ArchiveService available to the Company, according to the parameters provided :calls: ``get /archive`` :param dict params: (optional) Search options. :return: List of dictionaries that support attriubte-style access, which represent collection of Archives. :rtype: list
625941e3fff4ab517eb2f823
def _detector(self): <NEW_LINE> <INDENT> detector = super()._detector() <NEW_LINE> module_spacing = 117 <NEW_LINE> chip_spacing = 3 <NEW_LINE> mask_width = 5 <NEW_LINE> nfast = 8 * 256 + 7 * chip_spacing <NEW_LINE> nslow = 2 * 256 + chip_spacing <NEW_LINE> for module in 0, 1: <NEW_LINE> <INDENT> for j in range(1): <NEW...
return a detector with additional masking
625941e3236d856c2ad44bc4
def clean_yzm(self): <NEW_LINE> <INDENT> yzm = self.cleaned_data.get('yzm') <NEW_LINE> con = get_redis_connection() <NEW_LINE> re_yzm = con.get('yzm') <NEW_LINE> re_yzm = re_yzm.decode('utf-8') <NEW_LINE> if yzm != re_yzm: <NEW_LINE> <INDENT> raise forms.ValidationError('验证码错误或失效!') <NEW_LINE> <DEDENT> else: <NEW_LINE>...
验证码的获取 :return:
625941e394891a1f4081be90
def add_entry(): <NEW_LINE> <INDENT> pass
Add new entry
625941e3ab23a570cc25056a
def show(self): <NEW_LINE> <INDENT> if not self._tablepath: <NEW_LINE> <INDENT> conv = conversion.Converter(tableobj=self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> conv = conversion.Converter(self._tablepath) <NEW_LINE> <DEDENT> gui._show(conv.texToPng(), conv)
Opens a GUI displaying a ".png" file representation of the table. PyQt4 is needed to use this method.
625941e31f037a2d8b9465e2
def set_level(self, level): <NEW_LINE> <INDENT> self.quota_level = level
set resource in given level
625941e376d4e153a657ef17
def _install(args, use_cache, debug): <NEW_LINE> <INDENT> engine = choose_engine(args) <NEW_LINE> engine.use_cache = use_cache <NEW_LINE> script_list = SCRIPT_LIST() <NEW_LINE> if not script_list or not os.listdir(SCRIPT_WRITE_PATH): <NEW_LINE> <INDENT> check_for_updates() <NEW_LINE> script_list = SCRIPT_LIST(force_com...
Install datasets for retriever.
625941e3046cf37aa974d129
def sortFactors(self): <NEW_LINE> <INDENT> if len(self.factors) > 1: <NEW_LINE> <INDENT> self.factors.sort()
Sort factors list. Return nothing.
625941e34428ac0f6e5babda
def endLoop(self): <NEW_LINE> <INDENT> assert self._current_run_timedelta_list is not None <NEW_LINE> curtime = time.time() <NEW_LINE> self._current_run_timedelta_list.append(curtime - self._loop_start_time) <NEW_LINE> self._current_run_names_list.append(self.final_sample_name) <NEW_LINE> if self.final_sample_name not ...
Call this at the end of loop to end benchmarking. Will record total loop time as well
625941e345492302aab5e6ac
def launch_stack( stack_name: str, aws_profile: Optional[str] = None, aws_region: str = "us-west-2", **parameters): <NEW_LINE> <INDENT> if aws_profile is None: <NEW_LINE> <INDENT> aws_profile = os.getenv("DEFAULT_PROFILE", "default") <NEW_LINE> <DEDENT> launcher = StackLauncher(stack_name, aws_profile, aws_region) <NEW...
Launches the stack (for CLI use). :param stack_name: Name of the stack to launch (Template must be in aws-stacks). :param aws_profile: Profile to use for credentials. Default is DEFAULT_PROFILE (if it has been set) or otherwise "default". :param aws_region: Region where stack will be launched. :param parameters...
625941e35fdd1c0f98dc061a
def compile_dataset(subjects, dataset_dir, workspace, max_vocab_size=5000, test_split=0.3): <NEW_LINE> <INDENT> if not gb_input.is_input_initialized(workspace): <NEW_LINE> <INDENT> if os.path.exists(workspace): <NEW_LINE> <INDENT> tf.gfile.DeleteRecursively(workspace) <NEW_LINE> <DEDENT> train_inputs, test_inputs, voca...
Assemble all needed components in order to build the GB chapters dataset. :param subjects: The subjects to target. :param dataset_dir: The directory of the dataset. :param workspace: The directory of the workspace where all content is stored. :param max_vocab_size: The maximum number of vocabulary to keep in the datase...
625941e338b623060ff0b1d2
def SetTheStatsUncs(histo): <NEW_LINE> <INDENT> for bin in range(1, histo.GetNbinsX() + 1): <NEW_LINE> <INDENT> histo.SetBinError(bin, math.sqrt(histo.GetBinContent(bin))) <NEW_LINE> <DEDENT> return
Function that sets the uncs. of the given histogram as the expecteds from its contents.
625941e34527f215b584c838
@analyse_main_wrapper( "Main plotter for DiscSolver", plot_parser, cmd_parser_splitters={ "common_plot_args": get_common_plot_args, "plot_args": get_plot_args, } ) <NEW_LINE> def plot_main(soln, *, soln_range, common_plot_args, plot_args): <NEW_LINE> <INDENT> return plot(soln, soln_range=soln_range, **common_plot_args,...
Entry point for ds-plot
625941e3091ae3566866733c
def get_user_client(self, user): <NEW_LINE> <INDENT> if isinstance(user, UserProxy): <NEW_LINE> <INDENT> id_value = user.id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> id_value = user["id"] <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> id_value = user <NEW_LINE> <DEDENT> <DEDENT> ...
Get a `UserProxy` for a user with specified ID. :param user: The ID (name), dict representing the properties or :class:`UserProxy` instance of the user to be retrieved. :returns: A `UserProxy` instance representing the retrieved user. :raises ~azure.cosmos.exceptions.CosmosHttpResponseError: If the given user coul...
625941e3cc0a2c11143dd277
def __init__(self, prefixes_str=""): <NEW_LINE> <INDENT> super(StatusBarWidget, self).__init__() <NEW_LINE> self.statusbar = gtk.VBox() <NEW_LINE> hline = gtk.HSeparator() <NEW_LINE> self.statusbar.pack_start(hline) <NEW_LINE> hline.show() <NEW_LINE> hbox = gtk.HBox() <NEW_LINE> self.datasource_display = rose.gtk.util....
Generate the status bar.
625941e32eb69b55b151cc99
def sign_request(self, request): <NEW_LINE> <INDENT> timestamp = str(time.time()) <NEW_LINE> nonce = urlsafe_b64encode(urandom(32)).strip("=") <NEW_LINE> query = request.get_full_url() <NEW_LINE> to_be_signed = 'GET%s%s%s%s' % (query, timestamp, self.api_app_id, nonce) <NEW_LINE> signature = hmac.new(self.api_app_secre...
Sign request per PBSAuth specifications. Keyword arguments: `request` -- instance of `urllib2.Request` Returns: instance of `urllib2.Request` (signed)
625941e38c0ade5d55d3eda3
def test_create_token_missing_field(self): <NEW_LINE> <INDENT> res = self.client.post(TOKEN_URL, {'email': 'one', 'password': ''}) <NEW_LINE> self.assertNotIn('token', res.data) <NEW_LINE> self.assertEqual(res.status_code, status.HTTP_400_BAD_REQUEST)
Test that email and password are requerid
625941e34f6381625f114e21
def DeleteLoadBalancerListeners(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("DeleteLoadBalancerListeners", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.Delet...
This API is used to delete multiple listeners of a CLB instance. This is an async API. After it is returned successfully, you can call the `DescribeTaskStatus` API with the returned `RequestID` as an input parameter to check whether this task is successful. :param request: Request instance for DeleteLoadBalancerListen...
625941e38c3a8732951587a4