code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def test_unsuitable_timestamp_regex_fail(self): <NEW_LINE> <INDENT> testinput = '2020-06-02 19:03:17' <NEW_LINE> with self.assertRaises(kml.InvalidDateTimeString): <NEW_LINE> <INDENT> kml.convert_timestamp_to_kmltimestamp(testinput) | test a timestamp that doesn't match the regex
Note:
change this when i come up with a better regex for datetimes | 625941e2a17c0f6771cbe40d |
def getTau(self): <NEW_LINE> <INDENT> tau = self.Tau <NEW_LINE> return tau/np.nansum(tau) | Method to return the mixing proportion attribute of the gmobj
:return: | 625941e2dd821e528d63b563 |
def incidence_matrix(syst): <NEW_LINE> <INDENT> nw = len(syst.wires) <NEW_LINE> ns = len(syst.subsystems) <NEW_LINE> inc_mat = np.zeros((nw, ns), dtype=np.int8) <NEW_LINE> wires_ind = {w:i for i,w in enumerate(syst.wires)} <NEW_LINE> for s_ind, s in enumerate(syst.subsystems): <NEW_LINE> <INDENT> for p in s.ports: <NEW... | computes the incidence matrix of the system `syst` taking into account
the IO Ports (Port direction 'in' and 'out').
An ouput port yields +1, an input -1 | 625941e263b5f9789fde74a3 |
def run_tasks(repetitions, params, runTask, withmp=True): <NEW_LINE> <INDENT> all_reps_params = ((rep_i, param) for param,rep_i in it.product(params, xrange(repetitions))) <NEW_LINE> if withmp: <NEW_LINE> <INDENT> pool = mp.Pool(3) <NEW_LINE> pool.map(runTask, all_reps_params) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE... | repetitions - integer number repetitions per param
steps - integer number of steps per task
params - a list of all param values to be simulated
withmp - boolean enables multiprocessing, otherwise run serially | 625941e263d6d428bbe448ae |
def listify(self) -> None: <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.listy.append([self.results[num] for num in range(self.init, self.number)]) <NEW_LINE> logging.debug('Appended a result list') <NEW_LINE> self.init += self.num <NEW_LINE> self.number += self.num <NEW_LINE> <DEDEN... | List-ify results
Take a self.result and create a list with the results
Each list contains self.num items or less
This is called implicitly by self.parse_source() | 625941e2379a373c97cfaf04 |
def get_scans_and_eels_fnames(): <NEW_LINE> <INDENT> c_to_o_stem = gui_fnames(title="Select SiC to SiO2 STEM scans...") <NEW_LINE> c_to_o_eels = gui_fnames(title="Select SiC to SiO2 EELS lines...") <NEW_LINE> o_to_c_stem = gui_fnames(title="Select SiO2 to SiC STEM scans...") <NEW_LINE> o_to_c_eels = gui_fnames(title="S... | Get the list of file names for all the line scans selected. This
function will pop up four dialogs asking for STEM and EELS files for SiC
to SiO2 direction and SiO2 to SiC direction. The method also sorts the
lists in natural order so they are in an order that makes sense.
Returns
-------
c_to_o_stem, c_to_o_eels, o_t... | 625941e2cad5886f8bd27396 |
def _load(stream) -> dict: <NEW_LINE> <INDENT> return yaml.load(stream) | :param stream:
:return: a object serialized in yaml
:rtype: object | 625941e20a366e3fb873ebdb |
def default_frame(self): <NEW_LINE> <INDENT> def_bframe = self._base_space.default_frame() <NEW_LINE> if self._def_frame is None and def_bframe is not None: <NEW_LINE> <INDENT> if def_bframe._dest_map == self._dest_map: <NEW_LINE> <INDENT> self._def_frame = def_bframe <NEW_LINE> <DEDENT> <DEDENT> return self._def_frame | Return the default vector frame defined on ``self``.
By *vector frame*, it is meant a field on the manifold that provides,
at each point `p`, a vector basis of the pulled back tangent space at
`p`.
If the destination map is the identity map, the default frame is the
the first one defined on the manifold, usually the ... | 625941e201c39578d7e751f9 |
def coefficients_from_source(self, avec, bvec, rscale): <NEW_LINE> <INDENT> raise NotImplementedError | Form an expansion from a source point.
:arg avec: vector from source to center.
:arg bvec: vector from center to target. Not usually necessary,
except for line-Taylor expansion.
:returns: a list of :mod:`sympy` expressions representing
the coefficients of the expansion. | 625941e2ff9c53063f47c5af |
def tensored_calib_circ_creation(): <NEW_LINE> <INDENT> mit_pattern = [[2], [4, 1]] <NEW_LINE> meas_layout = [2, 4, 1] <NEW_LINE> qr = qiskit.QuantumRegister(5) <NEW_LINE> meas_calibs, mit_pattern = tensored_meas_cal(mit_pattern, qr=qr) <NEW_LINE> cr = qiskit.ClassicalRegister(3) <NEW_LINE> ghz_circ = qiskit.QuantumCir... | create tensored measurement calibration circuits and a GHZ state circuit for the tests
Returns:
QuantumCircuit: the tensored measurement calibration circuit
list[list[int]]: the mitigation pattern
QuantumCircuit: ghz circuit with 5 qubits (3 are used) | 625941e23cc13d1c6d3c7736 |
def encode_the_atoms_bonds(v, atom, orders): <NEW_LINE> <INDENT> idx = orders.index(atom.GetIdx()) <NEW_LINE> bv = [] <NEW_LINE> bonds = [] <NEW_LINE> for bond in atom.GetBonds(): <NEW_LINE> <INDENT> btype = int(bond.GetBondType()) <NEW_LINE> bidx, eidx = bond.GetBeginAtomIdx(), bond.GetEndAtomIdx() <NEW_LINE> fromatom... | encode the bonds for the given atom
:param atom: the atom to encode
:param v: the molvector to append to
:param orders: the atom orders to use for this mol vector | 625941e29b70327d1c4e1194 |
def _print_error(self, error, msg): <NEW_LINE> <INDENT> raise self.except_osv(error, msg) | Shows an error on the screen
| 625941e24a966d76dd5513d0 |
def compile(self, X_train: np.ndarray, y_train: np.ndarray, lr: float, epsilon: float, gamma: float, imb_ratio: float, replay_buffer_max_length: int, layers: dict) -> None: <NEW_LINE> <INDENT> dense_layers = layers.get("dense") <NEW_LINE> conv_layers = layers.get("conv") <NEW_LINE> dropout_layers = layers.get("dropout"... | Create the Q-network, agent and policy
Args:
X_train: A np.ndarray for training samples.
y_train: A np.ndarray for the class labels of the training samples.
lr: learn rate for the optimizer (default Adam)
epsilon: Used for the default epsilon greedy policy for choosing a random action.
gamma: The d... | 625941e23c8af77a43ae3b61 |
def __init__(self, new_secret: typing.Optional[str] = None, reason: typing.Optional[str] = None) -> None: <NEW_LINE> <INDENT> self.new_secret = new_secret <NEW_LINE> self.reason = reason | Initialize the :class:`Connection.UpdateSecret` class | 625941e297e22403b379d359 |
def collectImages(self): <NEW_LINE> <INDENT> for i in range(1,53): <NEW_LINE> <INDENT> x = "images/" + str(i) + ".gif" <NEW_LINE> y = Image(Point(50,50), x) <NEW_LINE> self.images.append(y) <NEW_LINE> <DEDENT> self.images.reverse() | Collects the 52 cards from the same location as the python file. | 625941e2167d2b6e31218f53 |
@core_wrapper <NEW_LINE> def delete_key(user, key_id): <NEW_LINE> <INDENT> log.info("Deleting key with id '%s'.", key_id) <NEW_LINE> if key_id not in user.keypairs: <NEW_LINE> <INDENT> raise KeypairNotFoundError(key_id) <NEW_LINE> <DEDENT> keypair = user.keypairs[key_id] <NEW_LINE> with user.lock_n_load(): <NEW_LINE> <... | Deletes given keypair.
If key was default, then it checks
if there are still keys left and assignes another one as default.
@param user: The User
@param key_id: The key_id to be deleted
@return: Returns nothing | 625941e207f4c71912b11842 |
def copy (): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> copy = copyfile('//cash' + con + '/CashIn/log/CashInTerminalWpf_debug_{}-{}-{}_00000.txt'.format(gun, ay, il), 'C:/logs/terminal.txt') <NEW_LINE> print(threading.current_thread().getName(), 'is Exiting') <NEW_LINE> <DEDENT> except FileNotFoundError: <NEW_LINE> <... | With threads copy currently file. if code give any error day ahead we can as see | 625941e20383005118ecf99f |
def writeXML(ofile, polylist, withHeader=False): <NEW_LINE> <INDENT> f, cl = getWritableObject(ofile) <NEW_LINE> if withHeader: <NEW_LINE> <INDENT> f.write('<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>\n') <NEW_LINE> <DEDENT> for p in polylist: <NEW_LINE> <INDENT> l = ['<polygon contours="%d" area="%g" x... | Write a readable representation of the Polygons in polylist to a XML file.
A simple header can be added to make the file parsable.
:Arguments:
- ofile: see above
- polylist: sequence of Polygons
- optional withHeader: bool
:Returns:
ofile object | 625941e299cbb53fe6792fa3 |
def depthFirstSearch(self, root): <NEW_LINE> <INDENT> Parameter.checkIndex(root, 0, self.size) <NEW_LINE> currentPath = [root] <NEW_LINE> visited = set() <NEW_LINE> searchPath = [] <NEW_LINE> while len(currentPath) != 0: <NEW_LINE> <INDENT> currentVertex = currentPath[-1] <NEW_LINE> if currentVertex not in visited: <NE... | Depth first search starting from a particular vertex. Returns a list of
connected vertices in the order they were found.
:param root: The index of the root vertex.
:type root: :class:`int`
:returns: A list of vertices connected to the input one via a path in the graph. | 625941e2e76e3b2f99f3abc4 |
def test_event_stop_propagation(): <NEW_LINE> <INDENT> root_called = 0 <NEW_LINE> child_called = 0 <NEW_LINE> def root_callback(event): <NEW_LINE> <INDENT> nonlocal root_called <NEW_LINE> root_called += 1 <NEW_LINE> <DEDENT> def child_callback(event): <NEW_LINE> <INDENT> nonlocal child_called <NEW_LINE> child_called +=... | Check that bubbling stops when stop_propagation
is called on an event. | 625941e23c8af77a43ae3b62 |
def canonicalize(id, thingtype=None): <NEW_LINE> <INDENT> assert is_sloppy_id(id), "precondition: `id' must be an id." + " -- " + "id: %s" % repr(id) <NEW_LINE> if len(id) == 20: <NEW_LINE> <INDENT> return id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return mojosixbit.a2b(id) | Use this function to canonicalize an id of one of the "bare" forms (a 20-byte binary string
or the mojosixbit encoding thereof) into the canonical form. Useful for calling on ids
received from other brokers over the wire.
@param id an id, which may be a bare binary or bare mojosixbit encoded id, or a full canonical i... | 625941e2656771135c3ebc31 |
def AcquireFromGCE(account=None): <NEW_LINE> <INDENT> credentials = oauth2client_gce.AppAssertionCredentials(email=account) <NEW_LINE> Refresh(credentials) <NEW_LINE> return credentials | Get credentials from a GCE metadata server.
Args:
account: str, The account name to use. If none, the default is used.
Returns:
client.Credentials, Credentials taken from the metadata server.
Raises:
c_gce.CannotConnectToMetadataServerException: If the metadata server cannot
be reached.
TokenRefreshError... | 625941e2baa26c4b54cb14da |
def parse_download_link(self, line, in_download): <NEW_LINE> <INDENT> return self.category.parse_download_link('id="linux-bundle"', line, in_download) | Parse Android Studio download link, expect to find a md5sum and a url | 625941e28e05c05ec3eea735 |
def block_orthogonal(tensor, split_sizes, gain=1.0): <NEW_LINE> <INDENT> sizes = list(tensor.size()) <NEW_LINE> if any([a % b != 0 for a, b in zip(sizes, split_sizes)]): <NEW_LINE> <INDENT> raise ValueError("tensor dimensions must be divisible by their respective " "split_sizes. Found size: {} and split_sizes: {}".form... | An initializer which allows initializing model parameters in "blocks". This is helpful
in the case of recurrent models which use multiple gates applied to linear projections,
which can be computed efficiently if they are concatenated together. However, they are
separate parameters which should be initialized independen... | 625941e2f9cc0f698b1409b6 |
def convolution_leaderboard_cyclopeptide_sequencing(input_file): <NEW_LINE> <INDENT> infile = open(input_file, 'r') <NEW_LINE> M = int(infile.readline().rstrip()) <NEW_LINE> N = int(infile.readline().rstrip()) <NEW_LINE> exp_spectrum = infile.readline().rstrip().split() <NEW_LINE> print('M', M) <NEW_LINE> print('N', N)... | (file) -> file
Given an integer N, an experimental spectrum of mass integers from the
input file, return the sequence of the leader peptide in the form of
amino acid mass-dased separated. | 625941e2d99f1b3c44c67946 |
@app.route('/', methods=['GET']) <NEW_LINE> @waitready <NEW_LINE> @nocache <NEW_LINE> def index(): <NEW_LINE> <INDENT> if 'id' in session: <NEW_LINE> <INDENT> log.info('user {} opened map.'.format(session['id'])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> session['id'] = os.urandom(8) <NEW_LINE> log.info('New sessio... | The base web page for the map. We grab the bbox from the user
using flasks request library (handles the web stuff).
We execute the data query, and use it to render a response. | 625941e2bde94217f36831ab |
def words(sentence): <NEW_LINE> <INDENT> return "".join(e for e in sentence if e not in string.punctuation).lower().split() | Tokenizes a sentence.
Returns a list of lowercase words containing no punctuation. | 625941e2cad5886f8bd27397 |
def handle_tz(self, input, request_nick): <NEW_LINE> <INDENT> assert input[0] == "datestz" <NEW_LINE> tz_offset = None <NEW_LINE> tz_is_valid = False <NEW_LINE> qnick = request_nick <NEW_LINE> show_offset = False <NEW_LINE> input_len = len(input) <NEW_LINE> if input_len == 1: <NEW_LINE> <INDENT> show_offset = True <NEW... | change or reset the time zone setting
.valid input list format
----------------------
[0] [1] [2]
----------------------
datestz nick +/-offset
datestz +/-offset
---------------------- | 625941e263f4b57ef00014cc |
def loadNodeWithDefault(_tag,_default): <NEW_LINE> <INDENT> if self.xml_data is not None: <NEW_LINE> <INDENT> if self.xml_data.find(_tag) is not None: <NEW_LINE> <INDENT> if self.xml_data.find(_tag).text is None: <NEW_LINE> <INDENT> return _default <NEW_LINE> <DEDENT> else: return self.xml_data.find(_tag).text <NEW_LIN... | An anonymous inner function to quickly pull from XML, giving a default value if the node
is not present or otherwise can't be loaded.
Parameters
-----------
_node : Element
The XML tree to be searching from. The node directly above the one you're looking for.
_tag : string
The name of the XML tag to search for... | 625941e2460517430c394539 |
def _update_major_gridlines( self, longrid=None, latgrid=None, lonarray=None, latarray=None, loninline=None, latinline=None, labelpad=None, rotatelabels=None, nsteps=None, ): <NEW_LINE> <INDENT> gl = self._gridlines_major <NEW_LINE> if gl is None: <NEW_LINE> <INDENT> gl = self._gridlines_major = self._init_gridlines() ... | Update major gridlines. | 625941e2460517430c39453a |
def build_flood_rules(self, vlan, modify=False): <NEW_LINE> <INDENT> command = ofp.OFPFC_ADD <NEW_LINE> if modify: <NEW_LINE> <INDENT> command = ofp.OFPFC_MODIFY_STRICT <NEW_LINE> <DEDENT> flood_priority = self.dp.low_priority <NEW_LINE> flood_eth_dst_matches = [] <NEW_LINE> if vlan.unicast_flood: <NEW_LINE> <INDENT> f... | Add flows to flood packets to unknown destinations on a VLAN. | 625941e210dbd63aa1bd2f60 |
def post_elem(self, elem, timeout=None): <NEW_LINE> <INDENT> from . import imcxmlcodec as xc <NEW_LINE> if self._is_stale_cookie(elem): <NEW_LINE> <INDENT> elem.attrib['cookie'] = self.cookie <NEW_LINE> <DEDENT> self.dump_xml_request(elem) <NEW_LINE> xml_str = xc.to_xml_str(elem) <NEW_LINE> response_str = self.post_xml... | sends the request and receives the response from the imc server using xml
element
Args:
elem (xml element)
timeout (int): if set, it is used as timeout in secs for urllib2
Returns:
response xml string
Example:
response = post_elem(elem=xml_element) | 625941e2b545ff76a89141d3 |
def bounds(self, string): <NEW_LINE> <INDENT> return string | Return the string with proper bounds. | 625941e2aad79263cf390e05 |
def create_db_tables(): <NEW_LINE> <INDENT> sys.path.append(os.getcwd()) <NEW_LINE> from horreum.db.terraform import ResourceTemplateDB <NEW_LINE> TABLE_LIST = [ResourceTemplateDB] <NEW_LINE> DYNAMODB_URL = "http://localhost:8000" <NEW_LINE> for table in TABLE_LIST: <NEW_LINE> <INDENT> table.Meta.host = DYNAMODB_URL <N... | Ensures all specified tables are present in local DynamoDB instance. | 625941e2627d3e7fe0d6920f |
def DescribeTIWDailyUsage(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("DescribeTIWDailyUsage", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.DescribeTIWDailyU... | 查询互动白板天维度计费用量。
1. 单次查询统计区间最多不能超过31天。
2. 由于统计延迟等原因,暂时不支持查询当天数据,建议在次日上午7点以后再来查询前一天的用量,例如在10月27日上午7点后,再来查询到10月26日整天的用量
:param request: Request instance for DescribeTIWDailyUsage.
:type request: :class:`tencentcloud.tiw.v20190919.models.DescribeTIWDailyUsageRequest`
:rtype: :class:`tencentcloud.tiw.v20190919.models.Descri... | 625941e2b57a9660fec33c47 |
def _compute_plane_coordinates_at_all_locations(self): <NEW_LINE> <INDENT> self.variables["plane_x_coordinate_at_u_location"] = _mi( self.variables["plane_x_coordinate_at_t_location"]) <NEW_LINE> self.variables["plane_x_coordinate_at_v_location"] = _mj( self.variables["plane_x_coordinate_at_t_location"]) <NEW_LINE> sel... | Define the plane coordinates at u,v,f location.
Namely :
- plane_x_coordinate_at_[u,v,f]_location,
- plane_y_coordinate_at_[u,v,f]_location, | 625941e2090684286d50f0a9 |
def __init__(self, id=None): <NEW_LINE> <INDENT> self._id = None <NEW_LINE> self.discriminator = None <NEW_LINE> self.id = id | AlertTeamMeta - a model defined in Swagger | 625941e2d7e4931a7ee9e2dd |
def apply_throttle_conditions(self, raw_crash): <NEW_LINE> <INDENT> for key, condition, percentage in self.processed_throttle_conditions: <NEW_LINE> <INDENT> throttle_match = False <NEW_LINE> try: <NEW_LINE> <INDENT> if key == '*': <NEW_LINE> <INDENT> throttle_match = condition(raw_crash) <NEW_LINE> <DEDENT> else: <NEW... | cycle through the throttle conditions until one matches or we fall
off the end of the list.
returns:
True - reject
False - accept | 625941e28c3a87329515877d |
def load(fname): <NEW_LINE> <INDENT> f = open(fname ,"r") <NEW_LINE> lines = f.readline() <NEW_LINE> rooms = [] <NEW_LINE> things_holder = [] <NEW_LINE> while lines != "": <NEW_LINE> <INDENT> lst = lines.split() <NEW_LINE> if lst[0] == "room": <NEW_LINE> <INDENT> room = Room(int(lst[1][1:])) <NEW_LINE> room.name = " ".... | Reads the name of a text file, fname and returns a World constructed from
the information in the text file following the instruction as stated in the
assignment
Effects: Reads the file fname and mutates players,exits, thing and rooms as
per the instructions
load: Str -> None | 625941e294891a1f4081be69 |
def tz2z(tzGyr): <NEW_LINE> <INDENT> if tzGyr.any() <= 0: <NEW_LINE> <INDENT> raise ValueError('Universe age must be positive.') <NEW_LINE> <DEDENT> tl = t0() - tzGyr <NEW_LINE> z = tl2z(tl) <NEW_LINE> return z | Calculates the redshift z corresponding to age of the universe tzGyr
given in Gyr.
@type tzGyr: float
@param tzGyr: age of the universe in Gyr
@rtype: float
@return: redshift
@note: Raises ValueError if Universe age not positive | 625941e2d4950a0f3b08c708 |
def _construct_conservation_from_prototypes( cl_prototypes: CL_Prototype, pysb_model: pysb.Model ) -> List[ConservationLaw]: <NEW_LINE> <INDENT> conservation_laws = [] <NEW_LINE> for monomer_name in cl_prototypes: <NEW_LINE> <INDENT> target_index = cl_prototypes[monomer_name]['target_index'] <NEW_LINE> target_expressio... | Computes the algebraic expression for the total amount of a given
monomer
:param cl_prototypes:
see return of :func:`_generate_cl_prototypes`
:param pysb_model:
pysb model
:return:
list of dicts describing conservation laws | 625941e226068e7796caf0a2 |
def _inherit_constraints(constraints, parent_child_class_dict): <NEW_LINE> <INDENT> net_constraints = deepcopy(constraints) <NEW_LINE> error_messages = [] <NEW_LINE> changes = 1 <NEW_LINE> while changes > 0: <NEW_LINE> <INDENT> changes = 0 <NEW_LINE> for parent_onto_class_uri, children_onto_class_uris in parent_child_c... | This function belongs in the Ontology class.
It is implemented outside the Ontology class to facilitate unit testing
Arguments:
constraints Dictionary {onto_class_uri:ClassConstraints|DatatypeConstraints|None}
parent_child_class_dict Dictionary {parent_onto_class_uri:[child_onto_class_uri]}
Re... | 625941e2377c676e91272565 |
def get_item_by_index(self, index): <NEW_LINE> <INDENT> return self._d.peekitem(index) | Get the (t, value) pair of the time series by index. | 625941e2956e5f7376d7122a |
def sphere(radius=1.0, num_segs=16, degrees=360, axis=pm.Vec3(0, 0, 1), origin=pm.Point3(0, 0, 0), normal=True, colour=False, texcoord=False): <NEW_LINE> <INDENT> polys = [] <NEW_LINE> axis = pm.Vec3(axis) <NEW_LINE> axis.normalize() <NEW_LINE> points = GetPointsForArc(degrees, num_segs, True) <NEW_LINE> zPoints = GetP... | Return a geom node representing a cylinder. | 625941e2c432627299f05007 |
@hug.put() <NEW_LINE> @hug.cli() <NEW_LINE> @hug.local() <NEW_LINE> def delete(id: hug.types.number): <NEW_LINE> <INDENT> todo = session.query(ToDo).get(id) <NEW_LINE> session.delete(todo) <NEW_LINE> session.commit() <NEW_LINE> if not session.query(ToDo).get(id): <NEW_LINE> <INDENT> result = 'Success' <NEW_LINE> <DEDEN... | Delete the todo item by ID | 625941e229b78933be1e5a65 |
@receiver(post_save,sender=User) <NEW_LINE> def save_profile(sender,instance,**kwargs): <NEW_LINE> <INDENT> instance.profile.save() | saves user profile | 625941e25f7d997b87174e59 |
def get_indexes(self, table_name, schema=None, **kw): <NEW_LINE> <INDENT> return self.dialect.get_indexes( self.bind, table_name, schema, info_cache=self.info_cache, **kw ) | Return information about indexes in `table_name`.
Given a string `table_name` and an optional string `schema`, return
index information as a list of dicts with these keys:
* ``name`` -
the index's name
* ``column_names`` -
list of column names in order
* ``unique`` -
boolean
* ``column_sorting`` -
optional... | 625941e2435de62698dfe00c |
def customAugmentation(img): <NEW_LINE> <INDENT> r = np.random.randint(low=1, high=7) <NEW_LINE> if r == 1: <NEW_LINE> <INDENT> temp = tf.image.rot90(img, k=np.random.randint(low=1, high=4)) <NEW_LINE> <DEDENT> elif r == 2: <NEW_LINE> <INDENT> temp = tf.image.random_brightness(img, max_delta=0.2) <NEW_LINE> <DEDENT> el... | This function takes in an image and randomly applies an image augmentation
method with random magnitude to create an new image. The new image is returned. | 625941e250485f2cf553d159 |
@auth.route('/user', methods=['POST']) <NEW_LINE> def login(): <NEW_LINE> <INDENT> request_params = request.json <NEW_LINE> if request_params is None: <NEW_LINE> <INDENT> raise BadRequest() <NEW_LINE> <DEDENT> email = request_params.get('email') <NEW_LINE> password = request_params.get('password') <NEW_LINE> try: <NEW_... | User login
---
tags:
- auth
parameters:
- name: email
in: formData
type: string
required: true
- name: password
in: formData
type: string
required: true
responses:
200:
description: Login successful
schema:
type: object
required... | 625941e250485f2cf553d15a |
def setup_options(self): <NEW_LINE> <INDENT> if self.collection is not None: <NEW_LINE> <INDENT> self.collection.append(self.rpc) <NEW_LINE> <DEDENT> rpc = self.rpc <NEW_LINE> if self.inheritance == 'concrete' and self.polymorphic: <NEW_LINE> <INDENT> raise NotImplementedError("Polymorphic concrete inheritance is " "no... | Setup any values that might depend on using_options. For example, the
rpcname. | 625941e232920d7e50b28592 |
def group_by_class(self, data, target): <NEW_LINE> <INDENT> separated = [[x for x, t in zip(data, target) if t == c] for c in self.target_values] <NEW_LINE> groups=[np.array(separated[0]),np.array(separated[1]), np.array(separated[2])] <NEW_LINE> return np.array(groups) | :param data: Training set
:param target: the list of class labels labelling data
:return:
Separate the data by their target class; that is, create one group
for every value of the target class. It returns all the groups | 625941e21f037a2d8b9465bb |
def search_products(query, token, xdock=False, api=None): <NEW_LINE> <INDENT> header = { "authorization": "{token}".format( token=token, ) } <NEW_LINE> query = escape(query) <NEW_LINE> if xdock: <NEW_LINE> <INDENT> query_url = search_url.format( query=query, userid=user_id, custnum=xdock_cust_num, warehouse=xdock_wareh... | Poll the UNFI API for a query string. Returns the json response.
:param query:
:param token:
:param xdock:
:return: | 625941e2009cb60464c6376d |
def test_upgrade_environment(self): <NEW_LINE> <INDENT> class SetupParticipantA(Component): <NEW_LINE> <INDENT> implements(IEnvironmentSetupParticipant) <NEW_LINE> called = False <NEW_LINE> def environment_created(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def environment_needs_upgrade(self): <NEW_LINE> <INDEN... | EnvironmentSetupParticipants are called only if
environment_needs_upgrade returns True for the participant. | 625941e2796e427e537b0987 |
def kth_of_two(xs, ys, k): <NEW_LINE> <INDENT> assert 0 < k <= len(xs) + len(ys) <NEW_LINE> if len(xs) == 0: <NEW_LINE> <INDENT> return ys[k - 1] <NEW_LINE> <DEDENT> if len(ys) == 0: <NEW_LINE> <INDENT> return xs[k - 1] <NEW_LINE> <DEDENT> if k == 1: <NEW_LINE> <INDENT> return min(xs[0], ys[0]) <NEW_LINE> <DEDENT> h = ... | Returns the k_th smallest element in the merge of two sorted arrays.
Expected time complexity is O(\log n). Space complexity is O(\log n).
:param xs: list[num]. sorted
:param ys: list[num]. sorted
:param k: int, cardinal
:return: num | 625941e2d268445f265b522d |
@click.group(help="Rebrickable CLI implemented in Python") <NEW_LINE> @click.pass_context <NEW_LINE> @click.option('--output', '-o', help='output printer (json, yaml, py --regular print Python function--)',type=EnumType(OutputFormat, casesensitive=False), default="py") <NEW_LINE> def main(click_context, output): <NEW_L... | Console script for pyrebrickable. | 625941e24527f215b584c811 |
def __init__(self, annotation_file=None): <NEW_LINE> <INDENT> self.dataset = {} <NEW_LINE> self.anns = [] <NEW_LINE> self.imgToAnns = {} <NEW_LINE> self.catToImgs = {} <NEW_LINE> self.imgs = {} <NEW_LINE> self.cats = {} <NEW_LINE> if not annotation_file == None: <NEW_LINE> <INDENT> print('loading annotations into memor... | Constructor of Microsoft COCO helper class for reading and visualizing annotations.
:param annotation_file (str): location of annotation file
:param image_folder (str): location to the folder that hosts images.
:return: | 625941e2a934411ee3751a53 |
def drawImagePreview(self, img): <NEW_LINE> <INDENT> q_img = self.to_qimage(img) <NEW_LINE> qpm = QtGui.QPixmap.fromImage(q_img) <NEW_LINE> scene = QtGui.QGraphicsScene() <NEW_LINE> scene.addPixmap(qpm) <NEW_LINE> self.ui.preview.setScene(scene) <NEW_LINE> self.image_preview = img | :param img: the result image (numpy array).
:return: put the image on the QgraphicsView (QImage). | 625941e2eab8aa0e5d26df18 |
def read_object(self, objstr, rd_is, unpad_oi=None): <NEW_LINE> <INDENT> if objstr in self.objs: <NEW_LINE> <INDENT> obj = self.objs[objstr] <NEW_LINE> <DEDENT> elif objstr in self.internal_objs: <NEW_LINE> <INDENT> obj = self.internal_objs[objstr] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError( "object... | Read data from object local to this core
objstr: name of th eobject
rd_is: indices to read
unpad_oi: object info if we want to "unpad" the object, or None | 625941e276e4537e8c351a34 |
def forward(self, inputs, targets, use_label_smoothing=True): <NEW_LINE> <INDENT> log_probs = self.logsoftmax(inputs) <NEW_LINE> targets = torch.zeros(log_probs.size()).scatter_(1, targets.unsqueeze(1).data.cpu(), 1) <NEW_LINE> if self.use_gpu: targets = targets.to(torch.device('cuda')) <NEW_LINE> if use_label_smoothin... | Args:
inputs: prediction matrix (before softmax) with shape (batch_size, num_classes)
targets: ground truth labels with shape (num_classes) | 625941e26aa9bd52df037164 |
def test_post_order(client): <NEW_LINE> <INDENT> resp = post_json_header(client, '/v1/users/orders', { "menu_id": 1, "quantity": 15}, headers={'Authorization': 'Bearer ' + signin(client)}) <NEW_LINE> assert resp.status_code == 201 <NEW_LINE> assert b'Order successfully added' in resp.data | test posting order | 625941e2fbf16365ca6f658a |
def read_src_list_csvfile(filepath, handle_dups='ignore'): <NEW_LINE> <INDENT> logging.debug('Reading images list from %s.' % filepath) <NEW_LINE> try: <NEW_LINE> <INDENT> with tf.gfile.GFile(filepath) as input_file: <NEW_LINE> <INDENT> return _check_src_list_dups(input_file.read().splitlines(), handle_dups) <NEW_LINE>... | Read source list from csv file.
Each line should contain the location of a source image file.
Returns:
List of file locations. | 625941e25e10d32532c5f2e4 |
def __init__(self, ip_server, port_server): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.listConnect = {} <NEW_LINE> self.sock = socket.socket() <NEW_LINE> self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) <NEW_LINE> self.sock.bind((ip_server, port_server)) <NEW_LINE> self.sock.listen() | :param ip_server:
:param port_server: | 625941e2566aa707497f4922 |
def sgd(frequency, amplitude=1): <NEW_LINE> <INDENT> def learning_rate(iterations): <NEW_LINE> <INDENT> return abs(amplitude * math.cos(2 * iterations * math.pi / frequency)) <NEW_LINE> <DEDENT> return learning_rate | Stochastic Gradient Descent with Warm Restarts,
proposed by Loshchilov & Hutter
:param max_iterations: number of iterations till the lr is resetted
:type max_iterations: int | 625941e267a9b606de4a8276 |
def get_mapping(self, max_iterations=None): <NEW_LINE> <INDENT> if max_iterations is None: <NEW_LINE> <INDENT> max_iterations = 50000 <NEW_LINE> <DEDENT> sdc = Lexconn.__one_hot_encoding(self.__entries[:, 0], self.__dc_cnt) <NEW_LINE> src = Lexconn.__one_hot_encoding(self.__entries[:, 1], self.__rst_cnt) <NEW_LINE> sdc... | find the best mapping according to the given emission and entries matrix
Return:
a mapping between PDTB relations and RST relations. Mapping[i, j] = P(RST_j|PDTB_i) | 625941e294891a1f4081be6a |
@_try_except_req <NEW_LINE> def post(url, data, timeout=None): <NEW_LINE> <INDENT> urlopen_kwargs = {} <NEW_LINE> if timeout is not None: <NEW_LINE> <INDENT> urlopen_kwargs['timeout'] = timeout <NEW_LINE> <DEDENT> if InputFile.is_inputfile(data): <NEW_LINE> <INDENT> data = InputFile(data) <NEW_LINE> request = Request(u... | Request an URL.
Args:
url:
The web location we want to retrieve.
data:
A dict of (str, unicode) key/value pairs.
timeout:
float. If this value is specified, use it as the definitive timeout (in
seconds) for urlopen() operations. [Optional]
Notes:
If neither `timeout` nor `data['timeout']` is sp... | 625941e266656f66f7cbc56b |
def disable_repo(self, params, context=None): <NEW_LINE> <INDENT> return self._client.call_method( 'NarrativeMethodStore.disable_repo', [params], self._service_ver, context) | :param params: instance of type "DisableRepoParams" -> structure:
parameter "module_name" of String | 625941e2f7d966606f6aa3c8 |
def test_virt_virt_with_virt_type_case(self): <NEW_LINE> <INDENT> dependencies = { 'virt_type': virt.VIRT_TYPE_VIRTUALBOX, 'internal_kvm_found': False, } <NEW_LINE> self.assertEqual( virt.ProcessVirtVirt.process( ansible_result(process.QPC_FORCE_POST_PROCESS), dependencies), 'virt-guest') | Found virt_virt using virt_type fact. | 625941e25fdd1c0f98dc05f4 |
def write(self,content): <NEW_LINE> <INDENT> folder_path = "/".join(self.path.split('/')[:-1]) <NEW_LINE> if not self.dir_exists(self.sftp,folder_path): <NEW_LINE> <INDENT> self.sftp.mkdir(folder_path) <NEW_LINE> <DEDENT> file = self.sftp.open(self.path,'w+') <NEW_LINE> file.write(content) | Takes the current object and writes a file to the path provided
Args:
content:str
Returns:
None | 625941e216aa5153ce362837 |
def _set_i_customer___(self, v, load=False): <NEW_LINE> <INDENT> if hasattr(v, "_utype"): <NEW_LINE> <INDENT> v = v._utype(v) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> t = YANGDynClass(v,base=six.text_type, is_leaf=True, yang_name="i_customer___", parent=self, path_helper=self._path_helper, extmethods=self._extmetho... | Setter method for i_customer___, mapped from YANG variable /params___/account_info___/i_customer___ (data)
If this variable is read-only (config: false) in the
source YANG file, then _set_i_customer___ is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_i_... | 625941e2e64d504609d74bff |
def read_pcap_header(input_file): <NEW_LINE> <INDENT> pcap_hdr_fmt = "IhhIIII" <NEW_LINE> try: <NEW_LINE> <INDENT> raw_header = input_file.read(24) <NEW_LINE> <DEDENT> except UnicodeDecodeError: <NEW_LINE> <INDENT> _module_logger.error('Unable to read pcap header') <NEW_LINE> raise <NEW_LINE> <DEDENT> if raw_header[:4]... | Parse pcap header from stream
https://wiki.wireshark.org/Development/LibpcapFileFormat
typedef struct pcap_hdr_s {
guint32 magic_number; /* magic number */
guint16 version_major; /* major version number */
guint16 version_minor; /* minor version number */
gint32 thiszone; /* GMT to local corr... | 625941e2851cf427c661a8cb |
def dato_actual(moneda1='BTC', moneda2='USDT'): <NEW_LINE> <INDENT> endpoint='/api/v3/depth' <NEW_LINE> url=base+endpoint <NEW_LINE> symbol=moneda1+moneda2 <NEW_LINE> params = {'symbol':symbol,'limit':5} <NEW_LINE> try: <NEW_LINE> <INDENT> r = requests.get(url, params=params) <NEW_LINE> js = r.json() <NEW_LINE> ask_PAR... | data=dato_actual(moneda1='BTC', moneda2='USDT') | 625941e2a17c0f6771cbe40e |
def vote_best(candidates, votes, n_winners): <NEW_LINE> <INDENT> best = [votes[0][0]] <NEW_LINE> for v in votes[1:]: <NEW_LINE> <INDENT> if v[0][1] > best[0][1]: <NEW_LINE> <INDENT> best = [v[0]] <NEW_LINE> <DEDENT> <DEDENT> return best | Select the artifact with the single best evaluation as the winner of
the vote.
Ties are resolved randomly.
:param candidates: All candidates in the vote
:param votes: Votes from the agents
:param int n_winners: The number of vote winners | 625941e2cc0a2c11143dd251 |
def inputs(self, func=None, variable=True, const=True): <NEW_LINE> <INDENT> ivars = [] <NEW_LINE> for v in self.vars.values(): <NEW_LINE> <INDENT> if v.producer != None: continue <NEW_LINE> if func != None: <NEW_LINE> <INDENT> used = False <NEW_LINE> for op in v.consumers: <NEW_LINE> <INDENT> if op.func == func: <NEW_L... | Return list of inputs, i.e. variables with no producer. | 625941e2f8510a7c17cf9abe |
def PlotDistanceVsNClusters(DataDirectory, fname_prefix, ln, threshold_level=0): <NEW_LINE> <INDENT> fig = plt.figure(1, facecolor='white') <NEW_LINE> gs = plt.GridSpec(100,100,bottom=0.15,left=0.1,right=0.9,top=0.9) <NEW_LINE> ax = fig.add_subplot(gs[5:100,10:95]) <NEW_LINE> clusters = [] <NEW_LINE> n_clusters = len(l... | Make a plot of the distance between each cluster compared to the
number of clusters. Maybe use this to determine where to put the distance
threshold
Args:
ln: linkage matrix from clustering
threshold_level: which level to return the threshold at. 0 = max distance between clusters.
Author: FJC | 625941e21b99ca400220ae72 |
def test_fallback_packages(self): <NEW_LINE> <INDENT> self.request.locator = MagicMock() <NEW_LINE> version = '1.1' <NEW_LINE> name = 'foo' <NEW_LINE> filename = '%s-%s.tar.gz' % (name, version) <NEW_LINE> url = 'http://pypi.python.org/pypi/%s/%s' % (name, filename) <NEW_LINE> dist = MagicMock() <NEW_LINE> dist.name = ... | Fetch fallback packages | 625941e2dc8b845886cb58f6 |
def render_string(self, path: str, **kwargs: Any) -> bytes: <NEW_LINE> <INDENT> return self.handler.render_string(path, **kwargs) | Renders a templates and returns it as a string. | 625941e2be8e80087fb20ffc |
def Tracing(self, request, timeout, metadata=None, with_call=False, protocol_options=None): <NEW_LINE> <INDENT> raise NotImplementedError() | See worker.proto for details.
| 625941e2091ae35668667316 |
def open(self, url_component=None): <NEW_LINE> <INDENT> if not self.check_origin(): <NEW_LINE> <INDENT> raise tornado.web.HTTPError(404, "Websocket origin mismatch") <NEW_LINE> <DEDENT> self._logger.info("TermSocket.open: %s", url_component) <NEW_LINE> url_component = _cast_unicode(url_component) <NEW_LINE> self.term_n... | Websocket connection opened.
Call our terminal manager to get a terminal, and connect to it as a
client. | 625941e25510c4643540f79a |
def attention(q, k, v, d_k, mask=None, dropout=None): <NEW_LINE> <INDENT> scores = torch.matmul(q, k.transpose(-2, -1)) / math.sqrt(d_k) <NEW_LINE> if mask is not None: <NEW_LINE> <INDENT> scores = scores.masked_fill(mask, -1e9) <NEW_LINE> <DEDENT> scores = F.softmax(scores, dim=-1) <NEW_LINE> if dropout is not None: <... | :param q: Batch x n_head x max_seq_len x variable
:param k: Batch x n_head x max_seq_len x variable
:param v: Batch x n_head x max_seq_len x variable
:param d_k:
:param mask: Batch x n_had x max_seq_len x max_seq_len
:param dropout:
:return: | 625941e2c432627299f05008 |
def update_config(self, config): <NEW_LINE> <INDENT> return self._update_config("config", config) | Update the CM configuration.
:param config: Dictionary with configuration to update.
:return: Dictionary with updated configuration. | 625941e2a219f33f34628d24 |
def set_control_target(self, handle_id, x, y): <NEW_LINE> <INDENT> dx, dy = self._controls[handle_id][2] <NEW_LINE> self._controls[handle_id][1] = (x+dx, y+dy) | Change target of control point if exists | 625941e223849d37ff7b344c |
def __call__(self, request, server): <NEW_LINE> <INDENT> if (request.method == "POST" and request.post_param("grant_type") == "authorization_code" and request.path == server.token_path): <NEW_LINE> <INDENT> return AuthorizationCodeTokenHandler( access_token_store=server.access_token_store, auth_token_store=server.auth_... | :param request: Incoming request
:type request: oauth2.web.Request
:param server: The OAuth2 provider instance
.. versionchanged:: 1.0.0
Check the HTTP method of a request | 625941e2cb5e8a47e48b7e64 |
def require_token(func): <NEW_LINE> <INDENT> @wraps(func) <NEW_LINE> def decorator(*args, **kwargs): <NEW_LINE> <INDENT> if request.authorization: <NEW_LINE> <INDENT> uuid = request.authorization.username <NEW_LINE> token = request.authorization.password <NEW_LINE> try: <NEW_LINE> <INDENT> manager = SessionManager() <N... | verifies the uuid/token combo of the given account. account type can be:
customer, fox, merchant | 625941e2de87d2750b860155 |
def getName(self): <NEW_LINE> <INDENT> return self.__name | getter for the name of the Student | 625941e263b5f9789fde74a5 |
def radiationExposure(start, stop, step): <NEW_LINE> <INDENT> total_exposure = 0 <NEW_LINE> i = start <NEW_LINE> while i < stop: <NEW_LINE> <INDENT> total_exposure += radioactive_activity_by_year(i) * step <NEW_LINE> i += step <NEW_LINE> <DEDENT> return total_exposure | Computes and returns the amount of radiation exposed
to between the start and stop times. Calls the
function radioactive_activity_by_year
to obtain the value of the radioactive activity at any year.
start: integer, the time at which exposure begins
stop: integer, the time at which exposure ends
step: float, the width... | 625941e29c8ee82313fbbb35 |
def get_cryptographic_strategy(self, strategy: str) -> Cryptography: <NEW_LINE> <INDENT> if strategy.lower() == "seaser": <NEW_LINE> <INDENT> return SeaserCipher() <NEW_LINE> <DEDENT> raise NotImplementedError(f"Strategy of type {strategy} is not implemented.") | get_cryptographic_strategy() -> This is a factory method to create Cryptography objects.
:param strategy: The cryptographic strategy to implement.
:exception NotImplementedError: raised when strategy of type Cryptography is not available.
:return: An object of type Cryptography. | 625941e2dd821e528d63b565 |
def simulated_annealing(f, t_init, t_fin, n_iter, domain, h=(lambda t: 0.9 * t)): <NEW_LINE> <INDENT> x = np.random.rand() * (domain[1] - domain[0]) + domain[0] <NEW_LINE> x_opt = x <NEW_LINE> t = t_init <NEW_LINE> k = 0 <NEW_LINE> def get_neighbour(x, eps=(domain[1] - domain[0])/2.0): <NEW_LINE> <INDENT> x_min = x - e... | Optimization algorithm.
:param f: cost function
:param t_init: initial temperature
:param t_fin: final temperature
:param n_iter: number of iterations per stage
:param h: temperature function
:param domain: list, contains boundaries for each variable
:return: x_opt minimizing f | 625941e2099cdd3c635f1019 |
def ansible_environment(args, color=True): <NEW_LINE> <INDENT> env = common_environment() <NEW_LINE> path = env['PATH'] <NEW_LINE> ansible_path = os.path.join(os.getcwd(), 'bin') <NEW_LINE> if not path.startswith(ansible_path + os.pathsep): <NEW_LINE> <INDENT> path = ansible_path + os.pathsep + path <NEW_LINE> <DEDENT>... | :type args: CommonConfig
:type color: bool
:rtype: dict[str, str] | 625941e20a366e3fb873ebdd |
def assert_pgerror(expr,msg,detail=''): <NEW_LINE> <INDENT> if not expr: <NEW_LINE> <INDENT> if not detail: <NEW_LINE> <INDENT> detail=msg <NEW_LINE> <DEDENT> raise LogicError(msg,detail) | assert expr is true, else raise LogicError with msg | 625941e25fcc89381b1e1a80 |
def __create_transactions_source(self): <NEW_LINE> <INDENT> source = ColumnDataSource( data={ self.date: [0], self.product: [0], self.price: [0], self.shop: [0] } ) <NEW_LINE> return source | Function creates DataSource for Transactions DataTable.
ColumnDataSource defines 4 variables in it's data, based on provided column names during initialization of
Category object:
- .date
- .product
- .price
- .shop
Returns created ColumnDataSource. | 625941e2b7558d58953c52cc |
def __init__(self, data_stream, from_cols, to_cols, produces_examples=False): <NEW_LINE> <INDENT> super().__init__(data_stream=data_stream, produces_examples=produces_examples) <NEW_LINE> self.from_inputs = from_cols <NEW_LINE> self.to_inputs = to_cols | :param data_stream:
:param from_cols: names of the columns to be transformed
:param to_cols: names of the columns to which the output is written | 625941e2be383301e01b583e |
def bunk_put (self, client): <NEW_LINE> <INDENT> self._client.response_code = self.__response_code <NEW_LINE> self.respond(self.__title) | Handle a PUT request.
@param client (HttpClient) The HttpClient instance. | 625941e24f88993c3716c423 |
def testExportTree(self): <NEW_LINE> <INDENT> xml = current.xml <NEW_LINE> current.auth.override = True <NEW_LINE> resource = current.s3db.resource("org_office", id=1) <NEW_LINE> tree = resource.export_tree(start=0, limit=1, dereference=False) <NEW_LINE> root = tree.getroot() <NEW_LINE> self.assertEqual(root.tag, xml.T... | Test export of a resource as element tree | 625941e23cc13d1c6d3c7738 |
def test_transf_count(self): <NEW_LINE> <INDENT> instloc = MakeSquareAdj() <NEW_LINE> self.assertEqual(instloc.transf_count(), 1) | Check the transf_count() for MakeSquareAdj | 625941e29b70327d1c4e1196 |
def is_scout(self): <NEW_LINE> <INDENT> if self.mech.get_walk() < 6 and self.load.get_jump() < 6: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True | Check if a mech is a scout
Definition:
- Speed at least walk 6 or jump 6 | 625941e2167d2b6e31218f55 |
def ex_get_node(self, node_id): <NEW_LINE> <INDENT> result = self.connection.request('/my/machines/%s' % (node_id)) <NEW_LINE> return self._to_node(result.object) | Return a Node object based on a node ID.
:param node_id: ID of the node
:type node_id: ``str``
:return: A Node object for the node
:rtype: :class:`Node` | 625941e21f5feb6acb0c4f09 |
def ListBuildTriggers(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details("Method not implemented!") <NEW_LINE> raise NotImplementedError("Method not implemented!") | Lists existing `BuildTrigger`s.
This API is experimental. | 625941e23eb6a72ae02ec8a6 |
def testSettersAndQueries(self): <NEW_LINE> <INDENT> parameters = PhotonBeamParameters( photon_energy=4.96e3*electronvolt, pulse_energy = 2e-3*joule, beam_diameter_fwhm = 2e-6*meter, ) <NEW_LINE> parameters.photon_energy = 8.0e3*electronvolt <NEW_LINE> parameters.pulse_energy = 2.5e-3*joule <NEW_LINE> parameters.beam_d... | Testing the default construction of the class using a dictionary. | 625941e299cbb53fe6792fa5 |
def GetSingleFastaLength(inFile): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> fpin = open(inFile, "r") <NEW_LINE> lines = fpin.readlines() <NEW_LINE> fpin.close() <NEW_LINE> aaSeq = "" <NEW_LINE> for line in lines: <NEW_LINE> <INDENT> if line[0] == ">": <NEW_LINE> <INDENT> next <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN... | return length of the fasta seq (the file should include just one sequence)
return -1 if failed | 625941e23c8af77a43ae3b64 |
def get_value(self, name, value): <NEW_LINE> <INDENT> if isinstance(value, GeneratorType): <NEW_LINE> <INDENT> return self.get_value(name, next(value)) <NEW_LINE> <DEDENT> if isinstance(value, (FunctionType, MethodType, BuiltinFunctionType)): <NEW_LINE> <INDENT> return self.get_value(name, value()) <NEW_LINE> <DEDENT> ... | Prepare value for field with name.
:return : (name, value) or None | 625941e2e76e3b2f99f3abc6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.