code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def add_group(self, state_group): <NEW_LINE> <INDENT> if self.states is not None: <NEW_LINE> <INDENT> raise core_exceptions.StateVectorAlreadyGenerated( 'Cannot add state groups after state vector has been generated.') <NEW_LINE> <DEDENT> if state_group not in self.groups: <NEW_LINE> <INDENT> self.groups.add(state_grou...
Add a state group to the simulator.
625941d599fddb7c1c9de5a2
def analyze(self, text): <NEW_LINE> <INDENT> keywords = [] <NEW_LINE> try: <NEW_LINE> <INDENT> params = urllib.urlencode({'text':text, 'view':'json'}) <NEW_LINE> keywords = self._analyze(params) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> return keywords
http://tagthe.net/api/?text=Hello%20World!
625941d57c178a314d6ef672
def __init__(self, children): <NEW_LINE> <INDENT> self.children = children <NEW_LINE> self.parent = None
Parameters: children: A list of names of children in the family.
625941d538b623060ff0affe
def get_gateway(name: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetGatewayResult: <NEW_LINE> <INDENT> __args__ = dict() <NEW_LINE> __args__['name'] = name <NEW_LINE> if opts is None: <NEW_LINE> <INDENT> opts = pulumi.InvokeOptions() <NEW_LINE> <DEDENT> if opts.version is None: <NEW_...
Retrieve information about a Direct Connect Gateway. ## Example Usage ```python import pulumi import pulumi_aws as aws example = aws.directconnect.get_gateway(name="example") ``` :param str name: The name of the gateway to retrieve.
625941d55fcc89381b1e18d1
def test_ddr3_with_usrp_probe(): <NEW_LINE> <INDENT> result = {} <NEW_LINE> ddr3_bist_executor = 'uhd_usrp_probe --args addr=127.0.0.1' <NEW_LINE> try: <NEW_LINE> <INDENT> output = subprocess.check_output( ddr3_bist_executor, stderr=subprocess.STDOUT, shell=True, ) <NEW_LINE> <DEDENT> except subprocess.CalledProcessErr...
Run uhd_usrp_probe and scrape the output to see if the DRAM FIFO block is reporting a good throughput. This is a bit of a roundabout way of testing the DDR3, but it uses existing software and also tests the RFNoC pathways.
625941d5293b9510aa2c34a5
def __html__(self, html): <NEW_LINE> <INDENT> if not html: <NEW_LINE> <INDENT> raise QuoteException("No html arg!") <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return BeautifulSoup(html) <NEW_LINE> <DEDENT> except Exception as err: <NEW_LINE> <INDENT> raise QuoteException('Could not parse text into BeautifulSoup!')
Return a BeautifulSoup object from a given text string
625941d5e5267d203edcdeac
def ExistsID(pathID): <NEW_LINE> <INDENT> iter_and_path = WalkByID(pathID) <NEW_LINE> if iter_and_path is None: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Use `WalkByPath()` to check existence if that `ID`.
625941d5b57a9660fec33a97
@asyncio.coroutine <NEW_LINE> def handle_streams(stream_in, stream_out, size_limit=None, progress_callback=None): <NEW_LINE> <INDENT> buffer_size = 409600 <NEW_LINE> bytes_copied = 0 <NEW_LINE> while True: <NEW_LINE> <INDENT> if size_limit: <NEW_LINE> <INDENT> to_copy = min(buffer_size, size_limit - bytes_copied) <NEW_...
Copy stream_in to all streams_out and monitor all mentioned processes. If any of them terminate with non-zero code, interrupt the process. Copy at most `size_limit` data (if given). :param stream_in: StreamReader object to read data from :param stream_out: StreamWriter object to write data to :param size_limit: int ma...
625941d515fb5d323cde0d23
def index(request): <NEW_LINE> <INDENT> return render(request, 'index.html')
Home page
625941d521a7993f00bc7f03
def __init__(self, is_training, num_classes=2, fixed_resize_side=256, default_image_size=224): <NEW_LINE> <INDENT> self._num_classes = num_classes <NEW_LINE> self._is_training = is_training <NEW_LINE> self._fixed_resize_side = fixed_resize_side <NEW_LINE> self._default_image_size = default_image_size
Constructor. Args: is_training: A boolean indicating whether the training version of computation graph should be constructed. num_classes: Number of classes.
625941d5462c4b4f79d1d8e1
def round_time(df, timeIntervalMinutes=5, timeField="time", roundedTimeFieldName="roundedTime", startWithFirstRecord=True, verbose=False): <NEW_LINE> <INDENT> df.sort_values(by=timeField, ascending=startWithFirstRecord, inplace=True) <NEW_LINE> df.reset_index(drop=True, inplace=True) <NEW_LINE> t = pd.to_datetime(df[ti...
A general purpose round time function that rounds the "time" field to nearest <timeIntervalMinutes> minutes INPUTS: * a dataframe (df) that contains a time field that you want to round * timeIntervalMinutes (defaults to 5 minutes given that most cgms output every 5 minutes) * timeField to round (defaults to...
625941d54e4d5625662d45e7
def construct_preset_pattern( self, pattern: int, speed: int, brightness: int ) -> bytearray: <NEW_LINE> <INDENT> return self.construct_wrapped_message( bytearray( [ 0x38, pattern, utils.speedToDelay(speed), ] ) )
The bytes to send for a preset pattern. 0xB0 0xB1 0xB2 0xB3 0x00 0x01 0x01 0x2A 0x00 0x04 0x38 0x01 0x10 0x00 0x3F (15) 0xB0 0xB1 0xB2 0xB3 0x00 0x01 0x01 0x2B 0x00 0x04 0x38 0x02 0x10 0x00 0x41 (15) 0xB0 0xB1 0xB2 0xB3 0x00 0x01 0x01 0x2C 0x00 0x04 0x38 0x03 0x10 0x00 0x43 (15) 0xB0 0xB1 0xB2 0xB3 0x00 0x01 0x01 0x2D ...
625941d51f5feb6acb0c4d5f
def set_input(self, data): <NEW_LINE> <INDENT> for (name, value) in data.items(): <NEW_LINE> <INDENT> i = self.form.find("input", {"name": name}) <NEW_LINE> if not i: <NEW_LINE> <INDENT> raise InvalidFormMethod("No input field named " + name) <NEW_LINE> <DEDENT> i["value"] = value
Fill-in a set of fields in a form. Example: filling-in a login/password form .. code-block:: python form.set_input({"login": username, "password": password}) This will find the input element named "login" and give it the value ``username``, and the input element named "password" and give it the value ``password`...
625941d54a966d76dd551221
def test_operation_same_size_as_vertex_constraint_different_order(self): <NEW_LINE> <INDENT> with self.assertRaises(NotImplementedError): <NEW_LINE> <INDENT> constrained_vertex = SimpleTestVertex(300, "Constrained") <NEW_LINE> new_large_vertex = SimpleTestVertex(300, "Non constrained") <NEW_LINE> constrained_vertex.add...
test that the partition and place partitioner can handle same size as constraints on a vertex which has to be split over many cores where the order of the vertices being added is different.
625941d5f9cc0f698b14080b
def sphere_contains_point( sphere, point ): <NEW_LINE> <INDENT> return sphere_contains_points( sphere, (point,) )[0]
Given a sphere ( 2/3d center, radius ) and a 2/3d point, returns whether or not the point is inside the sphere. tested
625941d5dd821e528d63b3b9
def refresh_clevr(dl): <NEW_LINE> <INDENT> return [asl.refresh_iter(dl, lambda x: Image(x))]
Extract image data and convert tensor to Mnist data type
625941d5ff9c53063f47c404
def get_history_datasets(self, trans, history): <NEW_LINE> <INDENT> query = (trans.sa_session.query(trans.model.HistoryDatasetAssociation) .filter(trans.model.HistoryDatasetAssociation.history == history) .join("dataset") .options(eagerload_all("dataset.actions")) .order_by(trans.model.HistoryDatasetAssociation.hid) .f...
Returns history's datasets.
625941d576d4e153a657ed43
def _scale_model_(self, z): <NEW_LINE> <INDENT> model = copy.copy(self.model) <NEW_LINE> model.set(z=z) <NEW_LINE> if self.mag_max is None: <NEW_LINE> <INDENT> d_l = self.cosmo.luminosity_distance(z).value * 1e5 <NEW_LINE> model.set(**{self.amp_or_x0: model.get(self.amp_or_x0)*d_l**-2}) <NEW_LINE> <DEDENT> else: <NEW_L...
Set the model to a certain redshift and adjust its amplitude to the luminosity distance. Assumes amplitude = 1 correspond to 10 pc
625941d5b545ff76a8914027
def test_is_valid_y_int16_array_E(self): <NEW_LINE> <INDENT> y = np.zeros((10,), dtype='i') <NEW_LINE> self.assertRaises(TypeError, is_valid_y_throw, (y))
Tests is_valid_y(*) on an int16 array. Exception expected.
625941d5bd1bec0571d90841
def _open_file(self, mode=gdalconst.GA_ReadOnly): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> LOGGER.debug('Open raster file: %s' % self.image_path) <NEW_LINE> self.image_path = self.image_path.encode('utf-8') <NEW_LINE> return gdal.Open(self.image_path, mode) <NEW_LINE> <DEDENT> except RuntimeError: <NEW_LINE> <INDEN...
Open the raster image file with gdal.
625941d5d8ef3951e324374f
def createFields(self, n=0, text='', posx=0, posy=0, dimension=50, orientation='L', visibility='V', hjustify='L', vjustify='C', style='', name=''): <NEW_LINE> <INDENT> field = 'F{} {} {} {} {} {} {} {} {}{}{}'.format(n, text, posx, posy, dimension, orientation, visibility, hjustify, vjustify, style, name) <NEW_LINE> se...
Format: F n “text” posx posy dimension orientation visibility hjustify vjustify/italic/bold “name” Notes: - The F1 field is the default component value and the component name in library. So the F1 field text should be the same as the name. - F0 is the reference prefix. If the prefix starts b # (like #U) the component ...
625941d521bff66bcd684b62
def test_filter_words_dict_empty(self): <NEW_LINE> <INDENT> expected_result = {} <NEW_LINE> res = main.filter_stop_words({}, STOP_WORDS) <NEW_LINE> self.assertEqual(expected_result, res)
Filter stop words when stop words tuple is empty
625941d5fff4ab517eb2f64e
def __showBadCommandMsg( self, userText ): <NEW_LINE> <INDENT> caption = self.__commandSuggestionCaption( escape_xml( userText ) ) <NEW_LINE> badCmd = userText.lower() <NEW_LINE> badCmd = escape_xml( badCmd ) <NEW_LINE> text = config.BAD_COMMAND_MSG <NEW_LINE> text = text % ( badCmd, caption ) <NEW_LINE> messages.displ...
Displays an error message telling the user that userText does not match any command. Also, if there are any reasonable commands that were similar but not matching, offers those to the user as suggestions.
625941d538b623060ff0afff
def _process(self): <NEW_LINE> <INDENT> match = [[-2, 3], [-1, -2, 3]] <NEW_LINE> cBundle = [] <NEW_LINE> if self.data.partsCount > 0: <NEW_LINE> <INDENT> for i in range(self.data.partsCount): <NEW_LINE> <INDENT> cList = self.data['parts'][i]['contourList'] <NEW_LINE> cBundle.append(cList) <NEW_LINE> <DEDENT> <DEDENT> ...
Do processing necessary, storing result in _feature.
625941d576e4537e8c351885
def definirCambiosTemperatura(this, inicial, interior, exterior, h, elemento=-1, remplazar=False): <NEW_LINE> <INDENT> dta = 1 / 2 * ((exterior - inicial) + (interior - inicial)) <NEW_LINE> dtf = (interior - exterior) <NEW_LINE> this.elementos[elemento].agregarCargaPorTemperatura(dta, dtf / h, remplazar)
Función que permite calcular las fuerzas asociadas a los cambios de temperatura en el elemento (CASO 1) :param inicial: Temperatura ambiente a la que fue construida la estructura en °C :param interior: Temperatura interna de la estructura en °C :param exterior: Temperatura externa de la estructura en °C :param h: Altur...
625941d58da39b475bd65186
@contract <NEW_LINE> def append_host_data_locally(path, cpu_mhz, data_length): <NEW_LINE> <INDENT> if not os.access(path, os.F_OK): <NEW_LINE> <INDENT> with open(path, 'w') as f: <NEW_LINE> <INDENT> f.write(str(cpu_mhz) + '\n') <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> with open(path, 'r+') as f: <NEW_LINE...
Write a CPU MHz value for the host. :param path: A path to write the data to. :type path: str :param cpu_mhz: A CPU MHz value. :type cpu_mhz: int,>=0 :param data_length: The maximum allowed length of the data. :type data_length: int
625941d5e76e3b2f99f3aa1a
def corrfun(eta): <NEW_LINE> <INDENT> return spheroid(eta)
Gridding *correction* function, but able to be passed either floating point numbers or vectors of `Float64`." Args: eta (float): the value in [0, 1]
625941d5cc40096d61595b62
def test_multiple_registrations(self): <NEW_LINE> <INDENT> register_locators("test1", {"foo": "//div/foo"}) <NEW_LINE> register_locators("test2", {"bar": "//div/bar"}) <NEW_LINE> expected = {"test1": {"foo": "//div/foo"}, "test2": {"bar": "//div/bar"}} <NEW_LINE> self.assertDictEqual(LOCATORS, expected)
Verify that more than one prefix can be registered
625941d50a366e3fb873ea2d
def ray_triangle_candidates(rays, triangles=None, tree=None): <NEW_LINE> <INDENT> if tree is None: <NEW_LINE> <INDENT> tree = create_tree(triangles) <NEW_LINE> <DEDENT> ray_bounding = ray_bounds(rays, tree.bounds) <NEW_LINE> ray_candidates = [None] * len(rays) <NEW_LINE> for ray_index, bounds in enumerate(ray_boundin...
Do broad- phase search for triangles that the rays may intersect. Does this by creating a bounding box for the ray as it passes through the volume occupied by
625941d5a17c0f6771cbe261
def execute(self) -> None: <NEW_LINE> <INDENT> if not os.path.exists(self.expansions.get("aws_ec2_yml", "")) or self.expansions.get( "ec2_ssh_failure", ""): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if self.is_windows(): <NEW_LINE> <INDENT> core_suffix = "mdmp" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> core_su...
:return: None.
625941d5cc0a2c11143dd0a2
def _build(self, inputs): <NEW_LINE> <INDENT> self._input_shape = tuple(inputs.get_shape().as_list()) <NEW_LINE> if len(self._input_shape) != 4: <NEW_LINE> <INDENT> raise base.IncompatibleShapeError( "Input Tensor must have shape (batch_size, input_height, " "input_width, input_channels)") <NEW_LINE> <DEDENT> if self._...
Connects the module into the graph, with input Tensor `inputs`. If this is not the first time the module has been connected to the graph, the input Tensor provided here must have the same final 3 dimensions, in order for the existing variables to be the correct size for the multiplication. The batch size may differ fo...
625941d5cdde0d52a9e53246
def send_config_set(self, config_commands=None, exit_config_mode=True, **kwargs): <NEW_LINE> <INDENT> return super(CiscoXrBase, self).send_config_set( config_commands=config_commands, exit_config_mode=False, **kwargs )
IOS-XR requires you not exit from configuration mode.
625941d5046cf37aa974cf58
@pytest.mark.check_env_('has_2_or_more_ironic_conductors') <NEW_LINE> @pytest.mark.need_devops <NEW_LINE> @pytest.mark.testrail_id('638353') <NEW_LINE> def test_reboot_all_ironic_conductors(env, devops_env): <NEW_LINE> <INDENT> controller = env.get_nodes_by_role('controller')[0] <NEW_LINE> with controller.ssh() as remo...
Check ironic state after restart all conductor nodes Scenario: 1. Ensure ironic conductor service works correctly on each conductor node (e.g., ensure "ironic driver-list" returns correct list of drivers) 2. Shutdown all ironic conductor nodes 3. Turn on all ironic conductor nodes 4. SS...
625941d57d847024c06be4d0
def get_shader_preset(shader_presets_filepath, template_name): <NEW_LINE> <INDENT> if shader_presets_filepath.startswith(str(os.sep + os.sep)): <NEW_LINE> <INDENT> shader_presets_filepath = _path.get_abs_path(shader_presets_filepath) <NEW_LINE> <DEDENT> preset_section = None <NEW_LINE> if os.path.isfile(shader_presets_...
Returns requested Shader Preset data from preset file. :param shader_presets_filepath: A file path to SCS shader preset file, can be absolute or relative :type shader_presets_filepath: str :param template_name: Preset name :type template_name: str :return: Preset data section :rtype: SectionData
625941d5e64d504609d74a52
def filter(self, order_by='asc', offset=None, limit=None, **kwargs): <NEW_LINE> <INDENT> query_kwargs = {} <NEW_LINE> if kwargs: <NEW_LINE> <INDENT> if len(kwargs) > 1: <NEW_LINE> <INDENT> raise TypeError('filter accept only one attribute for filtering') <NEW_LINE> <DEDENT> key, value = kwargs.items()[0] <NEW_LINE> if ...
Retrieve all the objects ids then pull them independently from cache. kwargs accepts one attribute filter, mainly for relationship pulling. offset and limit allow pagination, order by for sorting (asc/desc).
625941d5be7bc26dc91cd80f
def get_loan(self, info, detail, loan, borrower): <NEW_LINE> <INDENT> passed_times = loan.get('description') <NEW_LINE> try: <NEW_LINE> <INDENT> a=re.findall(r"现居.*?[市州位区盟]市?",passed_times)[0] <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> a="现居" <NEW_LINE> <DEDENT> result = { 'loan_id': loan.get('loanId'), 'borrow_am...
获取贷款信息 :param loan: :param borrower: :return:
625941d5b830903b967e9b1b
def igualdad_a_tres(a,b,c): <NEW_LINE> <INDENT> if (a==b) or (a==c) or (b==c): return 0 <NEW_LINE> else: return a+b+c
float, float, float --> float OBJ: suma 3 números, si dos o más de ellos son iguales retorna cero
625941d54c3428357757c539
def dust_component_path_for_name(self, model_name, component_name): <NEW_LINE> <INDENT> return self.dust_component_paths_for_model(model_name)[component_name]
This function ... :param model_name: :param component_name: :return:
625941d5d268445f265b5080
def dump_simh(buf, out) : <NEW_LINE> <INDENT> assert not buf.rel, "can't handle relocatable CodeBuffer" <NEW_LINE> for addr, value in buf.dumpw(0, 0x10000) : <NEW_LINE> <INDENT> out.write("d %4o %4o\n" % (addr, value)) <NEW_LINE> <DEDENT> if buf.startaddr != None : <NEW_LINE> <INDENT> out.write("g %o\n" % buf.startaddr...
dumps the contents of CodeBuffer object buf to out as a sequence of SIMH memory-deposit commands.
625941d5236d856c2ad449ed
def _write_parameter_file(params): <NEW_LINE> <INDENT> path = os.path.join(get_tempdir(), 'params.txt') <NEW_LINE> def valToStr(val): <NEW_LINE> <INDENT> if val in [True, False]: <NEW_LINE> <INDENT> return '"%s"' % str(val).lower() <NEW_LINE> <DEDENT> elif isinstance(val, int): <NEW_LINE> <INDENT> return str(val) <NEW_...
Write the parameter file in the format that elaxtix likes.
625941d5d53ae8145f87a47f
def getKeywords_textrank(text): <NEW_LINE> <INDENT> topK = 10 <NEW_LINE> result = [] <NEW_LINE> jieba.analyse.set_stop_words(r"C:\AI-NLP\Text-Auto-Summarization\data/stopwords.txt") <NEW_LINE> keywords = jieba.analyse.textrank(text, topK=topK, allowPOS=( 'n', 'nz', 'v', 'vd', 'vn', 'l', 'a', 'd'), withWeight=True) <NEW...
处理标题和摘要,提取关键词 :param text: :return:
625941d5e1aae11d1e749eca
def smart_404(request): <NEW_LINE> <INDENT> base_url = settings.HOST_URL <NEW_LINE> not_found = { 'type': None, 'redirect_url': base_url } <NEW_LINE> path_arguments = request.path.split('/')[1:] <NEW_LINE> if path_arguments and path_arguments[0].isdigit(): <NEW_LINE> <INDENT> from communities.models import Community <N...
Returns a 404 message that tries to help the user.
625941d585dfad0860c3b06d
def undefine(vm_, **kwargs): <NEW_LINE> <INDENT> conn = __get_conn(**kwargs) <NEW_LINE> dom = _get_domain(conn, vm_) <NEW_LINE> if getattr(libvirt, "VIR_DOMAIN_UNDEFINE_NVRAM", False): <NEW_LINE> <INDENT> ret = dom.undefineFlags(libvirt.VIR_DOMAIN_UNDEFINE_NVRAM) == 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ret =...
Remove a defined vm, this does not purge the virtual machine image, and this only works if the vm is powered down :param vm_: domain name :param connection: libvirt connection URI, overriding defaults .. versionadded:: 2019.2.0 :param username: username to connect with, overriding defaults .. versionadded:: ...
625941d55e10d32532c5f138
def update_absolute_progress_range(self, min_progress, max_progress): <NEW_LINE> <INDENT> progress_diff = max_progress - min_progress <NEW_LINE> self.absolute_min_progress = ( min_progress + self.min_progress * progress_diff) <NEW_LINE> self.absolute_max_progress = ( min_progress + self.max_progress * progress_diff) <N...
update the min progress and max progress the log file indicates.
625941d5ac7a0e7691ed42db
def on_ok(self, event): <NEW_LINE> <INDENT> self.getvalue() <NEW_LINE> event.Skip()
if you enable self.Destroy(), it delete from memory all data event and no return correctly. It has the right behavior if not used here, because it is called in the main frame. Event.Skip(), work correctly here. Sometimes needs to disable it for needs to maintain the view of the window.
625941d56aa9bd52df036fb6
def RawSorting(pop, **args): <NEW_LINE> <INDENT> pop.internalPop.sort(key=lambda x: x.score[args.get('score', 0)], reverse=args.get('reverse', False))
Will sort using the score as key
625941d54f6381625f114c4d
def status_update_json(apps, apks): <NEW_LINE> <INDENT> logging.debug(_('Outputting JSON')) <NEW_LINE> output = common.setup_status_output(start_timestamp) <NEW_LINE> output['antiFeatures'] = dict() <NEW_LINE> output['disabled'] = [] <NEW_LINE> output['archivePolicy0'] = [] <NEW_LINE> output['failedBuilds'] = dict() <N...
Output a JSON file with metadata about this `fdroid update` run. Parameters ---------- apps fully populated list of all applications apks all to be published apks
625941d57d43ff24873a2eb2
def main() -> None: <NEW_LINE> <INDENT> logging.basicConfig() <NEW_LINE> logging.getLogger("whisker").setLevel(logging.DEBUG) <NEW_LINE> configure_logger_for_colour(logging.getLogger()) <NEW_LINE> parser = argparse.ArgumentParser( description="Test Whisker Twisted client", formatter_class=argparse.ArgumentDefaultsHelpF...
Command-line parser. See ``--help`` for details.
625941d5ad47b63b2c50a191
def unregister(self, pollster): <NEW_LINE> <INDENT> pollster.unregister(self._pull_socket)
unregister this socket from the zeromq pollster
625941d5dc8b845886cb5748
def update(self, item): <NEW_LINE> <INDENT> self.notify(item)
The received item can be either a record or an offset (report), from an InputChannel. The Subject superclass will send objects of the appropriate type to the appropriate observer(s).
625941d5be8e80087fb20e53
def multi_scan(detectors,numO,motorO,startO,stopO,*args,num=None, per_step=None, md=None): <NEW_LINE> <INDENT> initial_scan_id='current scan_id' <NEW_LINE> initial_posO=motorO.position <NEW_LINE> start_scan_id=None <NEW_LINE> total_num_scans=num0 <NEW_LINE> if num is None: <NEW_LINE> <INDENT> num=numO <NEW_LINE> <DEDEN...
Combines an 'outer_product_scan' scan with a 'scan' scan such that each multi-motor trajectory defined by '*args' is saved as a seperate experiment in databroker for point defined by numO,motorO, startO,stopO. Parameters ---------- detectors : list list of 'readable' objects numO : integer The number...
625941d58c3a8732951585cd
def api28_apps_patch_with_http_info( self, names=None, app=None, authorization=None, x_request_id=None, async_req=False, _return_http_data_only=False, _preload_content=True, _request_timeout=None, ): <NEW_LINE> <INDENT> if names is not None: <NEW_LINE> <INDENT> if not isinstance(names, list): <NEW_LINE> <INDENT> names ...
Modify app Modifies an installed app or modifies Virtual Network Computing (VNC) access for apps that are being patched. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.api28_apps_patch_with_http_info(names, app, async_req=True)...
625941d53d592f4c4ed1d27c
def getData(self, key=None): <NEW_LINE> <INDENT> return super(GetPollVote, self).getData(key)
:param key: dictionary key, if None return the whole dictionary :return: dictionary of data
625941d59c8ee82313fbb987
def _get_path(unit, target_unit, using=[], level=1, **kwords): <NEW_LINE> <INDENT> todo = unit.getTodoList(target_unit) <NEW_LINE> for path in DimA.paths: <NEW_LINE> <INDENT> if DimA.todo__eq__(todo, path.todo): <NEW_LINE> <INDENT> return path <NEW_LINE> <DEDENT> <DEDENT> blacklist = [] <NEW_LINE> path = [] <NEW_LINE> ...
DimA._get_path(unit, target_unit, using=[], level=1, **{break_size: len(todo) * DimA.break_multiplier + DimA.break_additive, max_conversions: DimA.max_conversions}) return(s) list_of_conversions_in_order raise(s) PathError #if no path of conversions can be found to take the unit to the target_unit Argument discripti...
625941d556ac1b37e62643df
def getMin(self): <NEW_LINE> <INDENT> if len(self.min_stack)>0: <NEW_LINE> <INDENT> return self.min_stack[0]
:rtype: int
625941d5377c676e912723ba
def viewkeys(self): <NEW_LINE> <INDENT> return KeysView(self)
Return ``KeysView`` of dictionary keys.
625941d52ae34c7f2600d343
def computeJulianDay(year, month, day, hour, minute, second): <NEW_LINE> <INDENT> if(month <= 2): <NEW_LINE> <INDENT> year -= 1 <NEW_LINE> month += 12 <NEW_LINE> <DEDENT> tmp1 = m.floor(year/100.0) <NEW_LINE> tmp2 = 2 - tmp1 + m.floor(tmp1/4.0) <NEW_LINE> dDay = day + hour/24.0 + minute/1440.0 + second/86400.0 <NEW_L...
Compute the Julian Day from the date and time. Note: - Gregorian calendar only (>~1582). Parameters: year (int): Year of date. month (int): Month of date. day (int): Day of date. hour (int): Hour of time. minute (int): Minute of time. second (int): Second of time. Returns: ...
625941d54f88993c3716c278
def apply_rfm_numpy(num, den, x, y, z): <NEW_LINE> <INDENT> c_num = reshape_coefficients_vector(num) <NEW_LINE> c_den = reshape_coefficients_vector(den) <NEW_LINE> a = np.polynomial.polynomial.polyval3d(x, y, z, c_num) <NEW_LINE> b = np.polynomial.polynomial.polyval3d(x, y, z, c_den) <NEW_LINE> return a/b
Alternative implementation of apply_rfm, that uses numpy to evaluate polynoms.
625941d501c39578d7e7504e
def as_list(self): <NEW_LINE> <INDENT> return (utils.date_as_string(self.date), self.title, self.file_name, self.url, self.size, self.state)
Return all fields of object as a list. Handy for inserting into database.
625941d5ff9c53063f47c405
def balance(self): <NEW_LINE> <INDENT> self.balance = self.pos / (self.pos + self.neg)
Counts the balance between 0s and 1s
625941d5c4546d3d9de72c47
def test_login_post_with_next(self): <NEW_LINE> <INDENT> response = self.client.post( '/account/login/?next=/account/', { 'username': 'user_1', 'password': 'password_1', }, ) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE> self.assertEqual(response.url, '/account/') <NEW_LINE> user = get_user(self.cli...
Test login with next query parameter using POST data.
625941d544b2445a339322a7
def role_del(request, pk): <NEW_LINE> <INDENT> origin_url = reverse('rbac:role_list') <NEW_LINE> if request.method == "GET": <NEW_LINE> <INDENT> return render(request,'rbac/delete.html', {'cancel_url': origin_url}) <NEW_LINE> <DEDENT> models.Role.objects.filter(id=pk).delete() <NEW_LINE> return redirect(origin_url)
删除角色
625941d563b5f9789fde72f8
def runJob(self, job, document): <NEW_LINE> <INDENT> jobattributes.get(job).mainwindow = self.mainwindow() <NEW_LINE> rjob = jobmanager.job(document) <NEW_LINE> if rjob and rjob.is_running(): <NEW_LINE> <INDENT> rjob.abort() <NEW_LINE> <DEDENT> jobmanager.manager(document).start_job(job)
Runs the engraving job on behalf of document.
625941d5b830903b967e9b1c
def map_output(self, data: libioc.Config.Data.Data) -> str: <NEW_LINE> <INDENT> return str(libioc.helpers.to_ucl(data))
Output configuration in UCL format.
625941d54e4d5625662d45e8
def to_string( self, parent, *, alpha=None, precision=None, fit=True, none=False, **kwargs ): <NEW_LINE> <INDENT> options = kwargs <NEW_LINE> value = '' <NEW_LINE> a = util.no_nan(self.alpha) <NEW_LINE> alpha = alpha is not False and (alpha is True or a < 1.0) <NEW_LINE> hex_upper = options.get("upper", False) <NEW_LIN...
Convert to CSS.
625941d57d43ff24873a2eb3
def xrot(e): <NEW_LINE> <INDENT> a,b,c,d,e,f,g,h,i = e <NEW_LINE> return matrix.sqr(( a, b, c, 0, 0, 0, d, e, f, 0, 0, 0, g, h, i, 0, 0, 0, 0, 0, 0, a, b, c, 0, 0, 0, d, e, f, 0, 0, 0, g, h, i))
RBDA Tab. 2.2, p. 23: Spatial coordinate transform (rotation around origin). Calculates the coordinate transform matrix from A to B coordinates for spatial motion vectors, in which frame B is rotated relative to frame A.
625941d59f2886367277aa9f
def getSnakType(self) -> str: <NEW_LINE> <INDENT> return self.snaktype
Return the type of snak. :return: str ('value', 'somevalue' or 'novalue')
625941d5099cdd3c635f0e6d
def get_conj_display(self): <NEW_LINE> <INDENT> return copy.copy(self.conj_display)
Get The conjugation display class with result. @return: an object with result. @rtype: conjugatedisplay class
625941d596565a6dacc8f8dd
def __init__(self): <NEW_LINE> <INDENT> config=readDictFile('odkoc.config') <NEW_LINE> conn_string = "host='" + config['db_host'] + "' dbname='" + config['db_name'] + "' user='" + config['db_user'] + "' password='" + config['db_pass'] + "' port='" + config['db_port'] + "'" <NEW_LINE> self.init_result = '' <NEW_LINE> tr...
let us create the connection to use multiple times
625941d58c0ade5d55d3ebce
def exists(self, recipient, sender, text): <NEW_LINE> <INDENT> if recipient in self._messages: <NEW_LINE> <INDENT> for stored_msg in self._messages[recipient]: <NEW_LINE> <INDENT> if stored_msg['sender'] == sender and stored_msg['text'] == text: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> retu...
Checks if an identical message already exists.
625941d507d97122c4178aa1
def onMainParamsChange(self, top, bottom): <NEW_LINE> <INDENT> item = self._model_model.itemFromIndex(top) <NEW_LINE> model_column = item.column() <NEW_LINE> if model_column == 0: <NEW_LINE> <INDENT> self.checkboxSelected(item) <NEW_LINE> self.cmdFit.setEnabled(self.haveParamsToFit()) <NEW_LINE> self.updateUndo() <NEW_...
Callback method for updating the sasmodel parameters with the GUI values
625941d54527f215b584c667
def get_species_all(self): <NEW_LINE> <INDENT> res = self.services.http_get("data/species/all", frmt="json") <NEW_LINE> return res
the list of all species in Reactome
625941d55510c4643540f5f3
def parse_args(self): <NEW_LINE> <INDENT> self.parser.add_argument("-g", "--glob", help="A file-glob to match input file names. (default=%(default)s)", default=None) <NEW_LINE> self.parser.add_argument("-u", "--units", help="Output units per second [bits,Bytes,KBits,KBytes,Mbits,MBytes,Gbits,GBytes] (default=%(default)...
:return: namespace with command-line arguments
625941d53c8af77a43ae39b4
def __ne__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, UpdateRole): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
625941d53617ad0b5ed68109
def findBall(self, grid): <NEW_LINE> <INDENT> M, N = len(grid), len(grid[0]) <NEW_LINE> def dfs(i, j): <NEW_LINE> <INDENT> if i == M: <NEW_LINE> <INDENT> return j <NEW_LINE> <DEDENT> if grid[i][j] == 1 and j != N - 1 and grid[i][j + 1] == 1: <NEW_LINE> <INDENT> return dfs(i + 1, j + 1) <NEW_LINE> <DEDENT> if grid[i][j]...
:type grid: List[List[int]] :rtype: List[int]
625941d56e29344779a62823
def find_match(col, ref_list): <NEW_LINE> <INDENT> for ref_col in ref_list: <NEW_LINE> <INDENT> if match(col, ref_col): <NEW_LINE> <INDENT> if col == 'ACCTYPE': <NEW_LINE> <INDENT> print(ref_col) <NEW_LINE> <DEDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Tell if a string col has an approximate match in ref_list input ----- col : string the string to be searched for ref_list : array_like the list where the search takes place output ----- If there is a match in the list for the col
625941d54527f215b584c668
def schedule_tester(self, cycle=TESTER_CYCLE): <NEW_LINE> <INDENT> tester = Tester() <NEW_LINE> while True: <NEW_LINE> <INDENT> print('测试器开始运行') <NEW_LINE> tester.run() <NEW_LINE> time.sleep(cycle)
定时测试代理:首先声明一个Tester对象,然后进入死循环不断循环调用其run()方法,执行完一轮之后就休眠一段时间, 休眠结束后重新执行.在这里,休眠时间也定义为一个常量,如20秒,即每隔20秒进行一次代理检测 :param cycle: :return:
625941d5091ae3566866716e
def train_networks(networks, dataset, iteration, dataset_TB_folder_name): <NEW_LINE> <INDENT> pbar = tqdm(total=len(networks)) <NEW_LINE> current_network_count = 1 <NEW_LINE> for network in networks: <NEW_LINE> <INDENT> network.train(dataset, iteration, current_network_count, dataset_TB_folder_name) <NEW_LINE> pbar.upd...
Train each network. Args: networks (list): Current population of networks dataset (str): Dataset to use for training/evaluating iteration (int): Count of the current iteration. dataset_TB_folder_name (str): Name of the parent folder that holds the multiple run tensorboard result.
625941d5711fe17d8254257b
def append_to_queue(self, track): <NEW_LINE> <INDENT> self.queue.append(track) <NEW_LINE> self.track_appended.fire(track)
Append track to queue. Fires :attr:`.track_appended` event. See :meth:`._Queue.append`
625941d56aa9bd52df036fb7
def get_usrk(uk, fxml): <NEW_LINE> <INDENT> from qharv.seed import xml <NEW_LINE> doc = xml.read(fxml) <NEW_LINE> return calc_uksr(uk, doc)
Get short-range part of trial Jastrow pair potential.
625941d5a4f1c619b28b0248
def calcHA1( pszAlg, pszUserName, pszRealm, pszPassword, pszNonce, pszCNonce, preHA1=None ): <NEW_LINE> <INDENT> if (preHA1 and (pszUserName or pszRealm or pszPassword)): <NEW_LINE> <INDENT> raise TypeError(("preHA1 is incompatible with the pszUserName, " "pszRealm, and pszPassword arguments")) <NEW_LINE> <DEDENT> if p...
@param pszAlg: The name of the algorithm to use to calculate the digest. Currently supported are md5 md5-sess and sha. @param pszUserName: The username @param pszRealm: The realm @param pszPassword: The password @param pszNonce: The nonce @param pszCNonce: The cnonce @param preHA1: If available this is a str cont...
625941d576e4537e8c351886
def sheetWriter(dfH, dfL, dfPerc, dfRAW, name): <NEW_LINE> <INDENT> dfH.iat[0, 3] = pd.to_numeric('') <NEW_LINE> dfL.iat[0, 3] = pd.to_numeric('') <NEW_LINE> dfH.iat[0, 2] = pd.to_numeric('') <NEW_LINE> dfL.iat[0, 2] = pd.to_numeric('') <NEW_LINE> dfRAW.drop('SPOT PRICE ($)', axis = 0, inplace = True) <NEW_LINE> with p...
Sanitize and write a number of DF's to an .XLSX, as a new sheet
625941d592d797404e30439d
def register_user(self, login, passwd): <NEW_LINE> <INDENT> pass
Register user with passed login name and password hash. @param login str, Login name @param passwd str, SHA256 hash of password @return Deferred @throw ValueError('Registration failed')
625941d550485f2cf553cfad
def get_official_milestone(path): <NEW_LINE> <INDENT> with open(path) as fp: <NEW_LINE> <INDENT> for line in fp: <NEW_LINE> <INDENT> line = line.strip() <NEW_LINE> if line[:1].isdigit(): <NEW_LINE> <INDENT> return line <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> raise Exception("Didn't find a line that starts with a digit.")
Returns the contents of the first line in `path` that starts with a digit.
625941d53cc13d1c6d3c758c
def disable_oscillation(self) -> None: <NEW_LINE> <INDENT> current_oscillation_raw = self._get_field_value(self._status, "oson") <NEW_LINE> if current_oscillation_raw in ["OION", "OIOF"]: <NEW_LINE> <INDENT> oson = "OIOF" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> oson = "OFF" <NEW_LINE> <DEDENT> self._set_configura...
Turn off oscillation.
625941d599fddb7c1c9de5a4
def global_false_nearest_neighbors(x, lag, min_dims=1, max_dims=10, **cutoffs): <NEW_LINE> <INDENT> x = _vector(x) <NEW_LINE> dimensions = np.arange(min_dims, max_dims + 1) <NEW_LINE> false_neighbor_pcts = np.array([_gfnn(x, lag, n_dims, **cutoffs) for n_dims in dimensions]) <NEW_LINE> return dimensions, false_neighbor...
Across a range of embedding dimensions $d$, embeds $x(t)$ with lag $ au$, finds all nearest neighbors, and computes the percentage of neighbors that that remain neighbors when an additional dimension is unfolded. See [1] for more information. Parameters ---------- x : array-like Original signal $x(t). lag :...
625941d5167d2b6e31218da8
def test_iter_input(self): <NEW_LINE> <INDENT> inp = [range(1, 3), range(3, 5)] <NEW_LINE> expected = set(range(1, 5)) <NEW_LINE> actual = set(flatten_iter(inp)) <NEW_LINE> self.assertEqual(expected, actual)
Test if flatten_iter() works with iterators as input
625941d5711fe17d8254257c
def run(self): <NEW_LINE> <INDENT> running = True <NEW_LINE> cv2.namedWindow("Drone Camera") <NEW_LINE> while running: <NEW_LINE> <INDENT> image = self.drone.image.copy() <NEW_LINE> red, green, blue = cv2.split(image) <NEW_LINE> image = cv2.merge((blue, green, red)) <NEW_LINE> self.currFrame = image <NEW_LINE> x = cv2....
Will run the tracking program on the video from vid_src.
625941d57c178a314d6ef674
def validate(self) -> (bool, list): <NEW_LINE> <INDENT> evaluator_inputs = self.current_inputs_evaluators() <NEW_LINE> all_kos = [x for x in evaluator_inputs if x.is_ko()] <NEW_LINE> return len(all_kos) == 0, all_kos
Validate all the current filled inputs value :return: the tuple2 of (is the payload valid ? / list of all inputs 'KO')
625941d538b623060ff0b000
def fix_at_idx(arr, idx, fix, missing_idx=-1): <NEW_LINE> <INDENT> idx.shape = (-1, 1) <NEW_LINE> ncols = arr.shape[1] <NEW_LINE> idx[idx == missing_idx] = ncols <NEW_LINE> row_idx = np.arange(ncols) <NEW_LINE> arr[row_idx >= idx] = fix <NEW_LINE> return arr
Fix all values of each row at and following an index (index given per row). Parameters ---------- arr : numpy.ndarray A 2d numpy array. idx : numpy.ndarray A 1d numpy array or a 2d single row/column numpy array. The number of elements equal the number of rows in arr. Each value is the index at which t...
625941d5fbf16365ca6f63d8
def findMedianSortedArrays(self, nums1, nums2): <NEW_LINE> <INDENT> n1, n2 = len(nums1), len(nums2) <NEW_LINE> midpos = (n1 + n2) // 2 <NEW_LINE> i, j, res0, res1 = 0, 0, 0, 0 <NEW_LINE> for _ in range(midpos + 1): <NEW_LINE> <INDENT> if i < n1 and j < n2 and nums1[i] <= nums2[j]: <NEW_LINE> <INDENT> res0 = res1 <NEW_L...
:type nums1: List[int] :type nums2: List[int] :rtype: float
625941d5097d151d1a22306b
def test_parse_simple_quote_no_optional_tva(): <NEW_LINE> <INDENT> definition = copy.deepcopy(TESLA_SECTIONS_QUOTE) <NEW_LINE> definition["vat_rate"] = 20 <NEW_LINE> quote = parse_quote(definition) <NEW_LINE> checkQuote(quote) <NEW_LINE> assert quote["vat_rate"] == 20 <NEW_LINE> assert quote["title"] == "Configurateur ...
Parse a simple quote definition which include VAT but no optional.
625941d5bf627c535bc133e2
def countTypes(data): <NEW_LINE> <INDENT> dataTypes = ['int32', 'int64', 'object', 'datetime64[ns]'] <NEW_LINE> data = pd.DataFrame(data.dtypes, columns = ['type']) <NEW_LINE> int32s = len(data[data['type'] == dataTypes[0]]) <NEW_LINE> int64s = len(data[data['type'] == dataTypes[1]]) <NEW_LINE> ints = int32s + int64s <...
Use as part of summary()
625941d591af0d3eaac9bc2d
def get_node_source(self, model, cn): <NEW_LINE> <INDENT> if cn.pre_obj in self._passthrough_nodes: <NEW_LINE> <INDENT> return spec(ObjectPort(self._passthrough_nodes[cn.pre_obj], OutputPort.standard)) <NEW_LINE> <DEDENT> elif cn.pre_obj in self._f_of_t_nodes: <NEW_LINE> <INDENT> return spec(ObjectPort(self._f_of_t_nod...
Get the source for a connection originating from a Node.
625941d5c4546d3d9de72c48
def test_get_miles_per_hour(self): <NEW_LINE> <INDENT> self.assertEqual(19.883872, (32 ,60))
5 points Test with arguments kilometers 32 and minutes 60 return value should be 19.883872
625941d54a966d76dd551224
def proteger_passwd(clave): <NEW_LINE> <INDENT> from bcrypt import hashpw, gensalt <NEW_LINE> clave_encriptada = hashpw(clave.encode(), gensalt()) <NEW_LINE> return clave_encriptada
Devuelve una contraseña salteada con bcrytp.
625941d573bcbd0ca4b2c289
def neural_net_label_input(n_classes): <NEW_LINE> <INDENT> return tf.placeholder(tf.int32,shape=[None,n_classes],name='y')
Return a Tensor for a batch of label input : n_classes: Number of classes : return: Tensor for label input.
625941d58e7ae83300e4b1e0
@plan.command(name="info") <NEW_LINE> @click.argument("plan_name") <NEW_LINE> @click.option( "--messages", "messages_only", is_flag=True, help="Show only plan messages" ) <NEW_LINE> @pass_runtime(require_project=True, require_keychain=True) <NEW_LINE> def plan_info(runtime, plan_name, messages_only): <NEW_LINE> <INDENT...
Displays information for a MetaDeploy plan.
625941d530dc7b7665901b78
def get_end_date(self): <NEW_LINE> <INDENT> if self.is_loop: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> end_date = self.start_date <NEW_LINE> for step in self.schedulestep_set.all(): <NEW_LINE> <INDENT> end_date = end_date + datetime.timedelta(weeks=step.duration) <NEW_LINE> <DEDENT> return end_date
Calculates the date when the schedule is over or None is the schedule is a loop.
625941d50383005118ecf7f5
def test_with(self): <NEW_LINE> <INDENT> fake_rlock = MagicMock() <NEW_LINE> fw = firewall.FireWall() <NEW_LINE> fw._rlock = fake_rlock <NEW_LINE> with fw: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.assertEqual(fake_rlock.acquire.call_count, 1) <NEW_LINE> self.assertEqual(fake_rlock.release.call_count, 1)
FireWall support use of the with statement
625941d550485f2cf553cfae