code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def test_creation(self): <NEW_LINE> <INDENT> joueur = self.creer_joueur("simple", "Fiche") <NEW_LINE> guilde = importeur.crafting.creer_guilde("forgerons") <NEW_LINE> guilde.ajouter_rang("apprenti") <NEW_LINE> guilde.ajouter_talent("forge", "talent de la forge", False) <NEW_LINE> guilde.ajouter_talent("ciseau", "art du... | Test l'ajout de talents à des guildes vides. | 625941ee5fdd1c0f98dc0791 |
def __init__(self, graph): <NEW_LINE> <INDENT> super().__init__(graph) <NEW_LINE> self.count_type = CountTypes.if_edge.name | Store graph and set type. | 625941ee5fcc89381b1e1c1f |
def test_idempotent_add_dataset_type(index, ls5_telem_type, ls5_telem_doc): <NEW_LINE> <INDENT> assert index.products.get_by_name(ls5_telem_type.name) is not None <NEW_LINE> index.products.add_document(ls5_telem_doc) <NEW_LINE> different_telemetry_type = copy.deepcopy(ls5_telem_doc) <NEW_LINE> different_telemetry_type[... | :type ls5_telem_type: datacube.model.DatasetType
:type index: datacube.index._api.Index | 625941eea934411ee3751bf1 |
def expr_to_postfix(expr): <NEW_LINE> <INDENT> if expr.is_leaf(): <NEW_LINE> <INDENT> return str(expr.oper) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "{} {} {}".format(expr_to_postfix(expr[0]), expr_to_postfix(expr[1]), expr.oper) | The inverse of postfix_to_expr. | 625941ee23849d37ff7b35e7 |
def test_youdao_eserch(self): <NEW_LINE> <INDENT> driver=self.driver <NEW_LINE> driver.get(self.base_url+"/") <NEW_LINE> driver.find_element_by_id("translateContent").send_keys("学习python") <NEW_LINE> driver.get_screenshot_as_file("学习python.png") <NEW_LINE> driver.find_element_by_xpath('//*[@id="form"]/button').click() ... | 有道搜索 | 625941ee63d6d428bbe44a4d |
def files_in(directory, escape_spaces=False, escape_char='\\'): <NEW_LINE> <INDENT> file_list = [] <NEW_LINE> for root, subFolders, files in os.walk(directory): <NEW_LINE> <INDENT> for filename in files: <NEW_LINE> <INDENT> filePath = os.path.join(root, filename) <NEW_LINE> if escape_spaces: <NEW_LINE> <INDENT> filePat... | Walks through a directory recursively (like unix 'find') returns a list of filepaths. | 625941eeadb09d7d5db6cce8 |
def require_remote(progname, valid=None): <NEW_LINE> <INDENT> if valid is None: <NEW_LINE> <INDENT> valid = [0] <NEW_LINE> <DEDENT> def outer(fn): <NEW_LINE> <INDENT> @wraps(fn) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> cmd = "which {0}".format(progname) <NEW_LINE> client = SSHClient() <NEW_LINE> cli... | Decorator that validates some system command exists on the remote system. The wrapped function
must contain a kwargs dictionary with the following keys:
host: The ip address of the machine we are executing remote command on
username: the user of the remote machine we wish to run command on
password: the password for ... | 625941ee3d592f4c4ed1d5ba |
def getMask(self): <NEW_LINE> <INDENT> hsv = cv2.cvtColor(self.frame, cv2.COLOR_BGR2HSV) <NEW_LINE> mask1 = cv2.inRange(hsv, self.lower_l, self.upper_l) <NEW_LINE> mask2 = cv2.inRange(hsv, self.lower_h, self.upper_h) <NEW_LINE> mask = cv2.bitwise_or(mask1,mask2) <NEW_LINE> mask = cv2.erode(mask,self.kernel,iterations =... | This part is a little tricky and requires some background on erosion
and dialation.
Look here : https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_imgproc/py_morphological_ops/py_morphological_ops.html
I am converting the image to HSV, grabbing only colors in the select
range as a binary, eroding once to reduce noise... | 625941ee498bea3a759ba00a |
def AddrParams(self) -> Dict[str, Any]: <NEW_LINE> <INDENT> return self.m_addr_params["legacy"] if self.m_use_legacy_addr else self.m_addr_params["std"] | Get the address parameters. It overrides the method in BipCoinConf.
Returns:
dict: Address parameters | 625941ee7d43ff24873a3201 |
def nat(ind): <NEW_LINE> <INDENT> ind.play_game() <NEW_LINE> return ind.correct | Natural: Animats are evaluated based on the number of game trials they
successfully complete. For each task given in the ``TASKS`` parameter,
there is one trial per direction (left or right) of block descent, per
initial animat position (given by ``config.WORLD_WIDTH``). | 625941eede87d2750b8602f5 |
def _base_parse(self, fh, IndentationSetupF=False): <NEW_LINE> <INDENT> while 1 + 1 == 2: <NEW_LINE> <INDENT> skip_whitespace(fh) <NEW_LINE> if check(fh, ">"): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> pattern, identifier, sr = _parse_definition_head(fh, self.identifier_list) <NEW_LINE> if pattern is None and Inden... | Parses pattern definitions of the form:
[ ] => grid 4;
[:intersection([:alpha:], [\X064-\X066]):] => space 1;
In other words the right hand side *must* be a character set.
ADAPTS: result to contain parsing information. | 625941ee82261d6c526aba04 |
def rotate3D(X, Y, Z, rx, ry): <NEW_LINE> <INDENT> R = _np.eye(3) <NEW_LINE> Rx = _np.array([[1, 0, 0], [0, _np.cos(rx), -_np.sin(rx)], [0, _np.sin(rx), _np.cos(rx)]]) <NEW_LINE> Ry = _np.array([[_np.cos(ry), 0, _np.sin(ry)], [0, 1, 0], [-_np.sin(ry), 0, _np.cos(ry)]]) <NEW_LINE> R = _np.dot(R, Rx) <NEW_LINE> R = _np.... | Rotates a 3D object along one ordinate axis at a time.
Keyword arguments:
X -- The X coordinate of the voxels to be rotated.
Y -- The Y coordinate of the voxels to be rotated.
Z -- The Z coordinate of the voxels to be rotated.
Returns:
X,Y,Z coordinates of the rotated voxels. | 625941ee45492302aab5e825 |
def test_serializer_one_home_phone(self): <NEW_LINE> <INDENT> data = {'phones': '356-9877'} <NEW_LINE> serializer = OrderSerializer(data=data) <NEW_LINE> self.assertEqual(serializer.is_valid(), True) <NEW_LINE> self.assertEqual(serializer.validated_data['phones'], ['84953569877'], msg=serializer.validated_data) | Serializer should validate and parse one home phone numbers | 625941ee97e22403b379d4f8 |
def batchnorm_backward(dout, cache): <NEW_LINE> <INDENT> dx, dgamma, dbeta = None, None, None <NEW_LINE> pass <NEW_LINE> N, D = dout.shape <NEW_LINE> gamma, sample_mean, sample_var, margin, square, sqrt, _sum, invert, x_norm = cache <NEW_LINE> dbeta = np.sum(dout, axis = 0) <NEW_LINE> dgamma = np.sum(x_norm * dout, axi... | Backward pass for batch normalization.
For this implementation, you should write out a computation graph for
batch normalization on paper and propagate gradients backward through
intermediate nodes.
Inputs:
- dout: Upstream derivatives, of shape (N, D)
- cache: Variable of intermediates from batchnorm_forward.
Retur... | 625941ee1f5feb6acb0c50a6 |
def ex3_solution(input_string): <NEW_LINE> <INDENT> if re.match("^(..)*$", input_string) is not None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return False | Check if length of input_string is divisible by two. | 625941ee15baa723493c44d6 |
def __init__(self, id_, name, type_, parent=None): <NEW_LINE> <INDENT> assert isinstance(id_, int), (type(id_), id_) <NEW_LINE> assert isinstance(name, (str, int)), (type(name), name) <NEW_LINE> assert isinstance(type_, str), (type(type_), type_) <NEW_LINE> assert len(type_), (len(type_), type_) <NEW_LINE> self.id = id... | Init node.
:param id_: Value in parsed expression ``oid[<id>]=``.
:type id_: int
:param name: Node name.
:type name: (str or int)
:param type_: Node type.
:type type_: str
:param parent: Node parent.
:type parent: GuerillaNode | 625941eedd821e528d63b701 |
def upoly(factor_list): <NEW_LINE> <INDENT> return_list = dict() <NEW_LINE> n_factor = len(factor_list) <NEW_LINE> center_factor_list = list(map((lambda x: np.matrix(orpol((x-np.mean(x))/(np.sqrt(np.dot(x-np.mean(x), x-np.mean(x))))))), factor_list)) <NEW_LINE> zerotrend_list = list(map((lambda x: x[:, 0]), center_fact... | This module creates a U contrast matrix with orthogonal polynomial coding for within subject factors.
Parameters
----------
factor_list
list of levels of factors
Returns
-------
U
contrast matrix | 625941eef548e778e58cdadc |
def read_file(filename, namespace=None): <NEW_LINE> <INDENT> global MODULES <NEW_LINE> global MODULES_CHANGED <NEW_LINE> module, mod_time = MODULES.get(filename, (None, None)) <NEW_LINE> if module is None or mod_time != os.stat(filename)[stat.ST_MTIME]: <NEW_LINE> <INDENT> logger.debug('parsing module %s' % filename) <... | Parses a file. | 625941eea8370b7717052dfa |
def __init__(self, term_stream=sys.stdout): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import curses <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> if not term_stream.isatty(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> <DEDENT> except Exception: <N... | Create a `TerminalController` and initialize its attributes
with appropriate values for the current terminal.
`term_stream` is the stream that will be used for terminal
output; if this stream is not a tty, then the terminal is
assumed to be a dumb terminal (i.e., have no capabilities). | 625941eed53ae8145f87a7c1 |
def _makeMove(self, row, col, move): <NEW_LINE> <INDENT> if move == "N": <NEW_LINE> <INDENT> return row - 1, col <NEW_LINE> <DEDENT> elif move == "S": <NEW_LINE> <INDENT> return row + 1, col <NEW_LINE> <DEDENT> elif move == "W": <NEW_LINE> <INDENT> return row, col - 1 <NEW_LINE> <DEDENT> elif move == "E": <NEW_LINE> <I... | Given a row and column, and a direction to move, this returns the new row and column
values associated with that move | 625941ee6fece00bbac2dca2 |
def do_quit(self, line): <NEW_LINE> <INDENT> return True | quit: exits the console program if user enters 'quit' | 625941eecb5e8a47e48b7ffd |
def plot_diffusion(trans="ach", radii=[0., 1.1], spaces=[2, 3], duration=25000, save_pth=None, fmt="png"): <NEW_LINE> <INDENT> time_ax = np.arange(1, duration + 1) * .001 <NEW_LINE> time = time_ax / 1000 <NEW_LINE> funcs = {} <NEW_LINE> if 2 in spaces: <NEW_LINE> <INDENT> if trans == "ach": <NEW_LINE> <INDENT> funcs["2... | Visualize concentration profiles at the given radii (generally a proximal
and a distal site) that result from diffusion of ach or glut release events.
2D diffusion, 3D diffusion, or both can be included (set by spaces list). | 625941ee55399d3f05588c14 |
def register(model, critic_descriptor_attr='ratings'): <NEW_LINE> <INDENT> from critic.managers import RatingDescriptor <NEW_LINE> if model in registry: <NEW_LINE> <INDENT> raise AlreadyRegistered("The model '%s' has already been " "registered." % model._meta.object_name) <NEW_LINE> <DEDENT> if hasattr(model, critic_de... | Sets the given model class up for working with critic. | 625941ee60cbc95b062c6aa0 |
def post_add(self, name, variable): <NEW_LINE> <INDENT> logging.debug("Create Zookeeper node for %s", name) <NEW_LINE> self.zk_client.ensure_path(self.map_[name]) <NEW_LINE> val, _ = self.zk_client.get(self.map_[name]) <NEW_LINE> if not val: <NEW_LINE> <INDENT> if PY2: <NEW_LINE> <INDENT> self.zk_client.set(self.map_[n... | Add the variable as Zookeeper node.
:param name: str
:param variable: Variable | 625941ee76d4e153a657f08f |
def test_1_add(self): <NEW_LINE> <INDENT> modified = self.updater.update([self.testdir + "1_add.update"]) <NEW_LINE> self.assertTrue(modified) <NEW_LINE> entries = self.ld.get_entries( self.container_dn, self.ld.SCOPE_BASE, 'objectclass=*', ['*']) <NEW_LINE> self.assertEqual(len(entries), 1) <NEW_LINE> entry = entries[... | Test the updater with an add directive (test_1_add) | 625941ee26238365f5f0f3d2 |
def run(self, variables): <NEW_LINE> <INDENT> out = [[] for i in range(self.n_players)] <NEW_LINE> dog_day = variables[0] <NEW_LINE> for i in range(self.n_messengers): <NEW_LINE> <INDENT> this_out = self.messenger(dog_day, *variables[(1 + i*self.message_length):(1 + (i+1)*self.message_length)]) <NEW_LINE> for j in rang... | >>> m = ThomasModel(0.1, 0.25)
>>> m.run((1,0,1,0,0))
[(None, None, None, None), (1, 0, 1, None)]
>>> m.run((1,0,1,1,0))
[(None, None, None, None), (1, 0, 1, None)]
>>> m.run((1,1,0,0,0))
[(1, 1, None, None), (None, None, None, None)]
>>> m.run((1,1,0,1,0))
[(1, 1, 0, None), (None, None, None, None)]
>>> m.run((1,1,1,1... | 625941eed4950a0f3b08c8a3 |
def generate_wall(self): <NEW_LINE> <INDENT> return random.sample(self.tileset, len(self.tileset)) | Generate a fresh wall from self.tileset. | 625941ee66673b3332b925ed |
def export_to_tuple(self): <NEW_LINE> <INDENT> return self.x, self.y, self.z | Export vector to tuple.
:return: Tuple containing coordinates
:rtype: tuple | 625941ee167d2b6e312190f1 |
def create_android_app(package_name, display_name=None, app=None): <NEW_LINE> <INDENT> return _get_project_management_service(app).create_android_app(package_name, display_name) | Creates a new Android app in the associated Firebase project.
Args:
package_name: The package name of the Android app to be created.
display_name: A nickname for this Android app (optional).
app: An App instance (optional).
Returns:
AndroidApp: An ``AndroidApp`` instance that is a reference to the new... | 625941eef8510a7c17cf9c5d |
def first_true(iterable, default=False, pred=None): <NEW_LINE> <INDENT> return next(itertools.ifilter(pred, iterable), default) | Returns the first true value in the iterable.
If no true value is found, returns *default*
If *pred* is not None, returns the first item
for which pred(item) is true. | 625941eef7d966606f6aa567 |
def gaussin(nsigma=1): <NEW_LINE> <INDENT> return erf(old_div(nsigma, np.sqrt(2))) | FRACTION WITHIN nsigma | 625941eea4f1c619b28b0588 |
def isUnicast(self): <NEW_LINE> <INDENT> return not(self.isBroadcast() or self.isMulticast()) | Checks whether MAC address is unicast. | 625941ee442bda511e8be96d |
def draw(self, outputfile=None): <NEW_LINE> <INDENT> plot = self.init_plot() <NEW_LINE> ax = plot.gca() <NEW_LINE> if self.state: <NEW_LINE> <INDENT> self.pargs.setdefault( 'suptitle', '[%s-%s, state: %s]' % (self.span[0], self.span[1], texify(str(self.state)))) <NEW_LINE> <DEDENT> suptitle = self.pargs.pop('suptitle',... | Get data and generate the figure.
| 625941eec432627299f051a7 |
def rescale_video(video_fn, w, h, fps, dir, new_dir, extension): <NEW_LINE> <INDENT> video_dir = video_fn.split(dir)[1] <NEW_LINE> video_dir = video_dir.split('/') <NEW_LINE> video_dir, video_name_rescaled = '/'.join(video_dir[:-1])[1:], video_dir[-1] <NEW_LINE> video_dir_to_create = os.path.join(new_dir, video_dir) <N... | Rescale a video according to its new width, height an fps | 625941ee0a50d4780f6673f3 |
def search_wikipedia(term): <NEW_LINE> <INDENT> url = 'http://en.wikipedia.org/w/api.php' <NEW_LINE> params = { "action": 'opensearch', "search": term, "format": 'json' } <NEW_LINE> user_agent = "RxPY/1.0 (https://github.com/dbrattli/RxPY; dag@brattli.net) Tornado/4.0.1" <NEW_LINE> url = url_concat(url, params) <NEW_LI... | Search Wikipedia for a given term | 625941ee57b8e32f524839fb |
def __init__(self): <NEW_LINE> <INDENT> self.cloudidentifier = None <NEW_LINE> self.typeInfo['cloudidentifier'] = 'string' <NEW_LINE> self.signature = None <NEW_LINE> self.typeInfo['signature'] = 'string' <NEW_LINE> self.userid = None <NEW_LINE> self.typeInfo['userid'] = 'string' | the cloud identifier | 625941ee2eb69b55b151ce14 |
def parse_args(): <NEW_LINE> <INDENT> global flag_echo, flag_dryrun, flag_infiles, flag_outdir, flag_tag <NEW_LINE> global flag_binary, flag_pprof_path, flag_memvariants, flag_cleantemps <NEW_LINE> global flag_dashlines, flag_capture <NEW_LINE> try: <NEW_LINE> <INDENT> optlist, args = getopt.getopt(sys.argv[1:], "dmeCD... | Command line argument parsing. | 625941ee0fa83653e4657514 |
def find_label_weights(self, adult): <NEW_LINE> <INDENT> if adult in self.weights.keys(): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> pc = self.covertree.pointcloud <NEW_LINE> children_set = np.zeros(shape=(pc.coords.shape[0],), dtype='bool') <NEW_LINE> children_set[self.children[adult]] = Tr... | Compute the weights of labelled children of an adult.
Store it in self.weights[adult].
Parameters
----------
adult : `int`
index of adult to compute.
Returns
-------
self.weights[adult] | 625941ee7cff6e4e81117ee2 |
def init(self, path, namespace,categoryname): <NEW_LINE> <INDENT> self.initall(path, namespace,categoryname,db=False) | gets executed when catgory in osis gets loaded by osiscmds.py (.init method) | 625941ee26068e7796caf244 |
def __rlshift__(self, other): <NEW_LINE> <INDENT> return __lshift__(other, get_wrapped_object(self)) | other << self | 625941ee5166f23b2e1a56b6 |
def test_vote_case(): <NEW_LINE> <INDENT> assert 'titel' in opa.vote_case(9) | Test succesful retrieval of case-JSON based on case-id | 625941ee2ae34c7f2600d68d |
def Port_Enable(): <NEW_LINE> <INDENT> my_portstatus = 0 <NEW_LINE> if exists(Pattern("1437541744228.png").exact()): <NEW_LINE> <INDENT> Print_debug('sdi port is currently disabled.') <NEW_LINE> <DEDENT> if exists(Pattern("1437541808778.png").exact()): <NEW_LINE> <INDENT> my_portstatus = 1 <NEW_LINE> Print_debug('sdi p... | Enable/disable the sdi port
| 625941ee16aa5153ce3629d5 |
def is_ip_address(if_name): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> socket.inet_aton(if_name) <NEW_LINE> return True <NEW_LINE> <DEDENT> except socket.error: <NEW_LINE> <INDENT> return False | Return True if the parameter if_name is an IP address. | 625941eeff9c53063f47c74d |
def harris_feature(im, region_size=5, to_return='harris', scale=0.05): <NEW_LINE> <INDENT> ndim = im.ndim <NEW_LINE> grads = [nd.sobel(im, axis=i) for i in range(ndim)] <NEW_LINE> matrix = np.zeros((ndim, ndim) + im.shape) <NEW_LINE> for a in range(ndim): <NEW_LINE> <INDENT> for b in range(ndim): <NEW_LINE> <INDENT> ma... | Harris-motivated feature detection on a d-dimensional image.
Parameters
---------
im
region_size
to_return : {'harris','matrix','trace-determinant'} | 625941eeb7558d58953c5465 |
def mnist_training(logits, labels, learning_rate, num_workers): <NEW_LINE> <INDENT> cross_entropy = tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels, name='xentropy') <NEW_LINE> loss = tf.reduce_mean(cross_entropy, name='xentropy_mean') <NEW_LINE> opt = tf.train.AdamOptimizer(FLAGS.learning_rate) <N... | Build the training graph.
Args:
logits: Logits tensor, float - [Batch_size, NUM_CLASSES].
labels: Labels tensor, int32 - [Batch_size], with values in the
range [0, NUM_CLASSES).
learning_rate: The learning rate to use for gradient descent.
Returns:
train_op: The Op for training.
loss: The Op f... | 625941eed4950a0f3b08c8a4 |
def __init__( self, *, source_mdm_namespace: Optional[str] = None, display_name: Optional[str] = None, name: Optional[str] = None, aggregation_type: Optional[str] = None, display_description: Optional[str] = None, source_mdm_account: Optional[str] = None, enable_regional_mdm_account: Optional[bool] = None, unit: Option... | :keyword source_mdm_namespace: The source MDM namespace.
:paramtype source_mdm_namespace: str
:keyword display_name: Metric display name.
:paramtype display_name: str
:keyword name: Metric unique name.
:paramtype name: str
:keyword aggregation_type: Metric aggregation type.
:paramtype aggregation_type: str
:keyword dis... | 625941ee30dc7b7665901ebd |
def update(self, index: str): <NEW_LINE> <INDENT> if not self.active: <NEW_LINE> <INDENT> self.active = True <NEW_LINE> <DEDENT> self.remove_highlight() <NEW_LINE> self.text.tag_remove(tk.SEL, '0.0', tk.END) <NEW_LINE> self.text.mark_set(tk.INSERT, index) <NEW_LINE> current_index = self.index_as_tuple(index) <NEW_LINE>... | Update the text widget to display the column highlight and
block selection.
Args:
index: An index in the format 'line.char' | 625941ee7b180e01f3dc4d4e |
def plot3d(pixels, colors_rgb, axis_labels=list("RGB"), axis_limits=((0, 255), (0, 255), (0, 255))): <NEW_LINE> <INDENT> fig = plt.figure(figsize=(8, 8)) <NEW_LINE> ax = Axes3D(fig) <NEW_LINE> ax.set_xlim(*axis_limits[0]) <NEW_LINE> ax.set_ylim(*axis_limits[1]) <NEW_LINE> ax.set_zlim(*axis_limits[2]) <NEW_LINE> ax.tick... | Plot pixels in 3D. | 625941ee627d3e7fe0d693ae |
def test_wakati_002(self): <NEW_LINE> <INDENT> outputfilename = tempfile.gettempprefix() + '.csv' <NEW_LINE> if os.path.exists(outputfilename): <NEW_LINE> <INDENT> os.remove(outputfilename) <NEW_LINE> <DEDENT> config = set_sys_args('--wakati', '-i', SAMPLE_ID, '-o', outputfilename) <NEW_LINE> splunk_writer = twsearch.S... | --wakati オプションによる分かち書きテスト(CSV) | 625941ee3317a56b8693a1a7 |
def phase_angle(body, earth): <NEW_LINE> <INDENT> return _libkepler.phase_angle(byref(body), byref(earth)) | Calculate the Sun-body-Earth phase angle.
body -- The body's heliocentric rectangular coordinates. Must be in
the same reference frame and units as ear.
earth -- The Earth's heliocentric rectangular coordinates. Must be in
the same reference frame and units as obj.
Return 1: The Sun-body-Earth phase ... | 625941ee21bff66bcd684eaa |
def get_user_data(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.get_user_data_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.get_user_data_with_http_info(**kwargs) <NEW_LINE> return... | Get user data
Return profile information for the currently authenticated user.
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` function
to be invoked when receiving the response.
>>> def callback_function(response):
>>> pprint(response)
>>>
>... | 625941ee23e79379d52eeaba |
def dumps(voevent, pretty_print=False, xml_declaration=True, encoding='UTF-8'): <NEW_LINE> <INDENT> vcopy = copy.deepcopy(voevent) <NEW_LINE> _return_to_standard_xml(vcopy) <NEW_LINE> s = etree.tostring(vcopy, pretty_print=pretty_print, xml_declaration=xml_declaration, encoding=encoding) <NEW_LINE> return s | Converts voevent to string.
.. note:: Default encoding is UTF-8, in line with VOE2.0 schema.
Declaring the encoding can cause diffs with the original loaded VOEvent,
but I think it's probably the right thing to do (and lxml doesn't
really give you a choice anyway).
Args:
voevent (:class:`Voevent`): Ro... | 625941ee8a349b6b435e86cf |
def is_branch(path): <NEW_LINE> <INDENT> for control_dir in ('.bzr', ): <NEW_LINE> <INDENT> if os.path.exists(os.path.join(path, control_dir)): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False | Test to see if this path is a supported bzr branch.
May be bzr or git. | 625941ee435de62698dfe1aa |
def write(self, filename, format='fermi-counts', **kwargs): <NEW_LINE> <INDENT> filename = str(make_path(filename)) <NEW_LINE> self.to_fits(format).writeto(filename, **kwargs) | Write to FITS file.
Parameters
----------
filename : str
Filename
format : {'fermi-counts', 'fermi-background', 'fermi-exposure'}
Fits file format. | 625941eed99f1b3c44c67ae1 |
def batch_create_subscriptions_with_http_info(self, request, **kwargs): <NEW_LINE> <INDENT> all_params = ['request'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if... | Create multiple subscriptions.
{"nickname":"Create multiple subscriptions","response":"createMultipleSubscriptionViaHelper.html","request":"createMultipleSubscriptionViaHelper.request.html"}
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please define a `callback` functi... | 625941ee30bbd722463cc326 |
def softmax(X): <NEW_LINE> <INDENT> assert(X is not None) <NEW_LINE> T = np.exp(X) <NEW_LINE> S = np.sum(T, axis = 0, keepdims = True) <NEW_LINE> return T / S | softmax
The activation function of output layer in softmax regression N.N. to solve multiple classification problems.
exp(X) / sum(exp(X))
Arguments:
X -- dataset
Returns:
softmax of X | 625941eef7d966606f6aa568 |
def tan(curvelist): <NEW_LINE> <INDENT> if isinstance(curvelist, list): <NEW_LINE> <INDENT> for c in curvelist: <NEW_LINE> <INDENT> c.y = np.tan(c.y) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> curvelist.y = np.tan(curvelist.y) | Take the tangent of y values of a single curve or multiple curves in list.
>>> curves = pydvif.read('testData.txt')
>>> pydvif.tan(curves)
:param curvelist: A single curve or a list of curves
:type curvelist: curve or list | 625941eecc40096d61595eab |
def mean_per_class_accuracy(y_true, y_pred, n_classes=None, labels=None): <NEW_LINE> <INDENT> y_true, y_pred = _check_ndarrays_and_squeeze(y_true, y_pred) <NEW_LINE> if n_classes is None: <NEW_LINE> <INDENT> if labels is None: <NEW_LINE> <INDENT> labels = np.unique(y_true) <NEW_LINE> <DEDENT> n_classes = len(labels) <N... | Computes mean per-class accuracy
Args:
y_true: The true labels
y_pred: The predicted labels
n_classes: The number of classes, optional. If not provided, the number of
unique classes or length of `labels` if provided.
labels: The unique labels, optional. If not provided, unique l... | 625941eeb545ff76a8914373 |
def resetFirstTime( self, level=WARNING ): <NEW_LINE> <INDENT> if level == WARNING: <NEW_LINE> <INDENT> self.warnFirstTime = _FIRST_TIME <NEW_LINE> <DEDENT> elif level == ALARM: <NEW_LINE> <INDENT> self.alarmFirstTime = _FIRST_TIME <NEW_LINE> <DEDENT> elif level == CLEAR: <NEW_LINE> <INDENT> self.clearFirst... | Reset to be as though alert() never called for specified level. | 625941eeb5575c28eb68e562 |
def ensure_default_manager(sender, **kwargs): <NEW_LINE> <INDENT> cls = sender <NEW_LINE> if cls._meta.abstract: <NEW_LINE> <INDENT> setattr(cls, 'objects', AbstractManagerDescriptor(cls)) <NEW_LINE> return <NEW_LINE> <DEDENT> elif cls._meta.swapped: <NEW_LINE> <INDENT> setattr(cls, 'objects', SwappedManagerDescriptor(... | Ensures that a Model subclass contains a default manager and sets the
_default_manager attribute on the class. Also sets up the _base_manager
points to a plain Manager instance (which could be the same as
_default_manager if it's not a subclass of Manager). | 625941ee293b9510aa2c37ee |
def load(filepath: str) -> tuple[Optional[Version], Optional[str], Optional[str]]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> extractor = FILENAMES_TO_EXTRACTORS[Path(filepath).name] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> raise ValueError(f"Unsupported manifest {Path(filepath).name!r}") <NEW_LINE> <... | Loads the manifest file using the correct extractor and returns a tuple of:
(old_version, package_name, repository_url) | 625941eea8ecb033257d3628 |
def clear(self): <NEW_LINE> <INDENT> if self.remove_when_clearing: <NEW_LINE> <INDENT> for job_id in self: <NEW_LINE> <INDENT> self.remove_job(job_id) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self._jobs.clear() | Clear All Jobs. | 625941ee3eb6a72ae02eca4a |
def split_lines(nb): <NEW_LINE> <INDENT> for ws in nb.worksheets: <NEW_LINE> <INDENT> for cell in ws.cells: <NEW_LINE> <INDENT> if cell.cell_type == 'code': <NEW_LINE> <INDENT> if 'input' in cell and isinstance(cell.input, string_types): <NEW_LINE> <INDENT> cell.input = cell.input.splitlines(True) <NEW_LINE> <DEDENT> f... | split likely multiline text into lists of strings
For file output more friendly to line-based VCS. ``rejoin_lines(nb)`` will
reverse the effects of ``split_lines(nb)``.
Used when writing JSON files. | 625941ee55399d3f05588c15 |
def transfer( self, user_id, amount, desc, client_ip=None, check_name="OPTION_CHECK", real_name=None, out_trade_no=None, device_info=None, ): <NEW_LINE> <INDENT> if not out_trade_no: <NEW_LINE> <INDENT> now = datetime.now() <NEW_LINE> out_trade_no = f"{self.mch_id}{now.strftime('%Y%m%d%H%M%S')}{random.randint(1000, 100... | 企业付款接口
:param user_id: 接受收红包的用户在公众号下的 openid
:param amount: 付款金额,单位分
:param desc: 付款说明
:param client_ip: 可选,调用接口机器的 IP 地址
:param check_name: 可选,校验用户姓名选项,
NO_CHECK:不校验真实姓名,
FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账),
OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)... | 625941eebde94217f3683349 |
def putToSendTableWithDate(sendResult, date): <NEW_LINE> <INDENT> dateKey = formatDate(date) <NEW_LINE> sendResultDict = dict((k, v) for k, v in sendResult.asDict().iteritems() if v) <NEW_LINE> return sendTable.new_item( hash_key=sendResult.emailSendDefinitionID, range_key=dateKey, attrs=sendResultDict).put() | :param sendResult: SendResult
:return: | 625941ee5510c4643540f933 |
def countries_code_list() -> list: <NEW_LINE> <INDENT> return [country for country in sorted(dictionary.items())] | Return a sorted list of tuples with all country names and country codes
Returns:
A list, alphabetically sorted, of tuples with all countries and organizations,
denominated in English, recognized by ICAO and their 3-letters code. The first
element of the tuple is the country name and the second is its 3-let... | 625941ee5fc7496912cc3edb |
def get_services(self, crc, num_rows = 10): <NEW_LINE> <INDENT> data = self.client.get_dep_board_with_details(num_rows, crc) <NEW_LINE> train_services = data.trainServices <NEW_LINE> self.trains = {} <NEW_LINE> i = 0 <NEW_LINE> for train in train_services.service: <NEW_LINE> <INDENT> origin = self.get_origin(train) <NE... | Returns dictionary of trains | 625941ee236d856c2ad44d3f |
def boundary_circle(r, h, nt=100): <NEW_LINE> <INDENT> theta = np.linspace(0, 2*np.pi, nt) <NEW_LINE> x= 70+r*np.cos(theta) <NEW_LINE> y= 35+r*np.sin(theta) <NEW_LINE> z = 4+h*np.ones(theta.shape) <NEW_LINE> return x, y, z | r - boundary circle radius
h - height above xOy-plane where the circle is included
returns the circle parameterization | 625941ee7b25080760e399b3 |
@pytest.fixture <NEW_LINE> def signing_account(): <NEW_LINE> <INDENT> return eth_account.Account.create() | account used for signing | 625941eea934411ee3751bf2 |
def __init__(self, context): <NEW_LINE> <INDENT> UpdateRepositoryCommand.__init__(self, context) <NEW_LINE> ImporterConfigMixin.__init__(self, **IMPORTER_CONFIGURATION_FLAGS) <NEW_LINE> PythonRepositoryOptions.__init__(self) | Initialize the update command.
:param context: The CLI context
:type context: pulp.client.extensions.core.ClientContext | 625941eede87d2750b8602f6 |
def sortedListToBST(head): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> cur = head <NEW_LINE> nums = [] <NEW_LINE> while cur: <NEW_LINE> <INDENT> nums.append(cur.val) <NEW_LINE> cur = cur.next <NEW_LINE> <DEDENT> def build(nums): <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDEN... | :type head: ListNode
:rtype: TreeNode | 625941eea05bb46b383ecd7a |
def qstring(parser, token): <NEW_LINE> <INDENT> bits = token.split_contents() <NEW_LINE> if len(bits) not in (1, 3): <NEW_LINE> <INDENT> raise template.TemplateSyntaxError("'%s' takes zero or 2 arguments " "(as var_name)." % bits[0]) <NEW_LINE> <DEDENT> if len(bits) == 1: <NEW_LINE> <INDENT> asvar = None <NEW_LINE> <DE... | Get the current request's query string.
USAGE: {% qstring %} or {% qstring as current_qstring %} | 625941ee2c8b7c6e89b35d1a |
def read_pickle(self, file_name): <NEW_LINE> <INDENT> f = open(file_name) <NEW_LINE> self.lines, self.gate_list, self.constant_lines, self.updated = pickle.load(f) <NEW_LINE> f.close() | Replaces the Cascade's current state with the state read from a file.
Right now it uses the pickle module to do this, but a better choice might be JSON.
c = Cascade({}) # Create an empty Cascade with no lines
c.read_pickle("file_name.pckl") | 625941eed7e4931a7ee9e47d |
def __init__(self, inp_size, num_units, scope_name='gated_gru'): <NEW_LINE> <INDENT> self.inp_size = inp_size <NEW_LINE> self.num_units = num_units <NEW_LINE> xav_init = tf.contrib.layers.xavier_initializer <NEW_LINE> with tf.variable_scope(scope_name): <NEW_LINE> <INDENT> self.W_0 = tf.get_variable('W0', shape=[num_un... | GRU implemetation.
Args:
inp_size: input_size
hidden_size: number of units of hidden variable | 625941eeaad79263cf390fa7 |
def publish(self, data, metadata=None, source=None, *, transient=None, update=False, **kwargs) -> None: <NEW_LINE> <INDENT> handlers = {} <NEW_LINE> if self.shell is not None: <NEW_LINE> <INDENT> handlers = getattr(self.shell, 'mime_renderers', {}) <NEW_LINE> <DEDENT> for mime, handler in handlers.items(): <NEW_LINE> <... | Publish data and metadata to all frontends.
See the ``display_data`` message in the messaging documentation for
more details about this message type.
The following MIME types are currently implemented:
* text/plain
* text/html
* text/markdown
* text/latex
* application/json
* application/javascript
* image/png
* ima... | 625941ee507cdc57c6307245 |
def get_operands(self): <NEW_LINE> <INDENT> return self.user_input[1], self.user_input[2] | Возвращает операнд (оба)
:return:
:rtype: | 625941eef9cc0f698b140b54 |
def contains(self, other: str) -> bool: <NEW_LINE> <INDENT> return os.path.commonpath([self]) == os.path.commonpath([self, Path.path(other)]) | Check whether another path is contained in this path.
:param other: the other path
:return: `True` is this path contains the other path, `False` of not | 625941ee046cf37aa974d29f |
def getCriticalStress(self, l_ef): <NEW_LINE> <INDENT> E_05= self.wood.getFifthPercentileValueOfModulusOfElasticityAlongTheGrain() <NEW_LINE> G_05= self.wood.getFifthPercentileValueOfShearModulus() <NEW_LINE> Iy= self.Iy() <NEW_LINE> Itor= self.J() <NEW_LINE> return math.pi*math.sqrt(E_05*Iy*G_05*Itor)/l_ef/self.Wzel() | Return the critical bending stress calculated according to the
classical theory of stability, using 5-percentile stiffness
values (expression 6.31 of EC5).
:param l_ef: effective length of the beam, depending on the
support conditions and the load configuration,
according to Table ... | 625941eeb57a9660fec33dea |
def PolygonFilterRemove(self, filt): <NEW_LINE> <INDENT> for mm in self.measurements: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> mm.polygon_filter_rm(filt) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pass | Removes a polygon filter from all elements of the analysis. | 625941ee4f6381625f114f99 |
@mock.patch("Notify.sdlog.error") <NEW_LINE> @mock.patch("Notify.sdlog.warning") <NEW_LINE> @mock.patch("Notify.sdlog.info") <NEW_LINE> def test_warning_not_shown_if_warning_threshold_not_exceeded( mocked_info, mocked_warning, mocked_error ): <NEW_LINE> <INDENT> with TemporaryDirectory() as tmpdir, mock.patch( "Notify.... | Another high priority case: we don't want to warn the user if they've
recently run the updater successfully. | 625941eee8904600ed9f2494 |
def __getattr__(self, item): <NEW_LINE> <INDENT> if self.__called: <NEW_LINE> <INDENT> self._reset() <NEW_LINE> <DEDENT> if item == "xml": <NEW_LINE> <INDENT> self.__xml = True <NEW_LINE> <DEDENT> elif item == "nolock": <NEW_LINE> <INDENT> self.__no_lock = True <NEW_LINE> <DEDENT> elif item == "noraise": <NEW_LINE> <IN... | Call configurator.
:param item:
:return: | 625941ee4428ac0f6e5bad55 |
def compute_gradient(tx, error_vector): <NEW_LINE> <INDENT> return - tx.T.dot(error_vector) / error_vector.size | Computes the gradient for the mean squared error loss function.
Args:
y: labels
error_vector: error vector computed for a specific data set and model
Returns:
gradient: the gradient vector computed according to its definition | 625941ee1f037a2d8b94675a |
def convert_label(y): <NEW_LINE> <INDENT> for i in range(len(y)): <NEW_LINE> <INDENT> if y[i] == -1: <NEW_LINE> <INDENT> y[i] = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> y[i] = 1 <NEW_LINE> <DEDENT> <DEDENT> return y | used in avg_prediction_error function** | 625941ee91af0d3eaac9bf7b |
def DoTestWithStatus(self, expected_status): <NEW_LINE> <INDENT> positional = [ 'from@nowhere.com', 'subject', 'body', ] <NEW_LINE> parameters = { 'reply_to': 'reply@nowhere.com', } <NEW_LINE> def FakeMakeSyncCall(service, method, request, response): <NEW_LINE> <INDENT> self.assertEqual('mail', service) <NEW_LINE> sel... | Perform general send_mail_to_admins with expected status.
Args:
expected_status: Expected status, if not OK, will raise exception.
Doing is used to ensure that the send_mail function passes on the
error it receives from the api proxy. | 625941ee507cdc57c6307246 |
def get_download_link(self, link): <NEW_LINE> <INDENT> extract, link = self.engine.get_download_link(link) <NEW_LINE> return extract, link | Parse the contents from the Zippyshare site to extract the actual download link
of the file. The zippyshare site has javascript logic around how to construct
the download link. | 625941eed18da76e23532a3b |
def diagonalize(Q): <NEW_LINE> <INDENT> Q = np.asarray(Q) <NEW_LINE> _, v = np.linalg.eig(Q) <NEW_LINE> v_inv = np.linalg.inv(v) <NEW_LINE> Qdiag = v_inv @ Q @ v <NEW_LINE> assert Q.shape == Qdiag.shape <NEW_LINE> return Qdiag | Q(..., M, M) array: Matrices for which the diagonalized version will be computed
It diagonalizes a stack of matrices of any order (2 by 2 for our application) | 625941ee8c0ade5d55d3ef1d |
def get_user(request): <NEW_LINE> <INDENT> from .models import AnonymousUser <NEW_LINE> user = None <NEW_LINE> try: <NEW_LINE> <INDENT> user_id = _get_user_session_key(request) <NEW_LINE> backend_path = request.session[BACKEND_SESSION_KEY] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT... | Returns the user model instance associated with the given request session.
If no user is retrieved an instance of `AnonymousUser` is returned. | 625941ee24f1403a926010bf |
def observe(self, observation, gameState): <NEW_LINE> <INDENT> noisyDistance = observation <NEW_LINE> emissionModel = busters.getObservationDistribution(noisyDistance) <NEW_LINE> pacmanPosition = gameState.getPacmanPosition() <NEW_LINE> if noisyDistance is None: <NEW_LINE> <INDENT> counter = util.Counter() <NEW_LINE> c... | Update beliefs based on the given distance observation. Make sure to
handle the special case where all particles have weight 0 after
reweighting based on observation. If this happens, resample particles
uniformly at random from the set of legal positions
(self.legalPositions).
A correct implementation will handle two ... | 625941eebd1bec0571d90b8d |
def __init__(self, gray_level: int = 256): <NEW_LINE> <INDENT> if not 0 < gray_level <= 256: <NEW_LINE> <INDENT> raise ValueError("Expected gray level in the range of (1, 256)") <NEW_LINE> <DEDENT> self._gray_level = gray_level <NEW_LINE> self._supported_angle = [GLCMAngle.Ang_0, GLCMAngle.Ang_45, GLCMAngle.Ang_90, GLC... | Init a GLCM computer
Args:
gray_level: the gray level of expected glcm | 625941ee2ae34c7f2600d68e |
def searchMatrix(self, matrix, target): <NEW_LINE> <INDENT> if not matrix or target is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> row = self.search_for_row(matrix, 0, len(matrix) - 1, target) <NEW_LINE> if row == -1: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return s... | :type matrix: List[List[int]]
:type target: int
:rtype: bool | 625941ee7c178a314d6ef9c6 |
def get_arxiv_categories(arxiv_id=None, title=None, doi=None): <NEW_LINE> <INDENT> if arxiv_id is None and title is None and doi is None: <NEW_LINE> <INDENT> raise ValueError('One of the arxiv_id, title and doi parameters has to be different then None.') <NEW_LINE> <DEDENT> arxiv_id = clean_arxiv(arxiv_id) <NEW_LINE> q... | Return a list of arxiv categories based on the specified arXiv identifier and/or title and/or doi.
The identifier and title (if given) are both forwarded to the arXiv api.
First element of the returned list is the primary category.
In case categories cannot be found, empty list is returned. | 625941ee656771135c3ebdd3 |
def compile_to_code(definition, config=None): <NEW_LINE> <INDENT> name, code_generator = _factory(definition, config) <NEW_LINE> return name, code_generator.code | Generate validation function as plain Python code.
:argument dict definition: Json schema definition
:argument Config config: Config object
:returns: tuple(str, str): main validation function name, actual code
Exception :any:`JsonSchemaException` is thrown when validation fails.
Example:
.. code-block:: python
... | 625941ee4a966d76dd551573 |
def test_get_category_1_word_title(): <NEW_LINE> <INDENT> extracted_cat = get_category_from_title('Jacket') <NEW_LINE> assert extracted_cat == 'jackets', 'expected %s but was %s' % ( 'jackets', extracted_cat) | Test get_category_from_title function can extract a category
from a title containing only one word. | 625941ee283ffb24f3c55e59 |
def _updateItem(self,item,index): <NEW_LINE> <INDENT> item.wx = index <NEW_LINE> Ctrl._updateItem(self,item,index) | Same as Ctrl, but update also index. | 625941eeb7558d58953c5466 |
def parse_fcports(vios, vios_info): <NEW_LINE> <INDENT> LOG.debug('Extracting FC Ports from VIOS K2 entry.') <NEW_LINE> fcports = {} <NEW_LINE> adapterPath = str('./PartitionIOConfiguration/ProfileIOSlots/' 'ProfileIOSlot/AssociatedIOSlot/RelatedIOAdapter/' 'PhysicalFibreChannelAdapter') <NEW_LINE> fcAdapters = vios.el... | Get a list of the FC Ports related to a specific VIOS.
'vios' passed in is the K2 response VIOS entry of a previous call.
We traverse the hierarchy of objects to find the desired
information. | 625941eebaa26c4b54cb1677 |
def api_call(cmd, **kwargs): <NEW_LINE> <INDENT> data = DATA.copy() <NEW_LINE> data.update({'unique_id': uuid1(), 'cmd': cmd}, **kwargs) <NEW_LINE> query_uri = API_URI + '?' + urlencode(data) <NEW_LINE> result = json.load(TextIOWrapper(urllib.request.urlopen(query_uri))) <NEW_LINE> if result['result'] != 'success': <NE... | Invoke the DreamHost API method *cmd*. | 625941ee96565a6dacc8fc27 |
def join_indexed_dataframes(lhs, rhs, how='left', lsuffix='', rsuffix=''): <NEW_LINE> <INDENT> (lhs, rhs), divisions, parts = align_partitions(lhs, rhs) <NEW_LINE> divisions, parts = require(divisions, parts, required[how]) <NEW_LINE> left_empty = lhs._empty_partition <NEW_LINE> right_empty = rhs._empty_partition <NEW_... | Join two partitiond dataframes along their index | 625941ee6e29344779a62b6f |
def color_randomly(graph, bias): <NEW_LINE> <INDENT> from random import uniform <NEW_LINE> assert sum(bias.values()) == 1, "The biases must sum to 1" <NEW_LINE> cutoffs = list() <NEW_LINE> cut = 0 <NEW_LINE> for color, p in bias.items(): <NEW_LINE> <INDENT> cut += p <NEW_LINE> cutoffs.append((cut, color)) <NEW_LIN... | Return a random coloring of the given graph based on the given color
bias.
For example, if ``bias = {'green': 0.4, 'red': 0.5, 'yellow': 0.1}``,
then for each vertex v in the graph, v would be assigned the color 'green'
with a probability of 0.4, 'red' with a probability of 0.5, and 'yellow'
with a probability of 0.1.... | 625941ee287bf620b61d3fbe |
def get_mean_and_stddevs(self, sites, rup, dists, imt, stddev_types): <NEW_LINE> <INDENT> mean = self._get_mean(imt, rup.mag, rup.hypo_depth, dists.rrup, d=0.12) <NEW_LINE> stddevs = self._get_stddevs(stddev_types, np.exp(mean)) <NEW_LINE> return mean, stddevs | Implements equation 3.5.1-1 page 148 for mean value and equation
3.5.5-1 page 151 for total standard deviation.
See :meth:`superclass method
<.base.GroundShakingIntensityModel.get_mean_and_stddevs>`
for spec of input and result values. | 625941ee10dbd63aa1bd3100 |
def get_data(token, to_timestamp): <NEW_LINE> <INDENT> url = f"https://min-api.cryptocompare.com/data/histoday?fsym={token}&tsym=USD&limit=2000&toTs={to_timestamp}" <NEW_LINE> r = requests.get(url) <NEW_LINE> ipdata = r.json() <NEW_LINE> return ipdata | Query the API for 2000 days historical price data starting from "date". | 625941ee442bda511e8be96e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.