code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class ItemSelector(BaseEstimator, TransformerMixin): <NEW_LINE> <INDENT> def __init__(self, key): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> <DEDENT> def fit(self, x, y=None): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def transform(self, data_dict): <NEW_LINE> <INDENT> return data_dict[self.key] <NEW_LINE>...
For data grouped by feature, select subset of data at a provided key. The data is expected to be stored in a 2D data structure, where the first index is over features and the second is over samples. i.e. >> len(data[key]) == n_samples Please note that this is the opposite convention to sklearn feature matrixes (whe...
62598ee492d797404e387ea5
class WM_OT_properties_edit(Operator): <NEW_LINE> <INDENT> bl_idname = "wm.properties_edit" <NEW_LINE> bl_label = "Edit Property" <NEW_LINE> bl_options = {'REGISTER'} <NEW_LINE> data_path = rna_path <NEW_LINE> property = rna_property <NEW_LINE> value = rna_value <NEW_LINE> min = rna_min <NEW_LINE> max = rna_max <NEW_LI...
Internal use (edit a property data_path)
62598ee466673b3332c2e9fc
class ReviewItem(Item): <NEW_LINE> <INDENT> id = Field() <NEW_LINE> title = Field() <NEW_LINE> url = Field() <NEW_LINE> tags = Field() <NEW_LINE> helpful_count = Field() <NEW_LINE> entries = Field() <NEW_LINE> treatment = Field() <NEW_LINE> reviewer = Field() <NEW_LINE> doctor_review = Field()
Review item.
62598ee407f4c71912badaa9
class TestDuplicationDivergenceGraph(object): <NEW_LINE> <INDENT> def test_final_size(self): <NEW_LINE> <INDENT> G = duplication_divergence_graph(3, 1) <NEW_LINE> assert len(G) == 3 <NEW_LINE> G = duplication_divergence_graph(3, 1, seed=42) <NEW_LINE> assert len(G) == 3 <NEW_LINE> <DEDENT> def test_probability_too_larg...
Unit tests for the :func:`networkx.generators.duplication.duplication_divergence_graph` function.
62598ee49c8ee8231303f482
class NotificationAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ('event', 'notification_text') <NEW_LINE> list_filter = ('event', 'notification_text') <NEW_LINE> search_fields = ['event', 'notification_text']
Admin View for NotificationAdmin
62598ee4a219f33f346c4e8e
class ForeignKeyColumn(Column): <NEW_LINE> <INDENT> parameter_defs = { "key_name": str, "collection": None, "foreign_key_name": (str, "_id"), "label_alignment" : None, "label_size_policy" : None, "visible" : (bool, False) } <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.pre = self.__class...
A column that is a foreign key, referenced by another collection. Does not create any visible widget into forms. Basically, creates a key-value pair in the collection Row schema. Does not know anything about mapping the key to a foreign table. Parameters at instantiation: :param key_name: name of the key ...
62598ee44e4d562566370a6e
class Protocol(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.channel = None <NEW_LINE> <DEDENT> def getPublicChannelNames(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def die(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def sendMessage(self, where, line): <NEW_LINE> <INDENT> pa...
General plugin functions This is also the place to define any interfaces the protocol must implement
62598ee43539df3088eca907
class _Procedure: <NEW_LINE> <INDENT> argument_class = namedtuple('Argument', ('direction', 'name', 'type')) <NEW_LINE> command_class = namedtuple('Command', ('op', 'table', 'columns')) <NEW_LINE> temptable_class = namedtuple('TempTable', ('name', 'columns')) <NEW_LINE> column_class = namedtuple('Column', ('name', 'typ...
Procedure abstraction
62598ee4fff4ab517ebcbe31
class Matcher(object): <NEW_LINE> <INDENT> def __init__(self, compare): <NEW_LINE> <INDENT> self.compare = compare <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return self.compare(other) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return repr(self.compare)
Helper for test assertions
62598ee45fdd1c0f98e5c603
class Solution: <NEW_LINE> <INDENT> def getAns(self, s): <NEW_LINE> <INDENT> lock = 1 <NEW_LINE> not_lock = 0 <NEW_LINE> for c in s: <NEW_LINE> <INDENT> if c >= 'a': <NEW_LINE> <INDENT> lock, not_lock = min(lock + 2, not_lock + 2), min(not_lock + 1, lock + 2) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> lock, not_lock...
@param s: the English word @return: The number of keystrokes
62598ee476e4537e8c3edc0d
class Solution: <NEW_LINE> <INDENT> def insertNode(self, root, node): <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return node <NEW_LINE> <DEDENT> cursor = root <NEW_LINE> while True: <NEW_LINE> <INDENT> if not cursor: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if node.val == cursor.val: <NEW_LINE> <INDENT> ...
@param root: The root of the binary search tree. @param node: insert this node into the binary search tree. @return: The root of the new binary search tree.
62598ee463d6d428bbee0e27
class Particle(object): <NEW_LINE> <INDENT> def __init__(self, position, velocity, fitness=0): <NEW_LINE> <INDENT> self.position = position <NEW_LINE> self.velocity = velocity <NEW_LINE> self.fitness = fitness <NEW_LINE> self.paramCount = len(self.position) <NEW_LINE> self.pbest = self <NEW_LINE> <DEDENT> @classmethod ...
Implementation of a single particle :param position: the position of the particle in the parameter space :param velocity: the velocity of the particle :param fitness: the current fitness of the particle
62598ee456ac1b37e6300842
class DirMeta: <NEW_LINE> <INDENT> def __init__(self, name=None): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> self._drive_metadata = None <NEW_LINE> self._creds = None <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if self.is_null(): <NEW_LINE> <INDENT> return "DirMeta::null" <NEW_LINE> <DEDENT> else: ...
This is a lightweight class that holds the metadata about a particular directory in a Drive. Note that directories are not versioned, and they do not contain any ACLs (the ACLs are attached to files or drives). Directories just provide a convenient way to group together a set of files in a Drive
62598ee47d847024c075aa24
class MinTargets(FilterBase): <NEW_LINE> <INDENT> def validate(self, item, spider): <NEW_LINE> <INDENT> return len(item.keys()) >= spider.Meta.min_targets
Filters out items that weren't able to hit a minimum number for Targets.
62598ee416aa5153ce3feb52
class Callable: <NEW_LINE> <INDENT> def __init__(self, shell, name, func, auth = None): <NEW_LINE> <INDENT> self.shell = shell <NEW_LINE> self.name = name <NEW_LINE> self.func = func <NEW_LINE> self.auth = auth <NEW_LINE> <DEDENT> def __call__(self, *args, **kwds): <NEW_LINE> <INDENT> if self.auth and (not ar...
Wrapper to call a method either directly or remotely and automagically add the authentication structure if necessary.
62598ee432920d7e50bc4682
class CommandLineAgent(RPSAgent): <NEW_LINE> <INDENT> def __init__(self, actions="[r]ock, [p]aper, [s]cissors", name=None): <NEW_LINE> <INDENT> self.actions = actions <NEW_LINE> self.name = name <NEW_LINE> self.choice = None <NEW_LINE> pass <NEW_LINE> <DEDENT> def act(self): <NEW_LINE> <INDENT> choice = None <NEW_LINE>...
Allows humans to play in the bot tournaments. Prompts user for action selection at each round. Does not cheat.
62598ee4435de62698e9a42c
class DumpUrls(SubCommand): <NEW_LINE> <INDENT> name = "dump-urls" <NEW_LINE> def __call__(self, command, options): <NEW_LINE> <INDENT> from lib.util import dump_urls <NEW_LINE> dump_urls()
Dump the URL configuration.
62598ee4379a373c97d97650
class OwnedByDriverMixin(DriverOnlyMixin, OwnerOnlyMixin): <NEW_LINE> <INDENT> def is_owner(self): <NEW_LINE> <INDENT> return self.get_object().driver == self.driver
Views mixin - only allow drivers who own the object in question to access the view.
62598ee4379a373c97d97651
class NumbersMachine(object): <NEW_LINE> <INDENT> def __init__(self, spots: int) -> None: <NEW_LINE> <INDENT> if spots == 0 or spots > 21: <NEW_LINE> <INDENT> raise TypeError("What game is this? {0}".format(spots)) <NEW_LINE> <DEDENT> self.spots = spots <NEW_LINE> <DEDENT> def draw(self) -> List[int]: <NEW_LINE> <INDEN...
Abstract number drawing machine.
62598ee42c8b7c6e89bd1e16
class QueryCountTests(AppTestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(QueryCountTests, cls).setUpClass() <NEW_LINE> cls.country_list = ( 'Mexico', 'Monaco', 'Morocco', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Romania', 'Russia', 'South Africa', ) <NEW_LINE...
Test model construction
62598ee497e22403b3839546
class BasicLinePattern: <NEW_LINE> <INDENT> __slots__ = 'line', 'vars', 're_pattern', 're', 'output' <NEW_LINE> @staticmethod <NEW_LINE> def sanitize(pattern): <NEW_LINE> <INDENT> meta = r'.^$*+?{}[]\|()' <NEW_LINE> return ''.join(r'\%s' % x if x in meta else x for x in pattern) <NEW_LINE> <DEDENT> def __init__(self, l...
Defines a pattern for a line, like 'push $1' being $1 a pattern variable
62598ee4be8e80087fbbd6a3
class AttentionBasedGRUCell(RNNCell): <NEW_LINE> <INDENT> def __init__(self, num_units, input_size=None, activation=tanh, reuse=None): <NEW_LINE> <INDENT> if input_size is not None: <NEW_LINE> <INDENT> logging.warn("%s: The input_size parameter is deprecated.", self) <NEW_LINE> <DEDENT> self._num_units = num_units <NEW...
an Attention Based Gated Recurrent Unit cell (cf. https://arxiv.org/abs/1603.01417).
62598ee4e5267d203ee69f5b
class LogoBeta(Logo): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(LogoBeta, self).__init__() <NEW_LINE> self._pic = 'beta'
具体logo类,定义了pic属性的值
62598ee48c0ade5d55dc29ae
class PublicationsRDFView(_RDFView): <NEW_LINE> <INDENT> @view_config(route_name='pub') <NEW_LINE> def __call__(self): <NEW_LINE> <INDENT> publications(self.database(), self.graph, not self.includePrivate()) <NEW_LINE> return self.serialize(self.graph)
An RDF view for publications
62598ee4a8370b77170eea3a
class PoissonGroup(Group, SpikeSource): <NEW_LINE> <INDENT> add_to_magic_network = True <NEW_LINE> @check_units(rates=Hz) <NEW_LINE> def __init__(self, N, rates, dt=None, clock=None, when='thresholds', order=0, name='poissongroup*', codeobj_class=None): <NEW_LINE> <INDENT> Group.__init__(self, dt=dt, clock=clock, when=...
Poisson spike source Parameters ---------- N : int Number of neurons rates : `Quantity`, str Single rate, array of rates of length N, or a string expression evaluating to a rate dt : `Quantity`, optional The time step to be used for the simulation. Cannot be combined with the `clock` argument. cloc...
62598ee485dfad0860cbed93
class QPushButtonRT(QPushButton): <NEW_LINE> <INDENT> def __init__(self, parent=None, text=None, margin=10): <NEW_LINE> <INDENT> if parent is not None: <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> <DEDENT> self.__lbl = QLabel(self) <NEW_LINE> s...
Subclass QPushButton to render rich text
62598ee4851cf427c66b6928
class OGRReader(object): <NEW_LINE> <INDENT> def __init__(self, source, encoding='utf-8', delimiter='', quoting='', target_epsg=4326, feature_class_name=''): <NEW_LINE> <INDENT> if hasattr(source, 'name'): <NEW_LINE> <INDENT> s = source.name <NEW_LINE> source.close() <NEW_LINE> source = s <NEW_LINE> <DEDENT> self.encod...
OGRReader for supported OGR formats. Partially (duck-typed) compatible with csv.DictReader. Args: source (bytes): Complete path to the source file. encoding (Optional[bytes]): Encoding string. Defaults to 'utf-8'. delimiter (Optional[bytes]): Unused. Here for compatibility. quoting (Optional[bytes]): U...
62598ee492d797404e387ea6
class EncodingError(Exception): <NEW_LINE> <INDENT> pass
This error is raised when some data cannot be encoded into a vector. The most common reason for this error is that information hiding algorithm, e.g., steganography or watermarking, cannot fit the data in the space available.
62598ee47d847024c075aa25
class ProfileForm(messages.Message): <NEW_LINE> <INDENT> displayName = messages.StringField(1) <NEW_LINE> mainEmail = messages.StringField(2) <NEW_LINE> teeShirtSize = messages.EnumField('TeeShirtSize', 3) <NEW_LINE> conferenceKeysToAttend = messages.StringField(4, repeated=True) <NEW_LINE> sessionKeysInWishList = mess...
ProfileForm -- Profile outbound form message
62598ee4656771135c487cea
class Edge(Component): <NEW_LINE> <INDENT> def __init__(self, identifier, origin, target, colour=0): <NEW_LINE> <INDENT> super().__init__(identifier) <NEW_LINE> self._set_origin(origin) <NEW_LINE> self._set_target(target) <NEW_LINE> self.set_colour(colour) <NEW_LINE> <DEDENT> def _set_origin(self, origin): <NEW_LINE> <...
An edge joining two vertices.
62598ee43eb6a72ae0388c99
class RegisterView(View): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> return render(request, 'register.html') <NEW_LINE> <DEDENT> def post(self, request): <NEW_LINE> <INDENT> user_name = request.POST.get('user_name') <NEW_LINE> pwd = request.POST.get('pwd') <NEW_LINE> email = request.POST.get('email...
类视图, 注册:提供注册页面和实现注册逻辑
62598ee4f548e778e5969bec
class Application(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def factory(cls, global_config, **local_config): <NEW_LINE> <INDENT> return cls(**local_config) <NEW_LINE> <DEDENT> def __call__(self, environ, start_response): <NEW_LINE> <INDENT> raise NotImplementedError(_('You must implement __call__'))
Base WSGI application wrapper. Subclasses need to implement __call__.
62598ee4f7d966606f746647
class McGyver(Entity): <NEW_LINE> <INDENT> def __init__(self, position, name, sprite): <NEW_LINE> <INDENT> super().__init__(position, name, sprite) <NEW_LINE> self.inventory = [] <NEW_LINE> <DEDENT> def move(self, direction): <NEW_LINE> <INDENT> self.position = self.position[0] + direction[0], self.position[1] + direct...
McGyver is our player class,a special entity: it inherits every traits of the Entity class, but can moves and is also recognized as the player entity by the gamemanager.
62598ee4d58c6744b42db5e2
class Notifier(with_metaclass(ABCMeta, object)): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def notify(self, event): <NEW_LINE> <INDENT> raise NotImplemented <NEW_LINE> <DEDENT> def info(self, message): <NEW_LINE> <INDENT> self.notify({'type': 'info', 'message': message}) <NEW_LINE> <DEDENT> def debug(self, message...
Notifiers send build system events to a front end or may implement a front end themselves, displaying warnings and errors for a user. This is different from a logger in a few ways: * The structure of the events are defined by this interface. * A "progress" level is included allowing signaling completion status to ...
62598ee4c432627299fa160e
class Encoder(nn.Module): <NEW_LINE> <INDENT> def __init__( self, embedding_dim=64, rep_dim=64, h_dim=64, mlp_dim=1024, num_layers=1, obs_len=8, dropout=0.0, pos_embed=True, pos_embed_freq=100, activation='relu', batch_norm=False ): <NEW_LINE> <INDENT> super(Encoder, self).__init__() <NEW_LINE> self.pos_embed_flag = po...
Encoder is part of both TrajectoryGenerator and TrajectoryDiscriminator
62598ee41f037a2d8b9e275e
class State1Form(auth.forms.UserCreationForm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.request = kwargs.pop('request') <NEW_LINE> super(State1Form, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def save(self, commit=True): <NEW_LINE> <INDENT> user = super(State1Form, self...
Firstboot state 1: create a new user.
62598ee456ac1b37e6300844
class OFFLOAD_STATUS4args(BaseObj): <NEW_LINE> <INDENT> _strfmt1 = "FH:{fh:crc32} stid:{0}" <NEW_LINE> _attrlist = ("stateid",) <NEW_LINE> def __init__(self, unpack): <NEW_LINE> <INDENT> self.stateid = stateid4(unpack) <NEW_LINE> self.fh = self.nfs4_fh
struct OFFLOAD_STATUS4args { /* CURRENT_FH: destination file */ stateid4 stateid; };
62598ee4dd821e528d6d759c
class Tcp_Half_Opens(Collection): <NEW_LINE> <INDENT> def __init__(self, monitor): <NEW_LINE> <INDENT> super(Tcp_Half_Opens, self).__init__(monitor) <NEW_LINE> fixed = self._meta_data['uri'].replace('_', '-') <NEW_LINE> self._meta_data['uri'] = fixed <NEW_LINE> self._meta_data['allowed_lazy_attributes'] = [Tcp_Half_Ope...
BIG-IP® Tcp half open monitor collection.
62598ee46aa9bd52df0d3507
class DataprocProjectsClustersAgentsUpdateRequest(_messages.Message): <NEW_LINE> <INDENT> agent = _messages.MessageField('Agent', 1) <NEW_LINE> agentId = _messages.StringField(2, required=True) <NEW_LINE> clusterUuid = _messages.StringField(3, required=True) <NEW_LINE> projectId = _messages.StringField(4, required=True...
A DataprocProjectsClustersAgentsUpdateRequest object. Fields: agent: A Agent resource to be passed as the request body. agentId: [Required] ID of agent sending the update. clusterUuid: The cluster on which the agent is running. projectId: The agent's project.
62598ee4b7558d5895461c9d
class TestDoubleAsterisk(UnitTestCase): <NEW_LINE> <INDENT> def test_double_asterisk_no_match(self): <NEW_LINE> <INDENT> self.assertEqual(inc_sel_dir(u"/test/folder/**", u"/test/foo"), None) <NEW_LINE> <DEDENT> def test_double_asterisk_match(self): <NEW_LINE> <INDENT> self.assertEqual(inc_sel_dir(u"/test/folder/**", u"...
Test glob matching where the glob finishes with a **
62598ee4f9cc0f698b1c45fa
class KRR: <NEW_LINE> <INDENT> def __init__(self, X, T, kernel, c=0, d=2, s=1, gamma=1): <NEW_LINE> <INDENT> self.T = T <NEW_LINE> self.X = X <NEW_LINE> self.kernel = kernel <NEW_LINE> self.weights = None <NEW_LINE> self.lam = None <NEW_LINE> self.N = len(X) <NEW_LINE> self.D = len(X[0]) <NEW_LINE> self.c = c <NEW_LINE...
Kernel Ridge Regression X: Array containing input vectors x T: Array containing target vectors t
62598ee48e7ae83300ee76e7
class UserPost(object): <NEW_LINE> <INDENT> def __init__(self, username=None, password=None, first_name=None, last_name=None, email=None): <NEW_LINE> <INDENT> self.swagger_types = { 'username': 'str', 'password': 'str', 'first_name': 'str', 'last_name': 'str', 'email': 'str' } <NEW_LINE> self.attribute_map = { 'usernam...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598ee430dc7b766599dedf
class CoreConfiguration(ConfigurationObject): <NEW_LINE> <INDENT> @property <NEW_LINE> def processes(self): <NEW_LINE> <INDENT> return self._getint('processes') <NEW_LINE> <DEDENT> @property <NEW_LINE> def syslog_bind_host(self): <NEW_LINE> <INDENT> return _host_tuple(self._get('syslog_bind_host')) <NEW_LINE> <DEDENT> ...
Class mapping for the Portal configuration section 'core'
62598ee44e4d562566370a71
class EntityFilter(_messages.Message): <NEW_LINE> <INDENT> kinds = _messages.StringField(1, repeated=True) <NEW_LINE> namespaceIds = _messages.StringField(2, repeated=True)
Identifies a subset of Entities in a Project. This is specified as combinations of Kind + Namespace (either or both of which may be all as described in the following examples). Example usage: Entire Project: kinds=[], namespace_ids=[] Kinds Foo and Bar in all Namespaces: kinds=['Foo', 'Bar'], namespace_ids=[] Kinds...
62598ee47d43ff2487426727
class TextEntryDialog(object): <NEW_LINE> <INDENT> def __init__(self, parent, message, title): <NEW_LINE> <INDENT> self.parent = parent <NEW_LINE> xml = gtk.glade.XML('ui/pygmail.glade', 'TextEntryDialog', 'pygmail') <NEW_LINE> self.dialog = xml.get_widget('TextEntryDialog') <NEW_LINE> xml.get_widget('ted_question_labe...
Shows a dialog with a single line of text
62598ee499cbb53fe682f508
class AdminPageRegistry(dict): <NEW_LINE> <INDENT> def unregister(self, name): <NEW_LINE> <INDENT> del self[name] <NEW_LINE> <DEDENT> def register(self, name, template, permission): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> get_template(template) <NEW_LINE> <DEDENT> except TemplateDoesNotExist: <NEW_LINE> <INDENT> r...
Dict with methods for handling admin template registration.
62598ee48a43f66fc4bf07ca
class SlideLeft(Slide): <NEW_LINE> <INDENT> dx, dy = -1.0, 0.0
slide to the left
62598ee444b2445a339b5c93
class DiscoveryRunner(DjangoTestSuiteRunner): <NEW_LINE> <INDENT> def build_suite(self, test_labels, extra_tests=None, **kwargs): <NEW_LINE> <INDENT> suite = None <NEW_LINE> discovery_root = settings.TEST_DISCOVERY_ROOT <NEW_LINE> if test_labels: <NEW_LINE> <INDENT> suite = defaultTestLoader.loadTestsFromNames( test_la...
A test suite runner using unittest2 discovery.
62598ee4a8370b77170eea3c
class CriterionSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> answer_choices = serializers.SerializerMethodField(read_only=True) <NEW_LINE> def get_answer_choices(self, obj): <NEW_LINE> <INDENT> return Vote.ANSWER_CHOICES <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> model = Criterion <NEW_LINE> fie...
Serializer of the Criterion model, used for reading the detail of a criterion, includes the answer choices of the criterion. Used in AllChallengesSerializer.
62598ee42eb69b55b15a06b5
class Backend(object): <NEW_LINE> <INDENT> UNDEFINED = "undefined" <NEW_LINE> GLOO = "gloo" <NEW_LINE> NCCL = "nccl" <NEW_LINE> MPI = "mpi" <NEW_LINE> TCP = "tcp" <NEW_LINE> def __new__(cls, name): <NEW_LINE> <INDENT> if not isinstance(name, string_classes): <NEW_LINE> <INDENT> raise ValueError("Backend name must be a ...
An enum-like class of available backends: GLOO, NCCL, and MPI. The values of this class are lowercase strings, e.g., ``"gloo"``. They can be accessed as attributes, e.g., ``Backend.NCCL``. This class can be directly called to parse the string, e.g., ``Backend(backend_str)`` will check if ``backend_str`` is valid, and...
62598ee44a966d76dd5ed53c
class MapBindProvider(ListOfProviders[Dict[str, T]]): <NEW_LINE> <INDENT> def get(self, injector: 'Injector') -> Dict[str, T]: <NEW_LINE> <INDENT> map: Dict[str, T] = {} <NEW_LINE> for provider in self._providers: <NEW_LINE> <INDENT> map.update(provider.get(injector)) <NEW_LINE> <DEDENT> return map
A provider for map bindings.
62598ee4a17c0f6771d5a8ac
class FilterPlacesByCategoriesInputSet(InputSet): <NEW_LINE> <INDENT> def set_APIKey(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'APIKey', value) <NEW_LINE> <DEDENT> def set_APISecret(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'APISecret', value) <NEW_LINE> <DEDENT> def set_Category(sel...
An InputSet with methods appropriate for specifying the inputs to the FilterPlacesByCategories Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
62598ee40c0af96317c549f5
class BehindShockWave(): <NEW_LINE> <INDENT> temperature_bsw: float <NEW_LINE> number_of_moles_bsw: int <NEW_LINE> pressure_bsw: float <NEW_LINE> velocity_bsw: float <NEW_LINE> n_n2: float = 0.79 <NEW_LINE> n_o2: float = 0.21 <NEW_LINE> def set_macroscopic_parametrs(self, temperature0: float, mach0: int, pressure0: flo...
Класс для расчета параметров за ударной валной гармонического оссацилятора , на вход падаются параметры в набегающем потоке Концентрация азота N2 и O2 - 79% и 21% соответственно
62598ee430bbd72246468292
class PolySpline(PolyLine): <NEW_LINE> <INDENT> _attributes = {'colour': 'black', 'width': 1, 'style': PENSTYLE_SOLID, 'legend': ''} <NEW_LINE> def __init__(self, points, **attr): <NEW_LINE> <INDENT> PolyLine.__init__(self, points, **attr) <NEW_LINE> <DEDENT> def draw(self, dc, printerScale, coord=None): <NEW_LINE> <IN...
Class to define line type and style - All methods except __init__ are private.
62598ee4aad79263cf42ce63
class serverFtpProtocol(basic.Int32StringReceiver): <NEW_LINE> <INDENT> def connectionMade(self): <NEW_LINE> <INDENT> self.peer = self.transport.getPeer() <NEW_LINE> self.recv = False <NEW_LINE> self.sendingto = [] <NEW_LINE> self.factory.updateClients(self) <NEW_LINE> <DEDENT> def stringReceived(self, line): <NEW_LINE...
Implements the server ftp protocol
62598ee47cff6e4e811b4046
class SpiceTest(object): <NEW_LINE> <INDENT> def __init__(self, test, parameters, env): <NEW_LINE> <INDENT> logging.getLogger().setLevel(logging.INFO) <NEW_LINE> utils.extend_api_vm() <NEW_LINE> logger.info("Start test %s", test.name) <NEW_LINE> self.cfg = AttributeDict() <NEW_LINE> self.cfg.update(parameters) <NEW_LIN...
Perform some basic initialization steps. Parameters ---------- test : avocado.core.plugins.vt.VirtTest QEMU test object. params : virttest.utils_params.Params Dictionary with the test parameters. env : virttest.utils_env.Env Dictionary with test environment. Raises ------ utils.SpiceTestFail S...
62598ee43539df3088eca90b
class Like(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(XabrUser, on_delete=models.CASCADE) <NEW_LINE> slug = models.SlugField(verbose_name='URL', max_length=70, default='') <NEW_LINE> is_active = models.BooleanField(verbose_name='активна', default=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose...
модель лайков к постам
62598ee4eab8aa0e5d30a3d1
class DeleteCCLevelPolicyResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RequestId = params.get("RequestId")
DeleteCCLevelPolicy返回参数结构体
62598ee4c432627299fa1610
class StyleguideMixin: <NEW_LINE> <INDENT> STYLEGUIDE = { "fonts": ["hind", "montserrat"], "palette": [ "black", "dark-grey", "charcoal", "slate-grey", "battleship-grey", "light-grey", "silver", "azure2", "smoke", "white", "cerulean", "steelblue3", "denim", "dodgerblue4", "navy", "blue-green", "greeny-blue", "mediumtur...
Theme styleguide reference Only used to build styleguide page without to hardcode properties and values into styleguide template.
62598ee463d6d428bbee0e2a
class MoveBox(FloatLayout): <NEW_LINE> <INDENT> layout_content = ObjectProperty(None) <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> Clock.schedule_once( lambda _: self.layout_content.bind( minimum_height=self.layout_content.setter('height') ) ) <NEW_LINE> <DEDENT> de...
The box that holds the table of moves. This needs pretty much no functionality besides what is already there, so it shouldn't change that much.
62598ee4aad79263cf42ce64
class TestBillPresentmentResponse(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 testBillPresentmentResponse(self): <NEW_LINE> <INDENT> pass
BillPresentmentResponse unit test stubs
62598ee4442bda511e95aaba
class Teeth(Item): <NEW_LINE> <INDENT> shown = False <NEW_LINE> def drop(self): <NEW_LINE> <INDENT> world.print('You try to pull your teeth out of your skull, but they\'re firmly rooted') <NEW_LINE> return False
The only set of teeth you'll get, take care of them
62598ee432920d7e50bc4686
class PubkeySerializer(object): <NEW_LINE> <INDENT> def __init__(self, esc="", ): <NEW_LINE> <INDENT> self.esc = esc <NEW_LINE> return <NEW_LINE> <DEDENT> def __call__(self, obj): <NEW_LINE> <INDENT> if isinstance(obj, ProceduralPublicKey): <NEW_LINE> <INDENT> return self.esc + "publickey:" + obj.name + self.esc <NEW_L...
We want to defer substitution of public keys to a later date. I.e. we generate an object of a format roughly like this: {"tx" : {"operations" : [{"type" : "account_create_operation", "value" : { "creator" : "alice", "new_account_name" : "bob", "memo_key" : "bob-memo", ...}}]}, "signers" : ["alice-active"], "p...
62598ee466656f66f7d58a3a
class Group(object): <NEW_LINE> <INDENT> swagger_types = { 'id': 'str', 'name': 'str', 'description': 'str', 'links': 'OrganisationLinks' } <NEW_LINE> attribute_map = { 'id': 'id', 'name': 'name', 'description': 'description', 'links': '_links' } <NEW_LINE> def __init__(self, id=None, name=None, description=None, links...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598ee48e7ae83300ee76e8
class GenesOverlaps(SegmentsOverlaps): <NEW_LINE> <INDENT> pattern = "(.*)_segments_genes_overlaps$" <NEW_LINE> mTable = "_segments_genes_overlaps"
Return overlaps between genes.
62598ee48da39b475be01805
class RegexMatch(object): <NEW_LINE> <INDENT> def __init__(self, line_object): <NEW_LINE> <INDENT> self.line_text = line_object.line_content <NEW_LINE> self.param_groups = dict() <NEW_LINE> self.regex = None <NEW_LINE> self.primary_key = None <NEW_LINE> self.guessed_pattern_matches = dict() <NEW_LINE> self._guess_regex...
Container for information about line and corresponding regex Keeps own data integrity - especially consistency between regex and groups (param_groups). Verifies updates. :param line_text: raw string of the line :param param_groups: represents params from text (catched by regex groups) :param regex: regex matching to l...
62598ee47d43ff2487426728
class SpecialWordFinder(WordFinder): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> super().__init__(path) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def read_file(self, file): <NEW_LINE> <INDENT> return [word.strip() for word in file if word.strip() and not word.startswith('#')]
Finds words and searches around comments(#) and blank lines
62598ee444b2445a339b5c94
class TaskType(ReferralLookup): <NEW_LINE> <INDENT> initial_state = models.ForeignKey( TaskState, on_delete=models.PROTECT, limit_choices_to=Q(effective_to__isnull=True), help_text="The initial state for this task type.", ) <NEW_LINE> target_days = models.IntegerField( default=35, help_text="Time limit to fall back on ...
Lookup table of the types of user tasks that can be recorded in the database. All task types have a default initial status and time limit. Due date is required in tasks, but if the user doesn't supply it then we need something to fall back on. This is an arbitrary number which can be changed for each type.
62598ee48c0ade5d55dc29b0
class StcProtocolException(Exception): <NEW_LINE> <INDENT> pass
High-level protocol issue, like wrong packet type
62598ee42eb69b55b15a06b6
class Solution_2: <NEW_LINE> <INDENT> def ladderLength(self, beginWord, endWord, wordList): <NEW_LINE> <INDENT> q = deque() <NEW_LINE> length = {beginWord: 0} <NEW_LINE> q.append(beginWord) <NEW_LINE> wordListSet = set(wordList) <NEW_LINE> while q: <NEW_LINE> <INDENT> word = q.popleft() <NEW_LINE> if word == endWord: <...
Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a time. Each transformed word must exist in the word list. Note that beginWord is not a transformed word. For example, Give...
62598ee46e29344779afec8a
class HydraCollectionOp(): <NEW_LINE> <INDENT> def __init__(self, id_, type_, method, desc, expects, returns, status=[]): <NEW_LINE> <INDENT> self.id_ = id_ <NEW_LINE> self.type_ = type_ <NEW_LINE> self.method = method <NEW_LINE> self.desc = desc <NEW_LINE> self.returns = returns <NEW_LINE> self.expects = expects <NEW_...
Operation class for Collection operations.
62598ee44428ac0f6e656bad
class TestAuthRealm(object): <NEW_LINE> <INDENT> implements(portal.IRealm) <NEW_LINE> def requestAvatar(self, avatarId, mind, *interfaces): <NEW_LINE> <INDENT> if IHTTPUser in interfaces: <NEW_LINE> <INDENT> if avatarId == checkers.ANONYMOUS: <NEW_LINE> <INDENT> return IHTTPUser, TestHTTPUser('anonymous') <NEW_LINE> <D...
Test realm that supports the IHTTPUser interface
62598ee476e4537e8c3edc12
class Tag: <NEW_LINE> <INDENT> def __init__(self, name, start, end, line, pos): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> self.line = line <NEW_LINE> self.pos = pos
Represents a single template tag
62598ee4d486a94d0ba2a627
class ParametrizedSingleton(type): <NEW_LINE> <INDENT> def __init__(cls, *args, **kwargs): <NEW_LINE> <INDENT> cls.__instances = weakref.WeakValueDictionary() <NEW_LINE> <DEDENT> def __singleton_key__(cls, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def __call__(cls, *args, **kwa...
A metaclass that allows class construction to reuse an existing instance. We use this so that :class:`RisingEdge(sig) <cocotb.triggers.RisingEdge>` and :class:`Join(coroutine) <cocotb.triggers.Join>` always return the same instance, rather than creating new copies.
62598ee4a79ad16197768673
class Fetcher(object): <NEW_LINE> <INDENT> def __init__(self, normal_max_repeat=3, normal_sleep_time=3, critical_max_repeat=10, critical_sleep_time=10): <NEW_LINE> <INDENT> self.normal_max_repeat = normal_max_repeat <NEW_LINE> self.normal_sleep_time = normal_sleep_time <NEW_LINE> self.critical_max_repeat = critical_max...
class of Fetcher, must include function working() and url_fetch()
62598ee4925a0f43d25e6688
class CloudTrail(object): <NEW_LINE> <INDENT> def __init__(self, b3_cloudtrail): <NEW_LINE> <INDENT> self._trails = b3_cloudtrail.describe_trails( trailNameList=[], includeShadowTrails=False )["trailList"] <NEW_LINE> self._trail_statuses = {} <NEW_LINE> self._event_selectors = {} <NEW_LINE> for trail in self._trails: <...
Retrieves CloudTrail information and uses it accordingly. Args: b3_cloudtrail: boto3 cloudtrail client
62598ee4097d151d1a2bf67a
class WikiartArtistsExtractor(WikiartExtractor): <NEW_LINE> <INDENT> subcategory = "artists" <NEW_LINE> pattern = (BASE_PATTERN + r"/artists-by-([\w-]+)/([\w-]+)") <NEW_LINE> test = ("https://www.wikiart.org/en/artists-by-century/12", { "pattern": WikiartArtistExtractor.pattern, "count": ">= 8", }) <NEW_LINE> def __ini...
Extractor for artist collections on wikiart.org
62598ee47047854f4633da2f
class ContrastiveCosineObjective(BaseContrastiveObjective): <NEW_LINE> <INDENT> def __init__(self, weight=0.5, margin=2): <NEW_LINE> <INDENT> super(ContrastiveCosineObjective, self).__init__( weight=weight, margin=margin) <NEW_LINE> <DEDENT> def forward(self, enc1, enc2, **kwargs): <NEW_LINE> <INDENT> return -F.cosine_...
Implementation from "Learning Text Similarity with Siamese Recurrent Networks" http://www.aclweb.org/anthology/W16-1617 It diverges from original "contrastive loss" definition by Chopra et al 2005, based on euclidean distance instead of cosine (which makes sense for text). L_+(x_1, x_2, y) = weight * (1 - cosine_simil...
62598ee421a7993f00c645c7
class Terminal: <NEW_LINE> <INDENT> esc = '\x1b[' <NEW_LINE> erase_line = esc + '2K' <NEW_LINE> erase_down = esc + 'J' <NEW_LINE> erase_up = esc + '1J' <NEW_LINE> erase_screen = esc + '2J' <NEW_LINE> save_cursor = esc + 's' <NEW_LINE> unsave_cursor = esc + 'u' <NEW_LINE> def __init__(self, stdout=None, stdin=None, prom...
Virtual terminal
62598ee460cbc95b06362997
class Singleton: <NEW_LINE> <INDENT> def __init__(self, klass): <NEW_LINE> <INDENT> self.klass = klass <NEW_LINE> self.instance = None <NEW_LINE> <DEDENT> def __call__(self, *args, **kwds): <NEW_LINE> <INDENT> if self.instance == None: <NEW_LINE> <INDENT> self.instance = self.klass(*args, **kwds) <NEW_LINE> <DEDENT> re...
Python implementation for a singleton used by OrderStats
62598ee49c8ee8231303f485
class ArrayQueue(AbstractCollection): <NEW_LINE> <INDENT> DEFAULT_CAPACITY = 10 <NEW_LINE> def __init__(self, sourceCollection = None): <NEW_LINE> <INDENT> self._items = Array(ArrayQueue.DEFAULT_CAPACITY) <NEW_LINE> AbstractCollection.__init__(self, sourceCollection) <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <...
An array-based queue implementation.
62598ee4aad79263cf42ce65
class LinkCol(Col): <NEW_LINE> <INDENT> def __init__( self, name, endpoint, attr=None, attr_list=None, url_kwargs=None, url_kwargs_extra=None, anchor_attrs=None, text_fallback=None, **kwargs ): <NEW_LINE> <INDENT> super(LinkCol, self).__init__(name, attr=attr, attr_list=attr_list, **kwargs) <NEW_LINE> self.endpoint = e...
Format the content as a link. Requires a endpoint to use to find the url and can also take a dict of url_kwargs which is expected to have values that are strings which are used to get data from the item. Eg: view = LinkCol('View', 'view_fn', url_kwargs=dict(id='id')) This will create a link to the address given by u...
62598ee4f7d966606f74664b
class DefaultBackend(object): <NEW_LINE> <INDENT> def register(self, request, **kwargs): <NEW_LINE> <INDENT> username, email, password = kwargs['username'], kwargs['email'], kwargs['password1'] <NEW_LINE> try: <NEW_LINE> <INDENT> User.objects.get(email__iexact=email) <NEW_LINE> return User.objects.get(email__iexact=ema...
A registration backend which follows a simple workflow: 1. User signs up, inactive account is created. 2. Email is sent to user with activation link. 3. User clicks activation link, account is now active. Using this backend requires that * ``registration`` be listed in the ``INSTALLED_APPS`` setting (since this ...
62598ee44e4d562566370a74
class TemplateEmail(TemplateEmailMixin, BaseMultipartEmail): <NEW_LINE> <INDENT> def get_html_body(self): <NEW_LINE> <INDENT> return self.render() <NEW_LINE> <DEDENT> def get_body(self): <NEW_LINE> <INDENT> html_body = self.render() <NEW_LINE> return strip_tags(html_body)
Provide HTML/plain text mail from template for given model instance.
62598ee43539df3088eca90d
class FormsResponse(object): <NEW_LINE> <INDENT> openapi_types = { 'pagination': 'Pagination', 'data': 'list[FormFullResponse]' } <NEW_LINE> attribute_map = { 'pagination': 'pagination', 'data': 'data' } <NEW_LINE> def __init__(self, pagination=None, data=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if loc...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
62598ee41f037a2d8b9e2762
class IBotoManageable(Interface): <NEW_LINE> <INDENT> pass
Marker for Computes controlled through the boto library.
62598ee416aa5153ce3feb58
class DescribeAssetRecentMachineInfoRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.BeginDate = None <NEW_LINE> self.EndDate = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.BeginDate = params.get("BeginDate") <NEW_LINE> self.EndDate = params.g...
DescribeAssetRecentMachineInfo请求参数结构体
62598ee432920d7e50bc4688
class Rating(models.Model): <NEW_LINE> <INDENT> count = models.PositiveIntegerField(default=0) <NEW_LINE> total = models.PositiveIntegerField(default=0) <NEW_LINE> average = models.DecimalField(max_digits=6, decimal_places=3, default=Decimal(0.0)) <NEW_LINE> content_type = models.ForeignKey( ContentType, null=True, bla...
Attaches Rating models and running counts to the model being rated via a generic relation.
62598ee42c8b7c6e89bd1e1c
class AcceptReferralEffectProps(object): <NEW_LINE> <INDENT> openapi_types = { 'value': 'str' } <NEW_LINE> attribute_map = { 'value': 'value' } <NEW_LINE> def __init__(self, value=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_LINE> <INDENT> local_vars_configuration ...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
62598ee48c0ade5d55dc29b1
class DnfUpgradeTransaction(Actor): <NEW_LINE> <INDENT> name = 'dnf_upgrade_transaction' <NEW_LINE> consumes = ( DNFPluginTask, DNFWorkaround, FilteredRpmTransactionTasks, RHSMInfo, StorageInfo, TargetUserSpaceInfo, UsedTargetRepositories, ) <NEW_LINE> produces = (TransactionCompleted,) <NEW_LINE> tags = (RPMUpgradePha...
Setup and call DNF upgrade command Based on previously calculated RPM transaction data, this actor will setup and call rhel-upgrade DNF plugin with necessary parameters
62598ee42eb69b55b15a06b7
class DateTimeSchema(ElementarySchema): <NEW_LINE> <INDENT> __data_types__ = [datetime] <NEW_LINE> ms = IntegerSchema(nullable=True, default=None) <NEW_LINE> s = IntegerSchema(nullable=True, default=None) <NEW_LINE> mn = IntegerSchema(nullable=True, default=None) <NEW_LINE> hr = IntegerSchema(nullable=True, default=Non...
Date time schema.
62598ee432920d7e50bc4689
class Solution: <NEW_LINE> <INDENT> def longestPalindrome(self, s): <NEW_LINE> <INDENT> if s is None or len(s) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> setS = {a: s.count(a) for a in set(s)} <NEW_LINE> hasOdd = False <NEW_LINE> palindromeLen = 0 <NEW_LINE> for i in setS.values(): <NEW_LINE> <INDENT> if i ...
@param s: a string which consists of lowercase or uppercase letters @return: the length of the longest palindromes that can be built
62598ee42ae34c7f260a9743
class Priveledges(): <NEW_LINE> <INDENT> def __init__(self, priveledges=['can add post', 'can approve new member', 'can delete post']): <NEW_LINE> <INDENT> self.priveledges = priveledges <NEW_LINE> <DEDENT> def show_priveledges(self): <NEW_LINE> <INDENT> print("\nAdmin users have the following special priveledges:") <N...
Display user priveledges.
62598ee423849d37ff84f711
class CollectedLinks(object): <NEW_LINE> <INDENT> def __init__( self, files, find_links, pages, ): <NEW_LINE> <INDENT> self.files = files <NEW_LINE> self.find_links = find_links <NEW_LINE> self.pages = pages
Encapsulates all the Link objects collected by a call to LinkCollector.collect_links(), stored separately as-- (1) links from the configured file locations, (2) links from the configured find_links, and (3) a dict mapping HTML page url to links from that page.
62598ee4fbf16365ca7926ff
class BadRequestError(APIError): <NEW_LINE> <INDENT> pass
The request could not be understood due to bad syntax. Check your request and try again.
62598ee46fb2d068a7693151
class StateVectorMixin: <NEW_LINE> <INDENT> def __init__(self, qubit_map: Optional[Dict[ops.Qid, int]] = None, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self._qubit_map = qubit_map or {} <NEW_LINE> qid_shape = simulator._qubit_map_to_shape(self._qubit_map) <NEW_LINE> self._qid_s...
A mixin that provide methods for objects that have a state vector.
62598ee426068e7796d4afb9
class FunctionalTest(StaticLiveServerTestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> for arg in sys.argv: <NEW_LINE> <INDENT> if 'liveserver' in arg: <NEW_LINE> <INDENT> cls.server_host = arg.split('=')[1] <NEW_LINE> cls.server_url = 'http://' + cls.server_host <NEW_LINE>...
docstring for FunctionalTest
62598ee40a50d4780f703a06
class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler): <NEW_LINE> <INDENT> def get(self, resource): <NEW_LINE> <INDENT> briefname = self.request.get('brief') <NEW_LINE> briefmail = self.request.get('bmail') <NEW_LINE> lastmod = self.request.get('lastmod') <NEW_LINE> lang = self.request.get('lang') <NEW_LINE> ...
Download the ebook
62598ee4baa26c4b54d4d92c
class UploadForm(forms.Form): <NEW_LINE> <INDENT> spreadsheet = forms.FileField(label='Upload Spreadsheet') <NEW_LINE> def clean_spreadsheet(self): <NEW_LINE> <INDENT> spreadsheet = self.cleaned_data.get('spreadsheet', None) <NEW_LINE> if spreadsheet is not None: <NEW_LINE> <INDENT> _, ext = os.path.splitext(spreadshee...
will accept XLS, clean and collect values as list of dicts
62598ee4a219f33f346c4e96
class DatetimeWithNanoseconds(datetime.datetime): <NEW_LINE> <INDENT> __slots__ = ("_nanosecond",) <NEW_LINE> def __new__(cls, *args, **kw): <NEW_LINE> <INDENT> nanos = kw.pop("nanosecond", 0) <NEW_LINE> if nanos > 0: <NEW_LINE> <INDENT> if "microsecond" in kw: <NEW_LINE> <INDENT> raise TypeError("Specify only one of '...
Track nanosecond in addition to normal datetime attrs. Nanosecond can be passed only as a keyword argument.
62598ee430bbd72246468296