code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class StorageByKeyName(Storage): <NEW_LINE> <INDENT> @util.positional(4) <NEW_LINE> def __init__(self, model, key_name, property_name, cache=None, user=None): <NEW_LINE> <INDENT> if key_name is None: <NEW_LINE> <INDENT> if user is None: <NEW_LINE> <INDENT> raise ValueError('StorageByKeyName called with no key name or u...
Store and retrieve a credential to and from the App Engine datastore. This Storage helper presumes the Credentials have been stored as a CredentialsProperty or CredentialsNDBProperty on a datastore model class, and that entities are stored by key_name.
625990b2627d3e7fe0e08f85
class Task(Task): <NEW_LINE> <INDENT> option_list = [ make_option('--max-complexity', dest='max_complexity', default='-1', help='McCabe complexity treshold'), make_option("--pep8-exclude", dest="pep8-exclude", default=pep8.DEFAULT_EXCLUDE + ",migrations", help="exclude files or directories which match these " "comma se...
Runs flake8 on python files.
625990b2091ae35668706d48
class Keyword(Base): <NEW_LINE> <INDENT> __tablename__ = 'keywords' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> keyword = Column(Unicode) <NEW_LINE> keyword_weight = Column(Unicode)
Keyword Model. Populated by harvester. Keywords from harvested page and their number of occurences as keyword weight.
625990b2187af65679d2ac72
class MimetypePluginManager(RegistrablePluginManager): <NEW_LINE> <INDENT> _default_mimetype_functions = ( mimetype.by_python, mimetype.by_file, mimetype.by_default, ) <NEW_LINE> def clear(self): <NEW_LINE> <INDENT> self._mimetype_functions = list(self._default_mimetype_functions) <NEW_LINE> super(MimetypePluginManager...
Plugin manager for mimetype-function registration.
625990b2c4546d3d9def832d
class MapSave(Document): <NEW_LINE> <INDENT> name = StringProperty( verbose_name="Name of the map save", default=None, required=True, ) <NEW_LINE> desc = StringProperty( verbose_name="Description of the map save", default='', required=False, ) <NEW_LINE> version = StringProperty( verbose_name="User defined map version ...
A Minecraft server config file
625990b2c4546d3d9def8330
class ThreadLocal(local): <NEW_LINE> <INDENT> _init_done = False <NEW_LINE> def __init__(self, **default_factories): <NEW_LINE> <INDENT> if self._init_done: <NEW_LINE> <INDENT> raise SystemError('__init__ called too many times') <NEW_LINE> <DEDENT> self._init_done = True <NEW_LINE> self._default_factories = default_fac...
Thread local storage for greenlet state.
625990b2091ae35668706d55
class InternalTimerService(TimerService): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._current_watermark = None <NEW_LINE> <DEDENT> def current_processing_time(self) -> int: <NEW_LINE> <INDENT> return int(time.time() * 1000) <NEW_LINE> <DEDENT> def current_watermark(self): <NEW_LINE> <INDENT> retur...
Internal implementation of TimerService.
625990b2187af65679d2ac79
class SchLib_V6(object): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> with open(filename) as fp: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.sexpdata = sexpdata.loads("\n".join(fp.readlines())) <NEW_LINE> if self.sexpdata[0].value() != "kicad_symbol_lib": <NEW_LINE> <INDENT> raise Asserti...
A class to parse KiCad V6 schematic symbol libraries.
625990b2091ae35668706d57
class TransformerEncoderLayer(nn.Module): <NEW_LINE> <INDENT> __constants__ = ['batch_first'] <NEW_LINE> def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, activation="relu", layer_norm_eps=1e-5, batch_first=False, normalize_before=True, device=None, dtype=None) -> None: <NEW_LINE> <INDENT> factory_k...
TransformerEncoderLayer copy-paste from torch.nn.TransformerEncoderLayer with modifications: * layer norm before add residual
625990b2627d3e7fe0e08fa4
class DownloadReportResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.DailyReportUrl = None <NEW_LINE> self.ResultReportUrl = None <NEW_LINE> self.DetailReportUrl = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self....
DownloadReport返回参数结构体
625990b2187af65679d2ac7f
class MoverseConArribaAbajo(Habilidad): <NEW_LINE> <INDENT> def __init__(self, receptor): <NEW_LINE> <INDENT> Habilidad.__init__(self, receptor) <NEW_LINE> pilas.eventos.actualizar.conectar(self.pulsa_tecla) <NEW_LINE> <DEDENT> def pulsa_tecla(self, evento): <NEW_LINE> <INDENT> velocidad = 5 <NEW_LINE> c = pilas.escena...
Hace que un actor se pueda mover con las teclas direccionales <ARRIBA> y <ABAJO>
625990b3187af65679d2ac82
class TypoScriptCssDataLexer(RegexLexer): <NEW_LINE> <INDENT> name = 'TypoScriptCssData' <NEW_LINE> aliases = ['typoscriptcssdata'] <NEW_LINE> tokens = { 'root': [ (r'(.*)(###\w+###)(.*)', bygroups(String, Name.Constant, String)), (r'(\{)(\$)((?:[\w\-_]+\.)*)([\w\-_]+)(\})', bygroups(String.Symbol, Operator, Name.Const...
Lexer that highlights markers, constants and registers within css blocks.
625990b3c4546d3d9def833c
class Sport(models.Model): <NEW_LINE> <INDENT> ext_id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) <NEW_LINE> name = models.CharField(max_length=50, unique=True) <NEW_LINE> created = models.DateTimeField(auto_now_add=True) <NEW_LINE> updated = models.DateTimeField(auto_now=True) <NEW_LINE> d...
Store sport here
625990b3091ae35668706d6b
class XmlEntry: <NEW_LINE> <INDENT> def __init__(self, title, ns, id, text, username, ipedit, timestamp, editRestriction, moveRestriction, revisionid, comment, redirect): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.ns = ns <NEW_LINE> self.id = id <NEW_LINE> self.text = text <NEW_LINE> self.username = usernam...
Represent a page.
625990b3187af65679d2ac84
class Level: <NEW_LINE> <INDENT> def __init__(self, level): <NEW_LINE> <INDENT> self.Level = level <NEW_LINE> self.Nodes = [] <NEW_LINE> self.Bundles = [] <NEW_LINE> self.IndexLimitNode = None <NEW_LINE> <DEDENT> def AddEntity(self, entity, store): <NEW_LINE> <INDENT> self.Nodes.append(store.GetNode(entity)) <NEW_LINE>...
Graphical layout for a vertical group of entities
625990b3c4546d3d9def833f
class RandomSampling(Learner): <NEW_LINE> <INDENT> def __init__(self, model): <NEW_LINE> <INDENT> super(RandomSampling, self).__init__(model)
docstring for RandomSampling
625990b3187af65679d2ac86
class GlossProcessor(BlockProcessor): <NEW_LINE> <INDENT> def test(self, parent, block): <NEW_LINE> <INDENT> return block.split('\n')[0] == GLOSS_START <NEW_LINE> <DEDENT> def run(self, parent, blocks): <NEW_LINE> <INDENT> lines_raw = blocks.pop(0).split('\n')[1:] <NEW_LINE> lines = [] <NEW_LINE> pre = None <NEW_LINE> ...
Processes interlinear glosses.
625990b3091ae35668706d77
class TestTeamSPRatingSpecialTeams(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testTeamSPRatingSpecialTeams(self): <NEW_LINE> <INDENT> pass
TeamSPRatingSpecialTeams unit test stubs
625990b3627d3e7fe0e08fbb
class CanaryCamera(Camera): <NEW_LINE> <INDENT> def __init__(self, hass, data, location, device, timeout, ffmpeg_args): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._ffmpeg = hass.data[DATA_FFMPEG] <NEW_LINE> self._ffmpeg_arguments = ffmpeg_args <NEW_LINE> self._data = data <NEW_LINE> self._location = locatio...
An implementation of a Canary security camera.
625990b3091ae35668706d7b
class StudentDiscussionDetail(generics.RetrieveAPIView): <NEW_LINE> <INDENT> serializer_class = StudentDiscussionSerializer <NEW_LINE> permission_classes = (IsAdminUser, IsStudent, ) <NEW_LINE> authentication_classes = (SessionAuthentication, BasicAuthentication, OAuth2Authentication) <NEW_LINE> def get_object(self): <...
**Use Case** Get count of discussions and questions for a specific student. **Example Requests** GET /api/courses/v2/discussions/students/{student_id} **Response Values** On success with Response Code <200> * user_id: The unique identifier for the student. * count: * discus...
625990b3627d3e7fe0e08fbd
class TestCityDocs(unittest.TestCase): <NEW_LINE> <INDENT> def test_class_doc(self): <NEW_LINE> <INDENT> self.assertTrue(len(City.__doc__) > 0)
check for documentation
625990b3187af65679d2ac8f
class AwsDedicatedHost(resource.BaseResource): <NEW_LINE> <INDENT> def __init__(self, machine_type, zone): <NEW_LINE> <INDENT> super(AwsDedicatedHost, self).__init__() <NEW_LINE> self.machine_type = machine_type <NEW_LINE> self.zone = zone <NEW_LINE> self.region = util.GetRegionFromZone(self.zone) <NEW_LINE> self.clien...
Object representing an AWS host. Attributes: region: The AWS region of the host. zone: The AWS availability zone of the host. machine_type: The machine type of VMs that may be created on the host. client_token: A uuid that makes the creation request idempotent. id: The host_id of the host.
625990b4187af65679d2ac93
class AccountInvoiceRefund(models.TransientModel): <NEW_LINE> <INDENT> _inherit = "account.invoice.refund" <NEW_LINE> @api.multi <NEW_LINE> def compute_refund(self, mode='refund'): <NEW_LINE> <INDENT> return super(AccountInvoiceRefund, self.with_context(of_mode=mode)).compute_refund(mode)
Refunds invoice
625990b4187af65679d2ac99
class PyCFormView(object): <NEW_LINE> <INDENT> def __new__(cls): <NEW_LINE> <INDENT> raise Exception('This class just for typing, can not be instanced!') <NEW_LINE> <DEDENT> def OnCommand(self,wparam:'Any',lparam:'Any') -> 'None': <NEW_LINE> <INDENT> pass
A class which implementes a CFormView (ie, a view based on a dialog resource.
625990b4187af65679d2ac9b
class MainWindow(Gtk.ApplicationWindow): <NEW_LINE> <INDENT> def __init__(self,app): <NEW_LINE> <INDENT> Gtk.Window.__init__(self, title="google2ubuntu-manager",application=app) <NEW_LINE> self.set_default_size(660, 400) <NEW_LINE> self.set_resizable(True) <NEW_LINE> self.set_border_width(0) <NEW_LINE> self.get_focus()...
@description: This class display the main window that the user will see when he wants to manage his commands
625990b4c4546d3d9def8355
class FormlessBrowsableAPIRenderer(renderers.BrowsableAPIRenderer): <NEW_LINE> <INDENT> def show_form_for_method(self, *args, **kwargs): <NEW_LINE> <INDENT> return False
An instance of the browseable API with forms suppressed. Useful for POST endpoints that don't create objects.
625990b4187af65679d2ac9c
class StructureFormatError(Exception): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.msg)
Exception raised for structure format errors. Parameters ---------- msg : str Error message.
625990b4627d3e7fe0e08fe3
class TweetsFetcher(): <NEW_LINE> <INDENT> def __init__(self, tweetsCsvFile, outputDir, tweetsPerXml): <NEW_LINE> <INDENT> self.__process = None <NEW_LINE> self.tweetsCsvFile = tweetsCsvFile <NEW_LINE> self.outputDir = outputDir <NEW_LINE> self.__cacheDir = settings.XML_CACHE_DIR <NEW_LINE> self.__canceled = False <NEW...
Fetches and merges tweets as XML file(s). Process is done by jar file started through subprocess.
625990b4187af65679d2ac9f
class ScoreBoard(object): <NEW_LINE> <INDENT> def __init__(self, capacity=10): <NEW_LINE> <INDENT> self._board = [None]*capacity <NEW_LINE> self._len = 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def len(self): <NEW_LINE> <INDENT> return self._len <NEW_LINE> <DEDENT> def __getitem__(self, k): <NEW_LINE> <INDENT> return ...
高分榜
625990b4091ae35668706da5
class FeatureSerializer(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def deserialize(path): <NEW_LINE> <INDENT> serializedFeatures = {} <NEW_LINE> try: <NEW_LINE> <INDENT> with open(path) as file: <NEW_LINE> <INDENT> serializedFeatures = decode(file.read()) <NEW_LINE> <DEDENT> <DEDENT> except Exception: <NEW_L...
Serialize and deserialize features from a path
625990b5627d3e7fe0e08fe7
class RetrieveAgentAppsByTagId(RetrieveAppsByTagId): <NEW_LINE> <INDENT> def __init__(self, username, customer_name, tag_id, uri=None, method=None, count=30, offset=0, sort='asc', sort_key=AgentAppsKey.Name, show_hidden=CommonKeys.NO): <NEW_LINE> <INDENT> self.count = count <NEW_LINE> self.offset = offset <NEW_LINE> se...
This class is used to get tag data from within the Packages Page
625990b5187af65679d2aca1
class VmvlancreationmodeEnum(Enum): <NEW_LINE> <INDENT> automatic = 1 <NEW_LINE> manual = 2 <NEW_LINE> @staticmethod <NEW_LINE> def _meta_info(): <NEW_LINE> <INDENT> from ydk.models.cisco_ios_xe._meta import _CISCO_VLAN_MEMBERSHIP_MIB as meta <NEW_LINE> return meta._meta_table['CiscoVlanMembershipMib.Vmmembership.Vmvla...
VmvlancreationmodeEnum This object is used to determine whether or not a non\-existing VLAN will be created automatically by the system after assigned to a port. automatic(1)\: a non\-existing VLAN will be created automatically by the system after assigned to a port. manual(2)\: ...
625990b5187af65679d2aca3
class Example(QtGui.QWidget): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(QtGui.QWidget, self).__init__() <NEW_LINE> self.file = "" <NEW_LINE> self.save_file = "" <NEW_LINE> self.lbl = None <NEW_LINE> self.lbl_result = None <NEW_LINE> self.pbar = None <NEW_LINE> self.btn = None <NEW_LINE> self.ste...
Create a window with a label, a progress bar and a button that open a file dialog window
625990b5627d3e7fe0e08fed
class Fields: <NEW_LINE> <INDENT> bottom: int <NEW_LINE> top: int <NEW_LINE> def __init__(self, txt: Text): <NEW_LINE> <INDENT> if '-' in txt: <NEW_LINE> <INDENT> self.bottom, self.top = map(int, txt.split('-')) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.bottom = self.top = int(txt) <NEW_LINE> <DEDENT> self.top...
a range of fields; '2' would be the single field 2 and '3-5' would be fields '3-5' (inclusive)
625990b5091ae35668706daf
class SchemaElement: <NEW_LINE> <INDENT> def __init__(self, el): <NEW_LINE> <INDENT> assert el is not None <NEW_LINE> self.el = el <NEW_LINE> self.uri = None <NEW_LINE> self.name = None <NEW_LINE> self.id = None <NEW_LINE> self.type = None <NEW_LINE> self.label = None <NEW_LINE> self.verbose_label = None <NEW_LINE> sel...
スキーマファイルの中の項目 ( 語彙スキーマ )
625990b5627d3e7fe0e08ff1
class ProjectsService(base_api.BaseApiService): <NEW_LINE> <INDENT> _NAME = u'projects' <NEW_LINE> def __init__(self, client): <NEW_LINE> <INDENT> super(ApheleiaV1beta1.ProjectsService, self).__init__(client) <NEW_LINE> self._method_configs = { } <NEW_LINE> self._upload_configs = { }
Service class for the projects resource.
625990b5091ae35668706db1
class Unserializer(PdbHandler): <NEW_LINE> <INDENT> def __init__(self, include_pats=None, exclude_pats=None, custom_steps=None): <NEW_LINE> <INDENT> PdbHandler.__init__(self) <NEW_LINE> self.projects = {} <NEW_LINE> self.first_project = None <NEW_LINE> if include_pats: <NEW_LINE> <INDENT> self.include_pats = set(includ...
Builds *Project* instances for every project that matches *include_pats* and not *exclude_pats*. See *filters*() for implementation.
625990b5c4546d3d9def8360
class BoundaryBase(object): <NEW_LINE> <INDENT> def __init__(self, left, right, bottom, top): <NEW_LINE> <INDENT> self.dim = None <NEW_LINE> self.boundaries = None <NEW_LINE> <DEDENT> def update_boundaries(self, particles, particles_index, neighbor_graph): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def find_boundary_...
boundary condition base class, every boundary class must inherit this class
625990b5187af65679d2aca8
class DummyParent(UniqueRepresentation, Parent): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def _repr_(self): <NEW_LINE> <INDENT> return self.name
A class for creating dummy parents for testing ElementWrapper
625990b5627d3e7fe0e08ff7
class AttentionWithContext(Layer): <NEW_LINE> <INDENT> def __init__(self, W_regularizer=None, u_regularizer=None, b_regularizer=None, W_constraint=None, u_constraint=None, b_constraint=None, bias=True, **kwargs): <NEW_LINE> <INDENT> self.supports_masking = True <NEW_LINE> self.init = glorot_uniform() <NEW_LINE> self.W_...
Example: model.add(LSTM(64, return_sequences=True)) model.add(AttentionWithContext())
625990b5627d3e7fe0e08ff9
class PackageHashError(spack.error.SpackError): <NEW_LINE> <INDENT> pass
Raised for all errors encountered during package hashing.
625990b5187af65679d2acab
class SxS(_JSONEntry): <NEW_LINE> <INDENT> PREFIX = 'sxs' <NEW_LINE> JSON_ENCODER = AmendmentEncoder
Processes Section-by-Section analyses, keyed by sxs
625990b5c4546d3d9def8367
class SpinChain: <NEW_LINE> <INDENT> def __init__( self, total_devices: int, spi_select: Optional[Tuple[int, int]] = None, spi_transfer: Optional[ Callable[[List[int]], List[int]] ] = None, ) -> None: <NEW_LINE> <INDENT> assert total_devices > 0 <NEW_LINE> assert (spi_select is None) != (spi_transfer is None), ...
Class for constructing a chain of SPIN devices
625990b5187af65679d2acae
class KW_onehot0(KeywordToken): <NEW_LINE> <INDENT> ASTOP = 'onehot0'
Expression 'OneHot0' keyword
625990b5627d3e7fe0e09005
class IsOwnerOrReadOnly(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.owner == request.user
Grant rw permissions if user created the snippet and r otherwise.
625990b6187af65679d2acb1
class RegistrationView(MethodView): <NEW_LINE> <INDENT> def post(self): <NEW_LINE> <INDENT> user = User.query.filter_by(email=request.data['email']).first() <NEW_LINE> if not user: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> post_data = request.data <NEW_LINE> email = post_data['email'] <NEW_LINE> password = post_data...
This class register a new user
625990b6c4546d3d9def836b
class IncapSession(requests.Session): <NEW_LINE> <INDENT> def get(self, url, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('allow_redirects', True) <NEW_LINE> r = self.request('GET', url, **kwargs) <NEW_LINE> return crack(self, r)
requests.Session subclass to wrap all get requests with incapsula.crack.
625990b6187af65679d2acb2
class ExcelOption(object): <NEW_LINE> <INDENT> def __init__(self,filename,sheetname=None): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.sheetname = sheetname <NEW_LINE> self.wb = load_workbook(self.filename) <NEW_LINE> self.ws = self.wb.active if self.sheetname is None else self.wb[self.sheetname] <NEW_...
excel 操作类
625990b6187af65679d2acb3
class Actor(nn.Module): <NEW_LINE> <INDENT> def __init__(self, state_size, hidden_size, action_size, seed, dropout): <NEW_LINE> <INDENT> super(Actor, self).__init__() <NEW_LINE> self.seed = torch.manual_seed(seed) <NEW_LINE> self.input_layer = nn.Linear(state_size, hidden_size) <NEW_LINE> self.batchnorm_layer = nn.Batc...
Actor (Policy) Model.
625990b6091ae35668706dcd
class PropertiesTestCaseWithoutProperties(TestCase): <NEW_LINE> <INDENT> fixtures = ['lfs_shop.xml', "lfs_user.xml"] <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.p1 = Product.objects.create(name="Product 1", slug="product-1", price=5) <NEW_LINE> self.p2 = Product.objects.create(name="Product 2", slug="product-2...
Test the filter methods without added properties.
625990b6627d3e7fe0e0900f
class MqlTooComplex(InvalidMqlException): <NEW_LINE> <INDENT> pass
Exception class for errors caused by overly complex queries.
625990b6627d3e7fe0e09013
class CSCMatrix(COOMatrix): <NEW_LINE> <INDENT> def _build(self, num_rows, num_cols): <NEW_LINE> <INDENT> data, rows, cols = self._build_sparse(num_rows, num_cols) <NEW_LINE> srtidxs = np.lexsort((rows, cols)) <NEW_LINE> data = data[srtidxs] <NEW_LINE> rows = rows[srtidxs] <NEW_LINE> cols = cols[srtidxs] <NEW_LINE> rev...
Sparse matrix in Compressed Col Storage format.
625990b6187af65679d2acb7
class Printer(SciPyPrinter): <NEW_LINE> <INDENT> import_aliases = { 'numpy': '_np', 'scipy': '_scipy', 'scipy.special': '_scipy_special', 'scipy.constants': '_scipy_constants', 'scipy.sparse': '_scipy_sparse' } <NEW_LINE> @property <NEW_LINE> def numpy_alias(self): <NEW_LINE> <INDENT> return self.import_aliases.get('nu...
sym2num sympy code printer.
625990b6091ae35668706dd7
class Accoutrement(Equipment): <NEW_LINE> <INDENT> IS_EQUIPMENT = False <NEW_LINE> IS_ACCOUTREMENT = True <NEW_LINE> BUY_PRICE = 0 <NEW_LINE> SELL_PRICE = 0 <NEW_LINE> def place(self, animal): <NEW_LINE> <INDENT> for eq in animal.accoutrements: <NEW_LINE> <INDENT> if eq.NAME == self.NAME: <NEW_LINE> <INDENT> return Fal...
Things which are not equipment, but are displayed in the same way
625990b6627d3e7fe0e09019
class BlackListToken(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> token = db.Column(db.String(500), unique=True, nullable=False) <NEW_LINE> blacklisted_on = db.Column(db.DateTime, nullable=False) <NEW_LINE> def __init__(self, token): <NEW_LINE> <INDENT> self...
" db to save invalid tokens
625990b6627d3e7fe0e0901b
@attr(shard=10) <NEW_LINE> class NewProgramHelpTest(ProgramsConfigMixin, AcceptanceTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(NewProgramHelpTest, self).setUp() <NEW_LINE> self.auth_page = AutoAuthPage(self.browser, staff=True) <NEW_LINE> self.program_page = DashboardPageWithPrograms(self.brow...
Test help links on a 'New Program' page
625990b6c4546d3d9def8375
class EndiciaConfiguration(ModelSingleton, ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__ = 'endicia.configuration' <NEW_LINE> account_id = fields.Char('Account Id') <NEW_LINE> requester_id = fields.Char('Requester Id') <NEW_LINE> passphrase = fields.Char('Passphrase') <NEW_LINE> is_test = fields.Boolean('Is Test')...
Configuration settings for Endicia.
625990b6627d3e7fe0e0901d
class PublicManager(BasePage): <NEW_LINE> <INDENT> homepage = 'xpath=>//*[@id="navUl"]/li[1]/a' <NEW_LINE> username = 'xpath=>//*[@id="userName"]' <NEW_LINE> password = 'xpath=>//*[@id="password"]' <NEW_LINE> button = 'xpath=>//*[@id="btnSubmit"]' <NEW_LINE> pre_screening = 'xpath=>//*[@id="navUl"]/li[3]/span' <NEW_LIN...
公募基金经理详情页
625990b6091ae35668706ddd
class RandomRotate(object): <NEW_LINE> <INDENT> def __init__(self, max_deg): <NEW_LINE> <INDENT> self.max_deg = max_deg <NEW_LINE> <DEDENT> def __call__(self, sample): <NEW_LINE> <INDENT> angle = np.random.uniform(0, 1) * self.max_deg <NEW_LINE> sample = transform.rotate(sample, angle) <NEW_LINE> return sample
Rotate randomly the image in a sample.
625990b6187af65679d2acbd
class Stats(BaseObj): <NEW_LINE> <INDENT> enregistrer = True <NEW_LINE> def __init__(self, uptime): <NEW_LINE> <INDENT> BaseObj.__init__(self) <NEW_LINE> self.uptime = uptime <NEW_LINE> self.nb_commandes = 0 <NEW_LINE> self.tps_moy_commandes = None <NEW_LINE> self.max_commandes = DicMax(3) <NEW_LINE> self.moy_wd = 0 <N...
Classe contenant les différentes statistiques du MUD. Ces stats sont enregistrées en fichier pour être rechargées en cas de redémarrage du module 'statistique'. On s'assure, avant de considérer les statistiques récupérées comme les statistiques 'actuelles' que le temps d'uptime est bien égal à celui de la session. Ra...
625990b6c4546d3d9def8378
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = "users" <NEW_LINE> username = db.Column(db.String(20), primary_key=True) <NEW_LINE> password = db.Column(db.Text, nullable=False) <NEW_LINE> email = db.Column(db.String(50), nullable=False) <NEW_LINE> first_name = db.Column(db.String(30), nullable=False) <NEW_LI...
User Model
625990b6091ae35668706de7
class CodeCheckRecord(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'打分者', related_name='dafen_user') <NEW_LINE> to_user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=u'被打分者', related_name='beidafen_user') <NEW_LINE> date = models.DateField(default=time...
代码走查 by:王健 at:2015-4-6
625990b7187af65679d2acc3
class RichTextValue(object): <NEW_LINE> <INDENT> implements(IRichTextValue) <NEW_LINE> def __init__(self, raw=None, mimeType=None, outputMimeType=None, encoding='utf-8', output=None): <NEW_LINE> <INDENT> self._raw_holder = RawValueHolder(raw) <NEW_LINE> self._mimeType = mimeType <NEW_LINE> self._outputMimeType = output...
The actual value. Note that this is not a persistent object, to avoid a separate ZODB object being loaded.
625990b7091ae35668706ded
class IRCChannel(object): <NEW_LINE> <INDENT> def __init__(self, name, topic='Telegram channel'): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.topic_by = 'Telegram' <NEW_LINE> self.topic = topic <NEW_LINE> self.clients = set()
IRC Channel handler.
625990b7627d3e7fe0e09035
class Development(Common): <NEW_LINE> <INDENT> DEBUG = True <NEW_LINE> INTERNAL_IPS = [ '127.0.0.1' ] <NEW_LINE> INSTALLED_APPS = Common.INSTALLED_APPS + [ 'debug_toolbar' ]; <NEW_LINE> MIDDLEWARE = Common.MIDDLEWARE + [ 'debug_toolbar.middleware.DebugToolbarMiddleware' ] <NEW_LINE> def show_toolbar(request): <NEW_LINE...
The in-development settings and the default configuration.
625990b7c4546d3d9def8382
class DartApiClient(BaseApiClient): <NEW_LINE> <INDENT> def __init__(self, content_source): <NEW_LINE> <INDENT> BaseApiClient.__init__(self, content_source=content_source) <NEW_LINE> log.debug("Creating new Dart API client...") <NEW_LINE> slumber.API.__init__(self, self.url, auth=self.auth_request_decorator, append_sla...
API client to interact with DART.
625990b7187af65679d2acca
class SBBTreeHeap( object ): <NEW_LINE> <INDENT> __slots__ = ( 'root' ) <NEW_LINE> def __init__( self ): <NEW_LINE> <INDENT> self.root = None <NEW_LINE> <DEDENT> def __str__( self ): <NEW_LINE> <INDENT> return str(self.root)
A size-balanced binary tree heap. SLOTS: root: NoneType|TreeNode
625990b7c4546d3d9def8389
class TenCrop(object): <NEW_LINE> <INDENT> def __init__(self, size, vertical_flip=False): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> if isinstance(size, numbers.Number): <NEW_LINE> <INDENT> self.size = (int(size), int(size)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> assert len(size) == 2, "Please provide only ...
将给定的 PIL Image 裁剪成四个角, 中心裁剪, 并加上这些的翻转版本(默认使用水平翻转) .. Note:: 该变换返回一个图像元组, 并且数据集返回的输入和目标的数量可能不匹配. 请参阅下面的例子来处理这个问题. Args: size (sequence or int): 期望输出的裁剪尺寸. 如果 size(尺寸)是 `int`` 类型的整数, 而不是像 (h, w) 这样类型的序列, 裁剪出来的图像是 (size, size) 这样的正方形的. vertical_flip(bool): 使用垂直翻转而不是水平的方式 Example: >>> transform = ...
625990b8187af65679d2acd2
class NoFutureImportBear(LocalBear): <NEW_LINE> <INDENT> LANGUAGES = {'Python', 'Python 2', 'Python 3'} <NEW_LINE> AUTHORS = {'The coala developers'} <NEW_LINE> AUTHORS_EMAILS = {'coala-devel@googlegroups.com'} <NEW_LINE> LICENSE = 'AGPL-3.0' <NEW_LINE> BEAR_DEPS = {PyFlakesASTBear} <NEW_LINE> def remove_future_imports...
NoFutureImportBear implementation. A local bear that uses pyflakes AST to detect use of `__future__` import in python code.
625990b8187af65679d2acd8
class Queue: <NEW_LINE> <INDENT> def __init__(self, capacity): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def is_empty(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def is_full(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def enqueue(self, item): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def dequeue(s...
Implements an link-based ,efficient first-in first-out Abstract Data Type
625990b8627d3e7fe0e0905b
class ConfigurableUnit(Unit, Configurable): <NEW_LINE> <INDENT> pass
A unit which can be directly configured.
625990b8187af65679d2acdb
class PositionBody: <NEW_LINE> <INDENT> def __init__( self, x_m, y_m, z_m): <NEW_LINE> <INDENT> self.x_m = x_m <NEW_LINE> self.y_m = y_m <NEW_LINE> self.z_m = z_m <NEW_LINE> <DEDENT> def __eq__(self, to_compare): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return (self.x_m == to_compare.x_m) and ...
Position type, represented in the Body (X Y Z) frame Parameters ---------- x_m : float X Position in metres. y_m : float Y Position in metres. z_m : float Z Position in metres.
625990b8627d3e7fe0e09067
class Module(object): <NEW_LINE> <INDENT> def __init__(self, modname, filename): <NEW_LINE> <INDENT> self.modname = modname <NEW_LINE> self.label = modname <NEW_LINE> self.filename = filename <NEW_LINE> self.imports = set() <NEW_LINE> self.imported_names = () <NEW_LINE> self.unused_names = () <NEW_LINE> <DEDENT> def __...
Node in a module dependency graph. Packages may also be represented as Module objects. ``imports`` is a set of module names this module depends on. ``imported_names`` is a list of all names that were imported from other modules (actually, ImportInfo objects). ``unused_names`` is a list of names that were imported, ...
625990b8187af65679d2ace0
class Group(object): <NEW_LINE> <INDENT> def __init__(self, stones=None, color=None): <NEW_LINE> <INDENT> if stones is not None: <NEW_LINE> <INDENT> self.stones = set(stones) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.stones = set() <NEW_LINE> <DEDENT> self.border = set() <NEW_LINE> self.color = color <NEW_LINE...
Represents a group of connected stones on the board. Attributes: stones (set): list of all coordinates where the group has a stone border (set): list of all fields that are adjacent to the group For a new group empty fields must be added manually since the group does not kno...
625990b8627d3e7fe0e09069
class CompoundStep(object): <NEW_LINE> <INDENT> def __init__(self, methods): <NEW_LINE> <INDENT> self.methods = list(methods) <NEW_LINE> self.generates_stats = any(method.generates_stats for method in self.methods) <NEW_LINE> self.stats_dtypes = [] <NEW_LINE> for method in self.methods: <NEW_LINE> <INDENT> if method.ge...
Step method composed of a list of several other step methods applied in sequence.
625990b9627d3e7fe0e0906d
class VirtualNetworkProfile(Model): <NEW_LINE> <INDENT> _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'subnet': {'key': 'subnet', 'type': 'str'}, ...
Specification for using a Virtual Network. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource id of the Virtual Network. :type id: str :ivar name: Name of the Virtual Network (read-only). :vartype name: str :ivar type: Resource type of the Virtual Network (read...
625990b9627d3e7fe0e09075
class TZDateTime(TypeDecorator): <NEW_LINE> <INDENT> impl = DateTime <NEW_LINE> def process_bind_param(self, value, dialect): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> if isinstance(value, basestring) or isinstance(value, str): <NEW_LINE> <INDENT> value = parser.parse(value) <NEW_LINE> <DEDENT> if i...
Coerces a tz-aware datetime object into a naive utc datetime object to be stored in the database. If already naive, will keep it. On return of the data will restore it as an aware object by assuming it is UTC. Use this instead of the standard :class:`sqlalchemy.types.DateTime`.
625990b9c4546d3d9def83a4
class PySerialTransport(RFXtrxTransport): <NEW_LINE> <INDENT> def __init__(self, port, debug=False): <NEW_LINE> <INDENT> self.serial = Serial(port, 38400, timeout=0.1) <NEW_LINE> self.debug = debug <NEW_LINE> <DEDENT> def receive_blocking(self): <NEW_LINE> <INDENT> while True: <NEW_LINE> <INDENT> data = self.serial.rea...
Implementation of a transport using PySerial
625990b9187af65679d2ace9
class CommonDotGen(DotGenLabeller): <NEW_LINE> <INDENT> def visit_GeneratedPathRef(self, node): <NEW_LINE> <INDENT> return "target: %s" % node.target.get_filename()
Manages coversion of all common nodes to dot.
625990b9c4546d3d9def83a6
class CacheKey(str): <NEW_LINE> <INDENT> def __init__(self, key): <NEW_LINE> <INDENT> self._key = key <NEW_LINE> <DEDENT> if sys.version_info[0] < 3: <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return smart_bytes(self._key) <NEW_LINE> <DEDENT> def __unicode__(self): <NEW_LINE> <INDENT> return smart_text(...
A stub string class that we can use to check if a key was created already.
625990b9c4546d3d9def83a7
class Collaboration: <NEW_LINE> <INDENT> def __init__(self, species_index, gen, individuals, fit=None): <NEW_LINE> <INDENT> self.species_index = species_index <NEW_LINE> self.gen = gen <NEW_LINE> self.individuals = individuals <NEW_LINE> self.fitness = FitnessMin() <NEW_LINE> if fit is not None: <NEW_LINE> <INDENT> sel...
A cooperation of individuals to form a complete solution.
625990b9187af65679d2aced
class HomeView(TemplateView): <NEW_LINE> <INDENT> template_name = 'invest/home.html'
Query the miner.AggregateResults table to retrieve values for plotting in a bar chart
625990b9187af65679d2acf0
class TestProcessFindJbossEAPRunJarVer(unittest.TestCase): <NEW_LINE> <INDENT> def test_success_case(self): <NEW_LINE> <INDENT> in_line = '1.3.6.Final-redhat-1**2018-01-18; ' '1.3.6.Final-redhat-1**2018-01-18; ' '1.3.6.Final-redhat-1**2018-01-18\n' <NEW_LINE> expected = {'version': '1.3.6.Final-re...
Test ProcessFindJbossEAPRunJarVer.
625990bac4546d3d9def83af
class OpenURLAction(BaseAction): <NEW_LINE> <INDENT> itype = 'is.workflow.actions.openurl' <NEW_LINE> keyword = 'open_url'
Open URL from previous action
625990ba187af65679d2acf4
@parser(Specs.rhn_charsets) <NEW_LINE> class RHNCharSets(LegacyItemAccess, Parser): <NEW_LINE> <INDENT> def parse_content(self, content): <NEW_LINE> <INDENT> db_set = {} <NEW_LINE> db_backend = None <NEW_LINE> in_server = False <NEW_LINE> in_client = False <NEW_LINE> for line in content: <NEW_LINE> <INDENT> line = line...
==== Sample (1) embedded database ==== server_encoding ----------------- UTF8 (1 row) client_encoding ----------------- UTF8 (1 row) ==== Sample (2) Oracle database ==== PARAMETER VALUE --------------------------------- NLS_CHARACTERSET UTF8 NLS_NCHAR_CHARACTERSET UTF8 ==============...
625990ba627d3e7fe0e09091
class Corpus(object): <NEW_LINE> <INDENT> def __init__(self, dictionary=None): <NEW_LINE> <INDENT> self.dictionary = {} <NEW_LINE> self.dictionary_supplied = False <NEW_LINE> self.matrix = None <NEW_LINE> if dictionary is not None: <NEW_LINE> <INDENT> self._check_dict(dictionary) <NEW_LINE> self.dictionary = dictionary...
Class for constructing a cooccurrence matrix from a corpus. A dictionary mapping words to ids can optionally be supplied. If left None, it will be constructed from the corpus.
625990bac4546d3d9def83b2
class NetStatsTest(unittest.TestCase): <NEW_LINE> <INDENT> def testInterfaceStatsGood(self): <NEW_LINE> <INDENT> dm.mrvl88601_netstats.PON_STATS_DIR = 'testdata/mrvl88601_netstats/ani' <NEW_LINE> dm.mrvl88601_netstats.ETH_STATS_DIR = 'testdata/mrvl88601_netstats/uni' <NEW_LINE> eth = dm.mrvl88601_netstats.NetdevStatsMr...
Tests for mrvl88610_netstats.py.
625990ba187af65679d2acf8
class QueueIterator(object): <NEW_LINE> <INDENT> def __init__(self, node, count): <NEW_LINE> <INDENT> self.end = node <NEW_LINE> self.count = count <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> if self.count == 0: <NEW_LINE> <INDENT> raise StopIteration <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> end = ...
QueueIterator: Iterator for LinkedQueue.
625990ba627d3e7fe0e0909d
class ArticleDetailSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> category = CategorySerializer(read_only=True) <NEW_LINE> author = StringRelatedField(read_only=True) <NEW_LINE> tags = StringRelatedField(many=True, read_only=True) <NEW_LINE> comment_count = serializers.IntegerField(read_only=True) <NEW_LI...
查询文章详情序列化器
625990ba627d3e7fe0e0909f
class PickleRepository(DiskRepository): <NEW_LINE> <INDENT> file_ending = 'pickle' <NEW_LINE> def __init__(self, storage_path): <NEW_LINE> <INDENT> DiskRepository.__init__(self, storage_path) <NEW_LINE> self.repository_types = [PickleRepository] <NEW_LINE> <DEDENT> def load(self, fp): <NEW_LINE> <INDENT> cluster = pick...
This implementation of :py:class:`AbstractClusterRepository` stores the cluster on the local disc using pickle. Therefore the cluster object and all its dependencies will be saved in a pickle (binary) file. :param str storage_path: path to the folder to store the cluster information
625990bac4546d3d9def83b9
class HealthcareProjectsLocationsDatasetsFhirStoresFhirConditionalDeleteResourceRequest(_messages.Message): <NEW_LINE> <INDENT> parent = _messages.StringField(1, required=True) <NEW_LINE> type = _messages.StringField(2, required=True)
A HealthcareProjectsLocationsDatasetsFhirStoresFhirConditionalDeleteReso urceRequest object. Fields: parent: The name of the FHIR store this resource belongs to. type: The type of the resource to update.
625990bac4546d3d9def83ba
class PretrainPanoSet(Dataset): <NEW_LINE> <INDENT> def __init__(self, meta_data_path, filter_func, transform = None): <NEW_LINE> <INDENT> self.path = meta_data_path <NEW_LINE> df = pd.read_csv(self.path) <NEW_LINE> data = [] <NEW_LINE> for idx, row in df.iterrows(): <NEW_LINE> <INDENT> if filter_func(row): <NEW_LINE> ...
extended Dataset class for pytorch fore pretrain
625990ba627d3e7fe0e090a5
class DenormalizedText(Mutable, types.TypeDecorator): <NEW_LINE> <INDENT> impl = types.Text <NEW_LINE> def __init__(self, coerce=int, separator=" ", **kwargs): <NEW_LINE> <INDENT> self.coerce = coerce <NEW_LINE> self.separator = separator <NEW_LINE> super(DenormalizedText, self).__init__(**kwargs) <NEW_LINE> <DEDENT> d...
Stores denormalized primary keys that can be accessed as a set. :param coerce: coercion function that ensures correct type is returned :param separator: separator character Source: https://github.com/imwilsonxu/fbone/blob/master/fbone/user/models.py#L13-L45
625990bac4546d3d9def83bb
class RelatedObjectLinkMixin(object): <NEW_LINE> <INDENT> link_fields = [] <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> if self.link_fields: <NEW_LINE> <INDENT> for field_name in self.link_fields: <NEW_LINE> <INDENT> func_name = field_name + '_link' <N...
Generate links to related links. Add this mixin to a Django admin model. Add a 'link_fields' attribute to the admin containing a list of related model fields and then add the attribute name with a '_link' suffix to the list_display attribute. For Example a Student model with a 'teacher' attribute would have an Admin cl...
625990ba627d3e7fe0e090a8
class PhysicalVolume: <NEW_LINE> <INDENT> def __init__(self, handle: Any) -> None: <NEW_LINE> <INDENT> self.handle = handle <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self) -> str: <NEW_LINE> <INDENT> name: bytes = lvm_pv_get_name(self.handle) <NEW_LINE> return name.decode('ascii') <NEW_LINE> <DEDENT> @property ...
A physical volume
625990bbc4546d3d9def83be
class SummarizeDeNovoCountsStepPart(FilterDeNovosBaseStepPart): <NEW_LINE> <INDENT> name = "summarize_counts" <NEW_LINE> @listify <NEW_LINE> def get_input_files(self, action): <NEW_LINE> <INDENT> _ = action <NEW_LINE> name_pattern = "{mapper}.{caller}.%sde_novos_hard.{index_library}" % (self.prev_token,) <NEW_LINE> tpl...
Step part for creating summary counts.
625990bb627d3e7fe0e090b0
class memoized(object): <NEW_LINE> <INDENT> def __init__(self, func): <NEW_LINE> <INDENT> self.func = func <NEW_LINE> self.cache = {} <NEW_LINE> <DEDENT> def __call__(self, *args): <NEW_LINE> <INDENT> args_key = repr(args) <NEW_LINE> if args_key in self.cache: <NEW_LINE> <INDENT> return self.cache[args_key] <NEW_LINE> ...
Decorator. Caches a function's return value each time it is called. If called later with the same arguments, the cached value is returned (not reevaluated).
625990bb187af65679d2ad04
class Request: <NEW_LINE> <INDENT> data = {} <NEW_LINE> def __init__(self, module): <NEW_LINE> <INDENT> self.module = module <NEW_LINE> <DEDENT> def setData(self, name, value): <NEW_LINE> <INDENT> self.data[name] = value <NEW_LINE> <DEDENT> def setDataFromFile(self, name, file): <NEW_LINE> <INDENT> self.data[name] = ba...
Request class used for prepared requests
625990bb627d3e7fe0e090b2
class ChunkedDownload(_helpers.RequestsMixin, _download.ChunkedDownload): <NEW_LINE> <INDENT> def consume_next_chunk(self, transport): <NEW_LINE> <INDENT> method, url, payload, headers = self._prepare_request() <NEW_LINE> result = _helpers.http_request( transport, method, url, data=payload, headers=headers, retry_strat...
Download a resource in chunks from a Google API. Args: media_url (str): The URL containing the media to be downloaded. chunk_size (int): The number of bytes to be retrieved in each request. stream (IO[bytes]): A write-able stream (i.e. file-like object) that will be used to concatenate chun...
625990bb187af65679d2ad05
class EncoderNet2d(_EncoderNetNd): <NEW_LINE> <INDENT> def __init__(self, channel, layers, kernel_size=3, in_planes=1, out_length=2): <NEW_LINE> <INDENT> super().__init__(2, channel=channel, layers=layers, kernel_size=kernel_size, in_planes=in_planes, out_length=out_length)
2D convolutional down-scale (encoder) network. This moule is a built-in model for convolutional network. The network could be used for down-scaling or classification. The network would down-sample and the input data according to the network depth. The depth is given by the length of the argument "layers".
625990bb187af65679d2ad08