code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
def Kgrad_param(self, *args): <NEW_LINE> <INDENT> return _core.CFreeFormCF_Kgrad_param(self, *args) | Kgrad_param(CFreeFormCF self, limix::muint_t const i)
Parameters:
i: limix::muint_t const | 625941d03317a56b86939dd0 |
def has_auth_params(self, scheme): <NEW_LINE> <INDENT> for k, v in iteritems(self.schemes[scheme][u'params']): <NEW_LINE> <INDENT> if not v: return False <NEW_LINE> <DEDENT> return True | Check whether all information required for a given auth scheme have
been supplied.
Args:
scheme (str): Name of the authentication scheme to check. One of
Gem-Identify, Gem-Device, Gem-Application
Returns:
True if all required parameters for the specified scheme are present
or False otherwise. | 625941d00a50d4780f66700b |
def __init__(self, text, highlight=True, enumerated=True): <NEW_LINE> <INDENT> super().__init__(text, None, highlight, False) <NEW_LINE> self.enumerated = enumerated | Initialize the option.
:param str text: See :meth:`menus.base._BaseOption.__init__`.
:param bool hightlight: If True the text will be highlighted.
:param bool enumerated: If True the number of the option will be added
in front of the text.
.. note:: ``highlight`` only works if ``enumerated`` is set to True. | 625941d0f9cc0f698b140774 |
def name_get(self, cr, uid, ids, context = None): <NEW_LINE> <INDENT> res = [] <NEW_LINE> for item in self.browse(cr, uid, ids, context = context): <NEW_LINE> <INDENT> res.append((item.id, "%s [%s]" % (item.name, item.symbol))) <NEW_LINE> <DEDENT> return res | Force name of object with symbol
| 625941d03c8af77a43ae3919 |
def step_copy_data_between_s3_and_hdfs(self, c, src, dest): <NEW_LINE> <INDENT> response = c.add_job_flow_steps( JobFlowId=self.job_flow_id, Steps=[{ 'Name': 'Copy data from S3 to HDFS', 'ActionOnFailure': 'CANCEL_AND_WAIT', 'HadoopJarStep': { 'Jar': 'command-runner.jar', 'Args': [ "s3-dist-cp", "--s3Endpoint=s3-eu-wes... | Copy data between S3 and HDFS (not used for now)
:param c: the boto_client
:param src: source location of files
:param dest: the destination on hdfs
:return: | 625941d04f6381625f114bb3 |
def setLightState(self, new_state): <NEW_LINE> <INDENT> cur_state = self.light() <NEW_LINE> self.invert_light = cur_state != new_state | Sets the current state of the light (on or off).
Typically to sync with the light state of another TapBeat | 625941d023e79379d52ee6dc |
def parse_items(self, list_, **kargs): <NEW_LINE> <INDENT> return self.get_parse_items()(list_, **kargs) | Parse the contents of a sequence of items (an item is something
that would be matched by `Any`), returning a single match and using a
stream internally. | 625941d0956e5f7376d70fe6 |
def merge_two_sorted_lists(self, l1, l2): <NEW_LINE> <INDENT> if l1 is None or l2 is None: <NEW_LINE> <INDENT> return l1 if l1 is not None else l2 <NEW_LINE> <DEDENT> h = None <NEW_LINE> curr = None <NEW_LINE> while l1 and l2: <NEW_LINE> <INDENT> if l1.val < l2.val: <NEW_LINE> <INDENT> if h is None: <NEW_LINE> <INDENT>... | :type l1: ListNode
:type l2: ListNode
:rtype: ListNode | 625941d0cad5886f8bd27152 |
def _get_tm_year(self, year, gq): <NEW_LINE> <INDENT> years = gq['year'] <NEW_LINE> dif = abs(years - year) <NEW_LINE> return years[where(dif == dif.min())[0]][0] | Get the closest year to the current year in the group_quarters table. | 625941d0283ffb24f3c55a79 |
def _setPermanentCustomPanels(self, permCustomPanels): <NEW_LINE> <INDENT> for name in permCustomPanels: <NEW_LINE> <INDENT> if name not in self.__panels: <NEW_LINE> <INDENT> self.createPanel(None, name, custom=True, permanent=True) | creates empty panels for restoring custom panels.
:param permCustomPanels: (list<str>) list of names of custom panels | 625941d0ad47b63b2c50a0f8 |
def _store_data(self, appstruct): <NEW_LINE> <INDENT> raise NotImplementedError | Store data appstruct. | 625941d099cbb53fe6792d5f |
def trade_update_position(current_position, symbol, trade): <NEW_LINE> <INDENT> base_currency = symbol.split('/')[0].lower() <NEW_LINE> quote_currency = symbol.split('/')[1].lower() <NEW_LINE> current_position[base_currency].trade_update('base', trade) <NEW_LINE> current_position[quote_currency].trade_update('quote', t... | 产生Trade更新对应Postion | 625941d03c8af77a43ae391a |
def coarsen(reduction, x, axes): <NEW_LINE> <INDENT> for i in range(x.ndim): <NEW_LINE> <INDENT> if i not in axes: <NEW_LINE> <INDENT> axes[i] = 1 <NEW_LINE> <DEDENT> <DEDENT> newshape = tuple(concat([(x.shape[i] / axes[i], axes[i]) for i in range(x.ndim)])) <NEW_LINE> return reduction(x.reshape(newshape), axis=tuple(r... | Coarsen array by applying reduction to fixed size neighborhoods
Parameters
----------
reduction: function
Function like np.sum, np.mean, etc...
x: np.ndarray
Array to be coarsened
axes: dict
Mapping of axis to coarsening factor
Example
-------
>>> x = np.array([1, 2, 3, 4, 5, 6])
>>> coarsen(np.sum, x, ... | 625941d09b70327d1c4e0f4e |
def get_keyword(file): <NEW_LINE> <INDENT> path = dirname(realpath(__file__)) + '\\files\\' + file <NEW_LINE> with open(path,'r',encoding='gbk') as f: <NEW_LINE> <INDENT> csv_reader = reader(f) <NEW_LINE> target_name = defaultdict(list) <NEW_LINE> keywordlist = [] <NEW_LINE> line_num = 1 <NEW_LINE> for line in csv_read... | read file as keywords
may use some search engine to search for data | 625941d0b545ff76a8913f8e |
def expand_word_event(self, event): <NEW_LINE> <INDENT> curinsert = self.text.index("insert") <NEW_LINE> curline = self.text.get("insert linestart", "insert lineend") <NEW_LINE> if not self.state: <NEW_LINE> <INDENT> words = self.getwords() <NEW_LINE> index = 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> words, index... | Replace the current word with the next expansion. | 625941d0099cdd3c635f0dd4 |
def get_collected_df(): <NEW_LINE> <INDENT> collected_df = pd.DataFrame(columns=["emotion", "img_path"]) <NEW_LINE> collected_path = '../datasets/CollectedData/' <NEW_LINE> row = 0 <NEW_LINE> for folder in os.listdir(collected_path): <NEW_LINE> <INDENT> path = collected_path + str(folder) <NEW_LINE> for filename in os.... | Loads all images into a dataframe consisting of emotion label and the image path. | 625941d07b25080760e395d2 |
def list(self, server=None, name=None, status=None, changes_since=None, marker=None, limit=None, image_type=None, detail=False): <NEW_LINE> <INDENT> params = {} <NEW_LINE> if server: <NEW_LINE> <INDENT> params['server'] = server <NEW_LINE> <DEDENT> if name: <NEW_LINE> <INDENT> params['name'] = name <NEW_LINE> <DEDENT> ... | List all server images
:param server: Filters the list of images by server.
Specify the server reference by ID or by full URL
:param name: Filters the list of images by image name
:param status: Filters the list of images by status
:param changes_since: Filter images to those with change since time
:par... | 625941d0091ae356686670d6 |
def GetDurationString(duration): <NEW_LINE> <INDENT> total_days, total_hours, total_minutes = duration.days, duration.seconds // 3600, duration.seconds // 60 % 60 <NEW_LINE> if total_days >= 1: <NEW_LINE> <INDENT> return "{0:02}d {1:02}h {2:02}m".format(total_days, total_hours, total_minutes) <NEW_LINE> <DEDENT> elif t... | Convert the duration timedelta in a day:hour:min:sec string representation | 625941d0377c676e91272322 |
def largest_odd_times(L): <NEW_LINE> <INDENT> setL = set(L) <NEW_LINE> occur = 0 <NEW_LINE> res = [] <NEW_LINE> for num in setL: <NEW_LINE> <INDENT> occur = L.count(num) <NEW_LINE> if occur%2 == 0: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> res.append(num) <NEW_LINE> <DEDENT> <DEDENT> tr... | Assumes L is a non-empty list of ints
Returns the largest element of L that occurs an odd number
of times in L. If no such element exists, returns None | 625941d0167d2b6e31218d0f |
def register_user(self): <NEW_LINE> <INDENT> user_data = { 'email': self.user['email'], 'password': self.user['password'], 'location': self.user['location'], 'quip': self.user['quip'], 'photo': self.user['photo'], 'user_name': self.user['user_name'] } <NEW_LINE> return self.client().post('/auth/register', data=user_da... | Registers a test user | 625941d07d43ff24873a2e1a |
def instanciate_task(self): <NEW_LINE> <INDENT> pass | Instanciate the task self.task_obj.
This object can be a ToInstanciate instance if the task needs
to be instanciated in a separated thread or process. | 625941d0627d3e7fe0d68fc9 |
def test_delete_successfull(self): <NEW_LINE> <INDENT> customersvc.app.DATA_SERVICE.delete.return_value = self._updated_customer <NEW_LINE> with customersvc.app.FLASK_APP.app_context(): <NEW_LINE> <INDENT> client = customersvc.app.FLASK_APP.test_client() <NEW_LINE> resp = client.delete( "/customers/e6c53676-... | Test successfull customer creation | 625941d0ad47b63b2c50a0f9 |
def __init__(self, n, q, D, secret_dist='uniform', m=None): <NEW_LINE> <INDENT> self.n = ZZ(n) <NEW_LINE> self.m = m <NEW_LINE> self.__i = 0 <NEW_LINE> self.K = IntegerModRing(q) <NEW_LINE> self.FM = FreeModule(self.K, n) <NEW_LINE> self.D = D <NEW_LINE> self.secret_dist = secret_dist <NEW_LINE> if secret_dist == 'u... | Construct an LWE oracle in dimension ``n`` over a ring of order
``q`` with noise distribution ``D``.
INPUT:
- ``n`` - dimension (integer > 0)
- ``q`` - modulus typically > n (integer > 0)
- ``D`` - an error distribution such as an instance of
:class:`DiscreteGaussianDistributionIntegerSampler` or :class:`UniformSam... | 625941d0bd1bec0571d907a9 |
def do_pending(self, node): <NEW_LINE> <INDENT> if node.node_type == Node.parent: <NEW_LINE> <INDENT> self.proxy.parent() <NEW_LINE> <DEDENT> elif node.node_type == Node.getitem: <NEW_LINE> <INDENT> self.proxy.__getitem__(node.name) <NEW_LINE> <DEDENT> elif node.node_type == Node.children: <NEW_LINE> <INDENT> self.prox... | 根据node执行对应的操作
:param node:
:return: | 625941d038b623060ff0af67 |
def drawFirstLandscape(canv, doc): <NEW_LINE> <INDENT> canv.saveState() <NEW_LINE> frame, pagesize = doc.getFrame(doc.template_id) <NEW_LINE> canv.setPageSize(pagesize) <NEW_LINE> canv.setFont(base_fonts().get("normal"), doc.fontSize) <NEW_LINE> addPlugin(canv, doc, frame="First") <NEW_LINE> canv.restoreState() | This is the Template of any later drawn Landscape Oriented Page
the frame object is only used as a reference to be able to draw to the canvas
After creation a Frame is not usually manipulated directly by the
applications program -- it is used internally by the platypus modules.
Here is a diagramatic abstraction for ... | 625941d044b2445a3393220f |
def flatten(lst): <NEW_LINE> <INDENT> new_lst = [] <NEW_LINE> flatten_helper(lst, new_lst) <NEW_LINE> return new_lst | Put a nested list into a flat list | 625941d09f2886367277aa06 |
@torch.jit.unused <NEW_LINE> def _parse_fill(fill, img, min_pil_version, name="fillcolor"): <NEW_LINE> <INDENT> major_found, minor_found = (int(v) for v in PILLOW_VERSION.split('.')[:2]) <NEW_LINE> major_required, minor_required = (int(v) for v in min_pil_version.split('.')[:2]) <NEW_LINE> if major_found < major_requir... | Helper function to get the fill color for rotate, perspective transforms, and pad.
Args:
fill (n-tuple or int or float): Pixel fill value for area outside the transformed
image. If int or float, the value is used for all bands respectively.
Defaults to 0 for all bands.
img (PIL Image): Image to... | 625941d08c0ade5d55d3eb35 |
def update_editor ( self ): <NEW_LINE> <INDENT> image = self.value <NEW_LINE> if image is not self._last_image: <NEW_LINE> <INDENT> self._last_image = image <NEW_LINE> if not isinstance( image, HLSADerivedImage ): <NEW_LINE> <INDENT> image = HLSADerivedImage( base_image = image ) <NEW_LINE> <DEDENT> self.image = image ... | Updates the editor when the object facet changes externally to the
editor. | 625941d099fddb7c1c9de50a |
def wrapper(*args, **kwargs): <NEW_LINE> <INDENT> id_token = request.cookies.get("token") <NEW_LINE> rolle = request.cookies.get("rolle") <NEW_LINE> name = request.cookies.get("name") <NEW_LINE> kuerzel = request.cookies.get("kuerzel") <NEW_LINE> mat_nr = request.cookies.get("mat_nr") <NEW_LINE> error_message = None <N... | Hier werden alle in Cookies, welche in der Anmeldung vergeben werden, abgefragt | 625941d00fa83653e4657134 |
def CreateDisasterRecoverGroup(self, request): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> params = request._serialize() <NEW_LINE> body = self.call("CreateDisasterRecoverGroup", params) <NEW_LINE> response = json.loads(body) <NEW_LINE> if "Error" not in response["Response"]: <NEW_LINE> <INDENT> model = models.CreateD... | 本接口 (CreateDisasterRecoverGroup)用于创建[分散置放群组](https://cloud.tencent.com/document/product/213/15486)。创建好的置放群组,可在[创建实例](https://cloud.tencent.com/document/api/213/15730)时指定。
:param request: 调用CreateDisasterRecoverGroup所需参数的结构体。
:type request: :class:`tencentcloud.cvm.v20170312.models.CreateDisasterRecoverGroupRequest`
:r... | 625941d015baa723493c40ef |
def merge(a, b): <NEW_LINE> <INDENT> result = dict(a) <NEW_LINE> result.update(b) <NEW_LINE> return result | (dict,dict) -> dict
Combine two dictionaries without side-effects. | 625941d04e696a04525c95c5 |
def save_checkpoint(flag, net, epoch, checkpoint_interval, is_best=False): <NEW_LINE> <INDENT> directory = "runs/%s" % flag <NEW_LINE> if not os.path.exists(directory): <NEW_LINE> <INDENT> os.makedirs(directory) <NEW_LINE> <DEDENT> net.save_params(os.path.join(directory, "lastest.params")) <NEW_LINE> if (epoch + 1) % c... | Save Checkpoint | 625941d063b5f9789fde725f |
def setUp(self): <NEW_LINE> <INDENT> self.dialog = Qgis3TestDialog(None) | Runs before each test. | 625941d024f1403a92600cdf |
def toPath(self, converterPath, isFirst, isLast): <NEW_LINE> <INDENT> return None | @see: Match.toPath | 625941d08da39b475bd650ee |
def removeThe(name): <NEW_LINE> <INDENT> if name: <NEW_LINE> <INDENT> n = name.lower() <NEW_LINE> return name[4:] if n.startswith("the") else name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "" | Removes 'the' from the from the beginning of artist and title if present.
Mainly a problem with artist, to be honest.
Name is returned lower case. | 625941d0e5267d203edcde16 |
def api_staff_member_required(): <NEW_LINE> <INDENT> def _check_group(view_func): <NEW_LINE> <INDENT> @wraps(view_func) <NEW_LINE> def wrapper(request, *args, **kwargs): <NEW_LINE> <INDENT> if request.user.is_staff: <NEW_LINE> <INDENT> return view_func(request, *args, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <IND... | # Function Name: api_staff_member_required(request)
# Inputs: -
# Outputs: decorator
# Exceptions: None
# Description: Check if the user is an admin user. Used by the API
:return: | 625941d030dc7b7665901ae0 |
def shortestWordDistance(self, words, word1, word2): <NEW_LINE> <INDENT> min_dis = 27000000 <NEW_LINE> if word1 == word2: <NEW_LINE> <INDENT> idx = [i for i,word in enumerate(words) if word == word1] <NEW_LINE> min_dis = [y - x for x,y in zip(idx,idx[1:])] <NEW_LINE> return min(min_dis) <NEW_LINE> <DEDENT> idx1,idx2 = ... | :type words: List[str]
:type word1: str
:type word2: str
:rtype: int | 625941d04e4d5625662d4551 |
@reg.register_compute("conv2d") <NEW_LINE> def compute_conv2d(attrs, inputs, _): <NEW_LINE> <INDENT> padding = attrs.get_int_tuple("padding") <NEW_LINE> strides = attrs.get_int_tuple("strides") <NEW_LINE> dilation = attrs.get_int_tuple("dilation") <NEW_LINE> groups = attrs.get_int("groups") <NEW_LINE> channels = attrs.... | Compute definition of conv2d | 625941d07b180e01f3dc4976 |
def Delete(self, request, global_params=None): <NEW_LINE> <INDENT> config = self.GetMethodConfig('Delete') <NEW_LINE> return self._RunMethod( config, request, global_params=global_params) | Deletes a replica pool.
Args:
request: (ReplicapoolPoolsDeleteRequest) input message
global_params: (StandardQueryParameters, default: None) global arguments
Returns:
(ReplicapoolPoolsDeleteResponse) The response message. | 625941d057b8e32f52483615 |
def test_decode_struct(self): <NEW_LINE> <INDENT> rec = self.recoder_class("utf-8") <NEW_LINE> reg = SampleCorbaStruct( id=19, ico=b'', dic=b'', varSymb=b'', vat=False, handle=b'NEW REG', name=b'name 1', organization=b'', street1=b'chars \xc4\x8d\xc5\xa5', street2=b'', street3=b'', city=b'', stateorprovince=b'state', p... | CorbaRecoder decodes corba entity to python correctly . | 625941d0004d5f362079a4ad |
def write_msg(self, string_value): <NEW_LINE> <INDENT> if isinstance(string_value, six.string_types): <NEW_LINE> <INDENT> for char_value in string_value: <NEW_LINE> <INDENT> self._strobe(Rs | (char_value & 0xF0)) <NEW_LINE> self._strobe(Rs | ((char_value << 4) & 0xF0)) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <IND... | Send Data to LCD panel from string
:param string_value: value of string
:type string_value: String | 625941d0507cdc57c6306e56 |
def _get_hov_edges(self): <NEW_LINE> <INDENT> hov_edges = self.network_gdf[self.network_gdf['is_hov'] > 0] <NEW_LINE> shift_edges_geom = hov_edges.geometry.apply( self._shift_edges, args=(self.config['hov_shift_dist'],)) <NEW_LINE> hov_edges.update(shift_edges_geom) <NEW_LINE> hov_edges['is_managed'] = 1 <NEW_LINE> ret... | Returns a DF of shifted edges that represent
HOV/Managed lanes. | 625941d03346ee7daa2b2ee6 |
def __str__(self): <NEW_LINE> <INDENT> return self.title | String for representing the course | 625941d06e29344779a6278b |
def outputDir(self,product,platform,template): <NEW_LINE> <INDENT> outputDir = super(Platform, self).outputDir(product,platform,template) <NEW_LINE> path, template = os.path.split(outputDir) <NEW_LINE> cdatamodeldPath = os.path.join(path,os.path.basename(self.config.projectPath) + ".xcdatamodeld") <NEW_LINE> cdatamodel... | returns the final output directory | 625941d08a349b6b435e82ed |
def run(self): <NEW_LINE> <INDENT> pygame.init() <NEW_LINE> self.screen = pygame.display.set_mode(self.size) <NEW_LINE> self.game_manager.setup(self.screen) <NEW_LINE> pygame.display.set_caption(self.caption) <NEW_LINE> self.clock = pygame.time.Clock() <NEW_LINE> while not self.done: <NEW_LINE> <INDENT> for event in py... | Create the main screen surface, call the game manager's setup method,
then enter the main loop, which calls the game manager's remaining
methods.
Maintains the given frame rate using a pygame.time.Clock() instance. | 625941d0a17c0f6771cbe1ca |
def register_handler(self, function, pluggable="message", priority=50): <NEW_LINE> <INDENT> if (pluggable in ('conv_sync',) and asyncio.iscoroutinefunction(function)): <NEW_LINE> <INDENT> raise ValueError('%s does not support async functions' % pluggable) <NEW_LINE> <DEDENT> super().register_handler(function, pluggable... | register a handler for a single type
Args:
function (callable): the handling function/coroutine
pluggable (str): a pluggable of .pluggables
priority (int): ignored by the SyncHandler
Raises:
KeyError: unknown pluggable specified
ValueError: provide pluggable does not support async functions | 625941d0d18da76e23532651 |
def forward(self, obs, act): <NEW_LINE> <INDENT> l_out = self.l(torch.cat([obs, act], dim=-1)) <NEW_LINE> l_out_squared = torch.square(l_out) <NEW_LINE> l_out_summed = torch.sum(l_out_squared, dim=1) <NEW_LINE> return l_out_summed.unsqueeze(dim=1) | Perform forward pass through the network.
Args:
obs (torch.Tensor): The tensor of observations.
act (torch.Tensor): The tensor of actions.
Returns:
torch.Tensor: The tensor containing the lyapunov values of the input
observations and actions. | 625941d09f2886367277aa07 |
def setPageWidth(self, width, sameScale=True): <NEW_LINE> <INDENT> if sameScale and any(self.pages()): <NEW_LINE> <INDENT> self.setScale(self.widest().scaleForWidth(width)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> for page in self: <NEW_LINE> <INDENT> page.setWidth(width) | Sets the width of all pages.
If sameScale is True (default), the largest page will be scaled to the given
width (minus margin). All pages will then be scaled to that scale.
If sameScale is False all pages will be scaled individually to the same width. | 625941d0d6c5a102081441c6 |
def get_batch(self, ranges) -> Dict: <NEW_LINE> <INDENT> return ( self.service.spreadsheets() .values() .batchGet( spreadsheetId=self.spreadsheet_id, ranges=[str(r) for r in ranges] ) .execute() ) | Get a batch of cell values within the specified ranges.
:param ranges: The ranges to retrieve the cell values from.
:return: A list of dicts with the cell values stored in 'values'. | 625941d0cc0a2c11143dd00b |
def aumentar_felicidade(elemento): <NEW_LINE> <INDENT> Pymagochi.aumenta_felicidade(elemento, randint(1,8)) | Função para aumentar o atribudo feliciade do objeto elemento passado como
parâmetro (espera-se que esse elemento seja uma instância da classe Pymagochi). | 625941d076e4537e8c3517ed |
def load_cookies(filename): <NEW_LINE> <INDENT> with open(filename, 'rb') as f: <NEW_LINE> <INDENT> requests_cookiejar = pickle.load(f) <NEW_LINE> <DEDENT> return requests_cookiejar | Loads and returns a RequestsCookieJar from the pickle file. | 625941d06e29344779a6278c |
def mwEBVfromMaps(self): <NEW_LINE> <INDENT> if not self._hascoords: <NEW_LINE> <INDENT> raise ValueError('Cannot Calculate EBV from dust maps if ra or dec' 'is `None`') <NEW_LINE> <DEDENT> self.ebvofMW = self.lsstmwebv.calculateEbv( equatorialCoordinates=self.skycoord)[0] <NEW_LINE> return | set the attribute ebvofMW of the class from the ra and dec
of the SN. If the ra or dec attribute of the class is None,
set this attribute to None.
Parameters
----------
None
Returns
-------
None
Examples
--------
>>> t = SNObject()
>>> t.setCoords(ra=30., dec=60.)
>>> t.mwEBVfromMaps()
>>> t.ebvofMW
>>> 0.9777678251... | 625941d023849d37ff7b3209 |
def _check_reply(self, rpc_reply, format): <NEW_LINE> <INDENT> if rpc_reply is True : <NEW_LINE> <INDENT> self.logger_snap.info( colorama.Fore.BLUE + "\nOutput of requested Command/RPC is empty", extra=self.log_detail) <NEW_LINE> return "" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return etree.tostring(rpc_reply, e... | Check rpc reply for errors
:param rpc_reply: RPC reply
:param format: xml/ text
:return: return false if reply contains error ow return rpc reply | 625941d00fa83653e4657135 |
def _get_company_gestion_dropdown(request, cid): <NEW_LINE> <INDENT> gestion = DropDown(label="Gestion") <NEW_LINE> href = request.route_path("company_estimations", id=cid) <NEW_LINE> gestion.add_item("Devis", icon="fa fa-file-o", href=href) <NEW_LINE> href = request.route_path("company_invoices", id=cid) <NEW_LINE> ge... | Build and Return the 'Gestion' dropdown
:param obj request: The request object
:param int cid: The company id
:returns: A DropDown
:rtype: obj | 625941d0e64d504609d749ba |
def isPalindrome(self, x): <NEW_LINE> <INDENT> if not isinstance(x, int): <NEW_LINE> <INDENT> raise TypeError("bad input") <NEW_LINE> <DEDENT> x = str(x) <NEW_LINE> result = [x[i] == x[-(i + 1)] for i in range(len(x))] <NEW_LINE> for r in result: <NEW_LINE> <INDENT> if r == False: <NEW_LINE> <INDENT> return r <NEW_LINE... | :type x: int
:rtype: bool | 625941d03cc13d1c6d3c74f4 |
def retLM(self): <NEW_LINE> <INDENT> self.ard.writePort('L0') <NEW_LINE> self.messageLabel.setText('Linear motor retracted') | Callback function for the 'Activate linear motor' button
:return: | 625941d0b7558d58953c508d |
def _Exception_Frame__1(self): <NEW_LINE> <INDENT> self.exception_label_1.grid( row = 0, column = 0, sticky = tkinter.N + tkinter.S + tkinter.W) | A frame to raise exception whenever it has error | 625941d0be7bc26dc91cd779 |
def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self._cards = [] | Initialize the player and his name.
Args:
name: str. | 625941d07d847024c06be437 |
def test_book_delete(self): <NEW_LINE> <INDENT> self.seed_test_db() <NEW_LINE> self.login(username='admin') <NEW_LINE> response = self.client.post( '/books/1/delete', data=dict({ 'confirmation': True }), content_type='application/x-www-form-urlencoded' ) <NEW_LINE> self.assertEqual(response.status_code, 302) <NEW_LINE>... | Tests if the book delete page works correctly. | 625941d056ac1b37e6264348 |
def test_reject_request_access(self): <NEW_LINE> <INDENT> username = 'user' <NEW_LINE> user = User.query.filter_by(username=username).first() <NEW_LINE> status_code = Config.SENT_STATUS <NEW_LINE> status = Status.query.filter_by(code=status_code).first() <NEW_LINE> text = f'This is a test request' <NEW_LINE> headers = ... | Проверяет доступ к /requests/<id>/reject для различных ролей пользователей.
:return: | 625941d0fff4ab517eb2f5b7 |
@expose("validate-config") <NEW_LINE> def validate_config(*args): <NEW_LINE> <INDENT> ret = True <NEW_LINE> args = _parse_args('validate-config') <NEW_LINE> m = [ c.getName() for c in __configurers if c.getName() in args.modules and not c.validate() ] <NEW_LINE> if m: <NEW_LINE> <INDENT> sys.stdout.write( "Modules %s c... | Determine if configuration is valid | 625941d0e5267d203edcde17 |
def test_missing_prereq_one_of_two(self): <NEW_LINE> <INDENT> self.course1.taken = True <NEW_LINE> p_l = ["BBB222"] <NEW_LINE> self.assertEqual(self.course_two_prereq.missing_prereqs(), p_l) | Take only one of the prereqs in course object, check if the other
prereq (not taken) is returned when missing_prereqs() is called | 625941d0498bea3a759b9c29 |
def get_descendants(self, include_self=False): <NEW_LINE> <INDENT> if not include_self and self.is_leaf_node(): <NEW_LINE> <INDENT> return self._tree_manager.none() <NEW_LINE> <DEDENT> opts = self._meta <NEW_LINE> filters = {opts.tree_id_attr: getattr(self, opts.tree_id_attr)} <NEW_LINE> if include_self: <NEW_LINE> <IN... | Creates a ``QuerySet`` containing descendants of this model
instance, in tree order.
If ``include_self`` is ``True``, the ``QuerySet`` will also
include this model instance. | 625941d096565a6dacc8f846 |
def get_distance_color(distance): <NEW_LINE> <INDENT> if distance == 'Inf': <NEW_LINE> <INDENT> color = (0,255,0) <NEW_LINE> <DEDENT> elif distance == 'Invalid': <NEW_LINE> <INDENT> color = (0,0,255) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> color = (255,255,255) <NEW_LINE> <DEDENT> return color | get the color of the string of distance.
Args:
distance (float/str): 0-Infinite,'Inf','Invalid'
Returns:
color (set): (B,G,R) of the color. each value should be 0-255 | 625941d0379a373c97cfacc0 |
def main(stdscr): <NEW_LINE> <INDENT> WIN_H, WIN_W = stdscr.getmaxyx() <NEW_LINE> MENU_H = 0 <NEW_LINE> spct.init() <NEW_LINE> with open('color.yml', 'r') as f: <NEW_LINE> <INDENT> f_color = yaml.safe_load(f) <NEW_LINE> <DEDENT> wircolor = spct.init_colors(f_color) <NEW_LINE> titleV = MainMenuView(WIN_H-MENU_H, WIN_W) ... | Game main loop | 625941d038b623060ff0af68 |
def transliterate(string): <NEW_LINE> <INDENT> normalized = unicodedata.normalize('NFKD', string) <NEW_LINE> return normalized.encode('ascii', 'ignore').decode('ascii') | Replace non-ASCII characters with an ASCII approximation. If no
approximation exists, the non-ASCII character is ignored. The string must
be ``unicode``.
Examples::
>>> transliterate(u'älämölö')
u'alamolo'
>>> transliterate(u'Ærøskøbing')
u'rskbing' | 625941d0711fe17d825424e5 |
@responses.activate <NEW_LINE> def test_count_with_multiple_chainable_filters_startswith(service): <NEW_LINE> <INDENT> from pyodata.v2.service import FilterExpression as Q <NEW_LINE> responses.add( responses.GET, f"{service.url}/Employees/$count?$filter=%28ID%20eq%2023%20and%20startswith%28NickName%2C%20%27Ste%27%29%20... | Check getting $count with $filter calling startswith | 625941d0fb3f5b602dac380e |
def deactivate(self): <NEW_LINE> <INDENT> self.snippetMapper.mapped[str].disconnect(self.__insertSnippet) <NEW_LINE> for actionName, action in self.actions.items(): <NEW_LINE> <INDENT> action.triggered.disconnect(self.snippetMapper.map) <NEW_LINE> <DEDENT> self.cc3dmlMenu.clear() <NEW_LINE> self.__ui.menuBar().removeAc... | Public method to deactivate this plugin. | 625941d07047854f462a1584 |
def fetch_from_Yelp(): <NEW_LINE> <INDENT> elastic_rows = [] <NEW_LINE> dynamo_rows = [] <NEW_LINE> for location in locations: <NEW_LINE> <INDENT> for cuisine in cuisines: <NEW_LINE> <INDENT> for i in range(int(number_of_results_per_cuisine/search_limit)): <NEW_LINE> <INDENT> search_term = cuisine + " restaurant" <NEW_... | Fetch data from Yelp API and generate data for ES and Dynamodb
:return: data for elasticsearch and dynamodb | 625941d0596a897236089c3b |
def mean(self): <NEW_LINE> <INDENT> return _vnl_matrixPython.vnl_matrixSC_mean(self) | mean(self) -> signed char | 625941d0bde94217f3682f6b |
def to_env_file(self, env_name, path): <NEW_LINE> <INDENT> with open(path, 'w') as f: <NEW_LINE> <INDENT> d = self.to_env_dict(env_name) <NEW_LINE> add_py = True <NEW_LINE> for dep in d['dependencies']: <NEW_LINE> <INDENT> if isinstance(dep, str) and dep.startswith("python"): <NEW_LINE> <INDENT> add_py = False <NEW_LIN... | Dump the dependencies to a file
| 625941d030c21e258bdfa618 |
def make_Ba(bbdict): <NEW_LINE> <INDENT> Ba = od() <NEW_LINE> for bk in bbdict.keys(): <NEW_LINE> <INDENT> binfo = dict() <NEW_LINE> binfo['V1'] = bbdict[bk][0] <NEW_LINE> binfo['V2'] = bbdict[bk][1] <NEW_LINE> binfo['Qr'] = 500 <NEW_LINE> Ba[bk] = binfo <NEW_LINE> <DEDENT> return Ba | This is where we create the dict-of-dicts that the code uses,
for the basins. We also add some other state variables with
default initial values. | 625941d0ab23a570cc2502fd |
@lexer(None) <NEW_LINE> def command_info_locals(args): <NEW_LINE> <INDENT> frame = debugger.get_current_frame() <NEW_LINE> args = debugger.get_frame_locals(frame) <NEW_LINE> if args == None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> return '\n'.join('{arg.name} = {arg.value}'.format(arg=a) for a in args) | Returns information about local variable
| 625941d04e696a04525c95c6 |
def linkClickEvent(self, ev, page, link): <NEW_LINE> <INDENT> self.linkClicked.emit(ev, page, link) | Called when a link is clicked.
The default implementation emits the linkClicked(event, page, link) signal. | 625941d04428ac0f6e5ba96d |
def create_data_api_table( db_id=None, table_id=None, table_metadata=None, ): <NEW_LINE> <INDENT> data = table_metadata <NEW_LINE> assert table_id == table_metadata["table_id"] <NEW_LINE> data = {key: value for key, value in data.items() if value is not None} <NEW_LINE> response = make_post_request('tables/create_table... | Create a data table in the database with data using CSV
Parameters
----------
db_id: str
Database name (required)
table_id: str
Table name (required)
table_metadata: dict
Metadata for table | 625941d04d74a7450ccd433e |
def waitingline_signinuser(self, waitingline, itemid, staff, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> return self.waitingline_signinuser_with_http_info(waitingline, itemid, staff, **kwargs) | Sign a user in from a waiting line # noqa: E501
Allows the user to sign a user in from a waiting line, provided they have permission to access that waiting line. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.wai... | 625941d0ab23a570cc2502fe |
def _is_IIIF_image_resource(self, resource): <NEW_LINE> <INDENT> if not isinstance(resource, dict): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> service = resource.get('service') <NEW_LINE> if not service or not isinstance(service, dict): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return service.get('... | Helper function determines if dict is IIIF image resource. | 625941d0b830903b967e9a85 |
def read_csv_file(self, file_to_open, delimiter): <NEW_LINE> <INDENT> with open(file_to_open) as file: <NEW_LINE> <INDENT> csv_file = csv.reader(file, delimiter=delimiter, quotechar='\'') <NEW_LINE> csv_to_list = [] <NEW_LINE> index = 0 <NEW_LINE> for rows in csv_file: <NEW_LINE> <INDENT> while index < len(rows): <NEW_... | This method returns a list of strings contained in a CSV file with a given separator | 625941d03317a56b86939dd2 |
def find_formulae(proposition,condition_or_conclusion): <NEW_LINE> <INDENT> dir_priority_process = { 'neg': '^neg [a-zA-Z]+$', 'iff': '[a-zA-Z]+ iff [a-zA-Z]+$', 'imp': '[a-zA-Z]+ imp [a-zA-Z]+$', 'and': '[a-zA-Z]+ and [a-zA-Z]+$', 'or' : '[a-zA-Z]+ or [a-zA-Z]+$' } <NEW_LINE> list_priority_process = ['neg','iff','imp'... | this function is find the formulae like 'p imp q','neg r'
>>> find_formulae([[],[]],0)
([[], []], False)
>>> find_formulae([['p','q'],[]],0)
([['p', 'q'], []], False)
>>> find_formulae([[],['q','c']],0)
([[], ['q', 'c']], False)
>>> find_formulae([['p', 'q'],['q','c']],0)
([['p', 'q'], ['q', 'c']], False)
>>> find_for... | 625941d00a50d4780f66700e |
def sort_parity(self, a): <NEW_LINE> <INDENT> if not a: <NEW_LINE> <INDENT> return list() <NEW_LINE> <DEDENT> e = list() <NEW_LINE> o = list() <NEW_LINE> n = len(a) <NEW_LINE> for i in range(0, n, 1): <NEW_LINE> <INDENT> if a[i] % 2 == 0: <NEW_LINE> <INDENT> e.append(a[i]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ... | Sorts input array with even elements before odd elements.
:param list[int] a: input array of integers
:return: array sorted by parity
:rtype: list[int] | 625941d05fc7496912cc3af9 |
def assert_xlabel_ydata( self, xy_expected, xcol, ycol, message="Incorrect Data" ): <NEW_LINE> <INDENT> x_data = [ "".join(c for c in label.get_text()) for label in self.ax.xaxis.get_majorticklabels() ] <NEW_LINE> y_data = self.get_xy()["y"] <NEW_LINE> xy_data = pd.DataFrame(data={"x": x_data, "y": y_data}) <NEW_LINE> ... | Asserts that the numbers in x labels and y values in Axes `ax` match
`xy_expected`.
Parameters
----------
xy_expected : pandas.DataFrame
Pandas DataFrame that contains data
xcol : string
Column title containing xaxis data
ycol : string
Column title containing yaxis data
message : string
The error messa... | 625941d05510c4643540f55e |
def change_status_extension(request, extension_id): <NEW_LINE> <INDENT> ext = get_object_or_404(Extension, pk=extension_id) <NEW_LINE> if ext: <NEW_LINE> <INDENT> if ext.spw_active: <NEW_LINE> <INDENT> ext.spw_active = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ext.spw_active = True <NEW_LINE> <DEDENT> ext.sav... | Change to True or False the values of spw_active depending on previous value.
After saving, redirects to list-extension url and show the table with all data.
@TODO --> login_required | 625941d0bf627c535bc1334a |
def ExtRun(self, num=None): <NEW_LINE> <INDENT> if num is None: <NEW_LINE> <INDENT> num = self.GetSelection() <NEW_LINE> <DEDENT> if num==-1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> page = self.GetPage(num) <NEW_LINE> abspath = page._filename <NEW_LINE> if abspath is None: <NEW_LINE> <INDENT> res = self.SaveAs(n... | Run the file as an external process with a new console. If num is None
use the current page. | 625941d076e4537e8c3517ee |
def _get_row_values(self, puzzle, idx): <NEW_LINE> <INDENT> row = puzzle[idx] <NEW_LINE> return set([x for x in row if not isinstance(x, set)]) | Get taken values in row | 625941d0cad5886f8bd27154 |
def generators(self): <NEW_LINE> <INDENT> n = self.cartan_type.rank() <NEW_LINE> generators = [] <NEW_LINE> for i in range(1, n+1): <NEW_LINE> <INDENT> reflection = "r"+str(i) <NEW_LINE> generators.append(reflection) <NEW_LINE> <DEDENT> return generators | This method creates the generating reflections of the Weyl group for
a given Lie algebra. For a Lie algebra of rank n, there are n
different generating reflections. This function returns them as
a list.
Examples
========
>>> from sympy.liealgebras.weyl_group import WeylGroup
>>> c = WeylGroup("F4")
>>> c.generators... | 625941d03346ee7daa2b2ee7 |
def eig_pos_barrier( barrier = Th.dscalar(), V1 = Th.dvector(), **other): <NEW_LINE> <INDENT> posV1_barrier = 1-(1-barrier)*(Th.min(V1.flatten())>=0) <NEW_LINE> other.update(locals()) <NEW_LINE> return named( **other ) | A barrier enforcing that the log-det of M should be > exp(-6),
and all the eigenvalues of M > 0. Returns true if barrier is violated. | 625941d030c21e258bdfa619 |
def rand_color(): <NEW_LINE> <INDENT> color = "#" <NEW_LINE> for _ in range(6): <NEW_LINE> <INDENT> color += choice("0123456789ABCDEF") <NEW_LINE> <DEDENT> return color | Generates a random color. | 625941d07d43ff24873a2e1b |
def extract_people_sequence(mocap_data): <NEW_LINE> <INDENT> people = [] <NEW_LINE> for frame in mocap_data.get("frames"): <NEW_LINE> <INDENT> for i, p in enumerate(frame.get("people")): <NEW_LINE> <INDENT> if len(people) < i + 1: <NEW_LINE> <INDENT> people.append({"frames": []}) <NEW_LINE> <DEDENT> people[i].get("fram... | Extract all of the matrices for each frame per person. Extracting this
information will make it possible to simple loop the frames and create
the mocap data for one person.
:param dict mocap_data:
:return: People data
:rtype: dict | 625941d0d53ae8145f87a3ea |
def json(self) -> Dict[str, object]: <NEW_LINE> <INDENT> return {'name': self.name, 'coords': list(self.coords) if self.coords else None} | Return a JSON representation of the location. | 625941d055399d3f05588830 |
def __init__(self, code=None, message=None): <NEW_LINE> <INDENT> self.swagger_types = { 'code': int, 'message': str } <NEW_LINE> self.attribute_map = { 'code': 'code', 'message': 'message' } <NEW_LINE> self._code = code <NEW_LINE> self._message = message | Error - a model defined in Swagger
:param code: The code of this Error.
:type code: int
:param message: The message of this Error.
:type message: str | 625941d0dc8b845886cb56b0 |
def agetLambda(self): <NEW_LINE> <INDENT> return _core.CGPSum_agetLambda(self) | agetLambda(CGPSum self)
Parameters:
self: limix::CGPSum * | 625941d03617ad0b5ed68072 |
def write_cached_gfile(self, garminfile=None, update=False): <NEW_LINE> <INDENT> _write_cached_file(garminfile, self.cache_directory, update) | write cached file | 625941d050485f2cf553cf15 |
def create_certificate_invalidation_entry(certificate, user_requesting_invalidation, notes): <NEW_LINE> <INDENT> log.info(f"Creating a certificate invalidation entry linked to certificate with id {certificate.id}.") <NEW_LINE> certificate_invalidation, __ = CertificateInvalidation.objects.update_or_create( generated_ce... | Invalidates a certificate with the given certificate id. | 625941d06aa9bd52df036f20 |
def reset_accum(x): <NEW_LINE> <INDENT> return ((0 if x[0] in (-1, 256) else x[0]), x[1]) | Reset accumulator to 0 if it is either -1 or 256 | 625941d032920d7e50b2834c |
def finalizeFootprints(self, mask, results, sigma, factor=1.0): <NEW_LINE> <INDENT> for polarity, maskName in (("positive", "DETECTED"), ("negative", "DETECTED_NEGATIVE")): <NEW_LINE> <INDENT> fpSet = getattr(results, polarity) <NEW_LINE> if fpSet is None: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> if self.config... | Finalize the detected footprints
Grows the footprints, sets the ``DETECTED`` and ``DETECTED_NEGATIVE``
mask planes, and logs the results.
``numPos`` (number of positive footprints), ``numPosPeaks`` (number
of positive peaks), ``numNeg`` (number of negative footprints),
``numNegPeaks`` (number of negative peaks) entri... | 625941d05166f23b2e1a52d4 |
def UnpostFailure(self,messageKey): <NEW_LINE> <INDENT> pass | UnpostFailure(self: Document,messageKey: FailureMessageKey)
Deletes the posted failure message associated with a given FailureMessageKey.
messageKey: The key of the FailureMessage to be deleted. | 625941d071ff763f4b549807 |
def price_for_noloss(self, fees_sell: float = 0.26) -> float: <NEW_LINE> <INDENT> fees_sum = self.fees_percentage <NEW_LINE> assert 0 <= fees_sum <= 0.26 <NEW_LINE> return self.price_avg * ((1 + fees_sum / 100) / (1 - fees_sell / 100)) | Minimum price that should be used for *sell* if no loss
should be incurred. Prices larger than the noloss price will
be wins.
Parameters
----------
fees_sell : float, optional
Kraken Exchange *sell* fees, by default 0.26 (maximum for market orders)
Returns
-------
float
noloss price (based on quote currency)
... | 625941d0b830903b967e9a86 |
def save_downsampled_particles(outpath, part, rank): <NEW_LINE> <INDENT> op = outpath.format(rank) <NEW_LINE> fits = fitsio.FITS(op, 'rw') <NEW_LINE> if len(fits) > 1: <NEW_LINE> <INDENT> fits[-1].append(part) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> fits.write(part) | Save a downsampled particle catalog with masking if given | 625941d03cc13d1c6d3c74f5 |
def bst_rotate_right(root, top): <NEW_LINE> <INDENT> if top.leftChild is None: <NEW_LINE> <INDENT> debug("There is no right rotation") <NEW_LINE> return root, top <NEW_LINE> <DEDENT> node = top.leftChild <NEW_LINE> top.leftChild = node.rightChild <NEW_LINE> if node.rightChild: <NEW_LINE> <INDENT> node.rightChild.parent... | Function do right rotation of subtree | 625941d044b2445a33932210 |
def reassign_cluster_id(self, cell, cluster_id): <NEW_LINE> <INDENT> old_cluster_id = cell.clusterId <NEW_LINE> new_cluster_id = cluster_id <NEW_LINE> self.inventory.reassignClusterId(cell, new_cluster_id) <NEW_LINE> if self.clusterSurfaceTrackerPlugin: <NEW_LINE> <INDENT> self.clusterSurfaceTrackerPlugin.updateCluster... | reassigns cluster id of cells
:param cell: {cell}
:param cluster_id:{int} new cluster id
:return: | 625941d0627d3e7fe0d68fcb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.