code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def write(self, outfile='geom.xyz', label=True, style='xyz'): <NEW_LINE> <INDENT> out = '' <NEW_LINE> if style == 'xyz': <NEW_LINE> <INDENT> if label: <NEW_LINE> <INDENT> out += f'{len(self)}\n\n' <NEW_LINE> <DEDENT> out += f'{self}' <NEW_LINE> <DEDENT> elif style == 'latex': <NEW_LINE> <INDENT> header = f'{len(self)}\... | Writes the geometry to the specified file
Prints the size at the beginning if desired (to conform to XYZ format) | 625941b592d797404e303f8c |
def get(self, path, params=None): <NEW_LINE> <INDENT> params = params or {} <NEW_LINE> params = dict((k, _clean(v)) for k,v in params.iteritems()) <NEW_LINE> _log.debug("Calling %s with params=%r", path, params) <NEW_LINE> if self.api_key: <NEW_LINE> <INDENT> _log.debug("keyID and vCode added") <NEW_LINE> params['keyID... | Request a specific path from the EVE API.
The supplied path should be a slash-separated path
frament, e.g. "corp/AssetList". (Basically, the portion
of the API url in between the root / and the .xml bit.) | 625941b56aa9bd52df036ba4 |
def contrast_stretch(I, N): <NEW_LINE> <INDENT> T_up = 254 <NEW_LINE> T_low = 1 <NEW_LINE> for i in range(N): <NEW_LINE> <INDENT> if I.max()<T_up: <NEW_LINE> <INDENT> G_max = I.max() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> G_max = T_up <NEW_LINE> <DEDENT> if I.min()>T_low: <NEW_LINE> <INDENT> G_min = I.min() <NEW... | contrast_stretch(I,N)
where I is BW image matrix and N is a integer.
Carries out contrast enhancement of the image using the method described
in the paper by L.Chen et al(2013) :
'An effective image segmentation method for noisy low-contrast unbalanced
background in Mura defects using balanced discrete-cosine-transfe... | 625941b5dd821e528d63afad |
def _execute_multi_specific(self): <NEW_LINE> <INDENT> raise NotImplementedError | Operations specific for particular command dealing with multiple todo
IDs. | 625941b5d99f1b3c44c6739a |
def process_split( self, split, indexers, model_preprocessing_interface ) -> Iterable[Type[Instance]]: <NEW_LINE> <INDENT> def _make_instance(passage, question, answer, label, par_idx, qst_idx, ans_idx): <NEW_LINE> <INDENT> d = {} <NEW_LINE> d["psg_str"] = MetadataField(" ".join(passage)) <NEW_LINE> d["qst_str"] = Meta... | Process split text into a list of AllenNLP Instances. | 625941b5bf627c535bc12fd9 |
def __init__(self, state_size, action_size, seed): <NEW_LINE> <INDENT> super(QNetwork, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> self.state_size = state_size <NEW_LINE> self.action_size = action_size <NEW_LINE> self.fc1 = nn.Linear(self.state_size, 64) <NEW_LINE> self.fc2 = nn.Linear(64... | Initialize parameters and build model.
Params
======
state_size (int): Dimension of each state
action_size (int): Dimension of each action
seed (int): Random seed | 625941b5baa26c4b54cb0f26 |
def __resolveRelativeImport(importObj, basePath, result): <NEW_LINE> <INDENT> if basePath is None: <NEW_LINE> <INDENT> result.append(ImportResolution(importObj, None, False, None, None, "Could not resolve 'from " + importObj.name + " import ...' at line " + str(importObj.line) + " because the editing buffer has not bee... | Resolves imports like: 'from ..x import y' | 625941b57d847024c06be0c2 |
def time2year(self, t): <NEW_LINE> <INDENT> time = self.ds.variables['time'] <NEW_LINE> if type(t) == np.int: <NEW_LINE> <INDENT> return num2date(t, time.units).year <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.asarray([y.year for y in np.asarray(num2date(t, time.units))]) | convert time to year | 625941b5046cf37aa974cb4d |
def prep_level(self): <NEW_LINE> <INDENT> self.level_image = self.font.render(str(self.stats.level), True, self.text_color, self.ai_settings.bg_color) <NEW_LINE> self.level_rect = self.level_image.get_rect() <NEW_LINE> self.level_rect.right = self.screen_rect.right <NEW_LINE> self.level_rect.top =self.score_rect.bottom... | 将等级转换为渲染的图像 | 625941b545492302aab5e0c2 |
def __init__(self, charge): <NEW_LINE> <INDENT> self.charge = charge <NEW_LINE> self.rs = None <NEW_LINE> self.volume = None <NEW_LINE> self.mask_g = None <NEW_LINE> self.gd = None | Initialize the Jellium object
Input: charge, the total Jellium background charge. | 625941b5462c4b4f79d1d4d2 |
def on_token_auto_refreshed(self, access_token): <NEW_LINE> <INDENT> with self.lock: <NEW_LINE> <INDENT> self.access_token = access_token | Called after the access token is refreshed (requests-oauthlib
can automatically refresh tokens if given an OAuth client ID and
secret, so this is how our copy of the token stays up-to-date).
Applications that cache access tokens can override this to store
the new token - just remember to call the super() method!
:para... | 625941b57cff6e4e81117788 |
def get_css_classes(self): <NEW_LINE> <INDENT> css_classes = set(self.default_css_classes) <NEW_LINE> if self.is_required: <NEW_LINE> <INDENT> css_classes.add('required') <NEW_LINE> <DEDENT> return css_classes | Returns the list of CSS classes to apply to the element.
By default, this will include the contents of ``default_css_classes``,
and ``required`` if it's a required field.
This can be overridden to provide additional CSS classes, if they're
not appropraite for ``default_css_classes``. | 625941b597e22403b379cd9b |
def convert_package_name_or_id_to_title_or_name(package_name_or_id, context): <NEW_LINE> <INDENT> session = context['session'] <NEW_LINE> result = session.query(model.Package).filter_by( id=package_name_or_id).first() <NEW_LINE> if not result: <NEW_LINE> <INDENT> result = session.query(model.Package).filter_by( name=pa... | Return the package title, or name if no title, for the given package name
or id.
:returns: the name of the package with the given name or id
:rtype: string
:raises: ckan.lib.navl.dictization_functions.Invalid if there is no
package with the given name or id | 625941b5de87d2750b85fb90 |
def __init__(self, stream_id=None, message=None, input_id=None): <NEW_LINE> <INDENT> self.swagger_types = { 'stream_id': 'str', 'message': 'object', 'input_id': 'str' } <NEW_LINE> self.attribute_map = { 'stream_id': 'stream_id', 'message': 'message', 'input_id': 'input_id' } <NEW_LINE> self._stream_id = stream_id <NEW_... | SimulationRequest - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition. | 625941b5b545ff76a8913c23 |
def diffstat_for_changeset(patch_text: str) -> Dict: <NEW_LINE> <INDENT> diffstat = patch.diffstat(patch_text) <NEW_LINE> return { 'changedFiles': diffstat.files_changed, 'additions': diffstat.additions, 'deletions': diffstat.deletions, } | Calculate and return a raw patch's diffstat as JSON. | 625941b5b57a9660fec33682 |
def record(self, numframes=None): <NEW_LINE> <INDENT> if numframes is None: <NEW_LINE> <INDENT> recorded_data = [self._pending_chunk, self._record_chunk()] <NEW_LINE> self._pending_chunk = numpy.zeros([0]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> recorded_frames = len(self._pending_chunk) <NEW_LINE> recorded_data ... | Record a block of audio data.
The data will be returned as a frames × channels float32 numpy array.
This function will wait until numframes frames have been recorded.
If numframes is given, it will return exactly `numframes` frames,
and buffer the rest for later.
If numframes is None, it will return whatever the audi... | 625941b5293b9510aa2c309c |
def is_bool(a): <NEW_LINE> <INDENT> return isinstance(a, BoolRef) | Return `True` if `a` is a Z3 Boolean expression.
>>> p = Bool('p')
>>> is_bool(p)
True
>>> q = Bool('q')
>>> is_bool(And(p, q))
True
>>> x = Real('x')
>>> is_bool(x)
False
>>> is_bool(x == 0)
True | 625941b54f6381625f114849 |
def testComparison_009a(self): <NEW_LINE> <INDENT> quantity1 = 13 <NEW_LINE> quantity2 = ByteQuantity(quantity="12", units=UNIT_BYTES) <NEW_LINE> self.assertNotEqual(quantity1, quantity2) <NEW_LINE> self.assertTrue(not quantity1 == quantity2) <NEW_LINE> self.assertTrue(not quantity1 < quantity2) <NEW_LINE> self.assertT... | Test comparison of byte quantity to integer bytes, integer larger | 625941b51b99ca400220a8b3 |
def __mul__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, Polynomial) or other.n != self.n: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> d = max(len(self.coeff), len(other.coeff)) <NEW_LINE> k = (d * self.n ** 2 + 1).bit_length() <NEW_LINE> k_8 = (k - 1) // 8 + 1 <NEW_LINE> k = k_8 * 8 <NEW_LIN... | Multiplies two polynomials self and other.
Relies on fast integer multiplication in Python implementation.
Args:
other (Polynomial): Multiplier.
Raises:
ValueError: Thrown when other is not Polynomial or is incompatible.
Returns:
Polynomial: self * other. | 625941b5004d5f362079a13a |
def MaxFetch(coins): <NEW_LINE> <INDENT> num_coins = len(coins) <NEW_LINE> ans = [[0 for _ in xrange(num_coins+1)] for _ in xrange(num_coins+1)] <NEW_LINE> sides = [[None for _ in xrange(num_coins+1)] for _ in xrange(num_coins+1)] <NEW_LINE> for i in xrange(num_coins-1, -1, -1): <NEW_LINE> <INDENT> for j in xrange(i+1,... | http://leetcode.com/2011/02/coins-in-line.html | 625941b53346ee7daa2b2b6b |
@pytest.fixture <NEW_LINE> def signed_certificate(known_private_key, known_private_key_2): <NEW_LINE> <INDENT> subject = x509.Name( [ x509.NameAttribute(x509.oid.NameOID.COUNTRY_NAME, "DK"), x509.NameAttribute(x509.oid.NameOID.COMMON_NAME, "example.com"), ] ) <NEW_LINE> issuer = x509.Name( [ x509.NameAttribute(x509.oid... | Return a signed certificate. | 625941b5adb09d7d5db6c596 |
def get_instance(self, payload): <NEW_LINE> <INDENT> return NewFactorInstance( self._version, payload, service_sid=self._solution['service_sid'], identity=self._solution['identity'], ) | Build an instance of NewFactorInstance
:param dict payload: Payload response from the API
:returns: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance
:rtype: twilio.rest.verify.v2.service.entity.new_factor.NewFactorInstance | 625941b53539df3088e2e14d |
def read(self, section, key): <NEW_LINE> <INDENT> f = io.open(self.filename, 'r', encoding='utf16') <NEW_LINE> self.config.read_file(f) <NEW_LINE> f.close() <NEW_LINE> if section in self.config: <NEW_LINE> <INDENT> if key in self.config[section]: <NEW_LINE> <INDENT> return self.config[section][key] <NEW_LINE> <DEDENT> ... | Read value of key in section. Return value or None if failed.
| 625941b567a9b606de4a7cc0 |
def anlaysis_nerve_plotting(track_point): <NEW_LINE> <INDENT> num_true_pts = np.shape(track_point)[0] <NEW_LINE> num_sample_pts = 80 <NEW_LINE> x_sample = track_point[:,0] <NEW_LINE> y_sample = track_point[:,1] <NEW_LINE> z_sample = track_point[:,2] <NEW_LINE> tck, u = interpolate.splprep([x_sample, y_sample, z_sample]... | :param track_point:N X 3, array, [x,y,z]
:return: | 625941b5d164cc6175782b50 |
def bind_to(self, exchange='', routing_key='', arguments=None, nowait=False, **kwargs): <NEW_LINE> <INDENT> if isinstance(exchange, Exchange): <NEW_LINE> <INDENT> exchange = exchange.name <NEW_LINE> <DEDENT> return self.channel.exchange_bind(destination=self.name, source=exchange, routing_key=routing_key, nowait=nowait... | Binds the exchange to another exchange.
Arguments:
nowait (bool): If set the server will not respond, and the call
will not block waiting for a response.
Default is :const:`False`. | 625941b516aa5153ce36227b |
def add_sample(self, model, reference, label=None): <NEW_LINE> <INDENT> m_mean = np.mean(model) <NEW_LINE> r_mean = np.mean(reference) <NEW_LINE> sigma_r = reference.std() <NEW_LINE> sigma_m = model.std() <NEW_LINE> sigma_n = sigma_m // sigma_r <NEW_LINE> R = np.corrcoef(model, reference)[1,0] <NEW_LINE> n_bias = (m_me... | Adds a new point to the diagram.
Args:
- *model*: Numpy array of model data.
- *reference*: Numpy array of reference (observation) data.
- *label* (optional): The label for this sample (default: None). | 625941b544b2445a33931ea3 |
def __init__(self, *args): <NEW_LINE> <INDENT> this = _blocks_swig3.new_float_to_complex_sptr(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this | __init__(boost::shared_ptr<(gr::blocks::float_to_complex)> self) -> float_to_complex_sptr
__init__(boost::shared_ptr<(gr::blocks::float_to_complex)> self, float_to_complex p) -> float_to_complex_sptr | 625941b5ff9c53063f47c001 |
def update_alarm(self, device_id, alarm_id, alarm_time, week_days, recurring=False, enabled=True, label=None, snooze_length=None, snooze_count=None, vibe='DEFAULT'): <NEW_LINE> <INDENT> if not isinstance(week_days, list): <NEW_LINE> <INDENT> raise ValueError("Week days needs to be a list") <NEW_LINE> <DEDENT> for day i... | https://wiki.fitbit.com/display/API/API-Devices-Update-Alarm
alarm_time should be a timezone aware datetime object. | 625941b515fb5d323cde090b |
def metric_rms(ri, ref): <NEW_LINE> <INDENT> rms = np.sum(cutout(ri.real-ref.real)**2) <NEW_LINE> norm = np.sum(cutout(ref.real-1)**2) <NEW_LINE> return np.sqrt(rms/norm) | Root mean square metric (normalized)
This metric was used and described in
Müller et. al, "ODTbrain: a Python library for full-view,
dense diffraction tomography" Bioinformatics 2015 | 625941b524f1403a9260096d |
def post(self, request, nnid): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return_data = AutoMlCommon().update_parm_obj(nnid, request.data) <NEW_LINE> return Response(json.dumps(return_data)) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> return_data = {"status": "404", "result": str(e)} <NEW_LINE> ret... | Manage hyperparameter for GA algorithm like eval, population, survive etc
Structure : AutoML - NetID - NetVer(Auto Generated by GA) - NetBatch (auto generated on every batch)
(1) Define AutoML Graph definition
(2) Select Type of Data
(3) Select Type of Anal algorithm
(4) Select range of hyper parameters
(... | 625941b5462c4b4f79d1d4d3 |
def ogr_to_numpy(ogrobj): <NEW_LINE> <INDENT> jsonobj = eval(ogrobj.ExportToJson()) <NEW_LINE> return np.squeeze(jsonobj['coordinates']) | Backconvert a gdal/ogr geometry to a numpy vertex array.
Using JSON as a vehicle to efficiently deal with numpy arrays.
Parameters
----------
ogrobj : ogr.Geometry
object
Returns
-------
out : :class:`numpy:numpy.ndarray`
a nested ndarray of vertices of shape (num vertices, 2) | 625941b55f7d997b8717489e |
def get_steam_level(self, steamID, format=None): <NEW_LINE> <INDENT> parameters = {'steamid' : steamID} <NEW_LINE> if format is not None: <NEW_LINE> <INDENT> parameters['format'] = format <NEW_LINE> <DEDENT> url = self.create_request_url(self.interface, 'GetSteamLevel', 1, parameters) <NEW_LINE> data = self.retrieve_re... | Returns the Steam Level of a user.
steamID: The users ID
format: Return format. None defaults to json. (json, xml, vdf) | 625941b58a43f66fc4b53e6d |
def reload(self): <NEW_LINE> <INDENT> Base.metadata.create_all(self.__engine) <NEW_LINE> session_factory = sessionmaker(bind=self.__engine, expire_on_commit=False) <NEW_LINE> Session = scoped_session(session_factory) <NEW_LINE> self.__session = Session() | reload stuff | 625941b531939e2706e4cc74 |
def __init__(self, input, n_in, n_nodes): <NEW_LINE> <INDENT> self.input = input <NEW_LINE> W_bound = np.sqrt(6. /(n_in+n_nodes)) <NEW_LINE> W_values = np.asarray(np.random.uniform(high=W_bound, low=-W_bound, size=(n_in, n_nodes)), dtype=theano.config.floatX) <NEW_LINE> self.W = theano.shared(value=W_values, name='W', ... | Initialize a hidden layer
@param input: theano.tensor.dmatrix of shape (batch_size,n_in), represents inputs from previous layer
@param n_in: int, number of inputs to layer
@param n_nodes: int, number of nodes in the layer. Also the size of output | 625941b5090684286d50eae2 |
def wait_for_operation_async(reactor, compute, operation, timeout_steps): <NEW_LINE> <INDENT> poller = _create_poller(operation) <NEW_LINE> eliot_action = start_action( action_type=u"flocker:node:agents:gce:wait_for_operation_async", operation=operation ) <NEW_LINE> with eliot_action.context(): <NEW_LINE> <INDENT> def ... | Fires a deferred once a GCE operation is complete, or timeout passes.
This function will poll the operation until it reaches state 'DONE' or
times out, and then returns the final operation resource dict.
:param reactor: The twisted ``IReactorTime`` provider to use to schedule
delays.
:param compute: The GCE compu... | 625941b52ae34c7f2600cf34 |
def test_requestAvatarIdInvalidKey(self): <NEW_LINE> <INDENT> def _checkKey(ignored): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> self.patch(self.checker, 'checkKey', _checkKey) <NEW_LINE> d = self.checker.requestAvatarId(None); <NEW_LINE> return self.assertFailure(d, UnauthorizedLogin) | If L{SSHPublicKeyDatabase.checkKey} returns False,
C{_cbRequestAvatarId} should raise L{UnauthorizedLogin}. | 625941b5627d3e7fe0d68c51 |
def __init__(self): <NEW_LINE> <INDENT> super(hamiltonian_and_energy_output, self).__init__() <NEW_LINE> self.ham_init = None <NEW_LINE> self.energy_init = None | Initialization of particles output | 625941b5a17c0f6771cbde57 |
def _wrap_client_error(e): <NEW_LINE> <INDENT> error_code = e.response['Error']['Code'] <NEW_LINE> message = e.response['Error']['Message'] <NEW_LINE> if error_code == 'BadRequestException': <NEW_LINE> <INDENT> if "Failed to copy S3 object. Access denied:" in message: <NEW_LINE> <INDENT> match = re.search('bucket=(.+?)... | Wrap botocore ClientError exception into ServerlessRepoClientError.
:param e: botocore exception
:type e: ClientError
:return: S3PermissionsRequired or InvalidS3UriError or general ServerlessRepoClientError | 625941b538b623060ff0abf2 |
def iterpapers(self): <NEW_LINE> <INDENT> with self.input().open() as f: <NEW_LINE> <INDENT> record = self.nextrecord(f) <NEW_LINE> while record is not None: <NEW_LINE> <INDENT> yield record <NEW_LINE> record = self.nextrecord(f) | Return iterator over all paper records. | 625941b52ae34c7f2600cf35 |
def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None, **options): <NEW_LINE> <INDENT> if test_finder is None: <NEW_LINE> <INDENT> test_finder = DocTestFinder() <NEW_LINE> <DEDENT> module = _normalize_module(module) <NEW_LINE> tests = test_finder.find(module, globs=globs, extraglobs=extraglobs) <N... | Convert doctest tests for a module to a unittest test suite.
This converts each documentation string in a module that
contains doctest tests to a unittest test case. If any of the
tests in a doc string fail, then the test case fails. An exception
is raised showing the name of the file containing the test and a
(some... | 625941b5097d151d1a222c5f |
def test_parse_env(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> testpath = "testenv.txt" <NEW_LINE> with open(testpath, "w") as testfile: <NEW_LINE> <INDENT> testfile.write("FOO_VAR=bar=var\nexport FOO_NUM=42\n") <NEW_LINE> <DEDENT> parse_env(testpath) <NEW_LINE> assert get_string("FOO_VAR", "") == "bar=var" <NEW_LI... | ensure that the parse_env function is properly processing env files | 625941b55510c4643540f1fc |
def handle_emoji_extraction( emoji: dict, first_alias: str, path: str, force: bool, real_names: bool ): <NEW_LINE> <INDENT> unicode = ''.join(format(ord(char), 'x') for char in emoji['emoji']) <NEW_LINE> unicode = re.sub(r'fe0[ef]$', '', unicode, re.IGNORECASE) <NEW_LINE> unicode = re.sub(r'^(1f937)(?:200d)(.*)$', r'\1... | Simple function reduce `perform_emojis_extraction` cyclomatic complexity | 625941b5dc8b845886cb5337 |
def itkMeanProjectionImageFilterID3ID3_cast(*args): <NEW_LINE> <INDENT> return _itkMeanProjectionImageFilterPython.itkMeanProjectionImageFilterID3ID3_cast(*args) | itkMeanProjectionImageFilterID3ID3_cast(itkLightObject obj) -> itkMeanProjectionImageFilterID3ID3 | 625941b5a05bb46b383ec630 |
def data(self, QModelIndex, p_int): <NEW_LINE> <INDENT> pass | QStringListModel.data(QModelIndex, int) -> QVariant | 625941b5ec188e330fd5a5ab |
def testAPIChildren(self): <NEW_LINE> <INDENT> self.db.storeItem(1, 2, 0, {"ishort" : "CSE/270", "idesc" : "A computer science lab."}) <NEW_LINE> self.db.storeItem(2, 2, 0, {"ishort" : "CSE 2F", "idesc" : "The second-floor corridor of the Computer Science building."}) <NEW_LINE> self.db.storeItem(3, 0, 1, {"oshort" : "... | Test use of the database backend's API to find children of an object. | 625941b563d6d428bbe442f2 |
def upload_screenshot(self, name, image_data, metadata=None): <NEW_LINE> <INDENT> if not self.build_id: <NEW_LINE> <INDENT> raise PersephoneException('No build is running. Please create a build first.') <NEW_LINE> <DEDENT> screenshot = self.client.post_screenshot( self.project_id, self.build_id, name, image_data, metad... | Uploads a screenshot to the current build.
:param name: A freeform name for the screenshot (e.g. subfolder/image.png).
:param image_data: A bytes object with a PNG screenshot.
:param metadata: An optional freeform dict with JSON serializable values to attach to the
image as metadata. | 625941b55166f23b2e1a4f5c |
def error_handler(self, f): <NEW_LINE> <INDENT> self.handle_error_func = f <NEW_LINE> return f | Decorater | 625941b52c8b7c6e89b355c7 |
def do_GET(self): <NEW_LINE> <INDENT> pass | Ignore GET messages. | 625941b5796e427e537b03c5 |
def environment(sz): <NEW_LINE> <INDENT> sr = 0; sc = 1; su = 2; sg = 3; vg = 4; wt = 5; il = 6 <NEW_LINE> sr_dry = 0; sr_wet = 1; sr_saturated = 2 <NEW_LINE> sc_vs = 0; sc_s = 1; sc_hc = 2; sc_c = 3; sc_s = 4 <NEW_LINE> vg_no = 0; vg_sp = 1; vg_dn = 2 <NEW_LINE> wt_cl = 0; wt_oc = 1; wt_rn = 2 <NEW_LINE> il_lo = 0; il... | Create a simulated environment to match the simulated minefield.
The environment data includes:
sr : soil moisture (%)- dry [0, 10], wet (10, 40], saturated (>40)
sc : soil composition - very sandy, sandy, high-clay, clay, silt
su : soil uniformity - no, yes (uniform)
... | 625941b58e05c05ec3eea174 |
def shufflenetv2b_wd2(**kwargs): <NEW_LINE> <INDENT> return get_shufflenetv2b( width_scale=(12.0 / 29.0), shuffle_group_first=True, model_name="shufflenetv2b_wd2", **kwargs) | ShuffleNetV2(b) 0.5x model from 'ShuffleNet V2: Practical Guidelines for Efficient CNN Architecture Design,'
https://arxiv.org/abs/1807.11164.
Parameters:
----------
pretrained : bool, default False
Whether to load the pretrained weights for model.
root : str, default '~/.chainer/models'
Location for keeping t... | 625941b560cbc95b062c634c |
@register.simple_tag <NEW_LINE> def snippet(snippet_name): <NEW_LINE> <INDENT> return snip(snippet_name) | Looks up a snippet by name and returns it.
Syntax::
{% snippet [snippet_name] %}
Example::
{% snippet frontpage_message %} | 625941b50fa83653e4656dc1 |
def RunInJ(i,Type,X,Y,Z,Range,MeshRange,Iterations,Output = None): <NEW_LINE> <INDENT> EndResult = [None]*(Iterations-1) <NEW_LINE> for j in range(Iterations-1): <NEW_LINE> <INDENT> Result = StartObjectScan(i,j,Type,X,Y,Z,Range,MeshRange) <NEW_LINE> EndResult[j]= Result <NEW_LINE> <DEDENT> Output.append(EndResult) | ######################################################
run onver all columns
###################################################### | 625941b5e1aae11d1e749ab7 |
def make_wcs_positions(row, col, offset, inverse=False): <NEW_LINE> <INDENT> n=row.size <NEW_LINE> dt=[('wcs_row','f8'), ('wcs_col','f8'), ('zrow','f8'), ('zcol','f8')] <NEW_LINE> data=numpy.zeros(row.size, dtype=dt) <NEW_LINE> if inverse: <NEW_LINE> <INDENT> data['zrow'] = row <NEW_LINE> data['zcol'] = col <NEW_LINE> ... | make a structure holding both the original wcs and zero-offset positions.
This is only meant for converting between 1-offset and 0-offset
wcs positions are called 'wcs_row','wcs_col' and zero offset are called
'zrow','zcol'
parameters
----------
row: array
rows in the image, wcs coords if inverse=False
col: array... | 625941b5956e5f7376d70c7f |
def CV_multi_stats(X, y, model) : <NEW_LINE> <INDENT> n = N_TRIALS <NEW_LINE> scores = cross_validation.cross_val_score(estimator=model, X=X, y=y) <NEW_LINE> scores_f1 = cross_validation.cross_val_score(estimator=model, X=X, y=y, scoring='f1') <NEW_LINE> print("Model Accuracy: %0.3f (+- %0.2f)" % (scores.mean(), scores... | http://scikit-learn.org/stable/modules/model_evaluation.html#classification-metrics
This version uses multiclass (or multilabel) compatible metrics.
May be expanded to use the cross_val_score helper function:
http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.cross_val_score.html
http://scikit-l... | 625941b550812a4eaa59c129 |
def read_file(self, f, source=None): <NEW_LINE> <INDENT> super(ExtendedConfigParser, self).read_file(f, source) <NEW_LINE> self.move_defaults() | Like read() but the argument must be a file-like object.
The `f' argument must be iterable, returning one line at a time.
Optional second argument is the `source' specifying the name of the
file being read. If not given, it is taken from f.name. If `f' has no
`name' attribute, `<???>' is used. | 625941b57d43ff24873a2aa7 |
def test_raises_exception_when_accessed(self): <NEW_LINE> <INDENT> qs = QuerySetMock(None, TestException()) <NEW_LINE> self.assertRaises(TestException, lambda x: x[0], qs) | Exceptions can raise on getitem, too. | 625941b54c3428357757c12e |
def __init__(self, n_in, n_out, input, rng, poisson_layer=False, mean_doc_size=1, init_W=None, init_b=None, activation = T.tanh, mirroring=False): <NEW_LINE> <INDENT> self.n_in = n_in <NEW_LINE> self.n_out = n_out <NEW_LINE> self.input = input <NEW_LINE> self.mirroring = mirroring <NEW_LINE> T.pprint(self.input) <NEW_L... | Typical hidden layer of a MLP: units are fully-connected and have
sigmoidal activation function. Weight matrix W is of shape (n_in,n_out)
and the bias vector b is of shape (n_out,).
NOTE : The nonlinearity used here is tanh
Hidden unit activation is given by: tanh(dot(input,W) + b)
:type rng: numpy.random.RandomStat... | 625941b50c0af96317bb7fed |
def read_all_available_shows(self): <NEW_LINE> <INDENT> json_url = ('http://il.srgssr.ch/integrationlayer/1.0/ue/%s/tv/assetGroup/editorialPlayerAlphabetical.json') % BU <NEW_LINE> json_response = json.loads(self.open_url(json_url)) <NEW_LINE> try: <NEW_LINE> <INDENT> show_list = json_response['AssetGroups']['Show'] <N... | Downloads a list of all available RSI shows and returns this list. | 625941b556b00c62f0f14460 |
def set_media(self): <NEW_LINE> <INDENT> media_path = self.files[self.current_file_index] <NEW_LINE> fmt = self.get_fmt(media_path) <NEW_LINE> if fmt.lower() in self.image_fmts: <NEW_LINE> <INDENT> self.media = Image.open(media_path) <NEW_LINE> self.qmedia = ImageQt(self.hologrify(self.media)) <NEW_LINE> <DEDENT> elif ... | Sets the current media based on `self.current_file_index`. | 625941b5f548e778e58cd37f |
def list_hdf_groups(fname): <NEW_LINE> <INDENT> group_type = h5py._hl.group.Group <NEW_LINE> f = h5py.File(fname, 'r') <NEW_LINE> glist = [] <NEW_LINE> for kname in sorted(f.keys()): <NEW_LINE> <INDENT> if type(f[kname]) == group_type: <NEW_LINE> <INDENT> glist += [ kname, ] <NEW_LINE> <DEDENT> <DEDENT> f.close() <NEW_... | Makes a list of hdf groups.
Only the 1st level is implemented, TDB: recursive listing.
USAGE
=====
glist = list_hdf_groups(fname)
INPUT
=====
fname: filename of hdf file
OUTPUT
======
glist: list of group names | 625941b5d164cc6175782b51 |
def _insert_into_or_remove_from_text_archive(self, doc): <NEW_LINE> <INDENT> text_archive_service = get_resource_service('text_archive') <NEW_LINE> if text_archive_service is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if doc.get('state') in ['published', 'corrected']: <NEW_LINE> <INDENT> query = { 'query': { ... | If the state of the article is published, check if it's been killed after publishing. If article has been killed
then return otherwise insert into text_archive.
If the state of the article is killed then delete the article if the article is available in text_archive. | 625941b5d18da76e235322d5 |
def ex_add_servers_to_load_balancer(self, lb_id, server_ips=[]): <NEW_LINE> <INDENT> body = { 'server_ips': server_ips, } <NEW_LINE> response = self.connection.request( action='load_balancers/%s/server_ips' % lb_id, data=body, method='POST' ) <NEW_LINE> return response.object | Adds server's IP address to load balancer
:param lb_id: Load balancer ID
:rtype: ``str``
:param server_ips: Array of server IP IDs
:rtype: ``list`` of ``str``
:return: Instance of load balancer
:rtype: ``dict`` | 625941b54c3428357757c12f |
def stop(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(self.pidfile,'r') as f: <NEW_LINE> <INDENT> pid = int(f.read().strip()) <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> pid = None <NEW_LINE> <DEDENT> if not pid: <NEW_LINE> <INDENT> message = "pidfile {0} does not exist. Daemon not... | Stops daemon. | 625941b5e64d504609d74644 |
def predict_chunk(df, clfs): <NEW_LINE> <INDENT> object_id = df['object_id'].values <NEW_LINE> del df['object_id'] <NEW_LINE> preds = None <NEW_LINE> for clf in clfs: <NEW_LINE> <INDENT> if preds is None: <NEW_LINE> <INDENT> preds = clf.predict_proba(df, num_iteration=clf.best_iteration_) <NEW_LINE> <DEDENT> else: <NEW... | Prediction for chunk | 625941b5656771135c3eb676 |
@app.route('/api/v1/event/<event_id>/version', methods=['GET']) <NEW_LINE> @cross_origin() <NEW_LINE> def get_event_version(event_id): <NEW_LINE> <INDENT> version = Version.query.filter_by(event_id=event_id).order_by(Version.id.desc()).first() <NEW_LINE> if version: <NEW_LINE> <INDENT> return jsonify(version.serialize)... | Returns event's the latest version | 625941b52eb69b55b151c6ae |
def fourieruij_iso(beta,ct_over_cl, theta, phi): <NEW_LINE> <INDENT> gamt = (1-beta**2) <NEW_LINE> gaml = (1-(ct_over_cl*beta)**2) <NEW_LINE> uij = np.zeros((3,3,len(theta),len(phi))) <NEW_LINE> sinph = np.sin(phi) <NEW_LINE> cosph = np.cos(phi) <NEW_LINE> sinth = np.sin(theta) <NEW_LINE> denomL = 1-(ct_over_cl*beta*co... | Compute the dislocation displacement gradient field in the isotropic limit in Fourier space multiplied by iq/b (the radial coordinate over the magnitude of the Burgers vector),
i.e. we only return the dependence on the (discretized) polar angle phi in Fourier space, and hence the result is a 3x3xNthetaxNphi dimensional... | 625941b545492302aab5e0c3 |
def setUp(self): <NEW_LINE> <INDENT> mynote = TextNote() <NEW_LINE> mynote.content = '1st' <NEW_LINE> mynote.is_published = False <NEW_LINE> mynote.save() <NEW_LINE> TextNote.objects.create( content='2nd', is_published=True, ) <NEW_LINE> TextNote.objects.create( content='3rd', is_published=False, ) <NEW_LINE> TextNote.... | create TextNotes objects, publish 2,4,5 | 625941b5091ae35668666d6a |
def parse_apx_xml(self, fs_apx_pn): <NEW_LINE> <INDENT> assert fs_apx_pn <NEW_LINE> l_data_file = QtCore.QFile(fs_apx_pn) <NEW_LINE> assert l_data_file is not None <NEW_LINE> l_data_file.open(QtCore.QIODevice.ReadOnly) <NEW_LINE> if not l_data_file.isOpen(): <NEW_LINE> <INDENT> l_log = logging.getLogger("CApxData::make... | carrega o arquivo de procedimentos de aproximação
@param fs_apx_pn: pathname do arquivo em disco | 625941b5adb09d7d5db6c597 |
def i_set(self, a, b): <NEW_LINE> <INDENT> self.registers[self.eval_reg(a)] = self.eval_num(b) | Set register a to value of <b>. | 625941b55fdd1c0f98dc0035 |
def build_f(self, f, part, t): <NEW_LINE> <INDENT> if not isinstance(part, particles): <NEW_LINE> <INDENT> raise ProblemError('something is wrong during build_f, got %s' % type(part)) <NEW_LINE> <DEDENT> N = self.params.nparts <NEW_LINE> rhs = acceleration(self.params.nparts) <NEW_LINE> for n in range(N): <NEW_LINE> <I... | Helper function to assemble the correct right-hand side out of B and E field
Args:
f (dtype_f): the field values
part (dtype_u): the current particles data
t (float): the current time
Returns:
acceleration: correct RHS of type acceleration | 625941b5cad5886f8bd26de6 |
def field_thick_cover_diffraction_matrix(shape, ks, d = 1., epsv = (1,1,1), epsa = (0,0,0.), d_cover = 0, epsv_cover = (1.,1.,1.), epsa_cover = (0.,0.,0.), mode = "b", betamax = BETAMAX, out = None): <NEW_LINE> <INDENT> ks = np.asarray(ks, dtype = FDTYPE) <NEW_LINE> epsv = np.asarray(epsv, dtype = CDTYPE) <NEW_LINE> e... | Build field diffraction matrix.
| 625941b523849d37ff7b2e96 |
def getListData(request, models): <NEW_LINE> <INDENT> pageNo = request.GET.get('pageNo', '') <NEW_LINE> pageNo = 1 if (pageNo == '') else int(pageNo) <NEW_LINE> sortCol = request.GET.get('sortCol', '') <NEW_LINE> sortCol = '-name' if sortCol != '' and sortCol == request.session.get( 'sortCol', '') else 'name' <NEW_LINE... | pagination for master config | 625941b54d74a7450ccd3fc6 |
def create(self, allow_existing=False): <NEW_LINE> <INDENT> if not allow_existing: <NEW_LINE> <INDENT> if self.exists(): <NEW_LINE> <INDENT> raise google.api_core.exceptions.AlreadyExists(f"Topic {self.path!r} already exists.") <NEW_LINE> <DEDENT> <DEDENT> if not self.exists(): <NEW_LINE> <INDENT> MESSAGES[get_service_... | Register the topic in the global messages dictionary.
:param bool allow_existing: if True, don't raise an error if the topic already exists
:raise google.api_core.exceptions.AlreadyExists: if the topic already exists
:return None: | 625941b50a366e3fb873e61a |
def __idiv__(self, other): <NEW_LINE> <INDENT> if isinstance(other, GPUArray): <NEW_LINE> <INDENT> return self._div(other, self) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if other == 1: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._axpbz(1/other, 0, self) | Divides an array by an array or a scalar::
x /= n | 625941b521bff66bcd684759 |
@P.cluster_runnable <NEW_LINE> def getTimepointIntersections(infiles, n_times, outfile): <NEW_LINE> <INDENT> file_dictionary = {} <NEW_LINE> for infile in infiles: <NEW_LINE> <INDENT> gene_list = [] <NEW_LINE> with IOTools.openFile(infile, "rb") as gene_file: <NEW_LINE> <INDENT> gene_list = gene_file.read().split("\n")... | Take first n timepoints and intersect for each in vitro
activation condition. | 625941b592d797404e303f8e |
def split_patients(path, train=0.7, test=0.15, validate=0.15, use_first=None): <NEW_LINE> <INDENT> assert train + test + validate == 1.0, "Train, Test, and Validate must add to 1.0." <NEW_LINE> result = { 'train': [], 'test': [], 'validate': [], } <NEW_LINE> folder = pathlib.Path(path) <NEW_LINE> patients = [patient fo... | Divide the data into train, test, and validate on the patient level.
This prevents unfair bias from preview into the test/validate sets.
:param use_first: int optional, only use the first use_first number of patients in this path.
:param path: path-like to the directory containing patient directories
:param train: floa... | 625941b5b57a9660fec33683 |
def draw_pattack(self): <NEW_LINE> <INDENT> if self.visible: <NEW_LINE> <INDENT> self.screen.blit(self.image, self.rect) | Draws an attack | 625941b55fdd1c0f98dc0036 |
def _get_maybe_error_index(scores, y_score, median, threshold=1.4): <NEW_LINE> <INDENT> scores = scores.flatten() <NEW_LINE> maybe_error_indices = np.where((y_score > threshold) & (scores < median)) <NEW_LINE> maybe_error_scores = scores[maybe_error_indices] <NEW_LINE> return list(maybe_error_indices[0]), maybe_error_s... | 取疑似错字的位置,通过平均绝对离差(MAD)
:param scores: np.array
:param threshold: 阈值越小,得到疑似错别字越多
:return: | 625941b54d74a7450ccd3fc7 |
def test_collect_subscriber(self): <NEW_LINE> <INDENT> result = collect_subscriber.delay(1) <NEW_LINE> self.assertEqual(result.successful(), True) | Test that the ``collect_subscriber``
task runs with no errors, and returns the correct result. | 625941b521bff66bcd68475a |
def _decode_newlines(s): <NEW_LINE> <INDENT> def repl(m): <NEW_LINE> <INDENT> return LinewiseSerializer._subst[m.group(1)] <NEW_LINE> <DEDENT> return LinewiseSerializer._escape_re.sub(repl, s) | Return s with newlines and backslashes decoded.
This function reverses the encoding of _encode_newlines(). | 625941b510dbd63aa1bd29b4 |
def p_Iterable(self, p): <NEW_LINE> <INDENT> location = self.getLocation(p, 2) <NEW_LINE> identifier = IDLUnresolvedIdentifier( location, "__iterable", allowDoubleUnderscore=True ) <NEW_LINE> if len(p) > 6: <NEW_LINE> <INDENT> keyType = p[3] <NEW_LINE> valueType = p[5] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> keyT... | Iterable : ITERABLE LT TypeWithExtendedAttributes GT SEMICOLON
| ITERABLE LT TypeWithExtendedAttributes COMMA TypeWithExtendedAttributes GT SEMICOLON | 625941b54527f215b584c25f |
def __setattr__(self, name, value): <NEW_LINE> <INDENT> if self._initialized and not hasattr(self, name): <NEW_LINE> <INDENT> raise AttributeError("%s instance has no attribute '%s'" % (self.__class__.__name__, name)) <NEW_LINE> <DEDENT> super(Sonar, self).__setattr__(name, value) | Don't allow setting non-existent attributes on this class
| 625941b5293b9510aa2c309d |
def canonize(self, string, dummy_state): <NEW_LINE> <INDENT> return string | Returns the canonized string (student answer).
To return an error: return False, "Syntax error" | 625941b555399d3f055884b7 |
def comp_model(params, plate): <NEW_LINE> <INDENT> kn = params[0] <NEW_LINE> b = np.asarray(params[1:]) <NEW_LINE> neighbourhood = plate.neighbourhood <NEW_LINE> mask = plate.mask <NEW_LINE> neigh_nos = plate.neigh_nos <NEW_LINE> def growth(amounts, times): <NEW_LINE> <INDENT> np.maximum(0, amounts, out=amounts) <NEW_L... | Return a function for running the competition model.
Args
----
params : list
Model parameters excluding intial amounts.
plate : Plate
A corresponding plate with attributes describing the neighbourhood. | 625941b57b25080760e39260 |
def render_wavedrom_image(sphinx, node): <NEW_LINE> <INDENT> image_format = determine_format(sphinx.builder.supported_image_types) <NEW_LINE> if image_format is None: <NEW_LINE> <INDENT> raise SphinxError("Cannot determine a suitable output format") <NEW_LINE> <DEDENT> bname = "wavedrom-{}".format(uuid4()) <NEW_LINE> o... | Visit the wavedrom node | 625941b545492302aab5e0c4 |
def dataReceived(self, data): <NEW_LINE> <INDENT> self.log.debug("Data received: %s" % data) <NEW_LINE> self.buffer.append(data) <NEW_LINE> for frame in self.buffer: <NEW_LINE> <INDENT> self.log.debug("Processing frame: %s" % frame) <NEW_LINE> self.engine.process_frame(frame) | Twisted calls this method when data is received.
Note: The data may not be not be a complete frame or may be more than
one frame. | 625941b51f5feb6acb0c495a |
def __init__(self): <NEW_LINE> <INDENT> self._vtm_go_epg = VtmGoEpg() | Initialise object | 625941b571ff763f4b549492 |
def setProducer(self, _oProducer): <NEW_LINE> <INDENT> if not isinstance(_oProducer, Producer): <NEW_LINE> <INDENT> raise RuntimeError('Producer is not a subclass of LogWatcher.Producers.Producer') <NEW_LINE> <DEDENT> self.__oProducer = _oProducer | Set the data producer.
@param Producer _oProducer Log data producer | 625941b56fb2d068a760eea6 |
def __init__(self, *args): <NEW_LINE> <INDENT> this = _filter_swig.new_fir_filter_fcc_sptr(*args) <NEW_LINE> try: self.this.append(this) <NEW_LINE> except: self.this = this | __init__(boost::shared_ptr<(gr::filter::fir_filter_fcc)> self) -> fir_filter_fcc_sptr
__init__(boost::shared_ptr<(gr::filter::fir_filter_fcc)> self, fir_filter_fcc p) -> fir_filter_fcc_sptr | 625941b5cb5e8a47e48b78b4 |
def limit(self, *args): <NEW_LINE> <INDENT> return self._new(self.rows, self.cols, lambda i, j: self[i, j].limit(*args)) | Calculate the limit of each element in the matrix.
Examples
========
>>> import sympy
>>> from sympy.abc import x, y
>>> M = sympy.matrices.Matrix([[x, y], [1, 0]])
>>> M.limit(x, 2)
[2, y]
[1, 0]
See Also
========
integrate
diff | 625941b5462c4b4f79d1d4d4 |
def generate_article_info(parsed_result, feed_id): <NEW_LINE> <INDENT> article_info = parsed_result <NEW_LINE> article_info['feed_id'] = feed_id <NEW_LINE> return article_info | :param parsed_result: dict returned from parse_entry()
:param feee_id: feed ID
:return: | 625941b5be8e80087fb20a53 |
def possibilities_calculator(self): <NEW_LINE> <INDENT> output = 0 <NEW_LINE> for house in self.grid.houses: <NEW_LINE> <INDENT> output += house.output <NEW_LINE> <DEDENT> cap_kind = [450, 900, 1800] <NEW_LINE> options = [] <NEW_LINE> max_num = [0, 0, 0] <NEW_LINE> for i in range(len(cap_kind)): <NEW_LINE> <INDENT> max... | A function that calculates the least amount of battery
combinations that are possible, taking into account the capacity | 625941b5f7d966606f6a9e0d |
def addDigits(self, num): <NEW_LINE> <INDENT> if num == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> return num-9*int((num-1)/9) | :type num: int
:rtype: int
https://en.wikipedia.org/wiki/Digital_root | 625941b5796e427e537b03c6 |
def main(): <NEW_LINE> <INDENT> args = [] <NEW_LINE> project, account = bootstrapping.GetActiveProjectAndAccount() <NEW_LINE> pass_credentials = ( properties.VALUES.core.pass_credentials_to_gsutil.GetBool() and not properties.VALUES.auth.disable_credentials.GetBool()) <NEW_LINE> _MaybeAddBotoOption(args, 'GSUtil', 'def... | Launches gsutil. | 625941b5566aa707497f437f |
def set_times(event_list): <NEW_LINE> <INDENT> for event in event_list: <NEW_LINE> <INDENT> event.start = event.event_date_start.strftime('%H:%M') <NEW_LINE> event.end = event.event_date_end.strftime('%H:%M') <NEW_LINE> <DEDENT> return event_list | Formates time | 625941b5d58c6744b4257a65 |
def test_get(self): <NEW_LINE> <INDENT> self.flash['message'] = 'Message' <NEW_LINE> self.storage.set(self.flash, self.request, self.response) <NEW_LINE> self.assertEqual(None, self.storage.get(self.request)) <NEW_LINE> self._transfer_cookies_from_response_to_request() <NEW_LINE> self.assertEqual('Message', self.storag... | CookieStorage: should return the stored object.
| 625941b53c8af77a43ae35a2 |
def consumer_commit_for_times(consumer, partition_to_offset, atomic=False): <NEW_LINE> <INDENT> no_offsets = set() <NEW_LINE> for tp, offset in six.iteritems(partition_to_offset): <NEW_LINE> <INDENT> if offset is None: <NEW_LINE> <INDENT> logging.error( "No offsets found for topic-partition {tp}. Either timestamps not ... | Commits offsets to Kafka using the given KafkaConsumer and offsets, a mapping
of TopicPartition to Unix Epoch milliseconds timestamps.
Arguments:
consumer (KafkaConsumer): an initialized kafka-python consumer.
partitions_to_offset (dict TopicPartition: OffsetAndTimestamp): Map of TopicPartition to OffsetAndTim... | 625941b5b545ff76a8913c24 |
def get_res(self, context, element=None, ui=False) -> "BFResult or None": <NEW_LINE> <INDENT> if DEBUG: print("BFDS: BFObject.get_res:", self.idname) <NEW_LINE> return BFCommon.get_res(self, context, self, ui) | Get full BFResult (children and mine). On error raise BFException. | 625941b5442bda511e8be22b |
def get_user_input(input_value): <NEW_LINE> <INDENT> if input_value: <NEW_LINE> <INDENT> if check_input_validity(input_value): <NEW_LINE> <INDENT> return input_value <NEW_LINE> <DEDENT> <DEDENT> while True: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> current_code = raw_input("Your code (max len 13 char): ") <NEW_LINE>... | Question user for input
:return: | 625941b5d7e4931a7ee9dd20 |
def vote_positive(self): <NEW_LINE> <INDENT> return self.upvotes > self.downvotes | return the weight of all votes, positive if upvotes are more, negative if downvotes are more | 625941b5adb09d7d5db6c598 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.