code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def check_number(self, number): <NEW_LINE> <INDENT> if number in self.card: <NEW_LINE> <INDENT> self.card.remove(number) <NEW_LINE> print("Its my number!!") <NEW_LINE> if len(self.card) == 0: <NEW_LINE> <INDENT> print("Bingo!!! I have won!") <NEW_LINE> self.card = self.get_card()
Игрок npc проверяет номер для себя
625941c55510c4643540f3e1
def Setup(): <NEW_LINE> <INDENT> if os.path.isdir(download_directory): <NEW_LINE> <INDENT> os.chdir(download_directory) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> os.makedirs(download_directory) <NEW_LINE> os.chdir(download_directory)
should be run before any other functions or statements in Main so that the download envrionment can be setup.
625941c5462c4b4f79d1d6c9
def generator(data_dir, image_paths, steer_angles, batch_size, is_training): <NEW_LINE> <INDENT> images = np.empty([batch_size, height, width, num_channels]) <NEW_LINE> steering = np.empty(batch_size) <NEW_LINE> while True: <NEW_LINE> <INDENT> i = 0 <NEW_LINE> for index in np.random.permutation(image_paths.shape[0]): <...
Generator to process a certain portion of the model at a time :param data_dir: The data directory :param image_paths: The paths to the images :param steer_angles: The steering angles :param batch_size: The batch size :param is_training: Whether this is training data (True) or validation data (False)
625941c55fc7496912cc3977
def perform_create(self, serializer): <NEW_LINE> <INDENT> serializer.save(user=self.request.user)
creates a new tag
625941c5e1aae11d1e749caf
def test_to_string_starts_with_path(self): <NEW_LINE> <INDENT> wrapper = UrlPathWrapper("/foo/bar/baz.html?asd=123#asd123") <NEW_LINE> self.assertTrue(str(wrapper).startswith("/foo/bar/baz.html"))
Tests that to_string returns a string that starts with path. :return: None
625941c523849d37ff7b3089
def move(self, row: int, col: int, player: int) -> int: <NEW_LINE> <INDENT> diff = 1 if player == 1 else -1 <NEW_LINE> self.rows[row] += diff <NEW_LINE> self.columns[col] += diff <NEW_LINE> if row == col: <NEW_LINE> <INDENT> self.diagonals[0] += diff <NEW_LINE> <DEDENT> if row + col == self.n - 1: <NEW_LINE> <INDENT> s...
Player {player} makes a move at ({row}, {col}). @param row The row of the board. @param col The column of the board. @param player The player, can be either 1 or 2. @return The current winning condition, can be either: 0: No one wins. 1: Player 1 wins. 2: Player 2 wins.
625941c5460517430c394182
def _view(self, ddoc, view, use_devmode=False, params=None, unrecognized_ok=False, passthrough=False): <NEW_LINE> <INDENT> if params: <NEW_LINE> <INDENT> if not isinstance(params, str): <NEW_LINE> <INDENT> params = make_options_string( params, unrecognized_ok=unrecognized_ok, passthrough=passthrough) <NEW_LINE> <DEDENT...
.. warning:: This method's API is not stable Execute a view (MapReduce) query :param string ddoc: Name of the design document :param string view: Name of the view function to execute :param params: Extra options to pass to the view engine :type params: string or dict :return: a :class:`~couchbase.result.HttpResult` ...
625941c5d53ae8145f87a26b
def bestPossibleStrategy(data, column= 'Close'): <NEW_LINE> <INDENT> nextDayReturn = data[column].ix[:-1] / data[column].values[1:] - 1 <NEW_LINE> nextDayReturn = nextDayReturn.append(data[column][-1:]) <NEW_LINE> nextDayReturn[-1] = np.nan <NEW_LINE> dailyOrder = -1 * nextDayReturn.apply(np.sign) <NEW_LINE> order = da...
@Summmary: Evaluate the maximum possible return with a given stock looking into the future and with a restriction of +/- 200 shares per transaction with 0, 200 (represented by 1), -200 (represented by -1) being the only allowed positions (hold, buy 200 and sell 200) @param data: Seri...
625941c5a79ad161976cc13e
def testMakeClusterableWorksOnKerasRNNLayer(self): <NEW_LINE> <INDENT> layer = layers.LSTM(10) <NEW_LINE> with self.assertRaises(AttributeError): <NEW_LINE> <INDENT> layer.get_clusterable_weights() <NEW_LINE> <DEDENT> ClusterRegistry.make_clusterable(layer) <NEW_LINE> keras.Sequential([layer]).build(input_shape=(2, 3, ...
make_clusterable() makes a built-in RNN layer clusterable.
625941c521bff66bcd68494d
def test_libsass_compile_all_explicit_entry_point(self): <NEW_LINE> <INDENT> working_dir = mkdtemp(self) <NEW_LINE> with pretty_logging(stream=StringIO()) as stream: <NEW_LINE> <INDENT> spec = compile_all( ['example.usage'], working_dir=working_dir, calmjs_sassy_entry_point_name='extras', ) <NEW_LINE> <DEDENT> export_t...
Execute the toolchain with a spec that might be typically generated.
625941c5596a897236089abb
def read_achievements(self): <NEW_LINE> <INDENT> out = dict() <NEW_LINE> with open(self.achievefile, 'r') as ach: <NEW_LINE> <INDENT> for line in ach: <NEW_LINE> <INDENT> out[line.partition(' : ')[0].lower()] = self._ach_make(*line.split(' : ')) <NEW_LINE> <DEDENT> <DEDENT> return out
Read the achievements saved to the achievements file and put them in a dict of Achievement objects
625941c57d43ff24873a2c98
def all_pairs(catalogue, distance=distances.combined, dist_kwargs=None, parallel=False): <NEW_LINE> <INDENT> dist_kwargs = dist_kwargs or dict() <NEW_LINE> M = numpy.zeros((len(catalogue), len(catalogue)), dtype=numpy.float32) <NEW_LINE> indices = [(i, j) for i in range(len(catalogue)) for j in range(i + 1, len(catalog...
Generate the all-pairs distance matrix for all elements in catalogue distance: any distance function that accepts two words and returns a similarity value between 0 and infinity dist_kwargs: additional kwargs for the distance function parallel: use a Pool from the multiprocessing module for parallel comput...
625941c594891a1f4081baa1
def split_project(im_col): <NEW_LINE> <INDENT> stack = np.copy(im_col) <NEW_LINE> num = len(stack)/2 <NEW_LINE> gfp = stack[:num] <NEW_LINE> rfp = stack[num:] <NEW_LINE> gfp = z_project(gfp) <NEW_LINE> rfp = z_project(rfp) <NEW_LINE> return gfp, rfp
Split stack by channels and z-project each channel Arguments --------- im_col: skimage image collection Returns --------- gfp, rfp: array_like split image collection and z-projected based on maximum value
625941c576e4537e8c35166a
def get( self, resource_group_name, private_cloud_name, script_package_name, script_cmdlet_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map...
Return information about a script cmdlet resource in a specific package on a private cloud. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param private_cloud_name: Name of the private cloud. :type private_cloud_name: str :param script_package_...
625941c57d847024c06be2b3
def set_multi(self, mappings, time=0, compress_level=-1): <NEW_LINE> <INDENT> returns = [] <NEW_LINE> if mappings: <NEW_LINE> <INDENT> for server in self.servers: <NEW_LINE> <INDENT> returns.append(server.set_multi(mappings, time, compress_level=compress_level)) <NEW_LINE> <DEDENT> <DEDENT> return all(returns)
Set multiple keys with it's values on server. :param mappings: A dict with keys/values :type mappings: dict :param time: Time in seconds that your key will expire. :type time: int :param compress_level: How much to compress. 0 = no compression, 1 = fastest, 9 = slowest but best, -1 = default compression level....
625941c5566aa707497f4564
def compile_dfs(self,sample_tag_counts,rent,industry_dict,zone_grandparent): <NEW_LINE> <INDENT> def type_swich(int_x): <NEW_LINE> <INDENT> mapping_dict = { 1:'街道', 2:'市场', 3:'商场' } <NEW_LINE> return mapping_dict.get(int_x) <NEW_LINE> <DEDENT> def clean_market_name(name): <NEW_LINE> <INDENT> if name.find(":") != -1: <N...
组合sample_tag_counts,rent,industry,zone_grandparent三个数据框 用字典先封装,同时完成变量筛选和重命名的工作 :param sample_tag_counts: tag样本的计数表 :param rent: 租金表 :param industry: 行业数据表 :param zone_grandparent: 商圈所在的行政区划表 :return: merge组合结果
625941c5b57a9660fec3387c
@app.route('/count') <NEW_LINE> def get_counts(): <NEW_LINE> <INDENT> conn = get_conn() <NEW_LINE> return str(conn.count())
获取代理个数 :return:
625941c510dbd63aa1bd2b9d
def clear(self): <NEW_LINE> <INDENT> raise NotImplementedError()
Clear the screen.
625941c591f36d47f21ac4ea
def test_share_with_invalid_csrf(self, testapp): <NEW_LINE> <INDENT> url = url_for('public.share', data='INVALID') <NEW_LINE> resp = testapp.post_json(url, '', expect_errors=True) <NEW_LINE> assert resp.status_code == 400
Failing CSRF validation produces an error.
625941c59b70327d1c4e0dcd
@bokeh_app.route('/bokeh/login', methods=['POST']) <NEW_LINE> def login_post(): <NEW_LINE> <INDENT> return bokeh_app.authentication.login_post()
Log in user from a submission. :status 200: if API flag set, log in status :status 302: if API flag not set, redirect to index on success, to login on failue
625941c53539df3088e2e343
def get_minimum_value(dataset, field, where_clause): <NEW_LINE> <INDENT> sCursor = arcpy.SearchCursor(dataset, where_clause, "", "", "%s A" % field) <NEW_LINE> sRow = sCursor.next() <NEW_LINE> del sCursor <NEW_LINE> return sRow.getValue(field)
Return the maximum value based on the where clause :param dataset: :param field: :param where_clause: :return:
625941c53eb6a72ae02ec4d2
def exception(self, exception): <NEW_LINE> <INDENT> if isinstance(exception, IqError): <NEW_LINE> <INDENT> iq = exception.iq <NEW_LINE> log.error('%s: %s', iq['error']['condition'], iq['error']['text']) <NEW_LINE> log.warning('You should catch IqError exceptions') <NEW_LINE> <DEDENT> elif isinstance(exception, IqTimeou...
Process any uncaught exceptions, notably :class:`~sleekxmpp.exceptions.IqError` and :class:`~sleekxmpp.exceptions.IqTimeout` exceptions. :param exception: An unhandled :class:`Exception` object.
625941c5d4950a0f3b08c349
def _updatePositionCb(self, unused_pipeline, position): <NEW_LINE> <INDENT> self.current_position = position <NEW_LINE> if not self.progress or not position: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> length = self.app.project_manager.current_project.timeline.props.duration <NEW_LINE> fraction = float(min(position,...
Unlike other progression indicator callbacks, this one occurs every time the pipeline emits a position changed signal, which is *very* often. This should only be used for a smooth progressbar/percentage, not text.
625941c5956e5f7376d70e67
def calc_length(self): <NEW_LINE> <INDENT> self.length = (len(self.dst) + len(self.src) + len(self.session) + len(self.sequence) + len(self.command) + len(self.data) + len(self.crc))/2
Calculates the length field for the message
625941c5d7e4931a7ee9df16
def deserialize(self, data): <NEW_LINE> <INDENT> if not data: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> data = data.split(',') <NEW_LINE> root = TreeNode(int(data[0])) <NEW_LINE> hash = {0: root} <NEW_LINE> start, end = 0, 0 <NEW_LINE> child = end + 1 <NEW_LINE> while child < len(data): <NEW_LINE> <INDENT> ne...
Decodes your encoded data to tree. :type data: str :rtype: TreeNode
625941c52ae34c7f2600d12b
def find_first_declaration( declarations, type=None, name=None, parent=None, recursive=True, fullname=None): <NEW_LINE> <INDENT> matcher = match_declaration_t(type, name, fullname, parent) <NEW_LINE> if recursive: <NEW_LINE> <INDENT> decls = make_flatten(declarations) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> decls...
returns first declaration that match criteria, defined by developer For more information about arguments see :class:`match_declaration_t` class. :rtype: matched declaration :class:`declaration_t` or None
625941c594891a1f4081baa2
def as_legacy_dict(self): <NEW_LINE> <INDENT> products = [i.as_legacy_dict() for i in self.get_items()] <NEW_LINE> if len(products) > 0: <NEW_LINE> <INDENT> quantity = sum([p['quantity'] for p in products]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> quantity = 0 <NEW_LINE> <DEDENT> sub_total = self.get_sub_total() <...
Return the entire basket content as a dict. structure that can be used for AJAX responses or can be serialised.
625941c5cc0a2c11143dce8a
def setK(self, *args): <NEW_LINE> <INDENT> return _CsoundAC.Score_setK(self, *args)
setK(Score self, size_t priorBegin, size_t begin, size_t end, double base, double range)
625941c56fece00bbac2d736
def layout_variant_parse_join_test(self): <NEW_LINE> <INDENT> specs = ("cz", "cz (qwerty)") <NEW_LINE> for spec in specs: <NEW_LINE> <INDENT> (layout, variant) = keyboard.parse_layout_variant(spec) <NEW_LINE> self.assertEqual(spec, keyboard._join_layout_variant(layout, variant))
Parsing and joining valid layout and variant spec should have no effect.
625941c55e10d32532c5ef20
def test_addevent(telosprofile, eventtracker): <NEW_LINE> <INDENT> account, alias = telosprofile.new_profile() <NEW_LINE> lat = '-791123.1123 LAT' <NEW_LINE> lng = '981234.7545 LONG' <NEW_LINE> geom = json.dumps({'type': 'square'}) <NEW_LINE> conf = json.dumps({'_id': 92}) <NEW_LINE> map_name = eventtracker.add_map(ali...
Create new profile, map, season & target, as well as event information, add that event & check respective tables for correct values
625941c5cb5e8a47e48b7aa5
def __init__(self, avatar_url=None, display_name=None, email=None, fullname=None, id=None, last_activity=None, last_updated=None, member_since=None, username=None): <NEW_LINE> <INDENT> self._avatar_url = None <NEW_LINE> self._display_name = None <NEW_LINE> self._email = None <NEW_LINE> self._fullname = None <NEW_LINE> ...
UserBaseResource - a model defined in Swagger
625941c5dd821e528d63b1a3
def make(self, **attrs): <NEW_LINE> <INDENT> return self._make(commit=True, **attrs)
Creates and persists an instance of the model associated with Mommy instance.
625941c50a366e3fb873e812
def removeReferenceNumbers(inputString): <NEW_LINE> <INDENT> return re.sub(r"[\[].*?[\]]", "", inputString)
Removes reference numbers from the string Parameters ---------- inputString : `String` Input string Returns ------- inputString : `String` Reference number removed string obtained from wikipedia
625941c5f9cc0f698b1405f6
def train(self, X, y): <NEW_LINE> <INDENT> self.X_train = X <NEW_LINE> self.y_train = y <NEW_LINE> print(self.X_train.shape) <NEW_LINE> print(self.y_train.shape)
Train the classifier. For k-nearest neighbors this is just memorizing the training data. Inputs: - X: A numpy array of shape (num_train, D) containing the training data consisting of num_train samples each of dimension D. - y: A numpy array of shape (N,) containing the training labels, where y[i] is the label ...
625941c5f7d966606f6a9ffc
def parse(self, response): <NEW_LINE> <INDENT> l = ItemLoader(item=ScrapyWdzjItem(), response=response) <NEW_LINE> l.add_xpath('platformName', '//div[@class="itemTitle"]/h2/a/text()') <NEW_LINE> l.add_xpath('platformStartDate','//*[@id="showTable"]/ul/li/div[2]/a/div[4]/text()', MapCompose(lambda i: i.replace(' ','')))...
This function parses a property page. @url https://www.wdzj.com/dangan/ @returns items 1 @scrapes platformName platformStartDate @scrapes date
625941c5a79ad161976cc13f
def isPalindrome(self, s): <NEW_LINE> <INDENT> value_to_check = "".join(filter(str.isalnum, str(s).lower())) <NEW_LINE> if value_to_check == "" or len(value_to_check) <= 1: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> pointer_begin = 0 <NEW_LINE> pointer_end = len(value_to_check) - 1 <NEW_LINE> while pointer_beg...
acceptable
625941c5d53ae8145f87a26c
def key_up(self, value, element=None): <NEW_LINE> <INDENT> typing = [] <NEW_LINE> for val in value: <NEW_LINE> <INDENT> if isinstance(val, Keys): <NEW_LINE> <INDENT> typing.append(val) <NEW_LINE> <DEDENT> elif isinstance(val, int): <NEW_LINE> <INDENT> val = str(val) <NEW_LINE> for i in range(len(val)): <NEW_LINE> <INDE...
Releases a modifier key. :Args: - key: The modifier key to send. Values are defined in Keys class. - target: The element to send keys. If None, sends a key to current focused element.
625941c5596a897236089abc
def get_decrypted_str(self) -> str: <NEW_LINE> <INDENT> self.decrypt() <NEW_LINE> decrypted_binary = [cube.message_content for cube in self._cubes] <NEW_LINE> up_pad_binary = "".join(decrypted_binary).rstrip("0")[:-1] <NEW_LINE> return binary_to_string(up_pad_binary)
Decrypt the message and return the original input. :return: The original message that was encrypted as a string.
625941c5a05bb46b383ec81c
def getROIByPointPairs(im, pairs, drawfunc, masked_mat=False): <NEW_LINE> <INDENT> if(np.ndim(im) != 2): <NEW_LINE> <INDENT> raise ValueError("getROIByPointPairs only support 2D image, input im's shape is {}!\n".format(str(im.shape))) <NEW_LINE> <DEDENT> mask = np.zeros(im.shape, np.uint8) <NEW_LINE> thickness = 1 <NEW...
get ROI by point pairs, a pair of points can generate a rectangle or a line
625941c5187af65679ca5118
def _format_message(records, expected_values): <NEW_LINE> <INDENT> all_records_values = records.read(list(expected_values[0].keys()), load=False) <NEW_LINE> msg1 = '\n'.join(pprint.pformat(dic) for dic in all_records_values) <NEW_LINE> msg2 = '\n'.join(pprint.pformat(dic) for dic in expected_values) <NEW_LINE> return '...
Return a formatted representation of records/expected_values.
625941c5167d2b6e31218b90
def mlp_fp_model(n_shared_layers, shared_units, learning_rate, hidden_layers, units, dropout, input_dim): <NEW_LINE> <INDENT> keras.backend.clear_session() <NEW_LINE> shared_layers = {} <NEW_LINE> input1 = keras.layers.Input(shape=(input_dim,), name='input1') <NEW_LINE> input2 = keras.layers.Input(shape=(input_dim,), n...
Model constructor for performing random searches on the ProtR FPs. :param n_shared_layers: Integer. Number of layers with shared weights in the two branches. :param shared_units: Integer. Number of units in the shared layers. :param learning_rate: Float. The learning rate. :param hidden_layers:...
625941c5d7e4931a7ee9df17
def read_simulation_results(self): <NEW_LINE> <INDENT> return self.read_simulation_results_multi([self.base_filename])[0]
Read the results of a BNG simulation as a numpy array Returns ------- numpy.ndarray Simulation results in a 2D matrix (time on Y axis, species/observables/expressions on X axis depending on simulation type)
625941c5236d856c2ad447d2
def log_and_check_build_results(build_res, image_name): <NEW_LINE> <INDENT> get_logger().info(' BUILDING IMAGE '.center(80, '-')) <NEW_LINE> get_logger().info('IMAGE : %s', image_name) <NEW_LINE> success = True <NEW_LINE> try: <NEW_LINE> <INDENT> for chunk in build_res: <NEW_LINE> <INDENT> if not chunk: <NEW_LINE> <...
Log the results of a docker build. Args: build_res: ([basestring, ...]) a generator of build results, as returned by docker.Client.build image_name: (basestring) the name of the image associated with the build results (for logging purposes only) Raises: AppstartAbort: if the build failed.
625941c52eb69b55b151c8a7
def tearDown(self): <NEW_LINE> <INDENT> User.user_list = []
method that does clean up after each test case has run.
625941c58a43f66fc4b54060
def test_encode_decode_field_table_long_keys(self): <NEW_LINE> <INDENT> data = {'A' * 256: 1, ((b'A' * 128) + b'\xf0\x9f\x92\xa9').decode('utf-8'): 2} <NEW_LINE> encoded = encode.field_table(data) <NEW_LINE> decoded = decode.field_table(encoded)[1] <NEW_LINE> self.assertIn('A' * 128, decoded)
Encoding and decoding a field_table with too long keys.
625941c576e4537e8c35166b
def get_sqlalchemy_engine(self, engine_kwargs=None): <NEW_LINE> <INDENT> if engine_kwargs is None: <NEW_LINE> <INDENT> engine_kwargs = {} <NEW_LINE> <DEDENT> return create_engine(self.get_uri(), **engine_kwargs)
Get an sqlalchemy_engine object. :param engine_kwargs: Kwargs used in :func:`~sqlalchemy.create_engine`. :return: the created engine.
625941c50a366e3fb873e813
@admin.route('/admin/stationinfo/', methods=['GET']) <NEW_LINE> def get_all_station(): <NEW_LINE> <INDENT> request_data = request.args <NEW_LINE> errFirst = request_data.get('errFirst') == 'true' <NEW_LINE> try: <NEW_LINE> <INDENT> res = StationInfo().get_all_station() <NEW_LINE> station_off = [] <NEW_LINE> station_err...
获取所有测定站信息 :return:
625941c5e5267d203edcdc99
def log(message, level="DEBUG"): <NEW_LINE> <INDENT> now = datetime.datetime.utcnow() <NEW_LINE> full_message = "{date} - conftest - {level} - {message}".format( date=now.strftime("%Y-%m-%d %H:%M:%S"), level=level, message=message ) <NEW_LINE> print(full_message) <NEW_LINE> with open('robottelo.log', 'a') as log_file: ...
Pytest has a limitation to use logging.logger from conftest.py so we need to emulate the logger by stdouting the output
625941c55fcc89381b1e16b8
def test_view_index_ok(self): <NEW_LINE> <INDENT> self.course.user_partitions = [ UserPartition(0, 'First name', 'First description', [Group(0, 'Group A'), Group(1, 'Group B'), Group(2, 'Group C')]), ] <NEW_LINE> self.save_course() <NEW_LINE> if 'split_test' not in self.course.advanced_modules: <NEW_LINE> <INDENT> self...
Basic check that the groups configuration page responds correctly.
625941c538b623060ff0ade8
def build_weights_from_hifi(): <NEW_LINE> <INDENT> hifi_weights = [] <NEW_LINE> for i in range(0, len(HiFi_ascending)): <NEW_LINE> <INDENT> for j in range(0, HiFi_ascending[i]['num_freqs_to_include']): <NEW_LINE> <INDENT> hifi_weights.append(HiFi_ascending[i]['weight']) <NEW_LINE> <DEDENT> <DEDENT> return hifi_weights
Build the weights for each HiFi frequency :return: a list of weights
625941c5004d5f362079a32e
def on_notification(self, notification): <NEW_LINE> <INDENT> get_logger().info( "Received streaming notification: {}".format(notification)) <NEW_LINE> if notification['type'] == 'mention': <NEW_LINE> <INDENT> mention = Mention.from_notification(notification) <NEW_LINE> get_logger().info("Parsed notification: {}".format...
Handle Mastodon notifications.
625941c507f4c71912b1147b
def to_base(num, base, numerals=NUMERALS): <NEW_LINE> <INDENT> assert int(num) <NEW_LINE> assert int(base) <NEW_LINE> if len(numerals) < base < 1: <NEW_LINE> <INDENT> raise ValueError("str_base: base must be between 1 and %i" % len(numerals)) <NEW_LINE> <DEDENT> if num == 0: <NEW_LINE> <INDENT> return '0' <NEW_LINE> <D...
Convert <num> to <base> using the symbols in <numerals>
625941c5f9cc0f698b1405f7
def __init__(self): <NEW_LINE> <INDENT> self.WaterId = None <NEW_LINE> self.BalanceBeforeRecharge = None <NEW_LINE> self.Money = None <NEW_LINE> self.OperateTime = None
:param WaterId: 流水记录号。 注意:此字段可能返回 null,表示取不到有效值。 :type WaterId: int :param BalanceBeforeRecharge: 充值前的余额,单位0.01元。 注意:此字段可能返回 null,表示取不到有效值。 :type BalanceBeforeRecharge: int :param Money: 充值金额,单位0.01元。 注意:此字段可能返回 null,表示取不到有效值。 :type Money: int :param OperateTime: ...
625941c526068e7796caecd6
def on_discover_subscription(match, state, logger): <NEW_LINE> <INDENT> remote_addr = parse_guid(state, match[0], match[1], match[2]) <NEW_LINE> sub_oid = get_oid(match[3]) <NEW_LINE> logger.process(remote_addr, "", "Discovered new reader %s" % sub_oid)
It happens for discovered readers.
625941c5d8ef3951e3243537
def deposit_btc(self): <NEW_LINE> <INDENT> params = { "nonce": self._nonce, } <NEW_LINE> headers = self._sign_payload(params) <NEW_LINE> api_url = '/deposit_address' <NEW_LINE> r = requests.post(self.URL+api_url, params, headers=headers, verify=True) <NEW_LINE> json_resp = r.json() <NEW_LINE> try: <NEW_LINE> <INDENT> j...
Get btc address. :return:
625941c59f2886367277a888
def draw_graph(graph): <NEW_LINE> <INDENT> not_in_coordinates = lambda x: x not in vertex_coordinates <NEW_LINE> not_coordinates = filter(not_in_coordinates, graph.graph.vertices()) <NEW_LINE> for vertex in not_coordinates: <NEW_LINE> <INDENT> vertex_coordinates[vertex] = get_new_coordinate(vertex) <NEW_LINE> <DEDENT> ...
Using pygame, draws the map on the screen
625941c56fece00bbac2d737
def assertInvalidExpression(self, expn, error=SyntaxError): <NEW_LINE> <INDENT> self.assertRaises(error, calc.evaluate, expn)
Assert that C{expn} causes L{eridanusstd.calc.evaluate} to raise C{error}.
625941c5f548e778e58cd577
def _addr_re(self, m, msg=True): <NEW_LINE> <INDENT> with codecs.open(m, 'r', encoding='utf-8') as fp: <NEW_LINE> <INDENT> mailre = re.compile(r'[\w\.\-]+@[\w\.\-]+') <NEW_LINE> addr = mailre.findall(fp.read()) <NEW_LINE> print(fp.read()) <NEW_LINE> addr = list(addr) <NEW_LINE> addrs = list() <NEW_LINE> for a in addr: ...
Find all the email address in 'mailist.txt' and give warning of wrong email address return a list of addresses
625941c557b8e32f52483494
def Load(self): <NEW_LINE> <INDENT> if self.win is not None: <NEW_LINE> <INDENT> winMax = self.ReadBool(self._keyWinMax) <NEW_LINE> self.win.Maximize(winMax) <NEW_LINE> winSizeX = self.ReadInt(self._keyWinSizeX) <NEW_LINE> winSizeY = self.ReadInt(self._keyWinSizeY) <NEW_LINE> if winSizeX and winSizeY: <NEW_LINE> <INDEN...
Load all panel layouts for the aui manager.
625941c5cdde0d52a9e5302c
def find_domain(uuid): <NEW_LINE> <INDENT> domain = virt.Domain.find_by('uuid', uuid) <NEW_LINE> if domain is None: <NEW_LINE> <INDENT> abort(404) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return domain
Search for a given domain based on the provided UUID.
625941c5851cf427c661a50b
def preview_last_squeezed_event(self, event): <NEW_LINE> <INDENT> if self._PREVIEW_COMMAND and self.expandingbuttons: <NEW_LINE> <INDENT> self.expandingbuttons[-1].preview(event) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.text.bell() <NEW_LINE> <DEDENT> return "break"
Opens a defined application to show squeezed text
625941c5b830903b967e9907
def test_post_model_predict_date_param_missing_hyphen_status_code_equals_400(): <NEW_LINE> <INDENT> response = _post_request_good_json_with_overrides("date_param", "2021-1026") <NEW_LINE> assert response.status_code == HTTPStatus.BAD_REQUEST <NEW_LINE> assert NOT_A_DATE_MSG in response.text
Verify that calling /api/model/predict with bad date_param (missing date hyphen) fails with 400 and flags wrong type.
625941c582261d6c526ab497
@tf_export("sparse.segment_sqrt_n", v1=[]) <NEW_LINE> def sparse_segment_sqrt_n_v2(data, indices, segment_ids, num_segments=None, name=None): <NEW_LINE> <INDENT> return sparse_segment_sqrt_n( data, indices, segment_ids, name=name, num_segments=num_segments)
Computes the sum along sparse segments of a tensor divided by the sqrt(N). Read [the section on segmentation](https://www.tensorflow.org/versions/r2.0/api_docs/python/tf/math#about_segmentation) for an explanation of segments. Like `tf.sparse.segment_mean`, but instead of dividing by the size of the segment, `N`, div...
625941c556b00c62f0f14653
def drawGrid(self): <NEW_LINE> <INDENT> self.grid = self.canvas.create_line(0, 0, self.width, 0, width=0, fill=self.gridColor) <NEW_LINE> self.canvas.delete("cursorLine") <NEW_LINE> self.cursorLine = self.canvas.create_line(0, 0, 0, 0, fill="black", tag="cursorLine")
Draws the grid as long as the canvas is. This is important because the scrollbar has the same length as this line has. The color of the line is the same as the background color from the canvas. :return: nothing
625941c54f88993c3716c063
def maxInfluence(self, P, k): <NEW_LINE> <INDENT> Parameter.checkInt(k, 0, P.shape[0]) <NEW_LINE> numVertices = P.shape[0] <NEW_LINE> bestActivations = numpy.zeros(numVertices) <NEW_LINE> bestTotalActivation = 0 <NEW_LINE> selectedIndices = [] <NEW_LINE> unselectedIndices = set(range(0, numVertices)) <NEW_LINE> stepSiz...
The matrix P is one representing the quality of information reaching each node from certain input nodes. The i,jth entry is the quality of information reaching vertex j from i. Returns the k nodes of maximal influence using a greedy method. Complexity is O(k n)
625941c5507cdc57c6306cd2
def __init__( self, method: Callable[..., Awaitable[hub.ListHubsResponse]], request: hub.ListHubsRequest, response: hub.ListHubsResponse, *, metadata: Sequence[Tuple[str, str]] = () ): <NEW_LINE> <INDENT> self._method = method <NEW_LINE> self._request = hub.ListHubsRequest(request) <NEW_LINE> self._response = response ...
Instantiates the pager. Args: method (Callable): The method that was originally called, and which instantiated this pager. request (google.cloud.networkconnectivity_v1.types.ListHubsRequest): The initial request object. response (google.cloud.networkconnectivity_v1.types.ListHubsResponse): ...
625941c5379a373c97cfab3f
def test_run_cli(self): <NEW_LINE> <INDENT> input = self.f("cli/1a.yaml") <NEW_LINE> schema_file = self.f("cli/1b.yaml") <NEW_LINE> sys.argv = [ 'scripts/pykwalify', '-d', str(input), '-s', str(schema_file), ] <NEW_LINE> cli_args = cli.parse_cli() <NEW_LINE> c = cli.run(cli_args) <NEW_LINE> assert c.validation_errors =...
This should test that running the cli still works as expected
625941c54e696a04525c9446
def forward(self, output1, output2, label): <NEW_LINE> <INDENT> euclidean_distance = F.pairwise_distance(output1, output2) <NEW_LINE> loss_contrastive = torch.mean((1-label) * torch.pow(euclidean_distance, 2) + (label) * torch.pow(torch.clamp(self.margin - euclidean_distance, min=0.0), 2)) <NEW_LINE> return loss_contra...
Args: output1: 图片1(经过网路层的) output2: 图片2(经过网路层的) label: 表示是否为同一个类别,1 表示他们属于不同的类别, 反之为0 Returns: 返回损失
625941c5498bea3a759b9aaa
def run_example(expr): <NEW_LINE> <INDENT> p = PreJsPy.PreJsPy() <NEW_LINE> print(p.parse(expr))
Parses a single expression and prints the result to stdout. :param expr: Expression to parse. :type expr: str
625941c50a50d4780f666e8c
def set_host(self, host): <NEW_LINE> <INDENT> self.host = host
This method sets the redis host attribute, associated with this class instance.
625941c5656771135c3eb867
def stereoplot(nrows=1, ncols=1): <NEW_LINE> <INDENT> num_plots = nrows * ncols <NEW_LINE> if num_plots == 1: <NEW_LINE> <INDENT> fig, ax = plt.subplots() <NEW_LINE> set_stereo(ax) <NEW_LINE> fig.tight_layout() <NEW_LINE> return fig, ax <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if nrows == 1: <NEW_LINE> <INDENT> fi...
Automatically generate a defined number of stereoplots using the matplotlib library Parameters ---------- nrows : positive integer the number of rows of the subplot grid ncols : positive integer the number of columns of the subplot grid Call functions -------------- set_stereo Return ------ TODO
625941c524f1403a92600b62
def merge_sort(arr): <NEW_LINE> <INDENT> if len(arr) < 2: <NEW_LINE> <INDENT> return arr <NEW_LINE> <DEDENT> mid = len(arr) // 2 <NEW_LINE> left_arr = merge_sort(arr[:mid]) <NEW_LINE> right_arr = merge_sort(arr[mid:]) <NEW_LINE> print(left_arr,right_arr) <NEW_LINE> return merge(left_arr,right_arr)
归并排序,时间复杂度O(nlogn),空间复杂度O(n),稳定排序算法 :param arr: :return:
625941c5b545ff76a8913e11
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, AppleAllOf): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
625941c563f4b57ef0001118
def load_data(self, filename): <NEW_LINE> <INDENT> self.history += "HiC.load_data(filename='%s') - " % (filename) <NEW_LINE> if self.rank > 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> filename = os.path.abspath(filename) <NEW_LINE> if not os.path.exists(filename): <NEW_LINE> <INDENT> if not self.silent: <NEW...
Load fend-pair counts and fend object from :class:`HiCData <hifive.hic_data.HiCData>` object. :param filename: Specifies the file name of the :class:`HiCData <hifive.hic_data.HiCData>` object to associate with this analysis. :type filename: str. :returns: None :Attributes: * **datafilename** (*str.*) - A string conta...
625941c5293b9510aa2c3292
def compute_predict_matrix(self, source_lmn_rad, source_pqr_m=None, ant_pqr_m=None): <NEW_LINE> <INDENT> r <NEW_LINE> predict_matrix = make_predict_matrix( self.uvw_m, self.freq_hz, source_lmn_rad, self.min_baseline_lambda, self.max_baseline_lambda) <NEW_LINE> if source_pqr_m is not None: <NEW_LINE> <INDENT> nf_predic...
vis = matrix*source_fluxes
625941c532920d7e50b281c9
def get_player_position(generated_map): <NEW_LINE> <INDENT> logger.debug('Entered get_player_position(generated_map) function') <NEW_LINE> player_position = (None, None) <NEW_LINE> logger.debug('Finding player') <NEW_LINE> for i, row in enumerate(generated_map): <NEW_LINE> <INDENT> for j, column in enumerate(row): <NEW...
Returns player position :return: tuple with player position indeces (row, column) :rtype: tuple
625941c599fddb7c1c9de38c
def test_calc_temperature(): <NEW_LINE> <INDENT> assert calc_temperature(STATE_UNKNOWN) is None <NEW_LINE> assert calc_temperature('test') is None <NEW_LINE> assert calc_temperature('20') == 20 <NEW_LINE> assert calc_temperature('20.12', TEMP_CELSIUS) == 20.12 <NEW_LINE> assert calc_temperature('75.2', TEMP_FAHRENHEIT)...
Test if temperature in Celsius is calculated correctly.
625941c5462c4b4f79d1d6cb
def do_request(self, request): <NEW_LINE> <INDENT> request_xml = etree.fromstring(etree.tostring(request.to_xml())) <NEW_LINE> signature_node = xmlsec.template.create( request_xml, xmlsec.Transform.EXCL_C14N, xmlsec.Transform.RSA_SHA256) <NEW_LINE> ref = xmlsec.template.add_reference( signature_node, xmlsec.Transform.S...
Post an XML message to iDeal, verify the response and check for errors.
625941c52ae34c7f2600d12c
def test_score_play_2(): <NEW_LINE> <INDENT> num_tests = 0 <NEW_LINE> while num_tests < 1000: <NEW_LINE> <INDENT> num_cards = random.randint(1,6) <NEW_LINE> cards = random.sample(range(52), num_cards) <NEW_LINE> if cards_worth(cards) <= 31: <NEW_LINE> <INDENT> assert score_play(cards) == c_score_play(cards) <NEW_LINE> ...
Tess score_play against the C implementation of score_play.
625941c5e1aae11d1e749cb1
def _F_BE(self, l_CE): <NEW_LINE> <INDENT> return ( self.F_max * ( ( l_CE - self.l_opt * (1.0 - self.w) ) / ( self.l_opt * self.w / 2.0 ) )**2 if l_CE <= self.l_opt * (1.0 - self.w) else 0.0 )
This function computes the Force in the muscle belly. Force prevents the muscle from collapsing on itself. Parameters ---------- l_CE: float Muscle contractile element length.
625941c5099cdd3c635f0c56
def get_clients_state(self) -> Iterator[List[str]]: <NEW_LINE> <INDENT> for session_id in self._clients: <NEW_LINE> <INDENT> alias = self._clients[session_id][0] <NEW_LINE> color = self._clients[session_id][1] <NEW_LINE> yield [alias, color]
(Generator) Yield an iterator with a list in the format [alias, color]
625941c5fff4ab517eb2f436
def autocompleteCode(code, parent = sys.modules['__main__']): <NEW_LINE> <INDENT> all_lines = code.split('\n') <NEW_LINE> line = all_lines[-1] <NEW_LINE> context = get_context(line) <NEW_LINE> word = '.'.join(context) <NEW_LINE> completions = None <NEW_LINE> if line.startswith('from ') or line.startswith('import '): <N...
try to find useful completions for code
625941c5377c676e912721a4
def set_Message(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Message', value)
Set the value of the Message input for this Choreo. ((required, string) The message to post to the shoutbox.)
625941c594891a1f4081baa3
@cache <NEW_LINE> def all_task_statuses_for_project(project, client=default): <NEW_LINE> <INDENT> project = normalize_model_parameter(project) <NEW_LINE> task_statuses = raw.fetch_all( "projects/%s/settings/task-status" % project["id"], client=client ) <NEW_LINE> return sort_by_name(task_statuses)
Returns: list: Task status stored in database.
625941c55f7d997b87174a91
def normalize_product_ndc(product_ndc): <NEW_LINE> <INDENT> if any(i.isdigit() for i in product_ndc): <NEW_LINE> <INDENT> product_ndc = re.sub("[^\d-]", "", product_ndc.strip()) <NEW_LINE> if len(product_ndc) > 9: <NEW_LINE> <INDENT> product_ndc = product_ndc[:9] <NEW_LINE> <DEDENT> <DEDENT> return product_ndc
Simple ndc normalization: strip letters, whitespace, and trim 10 digit ndcs.
625941c57d43ff24873a2c9b
def set_property(self, subject, key, value, type=''): <NEW_LINE> <INDENT> subject = _uuid_parse(subject) <NEW_LINE> if isinstance(value, str): <NEW_LINE> <INDENT> value = value.encode() <NEW_LINE> <DEDENT> if isinstance(type, str): <NEW_LINE> <INDENT> type = type.encode() <NEW_LINE> <DEDENT> if _lib.jack_set_property( ...
Set a metadata property on *subject*. Parameters ---------- subject : int or str The subject (UUID) to set the property on. UUIDs can be obtained with `Client.uuid`, `Port.uuid` and `Client.get_uuid_for_client_name()`. key : str The key (URI) of the property. Some predefined keys are available as ...
625941c5c432627299f04c40
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(BufferMixin, self).__init__(*args, **kwargs) <NEW_LINE> self._buffered_values = None <NEW_LINE> self._reset_buffered_values()
initializes base data loader
625941c57c178a314d6ef458
def bad_factorial(n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return (bad_factorial(n+1)) / (n + 1)
Bad factorial function (pg. 24). Args: n (int): non-negative integer. Returns: int: n! (but should actually give "RecursionError: maximum recursion depth exceeded in comparison", a stack overflow error).
625941c510dbd63aa1bd2b9f
def __deploy_bee_orchestrator(self, temp_file): <NEW_LINE> <INDENT> temp_file.write(bytes("\n# Launch BEE\n", self._encode)) <NEW_LINE> in_flag = "" <NEW_LINE> if self._input_mng.yml_file_name is not None: <NEW_LINE> <INDENT> in_flag = "--input {} ".format(self._input_mng.yml_file_name) <NEW_LINE> <DEDENT> bee_deploy =...
Scripting to launch bee_orchestrator, add to file :param temp_file: Target sbatch file (named temp file)
625941c5cad5886f8bd26fd5
def BottleneckBlock(inputs, filters, strides=1, downsample=False, name=None): <NEW_LINE> <INDENT> identity = inputs <NEW_LINE> if downsample: <NEW_LINE> <INDENT> identity = Conv2D( filters=filters, kernel_size=1, strides=strides, padding='same', kernel_initializer='he_normal')(inputs) <NEW_LINE> <DEDENT> x = BatchNorma...
"Our final design makes extensive use of residual modules. Filters greater than 3x3 are never used, and the bottlenecking restricts the total number of parameters at each layer curtailing total memory usage. The module used in our network is shown in Figure 4." [1] Ethan: can't tell what's the exact structure, so we ne...
625941c50383005118ecf5df
def has_birthed(self): <NEW_LINE> <INDENT> self.energy = self.energy - (self.energy / 2)
decreases the creatures energy by 1/4th the original amount :return: null
625941c5bde94217f3682ded
def testHDU1DefaultNames(self): <NEW_LINE> <INDENT> task = ReadFitsCatalogTask() <NEW_LINE> table = task.run(FitsPath) <NEW_LINE> self.assertTrue(np.array_equal(self.arr1, table)) <NEW_LINE> self.assertEqual(len(table), 2)
Test the data in HDU 1, loading all columns without renaming
625941c53d592f4c4ed1d06c
def test_is_on(self): <NEW_LINE> <INDENT> entity_id = device_tracker.ENTITY_ID_FORMAT.format('test') <NEW_LINE> self.hass.states.set(entity_id, STATE_HOME) <NEW_LINE> self.assertTrue(device_tracker.is_on(self.hass, entity_id)) <NEW_LINE> self.hass.states.set(entity_id, STATE_NOT_HOME) <NEW_LINE> self.assertFalse(device...
Test is_on method.
625941c566656f66f7cbc1a5
def get_config_callback(self): <NEW_LINE> <INDENT> return self._config_callback
Retrieve the config_callback
625941c550812a4eaa59c31e
def turn_right(self): <NEW_LINE> <INDENT> temp = self.direction[0] <NEW_LINE> self.direction[0] = -self.direction[1] <NEW_LINE> self.direction[1] = temp
Fa girare il serpente alla propria destra rispetto alla direzione attuale Se direzione attuale = [x,y], ``turn_right()`` ritorna [-y,x] **Esempio:** Se [0,1] (giu') e' la direzione attuale, [-1,0] (destra) e' la nuova direzione
625941c5091ae35668666f5b
def update(self, qOdom, qGlb, qLoc): <NEW_LINE> <INDENT> if self.t >= np.inf: <NEW_LINE> <INDENT> self.t = 0 <NEW_LINE> self.init(qOdom, qGlb, qLoc, uniform=True) <NEW_LINE> <DEDENT> self._update_motion(qOdom) <NEW_LINE> self._update_meas(qGlb, qLoc) <NEW_LINE> self.t += 1 <NEW_LINE> return None
Applies full motion and meas. update to belief.
625941c5c4546d3d9de72a2e
def supports_activity_objective_bank(self): <NEW_LINE> <INDENT> return
Tests if an activity to objective bank lookup session is available. :return: ``true`` if activity objective bank lookup session is supported, ``false`` otherwise :rtype: ``boolean`` *compliance: mandatory -- This method must be implemented.*
625941c50fa83653e4656fb7
def test(): <NEW_LINE> <INDENT> testing=LinkedHashTable(5) <NEW_LINE> testing.add("sri") <NEW_LINE> testing.add("pearl") <NEW_LINE> testing.add("mayank") <NEW_LINE> testing.add("anusha") <NEW_LINE> testing.add("payal") <NEW_LINE> testing.add("brain") <NEW_LINE> testing.add("cathy") <NEW_LINE> testing.add("emily") <NEW_...
For internal Testing of the Linked Hash table :return:
625941c53539df3088e2e346
def p_if(subexpressions): <NEW_LINE> <INDENT> pass
if : IF '(' varExpresion ')' bloque else
625941c5dc8b845886cb552f
def register_server_callbacks(self): <NEW_LINE> <INDENT> raise NotImplementedError
register_server_callbacks(self) -> None Register callbacks necessary to handle the server side.
625941c5796e427e537b05c0