code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
def get_field_values(self, objectname, valuetype): <NEW_LINE> <INDENT> return []
returns fields for a specific object
625941ef8a43f66fc4b545d2
def to_snake(value): <NEW_LINE> <INDENT> return TO_SNAKE_RE.sub(r"_\1", value).lower()
Convert *value* from lowerCamelCase to snake_case.
625941eff7d966606f6aa57d
def readFile(self): <NEW_LINE> <INDENT> isd = False <NEW_LINE> options = self.options <NEW_LINE> if options['k'].isdigit(): <NEW_LINE> <INDENT> usecols = [int(s) for s in [options['k'], options['o']]] <NEW_LINE> isd = True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> allcols = iotools.open_file( options['l']).readline...
Reads the input files to memory.
625941efd4950a0f3b08c8b9
def setVisualSettings(self, visualSettings): <NEW_LINE> <INDENT> if ("FoldedColumns" in visualSettings): <NEW_LINE> <INDENT> if isinstance(visualSettings["FoldedColumns"], list): <NEW_LINE> <INDENT> self.table.setFoldedColumns(visualSettings["FoldedColumns"]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.table.set...
Deal with the visual settings that the model saved. Args: visualSettings (dict): dictionnary containing some visual parameters that the view can deal with
625941efadb09d7d5db6ccff
def _publish(self, author_id, board_name, article_id, root_id, root_title, reply_author): <NEW_LINE> <INDENT> for user_id in self.sub_db.smembers(root_id): <NEW_LINE> <INDENT> if user_id == author_id: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if not self.noti.zscore(user_id, '%d#%d#%d' % (TYPE_FROM_REPLY, articl...
모든 구독자에게 push를 보낸다. 이 명령은 반드시 Reply에 대한 Notification이 먼저 등록된 후에 호출되어야 한다. 그렇지 않으면 중복이 생길 것이다. @type author_id: int @param author_id: Reply 작성자 ID @type board_name: string @type board_name: 게시판 이름 @type article_id: int @param article_id: Update된 thread의 reply article id @type root_id: int @param root_id: Update된 t...
625941ef16aa5153ce3629eb
def get_clipboard_files() -> list: <NEW_LINE> <INDENT> file_list = [] <NEW_LINE> if user32.OpenClipboard(None): <NEW_LINE> <INDENT> hGlobal = user32.GetClipboardData(CF_HDROP) <NEW_LINE> if hGlobal: <NEW_LINE> <INDENT> hDrop = GlobalLock(hGlobal) <NEW_LINE> if hDrop: <NEW_LINE> <INDENT> count = DragQueryFile(hDrop, 0xF...
get clipboard files path list
625941efa05bb46b383ecd8f
def prepare_test_file(self): <NEW_LINE> <INDENT> self._counter+=1 <NEW_LINE> if self._counter>= 3: <NEW_LINE> <INDENT> source = FileFinder.findRuns('MAR11015')[0] <NEW_LINE> targ_path = config['defaultsave.directory'] <NEW_LINE> targ_file = os.path.join(targ_path,'MAR11002.raw') <NEW_LINE> shutil.copy2(source ,targ_fi...
This method will run instead of pause and would copy run file 11015 into 11002 emulating appearance of this file from instrument
625941efd8ef3951e3243ab0
def _getMidi(self): <NEW_LINE> <INDENT> def schoolYardRounding(x, d=0): <NEW_LINE> <INDENT> p = 10 ** d <NEW_LINE> return float(math.floor((x * p) + math.copysign(0.5, x)))/p <NEW_LINE> <DEDENT> roundedPS = int(schoolYardRounding(self.ps)) <NEW_LINE> if roundedPS > 127: <NEW_LINE> <INDENT> value = (12 * 9) + (roundedPS...
see docs below, under property midi
625941ef5166f23b2e1a56cc
def extract_pl_table(year, quarter, sheet, x_companies): <NEW_LINE> <INDENT> df = read_data(sheet, year, quarter) <NEW_LINE> header = df[df.iloc[:, 1] == 'Company'].dropna(axis=1) <NEW_LINE> df = df[df.iloc[:, 1].isin( x_companies)].dropna(axis=1, how='all') <NEW_LINE> df.columns = header.values[0].tolist() <NEW_LINE> ...
Extracts profit and loss tables from the sheets, x_company --> (gen_companies,life_companies)
625941ef9c8ee82313fbbcea
def _series_as_JSON(series): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> new_series = series.fillna('""').map(json.loads).replace('', np.nan) <NEW_LINE> logger.info('Parsed "{}" as JSON'.format(series.name)) <NEW_LINE> return new_series <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None
Try to read a pandas Series as JSON. Returns None if it fails.
625941ef30c21e258bdfaa16
def get_dataset_dir(): <NEW_LINE> <INDENT> if 'MPI_INF_PATH' in os.environ: <NEW_LINE> <INDENT> dataset_dir = os.environ['MPI_INF_PATH'] <NEW_LINE> if not os.path.isdir(dataset_dir): <NEW_LINE> <INDENT> raise RuntimeError('MPI_INF_PATH directory does not exist') <NEW_LINE> <DEDENT> return dataset_dir <NEW_LINE> <DEDENT...
Get the dataset directory based on MPI_INF_PATH environment variable. Raises: RuntimeError if MPI_INF_PATH environment not set or isn't a directory.
625941efd164cc61757832c2
def test_existing_content_tile(self): <NEW_LINE> <INDENT> page_id = self.portal.invokeFactory( "Document", "an-another-page", title=u"An another page", description=u"A description", text=u"Hello World!", ) <NEW_LINE> self.portal[page_id].text = RichTextValue(u"Hello World!") <NEW_LINE> page_uuid = IUUID(self.portal[pag...
The existing content tile takes the uuid of a content object in the site and displays the result of calling its default view's content-core macro
625941efcb5e8a47e48b8014
def count_tickets(self): <NEW_LINE> <INDENT> return Ticket.objects.count()
Returns the number of tickets.
625941ef4a966d76dd551588
def load(lib, IM_VERSION): <NEW_LINE> <INDENT> lib.ClearMagickWand.argtypes = [c_void_p] <NEW_LINE> lib.CloneMagickWand.argtypes = [c_void_p] <NEW_LINE> lib.CloneMagickWand.restype = c_void_p <NEW_LINE> lib.DestroyMagickWand.argtypes = [c_void_p] <NEW_LINE> lib.DestroyMagickWand.restype = c_void_p <NEW_LINE> lib.IsMagi...
Define Magick Wand methods. The ImageMagick version is given as a second argument for comparison. This will quick to determine which methods are available from the library, and can be implemented as:: if IM_VERSION < 0x700: # ... do ImageMagick-6 methods ... else # ... do ImageMagick-7 methods ...
625941ef8e05c05ec3eea8ec
def submit_proposal_callback(self, proposal_name, errmsg, r, save = True): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.on_proposal_submitted(proposal_name, r) <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> errmsg.append(str(e)) <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> if save: <NEW_LINE> <...
Callback for when a proposal has been submitted.
625941ef5fc7496912cc3ef0
def PrependChrootPath(path): <NEW_LINE> <INDENT> chroot_path = os.path.join(FindRepoDir(), '..', 'chroot') <NEW_LINE> if path.startswith('/'): <NEW_LINE> <INDENT> return os.path.realpath(os.path.join(chroot_path, path[1:])) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return os.path.realpath(os.path.join(chroot_path, ...
Assumes path is a chroot path and prepends chroot to create full path.
625941ef15fb5d323cde108b
def test_delete(self, mocker): <NEW_LINE> <INDENT> url = ( "https://cloudapi.acquia.com/v1/" "sites/prod:mysite/envs/prod/domains/foo.com.json" ) <NEW_LINE> mocker.register_uri( "DELETE", url, json=self.generate_task_dictionary(1137, "waiting", False) ) <NEW_LINE> mocker.register_uri( "GET", "https://cloudapi.acquia.co...
Test domain delete operation.
625941ef07f4c71912b119f8
def summary_writer_eager_fallback(shared_name="", container="", name=None): <NEW_LINE> <INDENT> _ctx = _context.context() <NEW_LINE> if shared_name is None: <NEW_LINE> <INDENT> shared_name = "" <NEW_LINE> <DEDENT> shared_name = _execute.make_str(shared_name, "shared_name") <NEW_LINE> if container is None: <NEW_LINE> <I...
This is the slowpath function for Eager mode. This is for function summary_writer
625941ef8e7ae83300e4b542
def createLKMethodInterface(self): <NEW_LINE> <INDENT> self.LKOptionWidget = QtGui.QGroupBox() <NEW_LINE> self.LKOptionWidget.hide() <NEW_LINE> self.OptionLayout.addWidget(self.LKOptionWidget) <NEW_LINE> self.LKOptionLayout = QtGui.QHBoxLayout() <NEW_LINE> self.LKOptionWidget.setLayout(self.LKOptionLayout) <NEW_LINE> s...
Create the layout for the widgets specific to the treatment which use Lucas-Kanade algorithm.
625941ef009cb60464c63920
def orientation2d(a, b, c): <NEW_LINE> <INDENT> l = (a[1] - c[1]) * (b[0] - c[0]) <NEW_LINE> r = (a[0] - c[0]) * (b[1] - c[1]) <NEW_LINE> det = l - r <NEW_LINE> if l > 0: <NEW_LINE> <INDENT> if r <= 0: <NEW_LINE> <INDENT> return det <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> s = l + r <NEW_LINE> <DEDENT> <DEDENT> el...
orientation in 2d space :param a: :param b: :param c: :return:
625941ef099cdd3c635f11cb
def solveNQueens(self, n): <NEW_LINE> <INDENT> def encode(Q): <NEW_LINE> <INDENT> n = len(Q) <NEW_LINE> return ['.' * idx + 'Q' + '.' * (n - idx - 1) for idx in Q] <NEW_LINE> <DEDENT> def queen(Q, idx, solns): <NEW_LINE> <INDENT> n = len(Q) <NEW_LINE> if idx == n: <NEW_LINE> <INDENT> solns.append(encode(Q)) <NEW_LINE> ...
:type n: int :rtype: List[List[str]]
625941eff8510a7c17cf9c74
def compute_total_loss(logli, all_advs, ent_coeff, ent, vf_loss_coeff, all_returns, all_values): <NEW_LINE> <INDENT> policy_loss = Variable(np.array(0.)) <NEW_LINE> vf_loss = Variable(np.array(0.)) <NEW_LINE> total_loss = Variable(np.array(0.)) <NEW_LINE> policy_loss = F.mean( logli * all_advs) - ent_coeff * F.mean(ent...
:param logli: A chainer variable, which should be a vector of size N :param all_advs: A chainer variable, which should be a vector of size N :param ent_coeff: A scalar :param ent: A chainer variable, which should be a vector of size N :param vf_loss_coeff: A scalar :param all_returns: A chainer variable, which should b...
625941ef44b2445a33932605
def numberOfArithmeticSlices(self, A): <NEW_LINE> <INDENT> self.L = len(A) <NEW_LINE> if self.L < 3: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> self.count = [0 for __ in range(self.L)] <NEW_LINE> for i in range(2, len(A)): <NEW_LINE> <INDENT> if A[i]-A[i-1] == A[i-1]-A[i-2]: <NEW_LINE> <INDENT> self.count[i] = se...
:type A: List[int] :rtype: int
625941ef15baa723493c44ed
def project_onto_geometry(geom, target, pool: Pool=None): <NEW_LINE> <INDENT> if isinstance(geom, shapely.geometry.GeometryCollection): <NEW_LINE> <INDENT> if pool is None: <NEW_LINE> <INDENT> projected_geom = [project_onto_geometry(g, target, pool=pool) for g in geom] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> part...
Projects all points from line_string onto target. @param geom: @param target: @param pool: @return:
625941ef56b00c62f0f14bd0
def set_cast_path(self, path, expected_type, corrected_type): <NEW_LINE> <INDENT> self._cast_paths[re.compile(path + '$')] = {"expected": expected_type, "corrected": corrected_type}
Cast path (dataset or attribute) to corrected_type. Needed because some datasets and attributes are of different type on different platforms. Stores the necessary information for the casting in a dict called self._cast_paths :param path: regular expression path to the dataset that may need casting :param expected_typ...
625941efa8ecb033257d363e
def get_installed_packages(self) -> set[str]: <NEW_LINE> <INDENT> pacman = run(["pacman", "-Qq"], capture_output=True, check=True) <NEW_LINE> return set(pacman.stdout.decode("utf-8").split("\n"))
Return a set of currently installed packages.
625941ef8a349b6b435e86e6
def get_latest_saved_checkpoint(): <NEW_LINE> <INDENT> checkpoint_files = os.listdir(os.path.join('_logs', g_conf.EXPERIMENT_BATCH_NAME, g_conf.EXPERIMENT_NAME, 'checkpoints')) <NEW_LINE> if checkpoint_files == []: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sort_nicely(checkpoint_file...
Returns the , latest checkpoint number that was saved
625941ef26238365f5f0f3e9
def _strength_mapping(self, strength): <NEW_LINE> <INDENT> mapping = { 'Royal Flush': 9, 'Straight Flush': 8, 'Four of a Kind': 7, 'Full House': 6, 'Flush': 5, 'Straight': 4, 'Three of a Kind': 3, 'Two Pairs': 2, 'One Pair': 1, 'High Card': 0 } <NEW_LINE> return mapping[strength]
Convert the string values of a hand's strength to a numeric value for comparison purposes.
625941efaad79263cf390fbd
def hot_update_mail_notify(to_list, content_obj, finish_ok): <NEW_LINE> <INDENT> if isinstance(content_obj, ServerHotUpdate): <NEW_LINE> <INDENT> update_type = '后端热更新#' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> update_type = '前端热更新#' <NEW_LINE> <DEDENT> if finish_ok: <NEW_LINE> <INDENT> subject = update_type + cont...
热更新完成后调用这个函数 告知工单发起人,节点审批人和额外 通知的人本次更新结果
625941efde87d2750b86030c
def all_positions(board): <NEW_LINE> <INDENT> position = (1, 1) <NEW_LINE> while position is not None: <NEW_LINE> <INDENT> yield position <NEW_LINE> position = Position.next(Board.dimension(board), position)
:param board: :return: generator for all positions on the board
625941ef507cdc57c630725c
def max_pool_forward_naive(x, pool_param): <NEW_LINE> <INDENT> out = None <NEW_LINE> pool_height = pool_param['pool_height'] <NEW_LINE> pool_weight = pool_param['pool_width'] <NEW_LINE> stride = pool_param['stride'] <NEW_LINE> N, C, H, W = x.shape <NEW_LINE> out_height = int((H - pool_height)/stride) + 1 <NEW_LINE> out...
A naive implementation of the forward pass for a max pooling layer. Inputs: - x: Input data, of shape (N, C, H, W) - pool_param: dictionary with the following keys: - 'pool_height': The height of each pooling region - 'pool_width': The width of each pooling region - 'stride': The distance between adjacent poolin...
625941ef32920d7e50b28748
def pca(X = np.array([]), no_dims = 50): <NEW_LINE> <INDENT> Y = np.array([]) <NEW_LINE> M = np.array([]) <NEW_LINE> N, D = X.shape <NEW_LINE> cov_mat = np.cov(X.T) <NEW_LINE> eigen_vals, eigen_vecs = np.linalg.eig(cov_mat) <NEW_LINE> eigen_pairs = [(np.abs(eigen_vals[i]),eigen_vecs[:,i]) for i in range(len(eigen_vals)...
Inputs: - X: A matrix with shape N x D where N: the number of examples & D: dimensionality of original data. - no_dims: A scalar indicates the output dimension of examples after performing PCA. Returns: - Y: A matrix of reduced size with shape N x no_dims where N is the number of examples and no_dims is the dimension...
625941ef56ac1b37e6264738
def reverts_per_yr_graphic(data, labels): <NEW_LINE> <INDENT> y_pos = [3*x for x in list(range(len(data)))] <NEW_LINE> plt.bar(y_pos, data) <NEW_LINE> plt.xticks(y_pos,labels, rotation = "vertical") <NEW_LINE> plt.ylabel('Reverts Per Year') <NEW_LINE> plt.title('Reverts Per Year of Contentious vs. Non-contentious Wikip...
Plots reverts per year, shows and saves figure. data: list of numbers labels: list of strings
625941ef23e79379d52eead0
def KT_eingesp(E, A, I, l, u, element='all'): <NEW_LINE> <INDENT> lam2 = l**2 / (I / A) <NEW_LINE> K = np.matrix([[lam2, 0, 0, -lam2, 0, 0], [0, 12, 6*l, 0, -12, 6*l], [0, 6*l, 4*l**2, 0, -6*l, 2*l**2], [-lam2, 0, 0, lam2, 0, 0], [0, -12, -6*l, 0, 12, -6*l], [0, 6*l, 2*l**2, 0, -6*l, 4*l**2]]) * E*I/l**3 <NEW_LINE> if ...
appr. Trennung, statischer Teil, eingesp Stab
625941efcc40096d61595ec1
def prog1(): <NEW_LINE> <INDENT> for o in output_list: <NEW_LINE> <INDENT> time.sleep(DELAY) <NEW_LINE> GPIO.output(o, not GPIO.input(o))
Blinking LED one by one
625941ef4527f215b584c9c5
def fix(op, api_inst, pargs, accept, backup_be, backup_be_name, be_activate, be_name, new_be, noexecute, omit_headers, parsable_version, quiet, show_licenses, verbose, unpackaged): <NEW_LINE> <INDENT> out_json = client_api._fix(op, api_inst, pargs, accept, backup_be, backup_be_name, be_activate, be_name, new_be, noexec...
Fix packaging errors found in the image.
625941ef8c0ade5d55d3ef33
def sanitize_mapping_file(data, headers): <NEW_LINE> <INDENT> all_lines = [headers] + data <NEW_LINE> out_lines = [] <NEW_LINE> for line in all_lines: <NEW_LINE> <INDENT> out_lines.append([element.replace("'", "").replace('"', '') for element in line]) <NEW_LINE> <DEDENT> return out_lines[1::], out_lines[0]
Clean the strings in the mapping file for use with javascript This function will remove all the ocurrences of characters like ' or ". Parameters ---------- data : list of lists of str the mapping file data headers : list of str the mapping file headers Returns ------- s_data : list of lists of str saniti...
625941ef3539df3088e2e8bf
def connect_preferences(self, preferences): <NEW_LINE> <INDENT> self.digital_clock.connect_preferences(preferences) <NEW_LINE> self.field_table_view.connect_preferences(preferences) <NEW_LINE> self.racer_table_view.connect_preferences(preferences) <NEW_LINE> self.result_table_view.connect_preferences(preferences) <NEW_...
Connect preferences signals to the various slots that care.
625941efd53ae8145f87a7d8
def get_dad_joke(): <NEW_LINE> <INDENT> if not settings.DAD_JOKE: <NEW_LINE> <INDENT> print("Dad jokes are disabled") <NEW_LINE> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> return requests.get("https://icanhazdadjoke.com/", headers={"Accept": "application/json"}).json()["joke"] <NEW_LINE> <DEDENT> except E...
Returns a dad joke.
625941efb57a9660fec33e00
def initialize(self): <NEW_LINE> <INDENT> self.pq = []
initialize the stack
625941ef236d856c2ad44d56
def test_registration_singleton() -> None: <NEW_LINE> <INDENT> registration = Registration( implementation=Greeting, is_singleton=True, ) <NEW_LINE> assert registration.is_singleton
Ensure a singleton registration.
625941ef91af0d3eaac9bf91
def package(pkg_name, url=None, pip_cmd='pip', python_cmd='python', allow_external=False, allow_unverified=False, **kwargs): <NEW_LINE> <INDENT> pip(MIN_PIP_VERSION, python_cmd=python_cmd) <NEW_LINE> if not is_installed(pkg_name, python_cmd=python_cmd, pip_cmd=pip_cmd): <NEW_LINE> <INDENT> install(url or pkg_name, pyth...
Require a Python package. If the package is not installed, it will be installed using the `pip installer`_. Package names are case insensitive. Starting with version 1.5, pip no longer scrapes insecure external urls by default and no longer installs externally hosted files by default. Use ``allow_external=True`` or ...
625941ef10dbd63aa1bd3116
def pop(self): <NEW_LINE> <INDENT> temp = self.stack.pop() <NEW_LINE> if self.min_stack[-1] == temp: <NEW_LINE> <INDENT> self.min_stack.pop()
:rtype: nothing
625941ef5fcc89381b1e1c37
def request_unmute(self, user): <NEW_LINE> <INDENT> self.__controller.unmute(user)
Unmute some user
625941ef85dfad0860c3b3d0
def remove_catch_all(self, email="", mail_virtual=None): <NEW_LINE> <INDENT> if not mail_virtual: <NEW_LINE> <INDENT> mail_virtual = self.get_mail_virtual(email) <NEW_LINE> <DEDENT> if mail_virtual and mail_virtual.iscatchall: <NEW_LINE> <INDENT> mail_virtual.email = email <NEW_LINE> mail_virtual.iscatchall = 0 <NEW_LI...
Remove the catch all setting from an email account @email: the email from which to remove the catch all setting
625941efdc8b845886cb5aab
def get_gpg_version(self): <NEW_LINE> <INDENT> import subprocess <NEW_LINE> try: <NEW_LINE> <INDENT> return subprocess.check_output((self.gpg_bin, "--version")).split()[2] <NEW_LINE> <DEDENT> except subprocess.CalledProcessError as e: <NEW_LINE> <INDENT> raise bb.build.FuncFailed("Could not get gpg version: %s" % e)
Return the gpg version
625941ef60cbc95b062c6ab7
def ForceSymmetry(self, structure): <NEW_LINE> <INDENT> if self.QE_nsymq == 0: <NEW_LINE> <INDENT> raise ValueError("Error, initialize the symmetries with SetupQPoint.") <NEW_LINE> <DEDENT> coords = np.zeros( (3, structure.N_atoms), order = "F", dtype = np.float64) <NEW_LINE> coords[:,:] = structure.coords.transpose() ...
FORCE SYMMETRY ============== Force the symmetries found at a given threshold to be satisfied also in a lower threshold. This use the irt trick
625941ef6e29344779a62b85
def order_win_accept(self): <NEW_LINE> <INDENT> if not len(self.drinks_waiting): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self.order_accepted = True <NEW_LINE> self.display_order() <NEW_LINE> order = self.drinks_waiting[0] <NEW_LINE> notif = {'id': order['id'], 'status': 'accepted'} <NEW_LINE> self.send_notif(ord...
Approve the current drink in the order queue
625941ef379a373c97cfb0bb
def elementlist(req, ln=CFG_SITE_LANG): <NEW_LINE> <INDENT> ln = wash_language(ln) <NEW_LINE> _ = gettext_set_language(ln) <NEW_LINE> uid = getUid(req) <NEW_LINE> (auth_code, auth_msg) = check_user(req, 'cfgwebsubmit') <NEW_LINE> if not auth_code: <NEW_LINE> <INDENT> body = perform_request_list_elements() <NEW_LINE> re...
List all WebSubmit form ELEMENTS (elements are input fields on a WebSubmit form)
625941ef91f36d47f21aca6d
def __getattr__(self, attr): <NEW_LINE> <INDENT> if attr != '__setstate__' and not self._has_fetched: <NEW_LINE> <INDENT> self._has_fetched = self._populate(None, True) <NEW_LINE> return getattr(self, attr) <NEW_LINE> <DEDENT> raise AttributeError('\'%s\' has no attribute \'%s\'' % (type(self), attr))
Return the value of the `attr` attribute.
625941efcc0a2c11143dd405
def location_sharing_owner_ids(self): <NEW_LINE> <INDENT> return EMWF.selected_location_sharing_group_ids(self.request)
For now (and hopefully for always) the only owner id that is important for case sharing group selection is that actual group id.
625941efb830903b967e9e79
@pytest.yield_fixture(scope="class") <NEW_LINE> def appliance_browser(get_appliance, provider, vm_template_name, os, fs_type): <NEW_LINE> <INDENT> logger.info("Starting appliance browser fixture") <NEW_LINE> global test_list <NEW_LINE> test_list.remove([provider.key, vm_template_name, os, fs_type]) <NEW_LINE> with get_...
Overrides env.conf and points a browser to the appliance IP passed to it. Once finished with the test, it checks if any tests need the appliance and delete it if not the appliance specified in conf/env.yaml.
625941ef85dfad0860c3b3d1
def setResource(self, resource): <NEW_LINE> <INDENT> pass
void Nepomuk.Query.ResourceTerm.setResource(Nepomuk.Resource resource)
625941ef283ffb24f3c55e6f
def create(self, session, prepend_key=True): <NEW_LINE> <INDENT> if not self.allow_create: <NEW_LINE> <INDENT> raise exceptions.MethodNotSupported(self, "create") <NEW_LINE> <DEDENT> session = self._get_session(session) <NEW_LINE> microversion = self._get_microversion_for(session, 'create') <NEW_LINE> if self.create_me...
Create a remote resource based on this instance. :param session: The session to use for making this request. :type session: :class:`~keystoneauth1.adapter.Adapter` :param prepend_key: A boolean indicating whether the resource_key should be prepended in a resource creation reques...
625941ef67a9b606de4a842a
def __init__(self): <NEW_LINE> <INDENT> self.Offline = None <NEW_LINE> self.Malware = None <NEW_LINE> self.NonlocalLogin = None <NEW_LINE> self.CrackSuccess = None <NEW_LINE> self.RequestId = None
:param Offline: CWP deactivation alarm status: <li>OPEN: alarm enabled</li> <li>CLOSE: alarm disabled</li> :type Offline: str :param Malware: Trojan discovery alarm status: <li>OPEN: alarm enabled</li> <li>CLOSE: alarm disabled</li> :type Malware: str :param NonlocalLogin: Unusua...
625941ef3c8af77a43ae3d1b
def mask(self): <NEW_LINE> <INDENT> return self.__flags_swap_mask
Will return the current swap mask :return: :rtype:
625941ef26068e7796caf25b
def __init__(self, temboo_session): <NEW_LINE> <INDENT> super(DeleteRolePolicy, self).__init__(temboo_session, '/Library/Amazon/IAM/DeleteRolePolicy')
Create a new instance of the DeleteRolePolicy Choreo. A TembooSession object, containing a valid set of Temboo credentials, must be supplied.
625941ef462c4b4f79d1dc43
def create_organization_repository(self, organization, name, description="", homepage="", private=False, has_issues = True, has_projects = True, has_wiki = True, **kw ): <NEW_LINE> <INDENT> all_args = locals() <NEW_LINE> url = '/orgs/{}/repos'.format(organization) <NEW_LINE> all_args.pop('self') <NEW_LINE> self._reques...
创建组织仓库 https://developer.github.com/v3/repos/#create
625941efcc0a2c11143dd406
def close(self): <NEW_LINE> <INDENT> with self.__lock: <NEW_LINE> <INDENT> if self.__running: <NEW_LINE> <INDENT> self.__running = False <NEW_LINE> self.__closeSocket() <NEW_LINE> self.__listener_thread.join()
Close the server-side socket connection handler. This method blocks until cleanup completed.
625941efbde94217f3683360
def getVoltage(self): <NEW_LINE> <INDENT> return float(self.instr.query("VOLT?"))
Get the output voltage level :returns: float
625941ef5fcc89381b1e1c38
def find_shortest_route(self): <NEW_LINE> <INDENT> routes = [self.initial] <NEW_LINE> shortest = None <NEW_LINE> while routes: <NEW_LINE> <INDENT> route = routes.pop() <NEW_LINE> if shortest and len(route) >= len(shortest): <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if self.is_vault(route): <NEW_LINE> <INDENT> sh...
>>> Rooms('ihgpwlah').find_shortest_route() 'DDRRRD' >>> Rooms('kglvqrro').find_shortest_route() 'DDUDRLRRUDRD' >>> Rooms('ulqzkmiv').find_shortest_route() 'DRURDRUDDLLDLUURRDULRLDUUDDDRR'
625941ef377c676e9127271b
def load(self, QIODevice, QWidget_parent=None): <NEW_LINE> <INDENT> pass
QAbstractFormBuilder.load(QIODevice, QWidget parent=None) -> QWidget
625941eff548e778e58cdaf4
def default(self, index=None): <NEW_LINE> <INDENT> return None
Default values of string attributes are not stored correctly. The default value will be ignored and set once the attribute is added to the instance.
625941ef5166f23b2e1a56cd
@cli.command() <NEW_LINE> @argument('command') <NEW_LINE> @pass_context <NEW_LINE> def time(ctx: Context, command: str) -> None: <NEW_LINE> <INDENT> with timer.Timing(verbose=True): <NEW_LINE> <INDENT> proc = run(command, shell=True) <NEW_LINE> <DEDENT> ctx.exit(proc.returncode)
Time the output of a command.
625941efa8ecb033257d363f
def reverseWords(self, s): <NEW_LINE> <INDENT> slist = s.split(" ") <NEW_LINE> res = "" <NEW_LINE> for i in xrange(len(slist)): <NEW_LINE> <INDENT> temp = list(slist[i]) <NEW_LINE> temp.reverse() <NEW_LINE> stemp = "" <NEW_LINE> for t in temp: <NEW_LINE> <INDENT> stemp += t <NEW_LINE> <DEDENT> res+=stemp <NEW_LINE> if ...
:type s: str :rtype: str
625941ef73bcbd0ca4b2c5ea
def main(): <NEW_LINE> <INDENT> get_http_resource('http://msoe.us/taylor/images/taylor.jpg','taylor.jpg') <NEW_LINE> get_http_resource('http://msoe.us/taylor/','index.html')
Tests the client on a variety of resources
625941ef7b180e01f3dc4d65
def set_plane_gear_box(self, state): <NEW_LINE> <INDENT> if (state not in ('gear_1', 'gear_2', 'gear_3')): <NEW_LINE> <INDENT> print("Error: %s is not a valid value. The value must be: gear_1, gear_2, gear_3" % state) <NEW_LINE> print("Ignoring command and returning") <NEW_LINE> return <NEW_LINE> <DEDENT> (command_tupl...
Set plane gear box :param state: :return:
625941efe5267d203edce20a
def get_attack_goodness(self, loc, game): <NEW_LINE> <INDENT> enemies_next_to_loc = self.get_enemy_bots_next_to(loc, game) <NEW_LINE> friendlies_next_to_loc = self.get_friendlies_next_to(loc, game) <NEW_LINE> nearby_friendlies_in_trouble = [] <NEW_LINE> for friendly in friendlies_next_to_loc: <NEW_LINE> <INDENT> if bot...
Returns how 'good' attacking a certain location is. Based upon the number of friendlies and enemies next to the location, any bot that is in the location, etc.
625941ef44b2445a33932606
def retrieve_ticket_status(status_url): <NEW_LINE> <INDENT> tracking_response = requests.get(status_url) <NEW_LINE> tracking_response_parsed = tracking_response.json() <NEW_LINE> job_status = tracking_response_parsed['job-status'] <NEW_LINE> return job_status
Extract the current status at the tracking/status url Parameters ---------- status_url : str Tracking URL for a submitted data request Returns ------- job_status : str Current status {'OK', 'Accepted', ...}
625941ef0383005118ecfb55
def get_changeset_nodes_since_date(self, startdate, enddate, branch_names): <NEW_LINE> <INDENT> proc = 'hgmozilla.selects.get_changeset_nodes_since_date' <NEW_LINE> data_set = self.hg_ds.dhub.execute( proc=proc, debug_show=self.DEBUG, replace_quote=[branch_names], placeholders=[startdate, enddate], return_type='iter', ...
Return a set of changeset nodes in a date range.
625941efadb09d7d5db6cd00
def pre_process_cn(courses, low_freq_filter=True): <NEW_LINE> <INDENT> texts_tokenized = [] <NEW_LINE> for document in courses: <NEW_LINE> <INDENT> texts_tokenized_tmp = [] <NEW_LINE> for word in word_tokenize(document): <NEW_LINE> <INDENT> texts_tokenized_tmp += jieba.analyse.extract_tags(word, 10) <NEW_LINE> <DEDENT>...
简化的 中文+英文 预处理 1.去掉停用词 2.去掉标点符号 3.处理为词干 4.去掉低频词
625941ef4d74a7450ccd473a
def test_put_wrong_user(self): <NEW_LINE> <INDENT> body = { 'message': 'Update', 'document': { 'document_id': self.profile1.document_id, 'version': self.profile1.version, 'categories': ['mountain_guide'], 'locales': [ {'lang': 'en', 'description': 'Me!', 'version': self.locale_en.version} ], 'geometry': { 'version': se...
Test that a normal user can only edit its own profile.
625941ef71ff763f4b549c0a
def _sendNMJ(self, host, database, mount=None): <NEW_LINE> <INDENT> if mount: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> req = urllib2.Request(mount) <NEW_LINE> logger.log(u"Try to mount network drive via url: %s" % (mount), logger.DEBUG) <NEW_LINE> handle = urllib2.urlopen(req) <NEW_LINE> <DEDENT> except IOError as ...
Sends a NMJ update command to the specified machine host: The hostname/IP to send the request to (no port) database: The database to send the requst to mount: The mount URL to use (optional) Returns: True if the request succeeded, False otherwise
625941ef460517430c3946ea
def limit_check(self): <NEW_LINE> <INDENT> if self.time_check() or self.data_check(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False
:return: True if within 5% of time/data limit; False if outside 5% of time/data limit
625941efac7a0e7691ed4636
def _calculate_initial_value(self): <NEW_LINE> <INDENT> if self.action == "BOT": <NEW_LINE> <INDENT> self.buys = self.quantity <NEW_LINE> self.avg_bot = self.init_price <NEW_LINE> self.total_bot = self.buys * self.avg_bot <NEW_LINE> self.avg_price = (self.init_price * self.quantity + self.init_commission) // self.quant...
Depending upon whether the action was a buy or sell ("BOT" or "SLD") calculate the average bought cost, the total bought cost, the average price and the cost basis. Finally, calculate the net total with and without commission.
625941efcb5e8a47e48b8015
def instrument(): <NEW_LINE> <INDENT> config = get_config() <NEW_LINE> modules = config['spec']['instrumentation']['modules'] <NEW_LINE> if config['debug']: <NEW_LINE> <INDENT> print("Instrumenting", modules) <NEW_LINE> <DEDENT> for m in modules: <NEW_LINE> <INDENT> mod = importlib.import_module(m) <NEW_LINE> for k,v i...
Instrument each of the modules specified in the config['spec']['instrumentation']['modules']
625941effb3f5b602dac3c0e
def open_file(self, filename, *args, **kwargs): <NEW_LINE> <INDENT> if self.has_file(filename): <NEW_LINE> <INDENT> raise DatabaseError('Cannot open file: %s, file already open!' % filename) <NEW_LINE> <DEDENT> file_object = self._file_object_handler(self) <NEW_LINE> file_object.filename = filename <NEW_LINE> self._fil...
Creates a new file instance in memory and loads the corresponding file object from disk, placing the data in memory
625941efe8904600ed9f24ab
def _get_hw_partition_schema(self): <NEW_LINE> <INDENT> LOG.debug('--- Reading HW partition scheme from the node ---') <NEW_LINE> partition_schema = objects.PartitionScheme() <NEW_LINE> disk_infos = [pu.info(disk['name']) for disk in self.hu_disks] <NEW_LINE> fstab = self._find_hw_fstab() <NEW_LINE> LOG.debug('Scanning...
Reads disks/partitions from underlying hardware. Does not rely on deploy_config
625941ef851cf427c661aa7e
def terminate(self): <NEW_LINE> <INDENT> if self.attachment == self.monitor.this_attachment: <NEW_LINE> <INDENT> raise fdb.ProgrammingError("Can't terminate statement from current session.") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.monitor._ic.execute('delete from mon$statements where mon$statement_id = ?', (...
Terminates execution of statement. Raises: fdb.ProgrammingError: If this attachement is current session.
625941efd10714528d60025e
def atualizar_pedidos(sender, instance, **kwargs): <NEW_LINE> <INDENT> action = kwargs.get('action') <NEW_LINE> if action == 'post_add': <NEW_LINE> <INDENT> trello = TrelloExternalApi() <NEW_LINE> board = trello.get_default_board() <NEW_LINE> name = "{0} {1}".format("Pedido", instance.id) <NEW_LINE> card = trello.add_c...
Faz a adição de card no trello apos a adição.
625941efcdde0d52a9e535ac
def save_document(self, doc, curr_node=None): <NEW_LINE> <INDENT> fmt = doc.format() <NEW_LINE> if not curr_node: <NEW_LINE> <INDENT> curr_node = URIRef(ODML_NS + str(doc.id)) <NEW_LINE> <DEDENT> self.graph.add((curr_node, RDF.type, URIRef(fmt.rdf_type))) <NEW_LINE> self.graph.add((self.hub_root, ODML_NS.hasDocument, c...
Add the current odML Document to the RDF graph and handle all child elements recursively. :param doc: An odml Document that should be added to the RDF graph. :param curr_node: An RDF node that is used to append the current odml element to the Hub node of the current RDF graph.
625941efd6c5a102081445c4
def v2_runner_on_failed(self, result, **kwargs): <NEW_LINE> <INDENT> ignore_errors = kwargs.get('ignore_errors') <NEW_LINE> if not ignore_errors: <NEW_LINE> <INDENT> self.results['failed'].append(result)
Save failed result
625941eff7d966606f6aa57f
def _sk_get_filesize(self): <NEW_LINE> <INDENT> return self._sk_property("ZGY]\006", 89, True)
The size of the file being transferred in bytes. Depending on the magnitude of this value, your UI might want to display the size in terms of kilobytes or even megabytes.
625941ef5f7d997b87175011
def token_decryption(token): <NEW_LINE> <INDENT> encoded = token.encode() <NEW_LINE> decrypted = jwt.decode(encoded, SECRET, algorithms=['HS256']) <NEW_LINE> return decrypted['email']
Decrypts user's token back to the email of the user using the jwt method with token and SECRET. Assumption is made that if the token is an empty string, then it is an invalid token Parameter: token: the token of the user Return: the email of the user
625941ef3617ad0b5ed6846b
def _pre_disconnect(self): <NEW_LINE> <INDENT> self._aborted.set() <NEW_LINE> self.was_successful = self.connected.is_set() <NEW_LINE> log.debug('(%s) _pre_disconnect: got %s for was_successful state', self.name, self.was_successful) <NEW_LINE> log.debug('(%s) _pre_disconnect: Clearing self.connected state.', self.name...
Implements triggers called before a network disconnects.
625941ef287bf620b61d3fd5
def format(self, polynom, **kwds): <NEW_LINE> <INDENT> raise NotImplementedError(_INTERFACE_MSG % self.__class__.__name__)
Return the formatted string of the polynomial.
625941ef3c8af77a43ae3d1c
def _generate_userdata(self, role, kms_key_arn, count, load_balancers, cluster_ca, cluster_ca_key): <NEW_LINE> <INDENT> assert role in ('worker', 'controller', 'etcd') <NEW_LINE> template_vars = { 'count': str(count), 'region': self.region } <NEW_LINE> template_vars['controller_elb_dns'] = load_balancers['controller'] ...
Generate userdata file from template and save to S3 bucket.
625941efa05bb46b383ecd91
def delete_associated_publics(private_id, callback): <NEW_LINE> <INDENT> url = associated_public_url(private_id) <NEW_LINE> fetch(url, callback, method='DELETE')
Deletes all associations between public and private identities for the given private identity in Homestead callback receives the HTTPResponse object.
625941ef21a7993f00bc826f
def subscription(self, data): <NEW_LINE> <INDENT> if self.api.api_protocol != '2.0': <NEW_LINE> <INDENT> raise Exception('This method allowed only for v2.0') <NEW_LINE> <DEDENT> path = '/checkout/url/' <NEW_LINE> recurring_data = data.get('recurring_data', '') <NEW_LINE> subscription_data = { 'subscription': 'Y', 'recu...
Method to generate checkout url with calendar :param data: order data data = { "currency": "UAH", -> currency ('UAH', 'RUB', 'USD') "amount": 10000, -> amount of the order (int) "recurring_data": { "every": 1, -> frequency of the recurring order (int) "amount": 10000, -> amount of the recurr...
625941ef5e10d32532c5f49a
@register.simple_tag <NEW_LINE> def get_continue_on_fail_value(bridge): <NEW_LINE> <INDENT> if bridge.vm_box: <NEW_LINE> <INDENT> return 'true' <NEW_LINE> <DEDENT> return 'false'
Return 'true' or 'false' based on Bridge voicemail config.
625941ef50812a4eaa59c890
def bootstrap(self): <NEW_LINE> <INDENT> import astroid.raw_building <NEW_LINE> astroid.raw_building._astroid_bootstrapping()
Bootstrap the required AST modules needed for the manager to work The bootstrap usually involves building the AST for the builtins module, which is required by the rest of astroid to work correctly.
625941efb5575c28eb68e57a
def __init__(self, ebox_data, sensor_type, name): <NEW_LINE> <INDENT> self.client_name = name <NEW_LINE> self.type = sensor_type <NEW_LINE> self._name = SENSOR_TYPES[sensor_type][0] <NEW_LINE> self._unit_of_measurement = SENSOR_TYPES[sensor_type][1] <NEW_LINE> self._icon = SENSOR_TYPES[sensor_type][2] <NEW_LINE> self.e...
Initialize the sensor.
625941ef3346ee7daa2b32e6
def main(*args): <NEW_LINE> <INDENT> index = None <NEW_LINE> pages = '1-' <NEW_LINE> options = {} <NEW_LINE> local_args = pywikibot.handle_args(args) <NEW_LINE> for arg in local_args: <NEW_LINE> <INDENT> arg, sep, value = arg.partition(':') <NEW_LINE> if arg == '-index': <NEW_LINE> <INDENT> index = value <NEW_LINE> <DE...
Process command line arguments and invoke bot. If args is an empty list, sys.argv is used. :param args: command line arguments :type args: str
625941ef4a966d76dd55158a
def __init__(self, data): <NEW_LINE> <INDENT> super(HouseholdConfig, self).__init__() <NEW_LINE> self.household_id = data.pop('household_id') <NEW_LINE> member_data = {} <NEW_LINE> members = data.pop("members", None) <NEW_LINE> for member in members: <NEW_LINE> <INDENT> agent_id = member["agent_id"] <NEW_LINE> member_d...
Household configuration parameters. Contains one `HouseholdModel` with `PersonModels` for each `ExpertPersona`. Args: data (dict[str,obj]): Parsed household member data.
625941ef0a366e3fb873ed94
def post(resource, data='', results_only=True): <NEW_LINE> <INDENT> return _meta_request(resource, 'post', data=data, results_only=results_only)
Makes an HTTP POST request to the API :param resource: API resource (e.g. user) :type resource: str :param data: Data payload for request :type data: dict :param results_only: Whether or not to return metadata along with results :type results_only: bool :return: Any data returned by API call
625941ef851cf427c661aa7f
def is_readable_dir(path: str) -> Dict[str, Union[str, bool]]: <NEW_LINE> <INDENT> if not os.path.exists(path): <NEW_LINE> <INDENT> return {"result": False, "message": "Path does not exist", "path": path} <NEW_LINE> <DEDENT> if not os.path.isdir(path): <NEW_LINE> <INDENT> return {"result": False, "message": "Path is no...
Check whether a path references a readable directory.
625941ef15fb5d323cde108d
def get_block_storage_id(self, vault_id, block_id): <NEW_LINE> <INDENT> args = dict( projectid=deuce.context.project_id, vaultid=vault_id, blockid=block_id ) <NEW_LINE> res = self._session.execute(CQL_GET_STORAGE_ID, args) <NEW_LINE> try: <NEW_LINE> <INDENT> return str(res[0][0]) <NEW_LINE> <DEDENT> except IndexError: ...
Retrieve storage id for a given block id
625941efb545ff76a891438b
def output_connection_created(self, connection): <NEW_LINE> <INDENT> ...
Output connection created Parameters ---------- connection : Connection
625941ef0a366e3fb873ed95
def _add_input_to_signature_def(tensor_name, map_key, signature_def): <NEW_LINE> <INDENT> tensor_info = meta_graph_pb2.TensorInfo(name=tensor_name) <NEW_LINE> signature_def.inputs[map_key].CopyFrom(tensor_info)
Add input tensor to signature_def. Args: tensor_name: string name of tensor to add to signature_def inputs map_key: string key to key into signature_def inputs map signature_def: object of type meta_graph_pb2.SignatureDef() Sideffect: adds a TensorInfo with tensor_name to signature_def inputs map keyed with ma...
625941efad47b63b2c50a4f5
def tensor_array_v2(size, dtype, element_shape=None, dynamic_size=False, clear_after_read=True, tensor_array_name="", name=None): <NEW_LINE> <INDENT> _ctx = _context.context() <NEW_LINE> if not _ctx.executing_eagerly(): <NEW_LINE> <INDENT> dtype = _execute.make_type(dtype, "dtype") <NEW_LINE> if element_shape is None: ...
Deprecated. Use TensorArrayV3 Args: size: A `Tensor` of type `int32`. dtype: A `tf.DType`. element_shape: An optional `tf.TensorShape` or list of `ints`. Defaults to `None`. dynamic_size: An optional `bool`. Defaults to `False`. clear_after_read: An optional `bool`. Defaults to `True`. tensor_array_name: A...
625941ef009cb60464c63922