code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def __init__(self, genes: Genes=None): <NEW_LINE> <INDENT> logger.debug("Constructing new population.") <NEW_LINE> if not isinstance(genes, Genes): <NEW_LINE> <INDENT> raise ValueError("Invalid genes:", genes) <NEW_LINE> <DEDENT> if not genes.size: <NEW_LINE> <INDENT> raise RuntimeError("Empty genetic code.") <NEW_LINE...
Population constructor. @param genes: A Genes instance is required. Mutations will take genes from this instance and generate variations. NOTE: The initial set of chromosomes will only contain pairs of genes whose first character match in order to reduce the algorithm complexit...
625941b3d18da76e23532292
def testNonZ(self): <NEW_LINE> <INDENT> self.doTest(datetime(2013, 1, 31, 3, 45, 0, 123000), '2013-01-31T04:45:00.123+01:00')
jsonutils.json2datetime() should convert a string with a numeric timezone offset
625941b3adb09d7d5db6c556
def logical_and(self, other, context=None): <NEW_LINE> <INDENT> if context is None: <NEW_LINE> <INDENT> context = getcontext() <NEW_LINE> <DEDENT> other = _convert_other(other, raiseit=True) <NEW_LINE> if not self._islogical() or not other._islogical(): <NEW_LINE> <INDENT> return context._raise_error(InvalidOperation) ...
Applies an 'and' operation between self and other's digits.
625941b355399d3f05588475
def fix_minmax(image): <NEW_LINE> <INDENT> hdulist = fits.open(image, mode='update') <NEW_LINE> datamin, datamax = numpy.nanmin(hdulist[0].data), numpy.nanmax(hdulist[0].data) <NEW_LINE> hdulist[0].header['DATAMIN'] = datamin <NEW_LINE> hdulist[0].header['DATAMAX'] = datamax <NEW_LINE> hdulist.flush() <NEW_LINE> hdulis...
Recalculate the datamin/datamax.
625941b363b5f9789fde6ea8
def setTool(self, pose, tool_id=None, tool_name=None): <NEW_LINE> <INDENT> xyzwpr = Pose_2_Fanuc(pose) <NEW_LINE> if tool_id is None or tool_id < 0: <NEW_LINE> <INDENT> for i in range(6): <NEW_LINE> <INDENT> self.addline('PR[%i,%i]=%.3f ;' % (self.SPARE_PR, i+1, xyzwpr[i])) <NEW_LINE> <DEDENT> for i in range(6,self.nAx...
Change the robot TCP
625941b3d268445f265b4c37
def endWrite(self): <NEW_LINE> <INDENT> self.writing = False <NEW_LINE> if len(self.okToRead._waiters) > 0: <NEW_LINE> <INDENT> self.okToRead.notify() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.okToWrite.notify() <NEW_LINE> <DEDENT> self.okToRead.release() <NEW_LINE> self.okToWrite.release()
Notify the next waiting writer if the readers condition queue is empty. Otherwise, notify the next waiting reader.
625941b3e5267d203edcda64
def get_clanLeagueWars(self, war_tag): <NEW_LINE> <INDENT> return self.get_request('/clanwarleagues/wars/%23{}'.format(war_tag.lstrip("#").upper()))
This one requires the clan_war tag that you get from get_clanLeagueGroup It's currently not working. Doesn't return roster numbers or peoples accurate position ARGS: war_tag (str): Unique tag of the war
625941b3ec188e330fd5a56a
def __init__(self, loc=None, covariance_matrix=None, validate_args=False, allow_nan_stats=True, name="MultivariateNormalFullCovariance"): <NEW_LINE> <INDENT> parameters = locals() <NEW_LINE> with ops.name_scope(name) as name: <NEW_LINE> <INDENT> with ops.name_scope("init", values=[loc, covariance_matrix]): <NEW_LINE> <...
Construct Multivariate Normal distribution on `R^k`. The `batch_shape` is the broadcast shape between `loc` and `covariance_matrix` arguments. The `event_shape` is given by last dimension of the matrix implied by `covariance_matrix`. The last dimension of `loc` (if provided) must broadcast with this. A non-batch `co...
625941b382261d6c526ab265
def tree(self, **kwargs): <NEW_LINE> <INDENT> if kwargs.get('full', False) or kwargs.get('show_union', False): <NEW_LINE> <INDENT> return '\n'.join(self._raw_tree(**kwargs)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._step.tree(**kwargs)
Internal structure of chain
625941b3a17c0f6771cbde17
def get_environment_config(self): <NEW_LINE> <INDENT> env_vars = dict( VCENTER_HOST=self._get_cloud_config('vcenter_host'), ) <NEW_LINE> ansible_vars = dict( vcsim=self._get_cloud_config('vcenter_host'), ) <NEW_LINE> return CloudEnvironmentConfig( env_vars=env_vars, ansible_vars=ansible_vars, )
:rtype: CloudEnvironmentConfig
625941b376e4537e8c351439
def checksum(self, data): <NEW_LINE> <INDENT> return hashlib.md5(data).hexdigest()
Return a checksum for some data.
625941b391f36d47f21ac2b7
def i2c_master_write(self, address, *data): <NEW_LINE> <INDENT> address = int_any_base(address) <NEW_LINE> if len(data) == 1: <NEW_LINE> <INDENT> data = list_any_input(data[0]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> data = [int_any_base(c) for c in data] <NEW_LINE> <DEDENT> logger.info('Writing %d bytes to %02xh...
Perform an I2C master write access. Writes the given `data` to a slave device with address given in the `address` argument. The `data` argument can either be list of bytes, a whitespace separated list of bytes or a single byte. See the examples below. Both the `address` and `data` can be given either as strings or in...
625941b3d164cc6175782b10
def _auth_api_key(self, api_key): <NEW_LINE> <INDENT> req = requests.post( self._auth_url(), data={ 'type': 'api_key', 'api_key': api_key}, timeout=5) <NEW_LINE> self._evaluate_response(req)
Authenticate as with api_key.
625941b315baa723493c3d34
def _test_create_examples(): <NEW_LINE> <INDENT> vbbvg.run_examples(u'Bundesplatz')
Test creating examples.
625941b323849d37ff7b2e55
def convert_amount(amount, target_currency, date): <NEW_LINE> <INDENT> if amount == 0: <NEW_LINE> <INDENT> return amount <NEW_LINE> <DEDENT> currency = amount.currency <NEW_LINE> if currency == target_currency: <NEW_LINE> <INDENT> return amount <NEW_LINE> <DEDENT> exchange_rate = currency.value_in(target_currency, date...
Returns ``amount`` converted to ``target_currency`` using ``date`` exchange rates. .. seealso:: :meth:`.Currency.value_in` :param amount: :class:`Amount` :param target_currency: :class:`.Currency` :param date: ``datetime.date``
625941b373bcbd0ca4b2be3f
def modify_model(prev_model, new_class_num): <NEW_LINE> <INDENT> new_output = Dense(units=new_class_num, activation="softmax", name="output")(prev_model.layers[-2].output) <NEW_LINE> new_model = Model(inputs=prev_model.input, outputs=new_output) <NEW_LINE> return new_model
Arguments - prev_model: tf.keras.Model - 기존 pretrained 모델 - new_class_num: int - 분류할 클래스 수 Returns - output_layer가 변경된 tf.keras.Model
625941b399cbb53fe67929aa
def protocolNegotiationMechanisms(): <NEW_LINE> <INDENT> support = ProtocolNegotiationSupport.NOSUPPORT <NEW_LINE> ctx = SSL.Context(SSL.SSLv23_METHOD) <NEW_LINE> try: <NEW_LINE> <INDENT> ctx.set_npn_advertise_callback(lambda c: None) <NEW_LINE> <DEDENT> except (AttributeError, NotImplementedError): <NEW_LINE> <INDENT>...
Checks whether your versions of PyOpenSSL and OpenSSL are recent enough to support protocol negotiation, and if they are, what kind of protocol negotiation is supported. @return: A combination of flags from L{ProtocolNegotiationSupport} that indicate which mechanisms for protocol negotiation are supported. @rtype:...
625941b332920d7e50b27f8f
def _Resolve(self): <NEW_LINE> <INDENT> with self._unresolved_subjects_lock: <NEW_LINE> <INDENT> if self in self._unresolved_subjects: <NEW_LINE> <INDENT> self._unresolved_subjects.remove(self)
Marks the current subject as having been adequately asserted.
625941b392d797404e303f54
def create_geometry(src2obj, det2obj, det_pixel, theta_range): <NEW_LINE> <INDENT> geometry = {'det_pixel':det_pixel, 'det_hrz':0., 'det_vrt':0., 'det_mag':0., 'src_hrz':0., 'src_vrt':0., 'src_mag':0., 'axs_hrz':0., 'det_rot':0., 'anisotropy':[1,1,1], 'vol_rot':[0. ,0. ,0.], 'vol_hrz':0., 'vol_tra':[0., 0., 0.], 'vol_m...
Initialize an empty geometry record.
625941b3099cdd3c635f0a1f
def kthSmallest(self, root, k): <NEW_LINE> <INDENT> self.ans = [] <NEW_LINE> self.all(root=root) <NEW_LINE> return self.ans[k - 1]
:type root: TreeNode :type k: int :rtype: int
625941b397e22403b379cd5b
def set(isamAppliance, name, connection, type, jndiId, description='', locked=False, connectionManager=None, new_name=None, check_mode=False, force=False): <NEW_LINE> <INDENT> if _check_exists(isamAppliance, name=name) is False: <NEW_LINE> <INDENT> return add(isamAppliance, name=name, connection=connection, type=type, ...
Creating or Modifying an JDBC server connection
625941b321a7993f00bc7aab
def write_polygon(self, p, polygons): <NEW_LINE> <INDENT> writer = shapefile.Writer(shapefile.POLYGON) <NEW_LINE> for pp in polygons: <NEW_LINE> <INDENT> writer.poly(parts=[pp.points]) <NEW_LINE> <DEDENT> writer.save(p)
polygons: list of Polygon objects Polygon.points=[[x0,y0],...,[xN,yN]]
625941b3d10714528d5ffaa1
def _media_item_image_url(self, source, url): <NEW_LINE> <INDENT> if source == "local": <NEW_LINE> <INDENT> url = f"http://{self.hostname}:{self.port}{url}" <NEW_LINE> <DEDENT> url = f"{url}?t=x" <NEW_LINE> return url
Return the correct url to the item's thumbnail.
625941b35fc7496912cc3748
def create_graph(): <NEW_LINE> <INDENT> return
Create and return graph components
625941b32ae34c7f2600cef5
def test_max_users_per_device_on_update_canocicals(setup_database): <NEW_LINE> <INDENT> config.max_users_per_device = 1 <NEW_LINE> database.process_user_login(login_id=20, language_id=7, platform_id=1, device_token='d20', application_version=1007) <NEW_LINE> database.process_user_login(login_id=21, language_id=7, platf...
Test that max_users_per_device works on update cannonicals
625941b3cb5e8a47e48b7874
def custom_method(self): <NEW_LINE> <INDENT> self.log.info("Running custom_method")
Do some custom behaviour for this test Define it in a method here because you're going to use it repeatedly. If you think it's useful in general, consider moving it to the base BitsendTestFramework class so other tests can use it.
625941b3283ffb24f3c556d1
def test_iters(self): <NEW_LINE> <INDENT> for hashtype in HashTypes: <NEW_LINE> <INDENT> self.do_test_iters(hashtype)
Test iteration using various hash types.
625941b391af0d3eaac9b7d6
def get_user_groups_checked(user, db_session): <NEW_LINE> <INDENT> ax.verify_param(user, not_none=True, http_error=HTTPNotFound, msg_on_fail=s.Groups_CheckInfo_NotFoundResponseSchema.description) <NEW_LINE> group_names = ax.evaluate_call(lambda: [group.group_name for group in user.groups], fallback=lambda: db_session.r...
Obtains the validated list of group names from a pre-validated user.
625941b30a366e3fb873e5d9
def lambda_handler(event, context): <NEW_LINE> <INDENT> stock_price = event["stock_price"] <NEW_LINE> transaction_result = { "id": str(uuid4()), "price": str(stock_price), "type": "buy", "qty": str(randint(1, 10)), "timestamp": datetime.now().isoformat(), } <NEW_LINE> return transaction_result
Sample Lambda function which mocks the operation of buying a random number of shares for a stock. For demonstration purposes, this Lambda function does not actually perform any actual transactions. It simply returns a mocked result. Parameters ---------- event: dict, required Input event to the Lambda function c...
625941b356ac1b37e6263fa5
def compare_tests_avg(request, test_id): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> source = request.POST.get('source', '0') <NEW_LINE> num_of_tests = request.POST.get('num_of_tests_to_compare', '0') <NEW_LINE> data = get_compare_tests_aggregate_data( test_id, num_of_tests, source=source) <NEW...
Compare average response times for current and N previous tests
625941b35166f23b2e1a4f1c
def cleanDataParam(r,varNames): <NEW_LINE> <INDENT> data = {} <NEW_LINE> for i, val in enumerate(varNames): <NEW_LINE> <INDENT> y = r.values(val)[-1][-1] <NEW_LINE> data[val] = y <NEW_LINE> <DEDENT> return data
Clean parameter data by removing all extra values and time information Returns dictionary of varNames with single values
625941b324f1403a92600935
def iec_custom_exception_handler(exc, context): <NEW_LINE> <INDENT> response = exception_handler(exc, context) <NEW_LINE> if response is not None: <NEW_LINE> <INDENT> response.data['status_code'] = response.status_code <NEW_LINE> response.data['error'] = response.data['detail'] <NEW_LINE> del response.data['detail'] <N...
Custom exception handler for Django Rest Framework that adds the `status_code` to the response and renames the `detail` key to `error`.
625941b3fb3f5b602dac345a
def make_tgt_mask(tgt, tgt_pad): <NEW_LINE> <INDENT> tgt_mask = (tgt != tgt_pad).unsqueeze(-2) <NEW_LINE> tgt_mask = tgt_mask & Variable( mask_invalid_positions(tgt.size(-1)).type_as(tgt_mask.data)) <NEW_LINE> return tgt_mask
Make the mask for the target to hide padding and future words Arguments: tgt: target sequence Tensor of shape [batch_size, seq_len] tgt_pad: id of the padding token Returns: A mask of size [batch_size, seq_len, seq_len]
625941b37047854f462a11d1
def render(self): <NEW_LINE> <INDENT> return self._parent + ' ' + self._render_link_type() + ' ' + self._child
Render class relationship to string This method generically appends the parent name, a rendering of the link type (obtained from the :func:`_render_link_type` method) and the child object name. Returns ------- str The string representation of the class relationship following the PlantUML syntax
625941b38c0ade5d55d3e782
def aper13(ut11, ut12, astrom): <NEW_LINE> <INDENT> era = era00(ut11, ut12) <NEW_LINE> return aper(era, astrom)
aper13(ut11, ut12, astrom) -> astrom In the star-independent astrometry parameters, update only the Earth rotation angle. The caller provides UT1, (n.b. not UTC).
625941b45f7d997b8717485f
def extract_from_tag(tag, line): <NEW_LINE> <INDENT> open_tag = "<" + tag + ">" <NEW_LINE> close_tag = "</" + tag + ">" <NEW_LINE> try: <NEW_LINE> <INDENT> i = line.index(open_tag) <NEW_LINE> start = i + len(open_tag) <NEW_LINE> stop = line.index(close_tag, start) <NEW_LINE> return line[start : stop] <NEW_LINE> <DEDENT...
This function accepts a line with html like tags, enter a tag name and you can find the word wrapped within the tag
625941b40383005118ecf3a8
@office_route.route('offices/<int:office_id>',methods=['GET']) <NEW_LINE> def get_specific_office(office_id): <NEW_LINE> <INDENT> query = """SELECT * FROM offices WHERE office_id = '{}'""".format(office_id) <NEW_LINE> office = office_model.Office() <NEW_LINE> office = database.select_from_db(query) <NEW_LINE> if not of...
get an office by id
625941b4e5267d203edcda65
def describe_direct_connect_gateways(directConnectGatewayId=None, maxResults=None, nextToken=None): <NEW_LINE> <INDENT> pass
Lists all your Direct Connect gateways or only the specified Direct Connect gateway. Deleted Direct Connect gateways are not returned. See also: AWS API Documentation Exceptions :example: response = client.describe_direct_connect_gateways( directConnectGatewayId='string', maxRe...
625941b4377c676e91271f71
def test_conv_to_self_type(self): <NEW_LINE> <INDENT> input = [1,2,3] <NEW_LINE> exp = array([1,2,3]) <NEW_LINE> obs = self.dt1._conv_to_self_type(input) <NEW_LINE> self.assertEqual(obs, exp) <NEW_LINE> exp = array([[1],[2],[3]]) <NEW_LINE> obs = self.dt1._conv_to_self_type([input], transpose=True) <NEW_LINE> self.asse...
Should convert from other to numpy type
625941b48e05c05ec3eea134
def reset(self): <NEW_LINE> <INDENT> super().reset() <NEW_LINE> self.initialised = False
Resets the scheme.
625941b4293b9510aa2c305d
def __reset_syncer(self): <NEW_LINE> <INDENT> if self._syncer is not None: <NEW_LINE> <INDENT> self._syncer.reset()
Reset state watcher :return: void
625941b430bbd722463cbb87
def device(): <NEW_LINE> <INDENT> pass
Return the device associated with this component.
625941b431939e2706e4cc35
def upload_single_file_from_buffer(self, request): <NEW_LINE> <INDENT> assert isinstance(request, UploadFileFromBufferRequest) <NEW_LINE> check_params_ret = self._check_params(request) <NEW_LINE> if check_params_ret is not None: <NEW_LINE> <INDENT> return check_params_ret <NEW_LINE> <DEDENT> data = request.get_data() <...
单文件上传 :param request: :return:
625941b43d592f4c4ed1ce45
def region_across(self, curtime, result): <NEW_LINE> <INDENT> date = curtime.format_date() <NEW_LINE> time = curtime.format_time() <NEW_LINE> for attribute in range(len(self.array())): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> depart = self.array()[attribute].station_number() <NEW_LINE> arrive = self.array()[attribu...
Creates the route across the region centers :param curtime: CurTime() instance :param result: Result() instance :return: new CurTime() instance, updated Result() instance
625941b4656771135c3eb636
def peek(self): <NEW_LINE> <INDENT> if (self.size == 0): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.items[1]
Returns the item at the root of the binary heap without removing it. Returns <None> if the list is empty.
625941b445492302aab5e083
def test_admin_setattr(self): <NEW_LINE> <INDENT> self.cmdhandler.admin.blacklist = False <NEW_LINE> cmd = self.cmd_str('setattr') <NEW_LINE> args = 'admin.blacklist True' <NEW_LINE> userinput = '{} {}'.format(cmd, args) <NEW_LINE> setattrfunc = self.get_cmdfunc( self.cmdhandler, userinput, asadmin=True) <NEW_LINE> if ...
admin command setattr works
625941b4dd821e528d63af70
def advance_round(ballots, active_candidates): <NEW_LINE> <INDENT> to_update = ~ ballots.apply(get_active_choice, axis=1) .isin(active_candidates) <NEW_LINE> ballots.loc[to_update] = ballots[to_update]. apply(find_high_valid_choice, axis=1, args=(active_candida...
Updates active choice on ballots after a candidate is eliminated Inputs: ballots (Pandas dataframe): all the ballots in the election active_candidates (set): uneliminated candidates
625941b421a7993f00bc7aac
def __init__( self, *, kubernetes_version: str, os_type: Union[str, "OSType"] = "Linux", name: Optional[str] = None, upgrades: Optional[List["ManagedClusterPoolUpgradeProfileUpgradesItem"]] = None, **kwargs ): <NEW_LINE> <INDENT> super(ManagedClusterPoolUpgradeProfile, self).__init__(**kwargs) <NEW_LINE> self.kubernete...
:keyword kubernetes_version: Required. Kubernetes version (major, minor, patch). :paramtype kubernetes_version: str :keyword name: Pool name. :paramtype name: str :keyword os_type: Required. OsType to be used to specify os type. Choose from Linux and Windows. Default to Linux. Possible values include: "Linux", "Window...
625941b47d847024c06be084
def make_class_dictable( cls, exclude=constants.default_exclude, exclude_underscore=constants.default_exclude_underscore, fromdict_allow_pk=constants.default_fromdict_allow_pk, include=None, asdict_include=None, fromdict_include=None): <NEW_LINE> <INDENT> setattr(cls, 'dictalchemy_exclude', exclude) <NEW_LINE> setattr(...
Make a class dictable Useful for when the Base class is already defined, for example when using Flask-SQLAlchemy. Warning: This method will overwrite existing attributes if they exists. :param exclude: Will be set as dictalchemy_exclude on the class :param exclude_underscore: Will be set as dictalchemy_exclude_under...
625941b40c0af96317bb7fad
def computeOverlap(self, return_dict=True): <NEW_LINE> <INDENT> W = np.matrix(self.getWeights(), np.float64) <NEW_LINE> O = np.multiply(self.N_k, W.T * W) <NEW_LINE> (eigenvals, eigevec) = linalg.eig(O) <NEW_LINE> eigenvals = np.sort(eigenvals)[::-1] <NEW_LINE> overlap_scalar = 1 - eigenvals[1] <NEW_LINE> results_vals ...
Compute estimate of overlap matrix between the states. Parameters ---------- return_dict : bool, Default False If true, results are a dict, else a tuple Returns ------- 'scalar' : np.ndarray, float, shape=(K, K) One minus the largest nontrival eigenvalue (largest is 1 or -1) If return_dict, key is 'scalar...
625941b42eb69b55b151c66e
def run(self): <NEW_LINE> <INDENT> self.run_simulation(nsims=self.nsims) <NEW_LINE> if self.path is None: <NEW_LINE> <INDENT> os.chdir(self.cur_dir)
Main way this class is intended to function
625941b47b180e01f3dc45cc
def getCoordinates(self): <NEW_LINE> <INDENT> return list(self.gridVars.keys())
Coordinates variables contained within the host object Returns ------- list of coordinate names
625941b4460517430c393f54
def MakeTestIonoclass(testv=False,testtemp=False,N_0=1e11,z_0=250.0,H_0=50.0,coords=None,times =np.array([[0,1e6]])): <NEW_LINE> <INDENT> if coords is None: <NEW_LINE> <INDENT> xvec = np.arange(-250.0,250.0,20.0) <NEW_LINE> yvec = np.arange(-250.0,250.0,20.0) <NEW_LINE> zvec = np.arange(50.0,900.0,2.0) <NEW_LINE> xx,zz...
This function will create a test ionoclass with an electron density that follows a chapman function. Inputs testv - A bool to add velocities. If not then all of the velocity values will be zero. testtemp - If true then a tempreture profile will be used. If not then there will be a set tempreture of 2000...
625941b4dc8b845886cb52f8
def __init__(self, product_id): <NEW_LINE> <INDENT> self.product_id = product_id
:param product_id: str, length:31 产品代码
625941b4d4950a0f3b08c120
def mean_average_precision(cand_set, queries, c_gdtruth, q_gdtruth): <NEW_LINE> <INDENT> scorer = APScorer(cand_set.shape[0]) <NEW_LINE> simmat = np.matmul(queries, cand_set.T) <NEW_LINE> ap_sum = 0 <NEW_LINE> for q in range(simmat.shape[0]): <NEW_LINE> <INDENT> sim = simmat[q] <NEW_LINE> index = np.argsort(-sim) <NEW_...
calculate mAP of a conditional set. Samples in candidate and query set are of the same condition. cand_set: type: nparray shape: c x feature dimension queries: type: nparray shape: q x feature dimension c_gdtruth: type: nparray shape: c q_gdtruth...
625941b445492302aab5e084
def splrnk(n, n0, p, x, y): <NEW_LINE> <INDENT> isplit = 1 <NEW_LINE> n1 = n0[0, 0] <NEW_LINE> p1 = p[0] <NEW_LINE> for i in range(1, n): <NEW_LINE> <INDENT> if n0[i, 0] < n1 or (n0[i, 0] == n1 and p[i] < p1): <NEW_LINE> <INDENT> isplit = i + 1 <NEW_LINE> n1 = n0[i] <NEW_LINE> p1 = p[i] <NEW_LINE> <DEDENT> <DEDENT> if ...
determines the splitting index and splitting value for splitting a box by rank
625941b463b5f9789fde6ea9
def test_getChildWithDefaultUnauthorizedPassword(self): <NEW_LINE> <INDENT> return self._invalidAuthorizationTest( 'Basic ' + b64encode(self.username + ':bar'))
If L{HTTPAuthSessionWrapper.getChildWithDefault} is called with a request with an I{Authorization} header with a user which exists and the wrong password, an L{IResource} which renders a 401 response code is returned.
625941b4b7558d58953c4ce0
def gotStringDigitsGetIntegers( d ): <NEW_LINE> <INDENT> for k, v in getItemIter( d ): <NEW_LINE> <INDENT> d[ k ] = int( v )
modifies the dictionary in place -- returns None
625941b467a9b606de4a7c81
def _updateEventQueue(self, playlist): <NEW_LINE> <INDENT> self.messenger.queueRemoveEvents('playtrack', 'player') <NEW_LINE> for track in playlist['playlist']['trackList']['track']: <NEW_LINE> <INDENT> if track.has_key('time') and track.has_key('start'): <NEW_LINE> <INDENT> starts = str(track['start'] + 'T' + track['t...
Playlist Eventqueue updaten @type playlist: dict @param playlist: Playlist
625941b4d486a94d0b98df13
def get_predefined_styles(): <NEW_LINE> <INDENT> lReturn = [] <NEW_LINE> sStylePath = os.path.join(os.path.dirname(__file__), 'styles') <NEW_LINE> lStyles = os.listdir(sStylePath) <NEW_LINE> for sStyle in lStyles: <NEW_LINE> <INDENT> if sStyle.endswith('.yaml'): <NEW_LINE> <INDENT> with open(os.path.join(sStylePath, sS...
Reads all predefined styles and returns a list of names. Parameters : None Returns : (list of strings)
625941b4cc40096d61595719
def scroll(amount, horizontal=False): <NEW_LINE> <INDENT> wheel = MOUSEEVENTF_WHEEL if not horizontal else MOUSEEVENTF_HWHEEL <NEW_LINE> scroll_event = Input( type=INPUT_MOUSE, mi=MouseInput(dwFlags=wheel, mouseData=amount * 120)) <NEW_LINE> _err(ctypes.windll.user32.SendInput( 1, ctypes.byref(scroll_event), ctypes.siz...
Horizontal and horizontal scrolling.
625941b4e5267d203edcda66
def exp1(): <NEW_LINE> <INDENT> phases = range(2,31) <NEW_LINE> fil3 = open("exp1_bonmin.csv",'w') <NEW_LINE> fil3.write("numPhases,ratio,ratio2,etBONMIN,etPkMin\n") <NEW_LINE> for numPhases in phases: <NEW_LINE> <INDENT> colNames = ["alloc-"+str(u) for u in range(1,numPhases+1)] <NEW_LINE> colNames.append("pkp") <NEW_...
Average peak power for applications under PkMin with increasing number of phases normalized against their peak power under Oracle.
625941b45e10d32532c5ecf4
def _setChangeLog(self, log): <NEW_LINE> <INDENT> if self._ui != None: <NEW_LINE> <INDENT> self._ui.setAppChangeLog(log) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._changelogHolder = log
Caches or displays the given change log. log: list of strings
625941b476e4537e8c35143b
def numSquares_TLE(self, n): <NEW_LINE> <INDENT> F = [i for i in xrange(n+1)] <NEW_LINE> for i in xrange(1, n+1): <NEW_LINE> <INDENT> for j in xrange(1, int(math.sqrt(i))+1): <NEW_LINE> <INDENT> if i-j*j >= 0: <NEW_LINE> <INDENT> F[i] = min(F[i], F[i-j*j]+1) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> return F[n]
DP :type n: int :rtype: int
625941b430c21e258bdfa261
def get_exp_ind(filePath, fileName, overwriteExpName=None): <NEW_LINE> <INDENT> if overwriteExpName is not None: <NEW_LINE> <INDENT> return exp_name_to_ind(overwriteExpName), overwriteExpName; <NEW_LINE> <DEDENT> if 'V1_orig' in filePath: <NEW_LINE> <INDENT> return 1, 'sfMix'; <NEW_LINE> <DEDENT> if fileName.startswith...
returns the following: index of experiment (see get_exp_params) name of experiment (e.g. sfMix, sfMixHalfInt) this function relies on the fact that all .npy files (in /structures) have an associated matlab file in /recordings with the full experiment name EXCEPT: V1_orig files...
625941b43346ee7daa2b2b2c
def gpscat(gpfile,rxn,data): <NEW_LINE> <INDENT> import numpy as np <NEW_LINE> from datfcn import order <NEW_LINE> om = [] <NEW_LINE> with open(gpfile,'w+') as gnu: <NEW_LINE> <INDENT> gnu.write("# sza / rad ") <NEW_LINE> for h in range(len(rxn)): <NEW_LINE> <INDENT> gnu.write("\t%s" % (rxn[h][1])) <NEW_LINE> <DEDEN...
Function gnuinp =============== Purpose: Write gnuplot input file with data for scatter plots of TUV data. Variables: I/O: gpfile: gnuplot file with data for scatter plots rxn: matrix with indices and labels of available photoreactions data: matrix with sza-dependent j values from TUV...
625941b41b99ca400220a874
def test_gapMaps(self): <NEW_LINE> <INDENT> empty = '' <NEW_LINE> no_gaps = 'aaa' <NEW_LINE> all_gaps = '---' <NEW_LINE> start_gaps = '--abc' <NEW_LINE> end_gaps = 'ab---' <NEW_LINE> mid_gaps = '--a--b-cd---' <NEW_LINE> gm = lambda x: self.RNA(x).gapMaps() <NEW_LINE> self.assertEqual(gm(empty), ({},{})) <NEW_LINE> self...
Sequence gapMaps should return dicts mapping gapped/ungapped pos
625941b4293b9510aa2c305e
def intToRoman(self, num): <NEW_LINE> <INDENT> div = 1 <NEW_LINE> final_str = "" <NEW_LINE> count = 0 <NEW_LINE> while num/div >= 10: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> div = div*10 <NEW_LINE> <DEDENT> while num > 0: <NEW_LINE> <INDENT> left_digit = num/div <NEW_LINE> left_value = left_digit*div <NEW_LINE> num =...
:type num: int :rtype: str Find the division of the number in form of 10's Then count the number of digits Get the left digit and slice it from the number For the left digit, identify the roman numeral
625941b45fdd1c0f98dbfff6
def _handle_pcl(self, ros_cloud): <NEW_LINE> <INDENT> pcl_original = ros_to_pcl(ros_cloud) <NEW_LINE> voxel_filter = PCLSegmenter.VoxelFilter( pcl_original, 0.01 ) <NEW_LINE> pcl_clustered = voxel_filter.filter() <NEW_LINE> pass_through_filter = PCLSegmenter.PassThroughFilter( pcl_clustered, 'z', [0.6, 1.1] ) <NEW_LINE...
Handle ROS pc2 message
625941b44d74a7450ccd3f88
@mock.patch('foremast.utils.lookups.gitlab') <NEW_LINE> def test_init(gitlab): <NEW_LINE> <INDENT> my_git = FileLookup() <NEW_LINE> assert my_git.git_short == '' <NEW_LINE> assert my_git.server == gitlab.Gitlab.return_value <NEW_LINE> my_git.server.projects.get.assert_called_with(my_git.git_short)
Check init.
625941b4046cf37aa974cb0f
def pretty_to_link(inst, from_link, to_link): <NEW_LINE> <INDENT> values = '' <NEW_LINE> prefix = '' <NEW_LINE> for name, ty in inst.__a__: <NEW_LINE> <INDENT> if name in from_link.ids: <NEW_LINE> <INDENT> value = getattr(inst, name) <NEW_LINE> value = xtuml.serialize_value(value, ty) <NEW_LINE> idx = from_link.ids.ind...
Create a human-readable representation of a link on the 'TO'-side
625941b4ec188e330fd5a56d
def update(self): <NEW_LINE> <INDENT> while not self.stopped: <NEW_LINE> <INDENT> self.grabbed, self.frame = self.stream.read() <NEW_LINE> if self.grabbed: <NEW_LINE> <INDENT> self.has_frame.set()
Continuously update the stream with the most recent frame until stopped.
625941b432920d7e50b27f90
def __init__(self, size=1024, *, loop=None): <NEW_LINE> <INDENT> self.loop = loop or _get_loop() <NEW_LINE> self.size = size <NEW_LINE> self._executed = 0 <NEW_LINE> self._joined = set() <NEW_LINE> self._waiting = {} <NEW_LINE> self._active = {} <NEW_LINE> self.semaphore = aio.Semaphore(value=self.size)
Pool of asyncio coroutines with familiar interface. Pool makes sure _no more_ and _no less_ (if possible) than `size` spawned coroutines are active at the same time. _spawned_ means created and scheduled with one of the pool interface methods, _active_ means coroutine function started executing it's code, as opposed t...
625941b4ff9c53063f47bfc3
def get_folders(self): <NEW_LINE> <INDENT> return self.mail.list()
Return a list of folders
625941b421bff66bcd68471a
def _on_canvas_clicked(self, event: tkinter.Event) -> None: <NEW_LINE> <INDENT> count = 0 <NEW_LINE> canvas_height = self._canvas.winfo_height() <NEW_LINE> canvas_width = self._canvas.winfo_width() <NEW_LINE> height = canvas_height / self._rows <NEW_LINE> wid = canvas_width / self._cols <NEW_LINE> desired_row = self.ge...
runs when canvas is clicked
625941b421bff66bcd68471b
def bind_tensors(self, tensors): <NEW_LINE> <INDENT> def _binder(placeholder, tensor): <NEW_LINE> <INDENT> placeholder.tensor = tensor <NEW_LINE> <DEDENT> U.recursive_binary_combine( self.struct, tensors, combinator=_binder, is_base=_is_placeholder, )
Bind tensor values to placeholders for actual layer computation
625941b499fddb7c1c9de158
def notify_condition(self, condition): <NEW_LINE> <INDENT> detected_foreign_database = self.__get_foreign_database(condition['id']) <NEW_LINE> versions_range_from_condition = VersionsRange(dump=condition['versions_range']) <NEW_LINE> if self.get_hash(versions_range_from_condition) == condition['hash']: <NEW_LINE> <INDE...
Сообщить базе о внешней базе и ее состоянии в указанном диапазоне.
625941b41f037a2d8b945fc4
def update_product(self, product_id, data): <NEW_LINE> <INDENT> product = self.get_one(product_id) <NEW_LINE> data['modified_date'] = str(datetime.now().strftime('%b-%d-%Y : %H:%M:%S')) <NEW_LINE> product[0].update(data) <NEW_LINE> return product
Method for updating an product
625941b4627d3e7fe0d68c12
def computeComponentsNumber(imIn, grid=mamba.DEFAULT_GRID): <NEW_LINE> <INDENT> imWrk = mamba.imageMb(imIn, 32) <NEW_LINE> return mamba.label(imIn, imWrk, grid=grid)
Computes the number of connected components in image 'imIn'. The result is an integer value.
625941b401c39578d7e74c09
def test_gen_modules_executors(self): <NEW_LINE> <INDENT> mock_opts = self.get_config('minion', from_scratch=True) <NEW_LINE> io_loop = salt.ext.tornado.ioloop.IOLoop() <NEW_LINE> io_loop.make_current() <NEW_LINE> minion = salt.minion.Minion(mock_opts, io_loop=io_loop) <NEW_LINE> class MockPillarCompiler(object): <NEW_...
Ensure gen_modules is called with the correct arguments #54429
625941b421a7993f00bc7aad
def test_basicInsertion(self): <NEW_LINE> <INDENT> x = MimeDict() <NEW_LINE> x["hello"] = "hello" <NEW_LINE> self.assertEqual("hello", x["hello"] )
Insertion into a dictionary succeeds
625941b45fc7496912cc374a
def print_square(size): <NEW_LINE> <INDENT> if isinstance(size, float) and i < 0: <NEW_LINE> <INDENT> raise TypeError("size must be an integer") <NEW_LINE> <DEDENT> if not isinstance(size, int): <NEW_LINE> <INDENT> raise TypeError("size must be an integer") <NEW_LINE> <DEDENT> if size < 0: <NEW_LINE> <INDENT> raise Val...
prints square given a size
625941b4627d3e7fe0d68c13
def Get_LocatorRecord_Object(rloc, weights="1/1/255/0", flags=0o01, loc_id="ISP1"): <NEW_LINE> <INDENT> sys.path.insert(0, workspace) <NEW_LINE> from LISPFlowMappingYANGBindings.odl_mappingservice_rpc.add_mapping.input import ( input, ) <NEW_LINE> rpc_input = input() <NEW_LINE> lrecord_obj = rpc_input.mapping_record.Lo...
Description: Returns locator record object from pyangbind generated classes Returns: locator record object Params: rloc: eid_string for lisp address object weights: priority/weight/multicastPriority/multicastWeight flags: Three bit parameter in the sequence routed->rlocProbed->routed loc_id: id of locator record ob...
625941b456b00c62f0f14421
def __init__(self, width=None, height=None, name=None, bounds=None, bg=(1, 1, 1), format=None): <NEW_LINE> <INDENT> if bounds is None: <NEW_LINE> <INDENT> assert width is not None <NEW_LINE> assert height is not None <NEW_LINE> bounds = Bounds(0, 0, width, height) <NEW_LINE> <DEDENT> self.bounds = bounds <NEW_LINE> sel...
Create a new Cairo drawing. If `bounds` is provided, it's a Bounds describing the extend of the drawing. Otherwise, provide `width` and `height` to specify a size explicitly. `bg` is the background color to paint initially.
625941b4a4f1c619b28afe09
def process_list_system_clients(self): <NEW_LINE> <INDENT> cmd = shlex.split("/usr/bin/curl http://localhost:8080/list/system/clients/asdf") <NEW_LINE> p = subprocess.Popen(cmd, stdout=subprocess.PIPE) <NEW_LINE> out, err = p.communicate() <NEW_LINE> error = [] <NEW_LINE> if err: error.append(err) <NEW_LINE> return err...
Tests /list/system/clients/(.*) :return: returns any errors
625941b48a43f66fc4b53e2f
def test_fetch_harvestable_not_nested(self): <NEW_LINE> <INDENT> non_nested_obj = json.load(open(self.test_simple_object)) <NEW_LINE> harvestable = self.dh.fetch_harvestable(non_nested_obj) <NEW_LINE> self.assertEqual(harvestable, [non_nested_obj])
test that a non-nested object is identified as harvestable
625941b4fbf16365ca6f5f88
def construct_relationships(filename): <NEW_LINE> <INDENT> dict1=read_files(filename) <NEW_LINE> people =ListNode(Person(None)) <NEW_LINE> temp=people <NEW_LINE> for key in dict1: <NEW_LINE> <INDENT> if temp.val.get_name() is None: <NEW_LINE> <INDENT> temp.val.set_name(key) <NEW_LINE> <DEDENT> temp.next = ListNode(Pers...
this function is built link list and each value of linklist is name and thier friends.People start def as None linklist,it val equal to key of dictionary,if get_name is NOne it will set that name first then,add another name one by one as linklist for thier friends,if get_friends is None, set first firends,then add othe...
625941b4e1aae11d1e749a79
def get_id_context_inter_etabs(self): <NEW_LINE> <INDENT> s = "SELECT id" " FROM {entete}context" " WHERE contextlevel = %(context_level)s" " AND instanceid = %(instanceid)s" .format(entete=self.entete) <NEW_LINE> self.mark.execute(s, params={'context_level': self.constantes....
Fonction permettant de recuperer l'id du contexte de la categorie inter-etablissements :return:
625941b40a366e3fb873e5db
def hash256_bit_length(data, length): <NEW_LINE> <INDENT> return hash_function(data, length, 256)
:param length: length in bits
625941b4c4546d3d9de727fd
def setContentData(content): <NEW_LINE> <INDENT> pass
Sets the content that will be used as the form processing context.
625941b415fb5d323cde08cd
def describe_log_inspection_rule_on_computer(self, computer_id, log_inspection_rule_id, api_version, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.describe_log_inspection_rule_on_computer_with_http_info(computer_id, log_insp...
Describe an log inspection rule # noqa: E501 Describe an log inspection rule including computer-level overrides. # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.describe_log_inspection_rule_on_computer(computer_id...
625941b43539df3088e2e110
def get_activity_feed_deleted(self, **kwargs): <NEW_LINE> <INDENT> kwargs.update({'api_key': self.params['api_key'], 'activity_type': 'delete-destination', }) <NEW_LINE> if self.check_required_params(kwargs, ['api_key', 'route_id']): <NEW_LINE> <INDENT> self.response = self.api._request_get(ACTIVITY_FEED, kwargs) <NEW_...
Get Activity Feed Deleted using GET request :return: API response :raise: ParamValueException if required params are not present.
625941b45166f23b2e1a4f1e
def update_package_data() -> None: <NEW_LINE> <INDENT> download_all_data(_const.DATA_PATH)
Update all data files currently installed by the module.
625941b4236d856c2ad445a4
def lemonadeChange(self, bills): <NEW_LINE> <INDENT> five = ten = 0 <NEW_LINE> for bill in bills: <NEW_LINE> <INDENT> if bill == 20: <NEW_LINE> <INDENT> if ten and five: <NEW_LINE> <INDENT> ten -=1 <NEW_LINE> five -=1 <NEW_LINE> <DEDENT> elif five >= 3: <NEW_LINE> <INDENT> five -=3 <NEW_LINE> <DEDENT> else: <NEW_LINE> ...
:type bills: List[int] :rtype: bool
625941b471ff763f4b549453
def _init_writer(self, config): <NEW_LINE> <INDENT> tb_base = os.environ['TENSORBOARD_DIR'] if 'TENSORBOARD_DIR' in os.environ else None <NEW_LINE> tb_dir = config.get("tensorboard_dir", "default") <NEW_LINE> if tb_base is None or tb_dir is None: <NEW_LINE> <INDENT> self.writer = DevNullSummaryWriter() <NEW_LINE> <DEDE...
set the writer
625941b47cff6e4e8111774c
def __init__(self, variety): <NEW_LINE> <INDENT> self._variety = variety <NEW_LINE> if not variety.is_orbifold(): <NEW_LINE> <INDENT> raise NotImplementedError('Requires an orbifold toric variety.') <NEW_LINE> <DEDENT> R = PolynomialRing(QQ, variety.variable_names()) <NEW_LINE> self._polynomial_ring = R <NEW_LINE> I = ...
See :class:`CohomologyRing` for documentation. TESTS:: sage: P2 = toric_varieties.P2() sage: P2.cohomology_ring() Rational cohomology ring of a 2-d CPR-Fano toric variety covered by 3 affine patches :: sage: cone1 = Cone([(1,0)]); cone2 = Cone([(1,0)]) sage: cone1 is cone2 False sage: f...
625941b426068e7796caea9d
def __addViewPanelMenu(self, panel, title): <NEW_LINE> <INDENT> if not self.__haveMenu: <NEW_LINE> <INDENT> return None, [] <NEW_LINE> <DEDENT> actionItems = [] <NEW_LINE> actionNames = [name for (name, obj) in panel.getActions()] <NEW_LINE> actionTitles = {} <NEW_LINE> pluginCtrls = plugins.listControls(type(panel)...
Called by :meth:`addViewPanel`. Adds a menu item for the newly created :class:`.ViewPanel` instance, and adds any tools for the view panel to the tools menu. :arg panel: The newly created ``ViewPanel`` instance. :arg title: The name given to the ``panel``.
625941b499fddb7c1c9de159
def testStorageSource(self): <NEW_LINE> <INDENT> model = swagger_client.models.storage_source.StorageSource()
Test StorageSource
625941b49f2886367277a65f
def get_id(self,f): <NEW_LINE> <INDENT> res=None <NEW_LINE> for identifiant in self._files: <NEW_LINE> <INDENT> if self._files[identifiant]==f: <NEW_LINE> <INDENT> res=identifiant <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> return res
Renvoie l'identifiant selon le nom du fichier
625941b4a05bb46b383ec5f3
def _check_sparse_inputs(options, A_ub, A_eq): <NEW_LINE> <INDENT> _sparse_presolve = options.pop('_sparse_presolve', False) <NEW_LINE> if _sparse_presolve and A_eq is not None: <NEW_LINE> <INDENT> A_eq = sps.coo_matrix(A_eq) <NEW_LINE> <DEDENT> if _sparse_presolve and A_ub is not None: <NEW_LINE> <INDENT> A_ub = sps.c...
Check the provided ``A_ub`` and ``A_eq`` matrices conform to the specified optional sparsity variables. Parameters ---------- A_ub : 2D array, optional 2D array which, when matrix-multiplied by ``x``, gives the values of the upper-bound inequality constraints at ``x``. A_eq : array_like, optional 2D array ...
625941b426238365f5f0ec2e