code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def game_over(self): <NEW_LINE> <INDENT> self.canvas.ax.set_title('Game Over') <NEW_LINE> self.canvas.timer.single_shot = True <NEW_LINE> self.canvas.timer.stop() | Game Over | 625941df7b180e01f3dc4b5e |
def encrypt_pubkey(self, recipients: List[x509.Certificate]): <NEW_LINE> <INDENT> self.output_version = (2, 0) <NEW_LINE> sh = PubKeySecurityHandler.build_from_certs(recipients) <NEW_LINE> self._assign_security_handler(sh) | Mark this document to be encrypted with PDF 2.0 public key encryption.
The certificates passed in should be RSA certificates.
PyHanko defaults to AES-256 to encrypt the actual file contents.
The seed used to derive the file encryption key is also encrypted
using AES-256 and bundled in a CMS EnvelopedData object.
The e... | 625941df16aa5153ce3627df |
def get_univariate_feature_scores(x, y, score_func=F_CLASSIFICATION): <NEW_LINE> <INDENT> x, uncs = _prepare_experiments(x) <NEW_LINE> pvalues = score_func(x, y)[1] <NEW_LINE> pvalues = np.asarray(pvalues) <NEW_LINE> pvalues = zip(uncs, pvalues) <NEW_LINE> pvalues = list(pvalues) <NEW_LINE> pvalues.sort(key=itemgetter(... | calculate feature scores using univariate statistical tests. In case of
categorical data, chi square or the Anova F value is used. In case of
continuous data the Anova F value is used.
Parameters
----------
x : structured array
y : 1D nd.array
score_func : {F_CLASSIFICATION, F_REGRESSION, CHI2}
the score f... | 625941df293b9510aa2c35f9 |
def get_list_points(self) -> List[int]: <NEW_LINE> <INDENT> return (self.get_question_points(question) for question in Question.objects.filter(competition=self.competition)) | Returns a list with all the points got from
Questions. | 625941df5fdd1c0f98dc059b |
def refresh(self): <NEW_LINE> <INDENT> self.__timeout.revive() | Resets the instance dying timer. | 625941df7d43ff24873a3009 |
def test_set_quota(self): <NEW_LINE> <INDENT> default_quota = {'default':1,'ram':1, 'virtual_cpus':None, 'disk':3} <NEW_LINE> user_quota = {'default':0, 'ram':4, 'virtual_cpus':5, 'disk':None} <NEW_LINE> user_quota2 = {'default':0, 'ram':7, 'virtual_cpus':8, 'disk':9} <NEW_LINE> cluster = Cluster(hostname='foo.fake.hos... | Tests cluster.set_quota()
Verifies:
* passing values with no quota, creates a new quota object
* passing values with an existing quota, updates it.
* passing a None with an existing quota deletes it
* passing a None with no quota, does nothing | 625941dfd58c6744b4257fc5 |
def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None | ArrayPositions - a model defined in Swagger | 625941df9f2886367277abf2 |
def runums(self, n, d1, d2, d5): <NEW_LINE> <INDENT> if 10 < n < 15: <NEW_LINE> <INDENT> return d5 <NEW_LINE> <DEDENT> n = n % 10 <NEW_LINE> if n == 1: <NEW_LINE> <INDENT> return d1 <NEW_LINE> <DEDENT> elif 1 < n < 5: <NEW_LINE> <INDENT> return d2 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return d5 | Return russian numeral according to given number and
basic numerals. | 625941df7b25080760e397be |
def test_adjust_gamma_one(self): <NEW_LINE> <INDENT> with self.cached_session(): <NEW_LINE> <INDENT> x_data = np.random.uniform(0, 255, (8, 8)) <NEW_LINE> x_np = np.array(x_data, dtype=np.float32) <NEW_LINE> x = constant_op.constant(x_np, shape=x_np.shape) <NEW_LINE> y = image_ops.adjust_gamma(x, gamma=1) <NEW_LINE> y_... | Same image should be returned for gamma equal to one | 625941dfbd1bec0571d90995 |
def get_category_list(self): <NEW_LINE> <INDENT> return self.__cat_line_widget.get_tag_list() | returns a string list with the user-selected categories | 625941dfd6c5a102081443b4 |
def getSignalStockMonthlyQuantByDate(self, stock_code, start_date, end_date): <NEW_LINE> <INDENT> df = funcRetry(self.pro.monthly, self.retry, self.intv, ts_code=stock_code, start_date=start_date, end_date=end_date, fields='ts_code,trade_date,open,high,low,close,pre_close,change,pct_chg,vol,amount') <NEW_LINE> return d... | 通过股票代码获取指定时间段的原始月行情
:param stock_code: 股票代码, 例如: 000001.SZ
:param start_date: 开始日期, 格式: 20200101
:param end_date: 结束日期, 格式: 20200101
:return: 原始月行情df | 625941df44b2445a339323fb |
def __init__(self, config_path): <NEW_LINE> <INDENT> self.log = log <NEW_LINE> self.config_path = config_path <NEW_LINE> self.reload_config() | Initialize the server with the configuration
in the specified file | 625941df8a43f66fc4b543c8 |
def get_text_from_td(td): <NEW_LINE> <INDENT> if "<" not in td: <NEW_LINE> <INDENT> ret = td <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ret = BeautifulSoup(td, "html.parser").text <NEW_LINE> <DEDENT> if len(ret): <NEW_LINE> <INDENT> return "0" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return ret | If we have html in the td then extract the text portion | 625941df3539df3088e2e6b1 |
def hide_metaelems(unselected=False): <NEW_LINE> <INDENT> pass | Hide (un)selected metaelement(s)
Arguments:
@unselected (bool): Hide unselected rather than selected
(optional) | 625941df3c8af77a43ae3b0a |
def logout(self): <NEW_LINE> <INDENT> self.response.headers.add_header('Set-Cookie', 'user_id=; Path=/') | Removes the login info from cookie when logged out | 625941df0fa83653e4657320 |
def __init__(self, rights_type=None, text=None, extension_elements=None, extension_attributes=None): <NEW_LINE> <INDENT> self.type = rights_type <NEW_LINE> self.text = text <NEW_LINE> self.extension_elements = extension_elements or [] <NEW_LINE> self.extension_attributes = extension_attributes or {} | Constructor for Rights
Args:
rights_type: string
text: str The text data in the this element
extension_elements: list A list of ExtensionElement instances
extension_attributes: dict A dictionary of attribute value string pairs | 625941df090684286d50f051 |
@dotfile.command() <NEW_LINE> @click.argument('path', metavar='PATH') <NEW_LINE> @click.option('--perm', 'permission', help='Linux permission represented in octal number (e.g. 755) ' 'Defaults to 755 if not specified') <NEW_LINE> @click.option('-f', '--file', 'dotfile_path', help='Path to dotfile to upload. ' 'If not s... | Store dotfile to Backend.AI Manager.
Dotfiles will be automatically loaded when creating kernels.
PATH: Where dotfiles will be created when starting kernel | 625941df0383005118ecf948 |
def test_run_ls(self): <NEW_LINE> <INDENT> rtn = self.run_cmd("client execute ls") <NEW_LINE> assert(rtn.return_code == 0) | Run ls command | 625941df7047854f462a176d |
def __init__(self, pieces_list, exit_pos, board_width=-1, board_height=-1): <NEW_LINE> <INDENT> if board_width == -1: <NEW_LINE> <INDENT> board_width = max(coord[1] for piece in pieces_list for coord in piece.coordinates)+1 <NEW_LINE> <DEDENT> if board_height == -1: <NEW_LINE> <INDENT> board_height = max(coord[0] for p... | Initialise the board using width, height and a list of Pieces:
[Piece([(0,1),(0,2),(0,3)]), Piece([(1,0),(1,1)], is_privileged=True)]
If width and height are absent, uses instead the smallest x and y coordinates possible from the
board coordinates.
exit_pos is a y-coordinate, distance from top of board: see the definit... | 625941dfa79ad161976cc4ad |
def encrypt_file(self, file, recipients, sign=None, always_trust=False, passphrase=None, armor=True, output=None, symmetric=False, hidden_recipient=False): <NEW_LINE> <INDENT> args = ['--encrypt'] <NEW_LINE> if symmetric: <NEW_LINE> <INDENT> args = ['--symmetric'] <NEW_LINE> if symmetric is not True: <NEW_LINE> <INDENT... | Encrypt the message read from the file-like object 'file' | 625941df3eb6a72ae02ec84d |
def random_walk(adj_matrix, steps=1000, biased=False, alpha=1.0): <NEW_LINE> <INDENT> visited_vertices = [] <NEW_LINE> if biased: <NEW_LINE> <INDENT> transition_matrix = create_transition_matrix(adj_matrix, True, alpha) <NEW_LINE> initial_vertex_distribution = find_initial_vertex_dist(adj_matrix, True, alpha) <NEW_LINE... | Performs either biased or non biased random walks on graphs encoded in an
adjacency matrix, returning a list of visited vertices
:param adj_matrix: Horizontal visibility graph encoded in matrix format
:param steps: Number of y coordinates to be produced
:param biased: Decides whether walk is biased or not
:param a... | 625941dfab23a570cc2504ec |
def self_or_admin_required(public_id: str): <NEW_LINE> <INDENT> def decorator(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> data, status = Auth.get_logged_in_user(request) <NEW_LINE> token = data.get('data') <NEW_LINE> if not token: <NEW_LINE> <INDENT> return data, statu... | only self or admin could visit | 625941df0c0af96317bb854f |
def subtest_10(ctx): <NEW_LINE> <INDENT> d = ctx.non_empty_dir() + "/pop" + ctx.termslash() <NEW_LINE> f = ctx.non_empty_dir() + "/a" + ctx.termslash() <NEW_LINE> ctx.rename(d, f, err=ENOTDIR) <NEW_LINE> ctx.open_dir(d, ro=1) <NEW_LINE> ctx.open_file(d + "/b", ro=1) | Rename dir over a file | 625941df66656f66f7cbc514 |
def is_number(self, s): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> float(s) <NEW_LINE> return True <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return False | Check if s is a number. | 625941df2ae34c7f2600d498 |
def setup_script_interactor(self, model_name='sxrd2'): <NEW_LINE> <INDENT> model = __import__('genx.models.%s' % model_name, globals(), locals(), [model_name]) <NEW_LINE> preamble = "import genx.models.%s as model\nfrom genx.models.utils import UserVars\nfrom genx.models.symmetries import *\n" % model_name <NEW_LINE> s... | Setup the script interactor | 625941df091ae356686672c0 |
def test_add_lines_to_end(self): <NEW_LINE> <INDENT> self.logger.info(Video.objects.all()) <NEW_LINE> self.editor_pg.open_editor_page(self.video.video_id, 'nl') <NEW_LINE> subs = ['third to last', 'pentulitmate subtitle', 'THE END'] <NEW_LINE> self.editor_pg.add_subs_to_the_end(subs) <NEW_LINE> new_subs = self.editor_p... | Add sub to the end of the subtitle list, enter adds new active sub. | 625941df21bff66bcd684cb6 |
def __init__(self, address=None, values=None, **kwargs): <NEW_LINE> <INDENT> ModbusRequest.__init__(self, **kwargs) <NEW_LINE> self.address = address <NEW_LINE> if not values: values = [] <NEW_LINE> elif not hasattr(values, '__iter__'): values = [values] <NEW_LINE> self.values = values <NEW_LINE> self.count = len(self.... | Initializes a new instance
:param address: The address to start writing to
:param values: The values to write | 625941dfac7a0e7691ed442d |
def sequence_mask(lengths, maxlen=None, dtype=tf.bool, transpose=False): <NEW_LINE> <INDENT> with tf.name_scope("sequence_mask"): <NEW_LINE> <INDENT> if maxlen is None: <NEW_LINE> <INDENT> maxlen = tf.reduce_max(lengths) <NEW_LINE> <DEDENT> positions = tf.range(maxlen, dtype=lengths.dtype) <NEW_LINE> positions_singleto... | Returns a sequence mask, like tf.sequence_mask().
Unlike tf.sequence_mask(), this can also generate a transposed mask, which is
convenient for working with time-major sequences.
Args:
lengths: <int>[batch_size] Sequence lengths.
maxlen: <int>[] Maximum length, or None to compute the max of `lengths`.
dtype: DTy... | 625941df498bea3a759b9e15 |
def _handle_disciplines(self, card): <NEW_LINE> <INDENT> for discipline in card.disciplines: <NEW_LINE> <INDENT> self.discipline[discipline].add(card) <NEW_LINE> self.discipline[discipline.lower()].add(card) <NEW_LINE> <DEDENT> if not card.disciplines: <NEW_LINE> <INDENT> self.discipline["none"].add(card) <NEW_LINE> <D... | Helper handling card disciplines. | 625941dff8510a7c17cf9a66 |
def test_put_with_policy_gen_GT_lesser(self): <NEW_LINE> <INDENT> key = ('test', 'demo', 1) <NEW_LINE> rec = {"name": "John"} <NEW_LINE> meta = {'gen': 2, 'ttl': 25000} <NEW_LINE> policy = {'timeout': 1000} <NEW_LINE> assert 0 == TestPut.client.put(key, rec, meta, policy) <NEW_LINE> (key, meta, bins) = TestPut.client.g... | Invoke put() for a record with generation as GT lesser | 625941dfdd821e528d63b50e |
def frompointer(*args): <NEW_LINE> <INDENT> return _x64dbgapi.BookmarkInfoArray_frompointer(*args) | frompointer(BookmarkInfo t) -> BookmarkInfoArray | 625941df56b00c62f0f149c2 |
def update_config_from_file(db_configs): <NEW_LINE> <INDENT> conf = ConfigParser(defaults={"echo": "off", "schema": DEFAULT_TEST_SCHEMA}) <NEW_LINE> if not os.path.isfile(CONFIG_FILE): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> conf.read(CONFIG_FILE) <NEW_LINE> for cls in db_config_classes: <NEW_LINE> <INDENT> db_c... | Update each value of the `db_configs` if there is a corresponding entry
in the configuration file. | 625941df63d6d428bbe44857 |
def next( self, day_of_week: Optional[int] = None, keep_time: bool = False ) -> "DateTime": <NEW_LINE> <INDENT> if day_of_week is None: <NEW_LINE> <INDENT> day_of_week = self.day_of_week <NEW_LINE> <DEDENT> if day_of_week < SUNDAY or day_of_week > SATURDAY: <NEW_LINE> <INDENT> raise ValueError("Invalid day of week") <N... | Modify to the next occurrence of a given day of the week.
If no day_of_week is provided, modify to the next occurrence
of the current day of the week. Use the supplied consts
to indicate the desired day_of_week, ex. DateTime.MONDAY. | 625941df56b00c62f0f149c3 |
def pick_label(self, part_gen, part_file, train_size, psize=1.0, seed=None): <NEW_LINE> <INDENT> if part_gen == 1: <NEW_LINE> <INDENT> print('==================================== generating partitions =====================================') <NEW_LINE> _train_part, self.test_part = partitioning.partition_stratified(self... | This runs at every creation instance
label_type: 'cat' (categorial), 'cont' (continuous) | 625941df10dbd63aa1bd2f09 |
def test_elections_list(self): <NEW_LINE> <INDENT> output = self.app.get('/elections') <NEW_LINE> self.assertEqual(output.status_code, 301) <NEW_LINE> output = self.app.get('/elections/') <NEW_LINE> self.assertEqual(output.status_code, 200) <NEW_LINE> self.assertTrue('<h1>Elections</h1>' in output.data) <NEW_LINE> self... | Test the elections_list function. | 625941df435de62698dfdfb5 |
def main(config): <NEW_LINE> <INDENT> last_log_info = find_last_log_file(config['LOG_DIR']) <NEW_LINE> if not last_log_info: <NEW_LINE> <INDENT> logging.exception('Log file was not founded') <NEW_LINE> return <NEW_LINE> <DEDENT> report_file_name = 'report-{0}.html'.format(last_log_info.date.strftime('%Y.%m.%d')) <NEW_L... | Start all calculations
:param config: dict with configs
:type config: dict | 625941df21bff66bcd684cb7 |
def initDialog(self): <NEW_LINE> <INDENT> self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) <NEW_LINE> try: <NEW_LINE> <INDENT> self.transPatternEdit.setText(os.path.join( self.project.ppath, self.project.pdata["TRANSLATIONPATTERN"][0])) <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDEN... | Public method to initialize the dialogs data. | 625941df82261d6c526ab80b |
@html_wrapper('td') <NEW_LINE> def create_header_cell(html_writer, header_text, **_attr): <NEW_LINE> <INDENT> html_writer.send(header_text) <NEW_LINE> create_button(html_writer, '<') | Creates a cell in the first row of the table.
- html_writer:
A co-routine all funs use to write the HTML file.
- header_text:
The text content of the cell.
- _attr:
Optional HTML arguments. | 625941df96565a6dacc8fa32 |
@contract <NEW_LINE> def write_vm_data_locally(path, data, data_length): <NEW_LINE> <INDENT> for uuid, values in data.items(): <NEW_LINE> <INDENT> with open(os.path.join(path, uuid), 'w') as f: <NEW_LINE> <INDENT> if data_length > 0: <NEW_LINE> <INDENT> f.write('\n'.join([str(x) for x in values[-data_length:]]) + '\n') | Write a set of CPU MHz values for a set of VMs.
:param path: A path to write the data to.
:type path: str
:param data: A map of VM UUIDs onto the corresponing CPU MHz history.
:type data: dict(str : list(int))
:param data_length: The maximum allowed length of the data.
:type data_length: int | 625941dfeab8aa0e5d26dec1 |
def get_diagnose_from_elem(diagnose_elem): <NEW_LINE> <INDENT> diagnose = diagnose_elem.text_content() <NEW_LINE> try: <NEW_LINE> <INDENT> return diagnose[:diagnose.index('(') - 1] <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return diagnose | Returns the diagnose's name from a diagnose's DOM element | 625941dfd53ae8145f87a5d1 |
def test_align_coverages_1(self): <NEW_LINE> <INDENT> self.coverage_extractor._matrix_alignment = "left" <NEW_LINE> npt.assert_array_equal( self.coverage_extractor._align_coverages([1.0, 2.0, 3.0], 10), [1.0, 2.0, 3.0, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan, np.nan]) | Alignment left | 625941df167d2b6e31218efc |
def get_api_versions_with_http_info(self, **kwargs): <NEW_LINE> <INDENT> all_params = [] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> params = locals() <NEW_LI... | get available API versions
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_api_versions_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: V1APIGroupList
If the method is called ... | 625941df99fddb7c1c9de6f7 |
def p_lista_indices(t): <NEW_LINE> <INDENT> t[1].append(t[2]) <NEW_LINE> t[0] = t[1] <NEW_LINE> asc.append(['LIND ',' LIND IND']) | LIND : LIND IND | 625941df8e7ae83300e4b335 |
def IO(self, command): <NEW_LINE> <INDENT> if self.evaluation: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> with open(self.fille, 'w') as f, stdout_redirected(f): <NEW_LINE> <INDENT> if command.startswith(u'print') or (ends_with(command, u')') and not command.startswith(u'(')): <NEW_LINE> <I... | Executes command in the self.glob, meanwhile redirects python
interpretor stdout into self.fille. | 625941df66673b3332b923f9 |
def locate_chunk(self, global_coords): <NEW_LINE> <INDENT> filename = self.path + get_chunk_region(*global_coords) <NEW_LINE> local_coords = _get_local_chunk_coords(*global_coords) <NEW_LINE> return filename, local_coords | Takes the global coordinates of a chunk and returns the
region filename and the local coordinates of the chunk or
None if it doesn't exits in this RegionSet | 625941dfd6c5a102081443b5 |
def _load_schema(version): <NEW_LINE> <INDENT> path = path_join(TEST_DIR, 'schemas', "schema-{}.json".format(version)) <NEW_LINE> with open(path) as f: <NEW_LINE> <INDENT> schema = json.load(f) <NEW_LINE> <DEDENT> return schema | Returns a jsonschema dict from the model-schema submodule | 625941dfb5575c28eb68e36b |
def validate_from_list(input_value, valid_list, convert_to_numbers = False, convert_to_integer = False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if convert_to_numbers: <NEW_LINE> <INDENT> value = float(input_value) <NEW_LINE> if convert_to_integer: <NEW_LINE> <INDENT> value = int(value) <NEW_LINE> <DEDENT> <DEDENT... | Check if a value is within list of valid numbers.
:param input_value: Input value to validate
:type input_value: String
:param valid_list: List of acceptable values.
:type valid_list: List
:param convert_to_numbers: Convert input_value to number prior to checking for presence in list.
:type convert_to_numbers: Boolean... | 625941df4d74a7450ccd452c |
def process_img(file_path): <NEW_LINE> <INDENT> img = cv2.imread(file_path) <NEW_LINE> width = int((300 - img.shape[1]) / 2) <NEW_LINE> height = int((300 - img.shape[0]) / 2) <NEW_LINE> img = cv2.copyMakeBorder(img, height, height, width, width, cv2.BORDER_REPLICATE) <NEW_LINE> img = cv2.resize(img, (112, 112)) <NEW_LI... | rough process images | 625941dfe8904600ed9f2299 |
def test_can_crud_value(): <NEW_LINE> <INDENT> original_key = "my_key" <NEW_LINE> original_value = 2 <NEW_LINE> original_loss = 0.3 <NEW_LINE> pv = PredictedValue(original_key, original_value, loss=original_loss) <NEW_LINE> value = 3 <NEW_LINE> assert pv.value is original_value <NEW_LINE> pv.value = value <NEW_LINE> a... | Tests that full get/set/delete functionality is
available for the value property | 625941df8e71fb1e9831db10 |
def date_lang(date: str, lang: (str, str) = ('en', 'zh')) -> str: <NEW_LINE> <INDENT> languages: dict = settings['languages'] <NEW_LINE> source_words, target_words = languages[lang[0]], languages[lang[1]] <NEW_LINE> for source_word, target_word in zip(source_words, target_words): <NEW_LINE> <INDENT> date = date.replace... | 时间戳中英互译 | 625941df925a0f43d254a1e2 |
def postorder(self,parent,child): <NEW_LINE> <INDENT> pass | Called when DFS visits child, after visiting all grandchildren.
Parent==child when child is the root of each DFS tree. | 625941dfd53ae8145f87a5d2 |
def forward(self, input_data): <NEW_LINE> <INDENT> activations = [input_data] <NEW_LINE> layer_result = input_data <NEW_LINE> for index in range(self.L-1): <NEW_LINE> <INDENT> W = self.Weights[index] <NEW_LINE> z = self.b[index] + np.matmul(layer_result, W) <NEW_LINE> layer_result = z * (z > 0) <NEW_LINE> activations.a... | Inputs:
inputs_data: np.array | 625941df7cff6e4e81117ced |
def deserialize(self, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.header is None: <NEW_LINE> <INDENT> self.header = std_msgs.msg.Header() <NEW_LINE> <DEDENT> end = 0 <NEW_LINE> _x = self <NEW_LINE> start = end <NEW_LINE> end += 12 <NEW_LINE> (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) =... | unpack serialized message in str into this message instance
:param str: byte array of serialized message, ``str`` | 625941df31939e2706e4d1cd |
def emit_node(node): <NEW_LINE> <INDENT> yield str(node) | Yield the concatenated text of all tokens in a node.
This will materialize an entire node | 625941df23849d37ff7b33f5 |
def CStreamInterface_readDoubleFromStream(*args): <NEW_LINE> <INDENT> return _ndlml.CStreamInterface_readDoubleFromStream(*args) | CStreamInterface_readDoubleFromStream(istream & _in, std::string const fieldName) -> double | 625941dfcc40096d61595cb7 |
def generate_default_config(): <NEW_LINE> <INDENT> if os.path.exists('config.py'): <NEW_LINE> <INDENT> print('Default config, config.py already exists.') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> header = ('# Automatically generated by configtools.generate_default_config()\n' '# %s on the node %s\n\n\n' 'from cmsto... | This generates the file ``config.py``, if it does not exist.
Site admins should check this configuration and change to their desired
values before running ``ListDeletable.py`` a second time. | 625941df293b9510aa2c35fa |
def _file_open(self, path, open_mode=AFC.O_RDONLY) -> int: <NEW_LINE> <INDENT> payload = struct.pack("<Q", open_mode) <NEW_LINE> payload += self._pad00(path) <NEW_LINE> pkg = self._request(AFC.OP_FILE_OPEN, payload) <NEW_LINE> fd = struct.unpack("<Q", pkg.data)[0] <NEW_LINE> assert fd, "file descriptor should not be ze... | Return file handle fd | 625941dfbde94217f3683156 |
def test_process_dry_run(self): <NEW_LINE> <INDENT> dry = True <NEW_LINE> test_dir = os.path.join('top', 'tests', 'files') <NEW_LINE> csv_file = 'ADP-Bulk-Load.csv' <NEW_LINE> test_file = os.path.join(test_dir, csv_file) <NEW_LINE> dir = tempfile.mkdtemp() <NEW_LINE> in_file = os.path.join(dir, os.path.basename(test_fi... | Check processing -- dry run.
| 625941df55399d3f05588a1e |
def _read_location_file(self, currloc, errlist): <NEW_LINE> <INDENT> if u'ArchiveUri' in currloc and u'ArchiveFile' in currloc: <NEW_LINE> <INDENT> fqpath = os.path.join(self._root, currloc.ArchiveUri.xref.lstrip(os.path.sep)) <NEW_LINE> if not os.path.isfile(fqpath): <NEW_LINE> <INDENT... | Return results from locations
:param currloc: current URI
:type currloc: str
:param errlist: list containing found errors.
:type errlist: list.
:returns: returns results from archive at currloc parameter | 625941df76d4e153a657ee9a |
def InitOtherEvents(self): <NEW_LINE> <INDENT> pass | Override in a subclass to initialize any other events that
need to be bound. Added so __init__ doesn't need to be
overriden, which is complicated with multiple inheritance | 625941df4a966d76dd55137a |
def __init__(self,iconpath,icongifpath=None,menu=None,parent=None): <NEW_LINE> <INDENT> super(TrayIconHandler,self).__init__(parent) <NEW_LINE> self.parent=parent <NEW_LINE> self.iconpath = iconpath <NEW_LINE> self.icongifpath = icongifpath <NEW_LINE> self.systray = QSystemTrayIcon(QIcon(iconpath),parent) <NEW_LINE> if... | @param menu: QMenu to show on right click on the systray icon
@param parent: QWidget which will be shown/hidden on left click on the systray icon | 625941df63b5f9789fde744e |
def parse_comment(source): <NEW_LINE> <INDENT> source.skip_while(set(")"), include=False) <NEW_LINE> source.expect(")") <NEW_LINE> return COMMENT | Parses a comment. | 625941dfcad5886f8bd27341 |
def tag_input(self, mach, tagname, tokens, attributes, content): <NEW_LINE> <INDENT> return '<input %s/>' % attributes | <input> handler | 625941df91f36d47f21ac85e |
def plot_grid_array(grid, cell_height, labels, title="", save=None, show=True): <NEW_LINE> <INDENT> plt.figure() <NEW_LINE> plt.imshow(grid, cmap="gray") <NEW_LINE> plt.title(title) <NEW_LINE> plt.axes().set_yticks( np.arange(len(labels)) * cell_height + (cell_height / 2.0)) <NEW_LINE> if labels is not None: <NEW_LINE>... | Takes a 2D array that can be thought of as a grid of images, like the one
returned by the `sample_grid_of_arrays()` function, and plots it, with class
labels along the y axis for each row of images that belong to some class.
:param grid: {2D array}
The 2D array we are treating as a grid of arrays
:param cell_heigh... | 625941dfab23a570cc2504ed |
def _get_class_info(classes): <NEW_LINE> <INDENT> res = {} <NEW_LINE> for node in classes: <NEW_LINE> <INDENT> if node.name.startswith('_') or res.get(node.name) is not None: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> init_func, subclasses, functions = _get_class_attrs(node, classes) <NEW_LINE> args = [] <NEW_LIN... | returns a dict containing info on args, subclasses and functions | 625941dfa05bb46b383ecb87 |
def __init__(self, **config): <NEW_LINE> <INDENT> super().__init__(config) <NEW_LINE> self._vendor = "Super" <NEW_LINE> self._model = "S8_3CN" <NEW_LINE> self._parameters.append( Parameter( "GetRelays", "Bits", ParameterType.INT16_T, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], RegisterType.ReadCoil ) ) <NEW_LINE> self._par... | Constructor | 625941df187af65679ca5488 |
def _get_email_output_for_task_success(self, attempted, succeeded, total, skipped=0): <NEW_LINE> <INDENT> instructor_task = self._create_email_subtask_entry( total=total, attempted=attempted, succeeded=succeeded, skipped=skipped, task_state=SUCCESS, ) <NEW_LINE> return self._test_get_status_from_result(instructor_task.... | returns the result returned by instructor_task_status(). | 625941dfd58c6744b4257fc6 |
def get_installed_packages(): <NEW_LINE> <INDENT> if freeze is None: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return list(freeze.freeze()) | Get a list of installed packages | 625941df4a966d76dd55137b |
def do_exec_vim(filepath): <NEW_LINE> <INDENT> call(["nvim", filepath]) <NEW_LINE> return | Called when running vim.
Since not implemented, EDITOR assumes neovim | 625941df046cf37aa974d0ad |
def test_items(self): <NEW_LINE> <INDENT> self.assertEqual(list(Dict2D(self.empty).Items), []) <NEW_LINE> sq = Dict2D(self.square, RowOrder='abc', ColOrder='abc') <NEW_LINE> self.assertEqual(list(sq.Items), [1,2,3,2,4,6,3,6,9]) <NEW_LINE> sq.RowOrder = 'ba' <NEW_LINE> sq.ColOrder = 'ccb' <NEW_LINE> self.assertEqual(lis... | Dict2D Items property should return list in correct order | 625941df4f6381625f114da4 |
def play_result_generator0(): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> yield 0 | 生成器,永远选择最前一张牌 | 625941df85dfad0860c3b1c5 |
def __init__(self, lcd, selected_game): <NEW_LINE> <INDENT> super(DIMMSelect, self).__init__(lcd) <NEW_LINE> if not DIMMSelect.instance: <NEW_LINE> <INDENT> DIMMSelect.instance = DIMMSelect.__DIMMSelect(lcd, selected_game) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> DIMMSelect.instance.lcd = lcd <NEW_LINE> DIMMSelect... | :param lcd: An lcd handle. This is not generalized.
:param dict selected_game: A dict describing the game to be loaded. | 625941df5fcc89381b1e1a29 |
def check_place(self, place_uid): <NEW_LINE> <INDENT> c = self.conn.cursor() <NEW_LINE> c.execute("SELECT 1 FROM places_data WHERE places_data.uid = ?", (place_uid,)) <NEW_LINE> return bool(c.fetchone()) | Returns true if the provided place_uid is valid | 625941df462c4b4f79d1da39 |
def _update_mask(mask, microplate_name, source): <NEW_LINE> <INDENT> if u'control' in source: <NEW_LINE> <INDENT> if microplate_name in source[u'control']: <NEW_LINE> <INDENT> for well in source[u'control'][microplate_name]: <NEW_LINE> <INDENT> mask[welladdr.indexof(well)] = True | Set flag for wells listed as control ones. | 625941df76d4e153a657ee9b |
def get_available_filenames(self, vm, template=None): <NEW_LINE> <INDENT> templates_dirs = self.templates_dirs(vm, template) <NEW_LINE> templates_dirs = (x for x in templates_dirs if os.path.isdir(x)) <NEW_LINE> if not templates_dirs: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> listed = set() <NEW_LINE> for template... | Yield filenames of available .desktop files | 625941df460517430c3944e5 |
def quasar_data_type_to_cpp_type(self, quasar_data_type, is_array): <NEW_LINE> <INDENT> if is_array: <NEW_LINE> <INDENT> return 'std::vector<{0}>'.format(quasar_data_type) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return quasar_data_type | TODO: this needs to be cleaned-up, really | 625941df3cc13d1c6d3c76e1 |
def removeElements(self, head, val): <NEW_LINE> <INDENT> if not head: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> dummy = ListNode(0) <NEW_LINE> dummy.next = head <NEW_LINE> p1 = head <NEW_LINE> p2 = dummy <NEW_LINE> while p1: <NEW_LINE> <INDENT> if p1.val == val: <NEW_LINE> <INDENT> p2.next = p1.next <NEW_LINE... | :type head: ListNode
:type val: int
:rtype: ListNode | 625941df73bcbd0ca4b2c3df |
def match(self, other, comparisonAttribute='pitchClass'): <NEW_LINE> <INDENT> otherPitches = self._extractPitchList(other, comparisonAttribute=comparisonAttribute) <NEW_LINE> matched, notMatched = self._abstract._net.match( pitchReference=self.tonic, nodeId=self._abstract.tonicDegree, pitchTarget=otherPitches, comparis... | Given another object of various forms (e.g., a :class:`~music21.stream.Stream`, a :class:`~music21.scale.ConcreteScale`, a list of :class:`~music21.pitch.Pitch` objects), return a named dictionary of pitch lists with keys 'matched' and 'notMatched'.
>>> from music21 import *
>>> sc1 = scale.MajorScale('g')
>>> sc2 = s... | 625941df7c178a314d6ef7cd |
def __get_info_command(self, channel): <NEW_LINE> <INDENT> int_list = [ BYTE_HEADER, BYTE_LENGTH_4, COMMAND_INFO, self.__set_upper_channel_bits(channel), self.__set_lower_channel_bits(channel), ] <NEW_LINE> return int_list | Create a hex list to the Info command. | 625941df8e05c05ec3eea6e0 |
def get_app_instances(self, app_name): <NEW_LINE> <INDENT> desktop_file = self.KNOWN_APPS[app_name]['desktop-file'] <NEW_LINE> return self.bamf.get_running_applications_by_desktop_file(desktop_file) | Get BamfApplication instances for app_name. | 625941dfd486a94d0b98e4af |
def get_setpoint(self, toutput): <NEW_LINE> <INDENT> pass | On Output type object only
Return current setpoint
Args:
toutput: Output class type object
Returns:
(float) setpoint value. Must be None if not setpoint is set | 625941df283ffb24f3c55c66 |
def _progress_bar(count, total): <NEW_LINE> <INDENT> bar_len = 60 <NEW_LINE> filled_len = int(round(bar_len * (count + 1) / float(total))) <NEW_LINE> bar = '=' * filled_len + '-' * (bar_len - filled_len) <NEW_LINE> return '[{}] {}/{}'.format(bar, count + 1, total) | Get a simple one-line string representing a progress bar.
Arguments:
count (int): Current count. Starts at 0.
total (int): Total count.
Returns:
pbar_string (str): The string progress bar. | 625941df596a897236089e25 |
def get_default_interface(): <NEW_LINE> <INDENT> llogger = local_logger.LocalLogger() <NEW_LINE> llogger.log_call(sys._getframe().f_code.co_name) <NEW_LINE> interface = config.get(Section.INTERNET, Option.INTERFACE) <NEW_LINE> if interface is not None: <NEW_LINE> <INDENT> return interface <NEW_LINE> <DEDENT> in_stream ... | Get the first interface listed in hostname
:return: interface | 625941df1f5feb6acb0c4eb3 |
def __getitem__(self, property): <NEW_LINE> <INDENT> return self.data[property][self.indx] | Return the column values ordered by channelId. | 625941df4527f215b584c7bc |
def testPredictBatching(self): <NEW_LINE> <INDENT> self._TestPredict( self._GetSessionBundlePath(), batching_parameters_file=self._GetBatchingParametersFile()) | Test PredictionService.Predict implementation with SessionBundle. | 625941df16aa5153ce3627e1 |
def clean_re_password(self): <NEW_LINE> <INDENT> if 'password' in self.cleaned_data: <NEW_LINE> <INDENT> password1 = self.cleaned_data['password'] <NEW_LINE> password2 = self.cleaned_data['re_password'] <NEW_LINE> <DEDENT> if password1 == password2: <NEW_LINE> <INDENT> return password2 <NEW_LINE> <DEDENT> raise forms.V... | 验证密码 | 625941df5e10d32532c5f28f |
def get_assessment_search_order(self): <NEW_LINE> <INDENT> return | Gets the search order for an assessment.
:return: the assessment search order
:rtype: ``osid.assessment.AssessmentSearchOrder``
:raise: ``Unimplemented`` -- ``supports_assessment_search_order()`` is ``false``
*compliance: optional -- This method must be implemented if
``supports_assessment_search_order()`` is ``true`... | 625941df7d847024c06be628 |
def __init__(self, corpus_record, naptan_record): <NEW_LINE> <INDENT> self.corpus_record = corpus_record <NEW_LINE> self.naptan_record = naptan_record | ```
{
"TIPLOC": "KETR",
"UIC": "18570",
"NLCDESC16": " ",
"STANOX": "61009",
"NLC": "185700",
"3ALPHA": "KET",
"NLCDESC": "KETTERING"
},
``` | 625941dfd486a94d0b98e4b0 |
def ligne_liste(self, categorie, valeurs): <NEW_LINE> <INDENT> return [categorie]+self.get_vals(categorie, valeurs) | retourne les elements sous forme de liste | 625941df66673b3332b923fa |
def run_worker(wname, data, **kwargs): <NEW_LINE> <INDENT> wfe = BibWorkflowEngine(wname, **kwargs) <NEW_LINE> wfe.save() <NEW_LINE> objects = prepare_objects(data, wfe) <NEW_LINE> run_workflow(wfe=wfe, data=objects, **kwargs) <NEW_LINE> return wfe | Runs workflow with given name and given data.
Data can be specified as list of objects or
single id of WfeObject/BibWorkflowObjects. | 625941df24f1403a92600ecc |
@register_api('/api/test/helloworld/', methods=['GET', 'POST', 'DELETE', 'PUT']) <NEW_LINE> def hello_world(*args, **kwargs): <NEW_LINE> <INDENT> print('+------------ HELLO WORLD ------------') <NEW_LINE> print('Args: %r' % (args,)) <NEW_LINE> print('Kwargs: %r' % (kwargs,)) <NEW_LINE> print('request.args: %r' % (reque... | CommandLine:
python -m ibeis.web.apis --exec-hello_world:0
python -m ibeis.web.apis --exec-hello_world:1
Example:
>>> # xdoctest: +REQUIRES(--web)
>>> from ibeis.web.app import * # NOQA
>>> import ibeis
>>> web_ibs = ibeis.opendb_bg_web(browser=True, start_job_queue=False, url_suffix='/api/tes... | 625941dfd58c6744b4257fc7 |
def test_i_p_pool_router_create(self): <NEW_LINE> <INDENT> pass | Test case for i_p_pool_router_create
| 625941df9f2886367277abf4 |
def test_get_score_success_fails(self): <NEW_LINE> <INDENT> score_dict = self.get_score(False, 0, 0) <NEW_LINE> self.assertIsNone(score_dict) | Test if query_data_for_location not succeed, their score is None. | 625941df3d592f4c4ed1d3ce |
def output_signature(self): <NEW_LINE> <INDENT> return _cdma_swig.pac_err_cal_sptr_output_signature(self) | output_signature(pac_err_cal_sptr self) -> io_signature_sptr | 625941dffff4ab517eb2f7a7 |
def withdraw(self, amount): <NEW_LINE> <INDENT> if self.balance - amount < 0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.balance -= amount <NEW_LINE> return True | Withdraw money from the debit account. Cannot go below 0. | 625941dffb3f5b602dac3a00 |
def checkPoints(arr,ny,nx,pos0,dy,dx,theta=0,gapsOutside=True): <NEW_LINE> <INDENT> pos,gap=makeGrid(pos0,ny,nx,dy,dx,theta,True,gapsOutside) <NEW_LINE> pos=list(zip(*pos)) <NEW_LINE> gap=list(zip(*gap)) <NEW_LINE> pos[0]=[max(0,min(arr.shape[0]-1,p)) for p in pos[0]] <NEW_LINE> pos[1]=[max(0,min(arr.shape[1]-1,p)) for... | Return pixel intensities at grid points in (typically smoothed) 2D array | 625941df2c8b7c6e89b35b27 |
def login_user(self, username): <NEW_LINE> <INDENT> last_10_wikis = self.get_last_10_wikis() <NEW_LINE> q = db.GqlQuery( "SELECT * FROM User where username = \'" + username + "\'" ) <NEW_LINE> if q.count() == 1: <NEW_LINE> <INDENT> user = q.get() <NEW_LINE> hash_cookie = str(user.key().id()) + "|" + user.password <NEW_... | Pre-condition: username exists already in db (given that info was verified in post)
logs-in user checking db. If not found send unexpected error | 625941df097d151d1a2231c0 |
def encrypt_and_hash(self, plaintext): <NEW_LINE> <INDENT> pass | EncryptAndHash(plaintext):
Sets ciphertext = EncryptWithAd(h, plaintext), calls MixHash(ciphertext), and returns ciphertext.
Note that if k is empty, the EncryptWithAd() call will set ciphertext equal to plaintext
:param plaintext:
:type plaintext: bytes
:return:
:rtype: bytes | 625941df94891a1f4081be13 |
def display_network_architecture(self): <NEW_LINE> <INDENT> self.log("\n-------- Network architecture --------") <NEW_LINE> self.log("y_res: {}".format(self.y_res)) <NEW_LINE> self.log("x_res: {}".format(self.x_res)) <NEW_LINE> self.log("n_input_channels: {}".format(self.n_input_channels)) <NEW_LINE> self.log("n_output... | Displays the network architecture | 625941df442bda511e8be77d |
def is_temp_network_error(exc): <NEW_LINE> <INDENT> if isinstance(exc, (httplib.IncompleteRead, socket.timeout)): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif (isinstance(exc, httplib.BadStatusLine) and (not exc.line or exc.line == "''")): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> elif (isinstance... | Return true if *exc* represents a potentially temporary network problem | 625941dfb57a9660fec33bf2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.