code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def _regrid_shape_aspect(self, regrid_shape, target_extent): <NEW_LINE> <INDENT> if not isinstance(regrid_shape, collections.abc.Sequence): <NEW_LINE> <INDENT> target_size = int(regrid_shape) <NEW_LINE> x_range, y_range = np.diff(target_extent)[::2] <NEW_LINE> desired_aspect = x_range / y_range <NEW_LINE> if x_range >=...
Helper for setting regridding shape which is used in several plotting methods.
625941ed4e4d5625662d48f8
def generate_targets(labels): <NEW_LINE> <INDENT> N = len(labels) <NEW_LINE> classes = labels.max() + 1 <NEW_LINE> targets = numpy.zeros((N, classes)) <NEW_LINE> for n in range(N): <NEW_LINE> <INDENT> targets[n, labels[n]] = 1.0 <NEW_LINE> <DEDENT> return targets
1-of-c category encoding (c is the number of categories/classes). **Parameters** :labels: array-like, shape = [N, 1]; class labels (0 to c) **Returns** :targets: array-like, shape = [N, c]; target matrix with 1-of-c encoding
625941eda934411ee3751bbd
def get_next_url(request, redirect_field_name): <NEW_LINE> <INDENT> next_url = request.GET.get(redirect_field_name) <NEW_LINE> if next_url: <NEW_LINE> <INDENT> kwargs = { 'url': next_url, 'require_https': import_from_settings( 'OIDC_REDIRECT_REQUIRE_HTTPS', request.is_secure()) } <NEW_LINE> hosts = list(import_from_set...
Retrieves next url from request Note: This verifies that the url is safe before returning it. If the url is not safe, this returns None. :arg HttpRequest request: the http request :arg str redirect_field_name: the name of the field holding the next url :returns: safe url or None
625941ed1b99ca400220afdb
def kernel(self): <NEW_LINE> <INDENT> res = set() <NEW_LINE> for elem in self._elements: <NEW_LINE> <INDENT> if elem.in_kernel(): <NEW_LINE> <INDENT> res.add(elem) <NEW_LINE> <DEDENT> <DEDENT> self._elements = res
Reduce the item set to the Kernel items
625941ed1d351010ab856043
def getUserData(self): <NEW_LINE> <INDENT> return self._user_data
Usually the matplotlib artist corresponding to this annotation.
625941ed50812a4eaa59c844
def _fake_os_path_abspath(self, name): <NEW_LINE> <INDENT> wbagg_home = '/home/wbagg/' <NEW_LINE> if name[0] not in ('/', '~'): <NEW_LINE> <INDENT> name = wbagg_home + name <NEW_LINE> <DEDENT> while name.endswith('/'): <NEW_LINE> <INDENT> name = name[:-1] <NEW_LINE> <DEDENT> return name or '/'
mock os.path.abspath, always assumes wbagg home dir
625941ed925a0f43d254a3a4
def _qresult_index_commented(self): <NEW_LINE> <INDENT> handle = self._handle <NEW_LINE> handle.seek(0) <NEW_LINE> start_offset = 0 <NEW_LINE> query_mark = None <NEW_LINE> qid_mark = b"# Query: " <NEW_LINE> end_mark = b"# BLAST processed" <NEW_LINE> while True: <NEW_LINE> <INDENT> end_offset = handle.tell() <NEW_LINE> ...
Indexer for commented BLAST tabular files (PRIVATE).
625941ed91f36d47f21aca20
@allure.feature( 'test_module_01' ) <NEW_LINE> @allure.story( 'test_story_01' ) <NEW_LINE> @allure.severity( 'critical' ) <NEW_LINE> def test0022(): <NEW_LINE> <INDENT> print( 'test022执行了' )
测试用例0022
625941ed566aa707497f4a89
def t_ANY_FLOAT(self, token): <NEW_LINE> <INDENT> token.value = float(token.value) <NEW_LINE> return token
-?\d+(\.\d*(e-?\d+)?|e-?\d+)
625941ed097d151d1a22337e
def all(self, columnName, key): <NEW_LINE> <INDENT> (isUnique, col) = self._columns[columnName] <NEW_LINE> if key in col: <NEW_LINE> <INDENT> res = col[key] <NEW_LINE> if isUnique: <NEW_LINE> <INDENT> res = [res] <NEW_LINE> <DEDENT> return res <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return []
Return a list of values with the given *key* in the specified column, in insertion order.
625941ede76e3b2f99f3ad2a
def check_palindrome_permute(chars): <NEW_LINE> <INDENT> chars = chars.replace(" ", "").lower() <NEW_LINE> unmatched_char_allowed = len(chars) % 2 != 0 <NEW_LINE> for char in chars: <NEW_LINE> <INDENT> if chars.count(char) % 2 != 0: <NEW_LINE> <INDENT> if unmatched_char_allowed: <NEW_LINE> <INDENT> unmatched_char_allow...
Checks if a given string or list is a permutation of a palindrome
625941ed50485f2cf553d2c4
@asyncio.coroutine <NEW_LINE> def async_trigger(hass, config, action): <NEW_LINE> <INDENT> number = config.get(CONF_NUMBER) <NEW_LINE> held_more_than = config.get(CONF_HELD_MORE_THAN) <NEW_LINE> held_less_than = config.get(CONF_HELD_LESS_THAN) <NEW_LINE> pressed_time = None <NEW_LINE> cancel_pressed_more_than = None <N...
Listen for events based on configuration.
625941ed8e71fb1e9831dccf
def test_check_parameters_ok(self): <NEW_LINE> <INDENT> parameters = {'dataset_id': 1, 'format': 'idf'} <NEW_LINE> self.assertEqual(models.ConvertJob.check_parameters(parameters), parameters)
Test the checking of correct parameters
625941ed4c3428357757c84d
def get_unknown_mac_unicast(self): <NEW_LINE> <INDENT> return self.unknown_mac_unicast
Gets the unknown mac unicast for this BD :returns: unknown mac unicast of the BridgeDomain
625941edad47b63b2c50a4a7
def get_links_from_feed(browser, amount, num_of_search, logger): <NEW_LINE> <INDENT> feeds_link = 'https://www.instagram.com/' <NEW_LINE> web_address_navigator(browser, feeds_link) <NEW_LINE> for i in range(num_of_search + 1): <NEW_LINE> <INDENT> browser.execute_script( "window.scrollTo(0, document.body.scrollHeight);"...
Fetches random number of links from feed and returns a list of links
625941ed5fc7496912cc3ea6
@world.absorb <NEW_LINE> def css_click(css_selector, index=0, wait_time=30): <NEW_LINE> <INDENT> wait_for_clickable(css_selector, timeout=wait_time) <NEW_LINE> assert_true( world.css_visible(css_selector, index=index), msg="Element {}[{}] is present but not visible".format(css_selector, index) ) <NEW_LINE> result = ret...
Perform a click on a CSS selector, first waiting for the element to be present and clickable. This method will return True if the click worked.
625941edb57a9660fec33db4
def main(argv): <NEW_LINE> <INDENT> assert len(argv) == 1 <NEW_LINE> def normalize_price(features, labels): <NEW_LINE> <INDENT> return features, labels / NORMALISER <NEW_LINE> <DEDENT> dataset = tf.data.TextLineDataset(PATH) <NEW_LINE> train_dataset = (dataset .filter(in_training_set) .cache() .map(parse_csv).map(norma...
Builds, trains, and evaluates the model.
625941ed82261d6c526ab9cf
def is_allowed_to_circulate(plate_number, date_, time_): <NEW_LINE> <INDENT> if plate_number.get_type() is not PlateTypes.PARTICULAR: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> day = date_.strftime('%A') <NEW_LINE> return not (plate_number.get_last_digit() in Days.get(day, []) and is_...
This function determines if a vehicle can move around according to the type of license plate. :param plate_number: The plate number as an PlateNumber object :param date_: The date as a python date object :param time_: The time as a python time object :return: boolean
625941ed23e79379d52eea85
def __init__( self, posix_time, record_position, message_id, level, record_header, read_uid, read_gid, computer_name, sender, facility, message, extra_information, micro_seconds=0): <NEW_LINE> <INDENT> super(AslEvent, self).__init__( posix_time, eventdata.EventTimestamp.CREATION_TIME, micro_seconds=micro_seconds) <NEW_...
Initializes the event object. Args: posix_time: the POSIX time value, which contains the number of seconds since January 1, 1970 00:00:00 UTC. record_position: position where the record start. message_id: Identification value for an ASL message. level: level of criticality. record_header: heade...
625941edfff4ab517eb2f968
def updateCurrentResult(self): <NEW_LINE> <INDENT> if self.currentMatchNumber == -1: <NEW_LINE> <INDENT> self.currentMatchNumber = 0 <NEW_LINE> <DEDENT> originalRowNumber = self.tableWidget.item(self.currentMatchNumber, 0).data(Qt.DisplayRole) <NEW_LINE> currentItem = self.tableWidget.item(self.currentMatchNumber, 1) <...
Update the currently selected result and jump to the shot
625941ed507cdc57c630720f
def testReceiveMessagesWithStatus(self): <NEW_LINE> <INDENT> client_id = test_lib.TEST_CLIENT_ID <NEW_LINE> flow_obj = self.FlowSetup( flow_test_lib.FlowOrderTest.__name__, client_id=client_id) <NEW_LINE> session_id = flow_obj.session_id <NEW_LINE> messages = [ rdf_flows.GrrMessage( request_id=1, response_id=i, session...
Receiving a sequence of messages with a status.
625941edfb3f5b602dac3bc1
def usage(self, console, line): <NEW_LINE> <INDENT> if not line: <NEW_LINE> <INDENT> line = "usage" <NEW_LINE> <DEDENT> line = line.lower() <NEW_LINE> if line == "usage": <NEW_LINE> <INDENT> console.msg("Usage: usage <command>") <NEW_LINE> <DEDENT> elif line in self._commands.keys(): <NEW_LINE> <INDENT> usage = "Usage:...
Usage Handler Retrieve just the usage string for a command. :param console: The console requesting help. :param line: The help line to parse. :return: True if succeeded, False if failed.
625941ed462c4b4f79d1dbf7
def getPosy(self): <NEW_LINE> <INDENT> return self.y
RETURNS the y position of the bolt object.
625941edab23a570cc2506af
def to_camel(string: str) -> str: <NEW_LINE> <INDENT> return "".join( word.capitalize() if i else word for i, word in enumerate(string.split("_")) )
Camel-case a given string e.g. camel_case -> camelCase
625941edc432627299f05172
def mdv(srs, window=5, nstep=48): <NEW_LINE> <INDENT> srs_filled = srs <NEW_LINE> for i in np.arange(0, len(srs)): <NEW_LINE> <INDENT> if (srs[i] < -5000): <NEW_LINE> <INDENT> if (i < window*48): <NEW_LINE> <INDENT> subarr = srs[i:(i+window*nstep)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if (i > (len(srs)-window*...
Mean diurnal variation method for filling data gaps in ISAM model Input: srs --- time series, missing values are represented by -9999 or -6999 window --- Size of the moving window for MDV method, unit in day nstep --- Timesteps per day Output: srs_filled --- gap-filled time series
625941ed10dbd63aa1bd30ca
def image_cb(self, msg): <NEW_LINE> <INDENT> self.has_image = True <NEW_LINE> self.camera_image = msg
Identifies red lights in the incoming camera image and publishes the index of the waypoint closest to the red light to /traffic_waypoint Args: msg (Image): image from car-mounted camera
625941ed8da39b475bd654a3
def appendFile(self, data, fileName, sheet = ''): <NEW_LINE> <INDENT> if fileName == "": <NEW_LINE> <INDENT> print('file error') <NEW_LINE> return False <NEW_LINE> <DEDENT> if os.path.exists(fileName): <NEW_LINE> <INDENT> self.loadFile(fileName) <NEW_LINE> if sheet == '': <NEW_LINE> <INDENT> sheet = self.sheets[0] <NEW...
append data to an excel file.
625941edf8510a7c17cf9c29
def on_session_start(self, session, logger): <NEW_LINE> <INDENT> cli_service = CliServiceImpl(session, self.enable_mode, logger) <NEW_LINE> cli_service.send_command( "enable-admin", action_map={ r"Password": lambda session, logger: session.send_line( self.enable_password, logger ) }, ) <NEW_LINE> cli_service.send_comma...
Send default commands to configure/clear session outputs.
625941ed26238365f5f0f39e
def execute(self, cid, cmd, stdout=False, stderr=False, stream=False, detach=False): <NEW_LINE> <INDENT> r = self.client.exec_create(cid, cmd, stdout=stdout, stderr=stderr) <NEW_LINE> return self.client.exec_start(r['Id'], stream=stream, detach=detach)
Execute a command on a container. Returns the output of the command. This mimics the old docker.execute() API, which was removed in docker-py 1.3.0.
625941edb7558d58953c5431
def translate(piece, M): <NEW_LINE> <INDENT> (x1, x2, y1, y2) = piece <NEW_LINE> poslist = [] <NEW_LINE> m = x2 - x1 + 1 <NEW_LINE> for j in range(y1, y2 + 1): <NEW_LINE> <INDENT> poslist.extend(range(x1 + M * j, x2 + 1 + M * j)) <NEW_LINE> <DEDENT> return tuple(poslist)
Translate the position of a tile in a pattern from the form of (x1, x2, y1, y2) into (.., i+m*j, ..)
625941ed24f1403a9260108a
def __init__(self, model_dir=None, weight_column_name=None, linear_feature_columns=None, linear_optimizer=None, dnn_feature_columns=None, dnn_optimizer=None, dnn_hidden_units=None, dnn_activation_fn=nn.relu, dnn_dropout=None, gradient_clip_norm=None, enable_centered_bias=None, target_dimension=1, config=None): <NEW_LIN...
Initializes a DNNLinearCombinedRegressor instance. Args: model_dir: Directory to save model parameters, graph and etc. This can also be used to load checkpoints from the directory into a estimator to continue training a previously saved model. weight_column_name: A string defining feature column name repre...
625941ed1f037a2d8b946725
def create(self, name): <NEW_LINE> <INDENT> bucket_info = self._api.buckets_insert(name) <NEW_LINE> return Bucket(self._api, name, bucket_info)
Creates a new bucket. Args: name: a unique name for the new bucket. Returns: The newly created bucket. Raises: Exception if there was an error creating the bucket.
625941ed7c178a314d6ef990
@pytest.mark.parametrize("serializer", [ datacite_v31, datacite_v41, ]) <NEW_LINE> def test_rights(db, minimal_record_model, recid_pid, serializer): <NEW_LINE> <INDENT> minimal_record_model.update({ 'license': { 'identifier': 'cc-by-sa', 'title': 'Creative Commons Attribution Share-Alike', 'source': 'opendefinition.org...
Test language.
625941edf548e778e58cdaa8
def find_xshape(self): <NEW_LINE> <INDENT> line = self.file.readline() <NEW_LINE> self.xshape = line.count(self.delim) + 1 <NEW_LINE> self.file.seek(0)
xshape is the number of elements in the first line of the csv file We will use it to check that the size is consistent throughout the file. yshape is simply the number of lines.
625941ed3346ee7daa2b3299
def ex_find_node(self, node_name, vdcs=None): <NEW_LINE> <INDENT> if not vdcs: <NEW_LINE> <INDENT> vdcs = self.vdcs <NEW_LINE> <DEDENT> if not getattr(vdcs, '__iter__', False): <NEW_LINE> <INDENT> vdcs = [vdcs] <NEW_LINE> <DEDENT> for vdc in vdcs: <NEW_LINE> <INDENT> res = self.connection.request(vdc.id) <NEW_LINE> ent...
Searches for node across specified vDCs. This is more effective than querying all nodes to get a single instance. @param node_name: The name of the node to search for @type node_name: C{string} @param vdcs: None, vDC or a list of vDCs to search in. If None all vDCs will be searched. @type node_name: L{Vdc} @return: ...
625941edcc40096d61595e77
def withdraw(self): <NEW_LINE> <INDENT> if self.balance > 2: <NEW_LINE> <INDENT> tmp = self.balance * 0.02 <NEW_LINE> self.balance -= self.balance*0.02 <NEW_LINE> return tmp <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 0
Withdraws 2% of the current balance from our account
625941ed76e4537e8c351b9f
def test01(self): <NEW_LINE> <INDENT> a, b = np.arange(self.N), np.arange(1, self.N+1) <NEW_LINE> c, d = ca.carray(a), ca.carray(b) <NEW_LINE> cr = ca.eval("c * d") <NEW_LINE> nr = a * b <NEW_LINE> assert_array_equal(cr[:], nr, "eval does not work correctly")
Testing eval() with only carrays
625941ed090684286d50f217
def get_chain_len(n, factorials=factorials, cache=cache): <NEW_LINE> <INDENT> if n in cache: <NEW_LINE> <INDENT> return cache[n] <NEW_LINE> <DEDENT> chain = [n] <NEW_LINE> while True: <NEW_LINE> <INDENT> fsum = 0 <NEW_LINE> while n: <NEW_LINE> <INDENT> fsum += factorials[n % 10] <NEW_LINE> n //= 10 <NEW_LINE> <DEDENT> ...
Return chain length for a given number
625941ed7d43ff24873a31cd
def parse(self, window, text='', check_restrictions=True): <NEW_LINE> <INDENT> if not text: <NEW_LINE> <INDENT> text = self.get_command() <NEW_LINE> <DEDENT> if not text.strip(): <NEW_LINE> <INDENT> raise OpenWithException(_('Command line is empty.')) <NEW_LINE> <DEDENT> args = self._commandline_to_arguments(text, wind...
Parses the command string and replaces special characters with their respective variable contents. Returns a list of arguments. If check_restrictions is False, no checking will be done if one of the variables isn't valid in the current file context.
625941ed45492302aab5e7f1
def valid_concept_name(text): <NEW_LINE> <INDENT> return bool(standardize_text(text))
Returns whether this text can be reasonably represented in a concept URI. This helps to protect against making useless concepts out of empty strings or punctuation. >>> valid_concept_name('word') True >>> valid_concept_name('the') True >>> valid_concept_name(',,') False >>> valid_concept_name(',') False >>> valid_conc...
625941edb830903b967e9e2e
def serialize(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, TopLevelElement): <NEW_LINE> <INDENT> value = obj.value <NEW_LINE> type_ = obj.type_ <NEW_LINE> name = obj.name <NEW_LINE> if not value: <NEW_LINE> <INDENT> msg = "TopLevelElement has not been assigned a value" <NEW_LINE> raise ValueError(msg) <NEW_LINE> ...
Serialize an object to an etree. obj must be either a TopLevelElement or an instance of a ComplexType subclass.
625941ed44b2445a339325bb
def test_lazy_update(): <NEW_LINE> <INDENT> show_client = ShowClient(_BASE_URL) <NEW_LINE> show_client.update = Mock() <NEW_LINE> show_client.get_show_info = Mock() <NEW_LINE> show_client.lazy_update() <NEW_LINE> show_client.update.assert_called_once()
Test :class:`ShowClient`'s :meth:`lazy_update` method.
625941ed56b00c62f0f14b85
def addParsers(self, subparsers): <NEW_LINE> <INDENT> helpMessage = "Generate Dockerfile and .dockerignore and build the docker image" <NEW_LINE> primeParser = subparsers.add_parser("prime", help=helpMessage) <NEW_LINE> primeParser.add_argument("-o", "--output", help="Output file name for the image file") <NEW_LINE> re...
SkeleParser Hook Adds a parser for the prime command that primes the docker image for deployment or subsequent job execution
625941ed004d5f362079a858
@login_required <NEW_LINE> def account_skillplan_add(request): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> form = UploadSkillPlanForm(request.POST, request.FILES) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> _handle_skillplan_upload(request) <NEW_LINE> return redirect('%s#skillplans' % (r...
Add a skillplan
625941edad47b63b2c50a4a8
def testSharing(self): <NEW_LINE> <INDENT> net = snt.nets.AlexNetMini() <NEW_LINE> inputs1 = tf.placeholder(tf.float32, shape=[None, 64, 64, 3]) <NEW_LINE> inputs2 = tf.placeholder(tf.float32, shape=[None, 64, 64, 3]) <NEW_LINE> keep_prob1 = tf.placeholder(tf.float32) <NEW_LINE> keep_prob2 = tf.placeholder(tf.float32) ...
Check that the correct number of variables are made when sharing.
625941ed21bff66bcd684e76
def bloomberg_article(raw_html): <NEW_LINE> <INDENT> article_params = {'source': 'bloomberg.com', 'author': '', 'date': '', 'text': '', 'title': '', 'image': '', } <NEW_LINE> for obj in raw_html.xpath("//address[@class='lede-text-only__byline']"): <NEW_LINE> <INDENT> obj_text = obj.text_content() <NEW_LINE> if obj_text...
Extract the article parameters from Bloomberg articles. Article parameters: source, author, date, text, title, image :param raw_html: String of the raw html :return: Dictionary of the article parameters
625941ed377c676e912726cf
def pretty_print_string_table(string_table): <NEW_LINE> <INDENT> df = pd.DataFrame(string_table[1:],columns = string_table[0]) <NEW_LINE> pretty_string = df.to_string(index=False) <NEW_LINE> return pretty_string
Pretty-prints a table of strings string_table : list of list of str
625941ed2c8b7c6e89b35ce5
def get_filesystem(path, filesystems=None): <NEW_LINE> <INDENT> path = os.path.abspath(path) <NEW_LINE> if filesystems is None: <NEW_LINE> <INDENT> filesystems = get_filesystems() <NEW_LINE> <DEDENT> filesystems_match = [] <NEW_LINE> for filesystem in filesystems: <NEW_LINE> <INDENT> if path.startswith(filesystem['moun...
Get the filesystem of a given path.
625941ed925a0f43d254a3a5
def read_settings(self) -> Tuple[Path, Path, Path, Path, str]: <NEW_LINE> <INDENT> base_dir: Path <NEW_LINE> vv_base_dir: Path <NEW_LINE> statifiles_dir: Path <NEW_LINE> templates_dir: Path <NEW_LINE> if not hasattr(settings, "BASE_DIR"): <NEW_LINE> <INDENT> raise ValueError("Missing BASE_DIR setting") <NEW_LINE> <DEDE...
Check if the required settings are there and get them as Path :raises ValueError: if some required setting is not found :return: a tuple with base_dir, staticfiles_dir, templates_dir paths and a static url string :rtype: Tuple[Path, Path, Path, str]
625941edd6c5a10208144578
def _get_best_three_of_a_kind(hand_values, board_values): <NEW_LINE> <INDENT> best_three_of_a_kind = tuple() <NEW_LINE> for board_value, board_ct in board_values.items(): <NEW_LINE> <INDENT> if board_ct >= 3: <NEW_LINE> <INDENT> if len(set(hand_values).difference({board_value})) >= 2: <NEW_LINE> <INDENT> k_1 = _get_hig...
:param hand_values: (LightDefaultDict({int: int})) :param board_values: (LightDefaultDict({int: int})) :return: (int, int, int) trips value, best kicker, 2nd best kicker
625941ed8e71fb1e9831dcd0
def buoyant(self,radius=1,density=1): <NEW_LINE> <INDENT> return ((-self.gravitationalAcceleration)*((pi)*(4/3)*(radius**3))*(density))*(self.includeBuoyant)
The buoyant force (for sphere) (SI units) F = particle.volume * fluid.density * gravitationalAcceleration where particle.volume = 4/3*pi*radius**3 Args: radius : radius of the particle (default to 1)
625941ed50812a4eaa59c845
def get(self, request, identity_uuid): <NEW_LINE> <INDENT> identity = get_identity(request.user, identity_uuid) <NEW_LINE> if not identity: <NEW_LINE> <INDENT> return failure_response( status.HTTP_404_NOT_FOUND, "The requested Identity ID %s was not found on an active provider" % identity_uuid) <NEW_LINE> <DEDENT> seri...
Authentication Required, all identities available to the user
625941ed23e79379d52eea86
def _install_packages(self, guestaddr, packstr): <NEW_LINE> <INDENT> raise oz.OzException.OzException("Customization is not implemented for guest %s" % (self.tdl.distro))
Internal method to install packages; expected to be overriden by child classes.
625941ed6aa9bd52df0372d0
def test_add_residues(self): <NEW_LINE> <INDENT> sets = self.sets <NEW_LINE> k = 'myfirst set' <NEW_LINE> resSet = self.mol.chains.residues <NEW_LINE> sets.add(k, resSet) <NEW_LINE> self.assertEquals(len(sets.keys()), 1) <NEW_LINE> self.assertEquals(sets.keys()[0], k) <NEW_LINE> self.assertEquals(sets.values()[0], resS...
test adding a ResidueSet
625941ed8a349b6b435e869c
def consulta(self): <NEW_LINE> <INDENT> if self.tamanho > 0: <NEW_LINE> <INDENT> return self.topo.dado <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "A pilha está vazia"
retorna o inicio sem remover
625941eda934411ee3751bbe
def test_missing_folder_raises_error(self): <NEW_LINE> <INDENT> with self.assertRaises(ResourceNotFoundError): <NEW_LINE> <INDENT> self.client.get_resource_by_uri('mf:///a/b/c/hi.txt')
Test that folder is reported missing if it is
625941ed187af65679ca5649
def getCreationDate(self): <NEW_LINE> <INDENT> datetimeString = None <NEW_LINE> xml = self.properties.get(Constants.PROP_CREATION_DATE) <NEW_LINE> if xml: <NEW_LINE> <INDENT> datetimeString = xml.textof() <NEW_LINE> <DEDENT> if datetimeString: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return _parseIso8601String(date...
Return the creation date as time tuple or C{None}. @rtype: C{time.struct_time}
625941edeab8aa0e5d26e083
def caculate_prob(self): <NEW_LINE> <INDENT> t_H = self.tree.depth() <NEW_LINE> t_h = 1 <NEW_LINE> while(t_h <= t_H): <NEW_LINE> <INDENT> t_hnodes = self.get_h(t_h) <NEW_LINE> t_sum = 0 <NEW_LINE> t_hpro = [] <NEW_LINE> t_cpro = [] <NEW_LINE> for t_n in t_hnodes: <NEW_LINE> <INDENT> t_sum = self.tree.get_node(t_n).data...
caculate prob of each node :return:
625941edadb09d7d5db6ccb5
def _recursive_structure(data, path=""): <NEW_LINE> <INDENT> for key, items in data.items(): <NEW_LINE> <INDENT> if not items: <NEW_LINE> <INDENT> yield os.path.join(path, key) <NEW_LINE> <DEDENT> elif isinstance(items, dict): <NEW_LINE> <INDENT> for p in _recursive_structure(items, os.path.join(path, key)): <NEW_LINE>...
Args: data(dict): Data from structure.yaml Keyword Args: path(str): Joined path Yields: (generator) String of the full folder path
625941eda17c0f6771cbe578
def new_powerset(xs: List[Any]) -> List[Any]: <NEW_LINE> <INDENT> return PowerSet.apply(xs)
Factory method :param xs: List :return: List of Lists
625941edfb3f5b602dac3bc2
@users.route('/user/<string:username>') <NEW_LINE> def user_posts(username): <NEW_LINE> <INDENT> page = request.args.get('page', 1, type=int) <NEW_LINE> user = User.query.filter_by(username=username).first_or_404() <NEW_LINE> posts = Post.query .filter_by(author=user) .order_by(Post.date_posted.desc()) ...
Home page of the app.
625941edff9c53063f47c71a
def add_gene(self, gene: Gene) -> None: <NEW_LINE> <INDENT> self.genes.append(gene) <NEW_LINE> self.gene_num += 1
Add a new Gene to the existing list of Genes.
625941ed5510c4643540f900
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.fiducials is None: <NEW_LINE> <INDENT> self.fiducials = fiducial_msgs.msg.FiducialMapEntryArray() <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> sel...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941ed63d6d428bbe44a1a
def get_multilevel_method_sig_frame(cpp_header, class_name, *args, **kwargs): <NEW_LINE> <INDENT> if isinstance(cpp_header, six.string_types): <NEW_LINE> <INDENT> cpp_header = [cpp_header] <NEW_LINE> <DEDENT> if isinstance(class_name, six.string_types): <NEW_LINE> <INDENT> class_name = [class_name] <NEW_LINE> <DEDENT> ...
Given one or more C++ header paths, each with a corresponding C++ class name, return a `pandas.DataFrame` with one row per method argument. Notes ----- - Each row in the frame has a `class_name` (including namespace) and `method_name`, indicating the specific method that corresponds to the row argument. - Te...
625941edde87d2750b8602c2
@marc21_authority.over( 'established_heading_linking_entry_topical_term', '^750.[_10325476]') <NEW_LINE> @utils.for_each_value <NEW_LINE> @utils.filter_values <NEW_LINE> def established_heading_linking_entry_topical_term(self, key, value): <NEW_LINE> <INDENT> indicator_map2 = { "0": "Library of Congress Subject Heading...
Established Heading Linking Entry-Topical Term.
625941ed099cdd3c635f1182
def get_info(data: List[str]) -> List[Move]: <NEW_LINE> <INDENT> all_instructions = [] <NEW_LINE> for x in data: <NEW_LINE> <INDENT> instruction = x[0] <NEW_LINE> amount = x[1:] <NEW_LINE> move = Move(instruction, int(amount)) <NEW_LINE> all_instructions.append(move) <NEW_LINE> <DEDENT> return all_instructions
Convert list of strings to list of Move(s) (=NamedTuple)
625941ede64d504609d74d69
def main(options): <NEW_LINE> <INDENT> addrs = get_addrs(options.hostname) <NEW_LINE> record = get_record(options) <NEW_LINE> record_list = record.split(':') <NEW_LINE> versions = { 'main': record_list[1], 'daily': record_list[2], 'safebrowsing': record_list[6], 'bytecode': record_list[7] } <NEW_LINE> for signature_typ...
The main functions
625941ed8a43f66fc4b54589
def get_monte_carlo_factors(n_cases, symp_covid_pos, asymp_covid_pos): <NEW_LINE> <INDENT> n_monte_carlo_samples = n_cases <NEW_LINE> n_r_monte_carlo_samples = n_cases * (symp_covid_pos + asymp_covid_pos) <NEW_LINE> monte_carlo_factor = 1.0 / np.sqrt(n_monte_carlo_samples) <NEW_LINE> r_monte_carlo_factor = 1.0 / np.sqr...
Get Monte Carlo scale factors :param n_cases: Number of cases :param symp_covid_pos: Probability of case being symptomatic COVID positive :param asymp_covid_pos: Probability of case being asymptomatic COVID positive :returns: TODO
625941ed30c21e258bdfa9cd
def RPR_GetNumTracks(): <NEW_LINE> <INDENT> a=_ft['GetNumTracks'] <NEW_LINE> f=CFUNCTYPE(c_int)(a) <NEW_LINE> r=f() <NEW_LINE> return r
Python: Int RPR_GetNumTracks()
625941ed63b5f9789fde7610
def handle_command_line(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=__doc__) <NEW_LINE> parser.add_argument('--pgdbf', '-p', help='Path to the pgdbf executable') <NEW_LINE> parser.add_argument('--verbose', '-v', action='count', default=0, help='Increase debugging verbosity') <NEW_LINE> parser.ad...
Evaluate the command line arguments and run tests
625941ed2c8b7c6e89b35ce6
@autojit(warnstyle='simple') <NEW_LINE> def test_simple_circular2(): <NEW_LINE> <INDENT> y = 2.0 <NEW_LINE> for i in range(10): <NEW_LINE> <INDENT> if i > 5: <NEW_LINE> <INDENT> x = y <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> y = x
>>> test_simple_circular2() Warning 44:16: local variable 'x' might be referenced before assignment
625941ed8da39b475bd654a4
def create(self, to=None, from_=None, body=None): <NEW_LINE> <INDENT> response = self.client.messages.create( to, from_ if from_ else API_SETTINGS['from_'], body ) <NEW_LINE> return response
Primary send sms method.
625941ed236d856c2ad44d0b
def test_triple_no_match_3bound(self, store): <NEW_LINE> <INDENT> with store.txn_ctx(True): <NEW_LINE> <INDENT> res1 = set(store.triples(( URIRef('urn:test:s2'), URIRef('urn:test:p3'), URIRef('urn:test:o2')))) <NEW_LINE> assert len(res1) == 0
Test empty matches with 3 bound terms.
625941edf7d966606f6aa534
def get_deprecate_message(self): <NEW_LINE> <INDENT> deprecate_message = { 'deprecate_job': { 'cloud': self.cloud, 'account': self.cloud_account, 'bucket': self.bucket, 'region': self.region } } <NEW_LINE> deprecate_message['deprecate_job'].update(self.base_message) <NEW_LINE> if self.old_cloud_image_name: <NEW_LINE> <...
Build deprecate job message.
625941edaad79263cf390f73
def toPdb(system, outfile="test.pdb", element=0): <NEW_LINE> <INDENT> o = open(outfile, 'w') <NEW_LINE> o.write("REMARK Generated by simpy\n") <NEW_LINE> if system.pbc: <NEW_LINE> <INDENT> o.write("CRYST1") <NEW_LINE> o.write("".join(["%9.3f"%i for i in system.pbc[:3]])) <NEW_LINE> o.write("".join(["%7.2f"%i for i in s...
output to pdb file format
625941ed0fa83653e46574e1
@app.route('/', methods=['GET', 'POST']) <NEW_LINE> def home(): <NEW_LINE> <INDENT> errors = [] <NEW_LINE> note = {} <NEW_LINE> if request.method == 'POST': <NEW_LINE> <INDENT> title = request.form['title'] <NEW_LINE> text = request.form['text'] <NEW_LINE> try: <NEW_LINE> <INDENT> note = Notes(title, text) <NEW_LINE> d...
Render homepage
625941edd7e4931a7ee9e449
def __add__(self, other): <NEW_LINE> <INDENT> dataset = self.copy() <NEW_LINE> dataset += other <NEW_LINE> return dataset
Copy this dataset and add the other dataset to it.
625941ed32920d7e50b286fe
def get_velvet_params(output): <NEW_LINE> <INDENT> output = output.split("\n") <NEW_LINE> mydict = dict() <NEW_LINE> kmer = 31 <NEW_LINE> for line in output: <NEW_LINE> <INDENT> if "n50" in line: <NEW_LINE> <INDENT> lista = dict() <NEW_LINE> nodes = re.search("(\d+)\snodes", line) <NEW_LINE> nodes = nodes.groups()[0] <...
\* *Internal function* \*
625941ed07f4c71912b119af
def prepare_dataset(sentences, char_to_id, tag_to_id, lower=False, train=True): <NEW_LINE> <INDENT> none_index = tag_to_id["O"] <NEW_LINE> def f(x): <NEW_LINE> <INDENT> return x.lower() if lower else x <NEW_LINE> <DEDENT> data = [] <NEW_LINE> i = 0 <NEW_LINE> print(len(sentences)) <NEW_LINE> for s in sentences: <NEW_LI...
Prepare the dataset. Return a list of lists of dictionaries containing: - word indexes - word char indexes - tag indexes
625941ed92d797404e3046b6
def become_fed(self): <NEW_LINE> <INDENT> self._is_fed = True
Saves the fact Hippo is fed now.
625941ed76d4e153a657f05d
def find_permutation_with_minimum_value(self, two_term_approximation, solution): <NEW_LINE> <INDENT> minimum_value = np.inf <NEW_LINE> minimum_index = len(two_term_approximation.list_of_permutations) <NEW_LINE> for i in range(len(two_term_approximation.list_of_permutations)): <NEW_LINE> <INDENT> temp_value = self. ...
... to be able to find the least conservative two term approximation.
625941edcc0a2c11143dd3bb
def _log_idl(self, idl_cmd, stdout, stderr): <NEW_LINE> <INDENT> self.log.debug('output of IDL command: {}'.format(idl_cmd)) <NEW_LINE> self.log.debug('STDOUT----\n{}'.format(stdout)) <NEW_LINE> self.log.debug('STDERR----\n{}'.format(stderr))
log info regarding external idl calls
625941ed046cf37aa974d26c
def setFamilyFieldArr(self, *args): <NEW_LINE> <INDENT> return _ParaMEDMEM.MEDFileMesh_setFamilyFieldArr(self, *args)
setFamilyFieldArr(self, int meshDimRelToMaxExt, DataArrayInt famArr) 1
625941ed4f88993c3716c58b
def _get_installing_progress(client, cluster_hosts): <NEW_LINE> <INDENT> timeout = time.time() + 60 * float(flags.OPTIONS.deployment_timeout) <NEW_LINE> clusters_progress = {} <NEW_LINE> hosts_progress = {} <NEW_LINE> install_finished = False <NEW_LINE> failed_hosts = {} <NEW_LINE> failed_clusters = {} <NEW_LINE> while...
get intalling progress.
625941eddd821e528d63b6ce
def to_adverb(self): <NEW_LINE> <INDENT> if 'AdverbPhrase' in self.variants: <NEW_LINE> <INDENT> return self.variants['AdverbPhrase'] <NEW_LINE> <DEDENT> return self.copy_with(typ="AdverbPhrase", text=self.text + " to")
Convert to adverb phrase.
625941ed4c3428357757c84e
@api.route('/friend-links') <NEW_LINE> def get_links(): <NEW_LINE> <INDENT> links = FriendLink.query.all() <NEW_LINE> return jsonify({'links': [link.to_json() for link in links]})
获得友情链接
625941ed50812a4eaa59c846
def read(self): <NEW_LINE> <INDENT> return (self._parent.read() >> self._start) & self._mask
Reads the value of all the wires in the slice If there is more than one wire in the slice then the least significant bit of the return value corresponds to the wire with the lowest index.
625941ed67a9b606de4a83e1
def _obj_register_members(cls, newcls): <NEW_LINE> <INDENT> for name, descriptor in newcls._members: <NEW_LINE> <INDENT> descriptor.set_obj(cls) <NEW_LINE> descriptor.build_val() <NEW_LINE> setattr(newcls, name, descriptor)
_register_members method of new object classes
625941ed6e29344779a62b3a
def next_power_of_two(self, value): <NEW_LINE> <INDENT> return 2**(1+int(log(value)/log(2)))
Return the next power of 2 above value
625941ed0383005118ecfb0a
def molal_to_weight_percent(self, molality, temperature=None): <NEW_LINE> <INDENT> b = molality <NEW_LINE> Mw = self.solute_molar_mass / 1000 <NEW_LINE> w = (1 + 1 / (b * Mw))**-1 <NEW_LINE> return w
Molal concentration to weight percent. Returns weight percent of the solution for a given molality (mol solute / kg solvent). The temperature is not required, but is included as an allowed argument to allow the argument to be passed to (and ignored by) the function).
625941ed097d151d1a223380
@rubberjack.command() <NEW_LINE> @click.option('--to-environment', default=None) <NEW_LINE> @click.pass_context <NEW_LINE> def promote(ctx, to_environment): <NEW_LINE> <INDENT> beanstalk = ctx.obj['beanstalk'] <NEW_LINE> APPLICATION = ctx.obj['application'] <NEW_LINE> APPLICATION_NAME = ctx.obj['application_name'] <NEW...
Do the actual deployment work. (See the module-level docstring for more details and caveats)
625941ed1d351010ab856045
def show_frame(self, frm): <NEW_LINE> <INDENT> frame = self.frames[frm] <NEW_LINE> frame.tkraise()
Raise page
625941ed596a897236089fe3
def common_dtype(cols): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return metadata.common_dtype(cols) <NEW_LINE> <DEDENT> except metadata.MergeConflictError as err: <NEW_LINE> <INDENT> tme = TableMergeError('Columns have incompatible types {}' .format(err._incompat_types)) <NEW_LINE> tme._incompat_types = err._incomp...
Use numpy to find the common dtype for a list of columns. Only allow columns within the following fundamental numpy data types: np.bool_, np.object_, np.number, np.character, np.void
625941ed5fc7496912cc3ea7
def add_tenant(self, owner, desc, tenant_name, bssid_type, tenant_id=None): <NEW_LINE> <INDENT> if tenant_id in self.tenants: <NEW_LINE> <INDENT> raise ValueError("Tenant %s exists", tenant_id) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> session = Session() <NEW_LINE> if tenant_id: <NEW_LINE> <INDENT> request = TblTen...
Create new Tenant.
625941ed236d856c2ad44d0c
def getLabels(self): <NEW_LINE> <INDENT> return []
:rtype: list of str
625941ed0383005118ecfb0b
@pytest.fixture() <NEW_LINE> def async_client(): <NEW_LINE> <INDENT> skip_if_no_django() <NEW_LINE> from django.test.client import AsyncClient <NEW_LINE> return AsyncClient()
A Django test async client instance.
625941ed851cf427c661aa34
def reverse_link_list(self): <NEW_LINE> <INDENT> current_node = self.head <NEW_LINE> prev_node = None <NEW_LINE> while(current_node is not None): <NEW_LINE> <INDENT> next = current_node.next <NEW_LINE> current_node.next = prev_node <NEW_LINE> prev_node = current_node <NEW_LINE> current_node = next <NEW_LINE> <DEDENT> s...
O(n) space
625941edf8510a7c17cf9c2a
def uniquePaths(self, m, n): <NEW_LINE> <INDENT> if m <= 0 or n <= 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> dp = [[1 for x in range(m)] for x in range(n)] <NEW_LINE> for i in range(1, n): <NEW_LINE> <INDENT> for j in range(1, m): <NEW_LINE> <INDENT> dp[i][j] = dp[i-1][j] + dp[i][j-1] <NEW_LINE> <DEDENT> <DED...
:type m: int :type n: int :rtype: int
625941ed5fdd1c0f98dc075f
def new_item_file(self, file_path): <NEW_LINE> <INDENT> index = self.rowCount() <NEW_LINE> self.insertRow(index) <NEW_LINE> export_file = self._get_output_path( file_path=file_path, extension='mp4') <NEW_LINE> input_item = TableWidgetItem(parent=self, text=file_path) <NEW_LINE> self.setItem(index, 0, input_item) <NEW_L...
This method add a new row in the table. :param file_path: The path of the file to convert :type file_path: str
625941edd4950a0f3b08c871
def __nonzero__(self): <NEW_LINE> <INDENT> raise TypeError( 'Variables cannot be evaluated as Python bool.')
This operator is not supported in Variables.
625941ed10dbd63aa1bd30cc