code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _build_simple_command(self, cmd): <NEW_LINE> <INDENT> return cmd+NEWLINE
Build handler for basic SBE16 commands. @param cmd the simple sbe16 command to format. @retval The command to be sent to the device.
625941d5d10714528d5fff08
def get(self, path, metadata): <NEW_LINE> <INDENT> return self.param_tree.get(path, metadata=metadata)
Construct a dict by running the get command for the given path on the tree :param path: URI path of request :param metadata: Boole representing whether to include the metadata :return: a dict containing the data in a tree structure
625941d523849d37ff7b32b1
def run(): <NEW_LINE> <INDENT> root_mount_point = tempfile.mkdtemp(prefix="calamares-root-") <NEW_LINE> partitions = libcalamares.globalstorage.value("partitions") <NEW_LINE> extra_mounts = libcalamares.job.configuration["extraMounts"] <NEW_LINE> extra_mounts_efi = libcalamares.job.configuration["extraMountsEfi"] <NEW_...
Define mountpoints. :return:
625941d5d58c6744b4257e81
def size(self): <NEW_LINE> <INDENT> return self._dll._counter
Return the size of the Deque.
625941d5a4f1c619b28b0258
def on_run(self, *tasks, subtasks=(), finite=True, **kwargs): <NEW_LINE> <INDENT> subtasks_iterable = itertools.chain(tasks, subtasks) <NEW_LINE> for task in subtasks_iterable: <NEW_LINE> <INDENT> if finite and task.has_ever_finished: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> task() <NEW_LINE> if not task.finish...
:param tasks: Tasks to be run sequentially. :param subtasks: More tasks to be run sequentially. Note: these Tasks are run after the `tasks` argument. :param finite: If True, each task is considered finished if .has_ever_finished is True. Tasks are not run if .has_ever_finished is True (and finite is True).
625941d5cb5e8a47e48b7ccb
def predict(model_path, test_path, output_path, predictionType="classification", outputType="int", headers=False, first_col_label=False): <NEW_LINE> <INDENT> print("loading model...") <NEW_LINE> try: <NEW_LINE> <INDENT> model = serial.load(model_path) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> print...
Predict from a pkl file. Parameters ---------- modelFilename : str The file name of the model file. testFilename : str The file name of the file to test/predict. outputFilename : str The file name of the output file. predictionType : str, optional Type of prediction (classification/regression). outputT...
625941d5711fe17d8254258b
def parse_json_from_html(self, response): <NEW_LINE> <INDENT> parser = html.fromstring(str(response)) <NEW_LINE> raw_json_data = parser.xpath('//script[@data-zrr-shared-data-key="mobileSearchPageStore"]//text()') <NEW_LINE> if not raw_json_data: <NEW_LINE> <INDENT> skip_scraper(self.college, 'Zillow') <NEW_LINE> return...
Find JSON from given html text.
625941d5091ae3566866717e
def test_connection(self, timeout=1): <NEW_LINE> <INDENT> if not self.service_port: <NEW_LINE> <INDENT> raise NotReachableException("Could not find container port") <NEW_LINE> <DEDENT> if not self.internal_ip: <NEW_LINE> <INDENT> raise NotReachableException("Could not find container IP, is container running?") <NEW_LIN...
Checks if the service running inside the container is accepting connections
625941d5711fe17d8254258c
def recoverData(Z, U, K): <NEW_LINE> <INDENT> X_rec = np.dot(Z, U[:, 0:K].T) <NEW_LINE> return X_rec
recovers an approximation the original data that has been reduced to K dimensions. It returns the approximate reconstruction in X_rec.
625941d5627d3e7fe0d69074
def GetFullRegistryTag(self, image): <NEW_LINE> <INDENT> region = util.GetMultiRegionFromRegion(util.GetRegionFromZone(self.zone)) <NEW_LINE> hostname = '{region}.gcr.io'.format(region=region) <NEW_LINE> full_tag = '{hostname}/{project}/{name}'.format( hostname=hostname, project=self.project, name=image) <NEW_LINE> ret...
Gets the full tag of the image.
625941d5bf627c535bc133f2
def set_latent_vector(self, values, *names, differentiable=False): <NEW_LINE> <INDENT> values = unpack(values, *map(B.shape, self.get_latent_vars(*names))) <NEW_LINE> if differentiable: <NEW_LINE> <INDENT> for index, value in zip( self.get_latent_vars(*names, return_indices=True), values ): <NEW_LINE> <INDENT> self.var...
Set all the latent variables by values from a vector. If no arguments are supplied, then all latent variables are retrieved. Args: values (tensor): Vector to set the variables to. *names (hashable): Set variables by name. differentiable (bool, optional): Differentiable assignment. Defaults to `Fal...
625941d5796e427e537b07ea
def search(self, nums, target): <NEW_LINE> <INDENT> lo, hi = 0, len(nums) - 1 <NEW_LINE> while lo <= hi: <NEW_LINE> <INDENT> mid = lo + (hi - lo) // 2 <NEW_LINE> midV = nums[mid] <NEW_LINE> loV = nums[lo] <NEW_LINE> hiV = nums[hi] <NEW_LINE> if target in (loV, hiV, midV): <NEW_LINE> <INDENT> return True <NEW_LINE> <DED...
:type nums: List[int] :type target: int :rtype: int
625941d58e71fb1e9831d9cb
def on_warn(self, warn_event): <NEW_LINE> <INDENT> if self.async_mode: <NEW_LINE> <INDENT> self.event_queue.append(('warn', warn_event)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for warn_hook in self._warn_hooks: <NEW_LINE> <INDENT> warn_hook(warn_event) <NEW_LINE> <DEDENT> <DEDENT> return
Publish *warn_event* to all sinks with ``on_warn()`` hooks.
625941d529b78933be1e58cc
def registration(request): <NEW_LINE> <INDENT> if request.user.is_authenticated: <NEW_LINE> <INDENT> return redirect(reverse('index')) <NEW_LINE> <DEDENT> if request.method == "POST": <NEW_LINE> <INDENT> registration_form = UserRegistrationForm(request.POST) <NEW_LINE> if registration_form.is_valid(): <NEW_LINE> <INDEN...
Render the registration page
625941d5c432627299f04e6a
def os_installer_config(self, config, **kwargs): <NEW_LINE> <INDENT> return {}
virtual method to get os installer related config. :param config: os installer host configuration :type config: dict :returns: package related configuration for os installer.
625941d58e71fb1e9831d9cc
def get_name(symbol): <NEW_LINE> <INDENT> return __fetch(symbol, 'n')
Returns: A string of the name of a given security.
625941d571ff763f4b5498b1
def formatFolder(folderName,create=False): <NEW_LINE> <INDENT> if folderName[-1] != '/': <NEW_LINE> <INDENT> folderName +='/' <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> foo = os.listdir(folderName) <NEW_LINE> return folderName <NEW_LINE> <DEDENT> except OSError: <NEW_LINE> <INDENT> print('folder %s does not exist' % ...
makes sure a folder exists and if not makes it returns a bool for folder
625941d526068e7796caef04
def Ar(S,T,**kwargs): <NEW_LINE> <INDENT> conc = _garcia_gordon_polynomial(S,T, A0 = 2.79150, A1 = 3.17609, A2 = 4.13116, A3 = 4.90379, B0 = -6.96233e-3, B1 = -7.66670e-3, B2 = -1.16888e-2) <NEW_LINE> return _umolkg_to_mmolm3(conc)
Solubility of Ar in sea water INPUT: (if S and T are not singular they must have same dimensions) S = salinity [PSS] T = temperature [degree C] conc = solubility of Ar [mmol/m^3] REFERENCE: Roberta Hamme and Steve Emerson, 2004. "The solubility of neon, nitrogen and argon in distilled water and seawater." Deep-Se...
625941d5e8904600ed9f2152
def E(self, tslice=None, vslice=None, postprocess=None): <NEW_LINE> <INDENT> return self._expression('H', tslice=tslice, vslice=vslice, postprocess=postprocess)
E === Generator of discrete energy's values. Parameters ----------- start: int or None, optional Starting index. If None, start=0 (default). stop: int or None, Stoping index. If None, stop=data.nt (default). step: int or None, stepation factor. If None, step = 1 (default). Returns ------- E_generator: g...
625941d592d797404e3043ae
def restart(self, clean=True): <NEW_LINE> <INDENT> self.stop() <NEW_LINE> self.wait(self.status.STOPPED) <NEW_LINE> if clean: <NEW_LINE> <INDENT> self._move_app_path() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._move_std_and_logs() <NEW_LINE> <DEDENT> path_cleanup = self.cfg.path_cleanup <NEW_LINE> self.cfg._op...
Stop the driver, archive the app_dir or rename std/log, and then restart the driver. :param clean: if set to ``True``, perform a 'clean' restart where all persistence is deleted, else a normal restart. :type clean: ``bool``
625941d5fff4ab517eb2f65f
def strength(self, triangle, triangle_set, subset=None): <NEW_LINE> <INDENT> maxstrength = 0.0 <NEW_LINE> for view in self.views(subset=subset): <NEW_LINE> <INDENT> minstrength = float('inf') <NEW_LINE> for camera in view: <NEW_LINE> <INDENT> strength = self[camera].strength(triangle) <NEW_LINE> if not strength or self...
Return the individual coverage strength of a point in the coverage strength model. @param triangle: The triangle to test. @type triangle: L{TensorTriangle} @param triangle_set: Set of additional triangles for occlusion. @type triangle_set: C{list} of L{Triangle} @param subset: Subset of cameras (defaults to all active...
625941d50a50d4780f6670b7
def get_delta_angle(pos, alpha, goal_pos): <NEW_LINE> <INDENT> alpha_direct = alpha_to_z(alpha) <NEW_LINE> goal_direct = complex(goal_pos[0] - pos[0], goal_pos[1] - pos[1]) <NEW_LINE> try: <NEW_LINE> <INDENT> zturn = (goal_direct / alpha_direct) <NEW_LINE> <DEDENT> except ZeroDivisionError: <NEW_LINE> <INDENT> return 0...
Calculate angle between robot and goal. Args: pos: Position of robot in window space. alpha: Robot orientation. goal_position: <= Returns: Angle difference in Delta space.
625941d5293b9510aa2c34b7
def set_on_change_listener(self, listener, funcname): <NEW_LINE> <INDENT> self.eventManager.register_listener(self.EVENT_ONCHANGE, listener, funcname)
register the listener for the onchange event.
625941d5442bda511e8be639
@app.route('/home') <NEW_LINE> def home(): <NEW_LINE> <INDENT> return render_template( 'index2.html', title='Home Page', year=datetime.now().year, )
Renders the home page.
625941d576d4e153a657ed55
def deposit(): <NEW_LINE> <INDENT> pass
Deposits the current load of the robot in order to score points. Deposit can only be done at the robot home base. If it is done anywhere else, the robot will lose its load and cannot recover it :returns: None
625941d5d18da76e235326fb
def p_multi_stmt_ind_block(p): <NEW_LINE> <INDENT> p[0] = p[1]
multi_stmt : indented_block
625941d5fff4ab517eb2f660
def __init__(self, chat_, parent=None): <NEW_LINE> <INDENT> super().__init__(parent=parent) <NEW_LINE> self.chat = chat_ <NEW_LINE> self.ui_main = Ui_Form() <NEW_LINE> self.ui_main.setupUi(self) <NEW_LINE> self.chat.sign_comming_msg.connect(self.show_msg) <NEW_LINE> self.model = QStandardItemModel() <NEW_LINE> self.ui_...
:param chat_: 聚合关系(调用辅助类: webchathelper ) :param parent: 依赖父窗口时,需要传递,不依赖时为None (该参数默认就为None,如果明确没有父窗体可以不指定)
625941d5e64d504609d74a63
def release_segmentation_id(id): <NEW_LINE> <INDENT> driver = _get_driver() <NEW_LINE> try: <NEW_LINE> <INDENT> driver.release_segmentation_id(id) <NEW_LINE> <DEDENT> except NameError: <NEW_LINE> <INDENT> raise ex.SegmentationDriverBindingDriverCompatibilityFailure
Releases the segmentation ID.
625941d53539df3088e2e56e
def details(app_id, hl="en", gl="us"): <NEW_LINE> <INDENT> s = scraper.PlayScraper(hl, gl) <NEW_LINE> return s.details(app_id)
Sends a GET request to the app's info page, parses the app's details, and returns them as a dict. :param app_id: the app to retrieve details from, e.g. 'com.nintendo.zaaa' :return: a dictionary of app details
625941d5d58c6744b4257e82
def test_missing_func_params_in_sphinx_docstring( x, y, z ): <NEW_LINE> <INDENT> pass
Example of a function with missing Sphinx parameter documentation in the docstring :param x: bla :param int z: bar
625941d5566aa707497f4789
def serialize(self): <NEW_LINE> <INDENT> return { 'aggregate_root_id': self.__aggregate_root_id, 'my_prop': self.__my_prop, }
Serialize the event for storing
625941d57cff6e4e81117ba9
def __init__(self, template: npc.NPC) -> None: <NEW_LINE> <INDENT> self.size = "Small" <NEW_LINE> self.type = "humanoid" <NEW_LINE> self.race = "(halfling)" <NEW_LINE> self.abil_mods["dex"] = 2 <NEW_LINE> self.abil_mods["cha"] = 1 <NEW_LINE> self.features["Brave"] = "The halfling has advantage on saving throws against ...
Takes an NPC template and alters it to have the racial abilities given in the DM's Guide.
625941d58e7ae83300e4b1f0
def make_fileitem_peinfo_exports_numberoffunctions(function_count, condition='is', negate=False): <NEW_LINE> <INDENT> document = 'FileItem' <NEW_LINE> search = 'FileItem/PEInfo/Exports/NumberOfFunctions' <NEW_LINE> content_type = 'int' <NEW_LINE> content = function_count <NEW_LINE> ii_node = ioc_api.make_indicatoritem_...
Create a node for FileItem/PEInfo/Exports/NumberOfFunctions :return: A IndicatorItem represented as an Element node
625941d515baa723493c419a
def __parse_post_list( post_list: list, url_formatter: callable, tag_key) -> tuple: <NEW_LINE> <INDENT> post = choice(post_list) <NEW_LINE> try: <NEW_LINE> <INDENT> file_url = url_formatter(post) <NEW_LINE> return file_url, post[tag_key].split(' ') <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return None, N...
Parse the post list to return the file url and its tags. :param post_list: the post list. :param url_formatter: a callable to get the file url. :param tag_key: the key to get the tag string. :return: a tuple of (file url, list of tags)
625941d5dc8b845886cb5759
def plot_blank(self): <NEW_LINE> <INDENT> return wx.Bitmap(os.path.join(pathfinder.bitmap_path(), 'thumbs_disabled.png'))
Returns a wx Bitmap placeholder to display when thumbnails are disabled
625941d56fece00bbac2d964
def test_update_failed_message_count_no_identity_supplied(self): <NEW_LINE> <INDENT> data = {"data": {"delivered": True}} <NEW_LINE> response = self.client.post( "/api/v1/identities/message_count/", json.dumps(data), content_type="application/json", ) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_400_BA...
If neither the identity or to_addr fields are populated, we should get an error returned to us.
625941d510dbd63aa1bd2dc6
def create_help(self, context, previous_state=None): <NEW_LINE> <INDENT> return HelpState( self._input_mapper, context, self, self._view, previous_state=previous_state)
Create a "no username" state object. Args: context: The state pattern context object.
625941d50fa83653e46571de
@_ignore_in_changes <NEW_LINE> def create_service(workspace_name, service): <NEW_LINE> <INDENT> service_properties = get_service_properties(service) <NEW_LINE> return server.create_service(workspace_name, **service_properties)
Take a workspace_name and a service object and save it to the sever. Return the server's json response as a dictionary.
625941d544b2445a339322b8
def shrink_uuid(uuid): <NEW_LINE> <INDENT> assert isinstance(uuid, UUID) <NEW_LINE> return (b64encode(uuid.bytes, BASE64_ALTCHARS)[:22]).decode("latin1")
Returns base64 representation of ``uuid``. >>> shrink_uuid(UUID('a4af2f54-e988-4f5c-bfd6-351c79299b74')) 'pK8vVOmIT1y_1jUceSmbdA' >>> shrink_uuid(UUID('d17aba88-19c3-400e-adee-3ecf935db272')) '0Xq6iBnDQA6t7j7Pk12ycg' >>> shrink_uuid(UUID('39ae13ee-202a-42d1-9117-6fb6fdd169a4')) 'Oa4T7iAqQtGRF2-2_dFppA' >>> shrink_uuid...
625941d5009cb60464c635d4
def __init__(self, obs_size, act_size, m_act_size, fea_size, hidden_dims): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.layers = nn.ModuleList() <NEW_LINE> self.observation_size = obs_size <NEW_LINE> self.action_size = act_size <NEW_LINE> self.mean_action_size = m_act_size <NEW_LINE> self.feature_size = fea_s...
Create a new critic network. The network is composed of linear (or fully connected) layers. After the linear layer, except the last case, we use ReLU for the activation function. Parameters ---------- obs_size act_size fea_size hidden_dims : list Dimensions of hidden layers. ex. if hidden_dims = [128, 64, 32],...
625941d5091ae3566866717f
def selenium_login(): <NEW_LINE> <INDENT> url = URL_ADSF + environ["JW_USER"] <NEW_LINE> passwd = environ["JW_PASS"] <NEW_LINE> options = Options() <NEW_LINE> options.add_argument("no-sanbox") <NEW_LINE> driver = webdriver.Chrome(chrome_options=options) <NEW_LINE> driver.get(url) <NEW_LINE> password_input = driver.find...
Authorize with Chromium and return cookies
625941d523849d37ff7b32b2
def on_deleted(path): <NEW_LINE> <INDENT> if path == rulemgr.path: <NEW_LINE> <INDENT> _LOGGER.critical('Network rules directory was removed: %r', path) <NEW_LINE> utils.sys_exit(1) <NEW_LINE> <DEDENT> rule_file = os.path.basename(path) <NEW_LINE> _LOGGER.info('Removing %r', rule_file) <NEW_LINE> chain_rule = rulemgr.g...
Invoked when a network rule is deleted.
625941d5a17c0f6771cbe273
def update_data(self, nodes, edges): <NEW_LINE> <INDENT> pass
Provides updated data for the datasources. nodes: list of tuples (id, timestamp, relevance) edges: list of tuples (parent id, child id) All parent & child IDs need to be in the updated nodes list.
625941d5be8e80087fb20e64
def export_results_to_file(self, file_name): <NEW_LINE> <INDENT> with open(file_name, 'w', newline='') as file: <NEW_LINE> <INDENT> date_time = datetime.datetime.now().strftime("%I:%M%p on %B %d - %Y") <NEW_LINE> intro_text = "\n".join(["Griffon Simulation Results - {date}".format(date=date_time), str(self.initializer)...
export the data to a .txt that is formatted :param file_name: name of the file where to output the files :return: nothing
625941d5a219f33f34628b8b
def get_partition_list(job, min_blocks=0, filter_func=None, exclude_swap=True, open_func=open): <NEW_LINE> <INDENT> active_swap_devices = set() <NEW_LINE> if exclude_swap: <NEW_LINE> <INDENT> for swapline in open_func('/proc/swaps'): <NEW_LINE> <INDENT> if swapline.startswith('/'): <NEW_LINE> <INDENT> active_swap_devic...
Get a list of partition objects for all disk partitions on the system. Loopback devices and unnumbered (whole disk) devices are always excluded. :param job: The job instance to pass to the partition object constructor. :param min_blocks: The minimum number of blocks for a partition to be considered. :...
625941d5a05bb46b383eca45
def validation_epoch_end(self, outputs): <NEW_LINE> <INDENT> avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean() <NEW_LINE> tensorboard_logs = {'val_loss': avg_loss} <NEW_LINE> return {'val_loss': avg_loss, 'log': tensorboard_logs, 'progress_bar': tensorboard_logs}
How to aggregate outputs of `validation_step` for logging. Args: outputs (list[dict]): List of validation losses, each with a ``'val_loss'`` key Returns: dict: Average loss ``'val_loss'``: Average loss on `outputs` ``'log'``: Tensorboard logs ``'progress_bar'``: Tensorboard logs
625941d5379a373c97cfad69
def main(): <NEW_LINE> <INDENT> print('Welcome to the Brain Games') <NEW_LINE> name = welcome_user() <NEW_LINE> print('Hello, {0}!'.format(name)) <NEW_LINE> return name
Make a user intreface. Greet user + return name of user. Returns: str
625941d5dd821e528d63b3cc
def set(self): <NEW_LINE> <INDENT> self.name("ctulimit") <NEW_LINE> self.append(self.test_functional, "Test ctulimit functionality") <NEW_LINE> return
Set all test functions.
625941d5097d151d1a22307c
def does_top_window_exist(self, parent, btn_name, window_name): <NEW_LINE> <INDENT> btn = None <NEW_LINE> children = parent.GetChildren() <NEW_LINE> print(", ".join([child.GetName() for child in children])) <NEW_LINE> for child in children: <NEW_LINE> <INDENT> if child.GetName() == btn_name: <NEW_LINE> <INDENT> btn = c...
produces a click event on the button called btn_name, see if it produces a top-level window called window_name
625941d5287bf620b61d3c86
def fix_inconsistent_naming(title): <NEW_LINE> <INDENT> d = {} <NEW_LINE> nt = title.replace("Marvels", "").replace("Marvel's", "") <NEW_LINE> if nt != title: <NEW_LINE> <INDENT> d[title] = nt <NEW_LINE> <DEDENT> return _fix_inconsistent_naming(title, d)
Fix titles with inconsistent naming using dictionary and sanitize them. :param str title: original title. :return: new title. :rtype: str
625941d5ad47b63b2c50a1a3
def string(addr, max=4096): <NEW_LINE> <INDENT> if peek(addr): <NEW_LINE> <INDENT> data = bytearray(read(addr, max, partial=True)) <NEW_LINE> if b'\x00' in data: <NEW_LINE> <INDENT> return data.split(b'\x00')[0] <NEW_LINE> <DEDENT> <DEDENT> return bytearray()
Reads a null-terminated string from memory. Arguments: addr(int): Address to read from max(int): Maximum string length (default 4096) Returns: An empty bytearray, or a NULL-terminated bytearray.
625941d5379a373c97cfad6a
@app.route("/get/todayRequest", methods=["GET"]) <NEW_LINE> def get_today_request(): <NEW_LINE> <INDENT> today = get_today() <NEW_LINE> cursor = conn.db().cursor() <NEW_LINE> sql = "select email, url, analysis_check as analysisResult from RequestList where request_date = %s" <NEW_LINE> cursor.execute(sql, today) <NEW_L...
Get today request list API :return: json type request list
625941d563d6d428bbe44713
def det(p1,p2,p3): <NEW_LINE> <INDENT> return (p2[0]-p1[0])*(p3[1]-p1[1]) -(p2[1]-p1[1])*(p3[0]-p1[0])
Funkce určuje, zda pohyb od bodu 1 k bodu 3 přes bod 2 šel po nebo proti směru hodinových ručíček. Pokud return bude < 0, tak pohyb jde po směru hodinových ručíček, pokud return > 0, tak pohyb jde proti. :param p1: :param p2: :param p3: :return:
625941d5b5575c28eb68e225
def test_delete_cluster_that_does_not_exist(self): <NEW_LINE> <INDENT> bus = mock.MagicMock() <NEW_LINE> bus.storage.get_cluster.side_effect = _bus.StorageLookupError('test') <NEW_LINE> self.assertEquals( expected_error(ID, JSONRPC_ERRORS['NOT_FOUND']), clusters.delete_cluster.handler(SIMPLE_CLUSTER_REQUEST, bus))
Verify delete_cluster returns properly when the cluster doesn't exist.
625941d5377c676e912723cc
def eval_abs_phase(self, t): <NEW_LINE> <INDENT> if not isinstance(t, (np.ndarray, list)): <NEW_LINE> <INDENT> t = np.array([t]) <NEW_LINE> <DEDENT> entryIndex = self.find_entry(t) <NEW_LINE> phaseInt = () <NEW_LINE> phaseFrac = () <NEW_LINE> for i in range(len(self.polycoTable)): <NEW_LINE> <INDENT> mask = np.where(en...
Polyco evaluate absolute phase for a time array. Parameters --------- t: numpy.ndarray or a single number. An time array in MJD. Time sample should be in order Returns --------- out: PINT Phase class Polyco evaluated absolute phase for t. phase = refPh + DT*60*F0 + COEFF(1) + COEFF(2)*DT + COEFF(3)*DT**2 + ....
625941d50c0af96317bb840c
def _query_metric_definitions(self): <NEW_LINE> <INDENT> tags = dict([i.split("=")[0], i.split("=")[1]] for i in self.args.tags) if self.args.tags else {} <NEW_LINE> definitions = self.client.query_metric_definitions(metric_type=self.metric_type, **tags) <NEW_LINE> for definition in definitions: <NEW_LINE> <INDENT> pri...
Get a list of metric definitions
625941d591f36d47f21ac718
def get_rss(self): <NEW_LINE> <INDENT> url = config.get('runescape.com', 'AdventurersLog') + "?searchName=" + self.params.user <NEW_LINE> return feedparser.parse(url)
Obtain the RSS data for this printer.
625941d5be8e80087fb20e65
def compute_indent(self, document, block): <NEW_LINE> <INDENT> line = Line(document, block) <NEW_LINE> if line.indent is False: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> depth = line.dedenters_start <NEW_LINE> blocks = document.blocks_backward(document.previous_block(block)) <NEW_LINE> align, indent = None, ...
Return the indent the specified block should have. Returns False if the block is not indentable, e.g. when it is part of a multiline string. This method is used to determine the indent of one line, and just looks to previous lines, copying the indent of the line where the current indent depth starts, and/or adding ...
625941d5d53ae8145f87a491
def raw(self, obj, spec, ctx): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> serializer = self.classmap[obj.__class__] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> if isinstance(obj, dict): <NEW_LINE> <INDENT> serializer = serialize_dict <NE...
Raw serialize without parsing the field spec. This method should be used when writing new serializers for performance reasons. When writing a new serializer you will already have a serialization context passed to the serializer function and the field spec will also already be passed as `Fieldspec` instance. Using `raw...
625941d5462c4b4f79d1d8f4
def fizzBuzz(n): <NEW_LINE> <INDENT> list = [] <NEW_LINE> for i in range(1, n + 1): <NEW_LINE> <INDENT> if (i % 3 == 0 and i % 5 == 0): <NEW_LINE> <INDENT> list.append('FizzBuzz') <NEW_LINE> <DEDENT> elif (i % 3 == 0): <NEW_LINE> <INDENT> list.append('Fizz') <NEW_LINE> <DEDENT> elif (i % 5 == 0): <NEW_LINE> <INDENT> li...
:type n: int :rtype: List[str]
625941d58a43f66fc4b54287
def make(self, *args, **kwargs): <NEW_LINE> <INDENT> return _channels_swig.sro_model_sptr_make(self, *args, **kwargs)
make(sro_model_sptr self, double sample_rate_hz, double std_dev_hz, double max_dev_hz, double noise_seed=0) -> sro_model_sptr Sample Rate Offset Model. This block implements a model that varies sample rate offset with respect to time by performing a random walk on the interpolation rate. Constructor Specific Documen...
625941d5c4546d3d9de72c59
def remove_contour2(self, contour=None, name=None): <NEW_LINE> <INDENT> self.contours2.remove(contour, name)
removes a contour with the certain name from the contour list
625941d556ac1b37e62643f1
def _remove_non_serializable_store_entries(store: dict): <NEW_LINE> <INDENT> removed_key_list = [] <NEW_LINE> for key, value in store.items(): <NEW_LINE> <INDENT> if not (_is_serializable(key) and _is_serializable(value)): <NEW_LINE> <INDENT> _logger.info("Remove non-serializable item from the global script store. Key:...
This function is called if there are non-serializable items in the global script storage. This function removes all such items.
625941d5956e5f7376d71090
def refrectententries(self, todo): <NEW_LINE> <INDENT> todo.title = self.title_e.get() <NEW_LINE> todo.description = self.description_e.get() <NEW_LINE> dt = datetime.strptime(self.duedate_e.get()+':00', '%Y/%m/%d %H:%M:%S') <NEW_LINE> todo.duedate = dt <NEW_LINE> if self.finished_v.get() != 0: <NEW_LINE> <INDENT> todo...
フィールドに入力された文字列をToDoItemインスタンスに反映する :param todo:
625941d523e79379d52ee786
def json_serialize(self): <NEW_LINE> <INDENT> return {self.__class__.__name__: {k: v for k, v in self.__dict__.items() if k[:1] != '_'}}
Serialize only non-protected, i.e. non volatile attributes. Designed to be part of json.Encoder.default(self, obj): -> add the following lines ... if isinstance(obj, CallBackFilter): return obj.json_serialize() ...
625941d54e696a04525c9670
def createRandom(nb, prop): <NEW_LINE> <INDENT> toSelect = int(nb * prop) <NEW_LINE> selected=[] <NEW_LINE> noSelected=list(range(nb)) <NEW_LINE> for i in range(toSelect): <NEW_LINE> <INDENT> s = noSelected[random.randrange(len(noSelected))] <NEW_LINE> selected.append(s) <NEW_LINE> noSelected.remove(s) <NEW_LINE> <DEDE...
Cree un selection aleatoire :param nb: nombre total :param prop: proportion train :return:
625941d557b8e32f524836c0
def serialize_numpy(self, buff, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> buff.write(_struct_B.pack(self.noErrors)) <NEW_LINE> <DEDENT> except struct.error as se: self._check_types(se) <NEW_LINE> except TypeError as te: self._check_types(te)
serialize message with numpy array types into buffer :param buff: buffer, ``StringIO`` :param numpy: numpy python module
625941d55fc7496912cc3ba2
def test_truthiness(self): <NEW_LINE> <INDENT> p = peekable([]) <NEW_LINE> self.failIf(p) <NEW_LINE> p = peekable(xrange(3)) <NEW_LINE> self.failUnless(p)
Make sure a ``peekable`` tests true iff there are items remaining in the iterable.
625941d54527f215b584c679
def test_eventsFromJSONLogFile(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fileHandle = StringIO(u'{"x": 1}\n') <NEW_LINE> events = eventsFromJSONLogFile(fileHandle) <NEW_LINE> nextEvent = next(events) <NEW_LINE> self.assertEquals(nextEvent, {u"x": 1}) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> fileHandle...
L{eventsFromJSONLogFile} reads events from a file.
625941d526238365f5f0f095
def setStatus( self, newStatusText='' ): <NEW_LINE> <INDENT> fnPrint( debuggingThisModule, "HTMLWindow.setStatus( {} )".format( repr(newStatusText) ) ) <NEW_LINE> if newStatusText != self._statusTextVar.get(): <NEW_LINE> <INDENT> self._statusTextVar.set( newStatusText ) <NEW_LINE> if self._showStatusBarVar.get(): self....
Set (or clear) the status bar text.
625941d5e76e3b2f99f3aa2d
def __init__(self, id: str = None, es_id: str = None, name: str = None, info: str = None, maintainer: str = None, contact_email: str = None, indexes: List[IndexSchemaDescription] = None): <NEW_LINE> <INDENT> self.swagger_types = { 'id': str, 'es_id': str, 'name': str, 'info': str, 'maintainer': str, 'contact_email': st...
Indexes - a model defined in Swagger :param id: The id of this Indexes. # noqa: E501 :type id: str :param es_id: The id of this ES Indexes. # noqa: E501 :type es_id: str :param name: The name of this Indexes. # noqa: E501 :type name: str :param info: The info of this Indexes. # noqa: E501 :type info: str :param ma...
625941d56aa9bd52df036fc9
def subarraySum(self, nums, k): <NEW_LINE> <INDENT> counter = 0 <NEW_LINE> length = len(nums) <NEW_LINE> array = {} <NEW_LINE> for i in range(len(nums) - 1, -1, -1): <NEW_LINE> <INDENT> for index in range(length - i): <NEW_LINE> <INDENT> sum = array.get(index, 0) <NEW_LINE> array[index] = nums[i] + sum <NEW_LINE> if ar...
:type nums: List[int] :type k: int :rtype: int
625941d5b7558d58953c5136
def statistics(list_of_int): <NEW_LINE> <INDENT> sum_value = list_of_int[0] + list_of_int[1] + list_of_int[2] <NEW_LINE> average = sum_value / 3 <NEW_LINE> if list_of_int[0] < list_of_int[1]: <NEW_LINE> <INDENT> smallest = list_of_int[0] <NEW_LINE> if list_of_int[2] < smallest: <NEW_LINE> <INDENT> smallest = list_of_in...
takes in a list of (exactly) 3 integers returns a list of the following statistics: sum, average value, smallest value, and largest value
625941d5f548e778e58cd7a3
def groupby_tnfa(self, sus_drug): <NEW_LINE> <INDENT> sus_drug[sus_drug["is_tnf"] == 1].groupby("識別番号").max().to_csv( 'target/tnf_druger.csv', encoding='shift-jis' )
TNF-α阻害薬を服用した患者を1人1レコードへ変換
625941d560cbc95b062c6768
def build(self, component_name: str): <NEW_LINE> <INDENT> self.trigger_event('application_build') <NEW_LINE> component: Component = self.get('component', component_name) <NEW_LINE> if 'build' in dir(component): <NEW_LINE> <INDENT> build = component.__getattribute__('build') <NEW_LINE> built = build() <NEW_LINE> if buil...
Build application method. You should provide your primary component name that has build method for start your app. :raise RuntimeError if specified component has no build method.
625941d5507cdc57c6306f03
def gameOfLife(self, board: List[List[int]]) -> None: <NEW_LINE> <INDENT> m, n = len(board), len(board[0]) <NEW_LINE> def count_cell(x,y): <NEW_LINE> <INDENT> points = [(x-1, y-1),(x-1, y),(x-1, y+1), (x, y-1),(x, y+1), (x+1, y-1),(x+1, y),(x+1, y+1)] <NEW_LINE> return sum((board[i][j] & 1) for i,j in points if 0 <= i...
位运算,左移1位,最后一位保存状态信息,进行位或运算
625941d57c178a314d6ef686
def initializeElementQuadrature(self, mesh, t, cq): <NEW_LINE> <INDENT> import copy <NEW_LINE> self.cq = cq <NEW_LINE> self.v_last = self.cq[('velocity', 0)]
Allocated or set additional arrays for values at element quadrature Parameters ---------- mesh : proteus.MeshTools.Mesh The mesh for the domain t : float The current time cq : dict The dictionary of element quadrature arrrays
625941d58a43f66fc4b54288
def start(self) -> None: <NEW_LINE> <INDENT> if self._started: <NEW_LINE> <INDENT> raise exceptions.ExecutionError('Cannot start an already started watcher!') <NEW_LINE> <DEDENT> self._started = True <NEW_LINE> self._tested.execute_once = self.__execute_once <NEW_LINE> for tester in self._testers: <NEW_LINE> <INDENT> t...
Send a *started* event to the statechart properties, and starts watching the execution of the statechart under test.
625941d599fddb7c1c9de5b5
def test_resolve_daterange_case3(self): <NEW_LINE> <INDENT> timeperiod = Timeperiod({}) <NEW_LINE> entry = '2015-07-26 - 2016-08-20 00:00-24:00' <NEW_LINE> timeperiod.resolve_daterange(timeperiod.dateranges, entry) <NEW_LINE> assert 2015 == timeperiod.dateranges[0].syear <NEW_LINE> assert 7 == timeperiod.dateranges[...
Test resolve daterange, case 3 :return: None
625941d52c8b7c6e89b359e5
def flip(in_, out, dim, **kwargs): <NEW_LINE> <INDENT> return wrapper.starcomm("$KAPPA_DIR/flip", "flip", in_, out, dim, **kwargs)
Reverses an NDF's pixels along a specified dimension. Runs the command: $KAPPA_DIR/flip . Arguments --------- `in_` : str,filename Input NDF data structure out : str,filename Output NDF data structure dim : int Dimension to reverse pixels along Keyword Arguments ----------------- axis : bool Flip ...
625941d576e4537e8c351898
def test_categories_sync(self): <NEW_LINE> <INDENT> category = Category.objects.all_categories()[:1][0] <NEW_LINE> threads = [testutils.post_thread(category) for _ in range(10)] <NEW_LINE> for thread in threads: <NEW_LINE> <INDENT> [testutils.reply_thread(thread) for _ in range(5)] <NEW_LINE> <DEDENT> category.threads ...
command synchronizes categories
625941d55166f23b2e1a537d
def group_anagrams(dictionary): <NEW_LINE> <INDENT> anagrams_map = collections.defaultdict(list) <NEW_LINE> for word in dictionary: <NEW_LINE> <INDENT> sorted_word = "".join(sorted(word)) <NEW_LINE> anagrams_map[sorted_word].append(word) <NEW_LINE> <DEDENT> output = [] <NEW_LINE> for key, value in anagrams_map.items():...
Time complexity: O(n* m log m) : n strings * sorting for each string of length m space complexity: O(n)
625941d55f7d997b87174cbe
def solve_constraint_propagate_reduced_domains(problem) : <NEW_LINE> <INDENT> agenda = [problem] <NEW_LINE> solution = None <NEW_LINE> num_extensions = 0 <NEW_LINE> while len(agenda) > 0: <NEW_LINE> <INDENT> prob = agenda.pop(0) <NEW_LINE> num_extensions += 1 <NEW_LINE> if not check_all_constraints(prob) or has_empty_d...
Solves the problem using depth-first search with forward checking and propagation through all reduced domains. Same return type as solve_constraint_dfs.
625941d5bde94217f3683014
def get_backend(user_input_num): <NEW_LINE> <INDENT> server_info = [] <NEW_LINE> with open(CONF,'r') as f1: <NEW_LINE> <INDENT> if user_input_num in f1.read(): <NEW_LINE> <INDENT> with open(CONF,'r') as f: <NEW_LINE> <INDENT> backend_title = 'backend %s' %user_input_num <NEW_LINE> Flag = False <NEW_LINE> for line in f:...
获取用户输入backed :param num: 接受用户传入的backed实际参数 :return: 返回用户输入backend的一个列表值,而后在main函数里循环打印出来
625941d556ac1b37e62643f2
def circle(self, circle): <NEW_LINE> <INDENT> coordX = round(circle.x, 3) <NEW_LINE> coordY = round(circle.y, 3) <NEW_LINE> width = circle.width <NEW_LINE> opacity = circle.color[3] <NEW_LINE> radius = round(circle.radius, 3) <NEW_LINE> the_color = self.svg_color(circle.color) <NEW_LINE> dwg = self.current_dwg <NEW_LIN...
Write a circle in the output file.
625941d523849d37ff7b32b3
def mean_reciprocal_rank(rs): <NEW_LINE> <INDENT> rs = (np.asarray(r).nonzero()[0] for r in rs) <NEW_LINE> return np.mean([1. / (r[0] + 1) if r.size else 0. for r in rs])
Score is reciprocal of the rank of the first relevant item First element is 'rank 1'. Relevance is binary (nonzero is relevant). Example from http://en.wikipedia.org/wiki/Mean_reciprocal_rank # >>> rs = [[0, 0, 1], [0, 1, 0], [1, 0, 0]] # >>> mean_reciprocal_rank(rs) 0.61111111111111105 # >>> rs = np.array([[0, 0, 0],...
625941d5cb5e8a47e48b7ccd
def get_project_id(project_name): <NEW_LINE> <INDENT> logger.debug("--- get_project_id ---") <NEW_LINE> projects_url = create_os_url('/projects') <NEW_LINE> projects_string = do_get(projects_url) <NEW_LINE> if projects_string is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> projects = json.loads(projects_st...
Gets the UUID of the project by project_name :param project_name: Name of the Project :return: string UUID or None
625941d5bf627c535bc133f4
def evaluate(self, trader): <NEW_LINE> <INDENT> for count in range(1, len(self)): <NEW_LINE> <INDENT> self.count = count <NEW_LINE> t_data, i_data = self.trading_data.iloc[count], self.indexes.iloc[count] <NEW_LINE> order_list = trader.trade(t_data, i_data) <NEW_LINE> self.apply_orders_on_portfolio(order_list) <NEW_LIN...
Play the data tape so that the trader can do its job Once finished, you can access the result by get_account, or get_signals
625941d5435de62698dfde72
def get(mode: modes.Mode) -> trie.Trie: <NEW_LINE> <INDENT> return _registry[mode]
Return the keybindings of one specific mode.
625941d5046cf37aa974cf6b
def handleGetLootRequest(self, request): <NEW_LINE> <INDENT> html = flatten(self.renderSignatureLoot(request.args['key'])) <NEW_LINE> return JsonResponse( dict(status='getLoot', metadata=dict( levels=dict( trivial=dict( label='Debris', image='http://image.eveonline.com/Type/33254_64.png', ), easy=dict( label='Rubble', ...
:type request: werkzeug.wrappers.Request
625941d5498bea3a759b9cd4
def canPlaceFlowers(self, flowerbed, n): <NEW_LINE> <INDENT> result = 0 <NEW_LINE> for i, num in enumerate(flowerbed): <NEW_LINE> <INDENT> if num == 0: <NEW_LINE> <INDENT> if (i == 0 or flowerbed[i-1] == 0) and (i == len(flowerbed) - 1 or flowerbed[i+1] == 0): <NEW_LINE> <INDENT> flowerbed[i] = 1 <NEW_LINE> result += 1...
:type flowerbed: List[int] :type n: int :rtype: bool
625941d5b57a9660fec33aab
def test_threeelements_chain(self): <NEW_LINE> <INDENT> root = Node(key=42) <NEW_LINE> left = Node(key=10) <NEW_LINE> right = Node(key=28) <NEW_LINE> root.left = left <NEW_LINE> left.right = right <NEW_LINE> ll = BSTtoLL(root) <NEW_LINE> sort, count = issorted(ll) <NEW_LINE> self.assertTrue(sort) <NEW_LINE> self.assert...
Tests three-element tree where root has one child.
625941d5ac7a0e7691ed42ee
def make_features4(listings): <NEW_LINE> <INDENT> assert listings.index.name == 'id' <NEW_LINE> features3 = make_features3(listings) <NEW_LINE> spellchecker = enchant.Dict("en_US") <NEW_LINE> tokenize = skl.feature_extraction.text.CountVectorizer().build_tokenizer() <NEW_LINE> def count_misspellings(text): <NEW_LINE> <...
Get features for ML from DataFrame May return a view (not copy). This is feature set version 4 (other versions may exist). Includes number of misspellings. Includes Zillow zip code value index
625941d591af0d3eaac9bc3f
def register(method: str, price: int, flags: contracts.CallFlags): <NEW_LINE> <INDENT> def inner_func(func): <NEW_LINE> <INDENT> interop.InteropService.register(method, func, price, flags) <NEW_LINE> return func <NEW_LINE> <DEDENT> return inner_func
Register a SYSCALL handler with the Application engine. Args: method: name of call. price: the price of calling the handler. flags: ExecutionContext rights needed.
625941d5097d151d1a22307d
def get_mongo(self): <NEW_LINE> <INDENT> if self.mongo_db: <NEW_LINE> <INDENT> return self.mongo_db <NEW_LINE> <DEDENT> if len(self.uri_params['nodelist']) > 1 and MongoReplicaSetClient: <NEW_LINE> <INDENT> client = MongoReplicaSetClient(self.uri_params['nodelist'], **self.uri_params['options']) <NEW_LINE> <DEDENT> els...
Return the mongo connection from the environment.
625941d5ec188e330fd5a9c1
def thumbnail(name, x, y, pick): <NEW_LINE> <INDENT> rect = cfg.SnowbroTmb.get_rect() <NEW_LINE> rect.topleft = (x,y) <NEW_LINE> pygame.draw.rect(cfg.gameDisplay, cfg.paleYellow, (x,y,100,100)) <NEW_LINE> pygame.draw.rect(cfg.gameDisplay, cfg.black, (x,y,100,100),1) <NEW_LINE> if name == 'Snowbro': <NEW_LINE> <INDENT> ...
Draws a character thumbnail, for use in the selection screen. name -- of character to be displayed, in string form x -- x-coordinate of top-left of thumbnail y -- y-coordinate of top-left of thumbnail pick -- 1 (primary pick) OR 2 (backup pick)
625941d50a50d4780f6670b9
def _update_last_visited_module_id(self, request, course, module_key, modification_date): <NEW_LINE> <INDENT> field_data_cache = FieldDataCache.cache_for_descriptor_descendents( course.id, request.user, course, depth=2) <NEW_LINE> try: <NEW_LINE> <INDENT> module_descriptor = modulestore().get_item(module_key) <NEW_LINE...
Saves the module id if the found modification_date is less recent than the passed modification date
625941d5187af65679ca5344
def list_issue_shared_files(self, issueIdOrKey): <NEW_LINE> <INDENT> raise NotImplementedError
https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-list-of-linked-shared-files/ :param issueIdOrKey: :return:
625941d5be383301e01b56a9
def connect(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._connection = self._opener.open(LconnectScraper.LCONNECT_URL, timeout=8) <NEW_LINE> return True <NEW_LINE> <DEDENT> except URLError: <NEW_LINE> <INDENT> return False
Attempts to connect to the data source
625941d5925a0f43d254a09d
def get_file_for_date(full_date: datetime) -> Optional[str]: <NEW_LINE> <INDENT> date_iso = helpers.format_datetime_ymd(full_date) <NEW_LINE> save_dir = Path(get_secret("DOWNLOADS_DIR")).resolve() <NEW_LINE> file_name = f"{FILE_NAME_BASE}{date_iso}{FILE_NAME_EXT}" <NEW_LINE> full_path = save_dir / file_name <NEW_LINE> ...
Determine if an archive file for a date exists.
625941d5d18da76e235326fd