Best Python code snippet using pandera_python
viewoptions.py
Source:viewoptions.py  
1from plone.app.layout.viewlets.common import ViewletBase2from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile3from zope.component import getMultiAdapter4class ViewOptions(ViewletBase):5    render = ViewPageTemplateFile('viewoptions.pt')6    def _isType(self, type):7        return self.context.portal_type == type8    def _endsWith(self, path):9        return self.context.request.URL.endswith(path)10    def getTabs(self):11        project = self.context.restrictedTraverse('@@unep_utils').projectParentURL()12        if project:13            tabs = [14                (project, "Overview",15                    self._isType('Project') and self._endsWith('/base_view')),16                ("%s/project_general_info" % project,"General",17                    self._isType('ProjectGeneralInformation')),18                ("%s/fmi_folder" % project, "Financial",19                    self._isType('FMIFolder')),20                ("%s/milestones" % project, "Milestones",21                    self._isType('Milestone')),22                ("%s/mne_folder" % project, "Monitoring & Evaluation",23                    self._isType('MandEfolder')),24                ("%s/@@reports" % project, "Reports",25                    self._isType('Project') and self._endsWith('/@@reports')),26                ("%s/documents" % project, "Documents",27                    self._isType('Folder')),28            ]29        elif self._isType('ProjectDatabase'):30            tabs = [31                (self.context.absolute_url(), "Projects",32                    self._endsWith('/base_view')),33                # ("%s/@@reports" % self.context.absolute_url(), "Reports",34                #     self._endsWith('/@@reports')),35                ("%s/projectdatabasereportsview" % self.context.absolute_url(), "Reports",36                    self._endsWith('/projectdatabasereportsview')),37            ]38        else:39            return []...filesource.py
Source:filesource.py  
2from pioneer.das.api.datasources import DataSource3from pioneer.das.api.loaders import pickle_loader, txt_loader, image_loader4import re5from six import string_types6def _endswith(s, patterns):7    assert isinstance(s, string_types)8    if isinstance(patterns, string_types):9        patterns = [patterns,]10    return any([s.endswith(p) for p in patterns])11def try_all_patterns(name):12    for p in [Constants.NUMBERED_PICKLE_PATTERN,13              Constants.NUMBERED_PNG_PATTERN,14              Constants.NUMBERED_JPG_PATTERN]:15        match = re.match(p, name)16        if match:17            return match, p18    return None, None19class FileSource(DataSource):20    """Base class for loading files from a dataset. Will be used to21        load a list of echoes from pickle files contained in a folder or a tar22        archive. Subclases must be used.23    """24    def __init__(self, path, pattern = None, sort=True, loader=None):25        self.path = path26        self.pattern = pattern27        self.sort = sort28        self._loader = loader29        self.files = []30    @property31    def loader(self):32        if self._loader is None:33            if _endswith(self.pattern, '.pkl'):34                self._loader = pickle_loader35            elif _endswith(self.pattern, ['.png', '.jpg']):36                self._loader = image_loader37            elif _endswith(self.pattern, '.txt'):38                self._loader = txt_loader39            else:40                raise RuntimeError('could not guess loader from pattern extension')41        return self._loader42    def get_timestamps(self):..._str_with.py
Source:_str_with.py  
1#!/usr/bin/python32# -*- coding: utf-8 -*-3# author : haymai4if __name__ == '__main__':5    filename = 'spam.txt'6    endswith = filename.endswith('.txt')7    print(endswith)8    startswith = filename.startswith('file:')9    print(startswith)10    file_names = ['Makefile', 'foo.c', 'bar.py', 'spam.c', 'spam.h']11    _endswith = [name for name in file_names if name.endswith(('.c', '.h'))]12    print(_endswith)13    _any = any(name.endswith('.py') for name in file_names)14    print(_any)15    choices = ['http:', 'ftp:']16    url = 'http://www.python.org'17    """18    è¿ä¸ªæ¹æ³ä¸å¿
é¡»è¦è¾å
¥ä¸ä¸ªå
ç»ä½ä¸ºåæ°ã妿你æ°å·§æä¸ä¸ª list æè
 set ç±»åç鿩项ï¼è¦ç¡®ä¿ä¼ éåæ°åå
è°ç¨ tuple() å°å
¶è½¬æ¢ä¸ºå
ç»ç±»åã19    """20    # url.startswith(choices)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
