code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def __add__(self, other): <NEW_LINE> <INDENT> return TrajectoryGroup(HyGroup.__add__(self, other)) | Add a ``HyGroup`` to this ``Cluster`` instance.
Parameters
----------
other : ``HyGroup``
Another ``TrajectoryGroup`` or ``Cluster``. May or may not
contain some of the same ``Trajectory`` instances.
Returns
-------
A new ``TrajectoryGroup`` containing the union of the sets
of ``Trajectory`` instances. | 625941d915fb5d323cde0d9f |
def insert_records(self, module, leads, extra_post_parameters={}): <NEW_LINE> <INDENT> self.ensure_opened() <NEW_LINE> xmldata = self._prepare_xml_request(module, leads) <NEW_LINE> post = { 'newFormat': 1, 'duplicateCheck': 2 } <NEW_LINE> post.update(extra_post_parameters) <NEW_LINE> response = self.do_xml_call("h... | Insert new leads to Zoho CRM database.
The contents of the lead parameters can be defined in Zoho CRM itself.
http://zohocrmapi.wiki.zoho.com/insertRecords-Method.html
@param leads: List of dictionaries. Dictionary content is directly mapped to
<FL> XML parameters as described in Zoho CRM API.
@param extra_pos... | 625941d957b8e32f52483729 |
def train(self, sess): <NEW_LINE> <INDENT> print('Starting training') <NEW_LINE> out = open(os.path.join(self.args.resultDir, self.outFile), 'w', 1) <NEW_LINE> out.write(self.outFile + '\n') <NEW_LINE> for e in range(self.args.epochs): <NEW_LINE> <INDENT> trainBatches = self.textData.getBatches('train') <NEW_LINE> tota... | training loop
:param sess: default sess for Tagger
:return: | 625941d9925a0f43d254a105 |
def FindIKSolutions(self, point, direction, checkcollision=True): <NEW_LINE> <INDENT> self.ActivateIKSolver() <NEW_LINE> ikparam = orpy.IkParameterization(orpy.Ray(point, direction), iktype5D) <NEW_LINE> if checkcollision: <NEW_LINE> <INDENT> sols = self.manip.FindIKSolutions(ikparam, ikfilter_checkcollision) <NEW_LINE... | point -- a 3D vector
direction -- a 3D 'unit' vector | 625941d9009cb60464c6363d |
def and_(self, q): <NEW_LINE> <INDENT> return self.where(q) | Add a filter to this query. Equivalent to calling :py:meth:`where` on this object.
:param str q: Query string - see the `Enterprise Protection API reference`_.
:return: Query object
:rtype: :py:class:`Query`
.. _Enterprise Protection API reference:
https://developer.carbonblack.com/reference/enterprise-protection... | 625941d92ae34c7f2600d3be |
def subfn(x): <NEW_LINE> <INDENT> field, idx = x.groups() <NEW_LINE> return "%s__%s" % (field, fix_sample_name(samples[int(idx)])) | Turn gt_types[1] into gt_types__sample | 625941d9a8370b7717052b2b |
def es_orden(self): <NEW_LINE> <INDENT> return self.es_reflexiva() and self.es_antisimetrica() and self.es_transitiva() | Determina si la relación binaria es reflexiva, transitiva y antisimétrica | 625941d9090684286d50ef74 |
def __init__(self): <NEW_LINE> <INDENT> self.filename = "" | Constructor | 625941d95fc7496912cc3c0b |
def post(self): <NEW_LINE> <INDENT> c_key = ndb.Key(urlsafe=self.request.get('c_key_str')) <NEW_LINE> confSessions = Session.query(ancestor=c_key) <NEW_LINE> speakers = Speaker.query() <NEW_LINE> speakers = speakers.order(Speaker.name) <NEW_LINE> feat_spk_keys = [] <NEW_LINE> for spk in speakers: <NEW_LINE> <INDENT> co... | Check if there are more conference sessions by the Speakers. | 625941d923849d37ff7b331a |
@core.flake8ext <NEW_LINE> def check_no_sqlalchemy_event_import(logical_line, filename, noqa): <NEW_LINE> <INDENT> if noqa: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> is_import = (logical_line.startswith('import') or logical_line.startswith('from')) <NEW_LINE> if not is_import: <NEW_LINE> <INDENT> return <NEW_LINE>... | N346 - Use neutron_lib.db.api.sqla_listen rather than sqlalchemy. | 625941d98c3a873295158649 |
def read_statvar_file(statvar_file): <NEW_LINE> <INDENT> with open(statvar_file) as src: <NEW_LINE> <INDENT> n_sites = int(next(iter(src)).strip()) <NEW_LINE> site_names = [] <NEW_LINE> for i in range(n_sites): <NEW_LINE> <INDENT> variable, segment = next(iter(src)).strip().split() <NEW_LINE> variable = variable.replac... | Read a PRMS statvar file into a pandas dataframe.
Parameters
----------
statvar_file : str or pathlike
Returns
-------
df : pandas DataFrame (n days x n sites)
With a datetime index (one row per day)
and columns: *site1, site2, ...*
Column names are formulated as variable-segment, for example,
*s... | 625941d98a349b6b435e8400 |
def testHeartbeatIntegration(self): <NEW_LINE> <INDENT> pass | Test HeartbeatIntegration | 625941d91f5feb6acb0c4dd9 |
def addNum(self, num): <NEW_LINE> <INDENT> if not self.minHeap and not self.maxHeap: <NEW_LINE> <INDENT> self.maxHeapPush(self.maxHeap, num) <NEW_LINE> return <NEW_LINE> <DEDENT> max_top = self.maxHeap[0] <NEW_LINE> if num <= max_top: <NEW_LINE> <INDENT> self.maxHeapPush(self.maxHeap, num) <NEW_LINE> <DEDENT> else: <NE... | :type num: int
:rtype: void | 625941d956ac1b37e6264459 |
def get_rect(self, x, y): <NEW_LINE> <INDENT> rect = self.scene.itemAt(x, y, QtGui.QTransform()) <NEW_LINE> idx = self.get_rectId(rect) <NEW_LINE> currentState = self.boardCell[idx].isAlive() <NEW_LINE> return rect, idx, currentState | Return the item at the position (x,y) of the GOL board
| 625941d97b180e01f3dc4a86 |
def test_solve_method_fails(self): <NEW_LINE> <INDENT> test_op = ( atmos_flux_inversion.correlations.HomogeneousIsotropicCorrelation. from_array([1, .5, .25, .125, .0625], is_cyclic=False)) <NEW_LINE> ident = np.eye(*test_op.shape) <NEW_LINE> test_mat = test_op.dot(ident) <NEW_LINE> for vec in ident: <NEW_LINE> <INDENT... | Test that solve still works if a solve method fails. | 625941d9b5575c28eb68e28f |
def between_markers(text, begin, end): <NEW_LINE> <INDENT> index_begin = text.find(begin) + len(begin) if begin in text else None <NEW_LINE> index_end = text.find(end) if end in text else None <NEW_LINE> return text[index_begin: index_end] | (str, str, str) -> str
Returns the substring of text between two given markers (begin and end).
If begin isn't found, and end is, returns text[:end],
if begin is found and end isn't, return [begin:],
if begin and end are not found, return the whole text and finally,
if begin index > end index, return empty string.
>>... | 625941d9be7bc26dc91cd889 |
def next(self) -> int: <NEW_LINE> <INDENT> res = self.val <NEW_LINE> try: <NEW_LINE> <INDENT> self.val = next(self.inorder) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> self.val = None <NEW_LINE> <DEDENT> return res | @return the next smallest number | 625941d992d797404e304418 |
def init_target_configuration(self, target_configuration): <NEW_LINE> <INDENT> target_configuration.krunner_version = None <NEW_LINE> target_configuration.krunner_inc_dir = None <NEW_LINE> target_configuration.krunner_lib_dir = None <NEW_LINE> target_configuration.krunner_is_dll = (target_configuration.py_platform == '... | Perform any module specific initialisation of the target
target configuration. Typically this is the initialisation of module
specific attributes. To avoid name clashes attributes should be given
a module specific prefix. target_configuration is the target
configuration. | 625941d97b25080760e396e5 |
def get(key, with_lease=False): <NEW_LINE> <INDENT> client = _get_client() <NEW_LINE> results = client.get(key, metadata=True) <NEW_LINE> LOG.debug("etcdv3 get key=%s results=%s", key, results) <NEW_LINE> if len(results) != 1: <NEW_LINE> <INDENT> raise KeyNotFound() <NEW_LINE> <DEDENT> value, item = results[0] <NEW_LIN... | Read a value from etcdv3.
- key (string): The key to read.
- with_lease (boolean): Indicates also to return the key's lease.
Returns (value, mod_revision) or (value, mod_revision, lease) where
- value is the key's value
- mod_revision is the etcdv3 revision at which the key was last
modified
- lease is an etcd3... | 625941d9d18da76e23532765 |
def partial_optimize(prob, opt_vars=None, dont_opt_vars=None): <NEW_LINE> <INDENT> if opt_vars is None and dont_opt_vars is None: <NEW_LINE> <INDENT> raise ValueError( "partial_optimize called with neither opt_vars nor dont_opt_vars." ) <NEW_LINE> <DEDENT> elif opt_vars is None: <NEW_LINE> <INDENT> ids = [id(var) for v... | Partially optimizes the given problem over the specified variables.
Either opt_vars or dont_opt_vars must be given.
If both are given, they must contain all the variables in the problem.
Partial optimize is useful for two-stage optimization and graph implementations.
For example, we can write
.. code :: python
... | 625941d921bff66bcd684bde |
def test_blank_cart(self): <NEW_LINE> <INDENT> data = self.json <NEW_LINE> data.update({'cart': ''}) <NEW_LINE> serializer = PurchaseOrderSerializer(data=data) <NEW_LINE> with self.assertRaises(serializers.ValidationError): <NEW_LINE> <INDENT> serializer.is_valid(raise_exception=True) <NEW_LINE> <DEDENT> self.assertIn(... | Test blank cart field value | 625941d98da39b475bd65203 |
def get_usd(html): <NEW_LINE> <INDENT> soup = BeautifulSoup(html, "html.parser") <NEW_LINE> soup.select('table.local_table tr td big') <NEW_LINE> usd_list = [] <NEW_LINE> for big_tag in soup.find_all('big')[0:2]: <NEW_LINE> <INDENT> usd_list.append(float(big_tag.text)) <NEW_LINE> <DEDENT> usd_info = { 'buy': usd_list[0... | parse usd exchange rate in html code | 625941d93cc13d1c6d3c7606 |
def __init__(self, create_node=rbnode): <NEW_LINE> <INDENT> self._nil = create_node(key=None, value=None) <NEW_LINE> self._nil._isNil = True <NEW_LINE> self._root = self.nil <NEW_LINE> self._create_node = create_node | Construct. | 625941d95fcc89381b1e194e |
@cuv.command() <NEW_LINE> @click.argument( 'keyword', nargs=-1, ) <NEW_LINE> @click.pass_obj <NEW_LINE> def watch(cfg, keyword): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> watch_coverage(keyword, cfg) <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> pass | Console graph of each file's coverage. | 625941d9fb3f5b602dac3923 |
def set_kbx_param_strict(self, value): <NEW_LINE> <INDENT> pass | Specify if received object value should contains only keys that you had defined.
Params:
value:Boolean - [Required] True if only keys defined are allowed in received object value. | 625941d9fff4ab517eb2f6ca |
def remove_subscriptions(self): <NEW_LINE> <INDENT> self.session.config.unsubscribe(self._on_avatarssize_changed, 'i_avatar_size') <NEW_LINE> self.session.signals.contact_attr_changed.unsubscribe( self._on_contact_attr_changed) <NEW_LINE> self.session.signals.picture_change_succeed.unsubscribe( self._on_contact_attr_ch... | disconnect signals subscriptions | 625941d9f548e778e58cd80c |
def adagrad(loss, all_params, learning_rate=1.0, epsilon=1e-6): <NEW_LINE> <INDENT> all_grads = theano.grad(loss, all_params) <NEW_LINE> all_accumulators = [theano.shared(np.zeros(param.get_value().shape, dtype=theano.config.floatX), broadcastable=param.broadcastable) for param in all_params] <NEW_LINE> updates = [] <N... | epsilon is not included in the typical formula,
See "Notes on AdaGrad" by Chris Dyer for more info. | 625941d94e696a04525c96d9 |
def choice_message(self,message='Yes or No?',choices=(('Yes'+' '*3,True), ('No'+' '*4,False)), variable=None): <NEW_LINE> <INDENT> choice=tk.StringVar(self) <NEW_LINE> choice_dict={str(k):v for k,v in choices} <NEW_LINE> choice_frame=FormattingGrid(self.master,rows=len(choices),columns=1,arrow_move=True, inactive=Stand... | Pops up a choice dialog
By default the choices are 'Yes'->True and 'No'->False
The message is 'Yes or No?' by default | 625941d94f88993c3716c2f3 |
def publish(block, event_type, event): <NEW_LINE> <INDENT> self.events.append({"event": event, "event_type": event_type}) <NEW_LINE> old_publish(block, event_type, event) | Log the event, and call the original publish | 625941d938b623060ff0b07b |
def run(): <NEW_LINE> <INDENT> print("--- Starting ---") <NEW_LINE> args = initial_args() <NEW_LINE> run_plotter(args) <NEW_LINE> print("--- Stopping ---") | Start the main script | 625941d915baa723493c4204 |
def TrackPoint(self, pt): <NEW_LINE> <INDENT> if not self._mouseIn: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> dc = wx.ClientDC(self) <NEW_LINE> self.DrawMarkers(dc) <NEW_LINE> mainDialog = self._mainDialog <NEW_LINE> colour = mainDialog._colour <NEW_LINE> colour.h = int(rad2deg(AngleFromPoint(pt, mainDialog._centr... | Track a mouse event inside the HSV colour wheel.
:param `pt`: an instance of :class:`wx.Point`. | 625941d97047854f462a1694 |
def to_array(sudoku): <NEW_LINE> <INDENT> tensor = np.zeros([9, 9, 9], dtype=np.int8) <NEW_LINE> tensor.fill(-1) <NEW_LINE> for y, row in enumerate(sudoku): <NEW_LINE> <INDENT> for x, slot in enumerate(row): <NEW_LINE> <INDENT> if slot is not None: <NEW_LINE> <INDENT> mark(tensor, slot - 1, y, x) <NEW_LINE> <DEDENT> <D... | Convert 2D sudoku into a 3D tensor containing {-1, 0, 1}.
These states mean:
0: Place is closed
1: Place is set
-1: Place is yet unknown
:param sudoku: List[List[int]] = Sudoku-field
:return: np.array (3d) = 3D tensor of the Sudoku-field | 625941d91d351010ab855da9 |
def penup(self): <NEW_LINE> <INDENT> if not self._drawing: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.pen(pendown=False) | Pull the pen up -- no drawing when moving.
Aliases: penup | pu | up
No argument
Example (for a Turtle instance named turtle):
>>> turtle.penup() | 625941d9eab8aa0e5d26dde6 |
def test_get_backend_configuration(self): <NEW_LINE> <INDENT> qp = QuantumProgram(specs=QPS_SPECS) <NEW_LINE> test = len(qp.get_backend_configuration("local_qasm_simulator")) <NEW_LINE> self.assertEqual(test, 6) | Test get_backend_configuration.
If all correct should return configuration for the
local_qasm_simulator. | 625941d93317a56b86939ee0 |
def exists(env): <NEW_LINE> <INDENT> return env['GCCCPP_INJECTED'] | Return True if the tool is present in the environment | 625941d931939e2706e4d0f4 |
def setUp(self): <NEW_LINE> <INDENT> pass | Set up for all methods | 625941d95f7d997b87174d27 |
def show(self): <NEW_LINE> <INDENT> self._boundingRect = QtCore.QRectF(0, 0, 0, 0) <NEW_LINE> super().show() | Reset the maximum bounding rect and show | 625941d9d99f1b3c44c67818 |
def getall(self): <NEW_LINE> <INDENT> return [self.fitdata_dict[group] for group in self.groups] | return all | 625941d9b7558d58953c519e |
def unbind(self): <NEW_LINE> <INDENT> self.mac_to_vendor = {} | Unloads mac to vendor mapping from memory
You can not use MACMatcher instance once this method is called
:param self: A MACMatcher object
:type self: MACMatcher | 625941d966656f66f7cbc43a |
def test_type(self): <NEW_LINE> <INDENT> jwt_token = sign_with_jwt(self.payload) <NEW_LINE> self.assertIs(type(jwt_token), bytes) | Check if we receive bytes
:return: | 625941d985dfad0860c3b0e9 |
@boolean_fail <NEW_LINE> def is_feature(anything): <NEW_LINE> <INDENT> return ( isinstance(anything, dict) and anything.get("type") == "Feature" and ("geometry" in anything) and ( anything["geometry"] is None or is_geometry(anything["geometry"]) ) and has_crs(anything) and has_bbox(anything) ) | Validate a GeoJSON Feature. | 625941d9a219f33f34628bf4 |
@require_permission("VIEW", Customer, 'id') <NEW_LINE> def edit_file(request, id, file_id): <NEW_LINE> <INDENT> customer = Core.current_user().get_permitted_objects("VIEW", Customer).all().get(id=id) <NEW_LINE> file = customer.files.get(id=file_id) <NEW_LINE> additional_data = {'customer': customer} <NEW_LINE> return f... | id = customer_id
file_id = file_id | 625941d95fdd1c0f98dc04c1 |
def model(ts,pars): <NEW_LINE> <INDENT> z=pars['z'] <NEW_LINE> d=pars['d'] <NEW_LINE> q=pars['q'] <NEW_LINE> t0=pars['t0'] <NEW_LINE> y0=pars['y0'] <NEW_LINE> dt = ts-t0 <NEW_LINE> result = z - q * np.exp(-dt*d) <NEW_LINE> return result + y0 | Model:
model func form:
y = z - q * exp(-d*(t-t0))
note y = ln (number of cases)
z = asymptote
d = exponential rate of approach to asmptote
q*d*exp(d*t0) = early rate of exponential growth
z - q = y(t0) | 625941d916aa5153ce362705 |
def OnMouseWheel(self,*args): <NEW_LINE> <INDENT> pass | OnMouseWheel(self: Control,e: MouseEventArgs)
Raises the System.Windows.Forms.Control.MouseWheel event.
e: A System.Windows.Forms.MouseEventArgs that contains the event data. | 625941d9aad79263cf390cd2 |
def biterbi_decoder(self, emit_scores, masks): <NEW_LINE> <INDENT> sent_size = emit_scores.size(0) <NEW_LINE> batch_size = emit_scores.size(1) <NEW_LINE> emit_scores_broadcast = emit_scores[0].view(batch_size, self.label_num) <NEW_LINE> trans_scores_broadcast = self.T[self.label_alpha.string2id[START], :].unsqueeze(0).... | :param emit_scores: Variable(sent_size, batch, label_num)
:return: | 625941d96aa9bd52df037032 |
def get_aa(freqs): <NEW_LINE> <INDENT> location = prms['loc'] <NEW_LINE> antennas = [] <NEW_LINE> nants = len(prms['antpos']) <NEW_LINE> for i in range(nants): <NEW_LINE> <INDENT> beam = bm.prms['beam'](freqs, nside=32, lmax=20, mmax=20, deg=7) <NEW_LINE> try: beam.set_params(bm.prms['bm_prms']) <NEW_LINE> except(Attri... | Return the AntennaArray to be used for simulation. | 625941d9462c4b4f79d1d95d |
def _api_request(self, method, url, **kwargs): <NEW_LINE> <INDENT> allow_404 = kwargs.pop('allow_404', False) <NEW_LINE> headers = kwargs.setdefault('headers', {}) <NEW_LINE> headers.setdefault('Authorization', 'token %s' % self.api_token) <NEW_LINE> if "cert" not in kwargs and self.certfile and self.keyfile: <NEW_LINE... | Make an API request | 625941d9462c4b4f79d1d95e |
def replace(update, cl, el1, el2, reptype = None, show_fit = 0): <NEW_LINE> <INDENT> st = cl.end <NEW_LINE> n_noneq_pos = len(determine_symmetry_positions(st, el1)) <NEW_LINE> printlog('Number of non-equiv pos', n_noneq_pos) <NEW_LINE> if not reptype: <NEW_LINE> <INDENT> printlog('Error! replace(): Please provide repty... | cl - calculation to work with
el1 - element to be replaced
el2 - replace by this
reptype - type of replacement
'full' - all atoms of specific symmetry type
'one' - only one atom of specific symmetry type
update - update | 625941d91b99ca400220ad3f |
def subscribeSilent(self, obj, callback): <NEW_LINE> <INDENT> self.silentSubscribers[self.__currentId] = Subscribable.Subscriber(obj, callback) <NEW_LINE> self.__currentId = self.__currentId + 1 <NEW_LINE> return self.__currentId - 1 | Subscribes an object to the "silent" list. Subscribers on the silent
list are not included in the total subscriber count. This is meant for
global or system listeners/subscribers. | 625941d90383005118ecf86f |
def set_taps(self, *args, **kwargs): <NEW_LINE> <INDENT> return _filter_swig.pfb_synthesizer_ccf_set_taps(self, *args, **kwargs) | set_taps(pfb_synthesizer_ccf self, pmt_vector_float taps)
Resets the filterbank's filter taps with the new prototype filter | 625941d91b99ca400220ad40 |
def minimax(self, gameState, depth): <NEW_LINE> <INDENT> if self.time_left() < self.TIMER_THRESHOLD: <NEW_LINE> <INDENT> raise SearchTimeout() <NEW_LINE> <DEDENT> levelScores = [] <NEW_LINE> levelMovesList = gameState.get_legal_moves() <NEW_LINE> if len(levelMovesList) > 0: <NEW_LINE> <INDENT> if depth == 1: <NEW_LINE>... | Implement depth-limited minimax search algorithm as described in
the lectures.
This should be a modified version of MINIMAX-DECISION in the AIMA text.
https://github.com/aimacode/aima-pseudocode/blob/master/md/Minimax-Decision.md
**********************************************************************
You MAY add add... | 625941d9bd1bec0571d908be |
def del_client_session(self): <NEW_LINE> <INDENT> raise ConnForbiddenError('Forbid to del client_session') | Delete client session. | 625941d93617ad0b5ed68184 |
def _find_version() -> str: <NEW_LINE> <INDENT> init_file = os.path.join(ROOT_DIR, 'pyatop', '__init__.py') <NEW_LINE> with open(init_file, 'rt') as file_in: <NEW_LINE> <INDENT> for line in file_in.readlines(): <NEW_LINE> <INDENT> if '__version__' in line: <NEW_LINE> <INDENT> version = line.split()[2].replace("'", '') ... | Locate semantic version from a text file in a compatible format with setuptools. | 625941d9d53ae8145f87a4fa |
def pushTMpacket(self, tmPacketDu, ertUTC): <NEW_LINE> <INDENT> return True | sends TM packet DU to CCS or downlink | 625941d926068e7796caef6f |
def Run(self, args): <NEW_LINE> <INDENT> client = updater_util.GetApiClientInstance() <NEW_LINE> messages = updater_util.GetApiMessages() <NEW_LINE> ref = resources.REGISTRY.Parse( args.update, collection='replicapoolupdater.rollingUpdates') <NEW_LINE> request = messages.ReplicapoolupdaterRollingUpdatesCancelRequest( p... | Run 'rolling-updates cancel'.
Args:
args: argparse.Namespace, The arguments that this command was invoked
with.
Raises:
HttpException: An http error response was received while executing api
request.
ToolException: An error other than http error occured while executing
the command. | 625941d971ff763f4b54991d |
def delete_user(self, login): <NEW_LINE> <INDENT> return self.request('delete', '/users/{}'.format(login), msg='deleting user {}'.format(login) ) | Delete a user
:rtype: bool
:param login: The user's login
:return: True on success | 625941d963d6d428bbe4477e |
def read_fermi(self): <NEW_LINE> <INDENT> E_f = None <NEW_LINE> text = open(self.out).read().lower() <NEW_LINE> for line in iter(text.split('\n')): <NEW_LINE> <INDENT> if line.rfind('fermi :') > -1: <NEW_LINE> <INDENT> E_f = float(line.split(':')[1].strip()) <NEW_LINE> <DEDENT> <DEDENT> E_f = E_f ... | Method that reads Fermi energy in Hartree from the output file
and returns it in eV | 625941d901c39578d7e750ca |
def _ParseGCPLog(self, parser_mediator, file_object): <NEW_LINE> <INDENT> text_file_object = text_file.TextFile(file_object) <NEW_LINE> for line in text_file_object: <NEW_LINE> <INDENT> json_log_entry = json.loads(line) <NEW_LINE> time_string = json_log_entry.get('timestamp', None) <NEW_LINE> if time_string is None: <N... | Extract events from GCP Logging saved to a file in JSON-L format.
Args:
parser_mediator (ParserMediator): mediates interactions between parsers
and other components, such as storage and dfvfs.
file_object (dfvfs.FileIO): a file-like object. | 625941d9377c676e91272436 |
def __init__(self, session): <NEW_LINE> <INDENT> super().__init__(session, "OrganizationInfo") | Initializes the OrganizationInfoAPI object.
:param session: An instance of the HttpSession class
:return OrganizationInfoAPI object. | 625941d945492302aab5e554 |
def createWorkload(self): <NEW_LINE> <INDENT> workload = rerecoWorkload("Tier1ReReco", getTestArguments()) <NEW_LINE> rereco = workload.getTask("DataProcessing") <NEW_LINE> return workload | Create a workload in order to test things | 625941d9adb09d7d5db6ca1c |
def best_match(supported, header): <NEW_LINE> <INDENT> parsed_header = [parse_media_range(r) for r in _filter_blank(header.split(","))] <NEW_LINE> weighted_matches = [] <NEW_LINE> pos = 0 <NEW_LINE> for mime_type in supported: <NEW_LINE> <INDENT> weighted_matches.append((fitness_and_quality_parsed(mime_type, parsed_hea... | Takes a list of supported mime-types and finds the best
match for all the media-ranges listed in header. The value of
header must be a string that conforms to the format of the
HTTP Accept: header. The value of 'supported' is a list of
mime-types. The list of supported mime-types should be sorted
in order of increasin... | 625941d9293b9510aa2c3522 |
def daymax(arr, axis = None, keepdims = True): <NEW_LINE> <INDENT> return _dayfunc_a0(np.maximum, arr, axis = axis, keepdims = keepdims) | see _dayfunc with np.maximum as func | 625941d9cc0a2c11143dd11f |
@app.route('/tags/new') <NEW_LINE> def display_form_create_tag(): <NEW_LINE> <INDENT> posts = Post.query.all() or [] <NEW_LINE> return render_template('add_tag.html', posts=posts) | Display a form to create a tag | 625941d9287bf620b61d3cf0 |
def center(width, height): <NEW_LINE> <INDENT> return (width/2, height/2) | Description: Trouve le centre de la video
----------------------------------------
Entrée: largeur (int); hauteur (int)
Sortie: tuple du center (x,y)
---------------------------------------- | 625941d9e1aae11d1e749f47 |
def visit_With(self, withstmt): <NEW_LINE> <INDENT> with_item = withstmt.items[0] <NEW_LINE> candidate = with_item.context_expr <NEW_LINE> if isinstance(candidate, Name) and self._ismacro(candidate.id): <NEW_LINE> <INDENT> macro = candidate.id <NEW_LINE> tree = withstmt.body <NEW_LINE> kw = { 'optional_vars': with_item... | Check for a with macro as
with macroname:
# with's body is the argument
It replaces the with node with the result of the macro. | 625941d9fbf16365ca6f6455 |
def set_current_comment(self): <NEW_LINE> <INDENT> if self.show_comments: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.current_comment = self.comment_tree_model.get_items(self.comment_tree_view.selectedIndexes()) <NEW_LINE> self.handle_comment_text_browser() <NEW_LINE> <DEDENT> except (IndexError, AttributeError):... | See set current download session. | 625941d9d4950a0f3b08c5da |
def get_ttl_device(self, path=None): <NEW_LINE> <INDENT> return self._get_device(USB_Device_Category.TTL, path) | Get the first available TTL device. If `path` is provided, get the
TTL device with its path equal to `path`. | 625941d9b5575c28eb68e290 |
def get_group_arg(self): <NEW_LINE> <INDENT> urlgroup = self.kwargs.get('group', '') <NEW_LINE> if not urlgroup: <NEW_LINE> <INDENT> urlgroup = self.request.POST.get('group', '') <NEW_LINE> <DEDENT> if not urlgroup: <NEW_LINE> <INDENT> urlgroup = self.request.GET.get('group', '') <NEW_LINE> <DEDENT> if not urlgroup: <N... | Look for the KeyGroup in the url, post args or get args.
Falls back to the `keygroup` set on the class. | 625941d976d4e153a657edc0 |
def set_words(self): <NEW_LINE> <INDENT> self.words = word_tokenize(self.text) <NEW_LINE> return self.words | Tokenise text and store as variable. | 625941d916aa5153ce362706 |
def weekly_gridlines(ax=None): <NEW_LINE> <INDENT> if ax is None: <NEW_LINE> <INDENT> ax = plt.gca() <NEW_LINE> <DEDENT> ax.xaxis.set_minor_locator(mdates.WeekdayLocator(byweekday=(1),interval=1)) <NEW_LINE> ax.grid(which='minor') | Set x-axis minor ticks and gridlines to weekly interval. | 625941d930c21e258bdfa72d |
def login_user(**kw): <NEW_LINE> <INDENT> msg = '' <NEW_LINE> if session.get(kw['session_name'], None) != None: <NEW_LINE> <INDENT> return redirect(url_for(kw['index'])) <NEW_LINE> <DEDENT> if request.method == 'GET' and request.args.get('next'): <NEW_LINE> <INDENT> session['next'] = request.args.get('next') <NEW_LINE>... | Helper function: that assists the user entry to the applicaton
parameters:
- form: form object to render.
- template : The template to display.
- session_name : The session name to be used with this session. | 625941d931939e2706e4d0f5 |
def tearDown(self): <NEW_LINE> <INDENT> self.myHub.setMonitoringParam('OCCP',False) | Cleanup after tests | 625941d9e64d504609d74ace |
def test_get_new_field_item(): <NEW_LINE> <INDENT> field_update = (TEST_FIELD_NAME, (TEST_OLD_VALUE, TEST_NEW_VALUE)) <NEW_LINE> result = get_new_field_item(field_update) <NEW_LINE> assert result == (TEST_FIELD_NAME, TEST_NEW_VALUE) | Test the get_new_field_item filter | 625941d9566aa707497f47f4 |
def rotate_to_single_block(blocks: Blocks) -> Blocks: <NEW_LINE> <INDENT> while len(blocks) > 1: <NEW_LINE> <INDENT> blocks = rotate_blocks(blocks) <NEW_LINE> <DEDENT> return blocks | Rotate an array of blocks until there's just one. | 625941d98c0ade5d55d3ec4b |
def __str__(self): <NEW_LINE> <INDENT> if self._quoted: <NEW_LINE> <INDENT> return self._value <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.normalize(self._value) | Creates a readable string representation of the keyword value node.
Returns the string representation. | 625941d926068e7796caef70 |
def __sub__(self, rhs): <NEW_LINE> <INDENT> return Point(self.x - rhs.x, self.y - rhs.y) | Return the difference of two points. | 625941d9f8510a7c17cf998c |
def plotHistogram(self, imageName): <NEW_LINE> <INDENT> import matplotlib.pyplot as plt <NEW_LINE> plt.hist(self.indexPagesPerBucket, bins=10) <NEW_LINE> plt.ylabel('Frequency') <NEW_LINE> plt.xlabel('Number of Index pages') <NEW_LINE> plt.title("Index Pages for each Bucket") <NEW_LINE> plt.savefig("./{}.png".format(im... | plot a histogram of the index pages per bucket | 625941d9d8ef3951e32437cc |
def setUp(self): <NEW_LINE> <INDENT> self.basedir = tempfile.mkdtemp() <NEW_LINE> dirs = ['a1', 'b1', 'c1', 'a1/aa2', 'a1/ab2', 'a1/ac2', 'b1/ba2', 'b1/bb2', 'a1/ab2/aa3'] <NEW_LINE> for dir in dirs: <NEW_LINE> <INDENT> path = '%s/%s' % (self.basedir, dir) <NEW_LINE> os.mkdir(path) <NEW_LINE> os.mkdir('%s/.snapshots' %... | Create a test direcory structure | 625941d94c3428357757c5b5 |
def send_raw(self, data): <NEW_LINE> <INDENT> return self.sock_send_str(data + "\r\n") | Send raw data to irc server | 625941d9e8904600ed9f21be |
def extract_attributes(theline): <NEW_LINE> <INDENT> theline = theline.strip() <NEW_LINE> if ' ' not in theline: <NEW_LINE> <INDENT> PETRglobals.AttributeList = theline[1:-2] <NEW_LINE> return <NEW_LINE> <DEDENT> pline = theline[1:].partition(' ') <NEW_LINE> PETRglobals.AttributeList = [pline[0]] <NEW_LINE> theline = p... | Structure of attributes extracted to AttributeList
At present, these always require a quoted field which follows an '=', though it
probably makes sense to make that optional and allow attributes without content | 625941d95fc7496912cc3c0c |
def add(self, entity): <NEW_LINE> <INDENT> pass | 添加一个实体
:param entity:
:return: | 625941d9bde94217f368307d |
@adapter(IField, interfaces.IFormLayer) <NEW_LINE> @implementer(interfaces.IFieldWidget) <NEW_LINE> def LabelFieldWidget(field, request): <NEW_LINE> <INDENT> return FieldWidget(field, LabelWidget(request)) | IFieldWidget factory for TextWidget. | 625941d98da39b475bd65204 |
def reset_time(self): <NEW_LINE> <INDENT> return int(self.response.headers[ self.RATE_LIMIT_RESET_HEADER_KEY ]) | Returns the reset time in seconds until next available request. | 625941d9d4950a0f3b08c5db |
def calculate_feature_points(frames: list): <NEW_LINE> <INDENT> detector = cv2.BRISK_create() <NEW_LINE> for frame in frames: <NEW_LINE> <INDENT> blurred = cv2.GaussianBlur(frame.image, (3, 3), 0) <NEW_LINE> keypoints, descriptors = detector.detectAndCompute(blurred, None) <NEW_LINE> frame.features = (keypoints, descri... | Goes through all frames from the given list and calculates features points on each frame.
The resulting feature points are then added to the frame together with their descriptors. | 625941d9be7bc26dc91cd88a |
def process_news_item(self, item, spider): <NEW_LINE> <INDENT> news_path = item['news_path'][0] <NEW_LINE> if not news_path: <NEW_LINE> <INDENT> raise DropItem("Missing news_path in %s" % item) <NEW_LINE> <DEDENT> if not os.path.exists(news_path): <NEW_LINE> <INDENT> os.makedirs(news_path) <NEW_LINE> <DEDENT> self.writ... | Create a directory for this news if it doesn't exist yet. | 625941d9925a0f43d254a107 |
def test_singleton_dim(): <NEW_LINE> <INDENT> image = np.random.rand(1, 20) <NEW_LINE> noisy = random_noise(image, mode='salt', amount=0.1, seed=42) <NEW_LINE> assert np.sum(noisy == 1) == 2 | Ensure images where size of a given dimension is 1 work correctly. | 625941d9d10714528d5fff74 |
def ds(s): <NEW_LINE> <INDENT> if py2: <NEW_LINE> <INDENT> return s <NEW_LINE> <DEDENT> return s.decode(encoding='utf-8', errors='surrogateescape') | Decodes the given byte string in Python 3 | 625941d9cc40096d61595bde |
def deprecated(self, msg, *args, **kwargs): <NEW_LINE> <INDENT> stdmsg = _("Deprecated: %s") % msg <NEW_LINE> if CONF.fatal_deprecations: <NEW_LINE> <INDENT> self.critical(stdmsg, *args, **kwargs) <NEW_LINE> raise DeprecatedConfig(msg=stdmsg) <NEW_LINE> <DEDENT> sent_args = self._deprecated_messages_sent.setdefault(msg... | Call this method when a deprecated feature is used.
If the system is configured for fatal deprecations then the message
is logged at the 'critical' level and :class:`DeprecatedConfig` will
be raised.
Otherwise, the message will be logged (once) at the 'warn' level.
:param kwargs:
:param args:
:param msg:
:raises: :c... | 625941d910dbd63aa1bd2e31 |
def insert(self, documents, **kwargs): <NEW_LINE> <INDENT> if not isinstance(documents, list): <NEW_LINE> <INDENT> documents = [documents] <NEW_LINE> <DEDENT> self._collection.insert(documents, **kwargs) | Stores documents into the collection.
:param documents: document or list of documents to store. | 625941d93c8af77a43ae3a31 |
def t110004_x3(actionbutton1=_, flag1=6001, flag2=6000): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> assert (not GetOneLineHelpStatus() and not IsTalkingToSomeoneElse() and not IsClientPlayer() and not IsPlayerDead() and not IsCharacterDisabled()) <NEW_LINE> assert CompareBonfireState(1) <NEW_LINE> if GetEventS... | State 0 | 625941d94c3428357757c5b6 |
def insert(self, loc: int, item: Any) -> Index: <NEW_LINE> <INDENT> length = len(self) <NEW_LINE> if loc < 0: <NEW_LINE> <INDENT> loc = loc + length <NEW_LINE> if loc < 0: <NEW_LINE> <INDENT> raise IndexError( "index {} is out of bounds for axis 0 with size {}".format( (loc - length), length ) ) <NEW_LINE> <DEDENT> <DE... | Make new MultiIndex inserting new item at location.
Follows Python list.append semantics for negative values.
Parameters
----------
loc : int
item : object
Returns
-------
new_index : MultiIndex
Examples
--------
>>> psmidx = ps.MultiIndex.from_tuples([("a", "x"), ("b", "y"), ("c", "z")])
>>> psmidx.insert(3, ("h",... | 625941d9dc8b845886cb57c5 |
def _add_gaussian_keypoint_jittering(keypoints, jittering_offset_stddev, seed=None): <NEW_LINE> <INDENT> if jittering_offset_stddev <= 0.0: <NEW_LINE> <INDENT> raise ValueError( 'Jittering offset standard deviation must be positive: %s.' % str(jittering_offset_stddev)) <NEW_LINE> <DEDENT> offsets = tf.random.normal( tf... | Randomly jitters keypoints following Gaussian distribution.
Args:
keypoints: A tensor for keypoints. Shape = [..., keypoint_dim].
jittering_offset_stddev: A float for standard deviation of Gaussian keypoint
jittering offset. Random jittering offset sampled from N(0,
jittering_offset_stddev) is to be added ... | 625941d98c3a87329515864b |
def remove_all_flask_handlers(self): <NEW_LINE> <INDENT> for handler in list(self.app.logger.handlers): <NEW_LINE> <INDENT> self.app.logger.removeHandler(handler) | This method just removes all the native flask logging handlers. These
are not very helpful as is, and may be removed from future versions
of flask:
https://github.com/pallets/flask/issues/2023 | 625941d97cff6e4e81117c14 |
def row_to_record_data(row): <NEW_LINE> <INDENT> data = {} <NEW_LINE> for i in range(len(RECYCLED_MATERIAL_TYPES)): <NEW_LINE> <INDENT> data[RECYCLED_MATERIAL_TYPES[i]] = row[i+1] <NEW_LINE> <DEDENT> return data | The row should have the following columns:
Classroom, Aluminum, Batteries, Bottles, Cans, Cardboard,
Computer Parts, Glass, Paper, Wood | 625941d9b545ff76a89140a4 |
def __init__(self, width=500, height=500, background="white", **options): <NEW_LINE> <INDENT> self._fill = "black" <NEW_LINE> self._outline = "black" <NEW_LINE> self._font = None <NEW_LINE> self._images = [] <NEW_LINE> self._image_map = dict() <NEW_LINE> self._x = 0 <NEW_LINE> self._y = 0 <NEW_LINE> self._stroke = 1 <N... | Constructs a panel of a given width, height, and optional background color.
Parameters:
@param width: (optional) width of the DrawingPanel central canvas area in pixels (default 500)
@param height: (optional) height of the DrawingPanel central canvas area in pixels (default 500)
@param background: (optional) backgroun... | 625941d91f5feb6acb0c4ddc |
def nodalForces(self, nset = None): <NEW_LINE> <INDENT> if nset is None: <NEW_LINE> <INDENT> nset = self.nall() <NEW_LINE> <DEDENT> self.solveReactions(nset) <NEW_LINE> sset = sorted(nset) <NEW_LINE> rows = len(sset) <NEW_LINE> nodeloads = np.zeros((3,), dtype=float) <NEW_LINE> ret = np.zeros((rows, 3), dtype=float) <N... | Return nodal forces over set.
The force includes sum of nodal loads and reactions.
If no nset is given all nodes are selected. | 625941d930dc7b7665901bf3 |
def __init__(self, x, y, width, height, font=None, textColor=None): <NEW_LINE> <INDENT> pass | :param x: integer - x coordinate of control.
:param y: integer - y coordinate of control.
:param width: integer - width of control.
:param height: integer - height of control.
:param font: string - font used for text. (e.g. 'font13')
:param textColor: hexstring - color of textbox's text. (e.g. '0xFFFFFFFF')
.. note::
... | 625941d97d43ff24873a2f30 |
def __init__(self, base_dir: str, clear_past_data: bool = False): <NEW_LINE> <INDENT> self.summary_writers: Dict[str, tf.summary.FileWriter] = {} <NEW_LINE> self.base_dir: str = base_dir <NEW_LINE> self._clear_past_data = clear_past_data | A StatsWriter that writes to a Tensorboard summary.
:param base_dir: The directory within which to place all the summaries. Tensorboard files will be written to a
{base_dir}/{category} directory.
:param clear_past_data: Whether or not to clean up existing Tensorboard files associated with the base_dir and
category. | 625941d9283ffb24f3c55b8e |
def end(self): <NEW_LINE> <INDENT> self._robot.arm.move_arm(0) | Called once after isFinished returns true | 625941d93cc13d1c6d3c7608 |
def _do_process_filtering_work(self,*args,**kwargs): <NEW_LINE> <INDENT> self.process_filtering_helper = ProcessFilterInputBox() <NEW_LINE> self.process_filtering_helper.owner_widget = weakref.proxy(self) <NEW_LINE> self.process_filtering_helper.display() <NEW_LINE> self.process_filtering_helper.edit() | Dynamically instantiate a process filtering box used
to offload the process filtering work | 625941d90fa83653e4657249 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.