code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def open(name, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=None, opener=None): <NEW_LINE> <INDENT> return file() | Open a file, returns a file object.
:type name: str | os.PathLike
:type mode: str
:type buffering: numbers.Integral
:type encoding: str | None
:type errors: str | None
:rtype: file | 625941c89c8ee82313fbb7d4 |
def __init__(self, eventType, vk, name=None, modifiers=None, isKeypad=None, time=None): <NEW_LINE> <INDENT> self.eventType = eventType <NEW_LINE> self.vk = vk <NEW_LINE> self.name = name <NEW_LINE> self.modifiers = modifiers <NEW_LINE> self.isKeypad = isKeypad <NEW_LINE> self.time = time if time is not None else GetTim... | init with current time if None were specify. | 625941c830dc7b76659019c6 |
def getAvailableUpdates(self): <NEW_LINE> <INDENT> socket.setdefaulttimeout(5) <NEW_LINE> conn = httplib.HTTPConnection('www.mmass.org') <NEW_LINE> try: <NEW_LINE> <INDENT> conn.connect() <NEW_LINE> url = '/update.php?version=%s&platform=%s' % (config.version, platform.platform()) <NEW_LINE> conn.request('GET', url) <N... | Check for available updates. | 625941c87047854f462a146a |
def tilt(value: float = 0.0, mirror: bool = False, proportional: int = 'DISABLED', proportional_edit_falloff: int = 'SMOOTH', proportional_size: float = 1.0, snap: bool = False, snap_target: int = 'CLOSEST', snap_point: float = (0.0, 0.0, 0.0), snap_align: bool = False, snap_normal: float = (0.0, 0.0, 0.0), release_con... | Tilt selected control vertices of 3D curve
:param value: Angle
:type value: float
:param mirror: Mirror Editing
:type mirror: bool
:param proportional: Proportional EditingDISABLED Disable, Proportional Editing disabled.ENABLED Enable, Proportional Editing enabled.PROJECTED Projected (2D), Proportional Editing usin... | 625941c8cc40096d615959b0 |
def init_table(self): <NEW_LINE> <INDENT> self.create_table() | Create the table and initialize data | 625941c8462c4b4f79d1d72f |
def on_failure(self, exc, task_id, args, kwargs, einfo): <NEW_LINE> <INDENT> entry_id = args[0] <NEW_LINE> mark_entry_failed(entry_id, exc) <NEW_LINE> entry = mgg.database.MediaEntry.query.filter_by(id=entry_id).first() <NEW_LINE> json_processing_callback(entry) <NEW_LINE> mgg.database.reset_after_request() | If the processing failed we should mark that in the database.
Assuming that the exception raised is a subclass of
BaseProcessingFail, we can use that to get more information
about the failure and store that for conveying information to
users about the failure, etc. | 625941c8627d3e7fe0d68eae |
def prefill(self, items): <NEW_LINE> <INDENT> self.model.clear() <NEW_LINE> inserted = {} <NEW_LINE> for item in items: <NEW_LINE> <INDENT> if len(item) == 3: <NEW_LINE> <INDENT> label, data, pixbuf = item <NEW_LINE> <DEDENT> elif len(item) == 2: <NEW_LINE> <INDENT> label, data = item <NEW_LINE> pixbuf = None <NEW_LINE... | Prefill items for selection.
:param items: a sequence of tuples containing: (label, data) or
even (label, data, pixbuf) if one wants to display a pixbuf
next to the label | 625941c85fc7496912cc39dd |
def label_remapping(reports,kb=None,result_field=None,drop_result=True): <NEW_LINE> <INDENT> if kb == None: <NEW_LINE> <INDENT> kb = load_knowledge_base() <NEW_LINE> <DEDENT> new_columns = ["PE_PRESENT_label","CERTAINTY_label","QUALITY_label", "LOOKING_FOR_PE_label","ACUITY_label"] <NEW_LINE> for new_column in new_colu... | label_remapping will take the PEFinder result present in result_field
and map it to a different schema.
:param reports: the pandas data frame of reports from analyze_reports
:param result_field: the result field where the result is present.
:param drop_result: drop the raw result in favor of the remapping (default True... | 625941c844b2445a339320f5 |
def makeRequest(url, method): <NEW_LINE> <INDENT> request = [] <NEW_LINE> request.append(method + ' ') <NEW_LINE> qMark = url.find('?') <NEW_LINE> indSlash = url.find('/') <NEW_LINE> if (indSlash != -1): <NEW_LINE> <INDENT> if(qMark != -1): <NEW_LINE> <INDENT> request.append(url[indSlash:qMark] + ' ') <NEW_LINE> <DEDEN... | Make a request using the method typed by the user.
Args:
url: Url typed by the user.
method: POST, PUT or DELETE method.
Return:
request: A vector following the pattern;
[0] => request.
[1] => location.
[2] => protocol.
[3] => host.
... | 625941c821bff66bcd6849b3 |
def test_suite(): <NEW_LINE> <INDENT> test(calc_det_3_dim(m), -12) | Run the suite of tests for code in this module (this file).
| 625941c8d4950a0f3b08c3af |
def constrained_aggregate_choice(choosers, alt_weights, alt_capacities=None, normalize_probs=True): <NEW_LINE> <INDENT> if alt_capacities is None: <NEW_LINE> <INDENT> unit_probs = get_probs(alt_weights) <NEW_LINE> alt_probs = unit_probs <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> gtz = (alt_capacities > 0) & (alt_wei... | Chooses among alternatives based on the provided weights, while respecting
alternative capacities. Choosers are randomly assigned to the chosen alternatives.
To mimimic the existing behavior of `urbansim.models.dcm.unit_choice`, run this
withouth providing `alt_capacities`.
Parameters:
-----------
choosers: pandas.Da... | 625941c8aad79263cf390a9f |
def deep_version_inputs_update(self): <NEW_LINE> <INDENT> raise NotImplementedError("deep_version_inputs_update is not implemented") | Updates the inputs of the references of the current scene
| 625941c8377c676e91272208 |
def test_write_auto_filter_12(self): <NEW_LINE> <INDENT> filter_condition = 'x == 1000' <NEW_LINE> exp = '<autoFilter ref="A1:D51"><filterColumn colId="2"><filters><filter val="1000"/></filters></filterColumn></autoFilter>' <NEW_LINE> self.worksheet.filter_column(2, filter_condition) <NEW_LINE> self.worksheet._write_au... | Test the _write_auto_filter() method | 625941c86fece00bbac2d79d |
def setUp(self): <NEW_LINE> <INDENT> self._plugin = lfu.BootVerificationPlugin() | Sets up the needed objects used throughout the test. | 625941c826068e7796caed3d |
def parse_args(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description="Train model to classify ASL digits", formatter_class=argparse.ArgumentDefaultsHelpFormatter) <NEW_LINE> info_options_group = parser.add_argument_group("Info") <NEW_LINE> info_options_group.add_argument("--job-dir", default=None, help="J... | Parse the command line options for this file
:return: An argparse object containing parsed arguments | 625941c866673b3332b920f0 |
def get_failed_rows_as_list(self): <NEW_LINE> <INDENT> assert self.has_unmatched_rows, 'Before calling this, check that "has_unmatched_rows" is True' <NEW_LINE> if self.has_error: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return self.build_failed_rows() | Return the failed rows as a python list | 625941c807d97122c41788e9 |
def log1p(x): <NEW_LINE> <INDENT> if sys.version_info > (2, 6): <NEW_LINE> <INDENT> return math.log1p(x) <NEW_LINE> <DEDENT> y = 1 + x <NEW_LINE> z = y - 1 <NEW_LINE> return x if z == 0 else x * math.log(y) / z | log(1 + x) accurate for small x (missing from python 2.5.2) | 625941c8498bea3a759b9b0e |
def edit(request, id): <NEW_LINE> <INDENT> return base.edit(request, Challenge, id) | Edit page of Challenge section.
@param request: request data
@type request: Django request
@param id: id of item to edit
@type id: integer
@return: rendered response page
@rtype: Django response | 625941c8cc0a2c11143dcef0 |
def bin_column_analysis(bin_column: pd.Series): <NEW_LINE> <INDENT> print(bin_column.describe()) <NEW_LINE> print("There are "+bin_column.isnull().sum()+" nan values") <NEW_LINE> print("Null values accounts for %2f".format(bin_column.isnull().sum()/len(bin_column))) <NEW_LINE> print("In this column, there are ", bin_c... | 用于分析二分类特征的空值数量、占比情况和取值情况
:param bin_column:
:return: | 625941c8eab8aa0e5d26dbb7 |
def getUnitOnComponent(self, *args): <NEW_LINE> <INDENT> return _MEDCouplingRemapper.DataArray_getUnitOnComponent(self, *args) | getUnitOnComponent(self, int i) -> string
1 | 625941c8435de62698dfdcac |
def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'content': 'list[TransacaoNaoProcessadaResponse]', 'first': 'bool', 'first_page': 'bool', 'has_content': 'bool', 'has_next_page': 'bool', 'has_previous_page': 'bool', 'last': 'bool', 'next_page': 'int', 'number': 'int', 'number_of_elements': 'int', 'previou... | PageTransacaoNaoProcessadaResponse - a model defined in Swagger
:param dict swaggerTypes: The key is attribute name
and the value is attribute type.
:param dict attributeMap: The key is attribute name
and the value is json key in definition. | 625941c8956e5f7376d70ecd |
def _get_available_filters(self, cr, uid, context=None): <NEW_LINE> <INDENT> res_filter = super(StockInventory, self)._get_available_filters( cr, uid, context=context) <NEW_LINE> res_filter.append(('categories', _('Selected Categories'))) <NEW_LINE> res_filter.append(('products', _('Selected Products'))) <NEW_LINE> for... | This function will return the list of filter allowed according to
the options checked in 'Settings\Warehouse'.
:return: list of tuple | 625941c863d6d428bbe4454f |
def testAddonPurchaseListResponse(self): <NEW_LINE> <INDENT> pass | Test AddonPurchaseListResponse | 625941c8bde94217f3682e51 |
def _t(self): <NEW_LINE> <INDENT> a, b = self.freq <NEW_LINE> vertices = self.vertices <NEW_LINE> group = self.group <NEW_LINE> anorm = a**2 + a * b + b**2 <NEW_LINE> x = vertices[:, 0] <NEW_LINE> y = vertices[:, 1] <NEW_LINE> q = a - b <NEW_LINE> line1 = x == 0 <NEW_LINE> line1_seg = y <= max(a, b) <NEW_LINE> line2 = ... | Initialization for triangle breakdowns | 625941c8a79ad161976cc1a5 |
def verify(sender, payload): <NEW_LINE> <INDENT> assert sender == consumer <NEW_LINE> assert payload == body | Verify signal is sent as expected. | 625941c8a8370b7717052900 |
def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <... | Returns the model properties as a dict | 625941c850485f2cf553cdf9 |
def extractValues(self,fName): <NEW_LINE> <INDENT> if self.__defaultValueNames: <NEW_LINE> <INDENT> self.__valueNames=self.__defaultValueNames[:] <NEW_LINE> return self.__valueNames <NEW_LINE> <DEDENT> if self.__namesFromFirstLine: <NEW_LINE> <INDENT> line=open(path.join(self.dir,fName)).readline().split() <NEW_LINE> i... | Extracts the names of the contained Values from a filename | 625941c8b545ff76a8913e76 |
def delete_smb_openfile_with_http_info(self, smb_openfile_id, **kwargs): <NEW_LINE> <INDENT> all_params = ['smb_openfile_id'] <NEW_LINE> all_params.append('async') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NE... | delete_smb_openfile # noqa: E501
Close the file in the SMB server. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async=True
>>> thread = api.delete_smb_openfile_with_http_info(smb_openfile_id, async=True)
>>> result = thread.get()
:param asyn... | 625941c8a4f1c619b28b009b |
def ifftn(a, s=None, axes=None): <NEW_LINE> <INDENT> return _raw_fftnd(a, s, axes, ifft) | Compute the N-dimensional inverse discrete Fourier Transform.
This function computes the inverse of the N-dimensional discrete
Fourier Transform over any number of axes in an M-dimensional array by
means of the Fast Fourier Transform (FFT). In other words,
``ifftn(fftn(a)) == a`` to within numerical accuracy.
For a d... | 625941c8293b9510aa2c32f7 |
def test_pydotprint_profile(): <NEW_LINE> <INDENT> if not theano.printing.pydot_imported: <NEW_LINE> <INDENT> raise SkipTest('pydot not available') <NEW_LINE> <DEDENT> A = tensor.matrix() <NEW_LINE> prof = theano.compile.ProfileStats(atexit_print=False, gpu_checks=False) <NEW_LINE> f = theano.function([A], A + 1, profi... | Just check that pydotprint does not crash with profile. | 625941c83346ee7daa2b2dca |
def getReverseConnectionStatus(self): <NEW_LINE> <INDENT> return self.read_bit(1316, 1) | Returns reverse connection status flag. 0=ok 1=reversed. | 625941c8a219f33f346289cb |
def get_text(file_name): <NEW_LINE> <INDENT> with open(file_name, 'r') as prophetic_html: <NEW_LINE> <INDENT> tree = lxml.html.parse(prophetic_html) <NEW_LINE> root = tree.getroot() <NEW_LINE> text = root.xpath('body/pre')[0].text_content() <NEW_LINE> return text | Seperate the prophecy text from html noise and return the text. | 625941c823849d37ff7b30f0 |
def birth_before_death(indivs_df: pd.DataFrame) -> pd.DataFrame: <NEW_LINE> <INDENT> indivs = indivs_df[~indivs_df['BIRTHDAY'].isna() & ~indivs_df['DEATH'].isna()] <NEW_LINE> res = indivs[indivs['BIRTHDAY'].apply(parse_date) > indivs['DEATH'].apply(parse_date)] <NEW_LINE> return res | Detect all Birth dates which are before death
:param indivs_df: Individual data frame
:return: All indivis which Birth date is before death | 625941c88e05c05ec3eea3d4 |
def time_str(): <NEW_LINE> <INDENT> return "".join(str(datetime.datetime.now().time()).split(".")[0]) | Returns string-formatted local time in format hours:minutes:seconds. | 625941c8ff9c53063f47c254 |
def _get_kitchens_info(self): <NEW_LINE> <INDENT> kitchens = {} <NEW_LINE> for kitchen in self._api_request(API_GET, 'kitchen', 'list').json()['kitchens']: <NEW_LINE> <INDENT> name = kitchen['name'] <NEW_LINE> if name in kitchens: <NEW_LINE> <INDENT> raise ValueError( f'More than 1 kitchen with the name: {name} found i... | Get information about available kitchens
Raises
------
HTTPError
If the request fails.
Returns
-------
dict
A dictionary keyed by kitchen name containing information about each kitchen.
For example::
{"test_kitchen": {
'_created': None,
'_finished': False,
'cre... | 625941c8baa26c4b54cb1180 |
def strip(self): <NEW_LINE> <INDENT> return str(self).strip() | Returns contents stripped of leading and trailing whitespace. | 625941c8711fe17d825423cd |
def compare_group(self): <NEW_LINE> <INDENT> return self._call('GET', 'compareGroup', auth=False) | This service has been deprecated and is no longer available.
Authorization not required.
http://www.last.fm/api/show/tasteometer.compareGroup | 625941c8de87d2750b85fdf2 |
def test_ipam_rirs_update(self): <NEW_LINE> <INDENT> pass | Test case for ipam_rirs_update
| 625941c83d592f4c4ed1d0d0 |
def _in_place_subclassed_model_reset(model): <NEW_LINE> <INDENT> assert not model._is_graph_network <NEW_LINE> attributes_cache = {} <NEW_LINE> for name in dir(model): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value = getattr(model, name) <NEW_LINE> <DEDENT> except (AttributeError, ValueError, TypeError): <NEW_LINE>... | Substitute for model cloning that works for subclassed models.
Subclassed models cannot be cloned because their topology is not serializable.
To "instantiate" an identical model in a new TF graph, we reuse the original
model object, but we clear its state.
After calling this function on a model instance, you can use ... | 625941c81b99ca400220ab11 |
def CreateInstance(self, instance, image_name, image_project, build_target=None, branch=None, build_id=None, kernel_branch=None, kernel_build_id=None, kernel_build_target=None, blank_data_disk_size_gb=None, avd_spec=None, extra_scopes=None, system_build_target=None, system_branch=None, system_build_id=None): <NEW_LINE>... | Create/Reuse a single configured cuttlefish device.
1. Prepare GCE instance.
Create a new instnace or get IP address for reusing the specific instance.
2. Put fetch_cvd on the instance.
3. Invoke fetch_cvd to fetch and run the instance.
Args:
instance: instance name.
image_name: A string, the name of the GC... | 625941c8796e427e537b0625 |
def unit(self, _): <NEW_LINE> <INDENT> raise exceptions.UnitError("Time fields do not have units") | Unit of fields | 625941c83317a56b86939cba |
def response(): <NEW_LINE> <INDENT> keyword = request.args.get('keyword') <NEW_LINE> return get_recommendations(keyword) | Response handler to api call | 625941c86e29344779a62673 |
def either_one_none(val1: Optional[Any], val2: Optional[Any]) -> bool: <NEW_LINE> <INDENT> return (val1 is None and val2 is not None) or (val1 is not None and val2 is None) | Test if exactly one value is None. | 625941c8cdde0d52a9e53092 |
def get_li_diag_status_labels(device): <NEW_LINE> <INDENT> if 'RF' in device: <NEW_LINE> <INDENT> return _et.DIAG_STATUS_LABELS_RF <NEW_LINE> <DEDENT> if 'PU' in device: <NEW_LINE> <INDENT> return _et.DIAG_STATUS_LABELS_PU <NEW_LINE> <DEDENT> if 'HVPS' in device: <NEW_LINE> <INDENT> return _et.DIAG_STATUS_LABELS_EG_HVP... | Return Diag Status Labels enum. | 625941c83317a56b86939cbb |
def add_arguments(parser): <NEW_LINE> <INDENT> return parser | Populate the given argparse.ArgumentParser with arguments.
This function can be used to make the definition these argparse arguments
reusable in other modules and avoid the duplication of these definitions
among the executable scripts.
The following arguments are added to the parser:
- **...** (...): ...
Parameters... | 625941c86aa9bd52df036e04 |
def test_authorization_is_enforced(self): <NEW_LINE> <INDENT> new_client = APIClient() <NEW_LINE> response = new_client.get('/lunisolar/moonshot/', kwargs={'pk': 3}, format="json") <NEW_LINE> self.assertEqual(response.status_code, status.HTTP_401_UNAUTHORIZED) | Test that the api has user authorization | 625941c8009cb60464c63412 |
def _libvirt_network_exec(netname, action): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> cmd = ['virsh', 'net-list', '--all'] <NEW_LINE> out = check_output(cmd).decode('UTF-8').splitlines() <NEW_LINE> if len(out) < 3: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for line in out[2:]: <NEW_LINE> <INDENT> res = re.searc... | Run action on libvirt network | 625941c85166f23b2e1a51b9 |
def testCovHessianNumericGLambda(self): <NEW_LINE> <INDENT> pn1 = 0 <NEW_LINE> pn2 = 6 <NEW_LINE> values = linspace(1, 10) <NEW_LINE> pos = 0.1 <NEW_LINE> p1 = self.particles[pn1] <NEW_LINE> p2 = self.particles[pn2] <NEW_LINE> PFunc = MockFunc(p1.set_nuisance, lambda a: self.gpi.get_posterior_covariance_derivative( a, ... | test the hessian of the gpi numerically for G and Lambda | 625941c860cbc95b062c65a3 |
def test04_unicode_date(self): <NEW_LINE> <INDENT> founded = datetime(1857, 5, 23) <NEW_LINE> mansfield = PennsylvaniaCity.objects.create(name='Mansfield', county='Tioga', point='POINT(-77.071445 41.823881)', founded=founded) <NEW_LINE> self.assertEqual(founded, PennsylvaniaCity.objects.dates('founded', 'day')[0]) | Testing dates are converted properly, even on SpatiaLite, see #16408. | 625941c8711fe17d825423ce |
def SaveConfig(): <NEW_LINE> <INDENT> Update() <NEW_LINE> MCPath_Str = MCPath_StringVar.get() <NEW_LINE> DRAM_Str = DRAM_StringVar.get() <NEW_LINE> ForgetMe_Int = int(RememberMe_Var.get()) <NEW_LINE> NotFailedDRAMCheck = True <NEW_LINE> try: <NEW_LINE> <INDENT> DRAM_Str = int(DRAM_Str) <NEW_LINE> if DRAM_Str <= 0: <NEW... | This is the first time i use a def in a def | 625941c82eb69b55b151c90e |
def get_trans_coords(img): <NEW_LINE> <INDENT> def onclick(event): <NEW_LINE> <INDENT> toolbar = plt.get_current_fig_manager().toolbar <NEW_LINE> if toolbar.mode!='': <NEW_LINE> <INDENT> print("clicked, but toolbar is in mode {:s}.".format(toolbar.mode)) <NEW_LINE> <DEDENT> elif event.xdata and event.ydata is not None:... | Function for getting the four x,y coordinates for the geometric transformation.
Click rule: Upper left, upper right, lower left, lower right | 625941c80a366e3fb873e87a |
def working_copy(remote_url, path=None, branch="master", update=True, use_sudo=False, user=None): <NEW_LINE> <INDENT> if path is None: <NEW_LINE> <INDENT> path = remote_url.split('/')[-1].rstrip('.git') <NEW_LINE> <DEDENT> if is_dir(path, use_sudo=use_sudo) and update: <NEW_LINE> <INDENT> git.fetch(path=path, use_sudo=... | Require a working copy of the repository from the ``remote_url``.
The ``path`` is optional, and defaults to the last segment of the
remote repository URL, without its ``.git`` suffix.
If the ``path`` does not exist, this will clone the remote
repository and check out the specified branch.
If the ``path`` exists and ... | 625941c84f6381625f114a9b |
def test_mixed_dump_load(self): <NEW_LINE> <INDENT> payload = salt.payload.Serial("msgpack") <NEW_LINE> dtvalue = datetime.datetime(2001, 2, 3, 4, 5, 6, 7) <NEW_LINE> od = OrderedDict() <NEW_LINE> od["a"] = "b" <NEW_LINE> od["y"] = "z" <NEW_LINE> od["j"] = "k" <NEW_LINE> od["w"] = "x" <NEW_LINE> idata = { dtvalue: dtva... | Test we can handle all exceptions at once | 625941c8a17c0f6771cbe0b2 |
def literal_destringizer(rep): <NEW_LINE> <INDENT> msg = "literal_destringizer is deprecated and will be removed in 3.0." <NEW_LINE> warnings.warn(msg, DeprecationWarning) <NEW_LINE> if isinstance(rep, str): <NEW_LINE> <INDENT> orig_rep = rep <NEW_LINE> try: <NEW_LINE> <INDENT> return literal_eval(rep) <NEW_LINE> <DEDE... | Convert a Python literal to the value it represents.
Parameters
----------
rep : string
A Python literal.
Returns
-------
value : object
The value of the Python literal.
Raises
------
ValueError
If `rep` is not a Python literal. | 625941c899fddb7c1c9de3f2 |
def show_object(key_field, lst): <NEW_LINE> <INDENT> if len(lst) == 0: <NEW_LINE> <INDENT> print('I: There are no objects in list') <NEW_LINE> return <NEW_LINE> <DEDENT> while True: <NEW_LINE> <INDENT> print('0. Exit') <NEW_LINE> for idx,obj in enumerate(lst): <NEW_LINE> <INDENT> print('{}. {}'.format(idx+1, getattr(ob... | Show field value of each element in list | 625941c8a8ecb033257d312e |
def unregister_company(self, company_id, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.unregister_company_with_http_info(company_id, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.unregister_company_wi... | Unregister company # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.unregister_company(company_id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str company_id: (required)
:return: Company
... | 625941c84c3428357757c389 |
def create_fund(self): <NEW_LINE> <INDENT> return self.go("create fund") | Click <Create fund>
Goes to SCR_0184 | 625941c8460517430c3941e8 |
def __gt__(self, other): <NEW_LINE> <INDENT> if not self in other and not other in self: <NEW_LINE> <INDENT> raise ValueError("keyentities must be parent for this comparison.") <NEW_LINE> <DEDENT> sulci_logger.debug(u"Comparing '%s' and '%s'" % (unicode(self), unicode(other)), "GRAY") <NEW_LINE> sulci_logger.debug(self... | We try here to define which from two keyentities competitor is the
best concentrate of information.
(Remember that if an expression A is included in B, A is mathematicaly
almost frequent than B.)
Examples :
- Ernesto Che Guevara, is more informative than "Che" or "Che
Guevara", even if "Che Guevara" is very more freq... | 625941c8a05bb46b383ec883 |
def get_ip_pcap(ifs,sender,size=100): <NEW_LINE> <INDENT> if 'www.' in sender: <NEW_LINE> <INDENT> with os.popen('ping %s -c 1'%sender) as readPing: <NEW_LINE> <INDENT> v = readPing.read() <NEW_LINE> ip = v.split()[2] <NEW_LINE> print("准备接收IP为 %s 的数据包..."%ip) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> ip = ... | 获取指定 ifs(网卡), 指定发送方 sender(域名或ip) 的数据包
size:(一次获取数据包的数量) | 625941c84527f215b584c4b8 |
def remove(self, square: Square) -> None: <NEW_LINE> <INDENT> mask = BB_SQUARES[square] <NEW_LINE> if self.mask & mask: <NEW_LINE> <INDENT> self.mask ^= mask <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise KeyError(square) | Removes a square from the set.
:raises: :exc:`KeyError` if the given square was not in the set. | 625941c8aad79263cf390aa0 |
def main(): <NEW_LINE> <INDENT> s = '0123h567h9h0123' <NEW_LINE> start = s.find('h') <NEW_LINE> finish = s.rfind('h') + 1 <NEW_LINE> s = s[:start] + s[finish:] <NEW_LINE> print(s) | Start the main function. | 625941c83539df3088e2e3ab |
def __init__(self, module): <NEW_LINE> <INDENT> CppClassBase.__init__(self) <NEW_LINE> assert isinstance(module, Module) <NEW_LINE> self._module = module <NEW_LINE> self.class_name = module.get_run_thread_cpp_class_name() <NEW_LINE> self.fields = [ "quint32 index_", "QVariantList args_", "class %s* plugin_" % module.ge... | Initializes from actor module tree | 625941c84d74a7450ccd4224 |
def get_stalest_node(self): <NEW_LINE> <INDENT> if self.empty(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return min(self._nodes, key = lambda node: node.last_updated) | Returns the node that has been refreshed the longest time ago
If this KBucket is empty, None is returned | 625941c8046cf37aa974cda9 |
def testEditWithToneNone(self): <NEW_LINE> <INDENT> self._editImage('fx',1) <NEW_LINE> assert d(text = 'SAVE').wait.gone(timeout = 2000) | Summary: Enter toning interface with selected none mode
Steps: 1.Enter full view
2.Click setting menu
3.Touch edit
4.Touch toning icon
5.Touch none mode
6.Touch save | 625941c8b5575c28eb68e060 |
def __init__( self, *, quarantine_policy: Optional["QuarantinePolicy"] = None, trust_policy: Optional["TrustPolicy"] = None, retention_policy: Optional["RetentionPolicy"] = None, **kwargs ): <NEW_LINE> <INDENT> super(Policies, self).__init__(**kwargs) <NEW_LINE> self.quarantine_policy = quarantine_policy <NEW_LINE> sel... | :keyword quarantine_policy: The quarantine policy for a container registry.
:paramtype quarantine_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.QuarantinePolicy
:keyword trust_policy: The content trust policy for a container registry.
:paramtype trust_policy: ~azure.mgmt.containerregistry.v2019_05_01.models.... | 625941c8ac7a0e7691ed412e |
def set(self, param=None, value=None, category='val', sim_index=None, update=True): <NEW_LINE> <INDENT> if category not in ['val', 'err', 'sim']: <NEW_LINE> <INDENT> raise RelaxError("The category of the parameter '%s' is incorrectly set to %s - it must be one of 'val', 'err' or 'sim'." % (param, category)) <NEW_LINE> ... | Set a alignment tensor parameter.
@keyword param: The name of the parameter to set.
@type param: str
@keyword value: The parameter value.
@type value: anything
@keyword category: The type of parameter to set. This can be 'val' for the normal parameter, 'err' for the parameter error, or 'sim' fo... | 625941c80c0af96317bb8248 |
def _updatePortSettings(self): <NEW_LINE> <INDENT> self.loaded_signal.disconnect(self._updatePortSettings) <NEW_LINE> if "ports" in self._node_info: <NEW_LINE> <INDENT> ports = self._node_info["ports"] <NEW_LINE> for topology_port in ports: <NEW_LINE> <INDENT> for port in self._ports: <NEW_LINE> <INDENT> adapter_number... | Updates port settings when loading a topology. | 625941c8fff4ab517eb2f49c |
def set_min_output_buffer(self, *args): <NEW_LINE> <INDENT> return _Research_swig.soqpsk_det_filter_cc_sptr_set_min_output_buffer(self, *args) | set_min_output_buffer(soqpsk_det_filter_cc_sptr self, long min_output_buffer)
set_min_output_buffer(soqpsk_det_filter_cc_sptr self, int port, long min_output_buffer) | 625941c87c178a314d6ef4bf |
def IsItemChecked(self, item): <NEW_LINE> <INDENT> item = self.GetItem(item, item._col) <NEW_LINE> return item.IsChecked() | Returns whether an item is checked or not.
:param `item`: an instance of :class:`UltimateListItem`. | 625941c8442bda511e8be47a |
def test_pride(): <NEW_LINE> <INDENT> proj = ppx.pride.list_projects() <NEW_LINE> assert len(proj) > 10000 <NEW_LINE> assert all((p.startswith("PXD") or p.startswith("PRD")) for p in proj) | Test that we can get pride projects | 625941c8d99f1b3c44c675f0 |
def _sanitize_input(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._device_number = blockdev.s390.sanitize_dev_input(self._device_number) <NEW_LINE> self._wwpn = blockdev.s390.zfcp_sanitize_wwpn_input(self._wwpn) <NEW_LINE> self._lun = blockdev.s390.zfcp_sanitize_lun_input(self._lun) <NEW_LINE> <DEDENT> excep... | Sanitize the input values. | 625941c876e4537e8c3516d2 |
def getOrderedLikes(): <NEW_LINE> <INDENT> likeDict = {} <NEW_LINE> recipes = session.query(Recipe) <NEW_LINE> for recipe in recipes: <NEW_LINE> <INDENT> likeDict[recipe.id] = 0 <NEW_LINE> <DEDENT> likes = session.query(Like) <NEW_LINE> for like in likes: <NEW_LINE> <INDENT> likeDict[like.recipe_id] += 1 <NEW_LINE> <DE... | function to order recipes based on how many likes each one has | 625941c8baa26c4b54cb1181 |
def factory_entry_widget(data_type, parent): <NEW_LINE> <INDENT> if data_type.lower() == "metabolite": <NEW_LINE> <INDENT> return MetaboliteEntryDisplayWidget(parent) <NEW_LINE> <DEDENT> elif data_type.lower() == "reaction": <NEW_LINE> <INDENT> return ReactionEntryDisplayWidget(parent) <NEW_LINE> <DEDENT> else: <NEW_LI... | Factory for the database entry display widget
Parameters
----------
data_type: str
parent: QWidget or None
Returns
------- | 625941c815fb5d323cde0b6f |
def autoAnalyzeAbf(abf, reanalyze=True): <NEW_LINE> <INDENT> if isinstance(abf, str): <NEW_LINE> <INDENT> abf = pyabf.ABF(abf, False) <NEW_LINE> <DEDENT> assert isinstance(abf, pyabf.ABF) <NEW_LINE> log.debug(f"Auto-analyzing {abf.abfID}.abf") <NEW_LINE> matchingFiles = abfnav.dataFilesForAbf(abf.abfFilePath) <NEW_LINE... | Given an abf filename (or ABF object), produce an analysis graph of its
data. If the protocol has a known analysis routine, run it. If not, run
the unknown() analysis routine. In all cases, an input ABF should produce
at least some type of output graph. | 625941c8925a0f43d2549ed7 |
def __fetch(self, ingest_item, destinations): <NEW_LINE> <INDENT> archive_items = [] <NEW_LINE> for destination in destinations: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> item_id = get_resource_service('fetch') .fetch([{'_id': ingest_item['_id'], 'desk': str(destination.get('desk')), 'stage': str(... | Fetch to item to the destinations
:param item: item to be fetched
:param destinations: list of desk and stage | 625941c82ae34c7f2600d192 |
def _get_handlers(self, prefix): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> handlers = self._handlers <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> handlers = [] <NEW_LINE> L = len(prefix) <NEW_LINE> for f in dir(self): <NEW_LINE> <INDENT> a = getattr(self, f) <NEW_LINE> if callable(a) and f.startswi... | return a list of all event types for which it looks like
the module has handlers. If the module has defined _on_join and
_on_kick, then this will return ['join', 'kick']
if the attribute self._handlers is defined, it will be returned
instead | 625941c8e5267d203edcdcff |
def __init__(self, device): <NEW_LINE> <INDENT> super().__init__(device) | Class constructor. Instantiates a new ``DigiMeshNetwork``.
Args:
device (:class:`.DigiMeshDevice`): the local DigiMesh device to get the network from.
Raises:
ValueError: if ``device`` is ``None``. | 625941c85166f23b2e1a51ba |
def Q_weir_rectangular_Kindsvater_Carter(h1, h2, b): <NEW_LINE> <INDENT> return 0.554*(1 - 0.0035*h1/h2)*(b + 0.0025)*sqrt(g)*(h1 + 0.0001)**1.5 | Calculates the flow rate across rectangular weir from
the height of the liquid above the crest of the notch, the liquid depth
beneath it, and the width of the notch. Model from [1]_ as reproduced in
[2]_.
Flow rate is given by:
.. math::
Q = 0.554\left(1 - 0.0035\frac{h_1}{h_2}\right)(b + 0.0025)
\sqrt{g}(h_1... | 625941c8287bf620b61d3ac5 |
def local_tunnel(self,local_port,remote_host,remote_port,bind_addr='127.0.0.1',error_level=enums.TunnelErrorLevel.warn): <NEW_LINE> <INDENT> if isinstance(remote_host,type('')) and isinstance(remote_port,type(0)): <NEW_LINE> <INDENT> option_string = str(bind_addr)+':'+str(local_port)+':'+remote_host+':'+str(remote_port... | Forwards a port on the remote machine the same way the ``-L`` option does for the OpenSSH client.
Providing a ``0`` for the local port will mean the OS will assign an unbound port for you.
This port number will be provided to you by this function.
:param local_port: The local port on the local machine to bind to.
:ty... | 625941c815baa723493c3fd5 |
def run(self, edit, target='browser'): <NEW_LINE> <INDENT> settings = sublime.load_settings("MarkdownPreview.sublime-settings") <NEW_LINE> md_map = settings.get('markdown_binary_map', {}) <NEW_LINE> parsers = [ "markdown", GithubCompiler.compiler_name, GitlabCompiler.compiler_name ] <NEW_LINE> for k in md_map.keys(): <... | Show menu of parsers to select from. | 625941c8097d151d1a222ebb |
def configure_osp(admin_password=None, forward_zone=None, reverse_zone=None, template_url=None): <NEW_LINE> <INDENT> if reverse_zone is None: <NEW_LINE> <INDENT> reverse_zone = os.environ.get('OSP_REVERSE_ZONE') <NEW_LINE> <DEDENT> if forward_zone is None: <NEW_LINE> <INDENT> forward_zone = os.environ.get('OSP_FORWARD_... | Configure the named service for OSP Compute Resource.
Expects the following environment variables:
OSP_REVERSE_ZONE
Reverse zone values Example: "179.29.10 178.28.10 177.27.10".
OSP_FORWARD_ZONE
Forward zone value Example: "lab.hyd.redhat.com".
OSP_FINISH_TEMPLATE_URL
The Satellite6 kickstart finish tem... | 625941c8c4546d3d9de72a94 |
def hit(self): <NEW_LINE> <INDENT> self.live = 0 <NEW_LINE> canv.delete(self.id) | Попадание шарика в цель.
Удаляем цель, если попадание произошло. | 625941c8be8e80087fb20ca5 |
def get_config(APP_CONFIG): <NEW_LINE> <INDENT> config = dict() <NEW_LINE> BASE_VARS = load_yaml("env_config/base.yaml") <NEW_LINE> APP_CONFIG_VARS = load_yaml(f"env_config/{APP_CONFIG}.yaml") <NEW_LINE> logger.info(f'APP_CONFIG: {APP_CONFIG}') <NEW_LINE> DB_USER = APP_CONFIG_VARS['PSQL_DB_USERNAME'] <NEW_LINE> DB_PASS... | Load all configuration information including
constants defined above.
(BASE_VARS are the same regardless of whether we are debugging or in production) | 625941c832920d7e50b28230 |
def main(): <NEW_LINE> <INDENT> os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'to_do_project.settings') <NEW_LINE> try: <NEW_LINE> <INDENT> from django.core.management import execute_from_command_line <NEW_LINE> <DEDENT> except ImportError as exc: <NEW_LINE> <INDENT> raise ImportError( "Couldn't import Django. Are yo... | Run administrative tasks. | 625941c8a219f33f346289cc |
def get_jump_designmatrix(self, cand, fitpatch=None): <NEW_LINE> <INDENT> patches = cand.get_patches(fitpatch=fitpatch) <NEW_LINE> npatches = len(patches) <NEW_LINE> Mj = np.zeros((self.nobs, npatches)) <NEW_LINE> for pp, patch in enumerate(patches): <NEW_LINE> <INDENT> Mj[patch,pp] = True <NEW_LINE> <DEDENT> return Mj... | Obtain the design matrix of inter-coherence-patch jumps
Obtain the design matrix of jumps that disconnect all the coherence
patches that are not phase connected.
:param cand:
CandidateSolution candidate
:param fitpatch:
If not None, exclude this patch from the designmatrix jumps | 625941c807d97122c41788ea |
def _indStr(ind): <NEW_LINE> <INDENT> return "ID=%s" % ind.ID | Compact way to print out some info about an ind | 625941c845492302aab5e323 |
@db_session <NEW_LINE> def schedule_class(day: date, expected_start: time, expected_finish: time, student_id: int, instructor_id: int): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> student = Student[student_id] <NEW_LINE> <DEDENT> except ObjectNotFound: <NEW_LINE> <INDENT> abort(404) <NEW_LINE> <DEDENT> nl_s = expected... | Agenda uma nova aula, assumindo conhecidos todos os parâmetros | 625941c8462c4b4f79d1d731 |
def predict( self, y, t=None, *, return_cov=False, return_var=False, include_mean=True, kernel=None, ): <NEW_LINE> <INDENT> y = self._process_input(y, inplace=True, require_vector=True) <NEW_LINE> return ConditionalDistribution( self, y, t=t, include_mean=include_mean, kernel=kernel ) | Compute the conditional distribution
The factorized matrix from the previous call to
:func:`GaussianProcess.compute` is used so that method must be called
first.
Args:
y (shape[N]): The observations at coordinates ``t`` as defined by
:func:`GaussianProcess.compute`.
t (shape[M], optional): The indepen... | 625941c80383005118ecf644 |
def run(item_list): <NEW_LINE> <INDENT> bag = Bag() <NEW_LINE> for item in item_list: <NEW_LINE> <INDENT> bag.add(item) <NEW_LINE> <DEDENT> sys.stdout.write("size of bag = {}\n".format(bag.size())) <NEW_LINE> for s in bag: <NEW_LINE> <INDENT> sys.stdout.write(" BAG CONTAINS: {}\n".format(s)) | Add items to a Bad. Iterate through Bag. | 625941c85fc7496912cc39df |
def threeSum(self, nums): <NEW_LINE> <INDENT> nums.sort() <NEW_LINE> l = len(nums) <NEW_LINE> res = [] <NEW_LINE> for i in range(l-2): <NEW_LINE> <INDENT> n_i = nums[i] <NEW_LINE> if i==0 or n_i != nums[i-1]: <NEW_LINE> <INDENT> left = i+1 <NEW_LINE> right = l-1 <NEW_LINE> while left < right: <NEW_LINE> <INDENT> n_l = ... | :type nums: List[int]
:rtype: List[List[int]] | 625941c8627d3e7fe0d68eb0 |
def get_padding(north, south, west, east, padding=10): <NEW_LINE> <INDENT> padding /= 100 <NEW_LINE> dlat = abs(north - south) <NEW_LINE> dlon = abs(east - west) <NEW_LINE> return round(dlat * padding), round(dlon * padding) | Calculate a reasonable amount of padding for the map
:param north:
:type north:
:param south:
:type south:
:param west:
:type west:
:param east:
:type east:
:param padding:
:type padding:
:return: The amount of padding to apply
:rtype: int | 625941c87d847024c06be31b |
def get_notification_models(): <NEW_LINE> <INDENT> return [model for model in models.get_models() if getattr(model, 'create_notification', False) is True] | Utility that gets all notification models | 625941c8d8ef3951e324359e |
def get_editor(self, guess=None): <NEW_LINE> <INDENT> editor = BitmapEditor() <NEW_LINE> return editor | Opens a new empty window
| 625941c801c39578d7e74e9c |
def click_cost_policy_grid_inline_action_button(self, cost_policy): <NEW_LINE> <INDENT> is_clicked = None <NEW_LINE> try: <NEW_LINE> <INDENT> self.logger.info('Start: click cost policy grid inline action button') <NEW_LINE> self._price_page.click_cost_policy_grid_inline_action_button(cost_policy) <NEW_LINE> is_clicked ... | Returning click cost policy grid inline action button
Implementing logging for click cost policy grid inline action button functionality
:param cost_policy:
:return: True/False | 625941c850812a4eaa59c384 |
def isSocket(self): <NEW_LINE> <INDENT> st = self.statinfo <NEW_LINE> if not st: <NEW_LINE> <INDENT> self.restat(False) <NEW_LINE> st = self.statinfo <NEW_LINE> if not st: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> <DEDENT> return S_ISSOCK(st.st_mode) | Returns whether the underlying path is a socket.
@return: C{True} if it is a socket, C{False} otherwise
@rtype: L{bool}
@since: 11.1 | 625941c8d6c5a102081440ab |
def fuse_getitem(dsk, func, place): <NEW_LINE> <INDENT> return fuse_selections(dsk, getitem, func, lambda a, b: tuple(b[:place]) + (a[2],) + tuple(b[place + 1:])) | Fuse getitem with lower operation
Parameters
----------
dsk: dict
dask graph
func: function
A function in a task to merge
place: int
Location in task to insert the getitem key
>>> def load(store, partition, columns):
... pass
>>> dsk = {'x': (load, 'store', 'part', ['a', 'b']),
... 'y': (getite... | 625941c8e1aae11d1e749d17 |
def deserialize_numpy(self, str, numpy): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> end = 0 <NEW_LINE> start = end <NEW_LINE> end += 4 <NEW_LINE> (length,) = _struct_I.unpack(str[start:end]) <NEW_LINE> start = end <NEW_LINE> end += length <NEW_LINE> if python3: <NEW_LINE> <INDENT> self.object_name = str[start:end].de... | unpack serialized message in str into this message instance using numpy for array types
:param str: byte array of serialized message, ``str``
:param numpy: numpy python module | 625941c876d4e153a657eb92 |
def to_request(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> ( id, facebook_id, device_id, first_name, last_name, description, phone_number, karma, ) = self._record <NEW_LINE> return Profile( id, facebook_id, device_id, first_name, last_name, description, phone_number, karma ) <NEW_LINE> <DEDENT> except ValueErro... | Converts a record into a profile request
Throws InvalidRecordError | 625941c8fff4ab517eb2f49d |
def getTitle(self): <NEW_LINE> <INDENT> facets = ", ".join(self.getFacets().values()) <NEW_LINE> if len(facets) > 0: <NEW_LINE> <INDENT> return self.context.title + ": " + facets <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.context.title | Return page title, with headings attached | 625941c882261d6c526ab4ff |
def monthly_payment_schedule(self): <NEW_LINE> <INDENT> monthly = float(self.dollar(self.monthly_payment())) <NEW_LINE> additional = float(self.dollar(self.additional_pmt())) <NEW_LINE> balance = float(self.dollar(self.amount())) <NEW_LINE> end_balance = float(self.dollar(balance)) <NEW_LINE> rate = float(decimal.Decim... | Yields amortization schedule for the given loan | 625941c8377c676e9127220a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.