code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def SetAlignment(self,alignment): <NEW_LINE> <INDENT> if self.alignment != alignment: <NEW_LINE> <INDENT> self.alignment = alignment <NEW_LINE> self.Sizer.Detach(self.content) <NEW_LINE> self.Sizer.Add(self.content, 1 if alignment == ALIGN_LEFT else 0, self.alignment) <NEW_LINE> self.Sizer.Layout()
Can change the alignment of the buttons in the bar, left or center... and maybe right?
625941b5d10714528d5ffad1
def get_amount_profile(GC_airdens,GC_mixrat,GC_height): <NEW_LINE> <INDENT> air_amount = np.multiply(conv4D_3D(GC_airdens), conv4D_3D(GC_height ) ) <NEW_LINE> tra_amount = np.multiply(air_amount, conv4D_3D(GC_mixrat ) ) <NEW_LINE> return tra_amount
Produces a 3D array of the amount of a substance per area in each voxel
625941b556b00c62f0f1444e
@deprecated('site.load_pages_from_pageids()', since='20200515') <NEW_LINE> def PagesFromPageidGenerator(pageids, site=None): <NEW_LINE> <INDENT> if site is None: <NEW_LINE> <INDENT> site = pywikibot.Site() <NEW_LINE> <DEDENT> return site.load_pages_from_pageids(pageids)
DEPRECATED. Return a page generator from pageids. Pages are iterated in the same order than in the underlying pageids. Pageids are filtered and only one page is returned in case of duplicate pageid. :param pageids: an iterable that returns pageids, or a comma-separated string of pageids (e.g. '945097,...
625941b55fdd1c0f98dc0023
def OeManipulateFP(inputfile,outputfile,formats='sdf',fingerprint='false',addsame='false'): <NEW_LINE> <INDENT> ifs=OeReadfile(inputfile) <NEW_LINE> if formats=='sdf': <NEW_LINE> <INDENT> ofs=OeWritefile(outputfile) <NEW_LINE> <DEDENT> if formats=='csv': <NEW_LINE> <INDENT> csvfile=open(outputfile,'w') <NEW_LINE> if fi...
Calculate the hex of binary MACCS and add an extra field inputfile can be any format outputfile should be sdf or csv formats is for outputfile fingerprint can be MACCSH or MACCSB addsame is the content of the extra field, this is for unsupervised learning. No specific meaning
625941b59f2886367277a683
def create_state(self): <NEW_LINE> <INDENT> pass
Factory method providing an interface for creating State instances @return GameState : @author
625941b5f9cc0f698b1403f8
def is_cn_char(ch): <NEW_LINE> <INDENT> return ch >= u'\u4e00' and ch <= u'\u9fa5'
Test if a char is a Chinese character.
625941b563d6d428bbe442e1
def py_string_to_ipy_string(str): <NEW_LINE> <INDENT> return read_python(BytesIO(str.encode()))
Read a string containing a regular Python script with special formatting, and perform preprocessing on it. The result is a string that conforms to the IPython notebook version 3 Python script format.
625941b550812a4eaa59c118
@contextmanager <NEW_LINE> def wait_for_element_visibility(driver, element, timeout=5): <NEW_LINE> <INDENT> yield <NEW_LINE> WebDriverWait(driver, timeout).until( visibility_of(element) )
Explicitly wait while element becomes visible. Args: driver: selenium webdriver instance. element: element we are waiting to be visible. timeout: timeout for waiting. Returns:
625941b5be383301e01b527f
def _apply_to_listeners(self, function, *args): <NEW_LINE> <INDENT> for type in self.listener: <NEW_LINE> <INDENT> getattr(self.listener[type], function)(*args)
Apply a simple function to all listeners.
625941b582261d6c526ab295
def diameterOfBinaryTree(self, root): <NEW_LINE> <INDENT> def height(root): <NEW_LINE> <INDENT> if not root: return 0 <NEW_LINE> return 1 + max(height(root.left), height(root.right)) <NEW_LINE> <DEDENT> def r(root): <NEW_LINE> <INDENT> if not root: return 0 <NEW_LINE> left = r(root.left) <NEW_LINE> right = r(root.right...
:type root: TreeNode :rtype: int
625941b54d74a7450ccd3fb4
def _send_message(self, message, with_last_error=False, check_primary=True): <NEW_LINE> <INDENT> if check_primary and not with_last_error and not self.is_primary: <NEW_LINE> <INDENT> raise AutoReconnect("not master") <NEW_LINE> <DEDENT> sock_info = self.__socket() <NEW_LINE> try: <NEW_LINE> <INDENT> try: <NEW_LINE> <IN...
Say something to Mongo. Raises ConnectionFailure if the message cannot be sent. Raises OperationFailure if `with_last_error` is ``True`` and the response to the getLastError call returns an error. Return the response from lastError, or ``None`` if `with_last_error` is ``False``. :Parameters: - `message`: message to...
625941b5167d2b6e31218990
def list_filesystem_snapshot_policies(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('callback'): <NEW_LINE> <INDENT> return self.list_filesystem_snapshot_policies_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.list_filesystem_...
List policies attached to filesystem snapshots. 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) >>> >>> thread = api.list_filesystem...
625941b530bbd722463cbbb4
def dynamicCompletion (self,event=None): <NEW_LINE> <INDENT> c,p,u = self.c,self.c.p,self.c.p.v.u <NEW_LINE> w = self.editWidget(event) <NEW_LINE> if not w: return <NEW_LINE> s = w.getAllText() <NEW_LINE> ins = w.getInsertPoint() <NEW_LINE> if 0 < ins < len(s) and not g.isWordChar(s[ins]): ins -= 1 <NEW_LINE> i,j = g.g...
dabbrev-completion Insert the common prefix of all dynamic abbrev's matching the present word. This corresponds to C-M-/ in Emacs.
625941b54527f215b584c24e
@login_required <NEW_LINE> def edit_occ(request, occurrence_id): <NEW_LINE> <INDENT> occurrence = get_object_or_404(Occurrence, id=occurrence_id) <NEW_LINE> if not occurrence.cancelled: <NEW_LINE> <INDENT> form = OccurrenceForm(data=request.POST or None, instance=occurrence) <NEW_LINE> if request.method == 'POST': <NEW...
edit a persisted occurrence
625941b5a934411ee375148d
def setHostNameIDL(self, sessionHandle, hostName): <NEW_LINE> <INDENT> pass
Parameters: - sessionHandle - hostName
625941b59f2886367277a684
def check_inside_guest(ishotplug): <NEW_LINE> <INDENT> def _check_disk_in_guest(): <NEW_LINE> <INDENT> new_disk_num = len(vm.get_disks()) <NEW_LINE> if new_disk_num > ori_disk_num: <NEW_LINE> <INDENT> logging.debug("New disk is found in vm") <NEW_LINE> return True <NEW_LINE> <DEDENT> logging.debug("New disk is not foun...
Check devices within the guest :param ishotplug: True for hotplug, False for hotunplug :raise: test.fail if the result is not expected
625941b556ac1b37e6263fd3
def create_intervals(data): <NEW_LINE> <INDENT> if len(data) is 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> intervals = [] <NEW_LINE> start = None <NEW_LINE> stop = None <NEW_LINE> for i in range(min(data), max(data)+1): <NEW_LINE> <INDENT> if i in data: <NEW_LINE> <INDENT> stop = i <NEW_LINE> if not start: <N...
Create a list of intervals out of set of ints.
625941b5be8e80087fb20a41
def set_vel(self, vel): <NEW_LINE> <INDENT> assert isinstance(vel, Vector) and len(vel) == 3 <NEW_LINE> self.vel = vel
Set the velocity in Cartesian coordinates.
625941b599fddb7c1c9de186
def cleanup(): <NEW_LINE> <INDENT> if MOUNTED: <NEW_LINE> <INDENT> exe('umount ' + mntpath) <NEW_LINE> <DEDENT> exe('losetup --detach' + loop) <NEW_LINE> exe('rm -r ' + filepath) <NEW_LINE> exe('rmdir ' + mntpath)
Cleanup after script.
625941b5f8510a7c17cf94f7
def extra(self, select=None, where=None, params=None, tables=None, order_by=None, select_params=None): <NEW_LINE> <INDENT> assert self.query.can_filter(), "Cannot change a query once a slice has been taken" <NEW_LINE> clone = self._clone() <NEW_LINE> clone.query.add_extra(select, select_params, where, params...
Adds extra SQL fragments to the query.
625941b53c8af77a43ae3591
def isReflected(self, points): <NEW_LINE> <INDENT> minX, maxX = float("inf"), float("-inf") <NEW_LINE> all = set() <NEW_LINE> for p in points: <NEW_LINE> <INDENT> minX = min(minX, p[0]) <NEW_LINE> maxX = max(maxX, p[0]) <NEW_LINE> all.add(tuple(p)) <NEW_LINE> <DEDENT> for p in points: <NEW_LINE> <INDENT> if (minX+maxX-...
:type points: List[List[int]] :rtype: bool
625941b57c178a314d6ef24a
def test_that_when_deleting_a_policy_succeeds_the_delete_policy_method_returns_true(boto_conn): <NEW_LINE> <INDENT> result = boto_iot.delete_policy(policyName='testpolicy', **pytest.conn_parameters) <NEW_LINE> assert result['deleted']
tests True policy deleted.
625941b5fbf16365ca6f5fad
def add_job(self, job, args, envs, newid=None): <NEW_LINE> <INDENT> if newid is None: <NEW_LINE> <INDENT> newid = str(uuid.uuid4()) <NEW_LINE> <DEDENT> assert isinstance(job, jobthread.Job) <NEW_LINE> job.setup(self, newid) <NEW_LINE> jthread = threading.Thread(target=jobthread.begin, args=(job, args, envs)) <NEW_LINE>...
Add a job to this server and start it :param job: the job object :param args: arguments for this job :param envs: an environment dictionary if required :param newid: An ID for the job, if omitted a unique string is generated :return:
625941b5d58c6744b4257a53
def main(): <NEW_LINE> <INDENT> set_infomation() <NEW_LINE> image_cap() <NEW_LINE> upload_files()
メイン関数
625941b5f548e778e58cd36e
def init(_time_str: str=None): <NEW_LINE> <INDENT> global time_str <NEW_LINE> if _time_str: time_str = _time_str <NEW_LINE> else: time_str = datetime.utcnow().strftime("%Y%m%d-%H%M%S")
Sets the time string for the log file (i.e. "log-{time_str}.txt").
625941b5004d5f362079a12a
def __init__(self,con,BPrIds): <NEW_LINE> <INDENT> self.con = con <NEW_LINE> self.cur = self.con.cursor() <NEW_LINE> self.BPrIds = BPrIds <NEW_LINE> self.setBasicData()
docstring for __init__
625941b501c39578d7e74c36
@pytest.fixture(scope='session') <NEW_LINE> def bottle_app(backend): <NEW_LINE> <INDENT> app = bottle.Bottle() <NEW_LINE> jwt_plugin = JWTProviderPlugin( keyword='jwt', auth_endpoint='/auth', backend=backend, fields=('username', 'password'), secret='my_secret', ttl=1, **{'id_field': 'username'} ) <NEW_LINE> app.install...
pytest fixture for `bottle.Bottle` instance.
625941b567a9b606de4a7cb0
def poison_estimator( self, x: np.ndarray, y: np.ndarray, batch_size: int = 64, nb_epochs: int = 10, **kwargs ) -> "CLASSIFIER_TYPE": <NEW_LINE> <INDENT> train_data = np.copy(x) <NEW_LINE> train_labels = np.copy(y) <NEW_LINE> selected_indices = np.zeros(len(x)).astype(bool) <NEW_LINE> if len(self.pp_poison) == 1: <NEW_...
Train a poisoned model and return it :param x: Training data :param y: Training labels :param batch_size: The size of the batches used for training :param nb_epochs: The number of epochs to train for :return: A classifier with embedded backdoors
625941b54f6381625f114839
def make_module_extra(self): <NEW_LINE> <INDENT> txt = super(EB_LAMMPS, self).make_module_extra() <NEW_LINE> python = get_software_version('Python') <NEW_LINE> if python: <NEW_LINE> <INDENT> pyshortver = '.'.join(get_software_version('Python').split('.')[:2]) <NEW_LINE> pythonpath = os.path.join('lib', 'python%s' % pys...
Add install path to PYTHONPATH
625941b5851cf427c661a30e
def testCompression(self): <NEW_LINE> <INDENT> dirtools.os = os <NEW_LINE> dirtools.open = open <NEW_LINE> test_dir = '/tmp/test_dirtools' <NEW_LINE> if os.path.isdir(test_dir): <NEW_LINE> <INDENT> shutil.rmtree(test_dir) <NEW_LINE> <DEDENT> os.mkdir(test_dir) <NEW_LINE> with open(os.path.join(test_dir, 'file1'), 'wb')...
Check the compression, withouth pyfakefs because it doesn't support tarfile.
625941b5009cb60464c631b0
def update_virus_fields(database, virus_name, fields): <NEW_LINE> <INDENT> if not fields: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> with open(database, "r+") as db_file: <NEW_LINE> <INDENT> contents = db_file.readlines() <NEW_LINE> index = get_virus_index(contents, virus_name) <NEW_LINE> i...
update virus fields to have new value - does nothing if fields are not present
625941b573bcbd0ca4b2be70
def mel_spectrogram(spectrogram, stft_channels=p.stft_channels, n_mels=p.n_mels, fmin=p.fmin, fmax=p.fmax, sr=p.sr): <NEW_LINE> <INDENT> if stft_channels != p.stft_channels or n_mels != p.n_mels or fmin != p.fmin or fmax != p.fmax or sr != p.sr: <NEW_LINE> <INDENT> mel_basis = librosa.filters.mel(sr=sr, n_fft=stft_chan...
Compute the mel spectrogram from a spectrogram.
625941b51f037a2d8b945ff1
def entry_is_empty(data): <NEW_LINE> <INDENT> if data == None or data == "": <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
Tests for a null data field
625941b57b180e01f3dc45f9
def fetch_data(self, sql_command): <NEW_LINE> <INDENT> cursor = self.connect_sqllite() <NEW_LINE> cursor.execute(sql_command) <NEW_LINE> results = cursor.fetchall() <NEW_LINE> return results
Excecutes the sqllite commands after a cursor with an established cursor. : param cursor: An established cursor object between Python and sqllite. : param sql_command: The sqllite command to be executed.
625941b5377c676e91271f9d
@bp.route('/reset_password/<token>', methods=['GET', 'POST']) <NEW_LINE> def reset_password(token): <NEW_LINE> <INDENT> if current_user.is_authenticated: <NEW_LINE> <INDENT> return redirect(url_for('coding.index')) <NEW_LINE> <DEDENT> user = User.verify_reset_password_token(token) <NEW_LINE> if not user: <NEW_LINE> <IN...
Allow a user to reset their password. Args: token (str): A reset token generated by send_password_reset_email Returns: Redirect to reset password page when navigating to this route for the first time. Redirect to home page if user is already logged in. Redirect to home page if reset to...
625941b5796e427e537b03b5
def _reindent(text, indent): <NEW_LINE> <INDENT> if text: <NEW_LINE> <INDENT> return text.replace("\n", "\n" + indent)
Reindent `text`.
625941b53539df3088e2e13e
def get_ip_for_interface(self, network_interface): <NEW_LINE> <INDENT> if network_interface.startswith('0') or network_interface == '::': <NEW_LINE> <INDENT> return network_interface <NEW_LINE> <DEDENT> is_cidr = len(network_interface.split(".")) == 4 or len( network_interface.split(":")) == 8 <NEW_LINE> if is_cidr: <N...
Helper to return the ip address of this machine on a specific interface. @param str network_interface: either the name of the interface, or a CIDR range, in which we expect the interface's ip to fall. Also accepts 0.0.0.0 (and variants, like 0/0) as a special case, which will simply return what you passed in.
625941b5099cdd3c635f0a4f
def handle(self, request): <NEW_LINE> <INDENT> entity = pop_path_info(request.environ) <NEW_LINE> if request.method == "OPTIONS": <NEW_LINE> <INDENT> return self.handle_options(request, entity) <NEW_LINE> <DEDENT> if not entity: <NEW_LINE> <INDENT> return self.handle_index() <NEW_LINE> <DEDENT> elif entity == "robots.t...
Handle a request, parse and validate arguments and dispatch the request.
625941b57b180e01f3dc45fa
def ExecuteTimeLoad(command): <NEW_LINE> <INDENT> browsers = command["--browsers"].split(",") <NEW_LINE> num_browsers = len(browsers) <NEW_LINE> if command["--browserversions"]: <NEW_LINE> <INDENT> browser_versions = command["--browserversions"].split(",") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> browser_versions ...
Executes the TimeLoad command.
625941b5a17c0f6771cbde47
def make_move(self): <NEW_LINE> <INDENT> raise NotImplementedError('make_move')
Return the next move to make.
625941b5627d3e7fe0d68c41
def deletePlayers(): <NEW_LINE> <INDENT> conn = connect() <NEW_LINE> cursor = conn.cursor() <NEW_LINE> cursor.execute("TRUNCATE TABLE players CASCADE") <NEW_LINE> conn.commit() <NEW_LINE> conn.close()
Remove all the player records from the database.
625941b5b7558d58953c4d0f
def deployments_list(resource_group, **kwargs): <NEW_LINE> <INDENT> result = {} <NEW_LINE> resconn = __utils__['azurearm.get_client']('resource', **kwargs) <NEW_LINE> try: <NEW_LINE> <INDENT> deployments = __utils__['azurearm.paged_object_to_list']( resconn.deployments.list_by_resource_group( resource_group_name=resour...
.. versionadded:: Fluorine List all deployments within a resource group. CLI Example: .. code-block:: bash salt-call azurearm_resource.deployments_list testgroup
625941b5097d151d1a222c4f
def test_140_weight_read_only(self): <NEW_LINE> <INDENT> rule = Mock() <NEW_LINE> rule.ruletype = TERuletype.allow <NEW_LINE> rule.tclass = "infoflow" <NEW_LINE> rule.perms = set(["med_r", "hi_r"]) <NEW_LINE> permmap = PermissionMap("tests/perm_map") <NEW_LINE> r, w = permmap.rule_weight(rule) <NEW_LINE> self.assertEqu...
PermMap get weight of read-only rule.
625941b50c0af96317bb7fdc
def glInitGl45VERSION(): <NEW_LINE> <INDENT> from OpenGL import extensions <NEW_LINE> return extensions.hasGLExtension( _EXTENSION_NAME )
Return boolean indicating whether this extension is available
625941b530bbd722463cbbb5
def process(self): <NEW_LINE> <INDENT> histo = copy.deepcopy(self.data['pitches.pitchClassHistogram']) <NEW_LINE> pIndexMax = histo.index(max(histo)) <NEW_LINE> pCountMax = histo[pIndexMax] <NEW_LINE> if not pCountMax: <NEW_LINE> <INDENT> raise JSymbolicFeatureException('input lacks notes') <NEW_LINE> <DEDENT> histo[pI...
Do processing necessary, storing result in feature.
625941b538b623060ff0abe2
def entity_destination_location_type_get(self, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.entity_destination_location_type_get_with_http_info(**kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.entity_de...
EntityDestinationLocationType_GET # noqa: E501 # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.entity_destination_location_type_get(async_req=True) >>> result = thread.get() :param async_req bool :param str fiel...
625941b5d58c6744b4257a54
def create(self): <NEW_LINE> <INDENT> c.default_extern_type = auth_internal.KallitheaAuthPlugin.name <NEW_LINE> c.default_extern_name = auth_internal.KallitheaAuthPlugin.name <NEW_LINE> user_model = UserModel() <NEW_LINE> user_form = UserForm()() <NEW_LINE> try: <NEW_LINE> <INDENT> form_result = user_form.to_python(dic...
POST /users: Create a new item
625941b5d8ef3951e3243330
def test_RestrictingNodeTransformer__visit_Name__3(): <NEW_LINE> <INDENT> result = compile_restricted_exec( BAD_NAME_OVERRIDE_OVERRIDE_GUARD_WITH_FUNCTION) <NEW_LINE> assert result.errors == ( 'Line 2: "_getattr" is an invalid variable name because it ' 'starts with "_"',)
It denies a function name starting in `_`.
625941b5956e5f7376d70c6f
def start_parsing(self): <NEW_LINE> <INDENT> if self.check_parser_start() is False: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.parsing_control_button.config(state=tk.DISABLED) <NEW_LINE> self.parsing_control_button.update() <NEW_LINE> args = (self.window.characters_frame.characters, self.character_data, self.w...
Start the results process and open the Overlay
625941b50fa83653e4656db1
def _get_smc_filename(self, ids): <NEW_LINE> <INDENT> return '%s - Situation map closeup.jpg' % self.short_name
Situation map closeup filename
625941b515fb5d323cde08fc
def changePassword(request): <NEW_LINE> <INDENT> user = username = old_password = new_password = confirm_password = None <NEW_LINE> if request.POST: <NEW_LINE> <INDENT> old_password = request.POST['old_password'] <NEW_LINE> new_password = request.POST['new_password'] <NEW_LINE> confirm_password = request.POST['confirm_...
Change password function.
625941b53346ee7daa2b2b5c
def key_event_answer(key): <NEW_LINE> <INDENT> if key: <NEW_LINE> <INDENT> print(f"Key {action}: {key}") <NEW_LINE> check_target(key) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(f"Key {action}: ESC") <NEW_LINE> print("Script terminated.") <NEW_LINE> return False
If a key code is given, check if it is target, otherwise (ESC) quit. Parameters: key (str): Key code captured. Returns: bool: False only if key pressed/released was ESC.
625941b52eb69b55b151c69d
def test_version(): <NEW_LINE> <INDENT> assert roddy.__version__
There should be a version associated with roddy.
625941b585dfad0860c3ac4c
def __init__(self, mainwindow, selection): <NEW_LINE> <INDENT> self.mainwindow = mainwindow <NEW_LINE> self.model = mainwindow.model <NEW_LINE> self.selection = selection <NEW_LINE> self.boxes = [self.create_info_box(elem) for elem in selection] <NEW_LINE> selection.inserted.connect(self._insert) <NEW_LINE> selection.r...
Add toolbar tool to panel and subscribe to capture events.
625941b5aad79263cf39082e
def generate(self, seed: list, iteration_count: int, name: str, output: CustomTrackPoolInterface, track: CustomTrack1D = CustomTrack1D(8, 4, 4, [], "")) -> tuple: <NEW_LINE> <INDENT> iteration_seed = seed <NEW_LINE> generated = [] <NEW_LINE> raw = [] <NEW_LINE> for iteration in range(int(iteration_count / self.y_size))...
Метод генерации набора долей по сиду, составляет дорожку для трека и возвращает раздельно (сид, сгенерированная часть) :param track: Экземпляр Track, с заданными параметрами размера и разбиения, используется в качестве контейнера сгененрированных данных для дальнейшей передачи в TrackPoolDoge :param output: Интерф...
625941b58e05c05ec3eea164
def lowess_xr(da, x_dset="date", min_days_weighted=2 * 365.25, frac=0.7, n_iter=2): <NEW_LINE> <INDENT> import xarray as xr <NEW_LINE> x = date2num(da[x_dset].values) <NEW_LINE> if min_days_weighted and min_days_weighted > 0: <NEW_LINE> <INDENT> frac = _find_frac(x, min_days_weighted) <NEW_LINE> <DEDENT> out_stack = lo...
Run lowess on a DataArray stack. Args: da (xr.DataArray): 3D xarray containing data to be smoothed along dimension `x_dset`. x_dset (str, optional): Name of the time dimension. Defaults to "date". min_days_weighted (float, optional): Minimum time period of data to include in smoothing. See notes. D...
625941b591af0d3eaac9b807
def cast(*args): <NEW_LINE> <INDENT> return _itkInterpolateImageFilterPython.itkInterpolateImageFilterIUS3IUS3_cast(*args)
cast(itkLightObject obj) -> itkInterpolateImageFilterIUS3IUS3
625941b557b8e32f52483293
def negloglikelihood(self, mu, S, pi): <NEW_LINE> <INDENT> assert(mu.shape == (self.K, self.D) and S.shape == (self.K, self.D, self.D) and pi.shape == (self.K, 1)) <NEW_LINE> nlogl= 0 <NEW_LINE> l=0 <NEW_LINE> for i in range(self.n): <NEW_LINE> <INDENT> for k in range(self.K): <NEW_LINE> <I...
Compute the E step of the EM algorithm. Arguments: mu -- component means, K x D array S -- component covariances, K x D x D array pi -- component weights, K x 1 array Returns: nlogl -- negative log-likelihood, 1x 1 array
625941b560cbc95b062c633c
def test_pool_list(self): <NEW_LINE> <INDENT> self.client.login(email='test@test.io', password='foo-bar') <NEW_LINE> pool1 = create_pool(self.user) <NEW_LINE> library1 = create_library(get_random_name(), status=4) <NEW_LINE> library2 = create_library(get_random_name(), status=-1) <NEW_LINE> sample1 = create_sample(get_...
Ensure get pool list behaves correctly.
625941b5d7e4931a7ee9dd0f
def stop(self): <NEW_LINE> <INDENT> return _atsc.atsc_randomizer_sptr_stop(self)
stop(self) -> bool
625941b5a8370b7717052695
def angle(x, y): <NEW_LINE> <INDENT> tx_ty = len(x) * len(y) <NEW_LINE> if tx_ty == 0: <NEW_LINE> <INDENT> return math.pi / 2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> intersection_size = len(x & y) <NEW_LINE> return math.acos(intersection_size / math.sqrt(tx_ty))
Compute the angle between sets x and y. Parameters ---------- x : set describes the temrs in a tweet y : set describes the terms in a tweet Returns ------- angle : float the angle between the two vectors in radians.
625941b5d268445f265b4c68
def __del__(self): <NEW_LINE> <INDENT> if self._cleanup_session: <NEW_LINE> <INDENT> self._session.loop.run_until_complete(self._session.close())
Cleanup the session if it was created here
625941b58e71fb1e9831d5a1
def toggle_link_state(self, id, linked): <NEW_LINE> <INDENT> self._api.put('scanners/{}/link'.format(self._check('id', id, int)), json={'link': int(self._check('linked', linked, bool))})
Toggles the scanner's activated state. :devportal:`scanners: toggle-link-state <scanners-toggle-link-state>` Args: id (int): The unique identifier for the scanner linked (bool): The link status of the scanner. Setting to `False` will disable the link, whereas setting to `True` will enable the...
625941b5d18da76e235322c5
def keys(self): <NEW_LINE> <INDENT> return list(self.__slots__)
return a list of available tag names
625941b5d10714528d5ffad2
def topic_send(self, exchange_name, topic, msg, timeout=None, retry=None): <NEW_LINE> <INDENT> exchange = kombu.entity.Exchange( name=exchange_name, type='topic', durable=self.amqp_durable_queues, auto_delete=self.amqp_auto_delete) <NEW_LINE> self._ensure_publishing(self._publish, exchange, msg, routing_key=topic, retr...
Send a 'topic' message.
625941b54c3428357757c11f
def test_serializer_class(self): <NEW_LINE> <INDENT> class TestTaskViewSet(viewsets.NamedModelViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.TaskSerializer <NEW_LINE> <DEDENT> viewset = TestTaskViewSet() <NEW_LINE> self.assertEquals(viewset.get_serializer_class(), serializers.TaskSerializer) <NEW_LINE> re...
Tests that get_serializer_class() returns the serializer_class attribute if it exists, and that it doesn't error if no minimal serializer is defined, but minimal=True.
625941b594891a1f4081b89c
def setMinimumLabelHeight(self, height): <NEW_LINE> <INDENT> self._minimumLabelHeight = height
Returns the minimum label height for this axis. :param height | <int>
625941b576d4e153a657e924
def _acquire_restore(self, state): <NEW_LINE> <INDENT> pass
_acquire_restore(state) -> None For internal use by `threading.Condition`.
625941b5a05bb46b383ec622
def add(self, token, args): <NEW_LINE> <INDENT> optional = ('distribution_id', 'virt_storage_size', 'virt_ram', 'virt_type', 'kickstart_metadata', 'kernel_options', 'puppet_classes') <NEW_LINE> required = ('name', 'version', 'valid_targets', 'is_container') <NEW_LINE> self.validate(args, required) <NEW_LINE>...
Create a profile. @param token: A security token. @type token: string @param args: Profile attributes. @type args: dict @raise SQLException: On database error
625941b50a50d4780f666c83
def is_valid_email(string): <NEW_LINE> <INDENT> return re.match('^[(a-z0-9\_\-\.)]+@[(a-z0-9\_\-\.)]+\.[(a-z)]{2,4}$', string.lower())
Check if an string is a valid email address. Arguments: string: The text to be validated Return: True if is a valid email address or False if is not.
625941b5d6c5a10208143e3b
def test_clone_unmanaged(): <NEW_LINE> <INDENT> xmlpath = CLI_XMLDIR + "clone-disk.xml" <NEW_LINE> conn = utils.URIs.open_testdefault_cached() <NEW_LINE> xml = open(xmlpath).read() <NEW_LINE> tmp1 = tempfile.NamedTemporaryFile() <NEW_LINE> tmp2 = tempfile.NamedTemporaryFile() <NEW_LINE> inp1 = os.path.abspath(__file__)...
Test that unmanaged storage duplication via the clone wizard actually copies data
625941b510dbd63aa1bd29a4
def aperture82(self, p1=None, p2=None, p3=None, p4=None, verbose=False) : <NEW_LINE> <INDENT> if p2 is None: <NEW_LINE> <INDENT> p2= 0.0 <NEW_LINE> <DEDENT> if p3 is None: <NEW_LINE> <INDENT> p3= 1e-2 <NEW_LINE> <DEDENT> p1half= 0.5 * p1 <NEW_LINE> k= 2.0 * np.pi/self.wavelength <NEW_LINE> print('vertical slit with rou...
helper function aperture82
625941b5d99f1b3c44c67390
def configure_hook(app): <NEW_LINE> <INDENT> @app.before_request <NEW_LINE> def before_request(): <NEW_LINE> <INDENT> g.user = current_user
Setup always available pre request context values :param app: Application instance :type app: Flask
625941b5b5575c28eb68ddf1
def parse_option(): <NEW_LINE> <INDENT> usage = 'usage: %prog [options] keyword' <NEW_LINE> parser = optparse.OptionParser(usage) <NEW_LINE> parser.add_option('-p', '--path', default=None) <NEW_LINE> parser.add_option('-n', '--rotation-number', default=3, type='int') <NEW_LINE> parser.add_option('-l', '--logfile-path',...
Parse option. A lot of system Python's version is still 2.6. `argparse` requires Python2.7, so use optparse instead.
625941b5be383301e01b5282
def __init__(self, players, num_owners, money, roster): <NEW_LINE> <INDENT> self.owners = [Owner(money, roster, i) for i in range(num_owners)] <NEW_LINE> self.players = players <NEW_LINE> self.players.sort(key=lambda player: player.value, reverse=True) <NEW_LINE> self.undrafted_players = list(players) <NEW_LINE> self.u...
Starts the auction with the specified settings. :param list(Player) players: Players in this auction :param int num_owners: number of owners. Owners are referenced by integer id. :param int money: integer dollar amount of money each player has :param list(RosterPosition) roster: list of RosterPositions each player...
625941b599fddb7c1c9de187
def check_domuuid_compliant_with_rfc4122(dom_uuid_value): <NEW_LINE> <INDENT> dom_uuid_segments = dom_uuid_value.split('-') <NEW_LINE> return dom_uuid_segments[2].startswith('4') and dom_uuid_segments[3][0] in '89ab'
Check the domain uuid format comply with RFC4122. xxxxxxxx-xxxx-Axxx-Bxxx-xxxxxxxxxxxx A should be RFC version number, since the compliant RFC version is 4122, so it should be number 4. B should be one of "8, 9, a or b". :param dom_uuid_value: value of domain uuid :return: True or False indicate whether it is complian...
625941b5627d3e7fe0d68c42
def assert_geotiff_basics( output_tiff: Union[str, Path], expected_band_count=1, min_width=64, min_height=64, expected_shape=None ): <NEW_LINE> <INDENT> assert imghdr.what(output_tiff) == 'tiff' <NEW_LINE> with rasterio.open(output_tiff) as dataset: <NEW_LINE> <INDENT> assert dataset.width > min_width <NEW_LINE> assert...
Basic checks that a file is a readable GeoTIFF file
625941b599cbb53fe67929db
def compute_distances_three_loops(self, X): <NEW_LINE> <INDENT> num_test = X.shape[0] <NEW_LINE> num_train = self.X_train.shape[0] <NEW_LINE> dim = X.shape[1] <NEW_LINE> dists = np.zeros((num_test, num_train)) <NEW_LINE> for i in range(num_test): <NEW_LINE> <INDENT> for j in range(num_train): <NEW_LINE> <INDENT> for k ...
Compute the distance between each test point in X and each training point in self.X_train using nested loops over the training data, the test data, and each element of their respective data. Inputs: - X: A numpy array of shape (num_test, D) containing test data. Returns: - dists: A numpy array of shape (num_test, num...
625941b54d74a7450ccd3fb7
def tr(self, message): <NEW_LINE> <INDENT> return QCoreApplication.translate('dxftoshp', message)
Get the translation for a string using Qt translation API. We implement this ourselves since we do not inherit QObject. :param message: String for translation. :type message: str, QString :returns: Translated version of message. :rtype: QString
625941b58e7ae83300e4adc0
def make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> return ClientSeriesReportItem( start_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), end_date = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'), clie...
Test ClientSeriesReportItem include_option is a boolean, when False only required params are included, when True both required and optional params are included
625941b5c4546d3d9de7282b
def update_user_info(self, token, data=None): <NEW_LINE> <INDENT> url = url_for('user_detail') <NEW_LINE> return self.client.put(url, data=data, headers={self.header_name: token})
Helper method to update user details.
625941b5293b9510aa2c308d
def yy(): <NEW_LINE> <INDENT> pass
Return calendar year as a 2 digit string Permission -- Always available
625941b53539df3088e2e13f
def build(self): <NEW_LINE> <INDENT> h, w = self.cf.patch_size[:2] <NEW_LINE> if h / 2 ** 5 != int(h / 2 ** 5) or w / 2 ** 5 != int(w / 2 ** 5): <NEW_LINE> <INDENT> raise Exception("Image size must be dividable by 2 at least 5 times " "to avoid fractions when downscaling and upscaling." "For example, use 256, 320, 384,...
Build Retina Net architecture.
625941b5f8510a7c17cf94f9
def is_same(arr1, arr2): <NEW_LINE> <INDENT> if isinstance(arr1, (list, tuple)): <NEW_LINE> <INDENT> return all([is_same(a1, a2) for a1, a2 in zip(arr1, arr2)]) <NEW_LINE> <DEDENT> return np.allclose(arr1, arr2)
Recursively check if 2 lists of array are equal.
625941b563f4b57ef0000f17
def ellip(N, rp, rs, Wn, btype='low', analog=False, output='ba'): <NEW_LINE> <INDENT> return iirfilter(N, Wn, rs=rs, rp=rp, btype=btype, analog=analog, output=output, ftype='elliptic')
Elliptic (Cauer) digital and analog filter design. Design an Nth order digital or analog elliptic filter and return the filter coefficients in (B,A) or (Z,P,K) form. Parameters ---------- N : int The order of the filter. rp : float Provides the maximum ripple in the passband. (dB) rs : float Provides the ...
625941b5a4f1c619b28afe37
def analyseEmotion(data): <NEW_LINE> <INDENT> matrix = {} <NEW_LINE> sid = SentimentIntensityAnalyzer() <NEW_LINE> previous_emotion = '' <NEW_LINE> previous_type = '' <NEW_LINE> for line in data: <NEW_LINE> <INDENT> if line['TURNTYPE'] in ['WYSIWYG', 'TBT']: <NEW_LINE> <INDENT> sentence = line['Translation'] <NEW_LINE>...
Average change of emotion per line per interface type
625941b5fbf16365ca6f5faf
def softsign(features, name=None): <NEW_LINE> <INDENT> _ctx = _context.context() <NEW_LINE> if _ctx.in_graph_mode(): <NEW_LINE> <INDENT> _, _, _op = _op_def_lib._apply_op_helper( "Softsign", features=features, name=name) <NEW_LINE> _result = _op.outputs[:] <NEW_LINE> _inputs_flat = _op.inputs <NEW_LINE> _attrs = ("T", ...
Computes softsign: `features / (abs(features) + 1)`. Args: features: A `Tensor`. Must be one of the following types: `float32`, `float64`, `int32`, `int64`, `uint8`, `int16`, `int8`, `uint16`, `half`. name: A name for the operation (optional). Returns: A `Tensor`. Has the same type as `features`.
625941b57b25080760e39250
def sanitize(name): <NEW_LINE> <INDENT> return name.replace( "&lt;", "<" ).replace( "&gt;", ">" ).replace( "&amp;", "&" ).replace( "< ", "<" ).replace( " >", ">" ).replace( " &", "&" ).replace( "& ", "&" )
Sanitize the specified ``name`` for use with breathe directives. **Parameters** ``name`` (:class:`python:str`) The name to be sanitized. **Return** :class:`python:str` The input ``name`` sanitized to use with breathe directives (primarily for use with ``.. doxygenfunction::``). Replacements such as ``"...
625941b57047854f462a1202
def attach(self, ctx, cluster, data): <NEW_LINE> <INDENT> cluster.heathy_check_enable() <NEW_LINE> cluster.heathy_check_set_interval(self.interval) <NEW_LINE> return True
Hook for policy attach. Initialize the health check mechanism for existing nodes in cluster.
625941b5d58c6744b4257a55
def find_common_prefix(strs): <NEW_LINE> <INDENT> common = [] <NEW_LINE> for cgroup in izip(*strs): <NEW_LINE> <INDENT> if all(x == cgroup[0] for x in cgroup[1:]): <NEW_LINE> <INDENT> common.append(cgroup[0]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> return ''.join(common)
Given a list (iterable) of strings, return the longest common prefix. >>> find_common_prefix(['abracadabra', 'abracadero', 'abranch']) 'abra' >>> find_common_prefix(['abracadabra', 'abracadero', 'mt. fuji']) ''
625941b56fb2d068a760ee96
def get_options(): <NEW_LINE> <INDENT> global opt <NEW_LINE> parser = argparse.ArgumentParser(description='Create PDF booklet') <NEW_LINE> parser.add_argument('file_in', help="Name of the input PDF file") <NEW_LINE> parser.add_argument('--debug', action="store_true", dest='debug', required=False, help="Additional featu...
Parses the command line options
625941b571ff763f4b549483
def getAction(self, gameState): <NEW_LINE> <INDENT> def expectimax(gameState): <NEW_LINE> <INDENT> actions = gameState.getLegalActions(0) <NEW_LINE> maxVal = float("-inf") <NEW_LINE> action = None <NEW_LINE> for each in actions: <NEW_LINE> <INDENT> succState = gameState.generateSuccessor(0, each) <NEW_LINE> v = self.mi...
Returns the expectimax action using self.depth and self.evaluationFunction All ghosts should be modeled as choosing uniformly at random from their legal moves.
625941b5f548e778e58cd370
def runTest(self): <NEW_LINE> <INDENT> find_q = worker.WorkQueue() <NEW_LINE> tag_q = worker.WorkQueue() <NEW_LINE> for rootdir in self.rootdirs: <NEW_LINE> <INDENT> find_q.put(rootdir) <NEW_LINE> <DEDENT> find_worker = find.Find(find_q, tag_q) <NEW_LINE> find_worker.start() <NEW_LINE> find_q.join() <NEW_LINE> find_wor...
Simple test for the Find worker.
625941b5462c4b4f79d1d4c4
def relu_backward(dout, cache): <NEW_LINE> <INDENT> x = cache <NEW_LINE> dx = (x > 0).astype(x.dtype) * dout <NEW_LINE> return dx
Computes the backward pass for a layer of rectified linear units (ReLUs). Input: - dout: Upstream derivatives, of any shape - cache: Input x, of same shape as dout Returns: - dx: Gradient with respect to x
625941b597e22403b379cd8d
def to_file(self, fpath): <NEW_LINE> <INDENT> return utils.dict_to_json_file(self._dag_dict, fpath)
Save the DAG to the .dagpy file.
625941b567a9b606de4a7cb1
@VALIDATOR <NEW_LINE> def state(row, index): <NEW_LINE> <INDENT> value = _read_value(row[index]) <NEW_LINE> state = us.states.lookup(value) <NEW_LINE> if state: <NEW_LINE> <INDENT> return state.abbr <NEW_LINE> <DEDENT> return value
Return the two-letter code for the given state.
625941b5009cb60464c631b2
def get_simple_name(self): <NEW_LINE> <INDENT> return self.simple_name
:returns: StringType -- the file name without the file path included.
625941b5bde94217f3682bf1
def setUp(self): <NEW_LINE> <INDENT> self.client = Client() <NEW_LINE> self.admin_user = get_user_model().objects.create_superuser( email='ayman@div.ai', password='aim12345' ) <NEW_LINE> self.client.force_login(self.admin_user) <NEW_LINE> self.user = get_user_model().objects.create_user( email='aim@div.ai', password='a...
Creating test client, adding a new user, make sure that user is logged inot our client test, regular user that is not authintecated
625941b53346ee7daa2b2b5d
def check_config(reporter, source_dir): <NEW_LINE> <INDENT> config_file = os.path.join(source_dir, '_config.yml') <NEW_LINE> config = load_yaml(config_file) <NEW_LINE> reporter.check_field(config_file, 'configuration', config, 'kind', 'lesson') <NEW_LINE> reporter.check_field(config_file, 'configuration', config, 'carp...
Check configuration file.
625941b53317a56b86939a5f
def resnet50(pretrained=False, **kwargs): <NEW_LINE> <INDENT> model = ResNet_Mnist(Bottleneck, [3, 4, 6, 3], **kwargs) <NEW_LINE> if pretrained: <NEW_LINE> <INDENT> model.load_state_dict(model_zoo.load_url(model_urls['resnet50'])) <NEW_LINE> <DEDENT> return model
Constructs a ResNet-50 model. Args: pretrained (bool): If True, returns a model pre-trained on ImageNet
625941b599cbb53fe67929dc