code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def _sample_predictive(self, session=None, test_x=None, return_stats=False, is_discarded=False, **kwargs): <NEW_LINE> <INDENT> pass | Draws a new sample from the model posterior predictive. | 625941cf8e7ae83300e4b12b |
def test_cannot_login_unregistered_user(self): <NEW_LINE> <INDENT> self.user = {"user": { "email": "xxxxhn@doe.com", "password": "Passwo8urd@123" }} <NEW_LINE> response = self.client.post( reverse("authentication:login"), self.user, format="json" ) <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_400_BAD_R... | This function tests whether an unregistered user can login | 625941cf0383005118ecf740 |
def keys(self): <NEW_LINE> <INDENT> return self._order[:] | See `IOrderedContainer`.
>>> oc = OrderedContainer()
>>> oc.keys()
[]
>>> oc['foo'] = 'bar'
>>> oc.keys()
['foo']
>>> oc['baz'] = 'quux'
>>> oc.keys()
['foo', 'baz']
>>> int(len(oc._order) == len(oc._data))
1 | 625941cf4c3428357757c486 |
def chrput(a): <NEW_LINE> <INDENT> _; a('CHRPUT') <NEW_LINE> _; a.remark ('Put a character in the text work area and advance') <NEW_LINE> _; a.remark ('the work area pointer. A = char to put') <NEW_LINE> _; a(pha) <NEW_LINE> _; a(phy) <NEW_LINE> _; a.remark ('IZY dummy index') <NEW_LINE... | Put a character in the text work area and advance the work area pointer.
* Parameter: A = Character to put | 625941cf8a349b6b435e82d2 |
def allocate_fully_specified_segment(self, context, **raw_segment): <NEW_LINE> <INDENT> network_type = self.get_type() <NEW_LINE> session, ctx_manager = self._get_session(context) <NEW_LINE> raw_segment = dict((k, raw_segment[k]) for k in self.primary_keys) <NEW_LINE> try: <NEW_LINE> <INDENT> with ctx_manager: <NEW_LIN... | Allocate segment fully specified by raw_segment.
If segment exists, then try to allocate it and return db object
If segment does not exists, then try to create it and return db object
If allocation/creation failed, then return None | 625941cf6fb2d068a760f1fc |
def ListComp(xp, fp, it, test=None): <NEW_LINE> <INDENT> xp.set_prefix("") <NEW_LINE> fp.set_prefix(" ") <NEW_LINE> it.set_prefix(" ") <NEW_LINE> for_leaf = Leaf(token.NAME, "for") <NEW_LINE> for_leaf.set_prefix(" ") <NEW_LINE> in_leaf = Leaf(token.NAME, "in") <NEW_LINE> in_leaf.set_prefix(" ") <NEW_LINE> inner_args = ... | A list comprehension of the form [xp for fp in it if test].
If test is None, the "if test" part is omitted. | 625941cf76d4e153a657ec8f |
def check_correctness_expression(expression): <NEW_LINE> <INDENT> AVAILABLE_CHARACTERS = '0123456789-+*/e,.' <NEW_LINE> UNAVAILABLE_CHARACTER_COMBINATIONS = ['**', '//', '--', '++', ',,', '..'] <NEW_LINE> if type(expression) is not str: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if len(expression) > 100: <NEW... | Check the correctness of expression.
:param string expression: expression to check (for example: '5+5')
:return boolean: check result (for example: True) | 625941cfd58c6744b4257dbe |
def __init__(self, stdout, stderr, configuration, crashData=None): <NEW_LINE> <INDENT> CrashInfo.__init__(self) <NEW_LINE> if stdout is not None: <NEW_LINE> <INDENT> self.rawStdout.extend(stdout) <NEW_LINE> <DEDENT> if stderr is not None: <NEW_LINE> <INDENT> self.rawStderr.extend(stderr) <NEW_LINE> <DEDENT> if crashDat... | Private constructor, called by L{CrashInfo.fromRawCrashData}. Do not use directly. | 625941cf5fdd1c0f98dc0392 |
def sage_formatargspec(args, varargs=None, varkw=None, defaults=None, kwonlyargs=(), kwonlydefaults={}, annotations={}, formatarg=str, formatvarargs=lambda name: '*' + name, formatvarkw=lambda name: '**' + name, formatvalue=lambda value: '=' + repr(value), formatreturns=lambda text: ' -> ' + text, formatannotation=form... | Format an argument spec from the values returned by getfullargspec.
The first seven arguments are (args, varargs, varkw, defaults,
kwonlyargs, kwonlydefaults, annotations). The other five arguments
are the corresponding optional formatting functions that are called to
turn names and values into strings. The last arg... | 625941cfe5267d203edcddfb |
def match(self, regex): <NEW_LINE> <INDENT> return bool(get_regex(regex)(self.to_string())) | See if the keycmd string matches the given regex. | 625941cf4a966d76dd55116e |
def getContent(self): <NEW_LINE> <INDENT> raise RuntimeError('Implement method.') | Implement this method to create a Translator. | 625941cf5fcc89381b1e181e |
def GetTypeInfoCount(self,pcTInfo): <NEW_LINE> <INDENT> pass | GetTypeInfoCount(self: _CustomAttributeBuilder) -> UInt32
Retrieves the number of type information interfaces that an object provides (either 0 or 1). | 625941cf38b623060ff0af4c |
def Backupusercode(*args): <NEW_LINE> <INDENT> return _ollyapi2.Backupusercode(*args) | Backupusercode(t_module pm, int force) | 625941cfd18da76e23532635 |
def contourf( histo, *args, **kwargs ): <NEW_LINE> <INDENT> axes = kwargs.pop("axes", None) <NEW_LINE> volume = kwargs.pop("volume", False) <NEW_LINE> useEdgeX = kwargs.pop("useEdgeX", None) <NEW_LINE> useEdgeY = kwargs.pop("useEdgeY", None) <NEW_LINE> height = ( lambda b : b.contentH ) if volume else ( lambda b : b.co... | Wrapper around axes.contourf for TH2, replacement for ROOT's CONT option
Bin centers (or edges, if specified with useEdge(X|Y)="lower" or "upper") and heights are taken from the histogram,
and fill the X, Y and Z arguments of contourf, any other arguments are passed on to contourf.
If the "volume" option is set to Tru... | 625941cf9c8ee82313fbb8d4 |
def __init__(self, y_target=None, batch_size=1, confidence=0, learning_rate=5e-3, binary_search_steps=5, max_iterations=1000, abort_early=True, initial_const=1e-2, clip_min=-1, clip_max=+1, sample=1): <NEW_LINE> <INDENT> self.y_target = y_target <NEW_LINE> self.confidence = confidence <NEW_LINE> self.learning_rate = le... | :param y_target: (optional) A tensor with the target labels for a
targeted attack.
:param confidence: Confidence of adversarial examples: higher produces
examples with larger l2 distortion, but more
strongly classified as adversarial.
:param batch_size: Number of attacks ... | 625941cf23e79379d52ee6c2 |
def copyPartOfStringInfoFrom2(self, *args): <NEW_LINE> <INDENT> return _MEDCalculator.DataArray_copyPartOfStringInfoFrom2(self, *args) | copyPartOfStringInfoFrom2(self, ivec compoIds, DataArray other)
copyPartOfStringInfoFrom2(self, PyObject li, DataArray other)
1 | 625941cfadb09d7d5db6c8ee |
def test_removing_id(self): <NEW_LINE> <INDENT> doc = Document(self.db) <NEW_LINE> doc['_id'] = 'julia006' <NEW_LINE> del doc['_id'] <NEW_LINE> self.assertIsNone(doc.get('_id')) | Ensure that proper processing occurs when removing the _id | 625941cf6fece00bbac2d89d |
def testGetManager(self): <NEW_LINE> <INDENT> self.assertEquals([], Acspy.Servants.ContainerServices.getManager().get_component_info()) | Mock Manager returned empty component list | 625941cff548e778e58cd6dc |
def authenticate_participant_old(request: HttpRequest, uuid: str, next_view: str='contact_details') -> HttpResponse: <NEW_LINE> <INDENT> if not uuid: <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> clean_session(request) <NEW_LINE> participant = get_object_or_404(models.Participant.objects.all(), secret_key=uuid)... | Old insecure authentication of participant. Just expire link and send new authentication url. | 625941cffb3f5b602dac37f2 |
def topview_example2(): <NEW_LINE> <INDENT> x_range, y_range, z_range, scale = (-50, 50), (-50, 50), (-4, 4), 10 <NEW_LINE> size = (int((max(y_range) - min(y_range)) * scale), int((max(x_range) - min(x_range)) * scale)) <NEW_LINE> velo2 = KITTI_Util(frame='all', velo_path=velo_path) <NEW_LINE> topview = velo2.velo_2_to... | save video about velodyne dataset converted to topview image | 625941cf379a373c97cfaca4 |
def run_style_transfer(self, style_weight=500, content_weight=5, iterations=1000): <NEW_LINE> <INDENT> print('Building the style transfer model..') <NEW_LINE> self.create_white_noise() <NEW_LINE> model, style_losses, content_losses, tv_losses = self.get_style_model_and_losses(self.model_dict, self.style_img, self.conte... | Run the style transfer. | 625941cfbd1bec0571d9078e |
def read_obj_file(filename): <NEW_LINE> <INDENT> data, vertices, faces = [], [], [] <NEW_LINE> with open(filename) as f: <NEW_LINE> <INDENT> for i, line in enumerate(f): <NEW_LINE> <INDENT> data.append(line) <NEW_LINE> words = line.split() <NEW_LINE> if len(words) > 0: <NEW_LINE> <INDENT> if words[0] == 'v': <NEW_LINE>... | Read an .obj file and returns the whole file, as well as the list of vertices, and faces.
Args:
filename (str): path to the obj file
Returns:
list[str]: each line in the file
np.array[N,3]: list of vertices, where each vertex is a 3D position
list[list[M]]: list of faces, where each face is a list of ... | 625941cfd10714528d5ffe43 |
def findShortestSubArray(self, nums): <NEW_LINE> <INDENT> nums_count, nums_begin, nums_end = {}, {}, {} <NEW_LINE> for index in range(len(nums)): <NEW_LINE> <INDENT> if nums[index] not in nums_count: <NEW_LINE> <INDENT> nums_count[nums[index]] = 1 <NEW_LINE> nums_begin[nums[index]] = index <NEW_LINE> <DEDENT> else: <NE... | :type nums: List[int]
:rtype: int | 625941cf91f36d47f21ac652 |
def ship_size(battlefield, cell, is_convert=False): <NEW_LINE> <INDENT> if is_convert: <NEW_LINE> <INDENT> cell = (cell[1], convert(cell[0])) <NEW_LINE> <DEDENT> if battlefield[cell] is not None: <NEW_LINE> <INDENT> counter = 1 <NEW_LINE> coordinates = set() <NEW_LINE> coordinates.add(cell) <NEW_LINE> directions = set(... | dict(tuple(int, int),
(str, int) or (int, int),
bool -> (int, set((int, int)))
returns a length of the ship, a part of which is located in cell cell
and set of coordinates of all the parts of this ship
if there is not ship in this cell, returns (0, 0)
is_convert variable determines format of cell:
1) if is_conve... | 625941cf7047854f462a1568 |
def find_num_peaks_window(ind_w1, ind_w2, ind_w3, ind_w4, ind_w5): <NEW_LINE> <INDENT> return len(ind_w1), len(ind_w2), len(ind_w3), len(ind_w4), len(ind_w5) | Computes number of peaks in each window
Args:
ind_w1 (ndarray): Indices of voltage peaks in window 1
ind_w2 (ndarray): Indices of voltage peaks in window 2
ind_w3 (ndarray): Indices of voltage peaks in window 3
ind_w4 (ndarray): Indices of voltage peaks in window 4
ind_w5 (ndarray): Indices of volt... | 625941cf0383005118ecf741 |
def filesnotin(self, m2, match=None): <NEW_LINE> <INDENT> if match: <NEW_LINE> <INDENT> m1 = self.matches(match) <NEW_LINE> m2 = m2.matches(match) <NEW_LINE> return m1.filesnotin(m2) <NEW_LINE> <DEDENT> files = set() <NEW_LINE> def _filesnotin(t1, t2): <NEW_LINE> <INDENT> if t1._node == t2._node and not t1._dirty and n... | Set of files in this manifest that are not in the other | 625941cff9cc0f698b14075a |
def begin(self, vccstate=SSD1306_SWITCHCAPVCC): <NEW_LINE> <INDENT> self._vccstate = vccstate <NEW_LINE> self.reset() <NEW_LINE> self._initialize() <NEW_LINE> self.command(SSD1306_DISPLAYON) | Initialize display. | 625941cfa934411ee37517f2 |
def fisher(r): <NEW_LINE> <INDENT> return 0.5 * np.log((1 + r) / (1 - r)) | Parameters
----------
r
Returns
------- | 625941cfa8ecb033257d322c |
def text2wordfreq(string, lowercase=False): <NEW_LINE> <INDENT> tokens = tokenize(string,lowercase) <NEW_LINE> hist = {} <NEW_LINE> for key in tokens: <NEW_LINE> <INDENT> if key in hist: <NEW_LINE> <INDENT> hist[key] += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> hist[key] = 1 <NEW_LINE> <DEDENT> <DEDENT> return hi... | Calculate word frequencies for a text written in English.
Handling of hyphenation and contractions is left to your discretion.
Your function should make use of the `tokenize` function above.
Args:
string (str): A string containing English.
lowercase (bool, optional): Convert words to lowercase before calcula... | 625941cf3c8af77a43ae38ff |
def making_forms_dictionary(lemma, word): <NEW_LINE> <INDENT> if lemma not in LEMMAS_DIC.keys(): <NEW_LINE> <INDENT> LEMMAS_DIC[lemma] = [word] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if word not in LEMMAS_DIC[lemma]: <NEW_LINE> <INDENT> LEMMAS_DIC[lemma].append(word) | MAking the dictionary of all word forms | 625941cfd7e4931a7ee9e07d |
@app.route('/get-photo/', methods = ['GET']) <NEW_LINE> def get_photo(): <NEW_LINE> <INDENT> if request.method == 'POST': <NEW_LINE> <INDENT> return make_response(400) <NEW_LINE> <DEDENT> clear_old_photos() <NEW_LINE> id = request.args.get('id') <NEW_LINE> photo = get_photo_from_id(id) <NEW_LINE> returnobj = {} <NEW_LI... | GET request gets the photo associated with an id and returns an object
containing the photo's location, id, original width, original height, whether
or not it is raw, any notes, and the time that it will expire at. | 625941cfc4546d3d9de72b94 |
def make_stdev_plot(mvals, n, b): <NEW_LINE> <INDENT> std_of_means = np.vectorize(lambda x: np.std(mean_unif_samp(x, n))) <NEW_LINE> stds = std_of_means(mvals) <NEW_LINE> m_expect = np.logspace(0,3,200) <NEW_LINE> std_expect = std_of_mean_unif(m_expect) <NEW_LINE> plt.plot(mvals, stds, 'ko') <NEW_LINE> plt.plot(m_expec... | Compute std of means for various values of m
Plot against expected standard deviation as a function of m | 625941cf287bf620b61d3bc2 |
def _make_dep_adj_matrices(self): <NEW_LINE> <INDENT> for config in self.configs: <NEW_LINE> <INDENT> links = [(x.gov, x.dep) for x in config.links] <NEW_LINE> idx = {x: i for i, x in enumerate(self.words_so_far)} <NEW_LINE> curradj = np.zeros((len(self.words_so_far), len(self.words_so_far))) <NEW_LINE> for l in links:... | Creates an adjacency matrix where element adj[i,j] is one if the
i-th word is the governor of the j-th word and zero otherwise. | 625941cfe8904600ed9f208c |
def private_get_open_orders_by_instrument_get_with_http_info(self, instrument_name, **kwargs): <NEW_LINE> <INDENT> local_var_params = locals() <NEW_LINE> all_params = ['instrument_name', 'type'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append... | Retrieves list of user's open orders within given Instrument. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.private_get_open_orders_by_instrument_get_with_http_info(instrument_name, async_req=True)
>>> result = t... | 625941cf656771135c3eb9ce |
def calcEquation(self, equations, values, queries): <NEW_LINE> <INDENT> res = [] <NEW_LINE> parent = {} <NEW_LINE> weight = {} <NEW_LINE> ufind = UnionFind(parent, weight) <NEW_LINE> for i, edge in enumerate(equations): <NEW_LINE> <INDENT> x1, x2 = edge[0], edge[1] <NEW_LINE> val = values[i] <NEW_LINE> if x1 not in par... | :type equations: List[List[str]]
:type values: List[float]
:type queries: List[List[str]]
:rtype: List[float] | 625941cf30c21e258bdfa5fd |
def test_wait_time_limit_reached(self): <NEW_LINE> <INDENT> self.rate_limit = RateLimit(resource='test', client='localhost', max_requests=10, expire=1) <NEW_LINE> self._make_10_requests() <NEW_LINE> with self.assertRaises(TooManyRequests): <NEW_LINE> <INDENT> with self.rate_limit: <NEW_LINE> <INDENT> pass <NEW_LINE> <D... | Should report wait time approximately equal to expire after reaching
the limit without delay between requests. | 625941cff548e778e58cd6dd |
def name(self): <NEW_LINE> <INDENT> return self.tr('Networks') | Returns the provider name, which is used to describe the provider
within the GUI.
This string should be short (e.g. "Lastools") and localised. | 625941cf7d43ff24873a2dff |
def assert_pickle(test, obj, value_to_compare=lambda x: x.__dict__, T=None): <NEW_LINE> <INDENT> metaclass = type(type(obj)) <NEW_LINE> if T == Expression: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> f = BytesIO() <NEW_LINE> pickle.dump(obj, f) <NEW_LINE> f.seek(0) <NEW_LINE> obj_again = pi... | Asserts that an object can be dumped and loaded and still maintain its
value.
Args:
test: Instance of `unittest.TestCase` (for assertions).
obj: Obj to dump and then load.
value_to_compare: (optional) Value to extract from the object to
compare. By default, compares dictionaries.
T: (optional) ... | 625941cf97e22403b379d0f9 |
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 | 625941cf50812a4eaa59c480 |
def get_config(self): <NEW_LINE> <INDENT> config = {'stride': self.stride, 'kernel_size': self.kernel_size} <NEW_LINE> base_config = super(ReflectionPadding2D, self).get_config() <NEW_LINE> return dict(list(base_config.items()) + list(config.items())) | Returns the config of the layer.
A layer config is a Python dictionary (serializable) containing the configuration of a
layer. The same layer can be reinstated later (without its trained weights) from this
configuration.
The configuration of a layer does not include connectivity information, nor the layer
class name.... | 625941cf7b25080760e395b8 |
def value(self, ob, c_in, h_in): <NEW_LINE> <INDENT> sess = tf.get_default_session() <NEW_LINE> return sess.run(self.vf, {self.x: [ob], self.c_in: c_in, self.h_in: h_in})[0] | Runs the value function. | 625941cf50485f2cf553cef9 |
def test_validate_resource_path_none(self) -> None: <NEW_LINE> <INDENT> with local_app.app_context(): <NEW_LINE> <INDENT> self.assertRaises(Exception, get_notification_html, notification_type=NotificationType.OWNER_REMOVED, options={'resource_name': 'testtable'}, sender='test@test.com') | Test Exception is raised if resource_path is None
:return: | 625941cf30bbd722463cbf25 |
def S(s=1 / 2): <NEW_LINE> <INDENT> return I(s), X(s), Y(s), Z(s) | Spin matrices (S_0, S_x, S_y, S_z)
Args
---
s:
integer or half integer
Returns
---
Tuple[np.ndarray]:
S_0, S_x, S_y, S_z matrices | 625941cfb545ff76a8913f75 |
def is_env_var_to_ignore(n): <NEW_LINE> <INDENT> return ('VERSIONER' in n or '__CF' in n or n == 'LD_PRELOAD' or n.startswith('SANDBOX') or n == 'LC_CTYPE') | Determine if an environment variable is under our control. | 625941cff7d966606f6aa164 |
def directly_linked_movie(actor, goal_actor, actor_dict, movie_dict): <NEW_LINE> <INDENT> for movie in actor_dict[actor]: <NEW_LINE> <INDENT> if goal_actor in movie_dict[movie]: <NEW_LINE> <INDENT> return movie | Return the movie (a string) which directly links 'actor' (string to
'goal_actor' (string), from dictionaries: 'actor_dict' and 'movie_dict'.
Return None if no common movie is found. | 625941cf9f2886367277a9ec |
def searchMatrix(self, matrix, target): <NEW_LINE> <INDENT> if matrix is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> if target > matrix[-1][-1]: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> height, width = len(matrix), len(matrix[0]) <NEW_LINE> i, j = 0, width - 1 <NEW_LINE> while i < height or j... | :type matrix: List[List[int]]
:type target: int
:rtype: bool | 625941cf7c178a314d6ef5c0 |
def test_metamodel_provider_advanced_test3_diamond(): <NEW_LINE> <INDENT> this_folder = dirname(abspath(__file__)) <NEW_LINE> def get_meta_model(provider, grammar_file_name): <NEW_LINE> <INDENT> mm = metamodel_from_file(join(this_folder, grammar_file_name), debug=False, classes=[Cls, Obj]) <NEW_LINE> mm.register_scope_... | More complicated model (see test above): here we have a
diamond shared dependency. It is also checked that
the parsers are correctly cloned. | 625941cf796e427e537b0726 |
def spatial_batchnorm_forward(x, gamma, beta, bn_param): <NEW_LINE> <INDENT> out, cache = None, None <NEW_LINE> pass <NEW_LINE> N,C,H,W=x.shape <NEW_LINE> x_re=x.reshape(N*H*W,C) <NEW_LINE> out,cache=batchnorm_forward(x_re, gamma, beta, bn_param) <NEW_LINE> out=out.reshape(N,C,H,W) <NEW_LINE> return out, cache | Computes the forward pass for spatial batch normalization.
Inputs:
- x: Input data of shape (N, C, H, W)
- gamma: Scale parameter, of shape (C,)
- beta: Shift parameter, of shape (C,)
- bn_param: Dictionary with the following keys:
- mode: 'train' or 'test'; required
- eps: Constant for numeric stability
- momen... | 625941cf9c8ee82313fbb8d5 |
def vector_source_i_make(*args, **kwargs): <NEW_LINE> <INDENT> return _blocks_swig1.vector_source_i_make(*args, **kwargs) | vector_source_i_make(std::vector< int,std::allocator< int > > const & data, bool repeat=False, int vlen=1,
tags_vector_t tags=std::vector< gr::tag_t >()) -> vector_source_i_sptr
Source that streams int items based on the input vector.
This block produces a stream of samples based on an input vector. In C++, thi... | 625941cf38b623060ff0af4d |
def run_crawl(): <NEW_LINE> <INDENT> crawler_setting = Settings() <NEW_LINE> crawler_setting.setmodule(my_setting) <NEW_LINE> process = CrawlerProcess(settings=crawler_setting) <NEW_LINE> process.crawl(MsuziOptCrawlSpider) <NEW_LINE> process.start() | Run crawler | 625941cfb830903b967e9a6a |
def _get_commute_key_list(self) -> List[List[Key]]: <NEW_LINE> <INDENT> start_index = 0 <NEW_LINE> key_index_list = [] <NEW_LINE> commute_key_index = namedtuple("index", ("start_index", "end_index")) <NEW_LINE> while start_index < len(self._key): <NEW_LINE> <INDENT> end_index = start_index <NEW_LINE> while end_index + ... | Split list of keys to list of lists of commute keys. | 625941cfad47b63b2c50a0df |
def nucleus_sampling(data, p, replace=0, ascending=False, above=True): <NEW_LINE> <INDENT> sorted_data, sorted_indices = torch.sort(data, descending=not ascending) <NEW_LINE> cum_probas = torch.cumsum(F.softmax(sorted_data, dim=-1), dim=-1) <NEW_LINE> if replace is None: <NEW_LINE> <INDENT> if above: <NEW_LINE> <INDENT... | :param tensor data: Input data
:param float p: Probability for filtering (or be replaced)
:param float replace: Default value is 0. If value is provided, input data will be replaced by this value
if data match criteria.
:param bool ascending: Return ascending order or descending order. Sorting will be executed if r... | 625941cf50485f2cf553cefa |
def iqr(df: DataFrame, col: int) -> tuple: <NEW_LINE> <INDENT> q1 = df.iloc[:, col].quantile(0.25) <NEW_LINE> q3 = df.iloc[:, col].quantile(0.75) <NEW_LINE> return q1, q3, q3 - q1 | Compute Interquartile Range (IQR)
:param DataFrame df: dataframe with target data
:param int col: column where to look for data
:return: Q1, Q3, and IQR | 625941cf2c8b7c6e89b35920 |
def get_input_tree(self): <NEW_LINE> <INDENT> return [{"name": "datatype", "type": IndependentComponents, "label": "Independent component analysis:", "required": True}, {"name": "i_svar", "type": 'int', 'default': 0, "label": "Index of state variable (defaults to first state variable)",}, {"name": "i_mode", "type": 'in... | Inform caller of the data we need | 625941cfa934411ee37517f3 |
def saveh5(dict_file, target_path): <NEW_LINE> <INDENT> with h5py.File(target_path, "w") as h5file: <NEW_LINE> <INDENT> if isinstance(dict_file, list): <NEW_LINE> <INDENT> for i, d in enumerate(dict_file): <NEW_LINE> <INDENT> newdict = {"dict" + str(i): d} <NEW_LINE> writeh5(newdict, h5file) <NEW_LINE> <DEDENT> <DEDENT... | Save dictionary as h5 file
Args:
dict_file (dict): dictionary to save
target_path (str): target path string | 625941cf4d74a7450ccd4323 |
def _get_subscriber(self): <NEW_LINE> <INDENT> pub_sub_driver = df_utils.load_driver( cfg.CONF.df.pub_sub_driver, df_utils.DF_PUBSUB_DRIVER_NAMESPACE) <NEW_LINE> return pub_sub_driver.get_subscriber() | Return the subscriber for inter-process communication. If multi-proc
communication is not use (i.e. disabled from config), return None. | 625941cf4a966d76dd55116f |
def only_for(version): <NEW_LINE> <INDENT> return unittest.skipIf( sys.version < version, "This test requires at least {0} version of Python.".format(version), ) | Should be used as a decorator for a unittest.TestCase test method | 625941cf5fcc89381b1e181f |
def __init__(self, train_size): <NEW_LINE> <INDENT> self.conv1 = Cconv2d([train_size, 28, 28, 1], 5, 32, name="conv1", exname="") <NEW_LINE> self.relu1 = Crelu(self.conv1.outputShape, name="relu1", exname="conv1") <NEW_LINE> self.pool1 = Cpool(self.relu1.shape, name="pool1", exname="relu1") <NEW_LINE> self.conv2 = Ccon... | The Model definition. | 625941cf45492302aab5e423 |
def complete_multipart_upload(self, key, upload_id, parts, headers=None): <NEW_LINE> <INDENT> headers = http.CaseInsensitiveDict(headers) <NEW_LINE> parts = sorted(parts, key=lambda p: p.part_number) <NEW_LINE> data = xml_utils.to_complete_upload_request(parts) <NEW_LINE> logger.debug("Start to complete multipart uploa... | 完成分片上传,创建文件。
:param str key: 待上传的文件名,这个文件名要和 :func:`init_multipart_upload` 的文件名一致。
:param str upload_id: 分片上传ID
:param parts: PartInfo列表。PartInfo中的part_number和etag是必填项。其中的etag可以从 :func:`upload_part` 的返回值中得到。
:type parts: list of `PartInfo <oss2.models.PartInfo>`
:param headers: HTTP头部
:type headers: 可以是dict,建议是oss2.... | 625941cf4e4d5625662d4537 |
@tf_export('create_tree_variable') <NEW_LINE> def create_tree_variable(tree_handle, tree_config, params, name=None): <NEW_LINE> <INDENT> _ctx = _context._context <NEW_LINE> if _ctx is None or not _ctx._eager_context.is_eager: <NEW_LINE> <INDENT> params = _execute.make_str(params, "params") <NEW_LINE> _, _, _op = _op_de... | Creates a tree model and returns a handle to it.
Args:
tree_handle: A `Tensor` of type `resource`.
handle to the tree resource to be created.
tree_config: A `Tensor` of type `string`. Serialized proto of the tree.
params: A `string`. A serialized TensorForestParams proto.
name: A name for the operation (o... | 625941cff8510a7c17cf985b |
def testConstructor1(self): <NEW_LINE> <INDENT> self.failUnless(isinstance(self.array3, Array.ArrayZ)) | Test ArrayZ length constructor | 625941cf507cdc57c6306e3b |
def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(DfuseTestBase, self).__init__(*args, **kwargs) <NEW_LINE> self.dfuse = None | Initialize a TestWithServers object. | 625941cf8c0ade5d55d3eb1b |
def predict(self, test_data): <NEW_LINE> <INDENT> _outputs = [] <NEW_LINE> classifier_input_set = [] <NEW_LINE> self.rc_helper.reset() <NEW_LINE> for _input, _output in test_data: <NEW_LINE> <INDENT> rc_output = self.rc_helper.run_input(_input) <NEW_LINE> classifier_input = rc_output.flattened_states <NEW_LINE> classif... | The input consists of data:
temporal_data =
[
(input, output),
(input, output)
]
or:
non_temporal_data =
[
(input, output)
]
:param training_data:
:return: | 625941cf15fb5d323cde0c70 |
def db_insert(func): <NEW_LINE> <INDENT> import config <NEW_LINE> if not config.playback: <NEW_LINE> <INDENT> return func <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> def inner(*args, **kwargs): <NEW_LINE> <INDENT> def execute(): <NEW_LINE> <INDENT> return func(*args, **kwargs) <NEW_LINE> <DEDENT> db.append(execute) <... | Decorator that causes the modified function call to be stored instead of
evaluated. | 625941d0cdde0d52a9e53194 |
def is_valid_move(self, move: str) -> bool: <NEW_LINE> <INDENT> for i in self.get_possible_moves(): <NEW_LINE> <INDENT> if move == i: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False | Returns whether or not move is valid in the current state. | 625941d0cb5e8a47e48b7c09 |
def testD07CertificationRevocation(self): <NEW_LINE> <INDENT> key_d = read_test_file(['pgpfiles','key','DSAELG2.revoked_uid.gpg']) <NEW_LINE> pkts = list_pkts(key_d) <NEW_LINE> keymsg = list_msgs(pkts)[0] <NEW_LINE> primary_key, uid, revoker = pkts[0], pkts[3], pkts[4] <NEW_LINE> verified = verify(revoker, uid, primary... | crypto.signature: verify() certification revocation | 625941d030bbd722463cbf26 |
def __init__(self, text: str = None, placeholderText: str = None, extension: tuple = None, parent=None): <NEW_LINE> <INDENT> super(DropQLineEdit, self).__init__(text, parent) <NEW_LINE> self.extension = extension <NEW_LINE> self.setAcceptDrops(True) <NEW_LINE> self.setPlaceholderText(placeholderText) | 拖拽文件到文本框内
:param text: 默认的文本
:param placeholderText: 提示文本
:param extension: 拖入文件后缀名筛选
:param parent: 父控件 | 625941d0f8510a7c17cf985c |
@contextmanager <NEW_LINE> def mockedUserProxyError(*_args, **_kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> yield S_ERROR() <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> pass | Context manager to replace the UserProxy context manager. | 625941d0a17c0f6771cbe1b0 |
@commit_on_success <NEW_LINE> def list_received_resources(log, conf): <NEW_LINE> <INDENT> z = Zookeeper(handle=conf.handle, disable_signal_handlers=True) <NEW_LINE> pdus = z.call_rpkid(list_received_resources_elt.make_pdu(self_handle=conf.handle)) <NEW_LINE> if pdus is None: <NEW_LINE> <INDENT> print >>log, 'error: cal... | Query rpkid for this resource handle's received resources.
The semantics are to clear the entire table and populate with the list of
certs received. Other models should not reference the table directly with
foreign keys. | 625941d094891a1f4081bc0a |
def test_create_file_A1(self): <NEW_LINE> <INDENT> filename = self.got_filename <NEW_LINE> workbook = Workbook(filename) <NEW_LINE> worksheet = workbook.add_worksheet() <NEW_LINE> worksheet.set_column('A:A', 12) <NEW_LINE> format1 = workbook.add_format({'num_format': 20}) <NEW_LINE> format2 = workbook.add_format({'num_... | Test dates and times in A1 notation. | 625941d099cbb53fe6792d46 |
def test_basic_dewpoint_rh(): <NEW_LINE> <INDENT> temp = np.array([30., 25., 10., 20., 25.]) * units.degC <NEW_LINE> rh = np.array([30., 45., 55., 80., 85.]) / 100. <NEW_LINE> real_td = np.array([11, 12, 1, 16, 22]) * units.degC <NEW_LINE> assert_array_almost_equal(real_td, dewpoint_rh(temp, rh), 0) | Test dewpoint_rh function. | 625941d0a79ad161976cc2a5 |
def strict_quotient(self): <NEW_LINE> <INDENT> if "_strict_quotient" not in self.__dict__: <NEW_LINE> <INDENT> if self.is_strictly_convex(): <NEW_LINE> <INDENT> self._strict_quotient = self <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> L = self.lattice() <NEW_LINE> Q = L.base_extend(QQ) / self.linear_subspace() <NEW_LI... | Return the quotient of ``self`` by the linear subspace.
We define the **strict quotient** of a cone to be the image of this
cone in the quotient of the ambient space by the linear subspace of
the cone, i.e. it is the "complementary part" to the linear subspace.
OUTPUT:
- cone.
EXAMPLES::
sage: halfplane = Cone... | 625941d015baa723493c40d6 |
def _expand_target_deps(target_id, targets, root_targets=None): <NEW_LINE> <INDENT> target = targets[target_id] <NEW_LINE> if target.expanded_deps is not None: <NEW_LINE> <INDENT> return target.expanded_deps <NEW_LINE> <DEDENT> if root_targets is None: <NEW_LINE> <INDENT> root_targets = set() <NEW_LINE> <DEDENT> root_t... | _expand_target_deps.
Return all targets depended by target_id directly and/or indirectly.
We need the parameter root_target_id to check loopy dependency. | 625941d092d797404e3042ea |
def CMDverify(parser, args): <NEW_LINE> <INDENT> (options, args) = parser.parse_args(args) <NEW_LINE> client = GClient.LoadCurrentConfig(options) <NEW_LINE> if not client: <NEW_LINE> <INDENT> raise gclient_utils.Error('client not configured; see \'gclient config\'') <NEW_LINE> <DEDENT> client.RunOnDeps(None, []) <NEW_L... | Verifies the DEPS file deps are only from allowed_hosts. | 625941d0566aa707497f46c8 |
def set_person_spreads(db, const, pe, person): <NEW_LINE> <INDENT> employee_person_spreads = [int(const.Spread(x)) for x in cereconf.EMPLOYEE_PERSON_SPREADS] <NEW_LINE> affs = list(pe.get_affiliations()) <NEW_LINE> is_ansatt = False <NEW_LINE> for aff in affs: <NEW_LINE> <INDENT> if aff['affiliation'] == int(const.affi... | Apply person spreads to employee object.
Add ansatt spreads if person has ANSATT affiliation and has a
stillingsandel higher than cereconf.EMPLOYEE_PERSON_SPREADS_PERCENTAGE.
Spreads to add are listed in cereconf.EMPLOYEE_PERSON_SPREADS
:param pe: A populated Cerebrum.Person object to apply spreads to
:param person: ... | 625941d00383005118ecf742 |
def searchlongestpath(self,Name1,Name2): <NEW_LINE> <INDENT> self.resetDijkstra(self._Nodes,False) <NEW_LINE> Node1 = self.searchnode(Name1) <NEW_LINE> Node2 = self.searchnode(Name2) <NEW_LINE> self.Dijkstra(Node1,False) <NEW_LINE> return Node2.path | Función para buscar el camino más largo entre dos nodos
Autor: Marcelo Truque
Entrada: Nombre del nodo fuente y el nodo destino para el camino más largo
Salida: Path más largo entre los nodos insertados
| 625941d056ac1b37e626432e |
def predicted_orders( daily_order_summary: pd.DataFrame, order_forecast_model: Tuple[float, float] ) -> pd.DataFrame: <NEW_LINE> <INDENT> a, b = order_forecast_model <NEW_LINE> start_date = daily_order_summary.order_date.max() <NEW_LINE> future_dates = pd.date_range(start=start_date, end=start_date + pd.DateOffset(days... | Predicted orders for the next 30 days based on the fit paramters | 625941d04c3428357757c488 |
def test_OverbookedError_9(self): <NEW_LINE> <INDENT> kwargs = copy.copy(self.kwargs) <NEW_LINE> kwargs["resource"] = self.test_resource2 <NEW_LINE> kwargs["start"] = datetime.datetime(2013, 3, 22, 4, 0, tzinfo=pytz.utc) + datetime.timedelta(20) <NEW_LINE> kwargs["duration"] = datetime.timedelta(5... | testing if no OverBookedError will be raised when the resource is
not already booked for the given time period.
Simple case diagram:
#######
####### | 625941d076d4e153a657ec91 |
def unpack(self, ud, destdir, d): <NEW_LINE> <INDENT> subdir = ud.parm.get("subpath", "") <NEW_LINE> if subdir != "": <NEW_LINE> <INDENT> readpathspec = ":%s" % (subdir) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> readpathspec = "" <NEW_LINE> <DEDENT> destdir = os.path.join(destdir, "git/") <NEW_LINE> if os.path.exis... | unpack the downloaded src to destdir | 625941d0851cf427c661a66e |
def test_stop(self): <NEW_LINE> <INDENT> pass | TODO strictly one-line summary
TODO Detailed multi-line description if
necessary.
Args:
arg1 (type1): TODO describe arg, valid values, etc.
arg2 (type2): TODO describe arg, valid values, etc.
arg3 (type3): TODO describe arg, valid values, etc.
Returns:
TODO describe the return type and details
Raises:... | 625941d05510c4643540f543 |
def plot(self): <NEW_LINE> <INDENT> plt.figure() <NEW_LINE> plt.plot(self.test_predict, self.Y_test, 'r.', label = 'test') <NEW_LINE> plt.plot(self.train_predict, self.Y_train, 'b.', label = 'train') <NEW_LINE> max_label = max(self.Y) <NEW_LINE> min_label = min(self.Y) <NEW_LINE> plt.plot([min_label,max_label], [min_la... | Plot for predict vs. true label.
| 625941d0d58c6744b4257dc0 |
def saveProxiedWebdir(ad): <NEW_LINE> <INDENT> task = ad['CRAB_ReqName'] <NEW_LINE> host = ad['CRAB_RestHost'] <NEW_LINE> uri = ad['CRAB_RestURInoAPI'] + '/task' <NEW_LINE> cert = ad['X509UserProxy'] <NEW_LINE> res = getProxiedWebDir(task, host, uri, cert, logFunction=printLog) <NEW_LINE> if res: <NEW_LINE> <INDENT> wi... | The function queries the REST interface to get the proxied webdir and sets
a classad so that we report this to the dashboard instead of the regular URL
The proxied_url (if exist) is written to a file named proxied_webdir so that
prejobs can read it and report to dashboard. If the url does not exist
(i.e.: schedd not a... | 625941d0aad79263cf390ba2 |
def _add_column_kwargs(self, kwargs, column): <NEW_LINE> <INDENT> if hasattr(column, "nullable"): <NEW_LINE> <INDENT> if column.nullable: <NEW_LINE> <INDENT> kwargs["allow_none"] = True <NEW_LINE> <DEDENT> kwargs["required"] = not column.nullable and not _has_default(column) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT... | Add keyword arguments to kwargs (in-place) based on the passed in
`Column <sqlalchemy.schema.Column>`. | 625941d0cb5e8a47e48b7c0a |
def replaceShape_xx(object, type, size): <NEW_LINE> <INDENT> controls = '' <NEW_LINE> if type == 'circle': <NEW_LINE> <INDENT> controls = cmds.circle(nr=[1, 0, 0], d=3, r=size) <NEW_LINE> <DEDENT> if type == 'box': <NEW_LINE> <INDENT> controls = cmds.curve(d=1, p=( [size, size, size], [-size, size, size], [-size, size,... | controlShape('RLleft_toe1','box',1) | 625941d03346ee7daa2b2ecc |
def list( self, resource_group_name, **kwargs ): <NEW_LINE> <INDENT> cls = kwargs.pop('cls', None) <NEW_LINE> error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } <NEW_LINE> error_map.update(kwargs.pop('error_map', {})) <NEW_LINE> api_version = "2020-04-01" <NEW_LINE> acc... | Gets all public IP addresses in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PublicIPAddressListResult or the result of c... | 625941d0d18da76e23532637 |
def del_credential(acc_name): <NEW_LINE> <INDENT> Credential.del_credential(acc_name) | Function to delete a credential | 625941d08e71fb1e9831d909 |
def print_queue(self): <NEW_LINE> <INDENT> if self.is_empty(): <NEW_LINE> <INDENT> print("空队列") <NEW_LINE> return <NEW_LINE> <DEDENT> for i in self.__queue: <NEW_LINE> <INDENT> if i == self.__queue[-1]: <NEW_LINE> <INDENT> print(i) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print(i,end="->") | 打印队列中的元素,从前到后
:return: | 625941d08c0ade5d55d3eb1c |
def to_axis_angle(self): <NEW_LINE> <INDENT> q = self <NEW_LINE> if q.a.is_negative: <NEW_LINE> <INDENT> q = q * -1 <NEW_LINE> <DEDENT> q = q.normalize() <NEW_LINE> angle = trigsimp(2 * acos(q.a)) <NEW_LINE> s = sqrt(1 - q.a*q.a) <NEW_LINE> x = trigsimp(q.b / s) <NEW_LINE> y = trigsimp(q.c / s) <NEW_LINE> z = trigsimp(... | Returns the axis and angle of rotation of a quaternion
Returns
=======
tuple
Tuple of (axis, angle)
Examples
========
>>> from sympy.algebras.quaternion import Quaternion
>>> q = Quaternion(1, 1, 1, 1)
>>> (axis, angle) = q.to_axis_angle()
>>> axis
(sqrt(3)/3, sqrt(3)/3, sqrt(3)/3)
>>> angle
2*pi/3 | 625941d0ff9c53063f47c354 |
def get_number_aliens_x(ai_settings, alien_width): <NEW_LINE> <INDENT> available_space_x = ai_settings.screen_width - 2 * alien_width <NEW_LINE> number_aliens_x = available_space_x // (2 * alien_width) <NEW_LINE> return number_aliens_x | Determine the number of aliens that would fit in a row | 625941d01f037a2d8b94635e |
def deleteNode(self, node): <NEW_LINE> <INDENT> if not node: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not node.next: <NEW_LINE> <INDENT> del node <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> temp = node.next <NEW_LINE> node.val = temp.val <NEW_LINE> node.next = temp.next <NEW_LINE> del temp <NEW_LINE> <DEDENT... | :type node: ListNode
:rtype: void Do not return anything, modify node in-place instead. | 625941d0009cb60464c63512 |
def context(request): <NEW_LINE> <INDENT> return Context({'url_name': request.resolver_match.url_name}) | Provides a base context | 625941d0adb09d7d5db6c8f0 |
def aspc(filename): <NEW_LINE> <INDENT> n_num, m_num = [int(num) for num in open(filename).read().split()[:2]] <NEW_LINE> combsum = 0 <NEW_LINE> for i in range(m_num, n_num+1): <NEW_LINE> <INDENT> combsum += no_combinations(n_num, i) <NEW_LINE> <DEDENT> print(int(combsum) % 1000000) | Read the numbers and calculate the number of combinations | 625941d06fece00bbac2d89f |
def cast_lightning(*args, **kwargs): <NEW_LINE> <INDENT> caster = args[0] <NEW_LINE> entities = kwargs.get('entities') <NEW_LINE> fov_map = kwargs.get('fov_map') <NEW_LINE> damage = kwargs.get('damage') <NEW_LINE> maximum_range = kwargs.get('maximum_range') <NEW_LINE> results = [] <NEW_LINE> target = None <NEW_LINE> cl... | Lightning scroll. | 625941d023e79379d52ee6c4 |
def check_list_cols_in_df(dframe, cols_to_exclude=None): <NEW_LINE> <INDENT> cols_to_exclude_from_explode = cols_to_exclude if cols_to_exclude is not None else [] <NEW_LINE> all_dtypes = (dframe.applymap(type) == list).all() <NEW_LINE> cols_incl_lists = all_dtypes.index[all_dtypes].tolist() <NEW_LINE> list_cols = [i fo... | helper function for commercetool data normalization
:param dframe: dataframe for which we need to check whether there are any list cols. If so we return a tuple: (True, list_cols)
:param cols_to_exclude: since this function is used to determine which cols to explode (only columns that contain lists must be "exploded"),... | 625941d0293b9510aa2c33f6 |
def getflagvalue(file,split): <NEW_LINE> <INDENT> with open(file) as f: <NEW_LINE> <INDENT> for i in np.arange(11): <NEW_LINE> <INDENT> f.readline() <NEW_LINE> <DEDENT> flag = f.readline().split(split)[0] <NEW_LINE> return float(flag) | gets flag values for representing bad data within the file
Parameters
----------
arg1: file
filename
Returns
-------
flag: float of the dataflag | 625941d0bd1bec0571d90790 |
def get_identity(self): <NEW_LINE> <INDENT> return GetIdentity(*self.ipcon.send_request(self, BrickletIsolator.FUNCTION_GET_IDENTITY, (), '', '8s 8s c 3B 3B H')) | Returns the UID, the UID where the Bricklet is connected to,
the position, the hardware and firmware version as well as the
device identifier.
The position can be 'a', 'b', 'c' or 'd'.
The device identifier numbers can be found :ref:`here <device_identifier>`.
|device_identifier_constant| | 625941d0091ae356686670be |
def add_wcs_nosip_keywords(hdu, img_size): <NEW_LINE> <INDENT> hdu.header.extend([('WCSAXES', 2, 'Number of coordinate axes'), ('CRPIX1', img_size/2, 'Pixel coordinate of reference point'), ('CRPIX2', img_size/2, 'Pixel coordinate of reference point'), ('PC1_1', -1.666667e-05, 'Coordinate transformation matrix element'... | Adds example wcs keywords without sip distortions to the given header.
Center coordinate is: 150.1163213, 2.200973097 | 625941d092d797404e3042eb |
def isValid(self, s): <NEW_LINE> <INDENT> stack, dicts = [], {'(': ')', ')': '(', '{': '}', '}': '{', '[': ']', ']': '['} <NEW_LINE> for ss in s: <NEW_LINE> <INDENT> if len(stack) == 0: <NEW_LINE> <INDENT> stack.append(ss) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> stack.pop() if dicts[ss] == stack[-1] else stack.ap... | :type s: str
:rtype: bool | 625941d0bde94217f3682f51 |
def _handle_requests(context): <NEW_LINE> <INDENT> sync_socket = context.socket(REQ) <NEW_LINE> sync_socket.connect(_SYNC_ENDPOINT) <NEW_LINE> requests_socket = context.socket(REP) <NEW_LINE> requests_socket.connect(_REQUEST_ENDPOINT) <NEW_LINE> _LOG.debug("Synchronizing worker") <NEW_LINE> sync_socket.send(b"") <NEW_L... | This is supposed to run as a background thread.
It listens for translation requests and answers them until a message is
arrived on the sync socket, whereupon the function (thread) ends.
:type context: zmq.Context | 625941d091f36d47f21ac654 |
def _delete_from(self, canvas): <NEW_LINE> <INDENT> def delete(): <NEW_LINE> <INDENT> self._erase_current_parts(canvas) <NEW_LINE> self._live = False <NEW_LINE> <DEDENT> delete() <NEW_LINE> return Action(delete, lambda: self.redraw(canvas), 'delete drawable parts') | Deletes the parts of this drawable from the given |canvas|.
Returns an Action corresponding to the delete. | 625941d04e696a04525c95ac |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.