code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def tearDown(self): <NEW_LINE> <INDENT> pass | Not implemented - 'tears down' the program | 625941f78c3a873295158a41 |
def domain_reduction(csp, queue=None) : <NEW_LINE> <INDENT> if queue == None: <NEW_LINE> <INDENT> queue = csp.get_all_variables() <NEW_LINE> <DEDENT> dequeued = [] <NEW_LINE> while queue: <NEW_LINE> <INDENT> var = queue.pop(0) <NEW_LINE> dequeued.append(var) <NEW_LINE> reduced_vars = eliminate_from_neighbors(csp,var) <... | Uses constraints to reduce domains, propagating the domain reduction
to all neighbors whose domains are reduced during the process.
If queue is None, initializes propagation queue by adding all variables in
their default order.
Returns a list of all variables that were dequeued, in the order they
were removed from the... | 625941f7293b9510aa2c390d |
def get_experience(self) -> int: <NEW_LINE> <INDENT> return random.randint(self.experience_gain['minimum'], self.experience_gain['maximum']) | Gets a random amount of experience. | 625941f74c3428357757c9a1 |
def getNumFromStr(usrStr): <NEW_LINE> <INDENT> numbers = '0123456789' <NEW_LINE> found = [] <NEW_LINE> remain = [] <NEW_LINE> for char in usrStr: <NEW_LINE> <INDENT> if char in numbers: <NEW_LINE> <INDENT> found.append(char) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> remain.append(char) <NEW_LINE> <DEDENT> <DEDENT> ... | Given a string, extract any numbers. Return two strings, the numbers (as strings) and the remaining characters.
>>> getNumFromStr('23a')
('23', 'a')
>>> getNumFromStr('23a954sdfwer')
('23954', 'asdfwer')
>>> getNumFromStr('')
('', '') | 625941f75fc7496912cc3ffb |
def __init__(self): <NEW_LINE> <INDENT> Player.__init__(self) | Initializes the player.
| 625941f766673b3332b9270e |
def unregister_editorstack(self, editorstack): <NEW_LINE> <INDENT> self.remove_last_focus_editorstack(editorstack) <NEW_LINE> if len(self.editorstacks) > 1: <NEW_LINE> <INDENT> index = self.editorstacks.index(editorstack) <NEW_LINE> self.editorstacks.pop(index) <NEW_LINE> return True <NEW_LINE> <DEDENT> else: <NEW_LINE... | Removing editorstack only if it's not the last remaining | 625941f745492302aab5e948 |
def create_output_file(output_path, default_extension, create_out_dir=True): <NEW_LINE> <INDENT> owd = os.getcwd() <NEW_LINE> output_path_no_ext, extension = os.path.splitext(output_path) <NEW_LINE> assert isinstance(extension, str) <NEW_LINE> if not extension or extension.isspace(): <NEW_LINE> <INDENT> extension = def... | Creates an output file
Args:
output_path: the path of the file to create
default_extension: the extension to use for the file
create_out_dir: Create an output directory
Returns:
A tuple containing a file object and the path of the file object. | 625941f7be8e80087fb212b4 |
def fd_wrap(self, fd:int, *args, **kwargs): <NEW_LINE> <INDENT> rv = EventDispatcherBaseTT.fd_wrap(self, fd, *args, **kwargs) <NEW_LINE> self._fdml[fd] = 0 <NEW_LINE> return rv | Return FD wrapper based on this ED and specified fd | 625941f7ec188e330fd5ae0e |
def __add__(self, other): <NEW_LINE> <INDENT> return self._binaryOp(other, operator.add, symetric=True, opStr='({0} + {1})') | Add result selectors with the ``+`` operator
:param other: The other result selector or a number
:type other: Union[:py:class:`ResultSelector`, float]
:returns: The result selector resulting from the addition of both operands. If both
operands are result selectors and have the same size, this corresponds to the
... | 625941f797e22403b379d619 |
def is_operator(op): <NEW_LINE> <INDENT> return True if op in ['+', '-', '*', '/'] else False | Determinate if is a string is operator or not
:param op: A string operand/operator
:return: True if operator, False otherwise | 625941f74d74a7450ccd4843 |
def test_install_appdir_shows_installed(self): <NEW_LINE> <INDENT> self.installable[0].install_region().click(self.system.images("Install.png")) <NEW_LINE> click(self.system.images("install_accept.png")) <NEW_LINE> self.firefox.reload() <NEW_LINE> self.assertTrue(self.installable[0].installed()) | Installs the first application on the application directory
page, reloads it, and verifies the application is still installed. | 625941f724f1403a926011de |
@all_tools <NEW_LINE> def test_version(tool_cls): <NEW_LINE> <INDENT> tool = tool_cls() <NEW_LINE> try: <NEW_LINE> <INDENT> tool.run("--version") <NEW_LINE> <DEDENT> except SystemExit as e: <NEW_LINE> <INDENT> if not hasattr(sys.stdout, "getvalue"): <NEW_LINE> <INDENT> raise Exception('stdout not captured in test.') <N... | Check that all command line tools have a --version option that returns the current version. | 625941f74527f215b584cacf |
def get(self): <NEW_LINE> <INDENT> return self.request().get() | Gets the EntityCollectionPage
Returns:
:class:`EntityCollectionPage<microsoft.msgraph.request.entity_collection.EntityCollectionPage>`:
The EntityCollectionPage | 625941f7283ffb24f3c55f77 |
def __getattr__(self, name): <NEW_LINE> <INDENT> if name == "errors": <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> filters = ( ("^other_fields$", lambda: self.fields.keys()), ("^(\w*)_fields$", lambda name: [f for f in self.fields.keys() if f.startswith(name)]), ("^(\w*)_field$", lambda name: [f for f in self.fi... | Dynamic fieldset caller - matches requested attribute name against
pattern for creating the list of field names to use for the fieldset. | 625941f7507cdc57c6307369 |
def __init__(self, items, collections=[]): <NEW_LINE> <INDENT> self._collections = collections <NEW_LINE> self._items = items <NEW_LINE> cols = {c.id: c for c in self._collections} <NEW_LINE> for i in self._items: <NEW_LINE> <INDENT> col = i._data.get('collection', None) <NEW_LINE> if col is not None: <NEW_LINE> <INDEN... | Initialize with a list of Item objects | 625941f763f4b57ef0001783 |
def express(self, frame1, frame2=None): <NEW_LINE> <INDENT> if frame2 == None: <NEW_LINE> <INDENT> frame2 = frame1 <NEW_LINE> <DEDENT> _check_frame(frame1) <NEW_LINE> _check_frame(frame2) <NEW_LINE> ol = 0 <NEW_LINE> for i, v in enumerate(self.args): <NEW_LINE> <INDENT> ol += v[0] * (v[1].express(frame1) | v[2].express... | Expresses this Dyadic in alternate frame(s)
The first frame is the list side expression, the second frame is the
right side; if Dyadic is in form A.x|B.y, you can express it in two
different frames. If no second frame is given, the Dyadic is expressed in
only one frame.
Parameters
==========
frame1 : ReferenceFrame
... | 625941f7aad79263cf3910c9 |
def getLabelEncoder(labelencoderfile): <NEW_LINE> <INDENT> labelencoders = [] <NEW_LINE> ledata = pd.read_csv(labelencoderfile, sep="\t", header=None) <NEW_LINE> for i in range(0, len(ledata)): <NEW_LINE> <INDENT> cur = ledata.iloc[i,1:].values <NEW_LINE> lei = cur.astype(str) <NEW_LINE> labelencoders.append(list(lei[l... | Gets informations for converting features
to integer values.
Parameters
----------
labelencoderfile : str
File containg the label encoder information.
Returns
-------
rv : list of lists
Returns a list of lists containing the feature
column for the conversions (first item) and the
string labels to convert to integers ... | 625941f7f7d966606f6aa68a |
def handle_config(self, msg): <NEW_LINE> <INDENT> name = rospy.get_name()[1:] <NEW_LINE> msg = msg.data <NEW_LINE> reset_file_name = rospy.get_param('reset_file_odom') <NEW_LINE> config_file_name = rospy.get_param('config_file_odom') <NEW_LINE> if msg == "reset": <NEW_LINE> <INDENT> with open(reset_file_name, 'r') as r... | Not currently in use.
Was intended to be used to remove gravity from NED-matrix
:param msg: std_msgs/String
:return: | 625941f771ff763f4b549d16 |
def warning(self, text): <NEW_LINE> <INDENT> self.display(text, colorama.Fore.RED + colorama.Style.BRIGHT, True) | Display a warning to the user.
| 625941f7f9cc0f698b140c73 |
def disable(conn, *args, **kw): <NEW_LINE> <INDENT> args = list(args) <NEW_LINE> args.pop(0) <NEW_LINE> name = get_name(conn, args.pop(0)) <NEW_LINE> conn.disable_job(name) <NEW_LINE> return 'disabled job: %s' % name | Disable a job that is currently enabled. Example usage::
!ci disable {job} | 625941f7379a373c97cfb1c5 |
def deleteHistory(self, scan_id, history_id): <NEW_LINE> <INDENT> self.sendRequest('DELETE', '/scans/{0}/history/{1}'.format(scan_id, history_id)) <NEW_LINE> return | Delete a historical scan | 625941f75166f23b2e1a57d7 |
def minSteps(self, n): <NEW_LINE> <INDENT> ans = 0 <NEW_LINE> while n > 1: <NEW_LINE> <INDENT> h = getsmallestfactor(n) <NEW_LINE> ans += h <NEW_LINE> n = n//h <NEW_LINE> <DEDENT> return ans | :type n: int
:rtype: int | 625941f76e29344779a62c8f |
def get_leftmostchild_index(self,parent_index): <NEW_LINE> <INDENT> if parent_index == None: return None <NEW_LINE> elif parent_index == 0 :return 1 <NEW_LINE> elif self.size() - parent_index <= self.arity() or (parent_index << self.exp2) + 1 > self.size()-1: return None <NEW_LINE> else: return (parent_index << self.ex... | Return the index of the leftmost child of the element at parent_index
Use bit operators here - to multiply say n by 2^m - left shift n by m bits (written as n << m, in python) | 625941f7d8ef3951e3243bbb |
def mixedCrossovers(ind1, ind2): <NEW_LINE> <INDENT> features1, family1 = ind1 <NEW_LINE> features2, family2 = ind2 <NEW_LINE> crossoverSelectionThres = 0.5 <NEW_LINE> if random.random() < crossoverSelectionThres: <NEW_LINE> <INDENT> new_features1, new_features2 = five_point_crossover(features1, features2) <NEW_LINE> <... | Crossover used in this Expr.
50% chance for a 5-point crossover and 50% chance for n-point crossover.
Notice that family-vector is not used in the crossover (stays as it was).
:param ind1: Parent-1
:param ind2: Parent-2
:return: | 625941f73d592f4c4ed1d6d9 |
def find_next(start, stop, i2hits): <NEW_LINE> <INDENT> if start not in i2hits and stop in i2hits: <NEW_LINE> <INDENT> index = stop <NEW_LINE> <DEDENT> elif stop not in i2hits and start in i2hits: <NEW_LINE> <INDENT> index = start <NEW_LINE> <DEDENT> elif start not in i2hits and stop not in i2hits: <NEW_LINE> <INDENT> ... | which protein has the best hit, the one to the 'right' or to the 'left?' | 625941f74d74a7450ccd4844 |
def construct (fileId, sink) : <NEW_LINE> <INDENT> print ("\t\tconstructing test database from {0}".format (fileId)) <NEW_LINE> entries = readTransactions (fileId) <NEW_LINE> pictureList = os.listdir ('test/pic') <NEW_LINE> for test in entries : <NEW_LINE> <INDENT> header = "\tprocessing place name: {name: <40}\tlat/lo... | Reads the definition of a set of transactions and inserts the
corresponding records into the test database. | 625941f74f6381625f1150b9 |
def start_video(self): <NEW_LINE> <INDENT> if not self.rodar_video: <NEW_LINE> <INDENT> self.rodar_video = True <NEW_LINE> self.video_thread = Thread(self) <NEW_LINE> self.video_thread.changePixmap.connect(self.set_image) <NEW_LINE> self.video_thread.start() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.rodar_vide... | Método que inicializa o vídeo | 625941f73617ad0b5ed68574 |
def test_clients_search(self): <NEW_LINE> <INDENT> search_key = 'as' <NEW_LINE> response = self.client.get("/clients/search?q={0}".format(search_key)) <NEW_LINE> self.assertIsNotNone(response.json['results']) <NEW_LINE> assert response <NEW_LINE> result = response.json['results'][0] <NEW_LINE> meta_fields = ['client_as... | Test searching for a client | 625941f7442bda511e8bea8c |
def select(self, population): <NEW_LINE> <INDENT> fit_per_item = [self._function(*self._representation.decode(item)) for item in population] <NEW_LINE> pop_and_fit = zip(population, fit_per_item) <NEW_LINE> pop_and_fit.sort(key=lambda x: x[1]) <NEW_LINE> best = pop_and_fit.pop()[0] <NEW_LINE> population.remove(best) <N... | Select a cromozom and return the population. | 625941f785dfad0860c3b4dc |
def test_readSpec(): <NEW_LINE> <INDENT> spec = PySpek('1412-0401898.SPE') <NEW_LINE> x, y = spec.readSpec() <NEW_LINE> assert len(x) == len(y) <NEW_LINE> assert len(x) == 335 <NEW_LINE> xUncorrected, yUncorrected = spec.readSpec(perSecond=False) <NEW_LINE> assert y[-1] * spec.aqTime == yUncorrected[-1] <NEW_LINE> asse... | Test the correct loading of the image | 625941f72eb69b55b151cf37 |
def apply_slope_and_noise(old_sci, num_groups, slope, noise): <NEW_LINE> <INDENT> new_sci = np.zeros((len(old_sci), num_groups, 2048, 2048), dtype=np.float32) <NEW_LINE> for integration in range(0, len(old_sci)): <NEW_LINE> <INDENT> new_sci[integration,0] = old_sci[integration,0] <NEW_LINE> electron_sum = np.zeros((204... | Takes the slope and read noise from the config file and applies it
to each pixel in the output file. The first group from the input file is
used as the initial values that the rest of the groups are built off of | 625941f77cff6e4e81118003 |
def testMakeClusterableRaisesErrorForCustomLayer(self): <NEW_LINE> <INDENT> with self.assertRaises(ValueError): <NEW_LINE> <INDENT> ClusterRegistry.make_clusterable(CustomLayer(10)) | make_clusterable() cannot make layer clusterable.
When the layer is a custom non-clusterable layer. | 625941f7a4f1c619b28b06a6 |
@post('/datasets/<did>') <NEW_LINE> @CaptureException <NEW_LINE> def post_dataset(did,library): <NEW_LINE> <INDENT> did = did.replace('|','/') <NEW_LINE> from databundles.identity import new_identity, Identity <NEW_LINE> from databundles.util import md5_for_file <NEW_LINE> payload = request.json <NEW_LINE> identity = n... | Accept a payload that describes a bundle in the remote. Download the
bundle and install it. | 625941f755399d3f05588d37 |
def do(self, string, date): <NEW_LINE> <INDENT> pass | Perform an action on the given string.
Parameters
----------
string : str
A string containing data for the action.
date : time.struct_time
Date associated with the action. | 625941f73c8af77a43ae3e26 |
def firstUniqChar(self, s): <NEW_LINE> <INDENT> if s == "": return -1 <NEW_LINE> seen = dict() <NEW_LINE> for char in s: <NEW_LINE> <INDENT> if char not in seen: <NEW_LINE> <INDENT> seen[char] = 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> seen[char]+= 1 <NEW_LINE> <DEDENT> <DEDENT> for i, char in enumerate(s): <NEW... | :type s: str
:rtype: int | 625941f7ab23a570cc250807 |
def getChildKey(self, widget): <NEW_LINE> <INDENT> name = str(widget.data.get("name")).lower() <NEW_LINE> if isinstance(widget, self.nodeWidget): <NEW_LINE> <INDENT> return "0-%s" % name <NEW_LINE> <DEDENT> elif isinstance(widget, self.leafWidget): <NEW_LINE> <INDENT> return "1-%s" % name <NEW_LINE> <DEDENT> else: <NEW... | Derives a string used to sort the entries on each level. | 625941f7e5267d203edce313 |
def make_rel_media_option(self, rel_media_count, rel_media_type, rel_media_options): <NEW_LINE> <INDENT> if rel_media_count > 0: <NEW_LINE> <INDENT> fl = FilterLinks() <NEW_LINE> fl.base_search_link = self.base_search_link <NEW_LINE> fl.base_request_json = self.request_dict_json <NEW_LINE> fl.base_r_full_path = self.re... | makes a facet option for related media | 625941f730dc7b7665901fdd |
@testing.requires_testing_data <NEW_LINE> def test_maxwell_filter_additional(): <NEW_LINE> <INDENT> data_path = op.join(testing.data_path(download=False)) <NEW_LINE> file_name = 'test_move_anon' <NEW_LINE> raw_fname = op.join(data_path, 'SSS', file_name + '_raw.fif') <NEW_LINE> with warnings.catch_warnings(record=True)... | Test processing of Maxwell filtered data | 625941f78a349b6b435e87f1 |
def riemann(g, ul, ur): <NEW_LINE> <INDENT> f = g.scratchArray() <NEW_LINE> i = g.ilo <NEW_LINE> while (i <= g.ihi + 1): <NEW_LINE> <INDENT> if ul[i] > ur[i]: <NEW_LINE> <INDENT> S = 0.5 * (ul[i] + ur[i]) <NEW_LINE> if (S > 0): <NEW_LINE> <INDENT> us = ul[i] <NEW_LINE> <DEDENT> elif (S < 0): <NEW_LINE> <INDENT> us = ur... | Riemann problem for advection -- this is simply upwinding,
but we return the flux | 625941f7c4546d3d9de730b9 |
def near(self, lng, lat, precision=None): <NEW_LINE> <INDENT> return self.prefix(self.encode(lat, lng, precision or self.precision)) | Return prefix query for point at given precision. | 625941f7cad5886f8bd27656 |
def open(self, transaction_manager=None, delegate=True): <NEW_LINE> <INDENT> if transaction_manager is None: <NEW_LINE> <INDENT> transaction_manager = transaction.manager <NEW_LINE> <DEDENT> self.transaction_manager = transaction_manager <NEW_LINE> self.explicit_transactions = getattr(transaction_manager, 'explicit', F... | Register odb, the DB that this Connection uses.
This method is called by the DB every time a Connection
is opened. Any invalidations received while the Connection
was closed will be processed.
If the global module function resetCaches() was called, the
cache will be cleared.
Parameters:
odb: database that owns the ... | 625941f710dbd63aa1bd3220 |
def which_member(self, i): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> for member_i in range(self.n_members): <NEW_LINE> <INDENT> grid_size = len(self.grids[member_i]) <NEW_LINE> if i < (count + grid_size): <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> count += grid_size <NEW_LINE> <DEDENT> grid_i = i - count <NEW_LINE> r... | Which family member does raw index `i` belong to | 625941f75fcc89381b1e1d43 |
def remove_provider_network(network_id): <NEW_LINE> <INDENT> session = db.get_session() <NEW_LINE> pnet = (session.query(network_models_v2.ProviderNetwork). filter_by(network_id=network_id).first()) <NEW_LINE> if pnet: <NEW_LINE> <INDENT> session.delete(pnet) <NEW_LINE> session.flush() <NEW_LINE> return network_id | Remove network_id from the provider network table.
:param network_id: Any network id. If it is not in the table, do nothing.
:return: network_id if it was in the table and successfully removed. | 625941f73539df3088e2e9ca |
def test_builtin_with_bad_settings(self): <NEW_LINE> <INDENT> args = ['sqlall', '--settings=bad_settings', 'admin_scripts'] <NEW_LINE> out, err = self.run_django_admin(args) <NEW_LINE> self.assertNoOutput(out) <NEW_LINE> self.assertOutput(err, "Could not import settings 'bad_settings'") | default: django-admin builtin commands fail if settings file (from argument) doesn't exist | 625941f7566aa707497f4bde |
@router.route('/v2/motions/stop', method=['OPTIONS', 'GET']) <NEW_LINE> @enable_cors <NEW_LINE> def motion_stop(): <NEW_LINE> <INDENT> response_json = { 'resource': 'motions', 'data': { 'command': 'stop', 'result': _driver.stop() } } <NEW_LINE> response.content_type = 'application/json' <NEW_LINE> return response_json | @brief Stop a motion. | 625941f782261d6c526abb28 |
def roi_to_mask(roi, shape): <NEW_LINE> <INDENT> if isinstance(roi, str): <NEW_LINE> <INDENT> roi = read_roi_zip(roi) <NEW_LINE> <DEDENT> mask = np.zeros(shape, dtype=bool) <NEW_LINE> for info in roi.values(): <NEW_LINE> <INDENT> if info["type"] == "oval": <NEW_LINE> <INDENT> process_oval(info, mask) <NEW_LINE> <DEDENT... | Convert a micromanager roi to a numpy mask.
Parameters
----------
roi : str or dict
The str to the roi zip folder or an already loaded roi zip.
shape : tuple of int
The shape of the mask to fill
Returns
-------
mask : numpy array | 625941f767a9b606de4a8534 |
def object_dir(self, dirname, relative= False): <NEW_LINE> <INDENT> if relative: <NEW_LINE> <INDENT> self._object_dir_maker = same_source_dir(dirname) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._object_dir_maker = specific_directory(dirname) | オブジェクトファイルを置くディレクトリを設定
relative= False -> root_path にあるディレクトリ
relative= True -> source_pathにあるディレクトリ | 625941f70c0af96317bb8865 |
def get_sensor_name(sensor_ip, sensor_port): <NEW_LINE> <INDENT> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) <NEW_LINE> sock.settimeout(6) <NEW_LINE> sensor_address = (sensor_ip, int(sensor_port)) <NEW_LINE> try: <NEW_LINE> <INDENT> sock.connect(sensor_address) <NEW_LINE> sensor_command = "gethostname" <NE... | Sub Function
To get the Hostname of the Sensor | 625941f7cdde0d52a9e536b8 |
def sync_synchronize(repository_id, user_id=None, manual=False): <NEW_LINE> <INDENT> if user_id: <NEW_LINE> <INDENT> auth.s3_impersonate(user_id) <NEW_LINE> <DEDENT> rtable = s3db.sync_repository <NEW_LINE> query = (rtable.deleted != True) & (rtable.id == repository_id) <NEW_LINE> repository = db(query).... | Run all tasks for a repository, to be called from scheduler | 625941f7283ffb24f3c55f78 |
def test_all(self): <NEW_LINE> <INDENT> obj_dict = self.f.all() <NEW_LINE> self.assertIsInstance(obj_dict, dict) <NEW_LINE> key1 = 'BaseModel.'+self.base.id <NEW_LINE> key2 = 'BaseModel.'+self.model.id <NEW_LINE> self.assertEqual(obj_dict[key1], self.base) <NEW_LINE> self.assertEqual(obj_dict[key2], self.model) | Test return dict | 625941f731939e2706e4d4de |
def str_not_matches_regex(value: str, comparable: Union[str, re._pattern_type]) -> bool: <NEW_LINE> <INDENT> return not re.match(comparable, value) | Checks whether `value` doesn't match the regex stored in `comparable`. | 625941f7379a373c97cfb1c6 |
def uniqueValues(name=None, withLengths=0): <NEW_LINE> <INDENT> pass | Return an iterable/sequence of unique values for name.
If 'withLengths' is true, returns a iterable/sequence of tuples of
(value, length). | 625941f715fb5d323cde1199 |
def build_graph(parameters): <NEW_LINE> <INDENT> input_tensor = tf.compat.v1.placeholder( dtype=parameters["input_dtype"], name="input", shape=parameters["input_shape"]) <NEW_LINE> out = tf.math.reciprocal(input_tensor) <NEW_LINE> return [input_tensor], [out] | Build the graph for cond tests. | 625941f7462c4b4f79d1dd4e |
def __init__(self, address=None): <NEW_LINE> <INDENT> self._address = None <NEW_LINE> self.discriminator = None <NEW_LINE> if address is not None: <NEW_LINE> <INDENT> self.address = address | GetAddressResponse - a model defined in Swagger | 625941f7fb3f5b602dac3d19 |
def str_to_datetime(dt_str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return datetime.strptime(dt_str, DATE_STR_FORMAT) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None | Converts a string to a datetime object.
@rtype: datetime | 625941f7dc8b845886cb5bb6 |
def write(self, M_t, c_t, z_t, full_shape, train): <NEW_LINE> <INDENT> h_t = self.write_lstm(self.write_dropout(c_t)) <NEW_LINE> M_t = F.broadcast_to(F.reshape((1 - z_t), (full_shape[0], full_shape[1], 1)), full_shape) * M_t <NEW_LINE> M_t += F.broadcast_to(F.reshape(z_t, (full_shape[0], full_shape[1], 1)), full_shape)... | The NSE write operation: Eq. 5 and 6. Here we can write back c_t instead. You could try :) | 625941f7bf627c535bc1384e |
def canThreePartsEqualSum(self, A): <NEW_LINE> <INDENT> s = sum(A) <NEW_LINE> if s % 3: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> p = 0 <NEW_LINE> p_s = 0 <NEW_LINE> for a in A: <NEW_LINE> <INDENT> p_s += a <NEW_LINE> if p_s == s / 3: <NEW_LINE> <INDENT> p_s = 0 <NEW_LINE> p += 1 <NEW_LINE> <DEDENT> <DEDENT>... | :type A: List[int]
:rtype: bool | 625941f7b830903b967e9f82 |
def read_longstr(self): <NEW_LINE> <INDENT> self.bit_count = self.bits = 0 <NEW_LINE> slen = unpack('>I', self.input.read(4))[0] <NEW_LINE> return self.input.read(slen).decode('utf-8') | Read a string that's up to 2**32 bytes
The encoding isn't specified in the AMQP spec, so assume it's utf-8 | 625941f7596a89723608a136 |
def get_kmers(reads, k): <NEW_LINE> <INDENT> kmers = [] <NEW_LINE> kmer_read_map = {} <NEW_LINE> for read in reads: <NEW_LINE> <INDENT> for i in range(len(read)-k+1): <NEW_LINE> <INDENT> kmer = read[i:i+k] <NEW_LINE> kmers.append(kmer) <NEW_LINE> set_map(kmer_read_map, kmer, {read}) <NEW_LINE> <DEDENT> <DEDENT> return ... | Identify all k-mers in a set of reads.
:param reads: the reads
:param k: the length of k-mers we want
:return: the list of all k-mers across the reads | 625941f73346ee7daa2b33f1 |
def get_test_vals(f): <NEW_LINE> <INDENT> cases = [] <NEW_LINE> try: <NEW_LINE> <INDENT> with open(f, "r") as fr: <NEW_LINE> <INDENT> contents = fr.read() <NEW_LINE> <DEDENT> contents = contents.split("\n") <NEW_LINE> for s in contents: <NEW_LINE> <INDENT> if s == "-arg": <NEW_LINE> <INDENT> mode = s <NEW_LINE> cases.a... | Extract arguments and answers from test file.
Params
======
f: str
The file to extract the parameters from | 625941f756ac1b37e6264840 |
def _reg_msz(self, value): <NEW_LINE> <INDENT> s = "" <NEW_LINE> ret = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for c in value.raw_data(): <NEW_LINE> <INDENT> s += ("%02x" % c) + "," <NEW_LINE> <DEDENT> <DEDENT> except TypeError: <NEW_LINE> <INDENT> return "ERROR_PARSER_REGISTRY_VALUE_TYPE_ERROR" <NEW_LINE> <DEDENT> if s... | REG_MULTI_SZ A sequence of null-terminated strings, terminated by an empty string ( ).
- Virus Malware -> 56,00,69,00,72,00,75,00,73,00,00,00,4d,00,61,00,6c,00,77, 00,61,00,72,00,65,00,00,00,00,00 | 625941f7236d856c2ad44e63 |
def read_lamination_parameters(thickness, laminaprop, xiA1, xiA2, xiA3, xiA4, xiB1, xiB2, xiB3, xiB4, xiD1, xiD2, xiD3, xiD4, xiE1, xiE2, xiE3, xiE4): <NEW_LINE> <INDENT> lam = Laminate() <NEW_LINE> lam.t = thickness <NEW_LINE> lam.matobj = read_laminaprop(laminaprop) <NEW_LINE> lam.xiA = np.array([1, xiA1, xiA2, xiA3,... | Calculates a laminate based on the lamination parameters.
The lamination parameters:
`\xi_{A1} \cdots \xi_{A4}`, `\xi_{B1} \cdots \xi_{B4}`,
`\xi_{C1} \cdots \xi_{C4}`, `\xi_{D1} \cdots \xi_{D4}`,
`\xi_{E1} \cdots \xi_{E4}`
are used to calculate the laminate constitutive matrix.
Parameters
----------
thickness : f... | 625941f76aa9bd52df037427 |
def _drawVisitedCells(self, colWidth, rowHeight, painter): <NEW_LINE> <INDENT> visited = self._alg.getVisitedCells() <NEW_LINE> if visited != None: <NEW_LINE> <INDENT> for cell in visited: <NEW_LINE> <INDENT> painter.fillRect(cell.column * (colWidth + self._GRID_SIZE), cell.row * (rowHeight + self._GRID_SIZE), colWidth... | Fills the algorithm's visited/non-active cells as fully blue. | 625941f707f4c71912b11b04 |
def end_trick(self): <NEW_LINE> <INDENT> led = self.trick_cards[0][0] <NEW_LINE> matching = [c for c in self.trick_cards if led == c[0]] <NEW_LINE> self.last_trick = self.trick_cards[:] <NEW_LINE> high_card = max(matching, key=card_sort_key) <NEW_LINE> index = self.trick_cards.index(high_card) <NEW_LINE> p = self.playe... | Ends a trick and adds the appropriate amount of points to one of the teams. This ends up
calling either end_hand() or start_trick() based on where in the hand it is.
Messages emitted:
Emits the 'end_trick' message (after a short delay) with the player number (0-4) for the
player who took the trick.
This also in... | 625941f7460517430c3947f1 |
def test_CNN(X_test, model): <NEW_LINE> <INDENT> probs = model.predict(X_test) <NEW_LINE> preds = np.argmax(probs, axis=-1) <NEW_LINE> return(probs,preds) | @Input : Test data and the model
@Input_type : 2D Numpy array of shape, sequential model
@Output : predicted probability of the classes, predicted highest probability
@Output_type : list,float | 625941f73617ad0b5ed68575 |
def setUp(self): <NEW_LINE> <INDENT> self.hass = get_test_home_assistant() <NEW_LINE> self.hass.config.temperature_unit = TEMP_CELSIUS <NEW_LINE> assert setup_component(self.hass, climate.DOMAIN, {'climate': { 'platform': 'generic_thermostat', 'name': 'test', 'cold_tolerance': 0.3, 'hot_tolerance': 0.3, 'heater': ENT_S... | Setup things to be run when tests are started. | 625941f773bcbd0ca4b2c6f4 |
def __init__(self, vertices, faces, textures=None, texture_res=1, texture_type='surface'): <NEW_LINE> <INDENT> self._vertices = vertices <NEW_LINE> self._faces = faces <NEW_LINE> if isinstance(self._vertices, np.ndarray): <NEW_LINE> <INDENT> self._vertices = torch.from_numpy(self._vertices).float().cuda() <NEW_LINE> <D... | vertices, faces and textures(if not None) are expected to be Tensor objects | 625941f74e4d5625662d4a4c |
def get_trn_label_slice_PNG_dir(self): <NEW_LINE> <INDENT> return self.get_base_dir() + self.config['paths']['trn_label_slice_PNG_dir'] | Retrieve directory of label files for training in PNG format. | 625941f73eb6a72ae02ecb6f |
def laidout( self, ): <NEW_LINE> <INDENT> return self.sequences.shape[1] > 1 | Are the sequences laid out properly
| 625941f7fff4ab517eb2fac0 |
def _create_surface(self): <NEW_LINE> <INDENT> surface = pygame.surface.Surface((self._width, self._height), pygame.SRCALPHA).convert_alpha() <NEW_LINE> if self.background_colour is not None: <NEW_LINE> <INDENT> surface.fill(self.background_colour) <NEW_LINE> <DEDENT> if self.inactive_colour is not None: <NEW_LINE> <IN... | Create the surface of the stimulus. | 625941f70a366e3fb873eea0 |
def filter_line(self, line): <NEW_LINE> <INDENT> filtered = [] <NEW_LINE> warn_msg = [] <NEW_LINE> splited = line.split("\n") <NEW_LINE> if not line and len(splited) < 1: <NEW_LINE> <INDENT> warn_msg = "[Warning] Empty line detected while filtering lines." <NEW_LINE> logging.warning(warn_msg) <NEW_LINE> self.warning_ms... | Removes `[` or `]` from the input line.
Args:
line: String that is a compatibility specification line from the `.ini`
config file.
Returns:
String that is a compatibility specification line without `[` and `]`. | 625941f70a50d4780f667517 |
def rescan(self, adapter=None, all=None, skipclaim=None, skipfsscan=None, type=None): <NEW_LINE> <INDENT> return execute_soap(self._client, self._host, self.moid, 'vim.EsxCLI.storage.core.adapter.Rescan', adapter=adapter, all=all, skipclaim=skipclaim, skipfsscan=skipfsscan, type=type, ) | Rescan SCSI HBAs to search for new Devices, remove DEAD paths and update path state. This operation will also run an claim operation equivalent to the claimrule run command and a filesystem rescan.
:param adapter: string, Select the adapter to use when rescanning SCSI adapters. This must be a SCSI HBA name as s... | 625941f7e76e3b2f99f3ae7f |
def test_update(self): <NEW_LINE> <INDENT> doc = {"_id": '1', "a": 1, "b": 2} <NEW_LINE> self.algolia_doc.upsert(doc) <NEW_LINE> self.algolia_doc.commit(True) <NEW_LINE> update_spec = {"$set": {"a": 1, "b": 2}} <NEW_LINE> self.algolia_doc.update(doc, update_spec) <NEW_LINE> self.algolia_doc.commit(True) <NEW_LINE> doc ... | Test the update method. | 625941f70fa83653e4657636 |
def style_cost(self): <NEW_LINE> <INDENT> sess.run(self.model['input'].assign(self.style_image)) <NEW_LINE> return self.compute_style_cost() | Pre Calculate the activation of style image's GRAM matrixes
and return the tensor for style cost | 625941f7435de62698dfe2cc |
def blitme(self): <NEW_LINE> <INDENT> self.screen.blit(self.image, self.rect) | Blit ball image in its rect on the screen. | 625941f7baa26c4b54cb1797 |
def make_archive_url(market_code, report_date=None): <NEW_LINE> <INDENT> target_url = BASE_ADDRESS + ARCHIVE_BASE + market_code <NEW_LINE> if report_date: <NEW_LINE> <INDENT> target_url = target_url + "&date=" + report_date <NEW_LINE> <DEDENT> return target_url | Return the appropriate URL for the top archive page
arguments: markeg_code string containing the id of the auction to download
returns: a string containing the URL to download the top archive page | 625941f74f88993c3716c6df |
def create_tiles_content(media): <NEW_LINE> <INDENT> movie_content = '' <NEW_LINE> tv_content = '' <NEW_LINE> for item in media: <NEW_LINE> <INDENT> youtube_id_match = re.search(r'(?<=v=)[^&#]+', item.trailer_youtube_url) <NEW_LINE> youtube_id_match = youtube_id_match or re.search(r'(?<=be/)[^&#]+', item.trailer_youtub... | Iterates through a collection of media titles and generates HTML markup
from each valid title. | 625941f74428ac0f6e5bae78 |
def sync_mempools(rpc_connections, *, wait=1, timeout=600, flush_scheduler=True): <NEW_LINE> <INDENT> while timeout > 0: <NEW_LINE> <INDENT> pool = set(rpc_connections[0].getrawmempool()) <NEW_LINE> num_match = 1 <NEW_LINE> for i in range(1, len(rpc_connections)): <NEW_LINE> <INDENT> if set(rpc_connections[i].getrawmem... | Wait until everybody has the same transactions in their memory
pools | 625941f723849d37ff7b3709 |
def grab(self) -> typing.List[DataAndMetadata.DataAndMetadata]: <NEW_LINE> <INDENT> ... | Grab list of data/metadata from the task.
.. versionadded:: 1.0
This method will wait until the task finishes.
:return: The list of data and metadata items that were read.
:rtype: list of :py:class:`DataAndMetadata` | 625941f7498bea3a759ba12c |
def __init__(self, unit_name: str, validation_pool=None): <NEW_LINE> <INDENT> self._unit_name = unit_name <NEW_LINE> self._sender = None <NEW_LINE> self._command_queue = [] <NEW_LINE> self._thread_paused = True <NEW_LINE> self._thread_stop = False <NEW_LINE> self._validator = validation_pool | The class constructor
unit_name: the name of the unit that uses this Command executor
validation_pool: the validation component that waits for an executed command | 625941f7fbf16365ca6f6852 |
def __init__( self, *, source: Union[str, "RoutingSource"], endpoint_names: List[str], is_enabled: bool, name: Optional[str] = None, condition: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(FallbackRouteProperties, self).__init__(**kwargs) <NEW_LINE> self.name = name <NEW_LINE> self.source = source <NEW_L... | :keyword name: The name of the route. The name can only include alphanumeric characters,
periods, underscores, hyphens, has a maximum length of 64 characters, and must be unique.
:paramtype name: str
:keyword source: Required. The source to which the routing rule is to be applied to. For
example, DeviceMessages. Poss... | 625941f7a79ad161976cc7c5 |
def AccessRuleFactory(self,identityReference,accessMask,isInherited,inheritanceFlags,propagationFlags,type): <NEW_LINE> <INDENT> pass | AccessRuleFactory(self: MutexSecurity,identityReference: IdentityReference,accessMask: int,isInherited: bool,inheritanceFlags: InheritanceFlags,propagationFlags: PropagationFlags,type: AccessControlType) -> AccessRule
Creates a new access control rule for the specified user,with the specified access rights,
acce... | 625941f7cc0a2c11143dd511 |
def get_drive_info(): <NEW_LINE> <INDENT> res = None <NEW_LINE> q = subprocess.Popen( ['system_profiler', 'SPUSBDataType', '-detailLevel', 'full', '-xml'], stdout=subprocess.PIPE) <NEW_LINE> try: <NEW_LINE> <INDENT> res = plistlib.readPlist(q.stdout) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDE... | finds and returns a list of connected usb drives. | 625941f7d18da76e23532b5e |
def zip(self, zip): <NEW_LINE> <INDENT> tmpl = loader.load('zip.xml') <NEW_LINE> vals = { 'username': self.username, 'password': self.password, 'zip': zip, } <NEW_LINE> url = 'https://ws.seur.com/WSEcatalogoPublicos/servlet/XFireServlet/WSServiciosWebPublicos' <NEW_LINE> xml = tmpl.generate(**vals).render() <NEW_LINE> ... | Get Seur values from zip
:param zip: string
:return: list dict | 625941f7e1aae11d1e74a33e |
def generate_json(tenant, output_file, task_info, extract_args): <NEW_LINE> <INDENT> query = extract_args[TaskConstants.TASK_QUERIES][QueryType.QUERY] <NEW_LINE> with EdCoreDBConnection(tenant=tenant) as connection, open(output_file, 'w', encoding='utf-8') as json_file: <NEW_LINE> <INDENT> results = connection.get_resu... | Write data extract to JSON file.
@param tenant: Requestor's tenant ID
@param output_file: File pathname of extract file
@param task_info: Task information for recording stats
@param extract_args: Arguments specific to generate_json | 625941f77b25080760e39ad4 |
@APP.route('/auth', methods=['POST']) <NEW_LINE> def auth(): <NEW_LINE> <INDENT> request_data = request.get_json() <NEW_LINE> print(request_data) <NEW_LINE> email = request_data.get('email') <NEW_LINE> password = request_data.get('password') <NEW_LINE> if not email: <NEW_LINE> <INDENT> LOG.error("No email provided") <N... | Create JWT token based on email. | 625941f71d351010ab85619a |
@decor3 <NEW_LINE> def add_author_labels(file_content): <NEW_LINE> <INDENT> changes = 0 <NEW_LINE> msg = None <NEW_LINE> res_dict = create_labels(file_content) <NEW_LINE> label_begin = res_dict['label_begin'] <NEW_LINE> label_end = res_dict['label_end'] <NEW_LINE> surnames = res_dict['surnames'] <NEW_LINE> match_surnam... | Проверяет наличие меток. Если не найдены, и есть данные для их создания,
то добавляет метки \label{Фамилия_begin} и \label{Фамилия_end}
:param file_content:
:return: | 625941f7d53ae8145f87a8e1 |
def _handle_host_definition_headers(self, headers, default_host_definition_headers): <NEW_LINE> <INDENT> host_definition_headers = Settings.get("pas_http_server_host_definition_headers", default_host_definition_headers ) <NEW_LINE> for host_definition_header in host_definition_headers: <NEW_LINE> <INDENT> if (host_defi... | Handles headers containing the server host name and port.
:param headers: Headers to search
:param default_host_definition_headers: Default list of HOST header names
:since: v1.0.0
| 625941f766673b3332b92710 |
def create_obj(self, kwargs): <NEW_LINE> <INDENT> return self.model_name.objects.create(**kwargs) | save/create instances of ORM into the database | 625941f756b00c62f0f14cdd |
def get_app_dir(self): <NEW_LINE> <INDENT> return '' | There is no app dir for packed jobs.
The dir is changed before each run.
Returns:
str : Empty string | 625941f766673b3332b92711 |
def on_completion(self) -> TxnExpr: <NEW_LINE> <INDENT> return self.txnType(TxnField.on_completion) | Get the on completion action from the ApplicationCall portion of the transaction.
Only set when :any:`type_enum()` is :any:`TxnType.ApplicationCall`. | 625941f7e64d504609d74ebf |
def _on_leave_notify_event(self, widget, event): <NEW_LINE> <INDENT> self.__set_artwork(self.__object.loved) | Update love opacity
@param widget as Gtk.EventBox (can be None)
@param event as Gdk.Event (can be None) | 625941f7283ffb24f3c55f79 |
@validation.handle_sandbox_restart_error <NEW_LINE> def restart(args): <NEW_LINE> <INDENT> with open(LATEST_SANDBOX_RUN_ARGS_FILE, 'r') as f: <NEW_LINE> <INDENT> run_args = f.read() <NEW_LINE> <DEDENT> conductr_cli.sandbox_main.run(['stop'], configure_logging=False) <NEW_LINE> conductr_cli.sandbox_main.run(['run'] + ru... | `sandbox restart` command | 625941f7a05bb46b383ece9a |
def create_locks(pro_team_matchup): <NEW_LINE> <INDENT> pro_team_matchup = player_models.Schedule.objects.get(pk = pro_team_matchup) <NEW_LINE> players = player_models.Player.objects.filter(Q(pro_team = pro_team_matchup.home)|Q(pro_team = pro_team_matchup.away)) <NEW_LINE> for player in players: <NEW_LINE> <INDENT> gui... | Creates 0'd out stat records once a player has started playing.
| 625941f7cdde0d52a9e536b9 |
def get_power_plant_data(dataset, **kwargs): <NEW_LINE> <INDENT> dataset = dataset.lower() <NEW_LINE> if dataset in ["sandiamod", "cecinverter"]: <NEW_LINE> <INDENT> return pvlib.pvsystem.retrieve_sam( name=dataset, path=kwargs.get("path", None) ) <NEW_LINE> <DEDENT> elif dataset == "oedb_turbine_library": <NEW_LINE> <... | Function to retrieve power plant data sets provided by feed-in models.
This function can be used to retrieve power plant data from data sets
and to get an overview of which modules, inverters and turbine types are
provided and can be used in feed-in calculations.
Parameters
----------
dataset : str
Specifies data... | 625941f7f9cc0f698b140c75 |
def __str__(self): <NEW_LINE> <INDENT> return self.player_initials | Return the player's initials string | 625941f7ab23a570cc250808 |
def generate_SCS_12_default_config(self, filename): <NEW_LINE> <INDENT> config = { 'clientCert': getCertFilename("device_expired.cert"), 'clientKey': getCertFilename("device_expired.key") } <NEW_LINE> writeConfig(filename, config) | Generates the WinnForum configuration for SCS.12 | 625941f756b00c62f0f14cde |
def process_result_value(self, value, dialect): <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> provider = Provider(value, location=self.location) <NEW_LINE> return provider | Called when accessing the value from the database and returning the
appropriate provider file wrapper.
Arguments
---------
value : str
The stored relative path in the database
dialect : sqlalchemy.engine.interfaces.Dialect
The dialect
Returns
-------
obj
An instance of the Store Provider class | 625941f73539df3088e2e9cb |
def rand_email_subject(self): <NEW_LINE> <INDENT> return ( f'{self.tcex.utils.random_string(randint(5,15))} ' f'{self.tcex.utils.random_string(randint(5,15))} ' f'{self.tcex.utils.random_string(randint(5,15))}' ) | Return a random email subject. | 625941f776d4e153a657f1b2 |
def encrypt_string(string, public_key): <NEW_LINE> <INDENT> integer = s2i(string) <NEW_LINE> return crypt(integer, public_key) | Take a string, return an integer. | 625941f75166f23b2e1a57d9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.