code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def _check_mode(self,mode,mstr=None): <NEW_LINE> <INDENT> if mstr is None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> mstr = self.mode <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> mstr = "r+" <NEW_LINE> <DEDENT> <DEDENT> if "+" in mstr: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if "-" in m... | Check whether the file may be accessed in the given mode.
'mode' must be one of "r" or "w", and this function returns False
if the file-like object has a 'mode' attribute, and it does not
permit access in that mode. If there is no 'mode' attribute,
it defaults to "r+".
If seek support is not required, use "r-" or "w... | 625941f432920d7e50b287e4 |
def findIndOfLeastDiff(x, x0): <NEW_LINE> <INDENT> if isinstance(x0, list) or isinstance(x0, np.ndarray): <NEW_LINE> <INDENT> return list(map(lambda t0: np.abs(x - t0).argmin(), x0)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.abs(x - x0).argmin() | Find Index of the value that's nearest to x0
Parameters
----------
x : array_like
Array to be inspected
x0 : digit
Target value to be searched for
Returns
-------
index : int or list
index(indices) of value(s) that is (are) nearest to x0 | 625941f4851cf427c661ab17 |
def publisher_update_task(api, topic, pub_uris): <NEW_LINE> <INDENT> is_rosout_topic = 'rosout' in topic <NEW_LINE> start_sec = time.time() <NEW_LINE> msg = "publisherUpdate[%s] -> %s %s" % (topic, api, str(pub_uris)) <NEW_LINE> if not is_rosout_topic: <NEW_LINE> <INDENT> mloginfo(msg) <NEW_LINE> <DEDENT> try: <NEW_LIN... | Contact api.publisherUpdate with specified parameters
@param api: XML-RPC URI of node to contact
@type api: str
@param topic: Topic name to send to node
@type topic: str
@param pub_uris: list of publisher APIs to send to node
@type pub_uris: [str] | 625941f445492302aab5e8d8 |
def predict(image_path, model, topk=1): <NEW_LINE> <INDENT> if(topk == None): <NEW_LINE> <INDENT> topk = 1 <NEW_LINE> <DEDENT> model.to('cpu') <NEW_LINE> image = process_image(image_path) <NEW_LINE> image = image.unsqueeze_(0) <NEW_LINE> model.eval() <NEW_LINE> with torch.no_grad(): <NEW_LINE> <INDENT> output = model.f... | Predict the class (or classes) of an image using a trained deep learning model.
| 625941f463f4b57ef0001715 |
def _create_parse_record_fn(image_size: (int, int)): <NEW_LINE> <INDENT> def parse_record_fn(example: tf.train.Example): <NEW_LINE> <INDENT> features = { "image": tf.FixedLenFeature((), tf.string), "mask": tf.FixedLenFeature((), tf.string), "image_filename": tf.FixedLenFeature((), tf.string), "mask_filename": tf.FixedL... | Create parse_record_fn which is used to parse single example from tf records
Arguments:
image_size: desired size of image and label | 625941f40c0af96317bb87f5 |
def create_polygon(polygon_text): <NEW_LINE> <INDENT> if polygon_text.startswith('POLYGON'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> polygon = wkt.loads(polygon_text) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> raise ValueError('Could not create geometry') <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT>... | Get a shapely Polygon from text
:param polygon: string with a list of floats separated by commas that represents
polygon vertexs or a WKT representing a polygon
:returns: Polygon | 625941f4460517430c394782 |
def _set_hsp_align_len(self): <NEW_LINE> <INDENT> self._hsp.align_length = int(self._value) | Record the length of the alignment (PRIVATE). | 625941f4498bea3a759ba0bc |
def gallery_data(request, app_label, content_type, object_id): <NEW_LINE> <INDENT> if not request.is_ajax(): <NEW_LINE> <INDENT> raise PermissionDenied <NEW_LINE> <DEDENT> image_size = { "width": settings.CONF['image_width'], "height": settings.CONF['image_height'] } <NEW_LINE> small_image_size = { "width": settings.CO... | Returns data of all images attached to the object. | 625941f4a79ad161976cc754 |
def withdraw_report(self, person): <NEW_LINE> <INDENT> self.reporters.remove(person) | Withdraw the report on behalf of the specified person
:param person: the person withdrawing the report | 625941f42eb69b55b151cec7 |
def _id(self): <NEW_LINE> <INDENT> result = '' <NEW_LINE> while self.current_char is not None and (self.current_char.isalnum() or self.current_char == '_'): <NEW_LINE> <INDENT> result += self.current_char <NEW_LINE> self.advance() <NEW_LINE> <DEDENT> token = RESERVED_KEYWORDS.get(result, Token(ID, result)) <NEW_LINE> r... | Handles identifiers and reserved keywords. | 625941f450485f2cf553d3aa |
def getAllSoluteData(self, species): <NEW_LINE> <INDENT> soluteDataList = [] <NEW_LINE> data = self.getSoluteDataFromLibrary(species, self.libraries['solute']) <NEW_LINE> if data is not None: <NEW_LINE> <INDENT> assert len(data) == 3, "soluteData should be a tuple (soluteData, library, entry)" <NEW_LINE> data[0].commen... | Return all possible sets of Abraham solute descriptors for a given
:class:`Species` object `species`. The hits from the library come
first, then the group additivity estimate. This method is useful
for a generic search job. Right now, there should either be 1 or
2 sets of descriptors, depending on whether or not we h... | 625941f47b25080760e39a63 |
def fit(self, train_x, train_y, folds=3): <NEW_LINE> <INDENT> log = logging.getLogger(__name__) <NEW_LINE> log.setLevel(logging.INFO) <NEW_LINE> log.addHandler(custom_logging.TqdmLoggingHandler()) <NEW_LINE> with tqdm( total=(len(model_param_map)), desc="Fitting Models", unit=" Algorithm", ncols=100, ) as progressbar: ... | Trains the optimal classification model
on given dataset by running model algorithm search.
If the argument folds isn't passed, the default
value(3) is used.
Parameters
----------
train_x : numpy.ndarray
The features for training classification model
train_y : numpy.ndarray
The corresponding label for feature... | 625941f48c0ade5d55d3efcf |
def imconcattb(upper, lower): <NEW_LINE> <INDENT> w1, h1 = upper.size <NEW_LINE> w2, h2 = lower.size <NEW_LINE> result = Image.new("RGB", (max(w1, w2), h1 + h2)) <NEW_LINE> result.paste(upper, (0, 0)) <NEW_LINE> result.paste(lower, (0, h1)) <NEW_LINE> return result | Concatenate two images top to bottom. | 625941f466656f66f7cbc7bb |
def insert_row(self, connection: ConnectionSqlite, tracker_id: int, short_name: str, full_name: str, description: str, active: bool, revision_id: int) -> Optional[int]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cursor = connection.native_connection.execute( "INSERT INTO tracker_information\n" " (id,\n" " tracke... | Inserts a new row in the table
:param connection: Database connection
:param tracker_id: ID of the tracker
:param short_name: Tracker short name
:param full_name: Tracker full name
:param description: Tracker description
:param active: State of the tracker (active or inactive)
:param revision_id: Revision ID... | 625941f4a4f1c619b28b0638 |
def test_empty_dict_coerce(): <NEW_LINE> <INDENT> @type_checked <NEW_LINE> def _run_test(thing:{}): <NEW_LINE> <INDENT> assert isinstance(thing, dict) <NEW_LINE> <DEDENT> _run_test([("something", "is_true")]) | Ensure things which can be coerced to dictionaries are. | 625941f4287bf620b61d406e |
def convertQImageToMat(self): <NEW_LINE> <INDENT> incomingImage = self.convertToFormat(QtGui.QImage.Format.Format_RGB32) <NEW_LINE> width = incomingImage.width() <NEW_LINE> height = incomingImage.height() <NEW_LINE> ptr = incomingImage.constBits() <NEW_LINE> arr = np.array(ptr).reshape(height, width, 4) <NEW_LINE> retu... | Converts a QImage into an opencv MAT format | 625941f4a17c0f6771cbe65d |
def basis_corr(frame, algo='SparCC', **kwargs): <NEW_LINE> <INDENT> import SparCC <NEW_LINE> comps = frame.columns <NEW_LINE> cor_med, cov_med, pval = SparCC.main(frame, algo=algo, **kwargs) <NEW_LINE> cor = DF(cor_med, index=comps, columns=comps) <NEW_LINE> if cov_med is None: <NEW_LINE> <INDENT> cov = None <NEW_LINE... | Compute correlations between all columns of a counts frame.
This is a wrapper around pysurvey.analysis.basis_correlations.main
Parameters
----------
counts : array_like
2D array of counts. Columns are components, rows are samples.
method : str {SparCC (default)| clr| pearson| spearman| kendall}
The algori... | 625941f476e4537e8c351c87 |
def _configure_learning_rate(num_samples_per_epoch, global_step, l_r, batch_size): <NEW_LINE> <INDENT> decay_steps = int(num_samples_per_epoch / batch_size * l_r['num_epochs_per_decay']) <NEW_LINE> if l_r['sync_replicas']: <NEW_LINE> <INDENT> decay_steps /= l_r['replicas_to_aggregate'] <NEW_LINE> <DEDENT> if l_r['learn... | Configures the learning rate.
Args:
num_samples_per_epoch: The number of samples in each epoch of training.
global_step: The global_step tensor.
Returns:
A `Tensor` representing the learning rate.
Raises:
ValueError: if | 625941f47cff6e4e81117f94 |
def change_color(ser, button: int, color: Tuple[int, int, int]): <NEW_LINE> <INDENT> button: int = 4 if button > 4 else button <NEW_LINE> qbutton: QPushButton = list(mockbutton.values())[button - 1] <NEW_LINE> qbutton.setStyleSheet(qpushcolor(color)) <NEW_LINE> amock.style().unpolish(amock) <NEW_LINE> amock.style().pol... | change color of selected button
:param ser: opened serial port
:param button: button id
:param color: new color
:return: | 625941f4ac7a0e7691ed46ce |
def generate_and_plot_images(gen, seed, w_avg, truncation_psi=1): <NEW_LINE> <INDENT> fig, ax = plt.subplots(1,3,figsize=(15,15)) <NEW_LINE> for i in range(3): <NEW_LINE> <INDENT> rnd = np.random.RandomState(seed) <NEW_LINE> z = rnd.randn(1, 512).astype('float32') <NEW_LINE> dlatents = gen.mapping_network(z) <NEW_LINE>... | plot images from generator output | 625941f4a8370b7717052eac |
def run_game(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> self._check_events() <NEW_LINE> if self.stats.game_active: <NEW_LINE> <INDENT> self.ship.update() <NEW_LINE> self._update_bullets() <NEW_LINE> self._update_aliens() <NEW_LINE> <DEDENT> self._update_screen() | start main loop for game
| 625941f4435de62698dfe25c |
def changed(self, *args, **kwargs): <NEW_LINE> <INDENT> pass | QDesignerFormWindowInterface.changed [signal] | 625941f456ac1b37e62647d1 |
def test_history(self): <NEW_LINE> <INDENT> myia = self._myia <NEW_LINE> myia.fromshape("", [10,10]) <NEW_LINE> deg = myia.adddegaxes(spectral=True) <NEW_LINE> myia.done() <NEW_LINE> msgs = deg.history() <NEW_LINE> deg.done() <NEW_LINE> self.assertTrue("ia.adddegaxes" in msgs[-2]) <NEW_LINE> self.assertTrue("ia.adddega... | Test history writing | 625941f423e79379d52eeb6a |
def extract_elements(self, x_path: str, human_read=True) -> list: <NEW_LINE> <INDENT> self.driver.get(self.URL) <NEW_LINE> if human_read: <NEW_LINE> <INDENT> elements = [i.text for i in self.driver.find_elements_by_xpath(x_path)] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> elements = self.driver.find_elements_by_xpat... | extract relevant elements based on their xpath,
and get a list of these elements | 625941f43317a56b8693a257 |
def sample_user(email='test@recipeappdev.com', password='testpass'): <NEW_LINE> <INDENT> return get_user_model().objects.create_user(email, password) | Create a sample user | 625941f4b5575c28eb68e615 |
def __init__(self): <NEW_LINE> <INDENT> self.table_header = "APRI,FIB4,GENDER,HBV,ALT,AST" | hosp_inst = HospitalModel(hospital_name)
self.table_data = hosp_inst.create_table_data(hospital_name) | 625941f48da39b475bd6558b |
def _clean_directory(self): <NEW_LINE> <INDENT> os.remove(f"{self.cwd}/{self.project_name}.inp") <NEW_LINE> os.remove(f"{self.cwd}/{self.project_name}.out") | Clean the simulation files out of the directory | 625941f4fbf16365ca6f67e0 |
def scrollContentsBy(self, p_int, p_int_1): <NEW_LINE> <INDENT> pass | scrollContentsBy(self, int, int) | 625941f4d6c5a1020814465f |
def encontrou(self, valor): <NEW_LINE> <INDENT> return self._busca_binaria(valor) | :param valor: valor a ser pesquisado na página
:return: True se o elemento está na página. False caso contrário | 625941f44e4d5625662d49dd |
@auth.route('/_create_profile', methods=['GET', 'POST']) <NEW_LINE> def create_profile(): <NEW_LINE> <INDENT> if g.user is not None or 'token_key' not in session or session['token_key'] not in session: <NEW_LINE> <INDENT> return redirect(url_for('docs.index')) <NEW_LINE> <DEDENT> if request.method == 'POST': <NEW_LINE>... | If this is the user's first login, the create_or_login function
will redirect here so that the user can set up his profile. | 625941f426238365f5f0f485 |
def getParentAddress(self): <NEW_LINE> <INDENT> print('%s call getParentAddress' % self.port) <NEW_LINE> parentInfo = [] <NEW_LINE> parentInfo = self.__stripValue( self.__sendCommand(self.wpan_cmd_prefix + 'getprop -v Thread:Parent')).split(' ') <NEW_LINE> return parentInfo[0] | get Thread device's parent extended address and rloc16 short address
Returns:
The extended address of parent in hex format | 625941f4f7d966606f6aa61a |
def wait_progress(self, silent=False): <NEW_LINE> <INDENT> if self._is_started: <NEW_LINE> <INDENT> jobstate = self._get_job_state() <NEW_LINE> try: <NEW_LINE> <INDENT> while all([jobstate.find(s) < 0 for s in self._end_states]): <NEW_LINE> <INDENT> if any([jobstate.find(s) >= 0 for s in self._wait_states]): <NEW_LINE>... | Interact with workload manager to notify job
progression and states
Parameters
----------
slient : bool (default=False)
Display or not a progression state. | 625941f485dfad0860c3b46c |
def test_check_secure(self): <NEW_LINE> <INDENT> mock_request = Mock() <NEW_LINE> mock_request.secure = True <NEW_LINE> mock_method = Mock(return_value="response") <NEW_LINE> handler = secure()(mock_method) <NEW_LINE> assert "response" == handler(mock_request) | Check if request is secure. | 625941f43d592f4c4ed1d66b |
@handler.add(MessageEvent, message=TextMessage) <NEW_LINE> def handle_message(event): <NEW_LINE> <INDENT> profile = line_bot_api.get_profile(event.source.user_id) <NEW_LINE> name = profile.display_name <NEW_LINE> uid = profile.user_id <NEW_LINE> message = event.message.text <NEW_LINE> if mongodb.get_ready(uid,'users') ... | 當收到使用者訊息的時候 | 625941f4d58c6744b425826c |
def get_long_hu_list(check_date): <NEW_LINE> <INDENT> df = get_billboard_list(stock_list=None, start_date=check_date, end_date=check_date, count=None) <NEW_LINE> security_list = list(set(df['code'])) <NEW_LINE> return security_list | 获取龙虎榜名单
check_date:查询日期 | 625941f463d6d428bbe44b00 |
def setResolution(self, resolution): <NEW_LINE> <INDENT> if not self.proxy: <NEW_LINE> <INDENT> self.proxy = ALProxy("ALFaceDetection") <NEW_LINE> <DEDENT> return self.proxy.setResolution(resolution) | Sets extractor resolution
:param int resolution: New resolution
:returns bool: True if the update succeeded, False if not | 625941f407f4c71912b11a94 |
@app.route('/v1/get_product_nameOLD', methods=["GET"]) <NEW_LINE> def get_product_nameOLD(): <NEW_LINE> <INDENT> logger_header('/get_product_nameOLD') <NEW_LINE> params = {'request_type': UPC_REQUEST_TYPE, 'access_token': UPC_ACCESS_TOKEN, 'upc': request.args.get('upc')} <NEW_LINE> barcode_data = requests.get(SEARCH_UP... | Gets product name from scanned UPC barcode from searchupc.com
Request parameters
upc: product UPC as string
return: product name as json | 625941f4d268445f265b547e |
@scores_blueprint.route('/scores/<exercise_id>', methods=['PUT']) <NEW_LINE> @authenticate <NEW_LINE> def update_scores(resp, exercise_id): <NEW_LINE> <INDENT> post_data = request.get_json() <NEW_LINE> response_object = { 'status': 'fail', 'message': 'Invalid payload.' } <NEW_LINE> if not post_data: <NEW_LINE> <INDENT>... | Update scores | 625941f40a366e3fb873ee2f |
def lzc_clone(name, origin, props=None): <NEW_LINE> <INDENT> if props is None: <NEW_LINE> <INDENT> props = {} <NEW_LINE> <DEDENT> nvlist = nvlist_in(props) <NEW_LINE> ret = _lib.lzc_clone(name, origin, nvlist) <NEW_LINE> errors.lzc_clone_translate_error(ret, name, origin, props) | Clone a ZFS filesystem or a ZFS volume ("zvol") from a given snapshot.
:param bytes name: a name of the dataset to be created.
:param bytes origin: a name of the origin snapshot.
:param props: a `dict` of ZFS dataset property name-value pairs
(empty by default).
:type props: dict of bytes:Any
:raises FilesystemEx... | 625941f4a05bb46b383ece2a |
def generate_train_test_set( input_path, is_supervised=True, training_size=0.8, label_noise_size=0.1, seed=43): <NEW_LINE> <INDENT> np.random.seed(seed) <NEW_LINE> df = pd.read_csv(input_path) <NEW_LINE> df.dropna() <NEW_LINE> df_valid = df[df['label'] == 'VALID'] <NEW_LINE> df_invalid = df[df['label'] == 'INVALID'] <N... | If supervised:
- 'training_size' of valid, resp. invalid records in training set
- 1 - 'training_size' of valid, resp. invalid records in test set
If Unsupervised:
- 'training_size' of valid records are used for training
- 1 - 'training_size' + invalid records are used for testing
- Adjust for valid... | 625941f4711fe17d8254296c |
def test_local_modification(self): <NEW_LINE> <INDENT> self.conf.read.return_value = {"enabled": "1", "hostname": self.NAME} <NEW_LINE> z = self.Z(self.client, "/services/db", self.conf) <NEW_LINE> z.loop(3, timeout=self.TIMEOUT) <NEW_LINE> self.conf.reset_mock() <NEW_LINE> self.conf.read.return_value = {"enabled": "0"... | Check if ZooKeeper is updated after a local modification | 625941f4cdde0d52a9e53648 |
def _find_summary_info(self): <NEW_LINE> <INDENT> summary = {"Sensor type": self.sensors_type} <NEW_LINE> summary["Number of Sensors"] = self.number_of_sensors <NEW_LINE> return summary | Gather scientifically interesting summary information from an instance
of this datatype. | 625941f45f7d997b871750ad |
def _get_next_dataset_version(self, identifier): <NEW_LINE> <INDENT> response = self.client.get("/rest/datasets/%s" % identifier) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_200_OK, response.data) <NEW_LINE> self.assertTrue("next_dataset_version" in response.data, "new dataset should be created") <NEW... | Returns next dataset version for dataset <identifier> | 625941f41b99ca400220b0c3 |
def count(self, x: T) -> int: <NEW_LINE> <INDENT> return self.index_right(x) - self.index(x) | Count the number of x. | 625941f463f4b57ef0001716 |
def get(self, key): <NEW_LINE> <INDENT> cached_content = self.storage.get(key, None) <NEW_LINE> if cached_content is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> age = datetime.now() - cached_content.timestamp <NEW_LINE> if age >= cached_content.max_age: <NEW_LINE> <INDENT> del self.storage[key] <NEW_LINE> <DED... | Return the thing from the cache or None if it expired or doesn't exist.
:param key: The name of the thing to get from the cache.
:type key: str
:return: The thing that was stored in the cache.
:rtype: object | None | 625941f4596a89723608a0c7 |
def __init__(self, host=QUANT_DB['host'], port=QUANT_DB['port'], start_t=None, end_t=None): <NEW_LINE> <INDENT> self.start_t = start_t <NEW_LINE> self.end_t = end_t <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> self.order_cols = None <NEW_LINE> self.rec_cols = np.array(['timestamp', 'trade_price'])... | Args:
start_t: timestamp start time
end_t: timestamp end time | 625941f48a43f66fc4b5466d |
def simple_control_policy(pa): <NEW_LINE> <INDENT> if not pa.final: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> pa.g.add_edges_from([(p, 'virtual') for p in pa.final]) <NEW_LINE> pa_path = nx.shortest_path(pa.g, source=pa.init.keys()[0], target='virtual') <NEW_LINE> assert pa_path[-2] in pa.final <NEW_LINE> pa.... | Computes a control policy which minimizes the total length (makespan)
of the policy. It can be used on product automata obtained from both normal
and infinity specification FSAs. In the infinity automata case, the returned
policy corresponds to a valid relaxation, but it may not in general provide
the best temporal rel... | 625941f4adb09d7d5db6cd9b |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'django_shotgun.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are y... | Run administrative tasks. | 625941f424f1403a92601170 |
def getSite( self, siteName = None, siteType = None, gridSiteName = None, meta = None ): <NEW_LINE> <INDENT> return self.__query( 'get', 'Site', locals() ) | Gets from Site all rows that match the parameters given.
:Parameters:
**siteName** - `[, string, list]`
name of the site
**siteType** - `[, string, list]`
it has to be a valid site type, any of the defaults: `T0` | `T1` | `T2` | `T3`
**gridSiteName** - `[, string, list]`
name of the grid si... | 625941f42ae34c7f2600d73f |
def system(*args,**kw): <NEW_LINE> <INDENT> pass | system(command) -> exit_status
Execute the command (a string) in a subshell. | 625941f450812a4eaa59c92a |
def _define_vehicle_types(self): <NEW_LINE> <INDENT> if self.load_capacity: <NEW_LINE> <INDENT> self._vehicle_types = len(self.load_capacity) <NEW_LINE> <DEDENT> elif self.fixed_cost: <NEW_LINE> <INDENT> self._vehicle_types = len(self.fixed_cost) <NEW_LINE> <DEDENT> elif self.num_vehicles: <NEW_LINE> <INDENT> self._veh... | The number of types of vehicle is the length of load_capacity
or fixed_cost or num_vehicles. | 625941f4796e427e537b0bdb |
def count_cnab_lines_0_1_3_5_9(fields): <NEW_LINE> <INDENT> return sum([1 for field in fields if field.start == 8 and field.end == 8]) | Na listagem abaixo encontram-se o(os) campo(os) em que a função modifica
e a(a)s descrição(ões) deste(es):
Campo: 06.9
Descrição: G056 (ver G003 para ver todos tipos de registro)
Todo o texto da especificação do Santander, sobre a descrição G002, diz:
"Quantidade de Registros do Arquivo
Número obtido pela contagem dos... | 625941f456b00c62f0f14c6d |
def eval(self, df): <NEW_LINE> <INDENT> return self.linker(*[g.eval(df) for g in self.genes]) | Evaluates a given GEP chromosome against some instance.
The terminals in the chromosome are assumed to be attributes on
the object insgeneovided (unless they are numeric constants).
@param df, pandas.DataFrame, dataset given by user
@return: numpy.array, results of evaluating the chromosome | 625941f4097d151d1a223465 |
def _Position_GetIM(self): <NEW_LINE> <INDENT> return _im_Position(*self.Get()) | Returns an immutable representation of the ``wx.Position`` object, based on ``namedtuple``.
This new object is hashable and can be used as a dictionary key,
be added to sets, etc. It can be converted back into a real ``wx.Position``
with a simple statement like this: ``obj = wx.Position(imObj)``. | 625941f494891a1f4081c0bc |
def find_elements(self, control_info, period=10): <NEW_LINE> <INDENT> for i in range(period): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if control_info.startswith(self.XPATH_TAG): <NEW_LINE> <INDENT> element = self._driver.find_elements_by_xpath(control_info) <NEW_LINE> <DEDENT> elif self.ID_TAG in control_info: <NE... | 通过给定的xpath, id 或 name来查找控件
:Args:
-control_info:控件的信息,可以是xpath,id,name或其他属性
:Return:
返回所有满足条件的控件,返回的类型是一个列表.找不到则抛出not_find_element异常
:Usage:
self.find_elements(control_info) | 625941f40383005118ecfbf0 |
def reordena_aleatoriament(self): <NEW_LINE> <INDENT> p = list(range(self.dimensio)) <NEW_LINE> random.shuffle(p) <NEW_LINE> r = [self.components[i] for i in p] <NEW_LINE> return Vector(r) | Retorna un nou vector amb les components reordenades aleatoriament | 625941f48c3a8732951589d2 |
def results(self) -> Iterable[Netifcon]: <NEW_LINE> <INDENT> self.log.info("Generating netifcon results from {0.policy}".format(self)) <NEW_LINE> self._match_name_debug(self.log) <NEW_LINE> self._match_context_debug(self.log) <NEW_LINE> for netif in self.policy.netifcons(): <NEW_LINE> <INDENT> if self.name and not matc... | Generator which yields all matching netifcons. | 625941f47d43ff24873a32b5 |
def define_func(name, args, body): <NEW_LINE> <INDENT> return ast.FunctionDef( name = name, args = args, body = [ast.Return(value = body)], decorator_list = [], returns = None, ) | Construct AST function definition with specified name, args and
body. | 625941f43d592f4c4ed1d66c |
def get_audio_data(self, num_bytes, compensation_time=0.0): <NEW_LINE> <INDENT> return None | Get next packet of audio data.
Args:
num_bytes (int): Maximum number of bytes of data to return.
compensation_time (float): Time in sec to compensate due to a
difference between the master clock and the audio clock.
Returns:
:class:`.AudioData`: Next packet of audio data, or ``None`` if
there ... | 625941f467a9b606de4a84c5 |
def setup_gpio(): <NEW_LINE> <INDENT> GPIO.setmode(GPIO.BCM) <NEW_LINE> GPIO.setwarnings(False) <NEW_LINE> GPIO.setup(LED_1_PIN, GPIO.OUT) <NEW_LINE> GPIO.setup(LED_2_PIN, GPIO.OUT) <NEW_LINE> GPIO.setup(LED_BUTTON_PIN, GPIO.OUT) <NEW_LINE> GPIO.setup(BUTTON_PIN, GPIO.IN, GPIO.PUD_UP) <NEW_LINE> reset_led() | Setup GPIO pins on which LEDs and button switch are connected. | 625941f4ad47b63b2c50a590 |
def map_reports(live_report) -> List[Report]: <NEW_LINE> <INDENT> reports = [] <NEW_LINE> if live_report: <NEW_LINE> <INDENT> for device in live_report.get("body", {}).get("devices", []): <NEW_LINE> <INDENT> device_id = device.get("_id") <NEW_LINE> device_name = device.get("name") <NEW_LINE> for report_json in device.g... | Maps *Reports*. | 625941f41b99ca400220b0c4 |
def query_ids(self, ids): <NEW_LINE> <INDENT> column = getattr(self.dataset, self.context.md_core_model['mappings']['pycsw:Identifier']) <NEW_LINE> query = self.session.query(self.dataset).filter(column.in_(ids)) <NEW_LINE> return self._get_repo_filter(query).all() | Query by list of identifiers | 625941f4046cf37aa974d351 |
def solve(self): <NEW_LINE> <INDENT> raise NotImplementedError | Method in charge of solving the problem. | 625941f482261d6c526abab9 |
def test_selem_disk(self): <NEW_LINE> <INDENT> self.strel_worker("data/disk-matlab-output.npz", selem.disk) | Test disk structuring elements | 625941f460cbc95b062c6b53 |
def iapply(self,f): <NEW_LINE> <INDENT> for key, val in self.iteritems(): <NEW_LINE> <INDENT> self[key] = f(key,val) <NEW_LINE> <DEDENT> return self | Apply function to parameters in place
:param f:
:return: | 625941f455399d3f05588cc8 |
def write_dxf(self, file_name, layer='GEOMETRY'): <NEW_LINE> <INDENT> drawing = dxf.drawing(file_name) <NEW_LINE> self.append_to_dxf(drawing) <NEW_LINE> drawing.save() | Create a DXF.
:param file_name: The name of the DXF file to write.
:param layer: The name of the layer to which to add the geometry. | 625941f4bf627c535bc137df |
def _format_percentile(self, datapoint, column): <NEW_LINE> <INDENT> result = [] <NEW_LINE> median = None <NEW_LINE> if column in datapoint and datapoint[column] is not None: <NEW_LINE> <INDENT> count = len(datapoint[column]) <NEW_LINE> if count > 0 and count % 2: <NEW_LINE> <INDENT> median = float(datapoint[column][co... | Format path length percentile values for smokeping style graphs | 625941f4ec188e330fd5ada1 |
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, Youtube): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict() | Returns true if both objects are not equal | 625941f4b7558d58953c5516 |
def get_spearman_corr(self): <NEW_LINE> <INDENT> return self._get_corr(f=spearmanr) | :returns (list) of [parameter name, Spearman's rank correlation coefficients, p-value] | 625941f43c8af77a43ae3db8 |
def _get_encap_exp_dst_ip(self, ip, port): <NEW_LINE> <INDENT> v4_host_bit_len = 32 - int(iputils.get_mask(self.mape_v4_prefix)) <NEW_LINE> v4_bin = bin(int(ipaddress.IPv4Address(ip))) <NEW_LINE> v4_bin_str = v4_bin[2:].zfill(32) <NEW_LINE> p_bits = str(v4_bin)[len(v4_bin)-v4_host_bit_len : len(v4_bin)] <NEW_LINE> port... | Get the expected ipv6 address based on parsed ipv4 address and port number | 625941f463b5f9789fde76f6 |
def user_type_stats(df): <NEW_LINE> <INDENT> print('\nCalculating User Stats...\n') <NEW_LINE> start_time = time.time() <NEW_LINE> user_type_cnt = df['User Type'].value_counts().to_frame() <NEW_LINE> print("\nThe counts of each user type are:\n" , user_type_cnt) <NEW_LINE> try: <NEW_LINE> <INDENT> gender_cnt = df['Gend... | Displays statistics on bikeshare users.
Args:
df - Pandas DataFrame containing city data
Prints:
user_type_cnt - Counts of each user type
gender_cnt - Counts of each gender
Earliest Birth year
Most common Birth year
Most recent Birth year | 625941f4d486a94d0b98e757 |
def DisplaySourceLinesWithLineNumbersAndColumn(self, *args): <NEW_LINE> <INDENT> return _lldb.SBSourceManager_DisplaySourceLinesWithLineNumbersAndColumn( self, *args) | DisplaySourceLinesWithLineNumbersAndColumn(self, SBFileSpec file, uint32_t line, uint32_t column, uint32_t context_before,
uint32_t context_after,
str current_line_cstr, SBStream s) -> size_t | 625941f471ff763f4b549ca7 |
def test_ten_lists(): <NEW_LINE> <INDENT> assert isinstance(ten_lists(), list) | `ten_lists()` should return a list | 625941f4379a373c97cfb157 |
def flowforme(default_dtype=tf.float32): <NEW_LINE> <INDENT> def flowforme_wrapper(func): <NEW_LINE> <INDENT> (result_node, inputs, graph,) = _build_tf_graph(func, default_dtype) <NEW_LINE> def intermediate(*args, **kwargs): <NEW_LINE> <INDENT> inputs_index = 0 <NEW_LINE> feed_dict = {} <NEW_LINE> for arg in args: <NEW... | Decorator to rewrite the function implementation as a TF graph
Args:
- default_dtype: A tf.DType used to initialize all placeholders
Returns:
- a function/callable. This may be rewritten to use @couchpotato.lazy so
the value is only calculated if it is used. | 625941f4711fe17d8254296d |
@retry <NEW_LINE> def download_json_from_list_of_tuples(result_tuple): <NEW_LINE> <INDENT> caseName, caseNo, caseCourt, JSON_INPUT_OUTPUT_PATH, CLIENT_MATTER, IS_CACHED = result_tuple <NEW_LINE> user = login.Credentials() <NEW_LINE> getdocket_url = "https://www.docketalarm.com/api/v1/getdocket/" <NEW_LINE> data = { 'lo... | This function takes in a tuple with 5 arguments as strings in order:
The case name,
The case number,
The court the case is in,
The output path for the download,
The client matter (The reason for making the call, for billing purposes).
It downloads json data for each case.
This function is not called on its own, it is w... | 625941f47047854f462a1a12 |
def run( self, args: List[str], env_vars: Optional[Dict[str, str]] = None, gcs_target: Optional[Dict[str, str]] = None, gcs_mounts: Optional[Dict[str, str]] = None, wait_for_result: bool = False, ): <NEW_LINE> <INDENT> subscriber = self.gcloud.get_subscriber() <NEW_LINE> publisher = self.gcloud.get_publisher() <NEW_LIN... | Runs a script which is given as a string.
Args:
script (string): A Bash script which will be executed on GCE.
env_vars (dict): Environment variables which can be used by the script.
gcs_target (dict): Files which will be copied to GCS when the script is done.
gcs_mounts (dict): Buckets which will be mo... | 625941f45fdd1c0f98dc0846 |
def get_outputs(self): <NEW_LINE> <INDENT> outputs = dict() <NEW_LINE> scene = capture.parse_active_scene() <NEW_LINE> outputs['sound'] = scene['sound'] <NEW_LINE> outputs['show_ornaments'] = True <NEW_LINE> outputs['camera_options'] = dict() <NEW_LINE> outputs['camera_options']['overscan'] = 1.0 <NEW_LINE> outputs['ca... | Retrieve all settings of each available sub widgets
:return: | 625941f423849d37ff7b369a |
def make_new_entry(): <NEW_LINE> <INDENT> conn = pymysql.connect(host=db_host,user=db_user,passwd=db_pass) <NEW_LINE> conn.autocommit(True) <NEW_LINE> cur = conn.cursor() <NEW_LINE> ''' Get data from tariff device ''' <NEW_LINE> try: <NEW_LINE> <INDENT> answ = electro.get_data_silent(portname) <NEW_LINE> split_answ = e... | Open table | 625941f4ec188e330fd5ada2 |
def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, specificHumidity,maxEvaporation,maxRelativeHumidity,useVirtualTemp): <NEW_LINE> <INDENT> threeDpressure = zeros(threeDtemperature[0].shape, threeDtemperature[0].dtype) <NEW_LINE> for pressureLevel in range(0, threeDpressure.shape[0]): <NEW_L... | Calculate Downdraft Convective Available Potential Energy
@param threeDtemperature
3D array of temperatures
@param threeDdewpoint
3D array of dewpoints
@param pressure
@param potentialTemperature
@param specificHumidity
@param maxEvaporation
maximum amount of liquid water availa... | 625941f4b5575c28eb68e616 |
def topology(self) -> str: <NEW_LINE> <INDENT> return 'PLC' | Return the topoology flag for this generator.
:returns: the topology mmarker ("PLC") | 625941f4cc40096d61595f5e |
def get_obo(force: bool = False) -> Obo: <NEW_LINE> <INDENT> return ComplexPortalGetter(force=force) | Get the ComplexPortal OBO. | 625941f444b2445a339326a2 |
def pre_get(self, data): <NEW_LINE> <INDENT> pass | Override this, will be called before data is sent
to the requester on get item endpoint.
You can use it to mutate the response sent.
Note that any new field added will not be reflected on the OpenApi spec. | 625941f4fb3f5b602dac3caa |
def report_loss(self, loss): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> loss = float(loss) <NEW_LINE> self.data["result"] = loss <NEW_LINE> r = requests.post(server + "report", json=self.data) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> traceback.print_stack() <NEW_LINE> print("Error: reported loss mus... | Adds a loss value to this configuration and returns it to the server.
Args:
loss (float): Loss generated by running a model with this configuration
Todo: There should be something returned from the post request indicate success/failure | 625941f4a8370b7717052ead |
def _ensure_consistency(contrib): <NEW_LINE> <INDENT> entry = contrib.timetable_entry <NEW_LINE> if entry is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if entry.parent_id is None and (contrib.session is not None or contrib.session_block is not None): <NEW_LINE> <INDENT> delete_timetable_entry(entry, log... | Unschedule contribution if not consistent with timetable
A contribution that has no session assigned, may not be scheduled
inside a session. A contribution that has a session assigned may
only be scheduled inside a session block associated with that
session, and that session block must match the session block of
the ... | 625941f445492302aab5e8da |
def set_pump_states(self, states): <NEW_LINE> <INDENT> new_state = {} <NEW_LINE> if 'turbo' in states: <NEW_LINE> <INDENT> reply = self.inst.ask('!C904 {0}'.format(1 if states['turbo'] else 0)) <NEW_LINE> <DEDENT> if 'backing' in states: <NEW_LINE> <INDENT> reply = self.inst.ask('!C910 {0}'.format(1 if states['backing'... | St pump states
| 625941f492d797404e30479d |
def start(self, event): <NEW_LINE> <INDENT> self.send_presence() <NEW_LINE> self.get_roster() <NEW_LINE> self.send_message(mto=self.recipient, mbody=self.msg, mtype='chat') <NEW_LINE> self.disconnect() | Process the session_start event.
Typical actions for the session_start event are
requesting the roster and broadcasting an initial
presence stanza.
Arguments:
event -- An empty dictionary. The session_start
event does not provide any additional
data. | 625941f450812a4eaa59c92b |
def replace_namespaced_replica_set_status_with_http_info(self, name, namespace, body, **kwargs): <NEW_LINE> <INDENT> all_params = ['name', 'namespace', 'body', 'pretty'] <NEW_LINE> all_params.append('async') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LIN... | replace_namespaced_replica_set_status # noqa: E501
replace status of the specified ReplicaSet # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.replace_namespaced_replica_set_status_with_http_info(name, namespace, body,... | 625941f4e5267d203edce2a5 |
def command_mail(self, arg): <NEW_LINE> <INDENT> if not self.__hostname: <NEW_LINE> <INDENT> raise errors.BadSequence('Error: need HELO command') <NEW_LINE> <DEDENT> address = self.__getaddr('FROM:', arg) if arg else None <NEW_LINE> if not address: <NEW_LINE> <INDENT> raise errors.BadArguments('MAIL FROM:<address>') <N... | Handles the ``MAIL`` SMTP command.
- Raises a :class:`~bonzo.errors.BadSequence` when a ``HELO`` command
wasn't previously received.
- Raises a :class:`~bonzo.errors.BadArguments` when the ``from`` address
is not received.
- Raises a :class:`~bonzo.errors.BadSequence` when a ``MAIL`` command
already was received... | 625941f4cc0a2c11143dd4a2 |
def _assign_bucket(self, bucket): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.bucket = ev.ChannelDB.objects.get_channel(bucket) <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> self.caller.msg(ERROR_PRE + "Bucket: %s does not exist." % decorate(bucket)) | sets self.bucket if it exists in the db | 625941f4b57a9660fec33e9d |
def _create_binary_sensor(knx_module: XKNX, config: ConfigType) -> XknxBinarySensor: <NEW_LINE> <INDENT> device_name = config[CONF_NAME] <NEW_LINE> return XknxBinarySensor( knx_module, name=device_name, group_address_state=config[BinarySensorSchema.CONF_STATE_ADDRESS], invert=config.get(BinarySensorSchema.CONF_INVERT),... | Return a KNX binary sensor to be used within XKNX. | 625941f4a79ad161976cc756 |
def apply_0(self, evaluation) -> Integer: <NEW_LINE> <INDENT> from itertools import chain <NEW_LINE> from sys import getsizeof <NEW_LINE> definitions = evaluation.definitions <NEW_LINE> seen = set() <NEW_LINE> default_size = getsizeof(0) <NEW_LINE> handlers = { tuple: iter, list: iter, dict: (lambda d: chain.from_itera... | MemoryInUse[] | 625941f4b57a9660fec33e9e |
def flip_point(point, size, y_flip=False, x_flip=False): <NEW_LINE> <INDENT> H, W = size <NEW_LINE> if isinstance(point, np.ndarray): <NEW_LINE> <INDENT> out_point = point.copy() <NEW_LINE> if y_flip: <NEW_LINE> <INDENT> out_point[:, :, 0] = H - out_point[:, :, 0] <NEW_LINE> <DEDENT> if x_flip: <NEW_LINE> <INDENT> out_... | Modify points according to image flips.
Args:
point (~numpy.ndarray or list of arrays): See the table below.
size (tuple): A tuple of length 2. The height and the width
of the image, which is associated with the points.
y_flip (bool): Modify points according to a vertical flip of
an image.
... | 625941f4656771135c3ebe87 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'DRF_API_VIEW.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are you... | Run administrative tasks. | 625941f4cad5886f8bd275e8 |
def is_valid_user(self, uid, password): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.__bind_user(uid, password) <NEW_LINE> <DEDENT> except LDAPException: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True | Checks if the user is valid
:param uid:
:type uid: String
:param passowrd:
:type password: String
:returns: Boolean | 625941f450485f2cf553d3ad |
def adjust_gev_scpd(device_list): <NEW_LINE> <INDENT> packet_size = device_list[0].remote_port.nodemap.get_node( "GevSCPSPacketSize") <NEW_LINE> if packet_size is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> timestamp_latch = device_list[0].remote_port.nodemap.get_node( "TimestampLatchValue") <NEW_LINE> if time... | Adjust GevSCPD for the devices in the device_list. | 625941f4cad5886f8bd275e9 |
def get(self): <NEW_LINE> <INDENT> del self.response.headers['Content-Type'] <NEW_LINE> user = users.get_current_user() <NEW_LINE> key_id = self.request.get('id') <NEW_LINE> parent_id = self.request.get('parent_id') <NEW_LINE> if parent_id and hasattr(self.model, 'parent_model_name'): <NEW_LINE> <INDENT> if parent_id =... | Return json for a specific or new entity. or search results. | 625941f4d53ae8145f87a874 |
def spline(x, y, drop_duplicates = True, sort = True, denoise_refit = {'denoiser': mad_denoising, 'std_cnt' : 100}): <NEW_LINE> <INDENT> s = Spline() <NEW_LINE> s.fit(x, y, drop_duplicates, sort) <NEW_LINE> if denoise_refit: <NEW_LINE> <INDENT> s.denoise_refit(**denoise_refit) <NEW_LINE> <DEDENT> return s | Fit a scipy-spline to the data.
Arguments:
x : np.array
y : np.array | 625941f4b545ff76a8914426 |
def __init__(self, dim, positive, negative, ub=1): <NEW_LINE> <INDENT> self.__solution_space = dim <NEW_LINE> self.__sample_region = [] <NEW_LINE> self.__label = [] <NEW_LINE> self.__positive_solution = positive <NEW_LINE> self.__negative_solution = negative <NEW_LINE> self.__x_positive = None <NEW_LINE> self.__uncerta... | Initialization
:param dim: a Dimension object
:param positive: positive population
:param negative: negative population
:param ub: uncertain bits, which is a parameter for Racos | 625941f423e79379d52eeb6c |
def s3_upload_signature(): <NEW_LINE> <INDENT> signature = base64.encodestring(hmac.new(os.getenv('AWS_SECRET_KEY_ID'), s3_upload_policy_document(), sha).digest()).strip() <NEW_LINE> return signature | Generate signature based on
http://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html | 625941f41d351010ab85612b |
def handle_proxy_request(self, data): <NEW_LINE> <INDENT> if data.startswith(b'\x04\x01'): <NEW_LINE> <INDENT> port = struct.unpack('!H', data[2:4])[0] <NEW_LINE> addr = socket.inet_ntoa(data[4:8]) <NEW_LINE> userid = data[8:-1] <NEW_LINE> self.handle_connect_request(addr, port, userid) <NEW_LINE> <DEDENT> elif data.st... | In SOCKS4, the first packet in a connection is a request to
either initiate a connection to a remote host and port, or it
is a request to bind a port. This method is responsible for
processing those requests. | 625941f4236d856c2ad44df4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.