code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def get_words(str_or_file): <NEW_LINE> <INDENT> return [word.lower() for sent in get_sents(str_or_file) for word in word_tokenize(sent)] | Given a string for a file handler, return a list of tokenized
and lowercased words from that string/file. | 625941d58a43f66fc4b54283 |
def ok(self, msg): <NEW_LINE> <INDENT> print('{c}{msg}{nc}'.format( c = self.green, msg = msg, nc = self.nc)) | Print an ok pessage | 625941d54f88993c3716c286 |
def deviceItemClicked(self, item): <NEW_LINE> <INDENT> name = str(item.text()) <NEW_LINE> if item.checkState() == Qt.Qt.Unchecked: <NEW_LINE> <INDENT> self.currentTask.removeDevice(name) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.currentTask.addDevice(name) <NEW_LINE> <DEDENT> self.updateDeviceDocks([name]) | Respond to clicks in the device list. Add/remove devices from the current task and update docks. | 625941d53c8af77a43ae39c1 |
def copy(self): <NEW_LINE> <INDENT> copy = self.new("") <NEW_LINE> _ffi.memmove(copy._native_object, self._native_object, self._native_size) <NEW_LINE> return copy | Returns a separate copy of this hashing object. An update
to this copy won't affect the original object. | 625941d530bbd722463cbfe8 |
def _network_wrapper(callback, thing, *args, **kwargs): <NEW_LINE> <INDENT> result = _NO_CALLBACK_RESULT <NEW_LINE> delay = 1 <NEW_LINE> while result == _NO_CALLBACK_RESULT: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> result = callback(thing, *args, **kwargs) <NEW_LINE> <DEDENT> except (RequestException, ResponseExcep... | Wraps the callback in a try/except against network issues | 625941d59f2886367277aaad |
@api.route('/<int:id>', methods=['GET']) <NEW_LINE> @api.doc(args=['g.path.group_id'], auth=True) <NEW_LINE> @auth.admin_required <NEW_LINE> def get_group(id): <NEW_LINE> <INDENT> group = Group.get_or_404(id=id, msg='分组不存在') <NEW_LINE> group.append('auth_list') <NEW_LINE> return Success(group) | 查询一个权限组及其权限 | 625941d53c8af77a43ae39c2 |
def top_headlines_by_src(src): <NEW_LINE> <INDENT> url = ('https://newsapi.org/v2/top-headlines?' 'sources=' + src + '&' 'language=en&' 'apiKey=' + API_KEY) <NEW_LINE> response = urllib.request.urlopen(url) <NEW_LINE> return json.loads(response.read()) | This function gets raw json data of top headlines by source | 625941d54d74a7450ccd43e4 |
def _normalize_boto3_resource(self, resource, add_tags=False): <NEW_LINE> <INDENT> if resource is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> tags = resource.get('Tags', None) <NEW_LINE> if tags: <NEW_LINE> <INDENT> tags = boto3_tag_list_to_ansible_dict(tags) <NEW_LINE> <DEDENT> elif add_tags or tags is n... | Performs common boto3 resource to Ansible resource conversion.
`resource['Tags']` will by default be converted from the boto3 tag list
format to a simple dictionary.
Parameters:
resource (dict): The boto3 style resource to convert to the normal Ansible
format (snake_case).
add_tags (bool): When `... | 625941d55e10d32532c5f147 |
def sigmoid(self): <NEW_LINE> <INDENT> with self.variable_scope(): <NEW_LINE> <INDENT> self.z = tf.nn.sigmoid(self.z) <NEW_LINE> <DEDENT> return self | Add a sigmoid activation | 625941d557b8e32f524836bc |
def longestCommonPrefix(self, m): <NEW_LINE> <INDENT> assert type(m) == list, "The input argument needs to be a list of strings." <NEW_LINE> for i in m: <NEW_LINE> <INDENT> assert type(i) == str, "The input argument needs to be a list of strings." <NEW_LINE> <DEDENT> s1 = min(m) <NEW_LINE> s2 = max(m) <NEW_LINE> for i,... | Slick, Pythonic LCP function for use in later functions.
:param
m (list): list of strings from which to search for the LCP.
:return:
LCP (string): the longest common prefix of all strings in the list. | 625941d54527f215b584c675 |
def __getitem__(self, index): <NEW_LINE> <INDENT> img_path = self.files[self.split][index].rstrip() <NEW_LINE> lbl_path = os.path.join( self.annotations_base, os.path.basename(img_path).replace(".jpg", ".png") ) <NEW_LINE> img = Image.open(img_path) <NEW_LINE> lbl = Image.open(lbl_path) <NEW_LINE> if self.augmentations... | __getitem__
:param index: | 625941d55fc7496912cc3b9e |
def check_required(params): <NEW_LINE> <INDENT> def decorator(f): <NEW_LINE> <INDENT> @wraps(f) <NEW_LINE> def decorated_function(*args, **kwargs): <NEW_LINE> <INDENT> json = request.get_json() <NEW_LINE> if not json: <NEW_LINE> <INDENT> response = {} <NEW_LINE> for p in params: <NEW_LINE> <INDENT> response[p[0]] = m.F... | Check that the specified parameters are provided and valid.
Args:
params (list[tuple]): List of tuples containing the parameter name
and the data type that the parameter should be. | 625941d55fdd1c0f98dc0454 |
def GetParentFileEntry(self): <NEW_LINE> <INDENT> if self._is_virtual: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> path_spec = sqlite_blob_path_spec.SQLiteBlobPathSpec( table_name=self.path_spec.table_name, column_name=self.path_spec.column_name, parent=self.path_spec.parent) <NEW_LINE> return SQLiteBlobFileEnt... | Retrieves the parent file entry.
Returns:
SQLiteBlobFileEntry: parent file entry or None if not available. | 625941d53617ad0b5ed68117 |
def preferred_width(self, max_available_width): <NEW_LINE> <INDENT> def preferred_content_width(): <NEW_LINE> <INDENT> if self.ignore_content_width(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> total_margin_width = sum(self._get_margin_width(m) for m in self.left_margins + self.right_margins) <NEW_LINE> prefer... | Calculate the preferred width for this window. | 625941d596565a6dacc8f8eb |
def update_message(obj): <NEW_LINE> <INDENT> if not check_params(obj, ["id"],["season", "episode", "character", "line"]): <NEW_LINE> <INDENT> return {"response":400,"message":"Bad Request: 'id' and at least one of ['season', 'episode', 'character' and 'line'] are obligatory parameters"} <NEW_LINE> <DEDENT> q = {"_id":O... | Given a message ID and new attributes, updates the message from the messages collection
Takes: message ID
Returns: nothing | 625941d5fb3f5b602dac38b6 |
def test_serialize_deserialize_keep_ignore(self): <NEW_LINE> <INDENT> self.parser.keep_ignore = True <NEW_LINE> testanno = PickleAnnotation() <NEW_LINE> testanno.ignore = True <NEW_LINE> obj = {'img': [testanno]} <NEW_LINE> bytestream = self.parser.serialize(obj) <NEW_LINE> obj2 = self.parser.deserialize(bytestream) <N... | Test whether the ignore property is saved when keep_ignore is True | 625941d545492302aab5e4e6 |
def marginal_maxent_dists(dist, k_max=None): <NEW_LINE> <INDENT> dist = prepare_dist(dist) <NEW_LINE> n_variables = dist.outcome_length() <NEW_LINE> if k_max is None: <NEW_LINE> <INDENT> k_max = n_variables <NEW_LINE> <DEDENT> outcomes = list(dist._sample_space) <NEW_LINE> k0 = Distribution(outcomes, [1] * len(outcomes... | Return the marginal-constrained maximum entropy distributions.
Parameters
----------
dist : distribution
The distribution used to constrain the maxent distributions.
k_max : int
The maximum order to calculate.
Returns
-------
dists : list
A list of distributions, where the `i`th element is the maxent
... | 625941d58a43f66fc4b54284 |
def set_kernel_arguments(self): <NEW_LINE> <INDENT> for val in self.mapping.values(): <NEW_LINE> <INDENT> self.cl_kernel_args[val] = OrderedDict(((i, self.cl_mem[i]) for i in ("raw", "converted"))) | Parametrize all kernel arguments | 625941d5b545ff76a8914036 |
def test_default_values(self): <NEW_LINE> <INDENT> logger = pgo_logger.get_logger() <NEW_LINE> assert logger is not None <NEW_LINE> assert logger.hasHandlers() is True <NEW_LINE> assert logger.name == pgo_logger.DEFAULT_LOGGER_NAME <NEW_LINE> assert logger.level == 20 | Simple test with default values | 625941d599fddb7c1c9de5b1 |
def dfs(starts, children_fn, yield_fn = lambda x : True): <NEW_LINE> <INDENT> stack = list(starts) <NEW_LINE> while len(stack) > 0: <NEW_LINE> <INDENT> vertex = stack.pop() <NEW_LINE> if yield_fn(vertex): <NEW_LINE> <INDENT> yield vertex <NEW_LINE> stack.extend(children_fn(vertex)) | Depth-first search | 625941d5cb5e8a47e48b7cc8 |
def get_property_descriptions(self): <NEW_LINE> <INDENT> return self.td.get('properties', {}) | Get the thing's properties as a dictionary.
Returns the properties as a dictionary, i.e. name -> description. | 625941d5d10714528d5fff06 |
def star_actual_user_dashboard(self, dashboard_id): <NEW_LINE> <INDENT> star_dashboard = '/user/stars/dashboard/%s' % (dashboard_id) <NEW_LINE> r = self.api.POST(star_dashboard) <NEW_LINE> return r | :param dashboard_id:
:return: | 625941d5460517430c3943a2 |
def updateStructure(self): <NEW_LINE> <INDENT> editor = pyzo.editors.getCurrentEditor() <NEW_LINE> if not editor: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> result = pyzo.parser._getResult() <NEW_LINE> if result is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> id0, id1, id2 = self._currentEditorId, id(editor... | Updates the tree.
| 625941d53346ee7daa2b2f8d |
def test_regular_FastaTwoLineParser(self): <NEW_LINE> <INDENT> for inp, out in zip(self.ins_two_line, self.outs_two_line): <NEW_LINE> <INDENT> handle1 = StringIO(inp) <NEW_LINE> handle2 = StringIO(inp + "\n") <NEW_LINE> self.assertEqual(list(FastaTwoLineParser(handle1)), out) <NEW_LINE> self.assertEqual(list(FastaTwoLi... | Test regular FastaTwoLineParser cases. | 625941d5091ae3566866717c |
def iter_rows(self, *datas, step=1): <NEW_LINE> <INDENT> for d in zip(*datas): <NEW_LINE> <INDENT> yield d <NEW_LINE> self += step | 按行写入数据 | 625941d53cc13d1c6d3c759a |
def normalize_vector(self, vector): <NEW_LINE> <INDENT> len_vector = vector.module <NEW_LINE> return Vector(vector.x / len_vector, vector.y / len_vector) | Нормализировать вектор | 625941d5009cb60464c635d1 |
def climbStairs(self, n: int) -> int: <NEW_LINE> <INDENT> if n in (1, 2, 3): <NEW_LINE> <INDENT> return n <NEW_LINE> <DEDENT> stairs = [1, 2, 3] <NEW_LINE> for i in range(3, n): <NEW_LINE> <INDENT> stairs.append(stairs[i-1] + stairs[i-2]) <NEW_LINE> <DEDENT> return stairs[-1] | Results:
1. Runtime: 44 ms
Memory Usage: 14.1 MB | 625941d538b623060ff0b00e |
def get_form_class(self): <NEW_LINE> <INDENT> if not hasattr(self, 'model'): <NEW_LINE> <INDENT> raise AttributeError( '%s is not bound to a model yet. Use `.bind_to_model(model)` ' 'before using this method.' % self.__class__.__name__) <NEW_LINE> <DEDENT> model_form_class = getattr(self.model, 'base_form_class', Wagta... | Construct a form class that has all the fields and formsets named in
the children of this edit handler. | 625941d521a7993f00bc7f13 |
def serialize_numpy(self, buff, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> _x = self <NEW_LINE> buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs)) <NEW_LINE> _x = self.header.frame_id <NEW_LINE> length = len(_x) <NEW_LINE> if python3 or type(_x) == unicode: <NEW_LINE> <IND... | serialize message with numpy array types into buffer
:param buff: buffer, ``StringIO``
:param numpy: numpy python module | 625941d5bf627c535bc133f0 |
def modify_MONACO_contournames(self,protocol_name): <NEW_LINE> <INDENT> with open(self.contour_path, "r+") as f: <NEW_LINE> <INDENT> line = f.readlines() <NEW_LINE> <DEDENT> old_name = [line[2+i*18].split('\n')[0] for i in range(int(len(line)/18))] <NEW_LINE> self.name = [line[2+i*18].split('\n')[0] for i in range(int(... | read contournames file from FocalData to
extract the structure names of CT | 625941d55fc7496912cc3b9f |
def pad_lists(lists, padding_value=None, max_length=None): <NEW_LINE> <INDENT> if max_length is None: <NEW_LINE> <INDENT> max_length = max(len(lst) for lst in lists) <NEW_LINE> <DEDENT> lengths = [] <NEW_LINE> for lst in lists: <NEW_LINE> <INDENT> length = len(lst) <NEW_LINE> lst += [padding_value] * (max_length - leng... | Pads a list of lists.
Args:
lists: A list of lists.
Returns:
A tuple with the padded collection of lists and the original length of each
list. | 625941d515fb5d323cde0d33 |
def emit(self, record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import smtplib <NEW_LINE> try: <NEW_LINE> <INDENT> from email.utils import formatdate <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> formatdate = self.date_time <NEW_LINE> <DEDENT> port = self.mailport <NEW_LINE> if not port: <NEW_LINE> <... | Emit a record.
Format the record and send it to the specified addressees. | 625941d592d797404e3043ac |
def __init__(self, T, Kelvin=False): <NEW_LINE> <INDENT> if not Kelvin: <NEW_LINE> <INDENT> self.T = T + 273 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.T = T <NEW_LINE> <DEDENT> self.k = air_props.thermal_conductivity(self, self.T) <NEW_LINE> self.nu = air_props.kinematic_viscosity(self, self.T) <NEW_LINE> self... | Parameters
----------
T: float, array like
Temperature at which air properties will be evaluated at
Kelvin: bool
Whether or not the temperatures are in Celsius or Kelvin. If in Celsius, the data is converted to Kelvin | 625941d55fcc89381b1e18e2 |
def get_stats(self, topic): <NEW_LINE> <INDENT> consumer_key = 'FQvMGcXfTBW085e9p8HrBGG03' <NEW_LINE> consumer_secret = 'EyELEm6tZsgLK3HDuLYOVAtiKprCPNzx2YxOfllBvV3xZG5KSs' <NEW_LINE> access_token = '4165420933-biz0Ne5cAEiMm7FivgPfPRu4oCIBYrf0UXOpAKI' <NEW_LINE> access_token_secret = '6SYcS2b5zzek72huIqEK6njL1nz5cKtlFI... | Get sentiments analysis of the tweets
:param topic:
:return: | 625941d566673b3332b922b3 |
def wait_element_present(self, timeout = 30, interval = 2): <NEW_LINE> <INDENT> frequence = int(timeout/interval) <NEW_LINE> for i in range(frequence): <NEW_LINE> <INDENT> self.web_element = self.element() <NEW_LINE> if self.web_element is not None: <NEW_LINE> <INDENT> if interval > 0: <NEW_LINE> <INDENT> time.sleep(i... | 在设定的时间里,等待元素的出现;超过时间间隔,报错.
timeout: 指定的时间
interval:轮询的间隔时间 | 625941d5d486a94d0b98e367 |
def create_item_pool(self, request): <NEW_LINE> <INDENT> body = { "name": request.get_name(), "serviceClass": request.get_service_class(), } <NEW_LINE> if request.get_description() is not None: <NEW_LINE> <INDENT> body["description"] = request.get_description() <NEW_LINE> <DEDENT> if request.get_acquisition_item_trigge... | 消費型アイテムプールを新規作成します<br>
<br>
:param request: リクエストパラメータ
:type request: gs2_consumable_item_client.control.CreateItemPoolRequest.CreateItemPoolRequest
:return: 結果
:rtype: gs2_consumable_item_client.control.CreateItemPoolResult.CreateItemPoolResult | 625941d50a366e3fb873ea3c |
def nsfw(phenny, input): <NEW_LINE> <INDENT> link = input.group(1) <NEW_LINE> if not link: <NEW_LINE> <INDENT> phenny.say(".nsfw <link> - for when a link isn't safe for work") <NEW_LINE> return <NEW_LINE> <DEDENT> phenny.say("!!NSFW!! -> %s <- !!NSFW!!" % (link)) | .nsfw <link> - Mark a link (or some text) as being not safe for work. | 625941d5d18da76e235326f9 |
def _apply_mask(self, inpt: t.Tensor, mask: t.ByteTensor) -> Tensor: <NEW_LINE> <INDENT> if mask.size() != inpt.size(): <NEW_LINE> <INDENT> if len(mask.size()) < len(inpt.size()): <NEW_LINE> <INDENT> while len(mask.size()) < len(inpt.size()): <NEW_LINE> <INDENT> mask = mask.unsqueeze(len(mask.size())) <NEW_LINE> <DEDEN... | Applies the mask to inpt according to MaskMode
:param inpt: Input tensor to apply mask to
:param mask: Mask to apply
:returns: Result of applying mask to inpt given the Mode | 625941d54e4d5625662d45f7 |
def log_likelihood(emp_cov, precision): <NEW_LINE> <INDENT> p = precision.shape[0] <NEW_LINE> log_likelihood_ = - np.sum(emp_cov * precision) + _logdet(precision) <NEW_LINE> log_likelihood_ -= p * np.log(2 * np.pi) <NEW_LINE> log_likelihood_ /= 2. <NEW_LINE> return log_likelihood_ | Computes the sample mean of the log_likelihood under a covariance model
computes the empirical expected log-likelihood (accounting for the
normalization terms and scaling), allowing for universal comparison (beyond
this software package)
Parameters
----------
emp_cov : 2D ndarray (n_features, n_features)
Maximum ... | 625941d5925a0f43d254a099 |
def estop_cb(self, msg): <NEW_LINE> <INDENT> if not msg.recipient_id == self.identifier: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> nodes = list(map(lambda n: (n.x, n.y, 0.0), self.curr_plan.nodes)) <NEW_LINE> i = nodes.index(msg.pose.position) <NEW_LINE> self.curr_plan = self.curr_plan[:i] <NEW_LINE> self.check_es... | A peer told us to stop
Params:
msg distributed_planning.msg.Estop | 625941d54a966d76dd551232 |
def learn_spell(self, spell): <NEW_LINE> <INDENT> if spell.min_year is not None: <NEW_LINE> <INDENT> if self.current_year >= spell.min_year: <NEW_LINE> <INDENT> print(f"{self.name} now knows spell {spell.name}") <NEW_LINE> self.known_spells.add(spell) <NEW_LINE> <DEDENT> elif self.exhibits_trait('highly intelligent'): ... | Allows a pupil to learn a spell, given that he/she is old enough | 625941d524f1403a92600d86 |
def query_cfg(self, query): <NEW_LINE> <INDENT> pass | Parameters:
- query | 625941d596565a6dacc8f8ec |
def crawl_comments(self): <NEW_LINE> <INDENT> client = self.wl.authorize_app() <NEW_LINE> if client: <NEW_LINE> <INDENT> for w in self.results: <NEW_LINE> <INDENT> w['comments'] = [] <NEW_LINE> crawler = WeiboCommentsCrawler(client, weibo_mid = w['mid']) <NEW_LINE> r = crawler.crawl() <NEW_LINE> for c in r: <NEW_LINE> ... | crawl the comments after getting all the results and update the results list --> self | 625941d58e7ae83300e4b1ef |
def __cb_open_recent(self, chooser): <NEW_LINE> <INDENT> recent_item = chooser.get_current_item() <NEW_LINE> fname = recent_item.get_uri() <NEW_LINE> if recent_item.exists(): <NEW_LINE> <INDENT> self.open_project(fname.replace('file://', ''), fname) | Called when a file is chosen from the open recent dialog | 625941d56fece00bbac2d962 |
def svg_converter(svgstringin, content_type="image/png", conversiontool=CONVERSION_TOOL_INKSCAPE): <NEW_LINE> <INDENT> convertedvalstring = '' <NEW_LINE> if conversiontool == CONVERSION_TOOL_INKSCAPE: <NEW_LINE> <INDENT> convertedvalstring = __convert_via_inkscape(svgstringin, content_type) <NEW_LINE> <DEDENT> return c... | This function callse Inkscape to convert to png or pdf. Cairosvg was not mature enough to enable nice styles or
flowtext | 625941d5d8ef3951e324375f |
@pytest.mark.parametrize( "item, freq", [ ( pd.Series( data=1, index=pd.DatetimeIndex( ["2000-01-01", "2000-01-02", "2000-01-03", "2000-01-04"], freq="D" ), ), "D", ), ( pd.Series( data=1, index=pd.DatetimeIndex( ["2000-01-01", "2000-01-02", "2000-01-03", "2000-01-04"], freq=None ), ), "D", ), ( pd.Series( data=1, inde... | Tests that enforce freq infers the right frequency. | 625941d5566aa707497f4788 |
def __init__(self, topology, core_assignment): <NEW_LINE> <INDENT> if not isinstance(topology, Topology): <NEW_LINE> <INDENT> raise ValueError("topology must be a Topology object, got {}".format( type(topology))) <NEW_LINE> <DEDENT> core_assignment = np.asarray(core_assignment, dtype=np.int32) <NEW_LINE> self._topology... | Constructs a `DeviceAssignment` object.
Args:
topology: A `Topology` object that describes the physical TPU topology.
core_assignment: A logical to physical core mapping, represented as a
rank 3 numpy array. See the description of the `core_assignment`
property for more details.
Raises:
ValueError: If `... | 625941d544b2445a339322b6 |
def strip_none(value): <NEW_LINE> <INDENT> return {k: v for k, v in value.items() if v is not None} | Takes a dict and removes all keys that have `None` values, used mainly for
tidying up introspection responses. Take care not to use this on something
that might legitimately contain a `None`. | 625941d54e696a04525c966d |
def intersect_bounds(one_bound, other_bound): <NEW_LINE> <INDENT> one_w, one_s, one_e, one_n = one_bound <NEW_LINE> other_w, other_s, other_e, other_n = other_bound <NEW_LINE> int_w, int_e = intersect_intervals((one_w, one_e), (other_w, other_e)) <NEW_LINE> int_s, int_n = intersect_intervals((one_s, one_n), (other_s, o... | Intersect two bounds.
Args:
one_bound, other_bound: tuple of float
Returns:
tuple of float.
If no intersection is found, tuple of None returned. | 625941d523e79379d52ee783 |
def __init__( self, name, ip, port=None, slack_channel=None, email_addresses=[], auto_start=False ) -> None: <NEW_LINE> <INDENT> self.started = False <NEW_LINE> self._monitor_stop_flag = False <NEW_LINE> self._monitor_thread = None <NEW_LINE> self._name = name <NEW_LINE> self._ip = ip <NEW_LINE> self._port = port <NEW_... | Object constructor.
Runs at object creation.
:param name: Name of the target being monitored
:param ip: (str) IP address of the target being monitored
:param ip: (int) Port number of the target beign monitored
:param slack_channel: (str) Name of slack channel to post to, must begin with #
:param email_addresses: (list ... | 625941d523849d37ff7b32b0 |
def check_wall(self): <NEW_LINE> <INDENT> if bool(self.which('wall')): <NEW_LINE> <INDENT> debug_logger.debug('Program "wall" found') <NEW_LINE> if self.config['critical_wall_message']: <NEW_LINE> <INDENT> self.wall_critical = True <NEW_LINE> debug_logger.debug('Critical broadcasts enabled') <NEW_LINE> <DEDENT> else: <... | See if daemon can/should broadcast high usage messages via 'wall'
Does not return anything; directly changes run-time variable of
wall_critical and wall_warning. | 625941d53317a56b86939e76 |
def check_can_live_migrate_source(self, ctxt, instance_ref, dest_check_data): <NEW_LINE> <INDENT> if len(self._get_iscsi_srs(ctxt, instance_ref)) > 0: <NEW_LINE> <INDENT> if not self._is_xsm_sr_check_relaxed(): <NEW_LINE> <INDENT> raise exception.MigrationError(reason=_('XAPI supporting ' 'relax-xsm-sr-check=true requi... | Check if it's possible to execute live migration on the source side.
:param ctxt: security context
:param instance_ref: patron.db.sqlalchemy.models.Instance object
:param dest_check_data: data returned by the check on the
destination, includes block_migration flag | 625941d5d268445f265b5090 |
def __init__(self, arm, num_joints=7, num_basis=20, sigma=0.05, noise=.0001, num_samples=100, with_orientation=True, std_factor=2, path_plots='/tmp/plots'): <NEW_LINE> <INDENT> self.fk = FK(arm) <NEW_LINE> self.num_basis = num_basis <NEW_LINE> self.nrTraj = num_samples <NEW_LINE> self.with_orientation = with_orientatio... | :param arm: ID of the arm to get FK ('' if unused)
:param num_joints:
:param num_basis:
:param sigma:
:param noise:
:param num_samples:
:param with_orientation:
:param std_factor:
:param path_plots:
:return: | 625941d57d847024c06be4e0 |
@anonymous_user_required <NEW_LINE> def confirm_email(token): <NEW_LINE> <INDENT> expired, invalid, user = confirm_email_token_status(token) <NEW_LINE> if not user or invalid: <NEW_LINE> <INDENT> invalid = True <NEW_LINE> do_flash(*get_message('INVALID_CONFIRMATION_TOKEN')) <NEW_LINE> <DEDENT> if expired: <NEW_LINE> <I... | View function which handles a email confirmation request. | 625941d58da39b475bd65197 |
def get_coords_array(self): <NEW_LINE> <INDENT> results = np.zeros((len(self.keypoints), 2), np.float32) <NEW_LINE> for i, kp in enumerate(self.keypoints): <NEW_LINE> <INDENT> results[i, 0] = kp.x <NEW_LINE> results[i, 1] = kp.y <NEW_LINE> <DEDENT> return results | Convert the coordinates of all keypoints in this object to
an array of shape (N,2).
Returns
-------
result : (N, 2) ndarray
Where N is the number of keypoints. Each first value is the
x coordinate, each second value is the y coordinate. | 625941d59b70327d1c4e0ff7 |
def makeMatrix(self, transformation): <NEW_LINE> <INDENT> m = Base.Matrix() <NEW_LINE> (m.A11, m.A21, m.A31, m.A41, m.A12, m.A22, m.A32, m.A42, m.A13, m.A23, m.A33, m.A43, m.A14, m.A24, m.A34, m.A44) = transformation.toList() <NEW_LINE> return m | takes a cgkit.cgtypes.mat4, returns FreeCAD.Matrix | 625941d5a934411ee37518b5 |
def draw(self, point: Point) -> None: <NEW_LINE> <INDENT> self.points[point] = None | Draw a point on the canvas. | 625941d532920d7e50b283f3 |
def es_gemelo(self, otro_rectangulo): <NEW_LINE> <INDENT> return self.__base == otro_rectangulo.get_base and self.__altura == otro_rectangulo.get_altura | comprueba si el objeto pasado es el mismo rectangulo, o sea, tiene la misma base y altura
:param otro_rectangulo: objeto con el que comparamos el actual
:return: True o False | 625941d555399d3f055888d6 |
def rsi(s: pd.Series, n: int) -> pd.Series: <NEW_LINE> <INDENT> d1s = s.diff() <NEW_LINE> ds = d1s[1:] <NEW_LINE> up , dn = ds.copy(), ds.copy() <NEW_LINE> up[up<0] = 0 <NEW_LINE> dn[dn>0] = 0 <NEW_LINE> dn = dn.abs() <NEW_LINE> upa = pd.concat([up.rolling(window=n,min_periods=n).mean()[:n],up[n:]]) <NEW_LINE> upa = up... | Technical analysis RSI function applied to a Series, e.g. closing prices
:param s: Series to which RSI is to be applied
:param n: N period of RSI
:return: A Series with same index as s containing the RSI
Detailed pseudo code for RSI(n) calculation:
need
up[i] = max(0,px[i]-px[i-1])
dn[i] = -min(... | 625941d5dd821e528d63b3ca |
def gets_discount(x, y): <NEW_LINE> <INDENT> return (x >= 65 and y <= 12) or (y >= 65 and x <= 12) | Returns True if this is a combination of a senior citizen
and a child, False otherwise.
>>> gets_discount(65, 12)
True
>>> gets_discount(9, 70)
True
>>> gets_discount(40, 45)
False
>>> gets_discount(40, 75)
False
>>> gets_discount(65, 13)
False
>>> gets_discount(7, 9)
False
>>> gets_discount(73, 77)
False
>>> gets_dis... | 625941d501c39578d7e7505d |
def lengthOfLastWord(self, s): <NEW_LINE> <INDENT> l = 0 <NEW_LINE> for c in s[::-1]: <NEW_LINE> <INDENT> if c == " ": <NEW_LINE> <INDENT> if l != 0: <NEW_LINE> <INDENT> return l <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> l += 1 <NEW_LINE> <DEDENT> <DEDENT> return l | nothing to say, so simple question, runs in 32ms beats 100%. Just read the string backwards and if you meet an empty space, return the number if indices you have visited | 625941d5097d151d1a22307a |
def get_dataset(self): <NEW_LINE> <INDENT> trainset = datasets.CIFAR10('datasets/CIFAR10/train/', train=True, transform=self.train_transforms, target_transform=None, download=True) <NEW_LINE> valset = datasets.CIFAR10('datasets/CIFAR10/test/', train=False, transform=self.val_transforms, target_transform=None, download=... | Uses torchvision.datasets.CIFAR10 to load dataset.
Downloads dataset if doesn't exist already.
Returns:
torch.utils.data.TensorDataset: trainset, valset | 625941d545492302aab5e4e7 |
def teste_meta_verbose_name_plural(self): <NEW_LINE> <INDENT> self.assertEqual(str(Servico._meta.verbose_name_plural), 'Servicos') | Verifica se o Servico.Meta.verbose_name_plural corresponde com o nome
da classe no plural. | 625941d5ad47b63b2c50a1a1 |
def learnMac(self, port, mac): <NEW_LINE> <INDENT> if mac in self.macTable: <NEW_LINE> <INDENT> if self.macTable[mac]['port'] == port: <NEW_LINE> <INDENT> self.macTable[mac]['timestamp'] = time.time() <NEW_LINE> self.ryuapp.logger.debug("%sSDNEngine.learnMac[time-update]: %s" % (self.delta(),str(self.macTable[mac]))) <... | Installs the specified mac address into the mac address table.
@param port - the port number the mac address was seen on.
@param mac - the mac address to learn.
@return None | 625941d530c21e258bdfa6c0 |
def scanPlusMinus(self): <NEW_LINE> <INDENT> if (self.isPlusMinus(self.c)): <NEW_LINE> <INDENT> self.b.append(self.c) <NEW_LINE> self._next() <NEW_LINE> if (self.isNumeric(self.c)): <NEW_LINE> <INDENT> self.scanNumber() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.scanOperatorIdentifier() <NEW_LINE> <DEDENT> retu... | ['+', '-'] ~ (numeric|identifier) | 625941d54f6381625f114c5d |
def oldstripname(namein, allowed=""): <NEW_LINE> <INDENT> if not namein: raise NameNotSet(namein) <NEW_LINE> n = namein.replace(os.sep, '+') <NEW_LINE> n = n.replace("/", '+') <NEW_LINE> n = n.replace("@", '+') <NEW_LINE> n = n.replace("#", '-') <NEW_LINE> n = n.replace("!", '.') <NEW_LINE> res = [] <NEW_LINE> allow = ... | strip all not allowed chars from name. | 625941d55510c4643540f602 |
def test_add_copy_made_left_hand_index(self): <NEW_LINE> <INDENT> benchmark3 = Hand(namelist=["AC", "2C", "3C", "4S", "5S", "6S"]) <NEW_LINE> benchmark1 = Hand(namelist=["AH", "2C", "3C"]) <NEW_LINE> hand3 = self.hand1 + self.hand2 <NEW_LINE> self.hand1[0] = Card(name="AH") <NEW_LINE> self.assertEqual(benchmark1.index_... | Test copies are appropriately made during addition, so
that the new hand does not change when the original left
side hand changes. Use the hand index to make the change. | 625941d563d6d428bbe44711 |
def __init__(self, jobId, appKey, role, taskType, ): <NEW_LINE> <INDENT> self.jobId = jobId <NEW_LINE> self.appKey = appKey <NEW_LINE> self.role = role <NEW_LINE> self.taskType = taskType | :param jobId: 任务ID
:param appKey: 账号ID
:param role: 数据角色
:param taskType: 任务类型 | 625941d5b5575c28eb68e223 |
def center(self): <NEW_LINE> <INDENT> qr_ = self.frameGeometry() <NEW_LINE> cp_ = QDesktopWidget().availableGeometry().center() <NEW_LINE> qr_.moveCenter(cp_) <NEW_LINE> self.move(qr_.topLeft()) | "窗口中心化 | 625941d5ac7a0e7691ed42eb |
def render_embedded_html(options, styles, stencils, mxgraph_path, own_path): <NEW_LINE> <INDENT> from PyQt5.QtCore import QFile <NEW_LINE> html_file = QFile(own_path + '/graph.html') <NEW_LINE> from PyQt5.QtCore import QIODevice <NEW_LINE> if not html_file.open(QIODevice.ReadOnly | QIODevice.Text): <NEW_LINE> <INDENT> ... | Renders an HTML that is able to load graph drawing widget page embedded
in a Qt widget.
:param GraphOptions options: Options of graph drawing widget.
:param GraphStyles styles: Styles available in graph drawing widget.
:param iterable[str] stencils: Stencils available in graph drawing
widget.
:param str mxgraph_pa... | 625941d5baa26c4b54cb1340 |
def integrate_temperature_dry(self, t_top): <NEW_LINE> <INDENT> interp_grada = interp1d(self.p, self.grada) <NEW_LINE> def dtdp(p, t): <NEW_LINE> <INDENT> return t / p * interp_grada(p) <NEW_LINE> <DEDENT> p_eval = self.p[self.kcore:][::-1] <NEW_LINE> sol = solve_ivp(dtdp, (p_eval[0], p_eval[-1]), np.array([t_top]), t_... | just do simple integration of dry adiabat from surface
t_top :: temperature at atm top (1 or 10 bars) | 625941d5d164cc6175782f70 |
def set_zone_letter(self, latitude): <NEW_LINE> <INDENT> if -80 <= latitude <= 84: <NEW_LINE> <INDENT> letter = 'CDEFGHJKLMNPQRSTUVWX' <NEW_LINE> index = int(latitude / 8 + 10) <NEW_LINE> if index == 20: <NEW_LINE> <INDENT> index = 19 <NEW_LINE> <DEDENT> self.zone_letter = letter[index] <NEW_LINE> <DEDENT> else: <NEW_L... | Determines the letter of a point's grid zone designation using the logic in chapters 2 and 3.
:param latitude: float, latitude of point in decimal degrees | 625941d529b78933be1e58cb |
def load_module(self, path, squash=True): <NEW_LINE> <INDENT> config_obj = load(path) <NEW_LINE> obj = {key: getattr(config_obj, key) for key in dir(config_obj) if key.isupper()} <NEW_LINE> if squash: <NEW_LINE> <INDENT> self.load_dict(obj) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.update(obj) <NEW_LINE> <DEDE... | Load values from a Python module.
Example modue ``config.py``::
DEBUG = True
SQLITE = {
"db": ":memory:"
}
>>> c = ConfigDict()
>>> c.load_module('config')
{DEBUG: True, 'SQLITE.DB': 'memory'}
>>> c.load_module("config", False)
{'DEBUG': True, 'SQLITE': {'DB': 'memory'}}
:param squash: If true (... | 625941d5eab8aa0e5d26dd7a |
def gen_pred(model, indices, inp): <NEW_LINE> <INDENT> preds = model.predict(inp) <NEW_LINE> print(np.argmax(preds)) <NEW_LINE> for k,v in indices.items(): <NEW_LINE> <INDENT> print(k) <NEW_LINE> if v == np.argmax(preds): <NEW_LINE> <INDENT> print(k) <NEW_LINE> new_inp = np.roll(inp, -1, 1) <NEW_LINE> new_inp[0][-1] =... | this method generates sentences character by character from the model | 625941d5167d2b6e31218db7 |
def _qcpy(deckin, qin, qout, arg: Threadargs, markdone=True, **kwargs) -> Tuple[int, int]: <NEW_LINE> <INDENT> TL.qcarg = arg <NEW_LINE> TL.countin = 0 <NEW_LINE> TL.countout = 0 <NEW_LINE> TL.deck = deckin <NEW_LINE> TL.markdone = markdone <NEW_LINE> TL.qin = qin <NEW_LINE> TL.qout = qout <NEW_LINE> TL.run = True <NEW... | _qcpy(deckin, qin, qout, arg):
if markdone is True, then the entries from the joinablequeue are marked done when removed
from qin and placed in the deck. If false, these entries are marked done when moved from
the deck into qout.
returns a tuple with [0] being the number read from qin, and [1] number copied to the o... | 625941d563b5f9789fde7307 |
def svm_loss_naive(W, X, y, reg): <NEW_LINE> <INDENT> dW = np.zeros(W.shape) <NEW_LINE> num_classes = W.shape[1] <NEW_LINE> num_train = X.shape[0] <NEW_LINE> loss = 0.0 <NEW_LINE> for i in xrange(num_train): <NEW_LINE> <INDENT> scores = X[i].dot(W) <NEW_LINE> correct_class_score = scores[y[i]] <NEW_LINE> classes_not_wi... | Structured SVM loss function, naive implementation (with loops).
Inputs have dimension D, there are C classes, and we operate on minibatches
of N examples.
Inputs:
- W: A numpy array of shape (D, C) containing weights.
- X: A numpy array of shape (N, D) containing a minibatch of data.
- y: A numpy array of shape (N,)... | 625941d5e8904600ed9f2151 |
def getKeysToAdd(): <NEW_LINE> <INDENT> return (('SiteAreas','KeywordIndex',{'indexed_attrs': 'SiteAreas', }), ('getSiteAreas','KeywordIndex',{'indexed_attrs': 'getSiteAreas', }),) | @author: andrea cecchi
@summary: returns a tuple of keys that should be added to portal_catalog | 625941d5090684286d50ef09 |
def read_memory(self, address, size): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.model.read_memory(address, size) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> logger.exception("Error reading memory") | On a read, we will use our model to return an appropriate value
:param address:
:param size:
:return: | 625941d501c39578d7e7505e |
def score(self, params, full=False): <NEW_LINE> <INDENT> lnalpha = params[-1] <NEW_LINE> params = params[:-1] <NEW_LINE> a1 = np.exp(lnalpha)**-1 <NEW_LINE> y = self.endog[:,None] <NEW_LINE> exog = self.exog <NEW_LINE> mu = np.exp(np.dot(exog,params))[:,None] <NEW_LINE> dparams = exog*a1 * (y-mu)/(mu+a1) <NEW_LINE> da1... | Score vector for NB2 model | 625941d556ac1b37e62643ef |
def resolveKindList(self, compilationUnit, reporter, mark, l): <NEW_LINE> <INDENT> kindAcc = 'Any' <NEW_LINE> for kind in l: <NEW_LINE> <INDENT> newKindAcc = compilationUnit.kindTree.narrow(kindAcc, kind) <NEW_LINE> if (newKindAcc): <NEW_LINE> <INDENT> kindAcc = newKindAcc <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ... | Resolve a list of annotaions by narrowing.
Takes a generous approach,
- starts with 'Any' and narrows.
- ignores un-narrowable annotations | 625941d5187af65679ca5341 |
def ensure_tuple(obj): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return tuple() <NEW_LINE> <DEDENT> if isinstance(obj, Sequence) and not isinstance(obj, six.string_types): <NEW_LINE> <INDENT> return tuple(obj) <NEW_LINE> <DEDENT> return obj, | Try and make the given argument into a tuple. | 625941d5a8370b7717052ac1 |
@api_view(['GET']) <NEW_LINE> def look_ones_answers(request, **kwargs): <NEW_LINE> <INDENT> user_id = kwargs.get('id') <NEW_LINE> if user_id: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(id=user_id) <NEW_LINE> <DEDENT> except User.DoesNotExist: <NEW_LINE> <INDENT> return Response(status=HTTP_400... | 查看某个用户所有回答,默认查看自己 | 625941d5435de62698dfde6f |
def check_type_forward(self, in_types): <NEW_LINE> <INDENT> pass | Checks types of input data before forward propagation.
Before :meth:`forward` is called, this function is called.
You need to validate types of input data in this function
using :ref:`the type checking utilities <type-check-utils>`.
Args:
in_types (~chainer.utils.type_check.TypeInfoTuple): The type
inform... | 625941d5eab8aa0e5d26dd7b |
def IsValid(self): <NEW_LINE> <INDENT> return _lldb.SBEvent_IsValid(self) | IsValid(self) -> bool | 625941d507f4c71912b116a6 |
def write_file(self, file_name, vasp4_compatible=False): <NEW_LINE> <INDENT> def _print_fortran_float(f): <NEW_LINE> <INDENT> s = "{:.10E}".format(f) <NEW_LINE> if f >= 0: <NEW_LINE> <INDENT> return "0." + s[0] + s[2:12] + 'E' + "{:+03}".format(int(s[13:]) + 1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "-." ... | Write the VolumetricData object to a vasp compatible file.
Args:
file_name (str): Path to a file
vasp4_compatible (bool): True if the format is vasp4 compatible | 625941d563b5f9789fde7308 |
@handle_request(r'swapid\ "(?P<tlid1>\d+)"\ "(?P<tlid2>\d+)"$') <NEW_LINE> def swapid(context, tlid1, tlid2): <NEW_LINE> <INDENT> tlid1 = int(tlid1) <NEW_LINE> tlid2 = int(tlid2) <NEW_LINE> tl_tracks1 = context.core.tracklist.filter(tlid=[tlid1]).get() <NEW_LINE> tl_tracks2 = context.core.tracklist.filter(tlid=[tlid2])... | *musicpd.org, current playlist section:*
``swapid {SONG1} {SONG2}``
Swaps the positions of ``SONG1`` and ``SONG2`` (both song ids). | 625941d54d74a7450ccd43e6 |
def bagDownload(request, identifier): <NEW_LINE> <INDENT> proxyRoot = request.build_absolute_uri('/') <NEW_LINE> get_object_or_404(Bag, name__exact=identifier) <NEW_LINE> try: <NEW_LINE> <INDENT> transList = generateBagFiles(identifier, proxyRoot, settings.CODA_PROXY_MODE) <NEW_LINE> <DEDENT> except FileHandleError: <N... | Return a downloadable bag zipped file. | 625941d57047854f462a162a |
@paper.route('/paperStatic/<conference_id>', methods=['GET', 'POST']) <NEW_LINE> def paperStatic(conference_id): <NEW_LINE> <INDENT> static = [] <NEW_LINE> try: <NEW_LINE> <INDENT> resultofAll = selectFromDB(["id"], {"conferenceID": conference_id}, "contribution") <NEW_LINE> resultofdeny = selectFromDB(["id"], {"confer... | This function enable the users to know the static of a conference like how many papers are allowed to join the conference.
param:
conference_id: the conference id whose all papers will be downloaded.
return:
a list of results like [12,12,12,12]
the first the num of the papers
the second is the num of t... | 625941d5442bda511e8be638 |
def _do_bind_generic(self, blob, init_state, opcode_dict): <NEW_LINE> <INDENT> s = init_state <NEW_LINE> seg = self.binary.segments[s.segment_index] <NEW_LINE> s.seg_end_address = seg.vaddr + seg.memsize <NEW_LINE> end = len(blob) <NEW_LINE> while not s.done and s.index < end: <NEW_LINE> <INDENT> l.debug("Current addre... | Does the actual binding work. Represents a generic framework for interpreting binding opcodes
:param blob: blob of binding opcodes
:param init_state: Initial BindingState
:param opcode_dict: Dictionary opcode=> handler
:return: resulting binding state | 625941d53317a56b86939e77 |
def check_if_busy(busy_times, time_to_check): <NEW_LINE> <INDENT> return any( [start_time <= time_to_check <= end_time for start_time, end_time in busy_times] ) | Checks if I am busy at a given time. Returns True if busy, False if free. | 625941d544b2445a339322b7 |
@cli.command() <NEW_LINE> @click.option( "-i", "--image-path", help="Path to the image capturing the timestamp", type=click.Path(exists=True, dir_okay=False, resolve_path=True), required=True, ) <NEW_LINE> @click.option( "-t", "--timestamp", help="Enter the timestamp value in the offset_calc photograph. This value over... | Calculate the difference between machine times.
This value is used to tell the renaming script how much to offset the timestamps.
:param image_path:
:param timestamp:
:param year:
:param month:
:param day:
:param hour:
:param minute:
:param second:
:param microsecond:
:return: | 625941d55fdd1c0f98dc0456 |
def post(self): <NEW_LINE> <INDENT> username = self.request.get('username') <NEW_LINE> channelname = self.request.get('channel') <NEW_LINE> usernameerror = "" <NEW_LINE> if not username: <NEW_LINE> <INDENT> usernameerror="Please enter a username" <NEW_LINE> <DEDENT> elif not re.compile(r'^[a-zA-Z0-9_-]{3,20}$').match(u... | Displays chat UI | 625941d5cc0a2c11143dd0b3 |
def create_url_clicked(app_log, command, recipient, amount, operation, openfield): <NEW_LINE> <INDENT> result = create_url(app_log, command, recipient, amount, operation, openfield) <NEW_LINE> url_r.delete(0, END) <NEW_LINE> url_r.insert(0, result) | isolated function so no GUI leftovers are in bisurl.py | 625941d596565a6dacc8f8ed |
def get_default_config_hash(read_func=read_file): <NEW_LINE> <INDENT> content = get_config_contents(VSFTPD_DEFAULT_CONFIG_PATH, read_func=read_func) <NEW_LINE> if content is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> content = content.encode(encoding='utf-8') <NEW_LINE> h = hashlib.sha1(content) <NEW_LIN... | Read the default vsftpd configuration file (/etc/vsftpd/vsftpd.conf) and return its hash.
:param read_func: Function to use to read the file. This is meant to be overriden in tests.
:return SHA1 hash of the configuration file, or None if the file could not be read. | 625941d55510c4643540f603 |
def check_outputs(self): <NEW_LINE> <INDENT> for key, fnames in OUTFILES.items(): <NEW_LINE> <INDENT> tdir = os.path.join(TARGETDIR, key) <NEW_LINE> odir = os.path.join(OUTDIR, key) <NEW_LINE> for fname in fnames: <NEW_LINE> <INDENT> with open(os.path.join(odir, fname), "r") as ofh: <NEW_LINE> <INDENT> with open(os.pat... | Test whether the output files are the same, when run. | 625941d5b545ff76a8914038 |
def decorator(func): <NEW_LINE> <INDENT> msg = "{0} is deprecated since version {1}".format( func.__name__, version) <NEW_LINE> if func.__doc__ is None: <NEW_LINE> <INDENT> func.__doc__ = '' <NEW_LINE> indent = 4 * ' ' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> indent = _get_doc_margin(func.__doc__) * ' ' <NEW_LINE>... | The @deprecated decorator with deprecation information | 625941d599fddb7c1c9de5b3 |
def get_public_ip(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = get('http://checkip.dyndns.com/', verify=False).text <NEW_LINE> if data: <NEW_LINE> <INDENT> return re.compile(r'Address: (\d+\.\d+\.\d+\.\d+)') .search(data) .group(1) <NEW_LINE> <DEDENT> <DEDEN... | Get public IP.
:return str: | 625941d5498bea3a759b9cd1 |
def generate_monomials(order): <NEW_LINE> <INDENT> monoms = [] <NEW_LINE> x, y, z = sympy.symbols('x y z') <NEW_LINE> for i in range(0, order + 1): <NEW_LINE> <INDENT> for j in range(0, order + 1): <NEW_LINE> <INDENT> for k in range(0, order + 1): <NEW_LINE> <INDENT> if i + j + k <= order: <NEW_LINE> <INDENT> monoms.ap... | Generate trivariate monomials up to given order. | 625941d5fbf16365ca6f63e8 |
def testCreateOutputRequest(self): <NEW_LINE> <INDENT> model = graylog.models.create_output_request.CreateOutputRequest() | Test CreateOutputRequest | 625941d576e4537e8c351896 |
def set_default_boot_policy(filename): <NEW_LINE> <INDENT> title = get_default_title() <NEW_LINE> return set_boot_policy(title, filename) | Set the boot policy in the default title to the given name. | 625941d592d797404e3043ad |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.