code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def test_clean_user(self): <NEW_LINE> <INDENT> form = OmniForm() <NEW_LINE> form.cleaned_data = {'user': "_asdf"} <NEW_LINE> self.assertRaises(ValidationError, form.clean_user) <NEW_LINE> form.cleaned_data = {'user': "matt (mdj2)"} <NEW_LINE> with patch("alma.requests.forms.is_ldap_user", return_value=True): <NEW_LINE>...
Ensure only ODIN usernames are accepted, and that users are created on the fly
625941ed2eb69b55b151cde4
def register_usage(ProductCode=None, PublicKeyVersion=None, Nonce=None): <NEW_LINE> <INDENT> pass
Paid container software products sold through AWS Marketplace must integrate with the AWS Marketplace Metering Service and call the Register operation for software entitlement and metering. Free and BYOL products for Amazon ECS or Amazon EKS aren't required to call Register, but you may choose to do so if you would...
625941ed287bf620b61d3f8d
def generate(env): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> bld = env['BUILDERS']['PDF'] <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> bld = SCons.Defaults.PDF() <NEW_LINE> env['BUILDERS']['PDF'] = bld <NEW_LINE> <DEDENT> bld.add_action('.ps', GhostscriptAction) <NEW_LINE> env['GS'] = gs <NEW_LINE> ...
Add Builders and construction variables for Ghostscript to an Environment.
625941edd7e4931a7ee9e44c
def get_tender_data(self, tender_number): <NEW_LINE> <INDENT> url = 'http://tenders.polyusgold.com/purchases/{}'.format(tender_number) <NEW_LINE> r = requests.get(url) <NEW_LINE> return r.text
Возвращает HTML документ с данными тендера
625941ed851cf427c661aa37
def p_declare_arr(p): <NEW_LINE> <INDENT> name = p[3] <NEW_LINE> alpha = p[5] <NEW_LINE> omega = p[7] <NEW_LINE> line = str(p.lineno(3)) <NEW_LINE> make_array(name, alpha, omega, line)
declarations : declarations COMMA ID LBR NUM COLON NUM RBR
625941ed596a897236089fe6
def dump_distribution_function(self, file_name): <NEW_LINE> <INDENT> PETSc.Object.setName(self._glob, 'distribution_function') <NEW_LINE> viewer = PETSc.Viewer().createHDF5(file_name + '.h5', 'w', comm=self._comm) <NEW_LINE> global_vec_value = self._da.getVecArray(self._glob) <NEW_LINE> global_vec_value[:] = np.array(s...
This function is used to dump distribution function to a file for later usage.This dumps the complete 5D distribution function which can be used for post-processing Parameters: ----------- file_name : The distribution_function array will be dumped to this provided file name. Output: ------- This function ...
625941ed56b00c62f0f14b89
def inspect(dataset, labels, i): <NEW_LINE> <INDENT> if dataset.shape[3] == 1: <NEW_LINE> <INDENT> shape = dataset.shape <NEW_LINE> dataset = dataset.reshape(shape[0], shape[1], shape[2]) <NEW_LINE> <DEDENT> print (labels[i]) <NEW_LINE> plt.figure(figsize=(3, 3), dpi=80) <NEW_LINE> plt.imshow(dataset[i]) <NEW_LINE> plt...
将图片显示出来 如果第四维的维度为1,说明rgb的3维合并到一维了, 就可以取消掉最后的维度,reshape成三维
625941edb830903b967e9e32
def set_weights(self, weights): <NEW_LINE> <INDENT> groupsWeight = np.ones(len(self.engine.groups), dtype=FLOAT_TYPE) <NEW_LINE> if weights is not None: <NEW_LINE> <INDENT> assert isinstance(weights, (list,set,tuple)),LOGGER.error("weights must be a list") <NEW_LINE> for w in weights: <NEW_LINE> <INDENT> idx, wgt = sel...
Set groups selection weighting scheme. :Parameters: #. weights (None, list): Weights list. It must be None for equivalent weighting or list of (groupIndex, weight) tuples.
625941ed4e4d5625662d48fd
def deleteNode(nodeName,h5FileName): <NEW_LINE> <INDENT> with openFile(h5FileName,'a') as h5File: <NEW_LINE> <INDENT> _deleteNode(nodeName, h5File)
Deletes a node from a h5 file
625941ed45492302aab5e7f6
def test_axis(self): <NEW_LINE> <INDENT> P1 = gp_Pnt(2, 3, 4) <NEW_LINE> D = gp_Dir(4, 5, 6) <NEW_LINE> A = gp_Ax3(P1, D) <NEW_LINE> IsDirectA = A.Direct() <NEW_LINE> self.assertTrue(IsDirectA) <NEW_LINE> AXDirection = A.XDirection() <NEW_LINE> self.assertIsInstance(AXDirection, gp_Dir) <NEW_LINE> AYDirection = A.YDire...
Test: axis
625941ed004d5f362079a85c
def parse_item(self, response): <NEW_LINE> <INDENT> url = response.url <NEW_LINE> name = response.xpath('//span[contains(@id, "roductTitle")]/text()').extract()[0] <NEW_LINE> packed = response.xpath('//h1[@id="title"]/span[contains(@class,"a-color-secondary")]/text()').extract()[0] <NEW_LINE> packed = packed.strip() <N...
[summary] 解析图书页面的信息 [description] 获取URL,书名,装帧方式,评论数,价格 Arguments: url -- [书籍的商品的 URL] name -- [书名] packed -- [装帧方式] comments_num -- [评论数] price -- [价格]
625941edbde94217f3683319
def align_ts(ts1,ts2, dual=True): <NEW_LINE> <INDENT> counter=1 <NEW_LINE> if dual: <NEW_LINE> <INDENT> ts_fixes={'ts1':{},'ts2':{}} <NEW_LINE> my_list = [ts1,ts2] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ts_fixes = {'ts1':{}} <NEW_LINE> my_list=[ts1] <NEW_LINE> <DEDENT> for ts in my_list: <NEW_LINE> <INDENT> if t...
Given that interpd1 does not interpolate the strating or trailing NaNs in timeseries, this function removes strating and trailing NaNs in time series making them the same shape. Args: ----- ts1 [list]: Goldstein timeseries ts2 [list]: Goldstein timeseries Returns: -------- ts_fixes [dict]: nested dict ...
625941ed10dbd63aa1bd30cf
def update_positions(current_positions, deal_positions, trans): <NEW_LINE> <INDENT> class PositionsDetail(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.total = 0 <NEW_LINE> self.positions = [] <NEW_LINE> self.cost = 0 <NEW_LINE> <DEDENT> <DEDENT> p = current_positions.setdefault(trans.contra...
更新持仓 current_positions: 当前持仓 deal_positions: 开平仓对
625941ed21bff66bcd684e7a
def generate_db_string(conn_dict): <NEW_LINE> <INDENT> user = conn_dict["user"] <NEW_LINE> if "password" in conn_dict.keys(): <NEW_LINE> <INDENT> user = user + ":" + conn_dict["password"] <NEW_LINE> <DEDENT> db_string = "postgresql://{}@{}:{}/{}".format( user, conn_dict["host"], conn_dict["port"], conn_dict["dbname"] )...
Build a database connexion string starting from a dict that contains connexion parameters Parameters ---------- conn_dict : dict Path to the database connexion configuration file Returns ------- str Database connexion string
625941ed15fb5d323cde1044
def new_entry( word:Str, sig:Maybe( Sig ), data:[ Tok ] ) -> IO( Entry ): <NEW_LINE> <INDENT> assert type( data ) <NEW_LINE> data = { 'id': len( g_defs ), 'word': word, 'sig': sig, 'data': data } <NEW_LINE> g_defs.append( data ) <NEW_LINE> g_dict[ word ] = data <NEW_LINE> return data
returns a new entry, saving it to the dictionary as a side effect
625941eda8ecb033257d35f8
def serializer(self, key: str, module: str=None): <NEW_LINE> <INDENT> if module: <NEW_LINE> <INDENT> occupieds = self.model.serials(module) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> occupieds = set() <NEW_LINE> <DEDENT> return Serializer(self.matchers[key], occupieds)
Create a Serializer object :param key: the name used to select prototype :param data: :param module: module name that the serializer will be used, used to get the :return: the serializer object for moudle
625941edc432627299f05177
def __init__(self, replay_buffer_capacity): <NEW_LINE> <INDENT> self._replay_buffer_capacity = replay_buffer_capacity <NEW_LINE> self._data = [] <NEW_LINE> self._next_entry_index = 0
Initialize the buffer
625941ed4527f215b584c97f
def testephemzero(self): <NEW_LINE> <INDENT> self.assertEqual(a.phs.juldate2ephem(self.jdzero), self.ephemzero) <NEW_LINE> self.assertEqual(a.phs.ephem2juldate(self.ephemzero), self.jdzero)
Test converting between ephem dates and JD - zero point
625941eda05bb46b383ecd4a
def set_bist_checker(self, enable): <NEW_LINE> <INDENT> if enable: <NEW_LINE> <INDENT> self.log.info("Enable Aurora BIST Checker") <NEW_LINE> self.mac_ctrl = self.mac_ctrl | 0b01 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.log.info("Disable Aurora BIST Checker") <NEW_LINE> self.mac_ctrl = self.mac_ctrl & 0xFFFFF...
Enable or disable Aurora BIST: Checker only
625941ed29b78933be1e5bd3
def test_latest_posts(): <NEW_LINE> <INDENT> service = get_service() <NEW_LINE> service.set_debug(True) <NEW_LINE> forum = service.get_forum_list()[0] <NEW_LINE> threads = forum.get_thread_list() <NEW_LINE> assert(len(threads) > 1)
Tests the API to get the most recent post.
625941edb7558d58953c5436
def inter2str_mdpd(a_ij): <NEW_LINE> <INDENT> s = "INTERACTIONS %i\n" % len(a_ij) <NEW_LINE> a_ij = OrderedDict(sorted(a_ij.items())) <NEW_LINE> for k, v in a_ij.items(): <NEW_LINE> <INDENT> if isinstance(k, tuple): <NEW_LINE> <INDENT> s += "%s %s %s " % (k[0], k[1], "mdpd") <NEW_LINE> s += "%.3f %.3f %.1f %.1f...
Dictionary of all pair interactions for many-body DPD. * key: pair, e.g. "A B" * values: array of [coefficient, rc, gamma] Method: add mddpd in the future
625941edcad5886f8bd27505
def reset(self): <NEW_LINE> <INDENT> self._pass_time = 0
Reset pass time.
625941ed8a349b6b435e86a0
def execute_step(self, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder, install_environment, work_dir, current_dir=None, initial_download=False): <NEW_LINE> <INDENT> if os.path.isabs(action_dict['full_path']): <NEW_LINE> <INDENT> full_path = action_dict['full_path'] <NEW_LINE> <D...
Make a directory on disk. Since this class is not used in the initial download stage, no recipe step filtering is performed here, and None values are always returned for filtered_actions and dir.
625941ed7047854f462a1931
def ol(*args, **kwargs): <NEW_LINE> <INDENT> return el('ol', *args, **kwargs)
The HTML <ol> Element (or HTML Ordered List Element) represents an ordered list of items. Typically, ordered-list items are displayed with a preceding numbering, which can be of any form, like numerals, letters or Romans numerals or even simple bullets. This numbered style is not defined in the HTML description of the ...
625941ed94891a1f4081bfd9
def _saturate_unsigned(self, val): <NEW_LINE> <INDENT> if val > self._max_unsigned_int: <NEW_LINE> <INDENT> val = self._max_unsigned_int <NEW_LINE> self.__saturation_warning() <NEW_LINE> <DEDENT> elif val < 0: <NEW_LINE> <INDENT> val = 0 <NEW_LINE> self.__saturation_warning() <NEW_LINE> <DEDENT> return val
Saturate out-of-range unsigned sample values.
625941edfb3f5b602dac3bc6
def load(filenames, prepare_data_iterator=True): <NEW_LINE> <INDENT> class Info: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> info = Info() <NEW_LINE> proto = nnabla_pb2.NNablaProtoBuf() <NEW_LINE> for filename in filenames: <NEW_LINE> <INDENT> _, ext = os.path.splitext(filename) <NEW_LINE> if 'txt' in ext: <NEW_LINE> ...
load Load network information from files. Args: filenames (list): List of filenames. Returns: dict: Network infomation.
625941ed30bbd722463cc2f6
def ShutdownRqdNow(self, request, context): <NEW_LINE> <INDENT> log.info("Request recieved: shutdownRqdNow") <NEW_LINE> self.rqCore.shutdownRqdNow() <NEW_LINE> return rqd_pb2.RqdStaticShutdownNowResponse()
RPC call that kills all running frames and shuts down rqd
625941ed6aa9bd52df0372d5
def put_notification(obj, payload): <NEW_LINE> <INDENT> pass
Add an arbitrary payload for a particular object (must support IUUID).
625941edd8ef3951e3243a6b
def _momentum_optimizer(loss, var_list, initial_learning_rate): <NEW_LINE> <INDENT> decay = 0.95 <NEW_LINE> num_decay_steps = 150 <NEW_LINE> batch = tf.Variable(0) <NEW_LINE> learning_rate = tf.train.exponential_decay( initial_learning_rate, batch, num_decay_steps, decay, staircase=True) <NEW_LINE> optimizer_ = tf.trai...
Momentum Optimizer with exponential learning rate decay
625941ed8e05c05ec3eea8a6
def checkpoint(self, time, full_state, random_state): <NEW_LINE> <INDENT> access_checkpoints = AccessCheckpoints(self.dirname) <NEW_LINE> access_checkpoints.set_checkpoint(Checkpoint(time, full_state, random_state.get_state()))
Store checkpoint at time `time` with full state `full_state` and PRNG state `random_state` Args: time (:obj:`float`): simulation time full_state (:obj:`FullSimulationState`): simulated full state random_state (:obj:`numpy.random.RandomState`): random number generator state
625941ed5510c4643540f904
def __ReceiveResponse(self,response_length,function_code): <NEW_LINE> <INDENT> valid = False <NEW_LINE> error_flag = False <NEW_LINE> function_code = int.from_bytes(bytes.fromhex(function_code),byteorder='big') <NEW_LINE> response = self.ser.read(size=2) <NEW_LINE> try: <NEW_LINE> <INDENT> response[1] <NEW_LINE> <DEDEN...
Private method which listens for a MODBUS response. Checks if the response is an error message and inspects the CRC value. Parameters: response_length (int): the anticipated length of the response in bytes function_code (str): the two-byte MODBUS function code Returns: vali...
625941ed30c21e258bdfa9d0
def factors(number): <NEW_LINE> <INDENT> out = [] <NEW_LINE> for i in range(int(number)): <NEW_LINE> <INDENT> if int(number % (i + 1)) == int(0): <NEW_LINE> <INDENT> print(str(i + 1), "is a factor of", number) <NEW_LINE> out.append(i + 1) <NEW_LINE> <DEDENT> <DEDENT> return out
Finds the factors of a give number e.g. print(factors(5)) returns an array [1,5] print(factors(6)) returns an array [1,2,3,6]
625941ed97e22403b379d4c9
@allure.title("Test block synchronization") <NEW_LINE> @pytest.mark.P0 <NEW_LINE> def test_CH_IN_018_CH_IN_007_CMD_039(global_test_env): <NEW_LINE> <INDENT> test_node = global_test_env.get_a_normal_node() <NEW_LINE> test_node.clean() <NEW_LINE> new_cfg = global_test_env.cfg <NEW_LINE> new_cfg.syncmode = "full" <NEW_LIN...
Non-consensus node block high synchronization
625941ed9f2886367277adb6
def revcomp(seq): <NEW_LINE> <INDENT> seq=seq.upper() <NEW_LINE> seq=seq[::-1] <NEW_LINE> intab="ACTG" <NEW_LINE> outtab="TGAC" <NEW_LINE> trantab=str.maketrans(intab,outtab) <NEW_LINE> seq=seq.translate(trantab) <NEW_LINE> return seq
this takes a given sequence and returns the reverse complement
625941ed63f4b57ef0001637
def binaryTreePaths(self, root): <NEW_LINE> <INDENT> res = [] <NEW_LINE> cand = [] <NEW_LINE> self.binary_tree_paths(root, cand, res) <NEW_LINE> return res
:type root: TreeNode :rtype: List[str]
625941ed30bbd722463cc2f7
def _disjunctive_normal_form(f, C): <NEW_LINE> <INDENT> f = _uniquify(f, [0]) <NEW_LINE> f = _remove_arrows(f) <NEW_LINE> f = _move_neg(f) <NEW_LINE> f = _remove_exists(f, C) <NEW_LINE> f = _remove_forall(f) <NEW_LINE> return _move_and(f)
Translate given formula to disjunctive normal form. f: a formula of first order logic. C: list of constants The result will be a list (disjunctions) of lists (conjuctions)
625941ed956e5f7376d71399
def indirect(self, interface): <NEW_LINE> <INDENT> if interface is IResource: <NEW_LINE> <INDENT> siteStore = self.store.parent <NEW_LINE> if self.store.parent is None: <NEW_LINE> <INDENT> siteStore = self.store <NEW_LINE> <DEDENT> return VirtualHostWrapper( siteStore, IWebViewer(self.store), self) <NEW_LINE> <DEDENT> ...
Create a L{VirtualHostWrapper} so it can have the first chance to handle web requests.
625941edd7e4931a7ee9e44d
@cache_page(DEFAULT_CACHE_TIME) <NEW_LINE> @vary_on_cookie <NEW_LINE> @login_required <NEW_LINE> @render_to('lenta.html') <NEW_LINE> @paginate(style='digg', per_page=10) <NEW_LINE> def lenta(request): <NEW_LINE> <INDENT> notifs = Notify.objects.select_related( 'post', 'comment', 'post__author', 'comment__author', 'post...
Return last posts and comments, adresed to user Keyword arguments: request -- request object Returns: Array
625941ed7d847024c06be7ee
def composite(self, filename, _): <NEW_LINE> <INDENT> if self.dryrun: <NEW_LINE> <INDENT> print('ImageCompositor: ({fn})'.format(fn=filename)) <NEW_LINE> return <NEW_LINE> <DEDENT> self.timestamp_helper.composite(filename)
Note an image to (maybe) copy.
625941edd18da76e23532a0b
def __init__( self, tesseract_path=TESSERACT_PATH, *, out_path=None, mode=3, delete=True ): <NEW_LINE> <INDENT> self._tesseract_path = tesseract_path <NEW_LINE> self._outpath = out_path <NEW_LINE> self._mode = mode <NEW_LINE> self._delete = delete
:param tesseract_path: tesseract 引擎的安装路径 :param out_path: 输出文件路径 :param mode: 图片的切割模式 :param delete: 是否保留生成的文本文件
625941ed0fa83653e46574e5
def __virtual__(): <NEW_LINE> <INDENT> if not salt.utils.which('ufw'): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return True
Load the module only if ufw is installed.
625941ed091ae35668667483
def make_auth_headers(self, content_type): <NEW_LINE> <INDENT> headers = self.make_headers(content_type) <NEW_LINE> headers['Authorization'] = 'Basic {}'.format(self.get_auth_string()) <NEW_LINE> return headers
Add authorization header.
625941ed24f1403a9260108f
def test_sample_201(self): <NEW_LINE> <INDENT> self.assertTrue(True)
passed template
625941ed07f4c71912b119b3
def add_diag(x, v): <NEW_LINE> <INDENT> for i in range(len(v)): <NEW_LINE> <INDENT> x[i, i] += v[i] <NEW_LINE> <DEDENT> return x
memory efficient way to add a diagonal matrix with a square matrix :param x: square matrix to be appended :param v: vector of diagonal elements :return:
625941ed76d4e153a657f061
def create_user_symbol(asset, base_ccy): <NEW_LINE> <INDENT> return (asset+base_ccy).upper()
Create the generic symbol that will be used in all price dictionaries as opposed to the specific symbols that are specific for each exchange
625941edac7a0e7691ed45f0
def __init__(self, vector, kwargs): <NEW_LINE> <INDENT> self._checkInitParamsSense(vector, kwargs) <NEW_LINE> if kwargs: <NEW_LINE> <INDENT> if vector: <NEW_LINE> <INDENT> if isinstance(vector, JimVect): <NEW_LINE> <INDENT> kwargs.update({'filename': str(kwargs.pop('output', None))}) <NEW_LINE> super(_ParentVect, self)...
Initialize the JimVect object and modules for methods. :param vector: path to a vector or another JimVect object as a basis for the JimVect object :param kwargs: See table below +------------------+--------------------------------------------------+ | key | value ...
625941ed2ae34c7f2600d65e
def pair_shutter_switches(self): <NEW_LINE> <INDENT> if self.paws.shutters is not None: <NEW_LINE> <INDENT> self.get_object('switches').show() <NEW_LINE> self.get_object('no_shutters').hide() <NEW_LINE> for i in range(self.paws.hardware.getMotorCount()): <NEW_LINE> <INDENT> if i in self.paws.shutters.keys(): <NEW_LINE>...
Update the switches to match current settings and associate the GUI to the shutters.
625941ed8c0ade5d55d3eeed
def filter_words(words, skip_words): <NEW_LINE> <INDENT> pass <NEW_LINE> sK = [word for word in words if word not in skip_words] <NEW_LINE> return sK
This function takes a list of words and returns a copy of the list from which all words provided in the list skip_words have been removed. For example: >>> filter_words(["help", "me", "please"], ["me", "please"]) ['help'] >>> filter_words(["go", "south"], skip_words) ['go', 'south'] >>> filter_words(['how', 'about',...
625941ed91f36d47f21aca26
@login_manager.user_loader <NEW_LINE> def load_user(user_id): <NEW_LINE> <INDENT> return db.session.query(Usuario).get(int(user_id))
Carrega o usuário que acabou de logar na sessão
625941ed3d592f4c4ed1d58d
@pytest.mark.parametrize("mode", ["ttest", "ftest"]) <NEW_LINE> def test_permutation_mode(mode, get_covmats, get_labels): <NEW_LINE> <INDENT> n_trials, n_channels, n_classes = 6, 3, 2 <NEW_LINE> covmats = get_covmats(n_trials, n_channels) <NEW_LINE> labels = get_labels(n_trials, n_classes) <NEW_LINE> p = PermutationDis...
Test one way permutation test
625941ed796e427e537b0af9
def get_title(self): <NEW_LINE> <INDENT> cb = ctypes.windll.user32.GetWindowTextLengthW(self.hwnd) + 1 <NEW_LINE> title = ctypes.create_unicode_buffer(cb) <NEW_LINE> ctypes.windll.user32.GetWindowTextW(self.hwnd, title, cb) <NEW_LINE> return title
Get native window title.
625941eddd821e528d63b6d3
def from_landxml(self, file, surfname=''): <NEW_LINE> <INDENT> sname = '{http://www.landxml.org/schema/LandXML-1.2}Surface' <NEW_LINE> dname = '{http://www.landxml.org/schema/LandXML-1.2}Definition' <NEW_LINE> tree = ET.parse(file) <NEW_LINE> root = tree.getroot() <NEW_LINE> for surface in root.iter(sname): <NEW_LINE> ...
Load a TIN surface from a landXLM file. Parameters ---------- file, string, is the LandXML file name surfname, string, is the surface name, by default load the first one
625941ed097d151d1a223384
def _widgetOnCurrentPage(self, widget): <NEW_LINE> <INDENT> return self.currentPage().findChild(widget.__class__, widget.objectName()) is not None
:returns Boolean True if widget is current active Wizard page
625941edb57a9660fec33dba
def __init__(self, nb_lin, nb_col, height, width, projection = None, **figure_properties): <NEW_LINE> <INDENT> figure_properties['figsize'] = (width, height) <NEW_LINE> Figure.__init__(self, **figure_properties) <NEW_LINE> self.nb_lin = nb_lin <NEW_LINE> self.nb_col = nb_col <NEW_LINE> gs = gridspec.GridSpec(nb_lin, nb...
Prepare a figure with a specified number axes Parameters ---------- nb_lin, nb_lin integer Number of lines and number of columns height, width float Height and width of the figure in inches axes_properties: set of axes properties
625941ed3eb6a72ae02eca1a
def test_has_module_permission(self): <NEW_LINE> <INDENT> login_url = reverse('admin:login') + '?next=/test_admin/admin/' <NEW_LINE> self.client.post(login_url, self.super_login) <NEW_LINE> response = self.client.get('/test_admin/admin/') <NEW_LINE> self.assertContains(response, 'admin_views') <NEW_LINE> self.assertCon...
Ensure that has_module_permission() returns True for all users who have any permission for that module (add, change, or delete), so that the module is displayed on the admin index page.
625941edf8510a7c17cf9c2e
def _checkConsistency( self ): <NEW_LINE> <INDENT> lastTag = self.latestTagInfo['name'] <NEW_LINE> if self._nextRealRelease == lastTag or versionComp( self._nextRealRelease, lastTag ) <= 0 or versionComp( self.newTag, lastTag ) <= 0: <NEW_LINE> <INDENT> self.log.error("Required (pre-)version (%r) is the sam...
check for invalid version requirements
625941ed5e10d32532c5f453
def Pt_ratio(Mn, gamma=defg._gamma): <NEW_LINE> <INDENT> return Ps_ratio(Mn, gamma)*Is.PtPs_Mach(downstream_Mn(Mn, gamma))/Is.PtPs_Mach(Mn, gamma)
Total pressure ration through shock wave Args: Mn: upstream relative normal Mach number to param gamma: (Default value = defg._gamma) Returns:
625941ed596a897236089fe7
def test_update_load_balancer_client_ssl_profile(self): <NEW_LINE> <INDENT> pass
Test case for update_load_balancer_client_ssl_profile Update a load balancer client-ssl profile # noqa: E501
625941edd4950a0f3b08c875
def get_participate_events(user): <NEW_LINE> <INDENT> now=timezone.now() <NEW_LINE> evs_lst= [] <NEW_LINE> par_qs=user.participant_set.filter(event__date__gte=now).order_by('event__date').select_related('event') <NEW_LINE> for par_ins in par_qs: <NEW_LINE> <INDENT> evs_lst.append(par_ins.event) <NEW_LINE> <DEDENT> retu...
`get_participate_events` returns a queryset of all events for which the user said he/she would participate
625941edd53ae8145f87a793
def test_maternal_consent_object_does_not_exist(self): <NEW_LINE> <INDENT> self.subject_consent.delete() <NEW_LINE> cleaned_data = { 'report_datetime': get_utcnow(), 'subject_identifier': self.subject_consent.subject_identifier} <NEW_LINE> form_validator = AntenatalVisitMembershipFormValidator( cleaned_data=cleaned_dat...
Asserts if Validation Error is raised if the maternal consent object does not exist.
625941ed32920d7e50b28703
def removePunctuations(text): <NEW_LINE> <INDENT> for punctuation in string.punctuation: <NEW_LINE> <INDENT> text = text.replace(punctuation, '') <NEW_LINE> <DEDENT> return text
:param text: :return:
625941edb830903b967e9e33
def get_default_config_dir(filename=None): <NEW_LINE> <INDENT> if windows_check(): <NEW_LINE> <INDENT> def save_config_path(resource): <NEW_LINE> <INDENT> app_data_path = os.environ.get('APPDATA') <NEW_LINE> if not app_data_path: <NEW_LINE> <INDENT> import winreg <NEW_LINE> hkey = winreg.OpenKey( winreg.HKEY_CURRENT_US...
:param filename: if None, only the config path is returned, if provided, a path including the filename will be returned :type filename: string :returns: a file path to the config directory and optional filename :rtype: string
625941ed23e79379d52eea8b
def test_query_multiple_tables(self): <NEW_LINE> <INDENT> result = session.query(User, Address).all() <NEW_LINE> print(type(result)) <NEW_LINE> for item in result: <NEW_LINE> <INDENT> print(item)
这种方式相当于笛卡尔乘积
625941ed283ffb24f3c55e2a
def form_2_model(form): <NEW_LINE> <INDENT> d = form.cleaned_data <NEW_LINE> if d['individual'] == u'Individual': <NEW_LINE> <INDENT> individual = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> individual = False <NEW_LINE> <DEDENT> newregistration = AustinCricket08Registration( captain_first_name=d['first_name'], ...
Convert the AustinCricket08RegistrationForm above to AustinCricket08Registration
625941ed97e22403b379d4ca
def get_new(modules, min_major_version, min_minor_version): <NEW_LINE> <INDENT> for mod_data in modules: <NEW_LINE> <INDENT> (modname, mod_major_version, mod_minor_version) = mod_data <NEW_LINE> if (mod_major_version > min_major_version or (mod_major_version == min_major_version and mod_minor_version >= min_minor_versi...
Get list of migrations that haven't been run yet :param modules: iterable containing module names :param min_major_version: minimum major version :param min_minor_version: minimum minor version :returns: return an iterator that yields only items which versions are >=...
625941ed4a966d76dd551543
def chooseAction(self, gameState): <NEW_LINE> <INDENT> actions = gameState.getLegalActions(self.index) <NEW_LINE> values = [self.evaluate(gameState, a) for a in actions] <NEW_LINE> maxValue = max(values) <NEW_LINE> bestActions = [a for a, v in zip(actions, values) if v == maxValue] <NEW_LINE> foodLeft = len(self.getFoo...
Picks among the actions with the highest Q(s,a).
625941ed3539df3088e2e87a
def substitute_origin(self, origin_map, substitute_map, line_number): <NEW_LINE> <INDENT> endl = line_number <NEW_LINE> for origin in origin_map: <NEW_LINE> <INDENT> substitute_var = Term.parse(substitute_map[origin]) if type(substitute_map[origin]) is str else substitute_map[origin] <NEW_LINE> formula =...
substitute formula in line number given the maps
625941ed7c178a314d6ef996
def remove_model(self, wave_file, identifier, score, gender): <NEW_LINE> <INDENT> raise NotImplementedError()
Remove a speaker model from the database according to the score it gets by matching vs the given feature file :type wave_file: string :param wave_file: the wave file :type identifier: string :param identifier: the name or label of the speaker :type score: float :param score: the score obtained in the voice matching ...
625941ed94891a1f4081bfda
def FreeSemaphore(*args): <NEW_LINE> <INDENT> return _DigitalMicrograph.FreeSemaphore(*args)
FreeSemaphore(long argument_1)
625941edff9c53063f47c71f
@server.before_first_request <NEW_LINE> def setup_ee(): <NEW_LINE> <INDENT> with open("privatekey.json") as keyfile: <NEW_LINE> <INDENT> extracted_key_data = keyfile.read() <NEW_LINE> credentials = ee.ServiceAccountCredentials( config.EE_SERVICE_ACCOUNT, key_data=extracted_key_data) <NEW_LINE> <DEDENT> ee.Initialize(cr...
Sets up Earth Engine authentication.
625941ed9c8ee82313fbbca5
def create_invoice(self, invoice_type): <NEW_LINE> <INDENT> Invoice = Pool().get('account.invoice') <NEW_LINE> invoice = super(Sale, self).create_invoice(invoice_type) <NEW_LINE> if not invoice: <NEW_LINE> <INDENT> return invoice <NEW_LINE> <DEDENT> if self.invoice_method == 'shipment' and invoice_type == 'out_invoice'...
Sale creates draft invoices. But if the invoices are created from shipments, then they should be automatically opened
625941ed30dc7b7665901e8e
def _itemWidgetSelectionChanged(self, index): <NEW_LINE> <INDENT> item = self._repositoryModel.nodeFromIndex(index) <NEW_LINE> rows = self._model.determineRows(item) <NEW_LINE> if len(rows) > 0: <NEW_LINE> <INDENT> topLeft = self._model.index(rows[0], 0) <NEW_LINE> bottomRight = self._model.index(rows[len(rows )- 1], 3...
Handles changed items of the select item widget and selects corresponding privilege definition in the table.
625941ed8c0ade5d55d3eeee
def enable_plots_saving(self, plots_save_frequency): <NEW_LINE> <INDENT> self.save_plots_automatically = True <NEW_LINE> self.plots_save_frequency = plots_save_frequency
Enables automatic plotting of key-values. Args: plots_save_frequency (int): Frequency for plotting the values automatically.
625941ed4527f215b584c980
def flags_hpux(): <NEW_LINE> <INDENT> flags = BASE_FLAGS.copy() <NEW_LINE> flags['volume_set_addressing'] = {'enabled': True, 'override': True} <NEW_LINE> flags['spc2_protocol_version'] = {'enabled': True, 'override': True} <NEW_LINE> flags['openvms'] = {'enabled': False, 'override': True} <NEW_LINE> return flags
Build Host Flags for HPUX host_type :return: (dict)
625941ed7cff6e4e81117eb4
def __init__(self, interval_minimum: int, interval_maximum: int, seed: int, duration: int, fatal_watcher: FatalWatcher, uniform_interval: int = config.UNIFORM_INTERVAL)->None: <NEW_LINE> <INDENT> if not isinstance(interval_minimum, int): <NEW_LINE> <INDENT> raise ValueError("interval_minimum must be int") <NEW_LINE> <D...
`interval_minimum`, `interval_maximum`, `seed`, and `duration` are all integers. `interval_minimum`, `interval_maximum`, and `duration` are in seconds.
625941ed73bcbd0ca4b2c5a4
def save_text_file(self): <NEW_LINE> <INDENT> text_to_save = self.center_text.toPlainText() <NEW_LINE> if self.working_file_name: <NEW_LINE> <INDENT> with open(self.working_file_name, 'w', encoding='utf-8') as save_file: <NEW_LINE> <INDENT> save_file.write(text_to_save) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <IN...
Saves the written text to a file
625941ed38b623060ff0b31c
def _filter_angs_3(angs_0, angs_1, symHKLs_ix, etaEdges, etaMin, etaMax, omeEdges, omeMin, omeMax, omePeriod): <NEW_LINE> <INDENT> oangs = _normalize_angs(angs_0, angs_1, -np.pi, min(omePeriod)) <NEW_LINE> symHKLs_ix = symHKLs_ix*2 <NEW_LINE> hkl_idx = num.empty((symHKLs_ix[-1],), dtype=int) <NEW_LINE> start = symHKLs_...
bakes data in a way that invalid (nan or out-of-bound) is discarded. returns: - hkl_idx, array of associated hkl indices - eta_idx, array of associated eta indices of predicted - ome_idx, array of associated ome indices of predicted
625941ed5166f23b2e1a5687
def random_flips_f(result_vector): <NEW_LINE> <INDENT> n=result_vector.size <NEW_LINE> int_vector1=np.zeros(n) <NEW_LINE> int_vector1[:]=result_vector <NEW_LINE> int_vector2=np.absolute(int_vector1-1) <NEW_LINE> integers=r.sample(range(1,n),10) <NEW_LINE> replacement=int_vector2[integers] <NEW_LINE> np.put(int_vector1,...
This function takes the result_vector and flips 10% of the bits
625941edd53ae8145f87a794
def _(text, disambiguation=None, context='ImportPlugin'): <NEW_LINE> <INDENT> return qt4.QCoreApplication.translate(context, text, disambiguation)
Translate text.
625941eda79ad161976cc674
def drnc26(**kwargs): <NEW_LINE> <INDENT> return get_drn(blocks=26, model_name="drnc26", **kwargs)
DRN-C-26 model from 'Dilated Residual Networks,' https://arxiv.org/abs/1705.09914. Parameters: ---------- pretrained : bool, default False Whether to load the pretrained weights for model. ctx : Context, default CPU The context in which to load the pretrained weights. root : str, default '~/.mxnet/models' ...
625941ed15baa723493c44a8
def invite_to_private_channel( self, channel_name: str, user_name: str, ) -> Dict[ str, Union[Dict[str, Union[Dict[str, str], List[str], str]], str] ]: <NEW_LINE> <INDENT> return requests.post( url='https://slack.com/api/groups.invite', headers={ 'Authorization': f'Bearer {self.api_token}', 'Content-type': 'application...
Invites user to join private channel in the Slack Workspace Uses the Slack Web API call https://api.slack.com/methods/groups.invite with no caching; limited to private channels in the API Token's scope Args: channel_name: name of private channel in Slack Workspace user_name: user name of user to invite to pri...
625941ede76e3b2f99f3ad31
def resync(self, socket=None, cb=None, args=None): <NEW_LINE> <INDENT> if socket is None: <NEW_LINE> <INDENT> socket = lookup_socket(self._protocol) <NEW_LINE> <DEDENT> capi.nl_cache_resync(socket._sock, self._nl_cache, cb, args)
Synchronize cache with content in kernel
625941ed44b2445a339325c1
def test_parseReference(self): <NEW_LINE> <INDENT> r = Reference(Atom('foo'), 5, 1) <NEW_LINE> self.assertEqual( self.parser.binaryToTerm("ed\x00\x03foo" "\x00\x00\x00\x05\x01"), (r, ""))
Parse a reference binary representation: the reference ID is only an integer.
625941eda05bb46b383ecd4b
def show_trailer(self): <NEW_LINE> <INDENT> webbrowser.open(self.trailer_youtube_url)
Opens trailer in a web browser
625941ed099cdd3c635f1187
def testFilepoolPolicyFileMatchingPatternOrCriteriaItemAndCriteriaItem(self): <NEW_LINE> <INDENT> pass
Test FilepoolPolicyFileMatchingPatternOrCriteriaItemAndCriteriaItem
625941ed15fb5d323cde1046
def _motion_notify_event(self, widget, event): <NEW_LINE> <INDENT> if not self.is_image_loaded(): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> end_point_orig = self._screen_to_image((event.x, event.y)) <NEW_LINE> end_point = self._truncate_to_image_size(end_point_orig) <NEW_LINE> if self.start_point_screen: <NEW_LINE...
Handles the motion-notify-event signal.
625941ed377c676e912726d6
def jsondump(model, fp): <NEW_LINE> <INDENT> fp.write('[') <NEW_LINE> links_ser = [] <NEW_LINE> for link in model: <NEW_LINE> <INDENT> links_ser.append(json.dumps(link)) <NEW_LINE> <DEDENT> fp.write(',\n'.join(links_ser)) <NEW_LINE> fp.write(']')
Dump Versa model into JSON form
625941ed8e71fb1e9831dcd6
def send_message(self, gpio=0, level=0, tick=0): <NEW_LINE> <INDENT> message = self.message_buffer.get() <NEW_LINE> self.send_to_pin(message) <NEW_LINE> print(message)
Sends message from queue to pin
625941edc432627299f05179
def __init__(self) : <NEW_LINE> <INDENT> self._root = None <NEW_LINE> self._right = None <NEW_LINE> self._left = None <NEW_LINE> self._size = 0
Input: BinTree (implicit argument) Output: BinTree Purpose: Creates an empty binary tree
625941ed26068e7796caf216
def failure(self, format, failure=None, level=LogLevel.critical, **kwargs): <NEW_LINE> <INDENT> if failure is None: <NEW_LINE> <INDENT> failure = Failure() <NEW_LINE> <DEDENT> self.emit(level, format, log_failure=failure, **kwargs)
Log an failure and emit a traceback. For example:: try: frob(knob) except Exception: log.failure("While frobbing {knob}", knob=knob) or:: d = deferredFrob(knob) d.addErrback(lambda f: log.failure, "While frobbing {knob}", f, knob=knob) This method is generally meant...
625941ede8904600ed9f2465
def gen_lines(self, timeout=None): <NEW_LINE> <INDENT> start_time = time.time() <NEW_LINE> while True: <NEW_LINE> <INDENT> rdb, wtb, xtb = select.select([self.fd], [], [], timeout) <NEW_LINE> if rdb: <NEW_LINE> <INDENT> fd = rdb[0] <NEW_LINE> data = os.read(fd, 1024) <NEW_LINE> self._buffer += data <NEW_LINE> <DEDENT> ...
Generator returning individual lines received by the TURRIS:DONGLE. Note: Messages are sent more than once by the sensors to protect against data loss. This code does not take care of removing the duplicates, it is up to you.
625941ed293b9510aa2c37c0
def average(scanline, previous, filter_unit): <NEW_LINE> <INDENT> ai = -filter_unit <NEW_LINE> result = array('B', scanline) <NEW_LINE> for i in range(len(result)): <NEW_LINE> <INDENT> x = scanline[i] <NEW_LINE> if ai < 0: <NEW_LINE> <INDENT> a = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> a = result[ai] <NEW_LINE>...
Undo average filter.
625941edcad5886f8bd27507
def vert_slide(value: float = 0.0, use_even: bool = False, flipped: bool = False, use_clamp: bool = True, mirror: bool = False, 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), correct_uv: bool = False, release_confirm...
Slide a vertex along a mesh :param value: Factor :type value: float :param use_even: Even, Make the edge loop match the shape of the adjacent edge loop :type use_even: bool :param flipped: Flipped, When Even mode is active, flips between the two adjacent edge loops :type flipped: bool :param use_clamp: Clamp, Clam...
625941ed0a366e3fb873ed4e
def removeDuplicates(self, nums): <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> last_num = None <NEW_LINE> last_index = None <NEW_LINE> for i in range(len(nums)): <NEW_LINE> <INDENT> n = nums[i] <NEW_LINE> if last_num is None: <NEW_LINE> <INDENT> last_num = n <NEW_LINE> last_index = ...
:type nums: List[int] :rtype: int
625941ed16aa5153ce3629a8
def _list_cells(self, values, in_row=None, in_column=None): <NEW_LINE> <INDENT> if in_row and in_column: <NEW_LINE> <INDENT> raise TypeError( "Either 'in_row' or 'in_column' should be specified." ) <NEW_LINE> <DEDENT> if in_column: <NEW_LINE> <INDENT> return [ Cell(row=i + 1, col=in_column, value=row[in_column - 1]) fo...
Returns a list of ``Cell`` instances scoped by optional ``in_row``` or ``in_column`` values (both one-based).
625941ed15baa723493c44a9
def on(event_name, cb): <NEW_LINE> <INDENT> emitter.eon(event_name, cb)
подписаться на события
625941ed29b78933be1e5bd5
def describe_features(self, traj): <NEW_LINE> <INDENT> feature_descs = [] <NEW_LINE> for dihed_type in self.types: <NEW_LINE> <INDENT> func = getattr(md, 'compute_%s' % dihed_type) <NEW_LINE> aind_tuples, _ = func(traj) <NEW_LINE> top = traj.topology <NEW_LINE> zippy = zippy_maker(aind_tuples, top) <NEW_LINE> if self.s...
Return a list of dictionaries describing the dihderal features. Parameters ---------- traj : mdtraj.Trajectory The trajectory to describe Returns ------- feature_descs : list of dict Dictionary describing each feature with the following information about the atoms participating in each dihedral - ...
625941ed23e79379d52eea8c
def get_raw_state(self, usr_data): <NEW_LINE> <INDENT> return []
Get unprocessed state from user data :param usr_data: user data :return:
625941ed5e10d32532c5f454
def nozzle(self): <NEW_LINE> <INDENT> pass
Converging/Diverging Nozzle
625941ed0c0af96317bb8717
def to_string(self, indices: List[int]) -> str: <NEW_LINE> <INDENT> return " ".join(self.decode(indices, strip_eow=False))
Converts a sequence of indices in to a readable string. :param indices: :return: A string corresponding to @indices. Example: 1 2 3 -> the
625941ed4f6381625f114f6a