code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MessageConsumer(AsyncWebsocketConsumer): <NEW_LINE> <INDENT> async def connect(self): <NEW_LINE> <INDENT> if self.scope['user'].is_anonymous: <NEW_LINE> <INDENT> await self.close() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> await self.channel_layer.group_add(self.scope['user'].username + '-message',self.channe... | 私信websocket,采用异步通信来增加并发 | 62598eecac7a0e7691f70c66 |
class AnuncioSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Anuncio <NEW_LINE> fields = ('pk', 'descripcion', 'img_anuncio', 'fecha_limite', 'estado', 'fecha_creado') <NEW_LINE> read_only_fields = ['fecha_creado'] | Serializador | 62598eec4e4d562566370b67 |
class Meta: <NEW_LINE> <INDENT> verbose_name = _("Html tag") <NEW_LINE> verbose_name_plural = _("Html tags") | HtmlTag Meta class | 62598eec090684286d592a88 |
class TestResult(object): <NEW_LINE> <INDENT> def __init__(self, asserter, return_code, output, xmlfile): <NEW_LINE> <INDENT> self._asserter = asserter <NEW_LINE> self._return_code = return_code <NEW_LINE> self._output = remove_ansi(output) <NEW_LINE> if os.path.isfile(xmlfile): <NEW_LINE> <INDENT> with open(xmlfile, "... | Save test results for easy checking. | 62598eecd486a94d0ba2a719 |
class SummaryFileEditor(SummaryFile): <NEW_LINE> <INDENT> def __init__(self, sum_fn, verbosity=False): <NEW_LINE> <INDENT> super().__init__(sum_fn, verbosity=verbosity) <NEW_LINE> self.loadable = False <NEW_LINE> self.verbose = verbosity <NEW_LINE> if self.verbose: <NEW_LINE> <INDENT> print(">>>>>Initialized a summary ... | Summary: A class that handles 'get'-ing and 'write'-ing
of summary files. It is built on top of the SummaryFile() class.
To Do:
Add HDF5 | 62598eec3346ee7daa336a0f |
class SelectorList(list): <NEW_LINE> <INDENT> def __getslice__(self, i, j): <NEW_LINE> <INDENT> o = super(SelectorList, self).__getslice__(i, j) <NEW_LINE> return self.__class__(o) <NEW_LINE> <DEDENT> def __getitem__(self, pos): <NEW_LINE> <INDENT> o = super(SelectorList, self).__getitem__(pos) <NEW_LINE> return self._... | The :class:`SelectorList` class is a subclass of the builtin ``list``
class, which provides a few additional methods. | 62598eec63b5f9789fe838ab |
class Book(object): <NEW_LINE> <INDENT> def __init__(self, guid, transactions=None, root_account=None, commodities=None, slots=None): <NEW_LINE> <INDENT> self.guid = guid <NEW_LINE> self.transactions = transactions or [] <NEW_LINE> self.root_account = root_account <NEW_LINE> self.commodities = commodities or [] <NEW_LI... | A book is the main container for GNU Cash data.
It doesn't really do anything at all by itself, except to have
a reference to the accounts, transactions, and commodities. | 62598eecd7e4931a7ef3a7ec |
class Player: <NEW_LINE> <INDENT> def __init__(self, id_player, team_id, name, position, age, heigth, weight, canon, salary, clause, years, juvenil, country ): <NEW_LINE> <INDENT> self._id = ObjectId(id_player.zfill(24)) <NEW_LINE> self.team_id = ObjectId(team_id.zfill(24)) <NEW_LINE> self.name = name <NEW_LINE> self.p... | Representa un jugador. | 62598eec2c8b7c6e89bd1f0f |
@dataclass <NEW_LINE> class Budget: <NEW_LINE> <INDENT> limit_amount: float <NEW_LINE> calculated_actual_spend: float <NEW_LINE> calculated_forecasted_spend: float | Class specifying information about the AWS Budget
| 62598eec442bda511e95abb0 |
class RouterRealm(object): <NEW_LINE> <INDENT> def __init__(self, id, config, session=None): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.config = config <NEW_LINE> self.session = session <NEW_LINE> self.created = datetime.utcnow() <NEW_LINE> self.roles = {} | A realm managed by a router. | 62598eec71ff763f4b5e5eab |
class GeoPoint(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._lla_pt = Point() <NEW_LINE> self._ned_pt = Point() <NEW_LINE> self._ref_pt = np.array([[0.0]*3]) <NEW_LINE> <DEDENT> def distance(self, other_pt, is_lla=True): <NEW_LINE> <INDENT> return 0.0 | Class to hold a point in both lla and ned coordinates. | 62598eec851cf427c66b6a16 |
class boot(SetupTask): <NEW_LINE> <INDENT> def __class_name__(self): <NEW_LINE> <INDENT> return 'boot' <NEW_LINE> <DEDENT> async def run(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> await self.host.boot() <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> self.host.log.exception('boot') <NEW_LINE> <DEDENT... | A task that just call host.boot() | 62598eec009cb60464cffc9c |
class AutoscalerListResponse(_messages.Message): <NEW_LINE> <INDENT> items = _messages.MessageField('Autoscaler', 1, repeated=True) <NEW_LINE> kind = _messages.StringField(2, default=u'compute#autoscalerList') <NEW_LINE> nextPageToken = _messages.StringField(3) | A AutoscalerListResponse object.
Fields:
items: Autoscaler resources.
kind: Type of resource.
nextPageToken: [Output only] A token used to continue a truncated list
request. | 62598eecd6c5a102081e087f |
class TemporaryFile(FileProxyMixin): <NEW_LINE> <INDENT> def __init__(self, mode='w+b', bufsize=-1, suffix='', prefix='', dir=None): <NEW_LINE> <INDENT> fd, name = tempfile.mkstemp(suffix=suffix, prefix=prefix, dir=dir) <NEW_LINE> self.name = name <NEW_LINE> self.file = os.fdopen(fd, mode, bufsize) <NEW_LINE> self.clos... | Temporary file object constructor that works in Windows and supports
reopening of the temporary file in windows.
可以重复打开的 tempfile | 62598eec10dbd63aa1c6f2c4 |
class SwitchBase(AppBase): <NEW_LINE> <INDENT> def action( self, action_type: str, state: str, action_entity: str, **kwargs: dict ) -> None: <NEW_LINE> <INDENT> if action_type == "toggle": <NEW_LINE> <INDENT> if self.get_state(action_entity) == "off" and state == "on": <NEW_LINE> <INDENT> self.turn_on(action_entity) <N... | Define a base feature to take action for switches. | 62598eeceab8aa0e5d30a4ca |
class Die(): <NEW_LINE> <INDENT> def __init__(self, num_sides=8): <NEW_LINE> <INDENT> self.num_sides = num_sides <NEW_LINE> <DEDENT> def roll(self): <NEW_LINE> <INDENT> return randint(1, self.num_sides) | A class representing a single die. | 62598eec8a43f66fc4bf08c2 |
class O2MProxy(X2MProxy): <NEW_LINE> <INDENT> def __init__(self, parent, field): <NEW_LINE> <INDENT> self._parent = parent <NEW_LINE> self._field = field <NEW_LINE> self._records = [] <NEW_LINE> model = self._model <NEW_LINE> fields = self._descr['views']['edition']['fields'] <NEW_LINE> for (command, rid, values) in se... | O2MProxy()
| 62598eec16aa5153ce3fec4e |
class OpenPorts(db.Model, BaseModel): <NEW_LINE> <INDENT> __tablename__ = 'OpenPorts' <NEW_LINE> _id = db.Column(db.String(30), primary_key=True, unique=True) <NEW_LINE> protocol = db.Column(db.String(300)) <NEW_LINE> local_address = db.Column(db.String(300)) <NEW_LINE> foreign_address = db.Column(db.String(300)) <NEW_... | The OpenPorts model | 62598eec1b99ca400228e8b5 |
class DataForServer(object): <NEW_LINE> <INDENT> current_value = [] <NEW_LINE> voltage_value = None <NEW_LINE> sp = None | server data | 62598eec67a9b606de54471d |
class ConnectCommand(SshCommandFormatterMixin, SshConfigMergerMixin, GetRelationMixin, AbstractCommand): <NEW_LINE> <INDENT> get_strategy = RelatedGetStrategy <NEW_LINE> def extend_parser(self, parser): <NEW_LINE> <INDENT> parser.add_argument( '-H', '--host', const=Host, dest='model', action='store_const', default=Host... | connect to a specific host with NAME or ID | 62598eecbd1bec0571e14471 |
class ByTypeTest(GarbageCollectedMixin, unittest.TestCase): <NEW_LINE> <INDENT> def test_long_type_names(self): <NEW_LINE> <INDENT> x = type('MyClass', (), {'__module__': 'mymodule'})() <NEW_LINE> self.assertEqual([x], objgraph.by_type('mymodule.MyClass')) | Tests for the by_test function. | 62598eecf548e778e5969cd9 |
class HybridComputePrivateLinkScopeProperties(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'provisioning_state': {'readonly': True}, 'private_link_scope_id': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, 'provisioning_stat... | Properties that define a Azure Arc PrivateLinkScope resource.
Variables are only populated by the server, and will be ignored when sending a request.
:param public_network_access: Indicates whether machines associated with the private link scope
can also use public Azure Arc service endpoints. Possible values includ... | 62598eec7d43ff24874267a3 |
class UserList(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[User]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["User"]] = None, next_link: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> supe... | The response of a list operation.
:param value: Results of the list operation.
:type value: list[~azure.mgmt.devtestlabs.models.User]
:param next_link: Link for next set of results.
:type next_link: str | 62598eec8e7ae83300ee77de |
class Recipe(metrics.MetricSetting): <NEW_LINE> <INDENT> def __init__(self, name, url): <NEW_LINE> <INDENT> super(Recipe, self).__init__() <NEW_LINE> self.name = name <NEW_LINE> self.url = url <NEW_LINE> self._register() <NEW_LINE> <DEDENT> def _add_metric(self, *args, **options): <NEW_LINE> <INDENT> options['recipe_na... | A recipe is a collection of metrics that registers itself on instantiation. A DuplicateRecipe execption is raise if two recipes with the same name and URL are created.
For usage, see fiveruns.dash.recipe function. | 62598eecf548e778e5969cda |
class WindGeneratingUnit(GeneratingUnit): <NEW_LINE> <INDENT> def __init__(self, *args, **kw_args): <NEW_LINE> <INDENT> super(WindGeneratingUnit, self).__init__(*args, **kw_args) <NEW_LINE> <DEDENT> _attrs = [] <NEW_LINE> _attr_types = {} <NEW_LINE> _defaults = {} <NEW_LINE> _enums = {} <NEW_LINE> _refs = [] <NEW_LINE>... | A wind driven generating unit.A wind driven generating unit.
| 62598eec3317a56b869bd90d |
class ShowConsoleURL(show.ShowOne): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.ShowConsoleURL') <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(ShowConsoleURL, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'server', metavar='<server>', help='Server (name or ID)... | Show server's remote console URL | 62598eec1f037a2d8b9e2857 |
class MultipleValueField(forms.MultipleChoiceField): <NEW_LINE> <INDENT> def validate(self, value): <NEW_LINE> <INDENT> pass | This is the same as a MultipleChoiceField except choices don't matter
as no validation will be done. The advantage is that it will take a list
as input, and output a list as well, allowing several values to be passed.
In the end, it's like a CharField that can take a list of values. It is
used as the default field for... | 62598eecb7558d5895461d95 |
class TestDataSynchronizationJobPagedMetadata(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 testDataSynchronizationJobPagedMetadata(self): <NEW_LINE> <INDENT> model = billforward.models.data_sync... | DataSynchronizationJobPagedMetadata unit test stubs | 62598eec26068e7796d4b0ab |
class CredDefRecordSchema(BaseRecordSchema): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model_class = CredDefRecord <NEW_LINE> <DEDENT> cred_def_id = fields.Str(required=False) <NEW_LINE> schema_id = fields.Str(required=False) <NEW_LINE> attributes = fields.List(fields.Str(), required=False) <NEW_LINE> author ... | Schema to allow serialization/deserialization of Schema records. | 62598eecdd821e528d6d7693 |
class STAR: <NEW_LINE> <INDENT> def __init__(self, parameter=None, outsamtype='bam', test_align=False): <NEW_LINE> <INDENT> self.name = 'STAR' <NEW_LINE> self.parameters = parameter <NEW_LINE> if parameter is None: <NEW_LINE> <INDENT> self.parameters = [] <NEW_LINE> <DEDENT> self.outsamtype = outsamtype <NEW_LINE> self... | Aligning sequences with STAR | 62598eeccc0a2c1114479754 |
class Popen(_Popen): <NEW_LINE> <INDENT> method = 'loky' <NEW_LINE> def __init__(self, process_obj): <NEW_LINE> <INDENT> prep_data = spawn.get_preparation_data( process_obj._name, getattr(process_obj, "init_main_module", True)) <NEW_LINE> rhandle, wfd = _winapi.CreatePipe(None, 0) <NEW_LINE> if sys.version_info[:2] > (... | Start a subprocess to run the code of a process object | 62598eec2c8b7c6e89bd1f10 |
class LalDnsConfig(Config): <NEW_LINE> <INDENT> type_ = "laldns" <NEW_LINE> class Meta(SLAMBaseModel.Meta): <NEW_LINE> <INDENT> proxy = True <NEW_LINE> <DEDENT> def _unique_host(self, line, host, addr): <NEW_LINE> <INDENT> records = line.split() <NEW_LINE> return not (host.name in records[1:] or (addr and addr.addr and... | Generator for the configuration format of the LAL custom DNS format. | 62598eec2ae34c7f260a9837 |
class DeleteTranscodeTemplateGroupRequest(JDCloudRequest): <NEW_LINE> <INDENT> def __init__(self, parameters, header=None, version="v1"): <NEW_LINE> <INDENT> super(DeleteTranscodeTemplateGroupRequest, self).__init__( '/transcodeTemplateGroups/{groupId}', 'DELETE', header, version) <NEW_LINE> self.parameters = parameter... | 删除转码模板组 | 62598eec21bff66bcd7213a3 |
class Workflow3(Workflow): <NEW_LINE> <INDENT> item_class = Item3 <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> Workflow.__init__(self, **kwargs) <NEW_LINE> self.variables = {} <NEW_LINE> <DEDENT> @property <NEW_LINE> def _default_cachedir(self): <NEW_LINE> <INDENT> return os.path.join( os.path.expanduse... | Workflow class that generates Alfred 3 feedback. | 62598eec63b5f9789fe838ad |
class DataAugmenter(nn.Module): <NEW_LINE> <INDENT> def __init__(self, p=0.5, noise_only=False, channel_shuffling=False, drop_channnel=False): <NEW_LINE> <INDENT> super(DataAugmenter, self).__init__() <NEW_LINE> self.p = p <NEW_LINE> self.transpose = [] <NEW_LINE> self.flip = [] <NEW_LINE> self.toggle = False <NEW_LINE... | Performs random flip and rotation batch wise, and reverse it if needed.
Works | 62598eec4f6381625f198863 |
@add_metaclass(PluginMeta) <NEW_LINE> class Report(Plugin): <NEW_LINE> <INDENT> _settings = {} <NEW_LINE> _other_class_settings = { 'document' : { 'bar' : ("Bar setting.", None) } } | Report Base Class | 62598eec97e22403b383963f |
class GradingServiceError(Exception): <NEW_LINE> <INDENT> pass | Exception for grading service. Shown when Open Response Assessment servers cannot be reached. | 62598eec71ff763f4b5e5ead |
class OAuth(object): <NEW_LINE> <INDENT> AUTH_URI = 'https://accounts.google.com/o/oauth2/auth' <NEW_LINE> TOKEN_URI = 'https://accounts.google.com/o/oauth2/token' <NEW_LINE> USER_INFO = 'https://www.googleapis.com/userinfo/v2/me' <NEW_LINE> SCOPE = ['profile', 'email'] <NEW_LINE> @classmethod <NEW_LINE> def get_client... | Google Credentials | 62598eece5267d203ee6a057 |
class GitHubAdapterHTTPError(GitHubAdapterBaseError): <NEW_LINE> <INDENT> status_code = 400 <NEW_LINE> reason = '' | Base HTTP Error Exception | 62598eec0a50d4780f703af7 |
class UnauthorisedError(Exception): <NEW_LINE> <INDENT> pass | User is unauthorised | 62598eec23849d37ff84f808 |
class AjaxableResponseMixin(object): <NEW_LINE> <INDENT> def render_to_json_response(self, context, **response_kwargs): <NEW_LINE> <INDENT> data = json.dumps(context) <NEW_LINE> response_kwargs['content_type'] = 'application/json' <NEW_LINE> return HttpResponse(data, **response_kwargs) <NEW_LINE> <DEDENT> def form_inva... | Mixin to add AJAX support to a form.
Must be used with an object-based FormView (e.g. CreateView) | 62598eecbe383301e0251f2a |
class SandboxError(Exception): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.msg | Report problems with sandboxes. | 62598eec56b00c62f0fb1022 |
class SpecialLandingPage(SectionablePage): <NEW_LINE> <INDENT> template = "specialfeatureslanding/landing_page_guide2021.html" <NEW_LINE> parent_page_types = [ 'section.SectionPage', 'specialfeaturelanding.SpecialLandingPage', ] <NEW_LINE> subpage_types = [ 'specialfeaturelanding.SpecialLandingPage', 'article.ArticlePa... | This is the general model for "special features" landing pages, such as for the guide, or a magazine. | 62598eeccb5e8a47e493b521 |
class createArrayMemory: <NEW_LINE> <INDENT> def __init__(self,layer_canvas = -1, idx_fields = -1): <NEW_LINE> <INDENT> self.layer_canvas = layer_canvas <NEW_LINE> self.idx_fields = idx_fields <NEW_LINE> <DEDENT> def createSHPMemoryArray (self): <NEW_LINE> <INDENT> data=[] <NEW_LINE> array_id=[] <NEW_LINE> vl = QgsVect... | Create array numpy and shapefile memory
Input layer shapefile and index of fields
Output shp temporary (QgsVector), datas (Numpy of table and IDs (Numpy) | 62598eecbd1bec0571e14472 |
class ReviewParser(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def remove_doublebs( self, review ): <NEW_LINE> <INDENT> return re.sub( r'\\n', '\n', review ) <NEW_LINE> <DEDENT> def handle_currency(self, review): <NEW_LINE> <INDENT> safe_replacement = "&&" <NEW_LINE> de... | This class implements a way to seperate a review document into atomic sentences. (defined carefully
by the periods.)
methods:
parse( review ): accepts a string as a review document, and returns a list of the atomic
sentences. | 62598eec2ae34c7f260a9838 |
class Settings(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_colour = (230, 230, 230) <NEW_LINE> self.rocket_speed_factor = 1.5 | A class to store the settings of the rocket display window. | 62598eeca8370b77170eeb35 |
class Delete(base_classes.GlobalDeleter): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> base_classes.GlobalDeleter.Args(parser, 'compute.targetHttpProxies') <NEW_LINE> <DEDENT> @property <NEW_LINE> def service(self): <NEW_LINE> <INDENT> return self.compute.targetHttpProxies <NEW_LIN... | Delete target HTTP proxies. | 62598eeccc0a2c1114479756 |
class CompoundQuery(Query): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.queries = args <NEW_LINE> self.op = kwargs.pop('op', lambda x, y: x and y) <NEW_LINE> super(CompoundQuery, self).__init__() <NEW_LINE> <DEDENT> def _test(self, obj): <NEW_LINE> <INDENT> return reduce(self.op, [... | Compound query class which tests multiple queries by applying and/or
logics to them | 62598eec090684286d592a8a |
class FunctionInput(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'data_type': {'key': 'dataType', 'type': 'str'}, 'is_configuration_parameter': {'key': 'isConfigurationParameter', 'type': 'bool'}, } <NEW_LINE> def __init__( self, *, data_type: Optional[str] = None, is_configuration_parameter: Opt... | Describes one input parameter of a function.
:ivar data_type: The (Azure Stream Analytics supported) data type of the function input
parameter. A list of valid Azure Stream Analytics data types are described at
https://msdn.microsoft.com/en-us/library/azure/dn835065.aspx.
:vartype data_type: str
:ivar is_configurati... | 62598eeca17c0f6771d5a9a5 |
class CategoryAdminTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> params = {'title': 'Category 1', 'slug': 'category-1'} <NEW_LINE> self.category = Category.objects.create(**params) <NEW_LINE> self.site = AdminSite() <NEW_LINE> self.admin = CategoryAdmin(Category, admin_site=1) <NEW_LINE> ... | Test case for Product Admin | 62598eeccad5886f8bdc3a54 |
class NDOntology: <NEW_LINE> <INDENT> def __init__(self, database_name: str, collection_name: str, uri: str=None ) -> None: <NEW_LINE> <INDENT> self.client = MongoClient ( uri ) <NEW_LINE> self.db = self.client[database_name] <NEW_LINE> self.collection = self.db[collection_name] <NEW_LINE> <DEDENT> def query_by_id(self... | Manage a MongoDB that contains the Ontologies.
The only assumpation is that the data has fields int(id), str(name) list(int(children))
This database should have been ingested from the tools in ndontology/***scripts | 62598eecd7e4931a7ef3a7f0 |
class ZFS(ShellCommandParser): <NEW_LINE> <INDENT> def __init__(self, client, name, used, available, references, mountpoint): <NEW_LINE> <INDENT> super(ZFS, self).__init__() <NEW_LINE> self.client = client <NEW_LINE> self.name = name <NEW_LINE> self.used = int(used) <NEW_LINE> self.available = available != '-' and int(... | ZFS volumes
If filesystem is zvol, self.fstype = zvol and self.mountpoint = None | 62598eeca8370b77170eeb36 |
class MediaFolderForm(BaseModelForm): <NEW_LINE> <INDENT> ERROR_ITSELF_AS_PARENT = 'Cannot have itself as parent.' <NEW_LINE> ERROR_PARENT_AS_CHILD = 'Parent cannot be a child of this node.' <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = MediaFolder <NEW_LINE> fields = '__all__' <NEW_LINE> <DEDENT> parent = BrowseM... | Form for editing media folders. | 62598eec30bbd72246468385 |
class InstalledExtensionQuery(Model): <NEW_LINE> <INDENT> _attribute_map = { 'asset_types': {'key': 'assetTypes', 'type': '[str]'}, 'monikers': {'key': 'monikers', 'type': '[ExtensionIdentifier]'} } <NEW_LINE> def __init__(self, asset_types=None, monikers=None): <NEW_LINE> <INDENT> super(InstalledExtensionQuery, self).... | InstalledExtensionQuery.
:param asset_types:
:type asset_types: list of str
:param monikers:
:type monikers: list of :class:`ExtensionIdentifier <extension-management.v4_1.models.ExtensionIdentifier>` | 62598eec7047854f4633db25 |
class Record193_43(Record): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Record193_43, self).__init__(_type = 193, _subtype = 43) <NEW_LINE> self.current = self <NEW_LINE> self.longRad = 0.0 <NEW_LINE> self.latRad = 0.0 <NEW_LINE> self.longitudeTablet = 0.0 <NEW_LINE> self.latitudeTablet = 0.0 <NEW... | classdocs | 62598eec63b5f9789fe838af |
class CIDR(models.Model): <NEW_LINE> <INDENT> objects = CIDRManager() <NEW_LINE> repository = models.ForeignKey( 'packages.Repository', related_name='cidr_list', on_delete=models.CASCADE, ) <NEW_LINE> cidr = models.CharField( 'CIDR', max_length=128, help_text='IP addresses and/or subnet', ) <NEW_LINE> label = models.Ch... | Allow access based on the IP address of the client. | 62598eec7d847024c075ab1f |
class CTRLLMHeadModel(CTRLPreTrainedModel): <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> super(CTRLLMHeadModel, self).__init__(config) <NEW_LINE> self.transformer = CTRLModel(config) <NEW_LINE> self.lm_head = nn.Linear(config.n_embd, config.vocab_size, bias=True) <NEW_LINE> self.init_weights() <N... | **labels**: (`optional`) ``torch.LongTensor`` of shape ``(batch_size, sequence_length)``:
Labels for language modeling.
Note that the labels **are shifted** inside the model, i.e. you can set ``lm_labels = input_ids``
Indices are selected in ``[-1, 0, ..., config.vocab_size]``
All la... | 62598eecbe7bc26dc925120b |
class WYLoaderCSV(WYBaseLoader): <NEW_LINE> <INDENT> def load(self): <NEW_LINE> <INDENT> headers = [ 'office', 'party', 'district', 'candidate', 'county', 'precinct', 'votes', 'winner' ] <NEW_LINE> self._common_kwargs = self._build_common_election_kwargs() <NEW_LINE> self._common_kwargs['reporting_level'] = 'precinct' ... | Loads Wyoming results for 2006 and for 2002 special election.
Format:
Wyoming has PDF files that have been converted to CSV files with office names that correspond
to those used for elections in 2006 and for special elections. | 62598eeca219f33f346c4f8d |
class MissingParametersError(EmrError): <NEW_LINE> <INDENT> fmt = ('aws: error: The following required parameters are missing for ' '{object_name}: {missing}.') | One or more required parameters were not supplied.
:ivar object: The object that has missing parameters.
This can be an operation or a parameter (in the
case of inner params). The str() of this object
will be used so it doesn't need to implement anything
other than str().
:ivar missing: The names of t... | 62598eec5fdd1c0f98e5c6f3 |
class TypeMustBeOfTupleOrStr(YKTypeError): <NEW_LINE> <INDENT> pass | As in the typed lambda calculus, the only types are
atoms or constructed from the atoms | 62598eec30dc7b766599dfdb |
class AMC: <NEW_LINE> <INDENT> def __init__(self, amc_filename): <NEW_LINE> <INDENT> self.frames = [] <NEW_LINE> def __init_frame(framenum, data): <NEW_LINE> <INDENT> self.frames.append(data) <NEW_LINE> <DEDENT> reader = AMCReader(amc_filename) <NEW_LINE> reader.onFrame = __init_frame <NEW_LINE> reader.read() | Parent class representing information from a .amc file | 62598eec56b00c62f0fb1024 |
class InlineResponse20033(object): <NEW_LINE> <INDENT> swagger_types = { 'table_name': 'str', 'column_name': 'str', 'data_type': 'str' } <NEW_LINE> attribute_map = { 'table_name': 'table_name', 'column_name': 'column_name', 'data_type': 'data_type' } <NEW_LINE> def __init__(self, table_name=None, column_name=None, data... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598eec60cbc95b06362a91 |
class KivBitRsaError(Exception): <NEW_LINE> <INDENT> pass | Base exception for package :py:module:`kiv_bit_rsa` | 62598eec66656f66f7d58b34 |
class MBoxCommand(BackendCommand): <NEW_LINE> <INDENT> BACKEND = MBox <NEW_LINE> @classmethod <NEW_LINE> def setup_cmd_parser(cls): <NEW_LINE> <INDENT> parser = BackendCommandArgumentParser(cls.BACKEND, from_date=True, ssl_verify=True) <NEW_LINE> parser.parser.add_argument('uri', help="URI of the mboxes, usually the UR... | Class to run MBox backend from the command line. | 62598eecf7d966606f746745 |
class InvitationManager(models.Manager): <NEW_LINE> <INDENT> CODE_LENGTH = 10 <NEW_LINE> def create(self, **kwargs): <NEW_LINE> <INDENT> pool = ascii_uppercase + digits + '.-' <NEW_LINE> code = kwargs.get('code', ''.join(random.choices(pool, k=self.CODE_LENGTH))) <NEW_LINE> while self.filter(code=code).exists(): <NEW_L... | Invitation maneger.
Used to handle code creation. | 62598eec32920d7e50bc477e |
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.user == request.user | Custom permission which restricts delete and update
operations on models to the owner of the object. | 62598eec4e4d562566370b6c |
class PersonalBarViewlet(common.PersonalBarViewlet): <NEW_LINE> <INDENT> index = ViewPageTemplateFile('personal_bar.pt') <NEW_LINE> def render(self): <NEW_LINE> <INDENT> if api.user.is_anonymous(): <NEW_LINE> <INDENT> return super(PersonalBarViewlet, self).render() <NEW_LINE> <DEDENT> return '' <NEW_LINE> <DEDENT> def ... | Personal bar viewlet showing the user portrait image.
| 62598eec2ae34c7f260a983a |
class RegistroJ150(Registro): <NEW_LINE> <INDENT> campos = [ CampoFixo(1, 'REG', 'J150'), Campo(2, 'COD_AGL'), CampoNumerico(3, 'NIVEL_AGL'), Campo(4, 'DESCR_COD_AGL'), CampoNumerico(5, 'VL_CTA', precisao=2), Campo(6, 'IND_VL'), CampoNumerico(7, 'VL_CTA_ULT_DRE', precisao=2), Campo(8, 'IND_VL_ULT_DRE'), ] | DEMONSTRAÇÃO DO RESULTADO DO EXERCÍCIO | 62598eec796e427e5384ceeb |
class MyTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.url = url + "/game/comment-list" <NEW_LINE> <DEDENT> def test_1(self): <NEW_LINE> <INDENT> datas['gameId'] = get_gameId() <NEW_LINE> datas['type'] = '1' <NEW_LINE> datas['page'] = '1' <NEW_LINE> res = requests.post(url=se... | 游戏评论列表 | 62598eec4a966d76dd5ed62e |
class QueryOps(namedtuple("QueryOps", "uiformatter")): <NEW_LINE> <INDENT> OPERATIONS = [ 'op_like', 'op_equals', 'op_greaterthan', 'op_lessthan', 'op_greaterthanequals', 'op_lessthanequals', 'op_true', 'op_false', 'op_dontcare', 'op_between', 'op_in', 'op_contains', 'op_empty', 'op_trueornull', 'op_falseornull', 'op_s... | Instances of this class turn Spqueryfield operation numbers into
functions that turn lookup keys and predicate values into Django filters. | 62598eec4e4d562566370b6d |
class Function(Node): <NEW_LINE> <INDENT> def __init__(self, args, child): <NEW_LINE> <INDENT> self.args = args <NEW_LINE> self.child = child | Represents an function with given arguments and returning given type.
args (List(Node)) - arguments of the functions | 62598eec99cbb53fe682f605 |
class TestEditAttachmentOptions(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 testEditAttachmentOptions(self): <NEW_LINE> <INDENT> pass | EditAttachmentOptions unit test stubs | 62598eec851cf427c66b6a1b |
class Also(object): <NEW_LINE> <INDENT> def __init__(self, obj): <NEW_LINE> <INDENT> self.obj = obj <NEW_LINE> <DEDENT> def every(self, *a): <NEW_LINE> <INDENT> return self.obj.every(*a, also=True) <NEW_LINE> <DEDENT> def on(self, *a): <NEW_LINE> <INDENT> return self.obj.on(*a, also=True) <NEW_LINE> <DEDENT> def during... | Link range values together (appending instead of replacing) | 62598eecd7e4931a7ef3a7f2 |
class V1beta1CustomResourceDefinitionVersion(object): <NEW_LINE> <INDENT> swagger_types = { 'name': 'str', 'served': 'bool', 'storage': 'bool' } <NEW_LINE> attribute_map = { 'name': 'name', 'served': 'served', 'storage': 'storage' } <NEW_LINE> def __init__(self, name=None, served=None, storage=None): <NEW_LINE> <INDENT... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598eec2ae34c7f260a983b |
class ShaResBlock(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, strides, bn_use_global_stats, shared_conv=None, **kwargs): <NEW_LINE> <INDENT> super(ShaResBlock, self).__init__(**kwargs) <NEW_LINE> with self.name_scope(): <NEW_LINE> <INDENT> self.conv1 = conv3x3_block( in_channels=in_c... | Simple ShaResNet block for residual path in ShaResNet unit.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
strides : int or tuple/list of 2 int
Strides of the convolution.
bn_use_global_stats : bool
Whether global moving statistics is us... | 62598eec9c8ee8231303f503 |
class DteDbSubrec(): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> args = dict(model=None, field=None, subfield=None, formfield=None, onclause=None, ) <NEW_LINE> args.update(kwargs) <NEW_LINE> reqdfields = ['model', 'field', 'subfield', 'formfield'] <NEW_LINE> for field in reqdfields: <NEW_LINE>... | define subfield relationship for datatables editor db - form interface
for relationships defined like
class model()
field = relationship( 'mappingmodel', backref=tablemodel, lazy=True )
* model - model comprises the subrec
* dbfield - field in model which is used to be displayed to the user
* formfield... | 62598eec63b5f9789fe838b1 |
class TestSetup(unittest.TestCase): <NEW_LINE> <INDENT> layer = MSD_DIGEST_INTEGRATION_TESTING <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.portal = self.layer['portal'] <NEW_LINE> self.installer = api.portal.get_tool('portal_quickinstaller') <NEW_LINE> <DEDENT> def test_product_installed(self): <NEW_LINE> <IND... | Test that msd.digest is properly installed. | 62598eecf9cc0f698b1c4678 |
class ApplicationGatewayProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> HTTP = "Http" <NEW_LINE> HTTPS = "Https" | Application Gateway protocol.
| 62598eec009cb60464cffca2 |
class OverlayRepoCheck(Check): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def skip(cls, namespace, skip=False): <NEW_LINE> <INDENT> if not skip: <NEW_LINE> <INDENT> skip = not namespace.target_repo.masters <NEW_LINE> if skip: <NEW_LINE> <INDENT> logger.info(f'skipping {cls.__name__}, not running against overlay repo')... | Check that is only run against overlay repos. | 62598eec7047854f4633db26 |
class Topbar: <NEW_LINE> <INDENT> def __init__(self,master,label_text,buttons): <NEW_LINE> <INDENT> global cnf,scrsize,scrmode <NEW_LINE> self.master=master <NEW_LINE> font=( cnf.dml['topbar']['font'], cnf.dml['global']['fonts_size'][scrmode]) <NEW_LINE> self.frame = tk.Frame(master,relief=tk.FLAT,borderwidth=1,bg=cnf.... | simple top bar with buttons | 62598eece5267d203ee6a05a |
class EndpointNAK(Exception): <NEW_LINE> <INDENT> pass | Endpoint has no space for data (OUT) or no data available (IN). | 62598eec8e71fb1e983ba1c0 |
class ServerAssetsListSerializers(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = ServerAssets <NEW_LINE> fields = '__all__' <NEW_LINE> depth = 1 | 主机资产列化 | 62598eecaad79263cf42cf60 |
class InstrumentDriver(SingleConnectionInstrumentDriver): <NEW_LINE> <INDENT> __metaclass__ = META_LOGGER <NEW_LINE> def _build_protocol(self): <NEW_LINE> <INDENT> self._protocol = Protocol(Prompt, NEWLINE, self._driver_event) | InstrumentDriver subclass
Subclasses SingleConnectionInstrumentDriver with connection state machine. | 62598eeca219f33f346c4f8f |
class Iterator: <NEW_LINE> <INDENT> is_begin: bool = None <NEW_LINE> is_end: bool = None <NEW_LINE> name: str = None <NEW_LINE> def __init__(self, ): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def decrement(self, ): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def increment(self, ): <NEW_LINE> <INDENT> pass | Base class to define iterators. | 62598eecd7e4931a7ef3a7f3 |
class TestHSTORE(BaseObject): <NEW_LINE> <INDENT> __tablename__ = 'test_hstore' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> foo = Column(MutableDict.as_mutable(HSTORE), info={'colanderalchemy': {'typ': colander.String()}}, nullable=False, unique=True) <NEW_LINE> def __init__(self, foo): <NEW_LINE> <IND... | SQLAlchemy model for demonstration of the postgres dialect
:class:`sqlalchemy.dialects.postgresql.HSTORE` field
:param id: standart pk.
:param foo: :class:`sqlalchemy.dialects.postgresql.HSTORE` field.
Usage::
>>> hash = {'param1': 'foo', 'param2': 'bar'}
>>> hstore_obj = TestHSTORE(hash)
>>> hstore_obj.... | 62598eecd268445f26638f38 |
class Field(Declaration): <NEW_LINE> <INDENT> __slots__ = ( ) <NEW_LINE> def _init(self): <NEW_LINE> <INDENT> pass | Represents a C++ class field. | 62598eecbe383301e0251f2e |
class RolePrivileges(object): <NEW_LINE> <INDENT> swagger_types = { 'privileges': 'list[AuthIdNtokenPrivilegeItem]', 'resume': 'str' } <NEW_LINE> attribute_map = { 'privileges': 'privileges', 'resume': 'resume' } <NEW_LINE> def __init__(self, privileges=None, resume=None): <NEW_LINE> <INDENT> self._privileges = None <N... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598eecf548e778e5969ce0 |
class PreferenceFormView(FormView): <NEW_LINE> <INDENT> registry = None <NEW_LINE> form_class = None <NEW_LINE> template_name = "dynamic_preferences/form.html" <NEW_LINE> def get_form_class(self, *args, **kwargs): <NEW_LINE> <INDENT> section = self.kwargs.get('section', None) <NEW_LINE> form_class = preference_form_bui... | Display a form for updating preferences of the given section provided via URL arg.
If no section is provided, will dispaly a form for all fields of a given registry. | 62598eeccc0a2c1114479759 |
class SingletonMeta(type): <NEW_LINE> <INDENT> _exemplars = dict() <NEW_LINE> def __call__(cls, *args, **kwargs): <NEW_LINE> <INDENT> if cls not in cls._exemplars: <NEW_LINE> <INDENT> cls._exemplars[cls] = super().__call__(*args, **kwargs) <NEW_LINE> <DEDENT> return cls._exemplars[cls] | Singleton metaclass. | 62598eec1b99ca400228e8b8 |
class Survey(AbstractSurvey): <NEW_LINE> <INDENT> object_id = models.CharField(max_length=24, unique=True, validators=[LengthValidator(24)]) <NEW_LINE> study = models.ForeignKey('Study', on_delete=models.PROTECT, related_name='surveys') <NEW_LINE> @classmethod <NEW_LINE> def create_with_object_id(cls, **kwargs): <NEW_L... | Surveys contain all information the app needs to display the survey correctly to a participant,
and when it should push the notifications to take the survey.
Surveys must have a 'survey_type', which is a string declaring the type of survey it
contains, which the app uses to display the correct interface.
Surveys cont... | 62598eec627d3e7fe0e055df |
@attr.s(repr=False, cmp=False, hash=False) <NEW_LINE> class Event: <NEW_LINE> <INDENT> _lot = attr.ib(default=attr.Factory(_core.ParkingLot), init=False) <NEW_LINE> _flag = attr.ib(default=False, init=False) <NEW_LINE> def is_set(self): <NEW_LINE> <INDENT> return self._flag <NEW_LINE> <DEDENT> @_core.enable_ki_protecti... | A waitable boolean value useful for inter-task synchronization,
inspired by :class:`threading.Event`.
An event object manages an internal boolean flag, which is initially
False, and tasks can wait for it to become True. | 62598eec26068e7796d4b0b1 |
class HourlySpeedSumPipeline(base_handler.PipelineBase): <NEW_LINE> <INDENT> def run(self, filekey, blobkey): <NEW_LINE> <INDENT> output = yield mapreduce_pipeline.MapreducePipeline( "hourly_speed_sum", "map_reduce.hourly_speed_sum_map", "map_reduce.hourly_speed_sum_reduce", "mapreduce.input_readers.BlobstoreZipLineInp... | A pipeline to run hourly_speed_sum.
Args:
blobkey: blobkey to process as string. Should be a zip archive with
text files inside. | 62598eec435de62698e9a52b |
class RecognizeResponse(proto.Message): <NEW_LINE> <INDENT> results = proto.RepeatedField( proto.MESSAGE, number=2, message="SpeechRecognitionResult", ) | The only message returned to the client by the ``Recognize`` method.
It contains the result as zero or more sequential
``SpeechRecognitionResult`` messages.
Attributes:
results (Sequence[~.cloud_speech.SpeechRecognitionResult]):
Sequential list of transcription results
corresponding to sequential p... | 62598eec2ae34c7f260a983c |
class ImageFolder(DatasetFolder): <NEW_LINE> <INDENT> def __init__( self, root: str, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, loader: Callable[[str], Any] = default_loader, is_valid_file: Optional[Callable[[str], bool]] = None, ): <NEW_LINE> <INDENT> super(ImageFolder, self).__... | A generic data loader where the images are arranged in this way: ::
root/dog/xxx.png
root/dog/xxy.png
root/dog/xxz.png
root/cat/123.png
root/cat/nsdf3.png
root/cat/asd932_.png
Args:
root (string): Root directory path.
transform (callable, optional): A function/transform that takes in... | 62598eeca79ad16197768773 |
class SineLayer(nn.Module): <NEW_LINE> <INDENT> def __init__( self, in_features: int, out_features: int, bias: bool = True, is_first: bool = False, omega_0: float = 30 ): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.omega_0 = omega_0 <NEW_LINE> self.is_first = is_first <NEW_LINE> self.in_features = in_feature... | Copied from original Colab Notebook. Sine Layer, basic layer
of Siren network | 62598eeca8370b77170eeb3a |
class HomeView(BaseView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> message = ('You are using the schaukasten api ' 'version {}.'.format(API_VERSION)) <NEW_LINE> return dict(status='success', msg=message, version=API_VERSION) | Announce the api version at root path. | 62598eecac7a0e7691f70c6e |
@ns.route( "/server-backup/<name>", "/<server>/server-backup/<name>", methods=["GET", "DELETE"], endpoint="is_server_backup", ) <NEW_LINE> @ns.route( "/do-server-backup/<name>", "/<server>/do-server-backup/<name>", methods=["PUT"], endpoint="server_backup", ) <NEW_LINE> @ns.doc( params={ "server": "Which server to coll... | The :class:`burpui.api.backup.ServerBackup` resource allows you to
prepare a server-initiated backup.
This resource is part of the :mod:`burpui.api.backup` module. | 62598eec498bea3a75a56287 |
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class Likelihood(Parameterized): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def transform(self, y): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def sample(self, f, rng=None): <NEW_LINE> <INDENT> raise NotImplementedE... | Likelihood interface. | 62598eec5fc7496912d4761d |
class Sodium(material.Fluid): <NEW_LINE> <INDENT> name = "Sodium" <NEW_LINE> def setDefaultMassFracs(self): <NEW_LINE> <INDENT> self.setMassFrac("NA", 1.0) <NEW_LINE> self.p.refDens = 0.968 <NEW_LINE> <DEDENT> def density(self, Tk=None, Tc=None, check_range=True): <NEW_LINE> <INDENT> Tk = getTk(Tc, Tk) <NEW_LINE> Tc = ... | Simplified sodium material.
.. warning:: This is an academic-quality material. Bring in user-provided material
properties through plugins as necessary.
Most info from [ANL-RE-95-2]_
.. [ANL-RE-95-2] Fink, J.K., and Leibowitz, L. Thermodynamic and transport properties of sodium
liquid and vapor. United State... | 62598eec38b623060ffa77f1 |
class ErrorDetails(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, code: Optional[str] = None, target: Optional[str] = None, message: ... | ErrorDetails.
:param code:
:type code: str
:param target:
:type target: str
:param message:
:type message: str | 62598eec442bda511e95abb8 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.