code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def run(self, host='0.0.0.0', port=None, debug=None): <NEW_LINE> <INDENT> self.app.run(host=host, port=port, debug=debug)
runs the development flask server :param host: default hostname :param port: the port of the webserver :param debug: run with debug output
625941cf24f1403a92600ca4
def export(parser): <NEW_LINE> <INDENT> build = Build() <NEW_LINE> build.configure(parser) <NEW_LINE> return build
To export this sub process to pagrant :param conf: :param parser: :return:
625941cf6fece00bbac2d87e
def update_forces(self): <NEW_LINE> <INDENT> for atom in self.atoms: <NEW_LINE> <INDENT> energy, fx, fy = self.potential(atom.x, atom.y) <NEW_LINE> atom.fx = fx <NEW_LINE> atom.fy = fy
Update forces on atoms
625941cf9c8ee82313fbb8b5
def spider_opened(self, spider): <NEW_LINE> <INDENT> if self.is_enabled(spider): <NEW_LINE> <INDENT> self.load_agents(spider)
When the spider is opened check if the middleware is enabled and load the agents
625941cf796e427e537b0705
def underlying_likelihood(self, binary_outcomes, modelparams, expparams): <NEW_LINE> <INDENT> original_mps = modelparams[..., self._orig_mps_slice] <NEW_LINE> return self.underlying_model.likelihood(binary_outcomes, original_mps, expparams)
Given outcomes hypothesized for the underlying model, returns the likelihood which which those outcomes occur.
625941cf6aa9bd52df036ee4
def train(self, train_dataset, val_dataset, learning_rate, epochs, layers): <NEW_LINE> <INDENT> assert self.mode == "training", "Create model in training mode." <NEW_LINE> train_gernerator = data_generator(dataset=train_dataset, config=self.config, shuffle=True, augment=True, batch_size=self.config.BATCH_SIZE) <NEW_LIN...
Train the model. train_dataset, val_dataset: Training and validation Dataset objects. learning_rate: The learning rate to train with epochs: Number of training epochs. Note that previous training epochs are considered to be done alreay, so this actually determines the epochs to train in total rather tha...
625941cf090684286d50ee25
@task <NEW_LINE> def package(): <NEW_LINE> <INDENT> with lcd(env.DIR): <NEW_LINE> <INDENT> with open(path.join(env.DIR, '.vagrant')) as f: <NEW_LINE> <INDENT> base = json.load(f)["active"]["default"] <NEW_LINE> <DEDENT> local(vagrant.vagrant.package.with_opts(base=base, output='%s.box' % env.NAME, include=path.join(env...
Package the base box
625941cfd4950a0f3b08c48e
def get_notification_url(self): <NEW_LINE> <INDENT> return self.__notification_url
オフライン転送先URLを取得 :return: オフライン転送先URL :rtype: unicode
625941cfc4546d3d9de72b74
def test_success_rmdir(self): <NEW_LINE> <INDENT> success_path=mock.Mock(return_value='success') <NEW_LINE> self.r.rmdir=success_path <NEW_LINE> self.assertEqual(self.r.exists_get_rmdir(),'success')
删除目录成功 :return:
625941cf004d5f362079a472
def default_main(agent_class, description, argv=sys.argv, parser_class=ArgumentParser, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if isapipe(sys.stdout): <NEW_LINE> <INDENT> stdout = sys.stdout <NEW_LINE> sys.stdout = os.fdopen(stdout.fileno(), 'w', 1) <NEW_LINE> <DEDENT> parser = parser_class(prog=os.path...
Default main entry point implementation.
625941cf60cbc95b062c6683
def upload_url(self): <NEW_LINE> <INDENT> url = self.get_url('upload_url') <NEW_LINE> return self.session.get(url).json()
Return an object storage URL for uploading the Qobj.
625941cfa219f33f34628aa9
def nthPascalValue(n): <NEW_LINE> <INDENT> numbers = 1 <NEW_LINE> start = 1 <NEW_LINE> while n > numbers: <NEW_LINE> <INDENT> start += 1 <NEW_LINE> numbers += start <NEW_LINE> <DEDENT> index = numbers - n <NEW_LINE> value = factorial(start - 1) / (factorial(index) * factorial(start - 1 - index)) <NEW_LINE> return value
NOTE IMPORT FACTORIAL WITH THIS FUNCTION
625941cf1f037a2d8b94633d
def extract_top(self): <NEW_LINE> <INDENT> ret_val = self.get_top() <NEW_LINE> self.size -= 1 <NEW_LINE> self._heap[1] = self._heap[-1] <NEW_LINE> self._heap.pop() <NEW_LINE> self._heapify_down(1) <NEW_LINE> return ret_val
Remove and return the top value of the heap, heap is modified. Time complexity: O(logn)
625941cf5166f23b2e1a5298
@app.before_request <NEW_LINE> def before_request(): <NEW_LINE> <INDENT> g.user = current_user
Used to get current user
625941cf1d351010ab855c5b
def group_get_all_objects_any_perms(group): <NEW_LINE> <INDENT> perms = {} <NEW_LINE> for cls in permission_map: <NEW_LINE> <INDENT> perms[cls] = group_get_objects_any_perms(group, cls) <NEW_LINE> <DEDENT> return perms
Get all objects from all registered models that the group has any permission for. This method does not accept a list of permissions since in most cases permissions will not exist across all models. If a permission didn't exist on any model then it would cause an error to be thrown. @param group - group to check perm...
625941cfb57a9660fec339c3
@main.command() <NEW_LINE> @click.option("-i", "--file-in", type=click.File("r"), default=sys.stdin) <NEW_LINE> @click.option("-o", "--file-out", type=click.File("w"), default=sys.stdout) <NEW_LINE> @click.option("--column", type=int, default=0, show_default=True) <NEW_LINE> @click.option("--sep", default="\t", show_de...
Remap a column in a given file stream.
625941cf091ae3566866709d
def addTwoNumbers(self, l1, l2): <NEW_LINE> <INDENT> head = ListNode(0) <NEW_LINE> cur = head <NEW_LINE> flag = 0 <NEW_LINE> while (l1 != None or l2 != None or flag == 1): <NEW_LINE> <INDENT> if l1 == None and l2 == None: <NEW_LINE> <INDENT> num = 0 <NEW_LINE> <DEDENT> elif l2 == None: <NEW_LINE> <INDENT> num = l1.val ...
:type l1: ListNode :type l2: ListNode :rtype: ListNode
625941cfb57a9660fec339c4
@patch('homeassistant.components.http.util.get_local_ip', return_value='127.0.0.1') <NEW_LINE> def setUpModule(mock_get_local_ip): <NEW_LINE> <INDENT> global hass <NEW_LINE> hass = ha.HomeAssistant() <NEW_LINE> hass.bus.listen('test_event', lambda _: _) <NEW_LINE> hass.states.set('test.test', 'a_state') <NEW_LINE> boot...
Initalizes a Home Assistant server.
625941cf3c8af77a43ae38e0
def test_fault_info(self): <NEW_LINE> <INDENT> if not self.checkResults: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> from pylith.tests.Fault import check_vertex_fields <NEW_LINE> fields = ["normal_dir", "final_slip", "slip_time"] <NEW_LINE> self.fault = 1 <NEW_LINE> filename = "%s-fault1_info.h5" % self.outputRoot <...
Check fault information.
625941cfad47b63b2c50a0bf
def _set_fitness_function(self, fitness_func): <NEW_LINE> <INDENT> self._fitness_function = fitness_func <NEW_LINE> self._lineage_fitnesses = {}
Sets the fitness function: a function that takes a Lineage object as an argument and returns the fitness score of the lineage in this habitat. Can be set to ``None`` to return an arbitrary fitness score of 1.0 for all and any lineages. Setting the fitness function clears the cached fitness values, forcing recalculation...
625941cf656771135c3eb9af
def test_warm_start_clear(): <NEW_LINE> <INDENT> X, y = datasets.make_hastie_10_2(n_samples=100, random_state=1) <NEW_LINE> for Cls in [GradientBoostingRegressor, GradientBoostingClassifier]: <NEW_LINE> <INDENT> est = Cls(n_estimators=100, max_depth=1) <NEW_LINE> est.fit(X, y) <NEW_LINE> est_2 = Cls(n_estimators=100, m...
Test if fit clears state.
625941cf4527f215b584c596
def moving_averages(data, interval, placeholder): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> assert interval == int(interval) <NEW_LINE> assert interval > 0 <NEW_LINE> assert interval < len(data) <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE> <INDENT> interval = 5 if len(data) > 5 else len(data) <NEW_LINE> pri...
data: list() - data using for calculations, interval: int() >0 service value for moving average calculating, placeholder: any type to fill places if it is unable to calculate result. If possible, calculates moving averages using 'interval' and 'data', else fills place with placeholder. Returns: List of results an...
625941cfac7a0e7691ed420c
@pytest.mark.django_db <NEW_LINE> def test_user_group_list_response(user_with_profile, user_client): <NEW_LINE> <INDENT> profile = user_with_profile(group="IPZ-41") <NEW_LINE> endpoint = f"/api/v1/users/group/{profile.group}/" <NEW_LINE> response = user_client.get(endpoint) <NEW_LINE> assert response.status_code == sta...
Ensure response contains only users of the required group.
625941cf8a349b6b435e82b3
def generate_slack_response(text, in_channel=True): <NEW_LINE> <INDENT> if in_channel: <NEW_LINE> <INDENT> where = "in_channel" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> where = "ephemeral" <NEW_LINE> <DEDENT> response = dict() <NEW_LINE> response["response_type"] = where <NEW_LINE> response["text"] = text <NEW_LIN...
Consumes a string message to send to slack in a public format. If the message should be sent only to the user set in_channel=False
625941cfdd821e528d63b2e8
def stop(self) -> None: <NEW_LINE> <INDENT> self.exit_token.set() <NEW_LINE> self.thread.join() <NEW_LINE> self.msg_pipe.close() <NEW_LINE> if self.other_pipe is not None: <NEW_LINE> <INDENT> self.other_pipe.close()
Stop the background thread which closes the serial port
625941cf30bbd722463cbf05
def J1(N): <NEW_LINE> <INDENT> key = 'J1(%s)'%N <NEW_LINE> try: <NEW_LINE> <INDENT> return _get(key) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> from sage.modular.arithgroup.all import Gamma1 <NEW_LINE> return _saved(key, Gamma1(N).modular_abelian_variety())
Return the Jacobian `J_1(N)` of the modular curve `X_1(N)`. EXAMPLES:: sage: J1(389) Abelian variety J1(389) of dimension 6112
625941cf50812a4eaa59c461
def setCookieJar(self, QNetworkCookieJar): <NEW_LINE> <INDENT> pass
setCookieJar(self, QNetworkCookieJar)
625941cfaad79263cf390b81
def plot_mid_text(center_point, parent_point, txt_str): <NEW_LINE> <INDENT> x_mid = (parent_point[0] - center_point[0]) / 2.0 + center_point[0] <NEW_LINE> y_mid = (parent_point[1] - center_point[1]) / 2.0 + center_point[1] <NEW_LINE> createPlot.ax1.text(x_mid, y_mid, txt_str) <NEW_LINE> return
内部函数,外部不要调用: 计算父节点和子节点的中间位置,并在父子节点间填充文本信息 :param center_point:文本中心点 :param parent_point:指向文本中心点的点
625941cfcad5886f8bd27119
def delete_project(self, repo_name) -> bool: <NEW_LINE> <INDENT> log.info("Deleting repo: {}".format(repo_name)) <NEW_LINE> result = self.driver.run_script("delete_project.js", {"repo_name": repo_name}) <NEW_LINE> if result.is_ok and result.data["status"] == "deleted": <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT...
:return: True on successful deletion, False otherwise
625941cf004d5f362079a473
def sign(tx_hash, private, use_rfc6979=True, k=None): <NEW_LINE> <INDENT> return Signature.create(tx_hash, private, use_rfc6979, k)
Sign transaction hash or message with secret private key. Creates a signature object. Sign a transaction hash with a private key and show DER encoded signature >>> sk = HDKey('728afb86a98a0b60cc81faadaa2c12bc17d5da61b8deaf1c08fc07caf424d493') >>> tx_hash = 'c77545c8084b6178366d4e9a06cf99a28d7b5ff94ba8bd76bbbce66ba8cd...
625941cf566aa707497f46a8
def step(self, f): <NEW_LINE> <INDENT> pos = self.atoms.get_positions().ravel() <NEW_LINE> G = -self.atoms.get_forces().ravel() <NEW_LINE> energy = self.atoms.get_potential_energy() <NEW_LINE> self.write_iteration(energy,G) <NEW_LINE> if hasattr(self,'oldenergy'): <NEW_LINE> <INDENT> self.write_log('energies ' + str(en...
Do one QN step
625941cfcb5e8a47e48b7be9
def hasprice(self): <NEW_LINE> <INDENT> if self.soup.find('span', {'class': 'price'}): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
Checks whether or not the listing has a price. Returns: bool: True if there is a price class in the content.
625941cf57b8e32f524835db
def walk_contents(folder: Union[str, Path], followlinks=False) -> Generator[Contents, None, None]: <NEW_LINE> <INDENT> folder = Path(folder).absolute() <NEW_LINE> _log.debug("walking folder contents of: %s", str(folder)) <NEW_LINE> for dirpath, dirnames, filenames in walk(folder, topdown=False, followlinks=followlinks)...
Recursively walks the given rootpath in bottom-up order, yielding Contents tuples
625941cfa8370b77170529df
@app.route('/login/<provider_name>/', methods=['GET', 'POST']) <NEW_LINE> def login(provider_name): <NEW_LINE> <INDENT> response = make_response() <NEW_LINE> result = authomatic.login(WerkzeugAdapter(request, response), provider_name) <NEW_LINE> if result: <NEW_LINE> <INDENT> if result.user: <NEW_LINE> <INDENT> result....
Login handler, must accept both GET and POST to be able to use OpenID.
625941cf3317a56b86939d97
def cast(*args): <NEW_LINE> <INDENT> return _itkMaskNegatedImageFilterPython.itkMaskNegatedImageFilterIUC3IUL3IUC3_Superclass_cast(*args)
cast(itkLightObject obj) -> itkMaskNegatedImageFilterIUC3IUL3IUC3_Superclass
625941cfd53ae8145f87a3af
def is_history(self): <NEW_LINE> <INDENT> return True
Utilisé uniquement dans les templates
625941cfd486a94d0b98e285
def main(): <NEW_LINE> <INDENT> args = docopt(__doc__, version='bromance 0.3') <NEW_LINE> cmd = args['<command>'] <NEW_LINE> if cmd: <NEW_LINE> <INDENT> lookup(cmd) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(args)
Parse the user input
625941cfff9c53063f47c333
def get_classification(self): <NEW_LINE> <INDENT> classification_dictionary = {} <NEW_LINE> for item in self.classification: <NEW_LINE> <INDENT> classification_dictionary[item['value']] = item['name'] <NEW_LINE> <DEDENT> classification_dictionary = OrderedDict( sorted(classification_dictionary.items())) <NEW_LINE> retu...
Get all hazard class created by user. :return: Hazard class definition created by user. :rtype: OrderedDict
625941cf8e71fb1e9831d8e9
def draw_with_valid_moves(self, player): <NEW_LINE> <INDENT> valid_move_list = self.valid_moves(player) <NEW_LINE> string = '' <NEW_LINE> for row, row_element in enumerate(self.__board): <NEW_LINE> <INDENT> for col, disc in enumerate(row_element): <NEW_LINE> <INDENT> if (row, col) in valid_move_list: <NEW_LINE> <INDENT...
Prints the board and also shows the valid moves for one player. :param player: Player for whom we need to show the valid moves :return: Nothing
625941cf6e29344779a62752
def calculate_overlap(series1,series2): <NEW_LINE> <INDENT> a, b = float(series1.start), float(series1.end) <NEW_LINE> c, d = float(series2.start), float(series2.end) <NEW_LINE> b_a = b-a <NEW_LINE> b_c = b-c <NEW_LINE> d_c = d-c <NEW_LINE> d_a = d-a <NEW_LINE> overlap = min([b_a,b_c,d_c,d_a]) <NEW_LINE> return overlap
series should both have start and end attrs http://baodad.blogspot.co.uk/2014/06/date-range-overlap.html
625941cf5fc7496912cc3abe
def test_rxt_03(self): <NEW_LINE> <INDENT> exp = iadpython.read_rxt('./tests/data/basic-C.rxt') <NEW_LINE> self.assertAlmostEqual(exp.m_r[0], 0.18744, delta=1e-5) <NEW_LINE> self.assertAlmostEqual(exp.m_t[0], 0.57620, delta=1e-5) <NEW_LINE> self.assertAlmostEqual(exp.m_u[0], 0.00560, delta=1e-5) <NEW_LINE> self.assertA...
Verify m_r, m_t, and m_u measurements read correctly.
625941cf5510c4643540f523
def getNumberOfCompo(self): <NEW_LINE> <INDENT> return _MEDCalculator.DataArrayIntTuple_getNumberOfCompo(self)
getNumberOfCompo(self) -> int 1
625941cfec188e330fd5a8de
def rejection_condition_one(complete_data): <NEW_LINE> <INDENT> record_id = 0 <NEW_LINE> incorrect_records_list = [] <NEW_LINE> correct_records = [] <NEW_LINE> flag = False <NEW_LINE> for row in complete_data: <NEW_LINE> <INDENT> mean = 0 <NEW_LINE> for value in row: <NEW_LINE> <INDENT> mean = mean + float(value) <NEW_...
This method rejects the records :param complete_data: :return: correct and incorrect records list
625941cf45492302aab5e404
def convert_to_date_obj(arr): <NEW_LINE> <INDENT> global year <NEW_LINE> for index, date in enumerate(arr): <NEW_LINE> <INDENT> if type(arr[0]) != unicode and datetime.strptime(year + " " + date, "%Y %d %B") < arr[0]: <NEW_LINE> <INDENT> year = str(int(year) + 1) <NEW_LINE> <DEDENT> date_obj = datetime.strptime(year +...
Converts items in a list, to date time objects. Input format = '2019 6 April' Output format = 06/04/2019
625941cf07f4c71912b115c3
def build_heap(self, i, l): <NEW_LINE> <INDENT> nums = self.nums <NEW_LINE> left, right = 2 * i + 1, 2 * i + 2 <NEW_LINE> large_index = i <NEW_LINE> if left <= l and nums[i] < nums[left]: <NEW_LINE> <INDENT> large_index = left <NEW_LINE> <DEDENT> if right <= l and nums[large_index] < nums[right]: <NEW_LINE> <INDENT> la...
构建大顶堆
625941cfbf627c535bc1330f
def add(self, items, addto=None): <NEW_LINE> <INDENT> if not isinstance(items, list): <NEW_LINE> <INDENT> items = [items] <NEW_LINE> <DEDENT> self.items.extend(items)
add more items to a sub-menu
625941cfcdde0d52a9e53174
def __int__(self): <NEW_LINE> <INDENT> return int()
int QGLShader.ShaderType.__int__()
625941cf15fb5d323cde0c50
def plot_peak_detail(peak, time_scalar=1, label='', unit='ns', colors=('gray', 'blue', 'green'), fig=None, ): <NEW_LINE> <INDENT> if not peak.shape: <NEW_LINE> <INDENT> peak = np.array([peak]) <NEW_LINE> <DEDENT> if peak.shape[0] != 1: <NEW_LINE> <INDENT> raise ValueError('Cannot plot the peak details for more than one...
Function which makes a detailed plot for the given peak. As in the main/alt S1/S2 plots of the event display. :param peak: Peak to be plotted. :param time_scalar: Factor to rescale the time from ns to other scale. E.g. =1000 scales to µs. :param label: Label to be used in the plot legend. :param unit: Time unit of...
625941cf8a349b6b435e82b4
def cost(section, dots_, mes_cost=True): <NEW_LINE> <INDENT> if dots_ == 4 and section == 'attributes': <NEW_LINE> <INDENT> return 5 <NEW_LINE> <DEDENT> if dots_ == 5: <NEW_LINE> <INDENT> if section == 'skills': <NEW_LINE> <INDENT> return 6 <NEW_LINE> <DEDENT> if section == 'merits' and mes_cost == False: <NEW_LINE> <I...
Determine cost of a particular desired rank (i.e., skill rank 5 returns 6
625941cf8da39b475bd650b5
def corr_series(self, param): <NEW_LINE> <INDENT> return self.psi(param) * (self.psi(param)**2 + (1-param.phi**2) * self.overdispersion(param)) ** (-.5)
Conditional correlation time series. Parameters ---------- param : ARGparams instance Model parameters Returns ------- (nobs, nsim) array Conditional correlation
625941cf7c178a314d6ef5a1
def getCumLength(self): <NEW_LINE> <INDENT> length_sequence=self.getLengthSequence() <NEW_LINE> return np.cumsum(length_sequence)
Return for each point in fineCoordMtr the cumulative length of tendon from its starting point
625941cf5fdd1c0f98dc0374
def get_server_info(self) -> Optional[Dict[str, Union[int, str, Dict[str, str]]]]: <NEW_LINE> <INDENT> _, data = self.request(urljoin(self.url, 'server/info'), method='get') <NEW_LINE> return data
Returns general server information including build number, version and commit hashes.
625941cf15baa723493c40b6
def _get_config_with_sensitive_info(self, domain_id, group=None, option=None): <NEW_LINE> <INDENT> whitelisted = self.list_config_options(domain_id, group, option) <NEW_LINE> sensitive = self.list_config_options(domain_id, group, option, sensitive=True) <NEW_LINE> sensitive_dict = {s['option']: s['value'] for s in sens...
Get config for a domain/group/option with sensitive info included. This is only used by the methods within this class, which may need to check individual groups or options.
625941cf38b623060ff0af2e
def _round_supply(self, supply, decimals): <NEW_LINE> <INDENT> if decimals > 0: <NEW_LINE> <INDENT> supply = supply / math.pow(10, decimals) <NEW_LINE> supply = Decimal(supply) <NEW_LINE> supply = round(supply) <NEW_LINE> <DEDENT> return min(supply, MAX_TOTAL_SUPPLY)
Divide supply by 10 ** decimals, and round it Parameters ---------- supply: int Contract total supply decimals: int Contract decimals Returns ------- str Contract total supply without decimals
625941cf8c0ade5d55d3eafc
def testBitReadMessageExecuteSuccess(self): <NEW_LINE> <INDENT> context = MockContext() <NEW_LINE> context.validate = lambda a,b,c: True <NEW_LINE> requests = [ ReadCoilsRequest(1,5), ReadDiscreteInputsRequest(1,5), ] <NEW_LINE> for request in requests: <NEW_LINE> <INDENT> result = request.execute(context) <NEW_LINE> s...
Test bit read request encoding
625941cf63b5f9789fde7226
@app.route('/categories/<int:category_id>/subcategories/' '<int:subcategory_id>/product/<int:productdetail_id>/details/JSON/') <NEW_LINE> def ProductDetailJSON(category_id, subcategory_id, productdetail_id): <NEW_LINE> <INDENT> if request.method == 'GET': <NEW_LINE> <INDENT> prodid = session.query(ProductType).filter_b...
Provides the products detail in JSON
625941cfa8ecb033257d320d
def minInertiaRatio(value): <NEW_LINE> <INDENT> global params <NEW_LINE> global detector <NEW_LINE> params.minInertiaRatio = value / 100 <NEW_LINE> detector = cv.SimpleBlobDetector_create(params)
Minimum blob inertia, in %.
625941cfd58c6744b4257da0
def patch_all(): <NEW_LINE> <INDENT> eventlet_monkey_patch() <NEW_LINE> patch_minidom_writexml()
Apply all patches. List of patches: * eventlet's monkey patch for all cases; * minidom's writexml patch for py < 2.7.3 only.
625941cf4a966d76dd551150
def test_non_implicit_but_exp_children(self, client): <NEW_LINE> <INDENT> class T1(ModellessSpoke): <NEW_LINE> <INDENT> implicit_add = False <NEW_LINE> <DEDENT> class T2(ModellessSpoke): <NEW_LINE> <INDENT> explicit_children = (T1, ) <NEW_LINE> <DEDENT> type_registry.register(T1) <NEW_LINE> type_registry.register(T2) <...
T1 cannot be added explicitly but is in T2's explicit children
625941cffff4ab517eb2f57d
def __init__(self, root): <NEW_LINE> <INDENT> self.stack = [] <NEW_LINE> left, right = None, None <NEW_LINE> if root is not None: <NEW_LINE> <INDENT> if root.left is not None: <NEW_LINE> <INDENT> left = root.left <NEW_LINE> root.left = None <NEW_LINE> <DEDENT> if root.right is not None: <NEW_LINE> <INDENT> right = root...
:type root: TreeNode
625941cfd10714528d5ffe24
def peek(self): <NEW_LINE> <INDENT> return self.l[self.i]
Returns the next element in the iteration without advancing the iterator. :rtype: int
625941cf2c8b7c6e89b35901
def test_get_import_settings(self): <NEW_LINE> <INDENT> pass
Test case for get_import_settings Get organization's default import settings # noqa: E501
625941cf99fddb7c1c9de4d1
def addDigits(self, num): <NEW_LINE> <INDENT> res = num % 9 <NEW_LINE> return 9 if res == 0 and num != 0 else res
:type num: int :rtype: int
625941cff548e778e58cd6be
def __init__(self, temboo_session): <NEW_LINE> <INDENT> Choreography.__init__(self, temboo_session, '/Library/Facebook/Reading/GetUnreadMessagesFromUser')
Create a new instance of the GetUnreadMessagesFromUser Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
625941cf379a373c97cfac86
def read_fstab(path): <NEW_LINE> <INDENT> entries = [] <NEW_LINE> with open(path) as f: <NEW_LINE> <INDENT> for i, line in enumerate(f): <NEW_LINE> <INDENT> line = line.strip().replace("\t", " ") <NEW_LINE> if line: <NEW_LINE> <INDENT> args = filter(bool, map(lambda s: s.strip(), line.split(" "))) <NEW_LINE> entries.ap...
Read an existing fstab
625941cf711fe17d825424ac
def set_osu_svr_dev(self, dev_info_str, curr_node): <NEW_LINE> <INDENT> for tbd in self.test_mngr_initr.test_prog_mngr.test_prog.testbed_dev_list: <NEW_LINE> <INDENT> indx = dev_info_str.find(tbd.dev_name) <NEW_LINE> indx1 = indx + len(tbd.dev_name) <NEW_LINE> if indx != -1 and tbd.dev_type == "OSUSERVER": <NEW_LINE> <...
Sets the OSU server device info. Args: dev_info_str (str): The string that includes device name and other device info. curr_node (node): The node object of SingleLinkedList class.
625941cfd18da76e23532617
@app_views.route('/amenities', methods=['POST'], strict_slashes=False) <NEW_LINE> def amenity_post(): <NEW_LINE> <INDENT> data = request.get_json() <NEW_LINE> if data is None: <NEW_LINE> <INDENT> abort(400, "Not a JSON") <NEW_LINE> <DEDENT> if 'name' not in data: <NEW_LINE> <INDENT> abort(400, "Missing name") <NEW_LINE...
handles POST method
625941cf96565a6dacc8f80c
def use_for_cell(*args, **kwargs): <NEW_LINE> <INDENT> return _cmf_core.MatrixInfiltration_use_for_cell(*args, **kwargs)
use_for_cell(Cell c)
625941cffbf16365ca6f6306
def load_gff(fp): <NEW_LINE> <INDENT> grpd_peaks = defaultdict(list) <NEW_LINE> for line in fp: <NEW_LINE> <INDENT> if line.startswith("#"): continue <NEW_LINE> if line.startswith("track"): continue <NEW_LINE> data = line.split() <NEW_LINE> signal = float(data[5]) <NEW_LINE> peak = Peak(data[0], data[6], int(float(data...
chr20 GRIT TSS 36322438 36322468 44 + . gene_id 'chr20_plus_36322407_36500530'; gene_name 'chr20_plus_36322407_36500530'; tss_id 'TSS_chr20_plus_36322407_36500530_pk1'; peak_cov '7,0,11,0,0,0,0,0,3,0,1,0,0,0,6,0,0,0,0,0,3,0,4,0,0,0,8,0,0,1';
625941cfc4546d3d9de72b75
def expired(self): <NEW_LINE> <INDENT> expired = False <NEW_LINE> if self.validity and not self.never_update: <NEW_LINE> <INDENT> expired = timebase.now() > self.last_updated + self.validity <NEW_LINE> <DEDENT> return expired
Return True if screenshot is expired
625941cf76d4e153a657ec72
def header(self,cells): <NEW_LINE> <INDENT> self = self or Rows() <NEW_LINE> self.indep = [] <NEW_LINE> for c0,x in enumerate(cells): <NEW_LINE> <INDENT> if not "?" in x: <NEW_LINE> <INDENT> c = len(self._use) <NEW_LINE> self._use.append(c0) <NEW_LINE> self.name.append(x) <NEW_LINE> if "$" in x or "<" in x or ">" in x:...
Checks for certain symbols at the beginning of the column name and structure then into sym and num objects
625941cf851cf427c661a64f
def users_organizations(user): <NEW_LINE> <INDENT> if not user or not user.is_authenticated(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return get_users_organizations(user)
Returns all organizations, in wich the user is member. Use in Template: {% load org_tags %} {% users_organizations request.user as my_orgs %}
625941cf097d151d1a222f9a
def resnn(self, sequences): <NEW_LINE> <INDENT> self.model_conf() <NEW_LINE> target_expanded = tf.expand_dims(sequences, 2) <NEW_LINE> with tf.variable_scope('conv_layer1'): <NEW_LINE> <INDENT> net = self.conv1d(target_expanded, self.groups[0].num_ker, 7, 2) <NEW_LINE> net = self.BN_ReLU(net) <NEW_LINE> <DEDENT> net = ...
Build the resnn model. Args: page_batch: Sequences returned from inputs_train() or inputs_eval. Returns: Logits.
625941cf76e4537e8c3517b3
def __call__(cls, religion, beliefs, *args, **kwargs): <NEW_LINE> <INDENT> clsName = religion + cls.__name__ <NEW_LINE> clsDict={} <NEW_LINE> if re.match('^[\w-]+$', religion) is None: <NEW_LINE> <INDENT> raise DogmaMetaClassException('''Blasphemy! The name of your metadata religion (class name prefix: '%s') must be al...
cls is the base class which new properties will be added to religion is the unique prefix for that class and its beliefs (properties) beliefs is a dictionary that maps property names (IOOS metadata) to a particular schema (ISO, CF, etc) @TODO - store the clsTypes so that they are only generated once - but how are the...
625941cf76e4537e8c3517b4
def run_episode(env, agent, imax=1000, updateQ=True): <NEW_LINE> <INDENT> s = env.reset() <NEW_LINE> r_total = 0 <NEW_LINE> for i in range(imax): <NEW_LINE> <INDENT> i_action = agent.get_next_action(s) <NEW_LINE> s_prime, reward, gameEnded, _ = env.step(i_action) <NEW_LINE> r_total += reward <NEW_LINE> if updateQ: <NEW...
Run an episode through the environment env using given agent :param env: Initialized environment (environment will automatically be reset at start of episode) :param agent: Agent object :param imax: Maximum number of steps to take in environment :param updateQ: Boolean controlling whether q is updated :return: Reward ...
625941cfab23a570cc2502c3
def _findroot(f_q1, f_q2, f_q2_subgen): <NEW_LINE> <INDENT> if card(f_q1) > 50: <NEW_LINE> <INDENT> _log.debug("by affine multiple (%d)" % card(f_q1)) <NEW_LINE> return affine_multiple_method(f_q1.modulus, f_q2) <NEW_LINE> <DEDENT> root = f_q2_subgen <NEW_LINE> for i in range(1, card(f_q1)): <NEW_LINE> <INDENT> if not ...
Find root of the defining polynomial of f_q1 in f_q2
625941cf3c8af77a43ae38e1
def output_result_page(self, current_results, word, current_page, final=False, pagetype=None, last_page=0): <NEW_LINE> <INDENT> overview_link = '<div id="top"><a href="..\{}">back to overview</a></div><br/>\n'.format(os.path.split(self.new_file)[1]) <NEW_LINE> page_links = self.make_result_page_links(current_results, w...
make the html page for a section of the results
625941cf0383005118ecf723
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 8 <NEW_LINE> (_x.result, _x.distance,) = _struct_if.unpack(str[start:end]) <NEW_LINE> return self <NEW_LINE> <DEDENT> except struct.error as e: <NEW_LINE> <INDENT> raise genpy.D...
unpack serialized message in str into this message instance :param str: byte array of serialized message, ``str``
625941cfa934411ee37517d4
def reverseListRecursive(self, head): <NEW_LINE> <INDENT> if(head == None or head.next == None): <NEW_LINE> <INDENT> return head <NEW_LINE> <DEDENT> temp = self.reverseListRecursive(head.next) <NEW_LINE> head.next.next = head <NEW_LINE> head.next = None <NEW_LINE> return temp
:type head: ListNode :rtype: ListNode
625941cf1f5feb6acb0c4c91
def show_bboxes(axes, bboxes, labels=None, colors=None): <NEW_LINE> <INDENT> labels = _make_list(labels) <NEW_LINE> colors = _make_list(colors, ['b', 'g', 'r', 'm', 'k']) <NEW_LINE> for i, bbox in enumerate(bboxes): <NEW_LINE> <INDENT> color = colors[i % len(colors)] <NEW_LINE> rect = bbox_to_rect(bbox.numpy(), color) ...
Show bounding boxes.
625941cf4d74a7450ccd4304
def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: <NEW_LINE> <INDENT> for x in range(m, len(nums1)): <NEW_LINE> <INDENT> nums1[x] = nums2[x - m] <NEW_LINE> <DEDENT> nums1.sort()
Do not return anything, modify nums1 in-place instead.
625941cf50812a4eaa59c462
def test_retrieve_profile_success(self): <NEW_LINE> <INDENT> res = self.client.get(ME_URL) <NEW_LINE> self.assertEqual(res.status_code, status.HTTP_200_OK) <NEW_LINE> self.assertEqual(res.data, { 'name': self.user.name, 'email': self.user.email })
Test retriving profile for logged in user
625941cf3cc13d1c6d3c74bb
def get_min_vertex(self): <NEW_LINE> <INDENT> min_vertex_value = sys.maxsize <NEW_LINE> min_vertex_index = 0 <NEW_LINE> for index in range(self.v): <NEW_LINE> <INDENT> if ( not self.visited[index] and self.distances[index] < min_vertex_value ): <NEW_LINE> <INDENT> min_vertex_value = self.distances[index] <NEW_LINE> min...
Find the vertex with the lowest distance
625941cfa8370b77170529e0
def _get_scm_cmd(self): <NEW_LINE> <INDENT> scmcmd = ['hg'] <NEW_LINE> if self.httpproxy: <NEW_LINE> <INDENT> logging.debug("using tempdir: %s", self.hgtmpdir) <NEW_LINE> cfg = open(self.hgtmpdir + "/tempsettings.rc", "wb") <NEW_LINE> cfg.write('[http_proxy]\n') <NEW_LINE> regexp_proxy = re.match('http://(.*):(.*)', se...
Compose a HG-specific command line using http proxies.
625941cf8a43f66fc4b541a6
def add_subsubtitle(self, box, text): <NEW_LINE> <INDENT> label = wx.StaticText(self, -1, text) <NEW_LINE> label.SetFont(font.normal) <NEW_LINE> box.AddSpacer(10) <NEW_LINE> box.Add(label)
Create and add the subsubtitle. @param box: The box element to pack the text into. @type box: wx.BoxSizer instance @param text: The text of the subsubtitle. @type text: str
625941cfbaa26c4b54cb1260
def setTimelineData(tbl,dirName,fields=[],positions=[],time=0): <NEW_LINE> <INDENT> actualDir=checkDir(dirName) <NEW_LINE> data=TimelinePlot(args=[case().name, "--directory="+actualDir, "--time="+str(time), "--basic-mode=lines", "--numpy"]+ ["--field=%s" % f for f in fields]+ ["--position=%s" % p for p in positions]).d...
Read timeline data and put it into a vtkTable Use in 'Programmable Filter'. Set output type to 'vtkTable'. To get (for instance) the fields p and U on position 'min' from the timeline data in the directory swakExpression_foo in the source code write from PyFoam.Paraview.Data import setTimelineData setT...
625941cfbde94217f3682f32
def fail_with_message(self, message): <NEW_LINE> <INDENT> logging.getLogger(__name__).error(message) <NEW_LINE> self.result = TrialResult( system=self.system, image_source=self.image_source, message=message ) <NEW_LINE> self.mark_job_complete()
Quick helper to log error message, and make and store a trial result as the result :param message: :return:
625941cf7b25080760e3959a
def __init__(self, ao_image=None): <NEW_LINE> <INDENT> self._ao_image = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.ao_image = ao_image
AoImage - a model defined in Swagger
625941cf91f36d47f21ac634
def arrays(): <NEW_LINE> <INDENT> pass
arr1 = list([2,3,4,2,1]) # print(arr1) arr1 = sorted(set(arr1)) print(arr1) # arr1 = arr1[2:] # keep only somewhere in list to the end # print(arr1) arr1 = arr1[::-1] # reverse list print(arr1)
625941cf6fece00bbac2d880
def test_normal_with_query_params(self): <NEW_LINE> <INDENT> with patch('basket.confirm') as confirm: <NEW_LINE> <INDENT> confirm.return_value = {'status': 'ok'} <NEW_LINE> rsp = self.client.get(self.url + '?utm_tracking=oh+definitely+yes&utm_source=malibu') <NEW_LINE> self.assertEqual(302, rsp.status_code) <NEW_LINE> ...
Confirm works with a valid token
625941cfab23a570cc2502c4
def expand_base(*num_comps): <NEW_LINE> <INDENT> assert num_comps, "zero dimension" <NEW_LINE> assert all(type(nc) == int for nc in num_comps), "number of component for each dimension must be int" <NEW_LINE> assert all(nc >= 1 for nc in num_comps), "at least 1 component for each dimension" <NEW_LINE> bases = num_comps[...
Return a mixed-base expansion for decoding. >>> expand_base(2, 3, 4) (12, 4, 1)
625941cf6fb2d068a760f1df
def load(self): <NEW_LINE> <INDENT> if(self.page is None): <NEW_LINE> <INDENT> print("Downloading webpage {0}".format(self.url)) <NEW_LINE> self.page=Webpage(self.url, headers=self.headers, encoding=self.encoding)
Downloads the webpage. Pretty important for most of the stuff in this class
625941cf8e05c05ec3eea4b6
def write_file(): <NEW_LINE> <INDENT> freq_list, word_list = read_file() <NEW_LINE> file = open('mincostbst.txt', 'w') <NEW_LINE> for i in range(1, len(word_list)): <NEW_LINE> <INDENT> file.write(word_list[i] + '\t' + str(freq_list[i]) + '\n')
This function writes the output to the file in a specific format :param: None :precondition: None :postcondition: The required output is written to the text file :complexity: Best Case = Worst case = O(n), where n is the size of the list
625941cf099cdd3c635f0d9c
def reshape(self): <NEW_LINE> <INDENT> s = self.states <NEW_LINE> m = self.measurements <NEW_LINE> if s and m: <NEW_LINE> <INDENT> shapes = {'A':(s,s), 'H':(m,s), 'P':(s,s), 'R':(m,m)} <NEW_LINE> for m_name in shapes: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> m_array = getattr(self, m_name) <NEW_LINE> r_matrix = np....
Reshapes matrices to the correct dimensions. Only need to call this if loading a model from a JSON file. Notes: Internally: Eigen::Matrix<double, m, s> H; Eigen::Matrix<double, s, s> Q; Eigen::Matrix<double, s, s> P; Eigen::Matrix<double, m, m> R;
625941cf6aa9bd52df036ee6
def generate(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> chunk = self.write_queue.get() <NEW_LINE> if chunk is None: <NEW_LINE> <INDENT> self.thread.join() <NEW_LINE> break <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> yield chunk
Executed in the main thread to generate output in the response
625941cf97e22403b379d0db
def pc_work_time_var(self): <NEW_LINE> <INDENT> return _blocks_swig4.packed_to_unpacked_bb_sptr_pc_work_time_var(self)
pc_work_time_var(packed_to_unpacked_bb_sptr self) -> float
625941cf4428ac0f6e5ba934
def __str__(self) -> str: <NEW_LINE> <INDENT> return json.dumps(self.to_dict(), indent=2)
Return a `str` version of this DialogNodeOutputOptionsElement object.
625941cf24f1403a92600ca7
def test_vertical_negative(self): <NEW_LINE> <INDENT> V = Vector2D(0, -0.2) <NEW_LINE> N = V.normal <NEW_LINE> self.assertAlmostEqual(N.x, -1) <NEW_LINE> self.assertAlmostEqual(N.y, 0)
normal <--------- | | vec v
625941cf01c39578d7e74f7c
def get_provider_by_index(self): <NEW_LINE> <INDENT> provider = self.field('provider_index') <NEW_LINE> return self.providers[provider]
returns the value of a provider given its index. this was used in the select provider page, in the case where we were preseeding providers in a combobox
625941cf60cbc95b062c6685
def leafSimilar(self, root1, root2): <NEW_LINE> <INDENT> result1 = [] <NEW_LINE> self.dfs(root1,result1) <NEW_LINE> result2 = [] <NEW_LINE> self.dfs(root2,result2) <NEW_LINE> if result1 == result2: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False
:type root1: TreeNode :type root2: TreeNode :rtype: bool
625941cf15baa723493c40b7