code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def getTreatmentVars(self): <NEW_LINE> <INDENT> return list(self.treatmentVars) | return a list of the treatment variables that can be modified | 625941e34e4d5625662d47bc |
def p_orelse_elif_with_orelse(self, p): <NEW_LINE> <INDENT> lineno, colno = self.prod_loc(p) <NEW_LINE> p[0] = [If(p[2], p[4], p[5], lineno=lineno, colno=colno)] | if_orelse : ELIF expr COLON suite if_orelse | 625941e307f4c71912b1186e |
def check_need_rc(seq, is_minus): <NEW_LINE> <INDENT> if is_minus: <NEW_LINE> <INDENT> seq = get_seqrc(seq) <NEW_LINE> <DEDENT> return seq.upper() | :param seq:
:param is_minus:
:return: | 625941e3293b9510aa2c367c |
def test_group_in_degree_centrality(self): <NEW_LINE> <INDENT> G = nx.DiGraph() <NEW_LINE> G.add_nodes_from([1, 2, 3, 4, 5, 6, 7, 8]) <NEW_LINE> G.add_edges_from( [(1, 2), (1, 3), (1, 6), (1, 7), (1, 8), (2, 3), (2, 4), (2, 5)] ) <NEW_LINE> d = nx.group_in_degree_centrality(G, [1, 2]) <NEW_LINE> d_answer = 0 <NEW_LINE>... | Group in-degree centrality in a DiGraph | 625941e30a50d4780f66727f |
def get_batch(self, data, bucket_id): <NEW_LINE> <INDENT> encoder_size, decoder_size = self.buckets[bucket_id] <NEW_LINE> encoder_inputs, decoder_inputs = [], [] <NEW_LINE> for _ in range(self.batch_size): <NEW_LINE> <INDENT> encoder_input, decoder_input = random.choice(data[bucket_id]) <NEW_LINE> encoder_pad = [PAD_ID... | Get a random batch of data from the specified bucket, prepare for step.
To feed data in step(..) it must be a list of batch-major vectors, while
data here contains single length-major cases. So the main logic of this
function is to re-index data cases to be in the proper format for feeding.
Args:
data: a tuple of siz... | 625941e3090684286d50f0d5 |
def do(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.udp: <NEW_LINE> <INDENT> current_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.getprotobyname("icmp")) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> current_socket = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.getprotobyname... | Send one ICMP ECHO_REQUEST and receive the response until self.timeout | 625941e315fb5d323cde0efe |
def topKMetric(results, top=10, cutoff=0): <NEW_LINE> <INDENT> topK = 0.0 <NEW_LINE> total = 0.0 <NEW_LINE> missed = np.repeat(0,len(label_words)).tolist() <NEW_LINE> correct = np.repeat(0, len(label_words)).tolist() <NEW_LINE> for ind in range(0, results[2].shape[0]): <NEW_LINE> <INDENT> contain, ones = topKVec(result... | Function: Compute the top K Metric
Arguments
results: batch output from testOnBatch
top: your choice of K in the top K probabilities
cutoff: % criteria that is required in the top K probabilities to be considered a success
Return: Top K metric, pandas dataframe showing correction and miss rate of each lab... | 625941e3b5575c28eb68e3ee |
def Recuperer_info_carte (self): <NEW_LINE> <INDENT> for info in self.root.findall('BoardInfo'): <NEW_LINE> <INDENT> self.reference = info.find('Model').text <NEW_LINE> self.ofSn = info.find('SerialNo').text <NEW_LINE> self.sn = self.ofSn[len(self.ofSn)-4:] <NEW_LINE> self.of = self.ofSn[:-5] | Méthode pour la récuperation des informations carte contenue dans le xml:
Référence = <Model>
SN = <SerialNo>
OF = <SerialNo | 625941e36fece00bbac2db2d |
@pytest.mark.skipif( 'CI' in os.environ, reason='Not really a test. This just measures the combined trades view query', ) <NEW_LINE> @pytest.mark.parametrize('start_with_valid_premium', [False, True]) <NEW_LINE> def test_measure_trades_api_query(rotkehlchen_api_server, start_with_valid_premium): <NEW_LINE> <INDENT> tra... | Measures the response time of the combined trades view API query.
This is required since it's quite a complicated query and takes a lot of time to process
so we can use this test to measure any potential optimizations. | 625941e332920d7e50b285bd |
def store_map(img, map_name, map_data): <NEW_LINE> <INDENT> import numpy as N <NEW_LINE> filename = get_name(img, map_name) <NEW_LINE> outfile = open(filename, 'wb') <NEW_LINE> N.save(outfile, map_data) <NEW_LINE> outfile.close() | Caches a map to disk. | 625941e3d486a94d0b98e531 |
def _createReplyTemplate(self, request, resource): <NEW_LINE> <INDENT> msg = CoapMessage() <NEW_LINE> msg.address = request.address <NEW_LINE> msg.tokenLength = request.tokenLength <NEW_LINE> msg.token = request.token <NEW_LINE> msg.codeClass = resource.resultClass <NEW_LINE> msg.codeDetail = r... | Creates a reply message with common code for any reply
:returns: CoapMessage Created reply | 625941e399cbb53fe6792fcf |
def show(self): <NEW_LINE> <INDENT> self.surface.fill(self.color) <NEW_LINE> self.add_text() | Displays the box and information. | 625941e367a9b606de4a82a1 |
def add_device(self, device_name, device_class, collector='localhost'): <NEW_LINE> <INDENT> log.info('Adding %s', device_name) <NEW_LINE> data = dict(deviceName=device_name, deviceClass=device_class, model=True, collector=collector) <NEW_LINE> return self.__router_request('DeviceRouter', 'addDevice', [data]) | Add a device.
| 625941e34e4d5625662d47bd |
def _process_all_summary_view(self, limit): <NEW_LINE> <INDENT> src_key = 'all_summary_view' <NEW_LINE> if self.test_mode: <NEW_LINE> <INDENT> graph = self.testgraph <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> graph = self.graph <NEW_LINE> <DEDENT> model = Model(graph) <NEW_LINE> line_num = 0 <NEW_LINE> raw = '/'.joi... | Here, we get the allele definitions: id, label, description, type
We also add the id to this source's global idhash for lookup later
<alleleid> a OWL:NamedIndividual
rdfs:label "allele symbol"
dc:description "long allele name"
:param limit:
:return: | 625941e3d164cc6175783139 |
def getMeans(self, pars=None): <NEW_LINE> <INDENT> if self.means is None: <NEW_LINE> <INDENT> self.setMeans() <NEW_LINE> <DEDENT> if pars is None: <NEW_LINE> <INDENT> return self.means <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return np.array([self.means[i] for i in pars]) | Gets the parameter means, from saved array if previously calculated.
:param pars: optional list of parameter indices to return means for
:return: numpy array of parameter means | 625941e3091ae35668667341 |
def get_record_info(record_type) -> Dict[str, Any]: <NEW_LINE> <INDENT> if record_type is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> if record_type == 'base': <NEW_LINE> <INDENT> cls = caproto.server.records.RecordFieldGroup <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cls = caproto.server.records.recor... | Get information from a given record type. | 625941e3442bda511e8be7fd |
def rotate(self, clockwise=True): <NEW_LINE> <INDENT> if clockwise: <NEW_LINE> <INDENT> rot_vector = (1,-1) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> rot_vector = (-1,1) <NEW_LINE> <DEDENT> zero = self.coordinates[0] <NEW_LINE> for i, coord in enumerate(self.coordinates): <NEW_LINE> <INDENT> x_old = coord[0] - zero... | Rotate 90 degrees of arc
If `clockwise=True`, rotate clockwise, if `False` then rotate
counter-clockwise. | 625941e326238365f5f0f25e |
def test_init_db_command(runner, monkeypatch): <NEW_LINE> <INDENT> class Recorder(object): <NEW_LINE> <INDENT> called = False <NEW_LINE> <DEDENT> def fake_init_db(): <NEW_LINE> <INDENT> Recorder.called = True <NEW_LINE> <DEDENT> monkeypatch.setattr('flaskr.db.init_db', fake_init_db) <NEW_LINE> result = runner.invoke(ar... | Tests whether (fake_)init_db is called with init-db command (initialise databse).
Uses monkeypatch fixture to call fake_int_db function instead of init_db, and
result of whether it's called is recorded into the Recorder object. | 625941e3b830903b967e9cf1 |
def nice_axis_limits(v): <NEW_LINE> <INDENT> vmin = np.amin(v) <NEW_LINE> vmax = np.amax(v) <NEW_LINE> exponent, remainder = divmod(math.log10(vmax - vmin), 1) <NEW_LINE> if remainder < 0.5: <NEW_LINE> <INDENT> exponent -= 1 <NEW_LINE> <DEDENT> scale = 10**(-exponent) <NEW_LINE> vmin = math.floor(scale*vmin)/scale <NEW... | Sets limits according to data. | 625941e3460517430c394565 |
def setFormat(self, value): <NEW_LINE> <INDENT> self.setContentType(value) | cmf/backward compat: ignore setFormat | 625941e3009cb60464c63799 |
def AddSweep1(rail, shapes, closed=False): <NEW_LINE> <INDENT> rail = rhutil.coercecurve(rail, -1, True) <NEW_LINE> shapes = [rhutil.coercecurve(shape, -1, True) for shape in shapes] <NEW_LINE> tolerance = scriptcontext.doc.ModelAbsoluteTolerance <NEW_LINE> breps = Rhino.Geometry.Brep.CreateFromSweep(rail, shapes, clos... | Adds a surface created through profile curves that define the surface
shape and one curve that defines a surface edge.
Parameters:
rail = identifier of the rail curve
shapes = one or more cross section shape curves
closed[opt] = If True, then create a closed surface
Returns:
List of new surface objects if succe... | 625941e3ff9c53063f47c5dc |
def do_task(data): <NEW_LINE> <INDENT> print(u'[' + time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) + u'] 执行任务 > ' + data['taskGuid']) <NEW_LINE> d = {} <NEW_LINE> upload = [] <NEW_LINE> try: <NEW_LINE> <INDENT> for on_task in data["requestList"]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> method = on... | 处理任务 | 625941e3d6c5a10208144439 |
def upgrade_settings(self, setting_values, variable_revision_number, module_name, from_matlab): <NEW_LINE> <INDENT> if from_matlab and variable_revision_number == 2: <NEW_LINE> <INDENT> setting_values = [setting_values[0], cps.NO, "None" ] <NEW_LINE> variable_revision_number = 1 <NEW_LINE> from_matlab = False <NEW_LINE... | Account for prior versions when loading
We handle Matlab revision # 2 here. We don't support thresholding
because it was generally unused. The first setting is the image name. | 625941e30a366e3fb873ec08 |
def print_dot(docgraph): <NEW_LINE> <INDENT> stripped_graph = preprocess_for_pydot(docgraph) <NEW_LINE> return nx.drawing.nx_pydot.to_pydot(stripped_graph).to_string() | converts a document graph into a dot file and returns it as a string.
If this function call is prepended by %dotstr,
it will display the given document graph as a dot/graphviz graph
in the currently running IPython notebook session.
To use this function, the gvmagic IPython notebook extension
needs to be installed on... | 625941e356b00c62f0f14a46 |
def test_renderer_no_data_exception(): <NEW_LINE> <INDENT> exc = RendererNoDataException() <NEW_LINE> with pytest.raises(RendererNoDataException): <NEW_LINE> <INDENT> raise exc <NEW_LINE> <DEDENT> assert text_type(exc) | Test `prewikka.renderer.RendererNoDataException` exception. | 625941e3ad47b63b2c50a369 |
def is_exact(self): <NEW_LINE> <INDENT> return False | Returns whether this p-adic ring is exact, i.e. False.
INPUT:
self -- a p-adic ring
OUTPUT:
boolean -- whether self is exact, i.e. False.
EXAMPLES::
#sage: R = Zp(5, 3, 'lazy'); R.is_exact()
#False
sage: R = Zp(5, 3, 'fixed-mod'); R.is_exact()
False | 625941e36e29344779a629fa |
def _convert_obj(obj): <NEW_LINE> <INDENT> if isinstance(obj, pd.DatetimeIndex): <NEW_LINE> <INDENT> converted = obj.asi8 <NEW_LINE> return converted, 'datetime64', tb.Int64Atom() <NEW_LINE> <DEDENT> elif isinstance(obj, pd.PeriodIndex): <NEW_LINE> <INDENT> converted = obj.values <NEW_LINE> return converted, 'periodind... | Convert a series to pytables values and Atom | 625941e321a7993f00bc80e1 |
def buffered_write_list (self, album): <NEW_LINE> <INDENT> if album in self.write_images: <NEW_LINE> <INDENT> return self.write_images[album].keys() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [] | Get the list of images that are in the queue to being uploaded
We wouldn't need it, but fuse calls getattr after create, which
otherwise fails | 625941e3627d3e7fe0d6923c |
def setUp(self): <NEW_LINE> <INDENT> super(FakeableCleanupMixin, self).setUp() <NEW_LINE> clear() | Invokes the ``setUp`` method of the superclass, and then
:func:`fakeable.clear`.
This ensures that fakes that have been previously set do not leak into
tests. | 625941e316aa5153ce362863 |
@pytest.fixture <NEW_LINE> def gen3_auth(): <NEW_LINE> <INDENT> return MockAuth() | Get MockAuth | 625941e33cc13d1c6d3c7763 |
def to_opcode(self, args): <NEW_LINE> <INDENT> if self.opcode_class is not None: <NEW_LINE> <INDENT> return self.opcode_class(* args) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None | Return an an :class:`PyDvi.DviMachine.Opcode` subclass isntance. | 625941e376e4537e8c351a60 |
def find_max_consecutive_ones(self, nums): <NEW_LINE> <INDENT> max_num = 0 <NEW_LINE> count = 0 <NEW_LINE> for i in nums: <NEW_LINE> <INDENT> if i == 1: <NEW_LINE> <INDENT> count += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> max_num = max(count, max_num) <NEW_LINE> count = 0 <NEW_LINE> <DEDENT> <DEDENT> return max... | :type nums: List[int]
:rtype: int | 625941e376d4e153a657ef1d |
def getRealization(self, pitchObj, stepOfPitch, minPitch=None, maxPitch=None, direction=DIRECTION_ASCENDING, reverse=False): <NEW_LINE> <INDENT> if self._net is None: <NEW_LINE> <INDENT> raise ScaleException('no IntervalNetwork is defined by this "scale".') <NEW_LINE> <DEDENT> post = self._net.realizePitch(pitchObj, st... | Realize the abstract scale as a list of pitch objects,
given a pitch object, the step of that pitch object,
and a min and max pitch. | 625941e350812a4eaa59c708 |
def node_to_str(node): <NEW_LINE> <INDENT> if len(node) == 2 and isinstance(node, tuple): <NEW_LINE> <INDENT> key, val = node <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> key, val = node, '' <NEW_LINE> <DEDENT> key, val = trim(key), trim(val) <NEW_LINE> return ': '.join([key, val]) | Unpack node and convert to string. | 625941e394891a1f4081be96 |
def start_command(prog, flags=b"", overwrite=False, quiet=False, verbose=False, superquiet=False, **kwargs): <NEW_LINE> <INDENT> if 'encoding' in kwargs.keys(): <NEW_LINE> <INDENT> encoding = kwargs.pop('encoding') <NEW_LINE> <DEDENT> options = {} <NEW_LINE> popts = {} <NEW_LINE> for opt, val in kwargs.items(): <NEW_LI... | Returns a Popen object with the command created by make_command.
Accepts any of the arguments which Popen() accepts apart from "args"
and "shell".
>>> p = start_command("g.gisenv", stdout=subprocess.PIPE)
>>> print(p) # doctest: +ELLIPSIS
<...Popen object at 0x...>
>>> print(p.communicate()[0]) # doctest: +SKIP
GISD... | 625941e338b623060ff0b1d8 |
def Top(self): <NEW_LINE> <INDENT> self.dock_direction = AUI_DOCK_TOP <NEW_LINE> return self | Top() sets the pane dock position to the top of the frame.
This is the same thing as calling Direction(``AUI_DOCK_TOP``). | 625941e321bff66bcd684d39 |
def add_tag_trace(thing, user_line=1): <NEW_LINE> <INDENT> limit = config.traceback.limit <NEW_LINE> if limit == -1: <NEW_LINE> <INDENT> limit = None <NEW_LINE> <DEDENT> tr = simple_extract_stack(limit=limit)[:-1] <NEW_LINE> while tr: <NEW_LINE> <INDENT> file_path = tr[-1][0] <NEW_LINE> rm = False <NEW_LINE> for p in [... | Add tag.trace to an node or variable.
The argument is returned after being affected (inplace).
Parameters
----------
thing
The object where we add .tag.trace.
user_line
The max number of user line to keep.
Notes
-----
We alse use config.traceback.limit for the maximum number of stack level
we look. | 625941e3cdde0d52a9e53420 |
def _traverse(self, u, p): <NEW_LINE> <INDENT> self._time += 1 <NEW_LINE> self._c[u] = 'gray' <NEW_LINE> self._d[u] = self._time <NEW_LINE> for v in self._G[u]: <NEW_LINE> <INDENT> if self._c[v] == 'white': <NEW_LINE> <INDENT> p[v] = u <NEW_LINE> self._traverse(v, p) <NEW_LINE> <DEDENT> <DEDENT> self._time += 1 <NEW_LI... | DFS.
:param u: 搜索的初始顶点编号, int
:param p: 用来记录搜索树, dict, key = node, value = parent
注意: 如果搜索树只是一个孤立点, 结果不会保存在p中. | 625941e371ff763f4b549a7d |
def get_class_name(self): <NEW_LINE> <INDENT> return self._class_name | Gets the class name.
:return: | 625941e366656f66f7cbc597 |
def __iter__(self): <NEW_LINE> <INDENT> for n in self.nodes(): <NEW_LINE> <INDENT> yield n | Возвращает итератор для прохода по всем вершинам. | 625941e36fece00bbac2db2e |
def _AddUpdateArgs(parser): <NEW_LINE> <INDENT> flags.AddVersionResourceArg(parser, 'to update') <NEW_LINE> labels_util.AddUpdateLabelsFlags(parser) | Get arguments for the `ml-engine versions update` command. | 625941e3cc0a2c11143dd27c |
def make_otp(self): <NEW_LINE> <INDENT> otp = RigidFragment() <NEW_LINE> otp.add_atom("O", np.array([0.0, -2./3 * np.sin( 7.*pi/24.), 0.0]), 1.) <NEW_LINE> otp.add_atom("O", np.array([cos( 7.*pi/24.), 1./3. * sin( 7.* pi/24.), 0.0]), 1.) <NEW_LINE> otp.add_atom("O", np.array([-cos( 7.* pi/24.), 1./3. * sin( 7.*pi/24)... | this constructs a single OTP molecule | 625941e3046cf37aa974d12f |
def unserialize(str, klass): <NEW_LINE> <INDENT> obj = db.services.io.unserialize(str, klass.vtType) <NEW_LINE> if obj: <NEW_LINE> <INDENT> klass.convert(obj) <NEW_LINE> <DEDENT> return obj | returns VisTrails entity given an XML serialization
| 625941e3ec188e330fd5ab82 |
def open(): <NEW_LINE> <INDENT> pass | A function that opens cans. | 625941e396565a6dacc8fab5 |
def can_update( self, user: UserClass, model_instance: Data, model_data: Dict, data: Data ): <NEW_LINE> <INDENT> allowed_fields = { "output", "tags", "entity_id", "entity", "collection_id", "collection", "name", "descriptor", } <NEW_LINE> not_allowed_keys = set(model_data.keys()) - allowed_fields <NEW_LINE> if not_allo... | Can user update the given model instance.
:raises RuntimeError: when user does not have permissions to update
the given model. | 625941e34527f215b584c83e |
def n(): <NEW_LINE> <INDENT> pass | Size of a group
It can be used in verbs like
:class:`~plydata.one_table_verbs.summarize`,
:class:`~plydata.one_table_verbs.define`. and
:class:`~plydata.one_table_verbs.create`.
This is special function that is internally created for each
group dataframe. | 625941e36aa9bd52df037191 |
@tools.raises(ValueError) <NEW_LINE> def test_incompatible_parameters(): <NEW_LINE> <INDENT> template_pars = {'int': 3} <NEW_LINE> wrong_pars = {'int': 3.0} <NEW_LINE> validate_parameters(wrong_pars, template_pars) | Check that validate_parameters raises exception with unknown parameter. | 625941e37047854f462a17f0 |
def is_bounded( slicing ): <NEW_LINE> <INDENT> slicing = box(slicing) <NEW_LINE> return all((sl.stop != None for sl in slicing)) | For all dimensions: stop value of slice is not None | 625941e3fb3f5b602dac3a82 |
def shutdown(self): <NEW_LINE> <INDENT> pass | Signals the handler to shut down | 625941e34f6381625f114e27 |
def update_submodules(self): <NEW_LINE> <INDENT> if (not os.path.exists(os.path.join(self.rust_root, ".git"))) or self.get_toml('submodules') == "false": <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> default_encoding = sys.getdefaultencoding() <NEW_LINE> try: <NEW_LINE> <INDENT> git_version_output = sub... | Update submodules | 625941e3d53ae8145f87a653 |
def boolean(return_vars=None, script='TEMP3D_blender_default.py', **kwargs): <NEW_LINE> <INDENT> function = 'boolean' <NEW_LINE> write_bpyfunc(return_vars=return_vars, script=script, function=function, **kwargs) <NEW_LINE> return return_vars | Run the same function in bpylirious and return return_vars | 625941e3d4950a0f3b08c734 |
def reverseString(self, s: list) -> None: <NEW_LINE> <INDENT> right = len(s) - 1 <NEW_LINE> left = 0 <NEW_LINE> times = (right + left) // 2 <NEW_LINE> print(times) <NEW_LINE> for i in range(times): <NEW_LINE> <INDENT> s[right], s[left] = s[left], s[right] <NEW_LINE> right -= 1 <NEW_LINE> left += 1 <NEW_LINE> print(f"i ... | Do not return anything, modify s in-place instead. | 625941e331939e2706e4d24f |
def devset(card: Card, ndev, nlsock: Optional[NLSocket] = None) -> Card: <NEW_LINE> <INDENT> if nlsock is None: <NEW_LINE> <INDENT> return _nlstub_(devset, card, ndev) <NEW_LINE> <DEDENT> new = None <NEW_LINE> try: <NEW_LINE> <INDENT> mode = modeget(card, nlsock) <NEW_LINE> phy = card.phy <NEW_LINE> devdel(card, nlsock... | Change the card's device name.
:param ndev: new dev name
:returns: the new card object
.. note:
- via netlink one can set a new physical name but we want the ability to
set a new dev.
- this is not a true set name: it adds a new card with ndev as the dev then
deletes the current card, returnin... | 625941e3de87d2750b860181 |
def __init__( self, id_livre: str, nom: str, author: str, year: str, triger: int ) -> None: <NEW_LINE> <INDENT> self.id_livre = id_livre <NEW_LINE> self.nom = nom <NEW_LINE> self.author = author <NEW_LINE> self.year = year <NEW_LINE> self.triger = triger | Создаем объект класса Книга.
Необходимо передать пять атрибутов. Первые четыре - str. Пятый - int.
:param id_livre: id
:param nom: название
:param author: автор
:param year: год издания
:param triger: триггер (0 - книгу у читателя или 1 - книга в библи-ке) | 625941e38e05c05ec3eea763 |
def GetFontList(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | 获得厂商列表和字体列表
| 625941e326238365f5f0f25f |
def val(num_gpu, val_loader, model, criterion): <NEW_LINE> <INDENT> model.eval() <NEW_LINE> total_time = 0 <NEW_LINE> epoch_loss = [] <NEW_LINE> total_batches = len(val_loader) <NEW_LINE> mAcc1 = [] <NEW_LINE> mAcc5 = [] <NEW_LINE> for i, (input, target) in enumerate(val_loader): <NEW_LINE> <INDENT> start_time = time.t... | :param val_loader: loaded for validation dataset
:param model: model
:param criterion: loss function
:return: average epoch loss, overall pixel-wise accuracy, per class accuracy, per class iu, and mIOU | 625941e3f8510a7c17cf9aea |
def get_matching_snippets(self, trigger, potentially): <NEW_LINE> <INDENT> if not potentially: <NEW_LINE> <INDENT> return [ s for s in self.snippets if s.matches(trigger) ] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return [ s for s in self.snippets if s.could_match(trigger) ] | Returns all snippets matching the given trigger. | 625941e39f2886367277ac75 |
def __init__(self, version, trust_product_sid, sid): <NEW_LINE> <INDENT> super(TrustProductsChannelEndpointAssignmentContext, self).__init__(version) <NEW_LINE> self._solution = {'trust_product_sid': trust_product_sid, 'sid': sid, } <NEW_LINE> self._uri = '/TrustProducts/{trust_product_sid}/ChannelEndpointAssignments/{... | Initialize the TrustProductsChannelEndpointAssignmentContext
:param Version version: Version that contains the resource
:param trust_product_sid: The unique string that identifies the resource.
:param sid: The unique string that identifies the resource
:returns: twilio.rest.trusthub.v1.trust_products.trust_products_c... | 625941e3099cdd3c635f1044 |
def extract_fd(fd, flags=0): <NEW_LINE> <INDENT> with fd_reader(fd) as archive: <NEW_LINE> <INDENT> extract_entries(archive, flags) | Extracts an archive from a file descriptor into the current directory.
| 625941e3cb5e8a47e48b7e90 |
@pytest.mark.parametrize('user_params', [ {}, {'f11': 'b11', 'f12': 'b12'}, {'f21': 'b21', 'f22': 'b22', 'f23': 'b23', 'f24': 'b24'}, { 'f31': 'b31', 'f32': 'b32', 'f33': 'b33', 'f34': 'b34', 'f35': 'b35'}, { 'username': 'u1', 'email': 'email@email.com', 'dob': '01.01.2001', 'address': 'addr', 'f5': 'b5' }, { 'username... | Test that a 400 is returned when a request is made on /users with invalid
parameters. | 625941e3ac7a0e7691ed44b0 |
def __str__(self): <NEW_LINE> <INDENT> return str(self.__dict__) | Returns the attributes of this FieldType as a dictionary string. | 625941e3be7bc26dc91cd9e4 |
def test_set_data_no_class(self): <NEW_LINE> <INDENT> w = self.widget <NEW_LINE> table_no_class = Table( Domain([ContinuousVariable("x"), ContinuousVariable("y")]), [[1, 2], [2, 3]]) <NEW_LINE> self.send_signal(w.Inputs.data, table_no_class) <NEW_LINE> self.assertIsNone(w.data) <NEW_LINE> self.assertEqual(w.cbx.count()... | Test set data | 625941e331939e2706e4d250 |
def OnSpectrum(self,event): <NEW_LINE> <INDENT> print("OnSpectrum") <NEW_LINE> (xMin,xMax,yMin,yMax)=self.opPanel.getRoi() <NEW_LINE> if type(self.data) is tuple: <NEW_LINE> <INDENT> u3d,d3d = self.data <NEW_LINE> u3d = u3d[:,:,:] <NEW_LINE> d3d = d3d[:,:,:] <NEW_LINE> u3d[np.logical_not(self.mask)] = 0 <NEW_LINE> d3d[... | Display a plot of the region of interest versus wavelength | 625941e399fddb7c1c9de77a |
def __contains__(self, user): <NEW_LINE> <INDENT> return UserInNetwork.query.filter_by(network=self, user=user).first() | Check if a user belongs to the network. | 625941e3f548e778e58cd96b |
def __init__(self, wizard, parent, store, order, payment_method=None, outstanding_value=currency(0), finish_on_total=True, allow_remove_paid=True, require_total_value=True): <NEW_LINE> <INDENT> self._require_total_value = require_total_value <NEW_LINE> self._has_modified_payments = False <NEW_LINE> self._allow_remove_p... | Initializes the slave
:param wizard: a :class:`stoqlib.gui.base.wizards.BaseWizard`
instance
:param parent: the parent of this slave (normally the one
who is attaching it)
:param store: a :class:`stoqlib.database.runtime.StoqlibStore`
instance
:param order: the order in question. This slave is prepared to
... | 625941e33d592f4c4ed1d44e |
def test_delete_ipsecpolicy(self): <NEW_LINE> <INDENT> self.assertTrue(neutron.delete_ipsecpolicy('SALT', profile='openstack1')) | Test if it deletes the specified IPsecPolicy | 625941e3a8370b7717052c89 |
def print_funct(*args, **kwargs): <NEW_LINE> <INDENT> sep = ' ' <NEW_LINE> try: <NEW_LINE> <INDENT> sep = kwargs['sep'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> print(sep.join([str(i) for i in args])) | Print function that can be used as mask exception (the print statement cannot be passed as parameter)
:param args: list of what to print, converted into string and separated by 'sep'
:param kwargs: keywords, valid keywords: 'sep' separator, default is space
:return: None | 625941e3e64d504609d74c2b |
def depot_to_archive_path(depot_path, change_num = 1): <NEW_LINE> <INDENT> return os.path.join(depot_path[2:], lbr_rev_str(change_num)) | Return the path within the zip archive where a librarian file goes.
Just appends "/1.1234" to the lbr_path.
blobs and other files where we force the librarian rev with
`p4 unzip --retain-lbr-revisions` should always use change_num = 1. | 625941e37d43ff24873a308e |
def create(self, to, status_callback=values.unset, application_sid=values.unset, max_price=values.unset, provide_feedback=values.unset, validity_period=values.unset, force_delivery=values.unset, content_retention=values.unset, address_retention=values.unset, smart_encoded=values.unset, persistent_action=values.unset, f... | Create the MessageInstance
:param unicode to: The destination phone number
:param unicode status_callback: The URL we should call to send status information to your application
:param unicode application_sid: The application to use for callbacks
:param unicode max_price: The total maximum price up to 4 decimal places ... | 625941e34e696a04525c9838 |
def p_select_block(p): <NEW_LINE> <INDENT> p[2] = p[2].replace('\n','\n\t') <NEW_LINE> p[0] = "%s%s%s%s" % (p[1], options["newline_sep"], options["tab"], p[2]) | select_block : select_keyword select_clause | 625941e3bde94217f36831d9 |
def testConstructor_006(self): <NEW_LINE> <INDENT> localPeer = LocalPeer(collectDir="/whatever") <NEW_LINE> self.assertEqual("/whatever", localPeer.collectDir) <NEW_LINE> localPeer.collectDir = None <NEW_LINE> self.assertEqual(None, localPeer.collectDir) | Test assignment of collectDir attribute, None value. | 625941e3925a0f43d254a266 |
def alldays_as_string(self): <NEW_LINE> <INDENT> items = [] <NEW_LINE> for item in self.entries: <NEW_LINE> <INDENT> items.append(item.date_as_string()) <NEW_LINE> <DEDENT> return items | All days as Y.m.d formated string from the stored
JenkinsDayEntrys | 625941e385dfad0860c3b247 |
def __getstate__(self): <NEW_LINE> <INDENT> return { 'visible': self.visible, 'select': self.select.__getstate__(), 'add': self.add.__getstate__(), 'search': self.search.__getstate__(include_cats=False), } | Serialize the current state of the object | 625941e3b5575c28eb68e3ef |
def relative_filepath(self, file): <NEW_LINE> <INDENT> return files.relative_filepath(file, self.path) | Return a filepath relative to the file dir for the given file. | 625941e338b623060ff0b1d9 |
def get_next_weekend_day(self, year, week, weekday): <NEW_LINE> <INDENT> logger.debug( " - Getting next weekend day since {}".format(Week(year, week).day(weekday))) <NEW_LINE> if weekday == SUN: <NEW_LINE> <INDENT> weekday = SAT <NEW_LINE> week += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> weekday = SAT <NEW_LINE... | Get the next weekend day. If entering date is friday or a weekend day, get the first workday of the next week
Returns a datetime.date | 625941e3cad5886f8bd273c5 |
def get_panel(): <NEW_LINE> <INDENT> for area in bpy.context.screen.areas: <NEW_LINE> <INDENT> if area.type == 'PROPERTIES': <NEW_LINE> <INDENT> for space in area.spaces: <NEW_LINE> <INDENT> if space.type == 'PROPERTIES': <NEW_LINE> <INDENT> return(space.context) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> <DEDENT> return (0... | return active panel name of the properties zone | 625941e3a8ecb033257d34b7 |
def memorizing_property(func): <NEW_LINE> <INDENT> ASSERT.not_equal(func.__name__, '<lambda>') <NEW_LINE> @nondata_property <NEW_LINE> @functools.wraps(func) <NEW_LINE> def wrapper(self): <NEW_LINE> <INDENT> value = func(self) <NEW_LINE> setattr(self, func.__name__, value) <NEW_LINE> return value <NEW_LINE> <DEDENT> re... | Non-data property decorator that memorizes its value.
It stores the value to the instance by function's name; so ``func``
cannot be a nameless entity such as a lambda function. | 625941e3711fe17d8254274e |
def _filecheck(self): <NEW_LINE> <INDENT> if self.audit_file is None: <NEW_LINE> <INDENT> if self.to_root: <NEW_LINE> <INDENT> self.audit_file = os.path.join(self._get_root_dir(), 'eb-audit.json') <NEW_LINE> try: <NEW_LINE> <INDENT> logger.debug('Trying audit file %s' % self.audit_file) <NEW_LINE> util.make_or_verify_d... | Checks audit file, creates a new one if needed.
:return: | 625941e382261d6c526ab891 |
def settings_show(self, args): <NEW_LINE> <INDENT> options = args["options"] <NEW_LINE> self.settings.show(options) | Display the user settings variables. | 625941e3e64d504609d74c2c |
@register.filter(name='cut') <NEW_LINE> def cut(value,arg): <NEW_LINE> <INDENT> return value.replace(arg,' ') | This cuts out all values of "arg" from the string! | 625941e33c8af77a43ae3b90 |
def quick_inquiry(self, start_date=None, end_date=None): <NEW_LINE> <INDENT> transactions = [] <NEW_LINE> html = self.quick_inquiry_raw(start_date, end_date) <NEW_LINE> rows = html.split("<tr align='center'>")[1:] <NEW_LINE> for row in rows: <NEW_LINE> <INDENT> columns = row.split("'>")[1:] <NEW_LINE> columns = [self.s... | 국민은행 계좌 빠른조회. 빠른조회 서비스에 등록이 되어있어야 사용 가능.
빠른조회 서비스: https://obank.kbstar.com/quics?page=C018920 | 625941e330bbd722463cc1b4 |
@multibox_detection.register(["cuda", "gpu"]) <NEW_LINE> def multibox_detection_gpu(cls_prob, loc_pred, anchor, clip=True, threshold=0.01, nms_threshold=0.5, force_suppress=False, variances=(0.1, 0.1, 0.2, 0.2), nms_topk=-1): <NEW_LINE> <INDENT> inter_out = multibox_transform_loc(cls_prob, loc_pred, anchor, clip, thres... | Convert multibox detection predictions.
Parameters
----------
cls_prob : tvm.Tensor
Class probabilities.
loc_pred : tvm.Tensor
Location regression predictions.
anchor : tvm.Tensor
Prior anchor boxes.
clip : boolean
Whether to clip out-of-boundary boxes.
nms_threshold : float
Non-maximum suppres... | 625941e3498bea3a759b9e9a |
def sign(self, party): <NEW_LINE> <INDENT> self.counter_party = party | Signs the contract and sets the self.counter_party property | 625941e3b57a9660fec33c75 |
def euclidean(rating1, rating2): <NEW_LINE> <INDENT> distance = 0 <NEW_LINE> for item in rating1: <NEW_LINE> <INDENT> if item in rating2: <NEW_LINE> <INDENT> score1 = rating1[item] <NEW_LINE> score2 = rating2[item] <NEW_LINE> distance += pow((score1 - score2), 2) <NEW_LINE> distance = pow(distance, 0.5) <NEW_LINE> <DED... | 计算欧几里得距离,rating表示某个用户的所有物品及评分 | 625941e3ac7a0e7691ed44b1 |
def get_accounts(self, customer_id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.get_accounts_with_http_info(customer_id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.get_accounts_with_http_info(cus... | Get all accounts, account groups, and MAVs. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_accounts(customer_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str customer_id: (requir... | 625941e3e76e3b2f99f3abf1 |
def subtest_4(ctx): <NEW_LINE> <INDENT> f = ctx.reg_file() <NEW_LINE> d = ctx.reg_file() + "/sub" + ctx.termslash() <NEW_LINE> ctx.rmdir(d, err=ENOTDIR) <NEW_LINE> ctx.rmdir(d, err=ENOTDIR) <NEW_LINE> ctx.open_file(f, ro=1, read=":xxx:yyy:zzz") | Remove subdir from file | 625941e30a50d4780f667281 |
def __Quit(self): <NEW_LINE> <INDENT> self.__nxagent = None <NEW_LINE> sys.exit(0) | Called when nxagent terminated.
| 625941e399fddb7c1c9de77b |
def check_config(self): <NEW_LINE> <INDENT> if self.PROD_USERNAME is None: <NEW_LINE> <INDENT> raise UnboundLocalError('Production username is not defined') <NEW_LINE> <DEDENT> if self.PROD_PASSWORD is None: <NEW_LINE> <INDENT> raise UnboundLocalError('Production password is not defined') | Are we setup ? | 625941e36fece00bbac2db2f |
def mergeKLists(self, lists): <NEW_LINE> <INDENT> def merge2lists(l1, l2): <NEW_LINE> <INDENT> dummy = ListNode(0) <NEW_LINE> p = dummy <NEW_LINE> while (l1 != None) and (l2 != None): <NEW_LINE> <INDENT> if l1.val < l2.val: <NEW_LINE> <INDENT> p.next = l1 <NEW_LINE> l1 = l1.next <NEW_LINE> <DEDENT> else: <NEW_LINE> <IN... | :type lists: List[ListNode]
:rtype: ListNode | 625941e37047854f462a17f1 |
def get_upgrade_output(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ret = subprocess.check_output(['apt-get', 'upgrade', '--no-act', '-q']) <NEW_LINE> return ret.decode() <NEW_LINE> <DEDENT> except (subprocess.CalledProcessError, OSError) as e: <NEW_LINE> <INDENT> log.error("upgrade --no-act failed with: %s" % e) <N... | Gets the output from the simulated upgrade.
Note that this is a SIMULATION (hence the --no-act.) Also note that this
doesn't use root priveleges, so its definitely not going to upgrade.
@throws UpgradeSimulError
@return the output string from the simulated upgrade
@date Feb 12, 2011
@author Matthew Todd | 625941e3baa26c4b54cb1508 |
def givensExtract(t,i,j,c,s,size): <NEW_LINE> <INDENT> G=eye(t,size) <NEW_LINE> G[i,i]=c;G[j,j]=c;G[i,j]=s;G[j,i]=-s.conjugate() <NEW_LINE> return G | Usage:
G=givensExtract(t,i,j,c,s,size)
t = type
i,j are index values for placement of
c,s which are obtained (probably) from function givensCoef.
size is an integer | 625941e37c178a314d6ef851 |
def _To_CS(c): <NEW_LINE> <INDENT> assert len(c) == 1 <NEW_LINE> if c.isdigit(): <NEW_LINE> <INDENT> return int(c) <NEW_LINE> <DEDENT> if c == "-": <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> return 0 | Convert the TLE line characters into their corresponding values for
calculating the checksum. Integers are their value, minus signs are 1, all
other characters are 0 (spaces, decimal points, letters) | 625941e33cc13d1c6d3c7764 |
def _seed_clusters(self): <NEW_LINE> <INDENT> initial_nodes = random.sample(self.graph.nodes(), self.n_clusters) <NEW_LINE> self._frozen_nodes = set(initial_nodes) <NEW_LINE> self._node_clusters = {node: None for node in self.graph} <NEW_LINE> self.clusters = {} <NEW_LINE> for i, node in enumerate(initial_nodes): <NEW_... | Add single nodes to each cluster in self.clusters
| 625941e391af0d3eaac9be08 |
def test_02wxapp_TucaoList(self): <NEW_LINE> <INDENT> case_data = get_test_data(self.data_list, 'test_wxapp_tucaolist') <NEW_LINE> if not case_data: <NEW_LINE> <INDENT> logging.error("用例数据不存在") <NEW_LINE> <DEDENT> url = case_data.get('url') <NEW_LINE> data = case_data.get('data') <NEW_LINE> expect_res = case_data.get('... | 查看吐槽列表 | 625941e3b57a9660fec33c76 |
def check_solutions(eq): <NEW_LINE> <INDENT> s = diophantine(eq) <NEW_LINE> terms = factor_list(eq)[1] <NEW_LINE> var = list(eq.free_symbols) <NEW_LINE> var.sort(key=default_sort_key) <NEW_LINE> okay = True <NEW_LINE> while len(s) and okay: <NEW_LINE> <INDENT> solution = s.pop() <NEW_LINE> okay = False <NEW_LINE> for t... | Determines whether solutions returned by diophantine() satisfy the original
equation. Hope to generalize this so we can remove functions like check_ternay_quadratic,
check_solutions_normal, check_solutions() | 625941e363b5f9789fde74d2 |
def _delete_asset(self, asset_id, recursive, verbose, dry_run): <NEW_LINE> <INDENT> info = ee.data.getInfo(asset_id) <NEW_LINE> if info is None: <NEW_LINE> <INDENT> print('Asset does not exist or is not accessible: %s' % asset_id) <NEW_LINE> return <NEW_LINE> <DEDENT> if recursive: <NEW_LINE> <INDENT> if info['type'] i... | Attempts to delete the specified asset or asset collection. | 625941e367a9b606de4a82a3 |
def windowed(self, window=('kaiser',6), normalize = True): <NEW_LINE> <INDENT> windowed = self.copy() <NEW_LINE> window = signal.get_window(window, len(self)) <NEW_LINE> window =window.reshape(-1,1,1) * npy.ones((len(self), self.nports, self.nports)) <NEW_LINE> windowed.s = windowed.s[:] * window <NEW_LINE> if normal... | Return a windowed version of s-matrix. Used in time-domain analysis.
When using time domain through :attr:`s_time_db`,
or similar properties, the spectrum is ussually windowed,
before the IFFT is taken. This is done to
compensate for the band-pass nature of a spectrum [1]_ .
This function calls :func:`scipy.signal.ge... | 625941e3956e5f7376d71258 |
def get_stored_order_data(start_date, end_date, database=ORDERS_DATABASE): <NEW_LINE> <INDENT> check_datetime_range(start_date, end_date) <NEW_LINE> check_database(database) <NEW_LINE> c = database.cursor() <NEW_LINE> dates = (start_date.strftime(SQLITE_DATE_TIME_FORMAT_STR), end_date.strftime(SQLITE_DATE_TIME_FORMAT_S... | Gets the stored order data that is stored
in the given database, between the given datetime
ranges, inclusive.
@param start_date: datetime.datetime object
that represents the starting datetime for the
range.
@param end_date: datetime.datetime object that
represents the ending datetime for the range.
@keyword databas... | 625941e371ff763f4b549a7e |
def heapify(self, index): <NEW_LINE> <INDENT> parentIndex = self.parent(index) <NEW_LINE> if parentIndex == -1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> parent = self.heap[parentIndex] <NEW_LINE> if parent > self.heap[index]: <NEW_LINE> <INDENT> self.swap(parentIndex, index) <NEW_LINE> s... | After adding an element, this function is called on that element's
index to trickle it up, if necessary | 625941e3d8ef3951e324392a |
@builtin("swap") <NEW_LINE> def builtin_swap(stack): <NEW_LINE> <INDENT> b = stack.pop() <NEW_LINE> a = stack.pop() <NEW_LINE> stack += [b, a] | Swap topmost elements | 625941e3283ffb24f3c55ce9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.