code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_sender(self): <NEW_LINE> <INDENT> return self.__sender
Gets the Sender Kingdom Object of the Message
625941d032920d7e50b28344
def recvn(self, numb, timeout = default): <NEW_LINE> <INDENT> self._xml += '<read><length>%d</length></read>\n' % numb <NEW_LINE> with self.countdown(timeout): <NEW_LINE> <INDENT> while self.countdown_active() and len(self.buffer) < numb and self._fillbuffer(self.timeout): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> <...
recvn(numb, timeout = default) -> str Recieves exactly `n` bytes. If the request is not satisfied before ``timeout`` seconds pass, all data is buffered and an empty string (``''``) is returned. Raises: exceptions.EOFError: The connection closed before the request could be satisfied Returns: A string contain...
625941d0d99f1b3c44c67700
def test_http_client_basic_auth_type_error(self): <NEW_LINE> <INDENT> url = 'https://username@password@0.0.0.0/feed' <NEW_LINE> with self.assertRaises(urllib.error.URLError): <NEW_LINE> <INDENT> feedparser.api._open_resource(url, '', '', '', '', [], {}, {})
Confirm an in-URL username/password doesn't cause a TypeError.
625941d08c3a87329515852f
def _simulate_model_string(self, model_str, params): <NEW_LINE> <INDENT> nbins = self.red_noise*self.N <NEW_LINE> simfreq = np.fft.rfftfreq(nbins, d=self.dt)[1:] <NEW_LINE> if model_str in dir(models): <NEW_LINE> <INDENT> if isinstance(params, dict): <NEW_LINE> <INDENT> model = eval('models.' + model_str + '(**params)'...
For generating a light curve from a pre-defined model Parameters ---------- model_str : string name of the pre-defined model params : list or dictionary parameters of the pre-defined model Returns ------- lightCurve : `LightCurve` object
625941d0091ae356686670d1
def count_zips(the_folder): <NEW_LINE> <INDENT> zip_list = os.listdir(the_folder) <NEW_LINE> zip_files = [] <NEW_LINE> for file_name in zip_list: <NEW_LINE> <INDENT> if file_name.endswith('.zip'): <NEW_LINE> <INDENT> zip_files.append(file_name) <NEW_LINE> <DEDENT> <DEDENT> number_of_archives = len(zip_files) <NEW_LINE>...
Checks to see if there are zip files inside the folder and returns hoe many
625941d08e7ae83300e4b140
def set_org(self, name, org_config): <NEW_LINE> <INDENT> self._check_keychain() <NEW_LINE> return self.keychain.set_org(name, org_config)
Creates or updates an org's oauth info
625941d09f2886367277aa00
def MultiNMF(V, rank, nrun, cores, return_best = True): <NEW_LINE> <INDENT> available_cores = multiprocess.cpu_count() <NEW_LINE> if available_cores < cores: <NEW_LINE> <INDENT> print("Only %d cores available but %d cores requested, reset it to available number." %(available_cores, cores)) <NEW_LINE> cores = available_...
Run NMF for a target matrix multiple times
625941d0bd1bec0571d907a3
def authenticate(self, _=None): <NEW_LINE> <INDENT> acceptance_wait_time = self.opts['acceptance_wait_time'] <NEW_LINE> acceptance_wait_time_max = self.opts['acceptance_wait_time_max'] <NEW_LINE> channel = salt.transport.client.ReqChannel.factory(self.opts, crypt='clear') <NEW_LINE> if not acceptance_wait_time_max: <NE...
Authenticate with the master, this method breaks the functional paradigm, it will update the master information from a fresh sign in, signing in can occur as often as needed to keep up with the revolving master AES key. :rtype: Crypticle :returns: A crypticle used for encryption operations
625941d0b5575c28eb68e174
def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent): <NEW_LINE> <INDENT> part_item = self.grid.part_item <NEW_LINE> tool = part_item._getActiveTool() <NEW_LINE> if tool.FILTER_NAME not in part_item.part().document().filter_set: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> tool_method_name = tool.methodPrefix()...
Args: event: Description
625941d038b623060ff0af61
def JointEigenDistribution(mat): <NEW_LINE> <INDENT> eigenvals = mat.eigenvals(multiple=True) <NEW_LINE> if any(not is_random(eigenval) for eigenval in set(eigenvals)): <NEW_LINE> <INDENT> raise ValueError("Eigen values don't have any random expression, " "joint distribution cannot be generated.") <NEW_LINE> <DEDENT> r...
Creates joint distribution of eigen values of matrices with random expressions. Parameters ========== mat: Matrix The matrix under consideration. Returns ======= JointDistributionHandmade Examples ======== >>> from sympy.stats import Normal, JointEigenDistribution >>> from sympy import Matrix >>> A = [[Normal...
625941d01f037a2d8b946371
def SetPow(self, *args): <NEW_LINE> <INDENT> return _itkRobustAutomaticThresholdImageFilterPython.itkRobustAutomaticThresholdImageFilterIUS3IUS3IUL3_SetPow(self, *args)
SetPow(self, double _arg)
625941d0293b9510aa2c3409
def parse(self, value): <NEW_LINE> <INDENT> if value.find('/') > 0: <NEW_LINE> <INDENT> value, seq = value.split('/') <NEW_LINE> self.seq = int(seq) <NEW_LINE> <DEDENT> if value.find('-') > 0: <NEW_LINE> <INDENT> vfrom, vto = value.split('-') <NEW_LINE> self.vfrom = self.slice._v(vfrom) <NEW_LINE> self.vto = self.slic...
Parse a ranged value in a cronjob
625941d0aad79263cf390bb5
def suppressed_by(self, msg: 'DNSIncoming') -> bool: <NEW_LINE> <INDENT> return any(self.suppressed_by_answer(record) for record in msg.answers)
Returns true if any answer in a message can suffice for the information held in this record.
625941d0287bf620b61d3bd7
def hitting_probability(A: np.ndarray, a: int): <NEW_LINE> <INDENT> assert A.shape[0] == A.shape[1] <NEW_LINE> r = A.shape[0] - a <NEW_LINE> return np.linalg.inv(np.eye(r) - A[:-a, :-a]) @ A[:-a, r:]
Calculate Hitting Probabilities Args: A: `np.ndarray`, State Transition matrix of the following form A = | A11 A12 | | 0 I | a: `int`, No. of absorbing states Returns: `np.ndarray`, Shape is (r * a) where r is no. of transient states.
625941d0cdde0d52a9e531a8
def remove_sheet(self, sheet): <NEW_LINE> <INDENT> if isinstance(sheet, int): <NEW_LINE> <INDENT> if sheet < len(self.__name_array): <NEW_LINE> <INDENT> sheet_name = self.__name_array[sheet] <NEW_LINE> del self.__sheets[sheet_name] <NEW_LINE> self.__name_array = list(self.__sheets.keys()) <NEW_LINE> <DEDENT> else: <NEW...
Remove a sheet
625941d063d6d428bbe44663
def add_new_transient(self, dt): <NEW_LINE> <INDENT> self.temperatures[dt] = {}
initializes the transient variables
625941d0d18da76e2353264a
def type_dist(eid1, eid2, kb, params): <NEW_LINE> <INDENT> eid1_types = kb[eid1].split(".") <NEW_LINE> eid2_types = kb[eid2].split(".") <NEW_LINE> if eid1_types[0] != eid2_types[0]: <NEW_LINE> <INDENT> LCA_dist = 3 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if eid1_types[1] != eid2_types[1]: <NEW_LINE> <INDENT> LCA...
Obtain the interaction strength between entity 1 and entity 2 based on their distance on type hierarchy :param eid1: :param eid2: :return:
625941d08e05c05ec3eea4e9
def ToString(self): <NEW_LINE> <INDENT> return "INVENTORY Type %s hashes %s " % (self.Type, [h for h in self.Hashes])
Get the string representation of the payload. Returns: str:
625941d0cad5886f8bd2714d
@ensure_csrf_cookie <NEW_LINE> @cache_control(no_cache=True, no_store=True, must_revalidate=True) <NEW_LINE> @require_level('staff') <NEW_LINE> @require_query_params('rolename') <NEW_LINE> def list_forum_members(request, course_id): <NEW_LINE> <INDENT> course_id = SlashSeparatedCourseKey.from_deprecated_string(course_i...
Lists forum members of a certain rolename. Limited to staff access. The requesting user must be at least staff. Staff forum admins can access all roles EXCEPT for FORUM_ROLE_ADMINISTRATOR which is limited to instructors. Takes query parameter `rolename`.
625941d0462c4b4f79d1d844
def __hash__(self): <NEW_LINE> <INDENT> return hash(self.file_name + str(self.file_from.__hash__()))
Override the default hash behavior (that returns the id or the object)
625941d015baa723493c40ea
def unsorted_range(a, b): <NEW_LINE> <INDENT> if a > b: <NEW_LINE> <INDENT> return range(b, a) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return range(a, b)
Return a list of numbers between a and b, inclusive. Just a wrapper around range() that sorts the input.
625941d0004d5f362079a4a6
def create_stub(self, service_name): <NEW_LINE> <INDENT> path_split = service_name.split('.') <NEW_LINE> module_name = '%s_client' % '.'.join(path_split[:-1]) <NEW_LINE> class_name = Converter.underscore_to_capwords(path_split[-1]) <NEW_LINE> module = __import__(module_name, globals(), locals(), class_name) <NEW_LINE> ...
Create a stub corresponding to the specified service name :type service_name: :class:`str` :param service_name: Name of the service :rtype: :class:`VapiInterface` :return: The stub correspoding to the specified service name
625941d04e4d5625662d454b
def drawBorders(self,unit): <NEW_LINE> <INDENT> x=self.posmazestart[0]+0.5*self.gridwidth+(unit.x-1)*self.gridwidth <NEW_LINE> y=self.posmazestart[1]+0.5*self.gridwidth+self.gridwidth*(unit.y-1) <NEW_LINE> nwcorner = [x-0.5*self.gridwidth,y-0.5*self.gridwidth] <NEW_LINE> necorner = [x+0.5*self.gridwidth,y-0.5*self.grid...
Draws the walls of the maze based on wall tuple of each mapUnit.
625941d0e5267d203edcde10
def test_airnow_api_nozip(self): <NEW_LINE> <INDENT> user_value_id = 2 <NEW_LINE> date = "2018-10-24" <NEW_LINE> with self.client as c: <NEW_LINE> <INDENT> result = c.post('/update-airnow-item', data={"user_value_id": user_value_id, "date": date}) <NEW_LINE> r = json.loads(result.data.decode()) <NEW_LINE> self.assertEq...
Test airnow api logic with no user zip and no input zip
625941d0099cdd3c635f0dcf
def residueSelectionChanged(self, selected: List[QtCore.QModelIndex], deselected: List[QtCore.QModelIndex]): <NEW_LINE> <INDENT> selectedindexes = self.sequenceTreeView.selectionModel().selectedIndexes() <NEW_LINE> selectedrows = {i.row() for i in selectedindexes} <NEW_LINE> for movebutton in [self.moveToTopToolButton,...
The selection in the treeview is changed. Enable/disable tool buttons accordingly
625941d0adb09d7d5db6c903
def rdataset_sorter(rdataset): <NEW_LINE> <INDENT> wire_rdata = rdataset[0].to_digestable() <NEW_LINE> return (rdataset.rdtype, wire_rdata)
Utility function used to get RDATA in the proper order.
625941d0004d5f362079a4a7
def get(self, dimname = None): <NEW_LINE> <INDENT> from copy import copy <NEW_LINE> if dimname is None: <NEW_LINE> <INDENT> return copy(self._data_) <NEW_LINE> <DEDENT> elif not isinstance(dimname, str): <NEW_LINE> <INDENT> raise ValueError("input dimname to {:s} ".format(self.__class__.__name__) + "...
get(dimname = None) Returns the current color coordinates. Either a single coordinate (if ``dimname`` is set) or all coordinates of the current :py:class:`colorobject`. The latter will return a dictionary containing the data with all defined dimensions. Parameters ---------- dimname : None, st can be set to only ...
625941d082261d6c526ab614
def clean(root, outputPath): <NEW_LINE> <INDENT> if not os.path.exists(outputPath): <NEW_LINE> <INDENT> os.mkdir(outputPath) <NEW_LINE> <DEDENT> for fn, fd in utils.loadFiles(root): <NEW_LINE> <INDENT> data = fd.read() <NEW_LINE> data = data.lstrip() <NEW_LINE> data = data[data.find("\n") :].strip() <NEW_LINE> start = ...
Post-clean up thoughts This has a lot going on. Changes in the scene are demarcated with < >. Keywords, sometimes the current speaker, and maybe narrations are decorated with 【 】 A blank line represents a break in continuity or passage of time maybe? All dialog can be extracted by picking lines wi...
625941d0d53ae8145f87a3e3
@pytest.mark.parametrize( "info, expected_title", [ pytest.param({}, None, id="not defined"), pytest.param({"title": "title 1"}, "title 1", id="defined"), pytest.param({"title": "title 2"}, "title 2", id="defined different"), ], ) <NEW_LINE> @pytest.mark.build <NEW_LINE> def test_calculate_spec_info_title(info, expecte...
GIVEN info and spec WHEN calculate_spec_info is called with the spec THEN the title is returned.
625941d0e1aae11d1e749e2b
def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1080 <NEW_LINE> self.screen_height = 600 <NEW_LINE> self.bg_color = (230, 230, 230) <NEW_LINE> self.ship_limit = 3 <NEW_LINE> self.bullet_width = 3 <NEW_LINE> self.bullet_height = 15 <NEW_LINE> self.bullet_color = (60, 60, 60) <NEW_LINE> self.bullets_allowed =...
Initialize the game's settings.
625941d0aad79263cf390bb6
def test_transform_rest_request_with_query_params(self): <NEW_LINE> <INDENT> orig_request = test_utils.build_request('/_ah/api/test?foo=bar', '{"sample": "body"}') <NEW_LINE> new_request = self.server.transform_rest_request(orig_request, {}) <NEW_LINE> self.assertEqual({'sample': 'body', 'foo': ['bar']}, json.loads(new...
Verify body is updated with query parameters.
625941d066673b3332b92205
def load_url(driver, content, wait_for_it=False): <NEW_LINE> <INDENT> driver.get(content)
given a url as `content`, opens the url
625941d00c0af96317bb835c
@task <NEW_LINE> def clean(): <NEW_LINE> <INDENT> for path in ( join(PROJECT_DIR, 'dist'), join(PROJECT_DIR, 'src', 'm3_django_compat.egg-info'), ): <NEW_LINE> <INDENT> if exists(path): <NEW_LINE> <INDENT> print('REMOVE:', path) <NEW_LINE> if isdir(path): <NEW_LINE> <INDENT> rmtree(path) <NEW_LINE> <DEDENT> else: <NEW_...
Удаление файлов, созданных во время сборки дистрибутивов.
625941d0d6c5a102081441bf
def test_from_json(hass): <NEW_LINE> <INDENT> expected_result = "Bar" <NEW_LINE> actual_result = template.Template( '{{ (\'{"Foo": "Bar"}\' | from_json).Foo }}', hass ).async_render() <NEW_LINE> assert actual_result == expected_result
Test the JSON string to object filter.
625941d06fb2d068a760f212
def render(self, file_out, ind=""): <NEW_LINE> <INDENT> file_out.write("<!DOCTYPE {}>\n".format(self.tag)) <NEW_LINE> Element.render(self, file_out, ind="")
Extension of the render method inherited for this subclass to write the DOCTYPE at the top of the page
625941d09f2886367277aa01
def getEmulator(self, **kwargs): <NEW_LINE> <INDENT> plat = self.getMeta('Platform') <NEW_LINE> arch = self.getMeta('Architecture') <NEW_LINE> eclass = viv_imp_lookup.workspace_emus.get((plat, arch)) <NEW_LINE> if eclass is None: <NEW_LINE> <INDENT> eclass = viv_imp_lookup.workspace_emus.get(arch) <NEW_LINE> <DEDENT> i...
Get an instance of a WorkspaceEmulator for this workspace. Use logread/logwrite to enable memory access tracking.
625941d03539df3088e2e4bf
def get_image_dimensions(file_or_path, close=False): <NEW_LINE> <INDENT> from PIL import ImageFile as PillowImageFile <NEW_LINE> p = PillowImageFile.Parser() <NEW_LINE> if hasattr(file_or_path, 'read'): <NEW_LINE> <INDENT> file = file_or_path <NEW_LINE> file_pos = file.tell() <NEW_LINE> file.seek(0) <NEW_LINE> <DEDENT>...
Return the (width, height) of an image, given an open file or a path. Set 'close' to True to close the file at the end if it is initially in an open state.
625941d0d58c6744b4257dd4
def init() -> None: <NEW_LINE> <INDENT> current_dir = os.getcwd() <NEW_LINE> WitEditor.create_dirs(os.path.join(current_dir, '.wit', 'images')) <NEW_LINE> WitEditor.create_dirs( os.path.join(current_dir, '.wit', 'staging_area'), f=os.mkdir ) <NEW_LINE> wit = WitEditor() <NEW_LINE> wit.update_activated_branch('master')
Create the directories for the images.
625941d02ae34c7f2600d2a5
def test_validate_inputs(): <NEW_LINE> <INDENT> model = MixedLogit() <NEW_LINE> with pytest.raises(ValueError): <NEW_LINE> <INDENT> model.fit(X, y, varnames=varnames, alts=alts, ids=ids, n_draws=10, maxiter=0, verbose=0, halton=True, randvars={'a': 'fake'}) <NEW_LINE> <DEDENT> with pytest.raises(ValueError): <NEW_LINE>...
Covers potential mistakes in parameters of the fit method that xlogit should be able to identify
625941d03346ee7daa2b2ee0
def load_state(self): <NEW_LINE> <INDENT> if not self._store.has("state"): <NEW_LINE> <INDENT> raise KeyError("no server state file exists") <NEW_LINE> <DEDENT> log.info("Starting game state load.") <NEW_LINE> state = self._store.get("state") <NEW_LINE> EVENTS.fire("server_load_state", state).now() <NEW_LINE> log.info(...
Load a serialized server state from file. This function just reads a pickle file into a state dict, all the actual data processing and sanitizing should be done by individual modules post-hooking the server_load_state event; each module should pull any data they want loaded from the shared state dict after it is deser...
625941d0d8ef3951e32436b1
def resurPet(self): <NEW_LINE> <INDENT> self.attribute.updateHp(self.attribute.getMaxHp()) <NEW_LINE> return {'result':True,'message':Lg().g(507)}
复活宠物
625941d04f88993c3716c1db
def test_retrieve_events_from_db_with_listener_attributes_of_datetime_start_and_datetime_end_that_should_retrieve_2_events(standard_db_event_entries): <NEW_LINE> <INDENT> event_id = 'sequence_video_clips-melt_ended_event' <NEW_LINE> url = "http://some_url_1.com/" <NEW_LINE> datetime_start = "20200503174008.553417" <NEW...
GIVEN a StoreAFilesMd5MicroService instance WHEN the 'StoreAFilesMd5MicroService.get_device_id(db, device)' is invoked and given a new device as argument THEN that new device should be stored in the 'device_ids' db collection and the 'device_id_index' from 'globals' db collection should be incremented by 1
625941d00fa83653e465712f
def setMapData(self, mapData): <NEW_LINE> <INDENT> if self._mapData is mapData: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self._info: <NEW_LINE> <INDENT> del self._info <NEW_LINE> self._info = None <NEW_LINE> <DEDENT> self._mapData = mapData <NEW_LINE> if not self._mapData: <NEW_LINE> <INDENT> return <NEW_LINE>...
Associates the QGeoMapData instance mapData with this map object. This will create an appropriate QGeoMapObjectInfo instance for this QGeoMapObject and will connect the appropriate signals to it so that it can be kept up to date. @param mapData: The associated GeoMapData Object @type mapData: GeoMapData
625941d099cbb53fe6792d5a
def _get_regularisation(self, freq, m): <NEW_LINE> <INDENT> raise NotImplementedError( f"{self.__class__} must define a _get_regularisation method." )
Return the parameter used to regularize the deconvolution operation. Any subclass must define this method in order to be a functional deconvolving ringmap maker. Parameters ---------- freq : float The frequency in MHz. m : np.ndarray[nm,] The m-modes. Returns ------- epsilon : np.ndarray[nm, npol, nel] (or c...
625941d00383005118ecf756
def splits(self, player, bet): <NEW_LINE> <INDENT> row, data = self._get_player_row_and_data(player) <NEW_LINE> cats = ['Player', 'Chips', 'Bet', 'Hand', 'Event'] <NEW_LINE> i_play, i_chip, i_bet, i_hand, i_event = self._get_field_index(cats) <NEW_LINE> data[row][i_chip] = player.chips <NEW_LINE> data[row][i_bet] = bet...
Player splits their hand.
625941d0b7558d58953c5087
def isConnected(self): <NEW_LINE> <INDENT> return _swigibpy.EClientSocketBase_isConnected(self)
isConnected(EClientSocketBase self) -> bool
625941d0a05bb46b383ec995
def get_changeset(self): <NEW_LINE> <INDENT> for key in self._changeset: <NEW_LINE> <INDENT> yield self._dictionary[key]
Get the changes since creation or since last committing.
625941d0009cb60464c63525
def get_accuracy(self): <NEW_LINE> <INDENT> return self.accuracy
Returns: accuracy as a float
625941d066656f66f7cbc31f
def add(self, name, value): <NEW_LINE> <INDENT> variable = Variable(name, value) <NEW_LINE> self.service.add(variable)
Add variable
625941d0711fe17d825424df
def purge(self, ignore_ignores): <NEW_LINE> <INDENT> command = ['status', '--xml'] <NEW_LINE> if ignore_ignores: <NEW_LINE> <INDENT> command.append('--no-ignore') <NEW_LINE> <DEDENT> d = self._dovccmd(command, collectStdout=True) <NEW_LINE> @d.addCallback <NEW_LINE> def parseAndRemove(stdout): <NEW_LINE> <INDENT> files...
Delete everything that shown up on status.
625941d08e7ae83300e4b141
def login(self, username="", password=""): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.token = "" <NEW_LINE> id = "" <NEW_LINE> if not os.path.isfile("CREDENTIALS_FILE"): <NEW_LINE> <INDENT> if username == "" or password == "": <NEW_LINE> <INDENT> username = raw_input("Username: ") <NEW_LINE> password = getpass.g...
Performs a login and sets the Github object via given credentials. If credentials are empty or incorrect then prompts user for credentials. Stores the authentication token in a CREDENTIALS_FILE used for future logins. Handles Two Factor Authentication.
625941d096565a6dacc8f83f
def testInvalidParameters(self): <NEW_LINE> <INDENT> actual = False <NEW_LINE> try: <NEW_LINE> <INDENT> nf(True, "1.1", "1") <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE> <INDENT> actual = True <NEW_LINE> <DEDENT> expected = True <NEW_LINE> self.assertEqual(expected, actual)
Test Numfinity with invalid parameters.
625941d0e5267d203edcde11
def changedFileCount(self): <NEW_LINE> <INDENT> filesadded = 0 <NEW_LINE> fileschanged = 0 <NEW_LINE> filesdeleted = 0 <NEW_LINE> logging.debug("Changed path count : %d" % len(self.revlog.changed_paths)) <NEW_LINE> for change in self.getChangeEntries(): <NEW_LINE> <INDENT> isdir = change.isDirectory() <NEW_LINE> if(isd...
includes directory and files. Initially I wanted to only add the changed file paths. however it is not possible to detect if the changed path is file or directory from the svn log output bChkIfDir -- If this flag is false, then treat all changed paths as files. since isDirectory function calls the svn client 'info' ...
625941d05fcc89381b1e1834
def comparable_dist(zamg_id): <NEW_LINE> <INDENT> station_lat, station_lon = stations[zamg_id] <NEW_LINE> return (lat - station_lat) ** 2 + (lon - station_lon) ** 2
Calculate the psudeo-distance from lat/lon.
625941d04c3428357757c49c
def onehot(self, df, categorical): <NEW_LINE> <INDENT> if categorical != [-1]: <NEW_LINE> <INDENT> for column in categorical: <NEW_LINE> <INDENT> attribute = list(df[column].unique()) <NEW_LINE> for att in attribute: <NEW_LINE> <INDENT> df.insert(0, att, '') <NEW_LINE> for row in range(len(df[column])): <NEW_LINE> <IND...
Kieran Ringel One hot encodes all categorical values
625941d091f36d47f21ac667
def sql(self , sqlText): <NEW_LINE> <INDENT> return self._snappySession.sql(sqlText)
Returns a :class:`DataFrame` representing the result of the given query. :return: :class:`DataFrame`
625941d007d97122c4178a01
def AptInstall(vm): <NEW_LINE> <INDENT> vm.RemoteCommand('sudo add-apt-repository ' "'deb http://archive.ubuntu.com/ubuntu trusty universe'") <NEW_LINE> vm.RemoteCommand('sudo apt-get update') <NEW_LINE> vm.RemoteCommand('sudo apt-get -y install mysql-client-5.6')
Installs the mysql package on the VM.
625941d0236d856c2ad44950
def test_find_relative_directory_index(self): <NEW_LINE> <INDENT> pass
Find a package require with a relative directory that falls back to index.js require statement: require('package/lib') directory structure: dir/ main.js <- We are here package.json node_modules/ package/ package.json lib/ index.js <- Find this file
625941d030c21e258bdfa612
def get_file(self, fp, headers=None, cb=None, num_cb=10, torrent=False): <NEW_LINE> <INDENT> if self.key_type & self.KEY_STREAM_READABLE: <NEW_LINE> <INDENT> raise BotoClientError('Stream is not Readable') <NEW_LINE> <DEDENT> elif self.key_type & self.KEY_STREAM_WRITABLE: <NEW_LINE> <INDENT> key_file = self.fp <NEW_LIN...
Retrieves a file from a Key :type fp: file :param fp: File pointer to put the data into :type headers: string :param: ignored in this subclass. :type cb: function :param cb: ignored in this subclass. :type cb: int :param num_cb: ignored in this subclass.
625941d031939e2706e4cfde
def test_to_html_basically_works(self): <NEW_LINE> <INDENT> image_result = ImageTestResult(0, '/tmp/filename', 'my description', '') <NEW_LINE> html = image_result.to_html() <NEW_LINE> self.assertIsInstance(html, str) <NEW_LINE> self.assertNotEqual(html, '') <NEW_LINE> self.assertIn('filename', html) <NEW_LINE> self.as...
If the to_html method can be invoked without producing an error
625941d0bd1bec0571d907a4
def slithering_snake_12(): <NEW_LINE> <INDENT> LOGGER.debug("Slithering Snake 1-2") <NEW_LINE> sleep_speed = 0.10 <NEW_LINE> PYGLOW.led(1, 100) <NEW_LINE> sleep(sleep_speed) <NEW_LINE> PYGLOW.led(2, 100) <NEW_LINE> sleep(sleep_speed) <NEW_LINE> PYGLOW.led(3, 100) <NEW_LINE> sleep(sleep_speed) <NEW_LINE> PYGLOW.led(4, 1...
Lights up then turns off the LEDs on arms 1 and 2
625941d0b830903b967e9a7f
def convex_criteria(self, x, y, slope, intercept_c): <NEW_LINE> <INDENT> if self.x1 - self.x2 == 0: <NEW_LINE> <INDENT> return x - self.x1 <NEW_LINE> <DEDENT> if self.y1 - self.y2 == 0: <NEW_LINE> <INDENT> return y - self.y1 <NEW_LINE> <DEDENT> if slope is not None and intercept_c is not None: <NEW_LINE> <INDENT> retur...
solve the equation for an arbitary point with the slope and intercept of another line and return positive or negative depending on which side of the line they lie :param x: :param y: :param slope: :param intercept_c: :return y - mx - c:
625941d0851cf427c661a683
def one_minute(): <NEW_LINE> <INDENT> return datetime.now() + timedelta(1.0/24/60,0,0)
For test purposes
625941d016aa5153ce3625ec
def get_predicted(products: list, num_codes = 3, num_models = 3, remove_used_models = True): <NEW_LINE> <INDENT> analogs = pd.DataFrame(columns=['product', 'probability', 'model_adeo', 'name']) <NEW_LINE> predicted = model.predict_output_word(products, topn=num_codes*num_models*5) <NEW_LINE> predicted = pd.DataFrame(pr...
Получить список похожих товаров. Parameters: products(str): Код продукта num_codes(int): Топ моделей num_models(int): Топ артикулов в каждой модели remove_used_models(bool): Не показывать модели, которые были в запросе Возвращает: predicted (list): список таблиц pd.DataFrame
625941d05fc7496912cc3af2
def single_logger_factory(level_name: str): <NEW_LINE> <INDENT> def single_logger(func): <NEW_LINE> <INDENT> @functools.wraps(func) <NEW_LINE> def wrapper(self, *args, **kwargs): <NEW_LINE> <INDENT> if ( self.authorized and logging._nameToLevel[level_name.upper()] >= self.min_level ): <NEW_LINE> <INDENT> try: <NEW_LINE...
Provides the general factory. :param level_name: The level to log.
625941d00a50d4780f667008
def set_mode(self, size, buffered=True, *args, **kwargs): <NEW_LINE> <INDENT> self.canvas = Canvas(size, buffered) <NEW_LINE> env.canvas = self.canvas <NEW_LINE> env.frame = Window.getDocumentRoot() <NEW_LINE> panel = FocusPanel(Widget=self.canvas) <NEW_LINE> RootPanel().add(panel) <NEW_LINE> self.panel = panel <NEW_LI...
Setup the display Surface. Argument include size (x,y) of surface and optional buffered surface. Return a reference to the display Surface.
625941d0956e5f7376d70fe2
def conf_mysql(dsn): <NEW_LINE> <INDENT> logging.debug("Configuring MYSQL: {}".format(dsn)) <NEW_LINE> connection = connector.connect( user=dsn.username, password=dsn.password, host=dsn.hostname, port=dsn.port or 3306, database=dsn.path[1:], auth_plugin="mysql_native_password" ) <NEW_LINE> return connection
create a connection to the original storage system
625941d026068e7796caee54
def highlight_doc(doc,query): <NEW_LINE> <INDENT> notFound = "No matching results found" <NEW_LINE> doc = doc.strip() <NEW_LINE> query = query.strip() <NEW_LINE> if not len(doc) > 0 or not len(query) > 0: <NEW_LINE> <INDENT> return notFound <NEW_LINE> <DEDENT> queryWords = remove_common_words_from_query(query) <NEW_LIN...
Args: doc Document to be highlighted (string) query Multiword/single word search query (string) Returns: The most relevant snippet of length 400 characters with the query terms highlighted (string) Searches for the exact match for the query in the doc and returns the snippet if an exact match is ...
625941d02eb69b55b151ca25
def create_slab(self, **kwargs): <NEW_LINE> <INDENT> if not kwargs['slab']: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> gridarr = np.linspace(0, 1, self.dims) <NEW_LINE> isslab = (gridarr >= (kwargs['slab_position'] - kwargs['slab_radius'])) & (gridarr <= (kwargs['slab_position'] + kwargs['slab_radius...
Create a slab.
625941d0d53ae8145f87a3e4
def task_get_detailed_results_in_excel(): <NEW_LINE> <INDENT> for lflank, rflank in flank_configs: <NEW_LINE> <INDENT> for cycle in cycles: <NEW_LINE> <INDENT> infile = '%s/dfisher_same.%d.l%d.r%d.csv' % (top_results_dir, cycle, lflank, rflank) <NEW_LINE> outfile = '%s/detailed_results_cycle%d_%s.xlsx' % (top_results_d...
Generate a table in MS-EXCEL format showing the details of Fisher's test
625941d0eab8aa0e5d26dccd
def insert_genres(self, genres): <NEW_LINE> <INDENT> genre_list = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for g in genres: <NEW_LINE> <INDENT> genre, created = Genre.objects.get_or_create( name=g, url=slugify(g)) <NEW_LINE> genre_list.append(genre) <NEW_LINE> <DEDENT> self.movie.genre.add(*genre_list) <NEW_LINE> <DEDENT...
Inserts the genres for the movie.
625941d016aa5153ce3625ed
def execute_adb_shell_timeout(self, command, timeout, *args): <NEW_LINE> <INDENT> return self._current_application().execute_script('mobile: shell', { 'command': command, 'args': list(args), 'timeout': timeout })
Execute ADB shell commands Android only. - _command_ - The ABD shell command - _timeout_ - Timeout to be applied to command - _args_ - Arguments to send to command Returns the exit code of ADB shell. Requires server flag --relaxed-security to be set on Appium server.
625941d02ae34c7f2600d2a6
def login(self): <NEW_LINE> <INDENT> user_email_elem = self.driver.find_element_by_id('email') <NEW_LINE> user_email_elem.clear() <NEW_LINE> user_email_elem.send_keys(self.user_name) <NEW_LINE> user_password_elem = self.driver.find_element_by_id('password') <NEW_LINE> user_password_elem.send_keys(self.user_password) <N...
Enter username, password and enter the website
625941d055399d3f0558882a
def start_nodes(num_nodes, dirname, extra_args=None, rpchost=None): <NEW_LINE> <INDENT> if extra_args is None: extra_args = [ None for i in range(num_nodes) ] <NEW_LINE> return [ start_node(i, dirname, extra_args[i], rpchost) for i in range(num_nodes) ]
Start multiple wealthsharesds, return RPC connections to them
625941d0c432627299f04dbb
@register.simple_tag <NEW_LINE> def full_url_without_tags(request, *args): <NEW_LINE> <INDENT> full_path = request.get_full_path() <NEW_LINE> query_part = full_path.split('?') <NEW_LINE> if len(query_part) == 1: <NEW_LINE> <INDENT> return full_path <NEW_LINE> <DEDENT> tags = [ x.split('=') for x in query_part[1].split(...
Removes all values of arg from the given string
625941d0dc8b845886cb56aa
def get_service(hass, config): <NEW_LINE> <INDENT> from pushetta import Pushetta, exceptions <NEW_LINE> if not validate_config({DOMAIN: config}, {DOMAIN: [CONF_API_KEY, 'channel_name']}, _LOGGER): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> pushetta = Pushetta(config[CONF_API_KEY]) <NEW...
Get the Pushetta notification service.
625941d021a7993f00bc7e66
def testParse(self): <NEW_LINE> <INDENT> parser = dpkg.DpkgParser() <NEW_LINE> storage_writer = self._ParseFile(['dpkg.log'], parser) <NEW_LINE> number_of_events = storage_writer.GetNumberOfAttributeContainers('event') <NEW_LINE> self.assertEqual(number_of_events, 4) <NEW_LINE> number_of_warnings = storage_writer.GetNu...
Tests for the Parse method.
625941d02c8b7c6e89b35935
def DisplayWidth(self, buf): <NEW_LINE> <INDENT> if not isinstance(buf, six.string_types): <NEW_LINE> <INDENT> return len(buf) <NEW_LINE> <DEDENT> cached = self._display_width_cache.get(buf, None) <NEW_LINE> if cached is not None: <NEW_LINE> <INDENT> return cached <NEW_LINE> <DEDENT> width = 0 <NEW_LINE> max_width = 0 ...
Returns the display width of buf, handling unicode and ANSI controls. Args: buf: The string to count from. Returns: The display width of buf, handling unicode and ANSI controls.
625941d063d6d428bbe44664
def _handle_ref(self, value): <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> value = pywikibot.input( 'Links to which page should be processed?') <NEW_LINE> <DEDENT> page = pywikibot.Page(pywikibot.Link(value, self.site)) <NEW_LINE> return page.getReferences()
Handle `-ref` argument.
625941d05166f23b2e1a52ce
def drange(start, stop, step): <NEW_LINE> <INDENT> x = start <NEW_LINE> if step > 0: <NEW_LINE> <INDENT> while x + step <= stop: <NEW_LINE> <INDENT> yield x <NEW_LINE> x += step <NEW_LINE> <DEDENT> <DEDENT> elif step < 0: <NEW_LINE> <INDENT> while x + step >= stop: <NEW_LINE> <INDENT> yield x <NEW_LINE> x += step <NEW_...
A generator that yields successive samples from start (inclusive) to stop (exclusive) in step intervals. Parameters ---------- start : float starting point stop : float stopping point step : float stepping interval Yields ------ x : float next sample
625941d032920d7e50b28346
def test_from_dict_03_mfdataset(self): <NEW_LINE> <INDENT> ds = xr.Dataset(*self._from_dataset_test_variables) <NEW_LINE> ds1 = ds.isel(time=slice(0, 2)) <NEW_LINE> ds2 = ds.isel(time=slice(2, None)) <NEW_LINE> fname1 = tempfile.NamedTemporaryFile(suffix='.nc', prefix='tmp_psyplot_').name <NEW_LINE> ds1.to_netcdf(fname...
Test opening a multifile dataset
625941d0377c676e9127231e
def format_timestamp(timestamp): <NEW_LINE> <INDENT> if timestamp: <NEW_LINE> <INDENT> d = arrow.get(timestamp) <NEW_LINE> formatted_date = d.format('YYYY-MM-DDTHH:mm:ss.SSS') <NEW_LINE> return '{}Z'.format(formatted_date)
Standardize Cromwell timestamps to follow the date-time JSON format required by the analysis process schema. Args: timestamp (str): A datetime string in any format Returns: formatted_timestamp (str): A datetime string in the format 'YYYY-MM-DDTHH:mm:ss.SSSZ'
625941d067a9b606de4a802f
@ldap.command(name='setup-org') <NEW_LINE> def setup_org(): <NEW_LINE> <INDENT> organization_id = toolkit.config['ckanext.ldap.organization.id'] <NEW_LINE> user = toolkit.get_action('get_site_user')({ 'ignore_auth': True }, {}) <NEW_LINE> context = { 'user': user['name'] } <NEW_LINE> try: <NEW_LINE> <INDENT> toolkit.ge...
Sets up the default organisation which all ldap users will be automatically made members of.
625941d0167d2b6e31218d0b
@skip_if_not_set('oscap') <NEW_LINE> @tier2 <NEW_LINE> def test_positive_assign_compliance_policy(session, scap_policy): <NEW_LINE> <INDENT> host = entities.Host().create() <NEW_LINE> org = host.organization.read() <NEW_LINE> loc = host.location.read() <NEW_LINE> scap_policy = Scappolicy.info( {'id': scap_policy['id']}...
Ensure host compliance Policy can be assigned. :id: 323661a4-e849-4cc2-aa39-4b4a5fe2abed :expectedresults: Host Assign Compliance Policy action is working as expected. :CaseLevel: Integration
625941d07d43ff24873a2e16
def quantize_tensor(self, tensor): <NEW_LINE> <INDENT> if tensor.data_type == mace_pb2.DT_FLOAT: <NEW_LINE> <INDENT> ops = self._consumers.get(tensor.name, None) <NEW_LINE> check_conv = False <NEW_LINE> check_deconv = False <NEW_LINE> if ops is not None and len(ops) == 1: <NEW_LINE> <INDENT> check_conv = ...
Assume biasadd has been already folded with convolution and fc
625941d0627d3e7fe0d68fc5
def place(self, pos, letter): <NEW_LINE> <INDENT> x, y = pos <NEW_LINE> if self.tiles[x][y] is not None: <NEW_LINE> <INDENT> raise Exception("error: tile exists") <NEW_LINE> <DEDENT> self.tiles[x][y] = tile.Tile(letter)
Converts letter to be placed into tile.Tile type.
625941d01d351010ab855c91
def _mobilenet_v2(net, depth_multiplier, output_stride, reuse=None, scope=None, final_endpoint=None): <NEW_LINE> <INDENT> with tf.variable_scope(scope, 'MobilenetV2', [net], reuse=reuse) as scope: <NEW_LINE> <INDENT> return mobilenet_v2.mobilenet_base( net, conv_defs=mobilenet_v2.V2_DEF, depth_multiplier=depth_multipli...
Auxiliary function to add support for 'reuse' to mobilenet_v2. Args: net: Input tensor of shape [batch_size, height, width, channels]. depth_multiplier: Float multiplier for the depth (number of channels) for all convolution ops. The value must be greater than zero. Typical usage will be to set this value ...
625941d0091ae356686670d3
def mkcell(self, params): <NEW_LINE> <INDENT> self._params = params <NEW_LINE> a_mag, b_mag, c_mag = params[:3] <NEW_LINE> alpha, beta, gamma = params[3:] <NEW_LINE> a_vec = np.array([a_mag, 0.0, 0.0]) <NEW_LINE> b_vec = np.array([b_mag * np.cos(gamma), b_mag * np.sin(gamma), 0.0]) <NEW_LINE> c_x = c_mag * np.cos(beta)...
Update the cell representation to match the parameters. Currently only builds a 3d cell.
625941d0de87d2750b85ff08
def partition_classes(X, y, split_attribute, split_val): <NEW_LINE> <INDENT> X_left = [] <NEW_LINE> X_right = [] <NEW_LINE> y_left = [] <NEW_LINE> y_right = [] <NEW_LINE> X = np.array(X) <NEW_LINE> N,D = X.shape <NEW_LINE> if isinstance(split_val, (int, float, complex)): <NEW_LINE> <INDENT> for n in range(N): <NEW_LINE...
Example: X = [[3, 'aa', 10], y = [1, [1, 'bb', 22], 1, [2, 'cc', 28], 0, [5, 'bb', 32], 0, [4, 'cc', 32]] 1] Here, columns 0 and 2 represent numeric attributes, while column 1 is a categorical attri...
625941d03617ad0b5ed6806d
def optimize_model(self, gtree, stree, gene2species): <NEW_LINE> <INDENT> CostModel.optimize_model(self, gtree, stree, gene2species) <NEW_LINE> if self.dupcost < 0: <NEW_LINE> <INDENT> self.parser.error("-D/--dupcost must be >= 0: " + str(self.dupcost)) <NEW_LINE> <DEDENT> if self.losscost < 0: <NEW_LINE> <INDENT> self...
Optimizes the model
625941d0d4950a0f3b08c4c4
def screenshot(self, thumbnail=True): <NEW_LINE> <INDENT> if self.configuration.has_option("VIRTUALMACHINE", "disable_screenshot"): <NEW_LINE> <INDENT> if self.configuration.getboolean("VIRTUALMACHINE", "disable_screenshot"): <NEW_LINE> <INDENT> return (None, (0, 0)) <NEW_LINE> <DEDENT> <DEDENT> state = self.domain.inf...
take a screenshot of the virtualmachine and return image as base64encoded PNG @type thumbnail: Boolean @param thumbnail: if True, will send a thumbnail of the screenshot @rtype: string @return: base64 encoded PNG data
625941d015baa723493c40eb
def load_corpus(location, document_key, text_only=False): <NEW_LINE> <INDENT> for item in load_scraped_items(location): <NEW_LINE> <INDENT> document = item.get(document_key) <NEW_LINE> if document: <NEW_LINE> <INDENT> document = _join_text(document) <NEW_LINE> if text_only: <NEW_LINE> <INDENT> yield document <NEW_LINE>...
Load an input corpus from a directory with scraped items, in a memory-efficient way. Each input file must contain one JSON object per line. :param str document_key: a scraped item dictionary key holding textual documents
625941d02c8b7c6e89b35936
def save_files(self, coded_file_name): <NEW_LINE> <INDENT> with open(coded_file_name+'.csv', 'w') as csvfile: <NEW_LINE> <INDENT> print('writing csv') <NEW_LINE> spamwriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) <NEW_LINE> spamwriter.writerow(['Zeichen', 'Absolute Häufigkeit', 'R...
Saves a coded_file_name.csv and coded_file_name.bin file.
625941d0cdde0d52a9e531a9
def team_template_folders_post_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> all_params = ['data'] <NEW_LINE> all_params.append('callback') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> params = locals() <NEW_LINE> for key, val in iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in ...
Create a new instance of the model and persist it into the data source. 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) >>> >>> th...
625941d08c0ade5d55d3eb31
def extract_KPD_single_frame(self, frame, pscale, cwavel, target=None, recenter=False, wrad=None, method="LDFT1"): <NEW_LINE> <INDENT> cvis = [] <NEW_LINE> kpdata = [] <NEW_LINE> detpa = [] <NEW_LINE> mjdate = [] <NEW_LINE> isz = frame.shape[0] <NEW_LINE> m2pix = core.mas2rad(pscale)*isz/cwavel <NEW_LINE> if target is ...
---------------------------------------------------------------- Handles the kernel processing of a single square frame Parameters: ---------- - frame: the 2D array image to process - pscale: the image plate scale (in mas/pixels) - cwavel: the central wavelength (in meters) -------------------------------------------...
625941d0287bf620b61d3bd9
def forEach(parameter_name, generator, n=None): <NEW_LINE> <INDENT> def outer(function): <NEW_LINE> <INDENT> def wrap(*args,**kwargs): <NEW_LINE> <INDENT> result = { "parameter_name":parameter_name, "parameter_values":[], "results":[] } <NEW_LINE> it = generator() <NEW_LINE> i = 0 <NEW_LINE> while n is None or i < n: <...
Usage: @forEach("i", generateNaturalInteger, 10) def square(self, x): return x*x assert square() == [x*x for x in range(10)] @forEach("i", lambda:iter(range(10))) def square(self, x): return x*x assert square() == [x*x for x in range(10)] @summary: decorator that applies n values from generator t...
625941d04527f215b584c5cc
def bombDrop(self, gridsize, fallSpeed, otherBlocks): <NEW_LINE> <INDENT> if self.timer > 0: <NEW_LINE> <INDENT> maxDrop = gridsize*18 <NEW_LINE> collides = False <NEW_LINE> j = 0 <NEW_LINE> while collides == False: <NEW_LINE> <INDENT> checkX = self.x <NEW_LINE> checkY = self.y + j*gridsize <NEW_LINE> check = (checkX, ...
(int, int, list) -> (none) Drops the bombs
625941d0925a0f43d2549fed
def sum_streams(stream1, stream2): <NEW_LINE> <INDENT> ex1 = ChunkExtractor(stream1) <NEW_LINE> ex2 = ChunkExtractor(stream2) <NEW_LINE> while True: <NEW_LINE> <INDENT> c1 = ex1.next_chunk() <NEW_LINE> c2 = ex2.next_chunk() <NEW_LINE> if c1 is None or c2 is None: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if len(c1....
Add two sample streams together The time elements of each stream will not be aligned if they do not match. Instead the time values from stream1 are used for the result. The iterator terminates when either of the two streams ends. This is a generator function. stream1 (iterable of SampleChunk objects) stream2 (iterab...
625941d0be7bc26dc91cd774
def dataReceived(self, data): <NEW_LINE> <INDENT> jsons = spilt_data(data) <NEW_LINE> for data in jsons: <NEW_LINE> <INDENT> if 'type' not in data: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if data['type'] in ['signin', 'signup']: <NEW_LINE> <INDENT> self.user_login(data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN...
收到服务器的数据时采取的动作。 由于数据可能粘包,所以需要先进行分包,然后再逐个处理。
625941d063b5f9789fde725b
def get_inspection_units(logdir='', event_file='', tag=''): <NEW_LINE> <INDENT> if logdir: <NEW_LINE> <INDENT> subdirs = io_wrapper.GetLogdirSubdirectories(logdir) <NEW_LINE> inspection_units = [] <NEW_LINE> for subdir in subdirs: <NEW_LINE> <INDENT> generator = itertools.chain(*[ generator_from_event_file(os.path.join...
Returns a list of InspectionUnit objects given either logdir or event_file. If logdir is given, the number of InspectionUnits should equal the number of directories or subdirectories that contain event files. If event_file is given, the number of InspectionUnits should be 1. Args: logdir: A log directory that cont...
625941d0a4f1c619b28b01ad