code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LiveTornadoTestCase(TransactionTestCase): <NEW_LINE> <INDENT> static_handler = None <NEW_LINE> @property <NEW_LINE> def live_server_url(self): <NEW_LINE> <INDENT> return 'http://%s:%s' % ( self.server_thread.host, self.server_thread.port) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE>... | Does basically the same as TransactionTestCase but also launches a live
http server in a separate thread so that the tests may use another testing
framework, such as Selenium for example, instead of the built-in dummy
client.
Note that it inherits from TransactionTestCase instead of TestCase because
the threads do not ... | 625990601f5feb6acb16428a |
class GaussianBlur(albu.GaussianBlur): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> blur_limit = args[0]["blur_limit"] if "blur_limit" in args[0].keys() else (3, 7) <NEW_LINE> sigma_limit = args[0]["blur_limit"] if "blur_limit" in args[0].keys() else 0 <NEW_LINE> always_apply = bool(args[0]["alway... | Blur the input image using using a Gaussian filter with a random kernel size.
Args:
blur_limit (int, (int, int)): maximum Gaussian kernel size for blurring the input image.
Must be zero or odd and in range [0, inf). If set to 0 it will be computed from sigma
as `round(sigma * (3 if img.dtype == np.... | 625990608a43f66fc4bf382e |
class DescribeRuleSetsResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.L4RuleSets = None <NEW_LINE> self.L7RuleSets = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("L4RuleSets") is not None: <NEW_LINE>... | DescribeRuleSets返回参数结构体
| 625990602ae34c7f260ac786 |
class UnknownProtocolError(BaseWsException): <NEW_LINE> <INDENT> _message = "Unknown protocol" | An exception for denoting that a network protocol is not known. | 62599060adb09d7d5dc0bc0a |
class ConnectionPool(object): <NEW_LINE> <INDENT> scheme = None <NEW_LINE> QueueCls = LifoQueue <NEW_LINE> def __init__(self, host, port=None): <NEW_LINE> <INDENT> if not host: <NEW_LINE> <INDENT> raise LocationValueError("No host specified.") <NEW_LINE> <DEDENT> self.host = host <NEW_LINE> self.port = port <NEW_LINE> ... | Base class for all connection pools, such as
:class:`.HTTPConnectionPool` and :class:`.HTTPSConnectionPool`. | 62599060097d151d1a2c270f |
class NetScience(DataSet): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _process(self): <NEW_LINE> <INDENT> V = {} <NEW_LINE> tree = ET.parse("datasets/netscience.xml") <NEW_LINE> for node in tree.iter("node"): <NEW_LINE> <INDENT> attrs = node.attrib <NEW_LINE> V[attrs['id']]... | Process netscience data set | 6259906038b623060ffaa3a0 |
class TimeoutLock(object): <NEW_LINE> <INDENT> def __init__(self, lock, timeout): <NEW_LINE> <INDENT> self.lock = lock <NEW_LINE> self.timeout = timeout <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.acquire() <NEW_LINE> return self <NEW_LINE> <DEDENT> def __exit__(self, type, value, tb): <NEW_LINE> ... | Provide lock functionality with a timeout. | 625990601f037a2d8b9e53bb |
class TestNodeTestcase(NodeTestCase): <NEW_LINE> <INDENT> def test_snapshots_work(self): <NEW_LINE> <INDENT> has_kernel = lambda: "kernel" in self.node.ssh("rpm -q kernel") <NEW_LINE> self.assertTrue(has_kernel()) <NEW_LINE> with self.node.snapshot().context(): <NEW_LINE> <INDENT> self.node.ssh("rpm -e --nodeps kernel"... | Let's ensure that the basic functionality is working
| 62599060379a373c97d9a6c4 |
class LogMessage: <NEW_LINE> <INDENT> def __init__(self, tstamp: datetime.datetime, sender: str, msg: str, own: bool = False) -> None: <NEW_LINE> <INDENT> self.tstamp = tstamp <NEW_LINE> self.sender = sender <NEW_LINE> self.own = own <NEW_LINE> self.msg = msg <NEW_LINE> self.is_read = False <NEW_LINE> <DEDENT> def get_... | Class for log messages to be displayed in LogWins | 6259906024f1403a9268641e |
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_game): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = ai_game.screen <NEW_LINE> self.settings = ai_game.settings <NEW_LINE> self.image = pygame.image.load('/Users/mahdieh/Desktop/Alien_game/alien.bmp') <NEW_LINE> self.rect = self.image.get_... | A class to represent a single alien in the fleet. | 62599060baa26c4b54d50942 |
@dataclasses.dataclass(frozen=True) <NEW_LINE> class ResolvedMutationSpec(MutationSpec): <NEW_LINE> <INDENT> start_pos: Tuple[int, int] <NEW_LINE> end_pos: Tuple[int, int] <NEW_LINE> def __post_init__(self): <NEW_LINE> <INDENT> super().__post_init__() <NEW_LINE> if self.start_pos[0] > self.end_pos[0]: <NEW_LINE> <INDEN... | A MutationSpec with the location of the mutation resolved. | 6259906032920d7e50bc76e6 |
class Sample(Model): <NEW_LINE> <INDENT> def __init__(self, center_code: int=None, id: str=None, collection_method: str=None, typing: List[Typing]=None): <NEW_LINE> <INDENT> self.swagger_types = { 'center_code': int, 'id': str, 'collection_method': str, 'typing': List[Typing], 'seq_records': Dict } <NEW_LINE> self.attr... | Examples:
>>> from pyhml.models.typing import Typing
>>> from pyhml.models.sample import Sample | 62599060a8370b77170f1a6f |
class ListLevel(AbstractLevel, QtGui.QListView): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> super(ListLevel, self).__init__(parent) <NEW_LINE> <DEDENT> def model_changed(self, model): <NEW_LINE> <INDENT> self.setModel(model) <NEW_LINE> if model is not None: <NEW_LINE> <INDENT> self.setCurr... | A level that consists of a listview to be used in a CascadeView
| 62599060a79ad1619776b60d |
class Solution: <NEW_LINE> <INDENT> def reorderList(self, head): <NEW_LINE> <INDENT> if head==None or head.next==None: <NEW_LINE> <INDENT> return head <NEW_LINE> <DEDENT> dummy = ListNode(0,None) <NEW_LINE> fast_node = dummy <NEW_LINE> pivot = dummy <NEW_LINE> dummy.next = head <NEW_LINE> while fast_node != None and fa... | @param head: The first node of the linked list.
@return: nothing | 6259906097e22403b383c5ad |
class keyi_data_frm(object): <NEW_LINE> <INDENT> implements(IVocabularyFactory) <NEW_LINE> def __call__(self, context=None): <NEW_LINE> <INDENT> items = ( SimpleTerm(value='dga', title=u'數位典藏'), SimpleTerm(value='dnt', title=u'捐贈'), SimpleTerm(value='cwk', title=u'合作'), SimpleTerm(value='fdw', title=u'田野調查'), ) <NEW_LI... | KeYi
| 625990606e29344779b01cef |
class TrainReservationSchema(SchemaObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.schema = 'TrainReservation' | Schema Mixin for TrainReservation
Usage: place after django model in class definition, schema will return the schema.org url for the object
A reservation for train travel. | 625990607cff6e4e811b70e6 |
class SharedLinker(config.compile.processor.Processor): <NEW_LINE> <INDENT> def __init__(self, argDB): <NEW_LINE> <INDENT> self.compiler = Compiler(argDB, usePreprocessorFlags = False) <NEW_LINE> self.configLibraries = config.libraries.Configure(config.framework.Framework(clArgs = '', argDB = argDB, tmpDir = os.getcwd(... | The C linker | 62599060009cb60464d02bd7 |
class CryptoMixin(models.Model): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def encrypted_fields(cls): <NEW_LINE> <INDENT> return [fld.name for fld in cls._meta.fields if isinstance(fld, BaseField)] <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> abstract = True | Model mixin for a user model that need to list it's
encrypted fields. | 62599060d268445f2663a6ad |
class RawHook(Hook): <NEW_LINE> <INDENT> def __init__(self, plugin, irc_raw_hook): <NEW_LINE> <INDENT> super().__init__("irc_raw", plugin, irc_raw_hook) <NEW_LINE> self.triggers = irc_raw_hook.triggers <NEW_LINE> <DEDENT> def is_catch_all(self): <NEW_LINE> <INDENT> return "*" in self.triggers <NEW_LINE> <DEDENT> def __... | :type triggers: set[str] | 6259906099cbb53fe6832582 |
class WebPage(object): <NEW_LINE> <INDENT> html = None <NEW_LINE> def fetch(self, url): <NEW_LINE> <INDENT> req = urllib2.Request(url) <NEW_LINE> response = urllib2.urlopen(req) <NEW_LINE> self.html = response.read() <NEW_LINE> if not self.html: <NEW_LINE> <INDENT> raise Exception('Unable to fetch the webpage HTML') | Provides the fecth method to
other classes | 6259906007f4c71912bb0adf |
class ProcessViewer(object): <NEW_LINE> <INDENT> def __init__(self, children): <NEW_LINE> <INDENT> self.children = children <NEW_LINE> <DEDENT> def create(self): <NEW_LINE> <INDENT> import ipywidgets as widgets <NEW_LINE> a = widgets.Tab() <NEW_LINE> for i in range(len(self.children)): <NEW_LINE> <INDENT> a.set_title(i... | A widget to summarize all the infromation from different processes.
Must be filled with the widgets of the single processes | 625990607047854f46340a5f |
class Ship: <NEW_LINE> <INDENT> ship_types = {'Carrier': 5, 'Battleship': 4, 'Cruiser': 3, 'Submarine': 3, 'Destroyer': 2} <NEW_LINE> def __init__(self, name, position, is_vertical=False): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.positions = [] <NEW_LINE> self.squares = [] <NEW_LINE> self.positions.append(p... | Class has methods to create and manage single Ship object.
Attributes:
ships_types : dict
Keys with ships names and values with corresponding lengths.
name : str
One of 5 possible ship names.
positions : list of tuples of ints
Carries all positions of ship squares.
squares : lis... | 625990608a43f66fc4bf3830 |
class Base(): <NEW_LINE> <INDENT> __nb_objects = 0 <NEW_LINE> def __init__(self, id=None): <NEW_LINE> <INDENT> if id is not None: <NEW_LINE> <INDENT> self.id = id <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> Base.__nb_objects += 1 <NEW_LINE> self.id = Base.__nb_objects <NEW_LINE> <DEDENT> <DEDENT> @staticmethod <NEW_L... | first class Base | 62599060cb5e8a47e493ccd6 |
class Pixel(object): <NEW_LINE> <INDENT> def __init__(self, state, x, y, colour_on, colour_off): <NEW_LINE> <INDENT> self.state = state <NEW_LINE> self.colour_on = colour_on <NEW_LINE> self.colour_off = colour_off <NEW_LINE> self.x = x <NEW_LINE> self.y = y <NEW_LINE> <DEDENT> def set_colour_on(self, rgb): <NEW_LINE> <... | A pixel describes one pixel in the matrix of the WordClock.
It holds information about its color, state and position in the WordClock matrix. | 62599060462c4b4f79dbd0a7 |
class IsolationPlugin(Plugin): <NEW_LINE> <INDENT> score = 10 <NEW_LINE> name = 'isolation' <NEW_LINE> def configure(self, options, conf): <NEW_LINE> <INDENT> Plugin.configure(self, options, conf) <NEW_LINE> self._mod_stack = [] <NEW_LINE> <DEDENT> def beforeContext(self): <NEW_LINE> <INDENT> mods = sys.modules.copy() ... | Activate the isolation plugin to isolate changes to external
modules to a single test module or package. The isolation plugin
resets the contents of sys.modules after each test module or
package runs to its state before the test. PLEASE NOTE that this
plugin should not be used with the coverage plugin in any other case... | 62599060e76e3b2f99fda0a2 |
class memoize_invalidate(object): <NEW_LINE> <INDENT> def __init__(self, func): <NEW_LINE> <INDENT> self.func = func <NEW_LINE> <DEDENT> def __get__(self, obj, objtype=None): <NEW_LINE> <INDENT> if obj is None: <NEW_LINE> <INDENT> return self.func <NEW_LINE> <DEDENT> return functools.partial(self, obj) <NEW_LINE> <DEDE... | Use in conjunction with @memoize decorator when you want to reset instance cache
when calling a specific method | 62599060f548e778e596cc2b |
class AppEngineTestCase(TransactionTestCase): <NEW_LINE> <INDENT> @property <NEW_LINE> def default_datastore_v3_stub_kwargs(self): <NEW_LINE> <INDENT> cp = datastore_stub_util.PseudoRandomHRConsistencyPolicy(probability=1) <NEW_LINE> return { "use_sqlite": True, "require_indexes": True, "consistency_policy": cp, "auto_... | Common test setup required for testing App Engine-related things.
You can provide your own default and specific keyword arguments for each
service stub by implementing properties of the names
`default_{service_name}_stub_kwargs` and
`{service_name}_stub_kwargs`
where {service_name} is one of the names define... | 62599060379a373c97d9a6c7 |
class BertForSequenceClassification(BertPreTrainedModel): <NEW_LINE> <INDENT> def __init__(self, config, num_labels): <NEW_LINE> <INDENT> super(BertForSequenceClassification, self).__init__(config) <NEW_LINE> self.num_labels = num_labels <NEW_LINE> self.bert = BertModel(config) <NEW_LINE> self.dropout = nn.Dropout(conf... | BERT models for classification.
This module is composed of the BERT models with a linear layer on top of
the pooled output.
Params:
`config`: a BertConfig class instance with the configuration to build a new models.
`num_labels`: the number of classes for the classifier. Default = 2.
Inputs:
`input_ids`: ... | 62599060435de62698e9d4a9 |
class AuthenticatorABC(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def _authenticate_packet(self, pkt: "Packet", **kwargs) -> None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def _on_pass(self, sock: "SSLSocket", pkt: "Packet", **kwargs) -> None: <NEW_LINE> <INDENT> pass <NEW_LINE>... | Authenticator Absctract Class
The absctract class for implementation. | 625990608e71fb1e983bd16e |
class MyTCPServer(socketserver.BaseRequestHandler): <NEW_LINE> <INDENT> def handle(self): <NEW_LINE> <INDENT> self.data = self.request.recv(1024).strip() <NEW_LINE> log.info(f"got data: {self.data}") <NEW_LINE> self.request.sendall(self.data.upper()+b"\n") | Simplest TCP server that echoes back the message. | 625990609c8ee82313040cdb |
class Breed(Base): <NEW_LINE> <INDENT> __tablename__ = 'breed' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> name = Column(String, nullable=False) <NEW_LINE> species_id = Column(Integer, ForeignKey('species.id'), nullable=False ) <NEW_LINE> pets = relationship('Pet', backref="breed") <NEW_LINE> def __rep... | domain model class for a Breed
has a with many-to-one relationship withSpecies | 625990603539df3088ecd93f |
class Department(models.Model): <NEW_LINE> <INDENT> name = models.CharField( "Nombre del Departamento", max_length=100, ) <NEW_LINE> department_chief = models.OneToOneField( 'Profile', related_name='+', on_delete=models.CASCADE, null=True, blank=True, verbose_name="Encargado del Departamento", ) <NEW_LINE> management =... | Comments | 62599060498bea3a75a59150 |
class XmlDump(object): <NEW_LINE> <INDENT> def __init__(self, filename, allrevisions=False): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> if allrevisions: <NEW_LINE> <INDENT> self._parse = self._parse_all <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._parse = self._parse_only_latest <NEW_LINE> <DEDENT> ... | Represents an XML dump file.
Reads the local file at initialization,
parses it, and offers access to the resulting XmlEntries via a generator.
@param allrevisions: boolean
If True, parse all revisions instead of only the latest one.
Default: False. | 62599060fff4ab517ebceeca |
class Integrator: <NEW_LINE> <INDENT> def __init__(self, dt, f): <NEW_LINE> <INDENT> self.dt = dt <NEW_LINE> self.f = f <NEW_LINE> <DEDENT> def step(self, t, x, u): <NEW_LINE> <INDENT> raise NotImplementedError | Integrator for a system of first-order ordinary differential equations
of the form \dot x = f(t, x, u). | 625990608e7ae83300eea731 |
class AudioApp(object): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> self.narrator = pyttsx.init() <NEW_LINE> self.narrator.setProperty('rate', 500) <NEW_LINE> self.synth = fluidsynth.Synth() <NEW_LINE> self.synth.start() <NEW_LINE> example = self.synth.sfload('example.sf2') <NEW_LINE> self.synth.p... | Base class for auditory UI. | 625990605166f23b2e244a75 |
class BaseNavigation(object): <NEW_LINE> <INDENT> pass | description of class | 6259906099cbb53fe6832585 |
class TestExportRunFile(TestCase): <NEW_LINE> <INDENT> fixtures = ("osm_provider.json",) <NEW_LINE> def test_create_export_run_file(self): <NEW_LINE> <INDENT> file_mock = MagicMock(spec=File) <NEW_LINE> file_mock.name = "test.pdf" <NEW_LINE> directory = "test" <NEW_LINE> provider = DataProvider.objects.first() <NEW_LIN... | Test cases for ExportRunFile model | 625990607047854f46340a61 |
class Envelope(object): <NEW_LINE> <INDENT> _version = MPLANE_VERSION <NEW_LINE> _content_type = None <NEW_LINE> _messages = None <NEW_LINE> def __init__(self, dictval=None, content_type=ENVELOPE_MESSAGE): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if dictval is not None: <NEW_LINE> <INDENT> self._from_dict(dict... | Envelopes are used to contain other Messages. | 6259906066673b3332c31aa0 |
class Switches(FilePath): <NEW_LINE> <INDENT> def __init__(self, text, col=None): <NEW_LINE> <INDENT> self.text = text <NEW_LINE> self.col = col <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Switches({0})".format(repr(self.text)) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return se... | AST for argument switches (arguments beginning with "-", as on a UNIX command line). | 625990604428ac0f6e659bd6 |
class ConfdAsyncUDPClient(daemon.AsyncUDPSocket): <NEW_LINE> <INDENT> def __init__(self, client, family): <NEW_LINE> <INDENT> daemon.AsyncUDPSocket.__init__(self, family) <NEW_LINE> self.client = client <NEW_LINE> <DEDENT> def handle_datagram(self, payload, ip, port): <NEW_LINE> <INDENT> self.client.HandleResponse(payl... | Confd udp asyncore client
This is kept separate from the main ConfdClient to make sure it's easy to
implement a non-asyncore based client library. | 6259906045492302aabfdb7e |
class IDParser(HTMLParser.HTMLParser): <NEW_LINE> <INDENT> def __init__(self, id): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.result = None <NEW_LINE> self.started = False <NEW_LINE> self.depth = {} <NEW_LINE> self.html = None <NEW_LINE> self.watch_startpos = False <NEW_LINE> HTMLParser.HTMLParser.__init__(self) ... | Modified HTMLParser that isolates a tag with the specified id | 6259906024f1403a92686420 |
class ProfileEditTextForm(FlaskForm, __TitleAndContent): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> csrf = True | If the user wants to edit the title and/or content of their profile. | 625990608e71fb1e983bd16f |
class VIEW3D_OT_ccdelta_sub(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "view3d.ccdelta_sub" <NEW_LINE> bl_label = "Subtract delta vector to 3D cursor" <NEW_LINE> bl_options = {'REGISTER'} <NEW_LINE> def modal(self, context, event): <NEW_LINE> <INDENT> return {'FINISHED'} <NEW_LINE> <DEDENT> def execute(self, ... | Subtract delta vector to 3D cursor | 6259906091af0d3eaad3b4cc |
class Config: <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> for key, value in kwargs.items(): <NEW_LINE> <INDENT> self.set_value(key, value) <NEW_LINE> <DEDENT> <DEDENT> @classmethod <NEW_LINE> def load_from_yaml(cls, path: str): <NEW_LINE> <INDENT> with open(path, 'r') as file: <NEW_LINE> <INDE... | Configuration options and yaml file loading and saving.
When creating from a .yaml file, use the .load_from_yaml() class method,
which will return an instance with values populated from the file path
provided. | 625990606e29344779b01cf3 |
class PTPhoneNumberField(Field): <NEW_LINE> <INDENT> default_error_messages = { 'invalid': _('Phone numbers have at least 3 and at most 9 digits and may optionally be prefixed with \'00351\' or \'+351\'.'), } <NEW_LINE> def clean(self, value): <NEW_LINE> <INDENT> super(PTPhoneNumberField, self).clean(value) <NEW_LINE> ... | A field which validates Portuguese phone numbers.
- Phone numbers have at least 3 and at most 9 digits and may optionally be prefixed with '00351' or '+351'.
- The input string is allowed to contain spaces (though they will be stripped). | 62599060f7d966606f74940b |
class EMA(): <NEW_LINE> <INDENT> def __init__(self, momentum): <NEW_LINE> <INDENT> self.momentum = momentum <NEW_LINE> self.shadow = {} <NEW_LINE> <DEDENT> def register(self, name, val): <NEW_LINE> <INDENT> self.shadow[name] = val.clone() <NEW_LINE> <DEDENT> def __call__(self, name, x): <NEW_LINE> <INDENT> assert name ... | Use moving avg for the models.
Examples:
>>> ema = EMA(0.999)
>>> for name, param in model.named_parameters():
>>> if param.requires_grad:
>>> ema.register(name, param.data)
>>>
>>> # during training:
>>> # optimizer.step()
>>> for name, param in model.named_parameters():
... | 625990603539df3088ecd941 |
class LegacyWidgetRegistryTests(TestCase): <NEW_LINE> <INDENT> def tearDown(self): <NEW_LINE> <INDENT> super(LegacyWidgetRegistryTests, self).tearDown() <NEW_LINE> if MyLegacyWidget in admin_widgets_registry: <NEW_LINE> <INDENT> admin_widgets_registry.unregister(MyLegacyWidget) <NEW_LINE> <DEDENT> <DEDENT> def test_reg... | Unit tests for legacy Widget registration functions. | 625990609c8ee82313040cdc |
class XLNet(nn.Module): <NEW_LINE> <INDENT> def __init__(self, model_name_or_path: str, max_seq_length: int = 128, do_lower_case: Optional[bool] = None, model_args: Dict = {}, tokenizer_args: Dict = {}): <NEW_LINE> <INDENT> super(XLNet, self).__init__() <NEW_LINE> self.config_keys = ['max_seq_length', 'do_lower_case'] ... | XLNet model to generate token embeddings.
Each token is mapped to an output vector from XLNet. | 625990602ae34c7f260ac78b |
class csvFuturesInstrumentData(futuresInstrumentData): <NEW_LINE> <INDENT> def __init__( self, datapath=arg_not_supplied, log=logtoscreen("csvFuturesInstrumentData"), ): <NEW_LINE> <INDENT> super().__init__(log=log) <NEW_LINE> if datapath is arg_not_supplied: <NEW_LINE> <INDENT> datapath = INSTRUMENT_CONFIG_PATH <NEW_L... | Get data about instruments from a special configuration used for initialising the system | 62599060d268445f2663a6af |
class AddTripEntryView(AddApprovableEntryView): <NEW_LINE> <INDENT> entry_class = TripEntry <NEW_LINE> entry_form_class = TripEntryForm <NEW_LINE> transaction_formset_class = TripTransactionFormSet <NEW_LINE> verbose_name = 'Trip' <NEW_LINE> receipt_class = TripReceipt <NEW_LINE> receipt_entry_field = 'trip_entry' <NEW... | Extend the AddApprovableEntryView to apply to TripEntries.
This view adds an additional formset, the TripStoreTransactionFormSet. | 62599060460517430c432ba5 |
class GetRuleRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RuleId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.RuleId = params.get("RuleId") <NEW_LINE> memeber_set = set(params.keys()) <NEW_LINE> for name, value in vars(self).items(): <NE... | GetRule请求参数结构体
| 6259906016aa5153ce401b82 |
class time_limited: <NEW_LINE> <INDENT> def __init__(self, limit_seconds, iterable): <NEW_LINE> <INDENT> if limit_seconds < 0: <NEW_LINE> <INDENT> raise ValueError('limit_seconds must be positive') <NEW_LINE> <DEDENT> self.limit_seconds = limit_seconds <NEW_LINE> self._iterable = iter(iterable) <NEW_LINE> self._start_t... | Yield items from *iterable* until *limit_seconds* have passed.
If the time limit expires before all items have been yielded, the
``timed_out`` parameter will be set to ``True``.
>>> from time import sleep
>>> def generator():
... yield 1
... yield 2
... sleep(0.2)
... yield 3
>>> iterable = time_limite... | 625990602c8b7c6e89bd4e94 |
class Result(Generic[T, E], AbstractContextManager): <NEW_LINE> <INDENT> def __init__(self, ok: T = None, err: E = None) -> None: <NEW_LINE> <INDENT> self._variant = _ResultVariant.ERR <NEW_LINE> self._ok = None <NEW_LINE> self._err = None <NEW_LINE> if err is not None: <NEW_LINE> <INDENT> self._err = err <NEW_LINE> <D... | A container for the result of functions that can produce errors.
Instances should be constructed using either the `Ok` or `Err` functions. | 625990607b25080760ed8833 |
class TestBasicFunctions(unittest.TestCase): <NEW_LINE> <INDENT> def test_instantiate(self): <NEW_LINE> <INDENT> m1 = instantiate('md5') <NEW_LINE> m2 = instantiate('sha256') <NEW_LINE> data = 'data'.encode('utf-8') <NEW_LINE> m1.update(data) <NEW_LINE> m2.update(data) <NEW_LINE> assert m1.hexdigest() == (hashlib.md5)(... | Basic Tests.
Suite of basic tests for various functions. | 6259906044b2445a339b74b3 |
class Square: <NEW_LINE> <INDENT> def __init__(self, size): <NEW_LINE> <INDENT> self.__size = size | square class | 625990605166f23b2e244a77 |
class DummyService(Service): <NEW_LINE> <INDENT> def __init__(self, context, num_nodes): <NEW_LINE> <INDENT> super(DummyService, self).__init__(context, num_nodes) <NEW_LINE> self.started_count = 0 <NEW_LINE> self.cleaned_count = 0 <NEW_LINE> self.stopped_count = 0 <NEW_LINE> self.started_kwargs = {} <NEW_LINE> self.cl... | Simple fake service class. | 625990604428ac0f6e659bd8 |
class Song(ndb.Model): <NEW_LINE> <INDENT> artist = ndb.StringProperty() <NEW_LINE> title = ndb.StringProperty() <NEW_LINE> price = ndb.IntegerProperty() <NEW_LINE> album = ndb.StringProperty(indexed=False) | A main model for representing an individual Song entry. | 62599060f548e778e596cc2e |
class Config(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.network_hub = "all" <NEW_LINE> self.user_agent = "Social network mapper, monitored by /u/YourUserName" <NEW_LINE> self.post_limit = 100 | Basic configuration | 6259906076e4537e8c3f0c33 |
class FlipBitBigMutation(FlipBitMutation): <NEW_LINE> <INDENT> def __init__(self, pm, pbm, alpha): <NEW_LINE> <INDENT> super(self.__class__, self).__init__(pm) <NEW_LINE> if not (0.0 < pbm < 1.0): <NEW_LINE> <INDENT> raise ValueError('Invalid big mutation probability') <NEW_LINE> <DEDENT> if pbm < 5*pm and mpi.is_maste... | Mutation operator using Flip Bit mutation implementation with adaptive
big mutation rate to overcome premature or local-best solution.
:param pm: The probability of mutation (usually between 0.001 ~ 0.1)
:type pm: float in (0.0, 1.0]
:param pbm: The probability of big mutation, usually more than 5 times
b... | 62599060baa26c4b54d50948 |
class Option(BaseOption): <NEW_LINE> <INDENT> TYPES = BaseOption.TYPES + ('regexp', 'csv', 'yn', 'named', 'password', 'multiple_choice', 'file', 'color', 'time', 'bytes') <NEW_LINE> ATTRS = BaseOption.ATTRS + ['hide', 'level'] <NEW_LINE> TYPE_CHECKER = copy(BaseOption.TYPE_CHECKER) <NEW_LINE> TYPE_CHECKER['regexp'] = c... | override optik.Option to add some new option types
| 625990601f037a2d8b9e53be |
class FakeVolunteerFactory(Volunteer.Factory): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_persister(): <NEW_LINE> <INDENT> return FakeVolunteerPersister() | Fake class for testing | 6259906024f1403a92686421 |
class OperationInfoDetail(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.DisabledReason = None <NEW_LINE> self.Enabled = None <NEW_LINE> self.Supported = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.DisabledReason = params.get("DisabledReason") <NEW... | 提供给前端控制按钮显示逻辑的字段
| 625990604f6381625f199ff6 |
class NoPlatformPolicyError(Error): <NEW_LINE> <INDENT> pass | Raised when a policy is received that doesn't support this platform. | 62599060dd821e528d6da4d4 |
class TestAlsoAffectsLinks(BrowserTestCase): <NEW_LINE> <INDENT> layer = DatabaseFunctionalLayer <NEW_LINE> def test_also_affects_links_product_bug(self): <NEW_LINE> <INDENT> owner = self.factory.makePerson() <NEW_LINE> product = self.factory.makeProduct( bug_sharing_policy=BugSharingPolicy.PROPRIETARY) <NEW_LINE> bug ... | Tests the rendering of the Also Affects links on the bug index view.
The links are rendered with a css class 'private-disallow' if they are
not valid for proprietary bugs. | 625990603d592f4c4edbc583 |
class Environment: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> p = abs(50) <NEW_LINE> self.agent_position = Point(np.random.randint(-p,p) , np.random.randint(-p,p)) <NEW_LINE> self.plane_line = Line(np.random.randint(-p,p) , np.random.randint(-p,p), np.random.randint(-p,p)) <NEW_LINE> self.plane_sign = ... | agent_position:
This is the coordinate of the agent in a 2D cartesian plane.
plane_line:
The equation of the line which divides the plane into two halves
where one of the halves is the plane.
plane_sign:
Takes on either of two values +1 or -1. Since any line divides... | 6259906097e22403b383c5b3 |
class Product(object): <NEW_LINE> <INDENT> self.id = 0 <NEW_LINE> self.name = '' <NEW_LINE> self.abbreviation = '' <NEW_LINE> self.resource = '' <NEW_LINE> self.description = '' <NEW_LINE> self.documentation = '' <NEW_LINE> self.tags = '' <NEW_LINE> self.species = '' <NEW_LINE> self.ontologies = [] <NEW_LINE> self.data... | aibs.model.product (autogen) | 625990602ae34c7f260ac78d |
class Circle: <NEW_LINE> <INDENT> def __init__(self, radius): <NEW_LINE> <INDENT> self.radius = radius <NEW_LINE> <DEDENT> @property <NEW_LINE> def area(self): <NEW_LINE> <INDENT> return math.pi * self.radius ** 2 <NEW_LINE> <DEDENT> @property <NEW_LINE> def diameter(self): <NEW_LINE> <INDENT> return self.radius * 2 <N... | property 还是一种定义动态计算 attribute 的方法。这种类型的 attributes 并不会
被实际的存储,而是在需要的时候计算出来
| 625990603cc13d1c6d466de9 |
class Config(): <NEW_LINE> <INDENT> TIMEZONE = 'Asia/Shanghai' <NEW_LINE> BASE_DIR = os.path.dirname(os.path.dirname(__file__)) | Basic config for demo02 | 62599060d486a94d0ba2d66f |
class Multimap(MutableMapping): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(Multimap, self).__init__() <NEW_LINE> self.__store = OrderedDict() <NEW_LINE> if args is not None and len(args) > 0: <NEW_LINE> <INDENT> for key, value in six.iteritems(args[0]): <NEW_LINE> <INDENT> self._... | Dictionary that can hold multiple values for the same key
In order not to break existing customers, getting and inserting elements with ``[]`` keeps the same behaviour
as the built-in dict. If multiple elements are already mapped to the key, ``[]` will return
the newest one.
To map multiple elements to a key, use th... | 6259906045492302aabfdb81 |
class Data71: <NEW_LINE> <INDENT> hdr_dtype = np.dtype([('SoundSpeedCounter','H'),('SystemSerial#','H'), ('NumEntries','H')]) <NEW_LINE> data_dtype = np.dtype([('Time','d'),('SoundSpeed','f')]) <NEW_LINE> def __init__(self, datablock, POSIXtime, byteswap = False): <NEW_LINE> <INDENT> data_dtype = np.dtype([('Time','H')... | Surface Sound Speed datagram 047h / 71d / 'G'. Time is in POSIX time and
sound speed is in meters per second. | 6259906067a9b606de5475f5 |
class UserFactory(factory.django.DjangoModelFactory): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> <DEDENT> first_name = factory.Faker('first_name') <NEW_LINE> last_name = factory.Faker('last_name') <NEW_LINE> username = first_name <NEW_LINE> password = make_password('test') | Creates an user | 625990607d847024c075da7b |
class Plan(object): <NEW_LINE> <INDENT> def __init__(self, groups): <NEW_LINE> <INDENT> self.result = {} <NEW_LINE> self.action_groups_dict = dict((name, ActionGroup()) for name in groups) <NEW_LINE> self.result["timeout"] = [] <NEW_LINE> <DEDENT> def action_done(self, action, result): <NEW_LINE> <INDENT> if result["st... | plan for action groups
| 62599060498bea3a75a59152 |
class MathFragment(Math): <NEW_LINE> <INDENT> def __init__( self, text: String, errors: Optional[Array[String]] = None, id: Optional[String] = None, mathLanguage: Optional[String] = None, meta: Optional[Object] = None ) -> None: <NEW_LINE> <INDENT> super().__init__( text=text, errors=errors, id=id, mathLanguage=mathLan... | A fragment of math, e.g a variable name, to be treated as inline content. | 625990601f5feb6acb164292 |
class BaseTestCase(TestCase): <NEW_LINE> <INDENT> def create_app(self): <NEW_LINE> <INDENT> app.config.from_object('config.TestingConfig') <NEW_LINE> return app <NEW_LINE> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> db.create_all() <NEW_LINE> self.test_user = {"username": "moses", "password": "mango", "first_name": "... | Base test case to test the API | 6259906007f4c71912bb0ae5 |
class StraightPolyomino( Tetrimino ): <NEW_LINE> <INDENT> def __init__( self, imageSurface, screenSurface ): <NEW_LINE> <INDENT> super( StraightPolyomino, self ).__init__( imageSurface, screenSurface ) <NEW_LINE> super( StraightPolyomino, self ).addRepresentation( 0, [ (0,0), (1,0), (2,0), (3,0) ] ) <NEW_LINE> super( S... | Class to represent a Straight Polyomino in the game | 625990608a43f66fc4bf3836 |
class DB(object): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.conn = None <NEW_LINE> <DEDENT> def connect(self): <NEW_LINE> <INDENT> self.conn = sqlite3.connect(self.path) <NEW_LINE> <DEDENT> def disconnect(self): <NEW_LINE> <INDENT> self.conn.close() <NEW_LINE> <D... | SQLite3 wrapper. | 62599060ac7a0e7691f73b8b |
class DisableQuickuploadOverride(UpgradeStep): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> self.install_upgrade_profile() | Disable quickupload override and unique id.
The override default in collective.quickupload was inconsistent in the
default profile and in the upgrade step.
Even though this setting does not affect us currently this upgrade-step
makes sure that all of our installations have the same setting. You never
know ...
Also s... | 6259906066673b3332c31aa4 |
class KeyboardAgent(Agent): <NEW_LINE> <INDENT> WEST_KEY = 'a' <NEW_LINE> EAST_KEY = 'd' <NEW_LINE> NORTH_KEY = 'w' <NEW_LINE> SOUTH_KEY = 's' <NEW_LINE> STOP_KEY = 'q' <NEW_LINE> def __init__( self, index = 0 ): <NEW_LINE> <INDENT> self.lastMove = Directions.STOP <NEW_LINE> self.index = index <NEW_LINE> self.keys = ... | An agent controlled by the keyboard. | 62599060462c4b4f79dbd0ad |
class Breakpoint: <NEW_LINE> <INDENT> next = 1 <NEW_LINE> bplist = {} <NEW_LINE> bpbynumber = [None] <NEW_LINE> def __init__(self, file, line, temporary=False, cond=None, funcname=None): <NEW_LINE> <INDENT> self.funcname = funcname <NEW_LINE> self.func_first_executable_line = None <NEW_LINE> self.file = file <NEW_LINE>... | Breakpoint class.
Implements temporary breakpoints, ignore counts, disabling and
(re)-enabling, and conditionals.
Breakpoints are indexed by number through bpbynumber and by
the (file, line) tuple using bplist. The former points to a
single instance of class Breakpoint. The latter points to a
list of such instances... | 6259906076e4537e8c3f0c35 |
class StubReactor(object): <NEW_LINE> <INDENT> implements(IReactorTCP) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.calls = [] <NEW_LINE> <DEDENT> def connectTCP(self, *args, **kwargs): <NEW_LINE> <INDENT> self.calls.append((args, kwargs)) <NEW_LINE> return StubConnector() <NEW_LINE> <DEDENT> def addSystemEv... | A stub L{IReactorTCP} that records the calls to connectTCP.
@ivar calls: A C{list} of tuples (args, kwargs) sent to connectTCP. | 625990601f037a2d8b9e53bf |
@interface.provider(IFormFieldProvider) <NEW_LINE> class IRelatedSites(model.Schema): <NEW_LINE> <INDENT> model.fieldset('settings', label=u"Settings", fields=['related_sites_links']) <NEW_LINE> related_sites_links = schema.List( title=_(u"Related sites"), required=False, value_type=DictRow( title=u"tablerow", required... | Marker / Form interface for additional links | 6259906021bff66bcd72430d |
class PublishTranslations(hook.Hook): <NEW_LINE> <INDENT> __regid__ = "frarchives_edition.publish-translation" <NEW_LINE> __select__ = hook.Hook.__select__ & custom_on_fire_transition( CMS_I18N_OBJECTS, {"wft_cmsobject_publish"} ) <NEW_LINE> to_state = "wfs_cmsobject_published" <NEW_LINE> events = ("after_add_entity",)... | Publish a Translation | 625990604f6381625f199ff7 |
class Tool(benchexec.tools.template.BaseTool): <NEW_LINE> <INDENT> REQUIRED_PATHS = ["bin", "lib", "kluzzer"] <NEW_LINE> def program_files(self, executable): <NEW_LINE> <INDENT> return self._program_files_from_executable( executable, self.REQUIRED_PATHS, parent_dir=True ) <NEW_LINE> <DEDENT> def executable(self): <NEW_... | Tool info for LibKluzzer (http://unihb.eu/kluzzer). | 625990608e71fb1e983bd173 |
class ScreenShot: <NEW_LINE> <INDENT> __slots__ = {"__pixels", "__rgb", "pos", "raw", "size"} <NEW_LINE> def __init__(self, data, monitor, size=None): <NEW_LINE> <INDENT> self.__pixels = None <NEW_LINE> self.__rgb = None <NEW_LINE> self.raw = data <NEW_LINE> self.pos = Pos(monitor["left"], monitor["top"]) <NEW_LINE> if... | Screen shot object.
.. note::
A better name would have been *Image*, but to prevent collisions
with PIL.Image, it has been decided to use *ScreenShot*. | 625990609c8ee82313040cde |
class RegistryConfiguration(BrowserView): <NEW_LINE> <INDENT> def __init__(self, context, request): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> self.request = request <NEW_LINE> self.catalog_name = self.request.get('catalog_name', 'portal_catalog') <NEW_LINE> self.prefix = "bika.lims.%s_query" % self.catalog_... | Combine default operations from plone.app.query, with
fields from registry key in prefix | 62599060d7e4931a7ef3d6d9 |
class QBXProxyGenerator(ProxyGeneratorBase): <NEW_LINE> <INDENT> def get_radii_knl(self, actx: PyOpenCLArrayContext) -> lp.LoopKernel: <NEW_LINE> <INDENT> return make_compute_block_qbx_radii_knl(actx, self.ambient_dim) <NEW_LINE> <DEDENT> def __call__(self, actx: PyOpenCLArrayContext, source_dd, indices: BlockIndexRang... | A proxy point generator that also considers the QBX expansion
when determining the radius of the proxy ball.
Inherits from :class:`ProxyGeneratorBase`. | 6259906016aa5153ce401b86 |
class AddoDialogHelper(AddoHelper): <NEW_LINE> <INDENT> _PROGRESS_DIALOD_MSG = 'Overviews computation.' <NEW_LINE> def __init__(self, app, tool): <NEW_LINE> <INDENT> super().__init__(app, tool) <NEW_LINE> self.dialog = None <NEW_LINE> <DEDENT> def target_levels(self, dataset): <NEW_LINE> <INDENT> return self.dialog.ove... | Helper class for overviews computation.
.. seealso:: :class:`AddoHelper` | 62599060498bea3a75a59153 |
class RefRatingScaleListCreateView(ListCreateAPIView): <NEW_LINE> <INDENT> lookup_field = 'id' <NEW_LINE> serializer_class = RefRatingScaleSerializer <NEW_LINE> permission_classes = (PermissionSettings.IS_ADMIN_OR_READ_ONLY, CustomDjangoModelPermissions) <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Ref... | This module contains the definition for LIST, CREATE operation for the Rating Scale Model. | 62599060e5267d203ee6cf14 |
class EditVariationOptions(VariationOptions, EditProductPage): <NEW_LINE> <INDENT> class PageDataWithExistingData(PageData): <NEW_LINE> <INDENT> def __set__(self, instance, data): <NEW_LINE> <INDENT> existing_data = instance.manager.product_data[instance.EXISTING_VARIATIONS] <NEW_LINE> for option, value_list in existin... | Page to select variations for new variation products. | 625990603c8af77a43b68a96 |
class FBTakeChangeType (object): <NEW_LINE> <INDENT> kFBTakeChangeAdded=property(doc=" ") <NEW_LINE> kFBTakeChangeRemoved=property(doc=" ") <NEW_LINE> kFBTakeChangeOpened=property(doc=" ") <NEW_LINE> kFBTakeChangeClosed=property(doc=" ") <NEW_LINE> kFBTakeChangeRenamed=property(doc=" ... | Types of take change events.
| 625990608e7ae83300eea736 |
class ConnectSerialDialog(simpledialog.Dialog): <NEW_LINE> <INDENT> def body(self, master): <NEW_LINE> <INDENT> Label(master, text="Choose the serial I/O port").grid(row=0) <NEW_LINE> self.cb = ttk.Combobox(master, values=available_ports()) <NEW_LINE> self.cb.grid(row=1) <NEW_LINE> return self.cb <NEW_LINE> <DEDENT> de... | Simple dialog for selecting the serial I/O port you want to use | 625990607d43ff2487427f64 |
class Vertice(object): <NEW_LINE> <INDENT> def __init__(self, label=None): <NEW_LINE> <INDENT> self.label = label <NEW_LINE> self.lista_vecinos = [] <NEW_LINE> self.lista_pesos = [] <NEW_LINE> self.grado = 0 <NEW_LINE> self.estado = "NO VISITADO" <NEW_LINE> self.distancia = None <NEW_LINE> self.padre = None <NEW_LINE> ... | Esta es una clase vértice que representa un nodo en un grafo.
| 625990608e7ae83300eea737 |
class HierarchicalLSTM(nn.Module): <NEW_LINE> <INDENT> def __init__(self, lstm_dim, score_dim, bidir, num_layers=2, drop_prob=0.20, method='max'): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> num_dirs = 2 if bidir else 1 <NEW_LINE> input_dim = lstm_dim*num_dirs <NEW_LINE> self.model = nn.Sequential( LSTMLower(lstm... | Super class for taking an input batch of sentences from a Batch
and computing the probability whether they end a segment or not | 62599060e64d504609df9f23 |
class CopyrightCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def __init__(self, view): <NEW_LINE> <INDENT> self.settings = sublime.load_settings(AutoCopyright.constants.SETTINGS_FILE) <NEW_LINE> self.view = view <NEW_LINE> self.selected_owner = None <NEW_LINE> <DEDENT> def format_pattern(self, year, owner, f... | Common functionality for the Auto Copyright command classes. | 625990604428ac0f6e659bdc |
class CaptchaFound(Exception): <NEW_LINE> <INDENT> pass | Raised when google fucks you with captcha. | 6259906015baa7234946363d |
class LibTIFFSeeker(Seeker): <NEW_LINE> <INDENT> NAME = 'libtiff' <NEW_LINE> VERSION_STRING = "LIBTIFF, Version " <NEW_LINE> SANITY_STRING = "TIFFRasterScanlineSize64" <NEW_LINE> def searchLib(self, logger): <NEW_LINE> <INDENT> self._version_strings = [] <NEW_LINE> self._sanity_exists = False <NEW_LINE> for bin_str in ... | Seeker (Identifier) for the libtiff open source library. | 625990608e71fb1e983bd175 |
class PointerType(Type): <NEW_LINE> <INDENT> is_pointer = True <NEW_LINE> null = 'null' <NEW_LINE> def __init__(self, pointee, addrspace=0): <NEW_LINE> <INDENT> assert not isinstance(pointee, VoidType) <NEW_LINE> self.pointee = pointee <NEW_LINE> self.addrspace = addrspace <NEW_LINE> <DEDENT> def _to_string(self): <NEW... | The type of all pointer values. | 62599060f7d966606f74940e |
class InviteListView(PaginationMixin, PaginateByMixin, SortableListMixin, CommonViewMixin, ListView): <NEW_LINE> <INDENT> model = Invite <NEW_LINE> nav_active_item = 'Admin' <NEW_LINE> dd_active_item = 'Invites' <NEW_LINE> valid_order_by = [ 'email', 'is_staff', 'is_superuser', 'created_at', 'created_by', 'notified', '... | View for listing invites. | 6259906097e22403b383c5b8 |
class DynamicFieldsMixin: <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> allowed = kwargs.pop('fields', None) <NEW_LINE> excluded = kwargs.pop('excluded_fields', None) <NEW_LINE> super().__init__(*args, **kwargs) <NEW_LINE> request = self.context.get('request') <NEW_LINE> if allowed is Non... | A serializer mixin that takes an additional `fields` and `excluded_fields` arguments that controls
which fields should be displayed.
Usage::
class MySerializer(DynamicFieldsMixin, serializers.HyperlinkedModelSerializer):
class Meta:
model = MyModel | 6259906099cbb53fe683258c |
class DropDownCommandInput(CommandInput): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def cast(arg): <NEW_LINE> <INDENT> return DropDownCommandInput() <NEW_LINE> <DEDENT> @property <NEW_LINE> def dropDownStyle(self): <NEW_LINE> <INDENT> return DropDownSt... | Provides a command input to get the choice in a dropdown list from the user. | 625990603617ad0b5ee077f9 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.