code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Menus(models.Model): <NEW_LINE> <INDENT> menu_title = models.CharField(max_length=64) <NEW_LINE> menu_url = models.CharField(max_length=64,unique=True) <NEW_LINE> menu_type = models.CharField(max_length=64) <NEW_LINE> pmenu_id = models.CharField(max_length=64,null=True) <NEW_LINE> menu_num = models.CharField(max_... | 菜单表 | 62598f760383005118f6cfdc |
class MongoDBO(DBO): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> DBO.__init__(self) <NEW_LINE> <DEDENT> def __getitem__(self, k): <NEW_LINE> <INDENT> return self.__dict__[k] <NEW_LINE> <DEDENT> def collection(self): <NEW_LINE> <INDENT> raise NotImplementedError('collection() must be implemented by a sub... | {
dbo: DBO,
col: string,
db: string
} | 62598f7696565a6dacd2cbe8 |
class TestSession(Session): <NEW_LINE> <INDENT> def __init__(self, output_str, output_dir=None, settings_file=None, n_trials=10): <NEW_LINE> <INDENT> self.n_trials = n_trials <NEW_LINE> super().__init__(output_str, output_dir=None, settings_file=settings_file) <NEW_LINE> <DEDENT> def create_trials(self, durations=(.5, ... | Simple session with x trials. | 62598f766fece00bbaccb266 |
class IColuna(Interface): <NEW_LINE> <INDENT> autor = schema.TextLine( title=_(u"Autor"), required=True, description=_(u"Field description"), ) <NEW_LINE> foto = schema.Bytes( title=_(u"Foto"), required=True, description=_(u"Field description"), ) | Description of the Example Type | 62598f7626238365f5fac44f |
class Evaluation(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200) <NEW_LINE> out_of = models.IntegerField(default=0) <NEW_LINE> course = models.ForeignKey(Course, null=True) <NEW_LINE> def quiz_update_out_of(self, quiz): <NEW_LINE> <INDENT> self.out_of = quiz.out_of <NEW_LINE> self.save() <NEW... | Model used to track events to which students receive grades.
| 62598f7676d4e153a661c4ef |
class Pop3: <NEW_LINE> <INDENT> def __init__(self, config): <NEW_LINE> <INDENT> self.hostname = config["hostname"] <NEW_LINE> self.port = POP3_PORT <NEW_LINE> if "port" in config: <NEW_LINE> <INDENT> self.port = config["port"] <NEW_LINE> <DEDENT> self.sleep = 0 <NEW_LINE> if "sleep" in config: <NEW_LINE> <INDENT> self.... | Klasa implementująca protokuł POP3.
Jej zadaniem jest wykonanie próby uwierzytelnienia. | 62598f7630c21e258be980e0 |
class DecimalField(DefaultMixin, Field): <NEW_LINE> <INDENT> def __init__(self, context=None, default=NoDefault): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> super().__init__(default=default) <NEW_LINE> <DEDENT> @property <NEW_LINE> def context(self): <NEW_LINE> <INDENT> return self._context if self._context ... | Field for work with :class:`decimal.Decimal`
:param decimal.Context context: context for decimal operations
(default: run :func:`decimal.getcontext` when need)
:param decimal.Decimal default: | 62598f764e696a045264da6c |
class Device(Base): <NEW_LINE> <INDENT> __tablename__ = 'device' <NEW_LINE> address = sa.Column( pg.BYTEA, sa.CheckConstraint("length(address) = 6"), primary_key=True) | The model for a device. | 62598f7666673b3332c2fc9c |
class AbstractRange(models.Model): <NEW_LINE> <INDENT> name = models.CharField(_("Name"), max_length=128, unique=True) <NEW_LINE> includes_all_products = models.BooleanField(_('Includes All Products'), default=False) <NEW_LINE> included_products = models.ManyToManyField('catalogue.Product', related_name='includes', bla... | Represents a range of products that can be used within an offer | 62598f76b57a9660fecd135a |
class ZeroCool: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.zombies = [] <NEW_LINE> self.loop = asyncio.get_event_loop() <NEW_LINE> <DEDENT> def broadcast(self, client, data): <NEW_LINE> <INDENT> for zombie in self.zombies: <NEW_LINE> <INDENT> if zombie is not client: <NEW_LINE> <INDENT> self.loop.... | Are you not supposed to comment
botnet code? Is that bad?
CSI: CYBER says it's bad..
Damn, I might've slipped up!
Also, this is the server class. | 62598f76711fe17d825dffc0 |
class Property(Flattenable): <NEW_LINE> <INDENT> def __init__(self, name, value): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.on_changed = Event('Property(%s).on_changed' % name) <NEW_LINE> self._value = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return '<%s>' % self._value <NEW_LINE> <DE... | An object that holds *one* value
and notifies any subscribers about changes.
#TODO: make this spawn a real answer
>>> p = Property('test', 0)
>>> h = lambda name, val: print("{0}: {1}".format(name, val))
>>> p.on_changed += h
>>> p.value = 1
>>>
Base class to all other properties. | 62598f76fb3f5b602db47e1e |
class PM_PartLib(PM_GroupBox): <NEW_LINE> <INDENT> def __init__(self, parentWidget, title = 'Part Library', win = None, elementViewer = None ): <NEW_LINE> <INDENT> self.w = win <NEW_LINE> self.elementViewer = elementViewer <NEW_LINE> self.elementViewer.setDisplay(diTrueCPK) <NEW_LINE> self.partLib = None <NEW_LINE> s... | The PM_PartLib class provides a groupbox containing a partlib directory
The selected part in this list is shown by its elementViewer
(an instance of L{PM_PreviewGroupBox})
The part being previewed can then be deposited into the 3D workspace. | 62598f766aa9bd52df0d47b0 |
class LicenseTarget(ManagedObject): <NEW_LINE> <INDENT> consts = LicenseTargetConsts() <NEW_LINE> naming_props = set([u'slotId', u'aggrPortId', u'portId']) <NEW_LINE> mo_meta = MoMeta("LicenseTarget", "licenseTarget", "slot-[slot_id]-aggr-port-[aggr_port_id]-port-[port_id]", VersionMeta.Version223a, "InputOutput", 0xff... | This is LicenseTarget class. | 62598f761f5feb6acb162512 |
class DfaNetwork(db.Base): <NEW_LINE> <INDENT> __tablename__ = 'networks' <NEW_LINE> network_id = sa.Column(sa.String(36), primary_key=True) <NEW_LINE> name = sa.Column(sa.String(255)) <NEW_LINE> config_profile = sa.Column(sa.String(255)) <NEW_LINE> segmentation_id = sa.Column(sa.Integer) <NEW_LINE> tenant_id = sa.Colu... | Represents DFA network. | 62598f769b70327d1c57e68a |
class AverageMeter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.reset() <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <INDENT> self.val = 0.0 <NEW_LINE> self.avg = 0.0 <NEW_LINE> self.sum = 0.0 <NEW_LINE> self.count = 0 <NEW_LINE> <DEDENT> def update(self, val, n=1): <NEW_LINE> <INDENT> s... | Computes and stores the average and current value | 62598f766fece00bbaccb267 |
class MPMenuCallTextDialog(object): <NEW_LINE> <INDENT> def __init__(self, title='Enter Value', default=''): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.default = default <NEW_LINE> <DEDENT> def call(self): <NEW_LINE> <INDENT> from MAVProxy.modules.lib.wx_loader import wx <NEW_LINE> try: <NEW_LINE> <INDENT> ... | used to create a value dialog callback | 62598f7676d4e153a661c4f0 |
class RPCBase(CottontailBase): <NEW_LINE> <INDENT> def _declare_exchange(self, exchange_name): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _bind_to_queue(self, queue, topic): <NEW_LINE> <INDENT> pass | A service base class for implementing RPC messaging patterns using the RabbitMQ library. | 62598f76a4f1c619b294dec7 |
class SuitDashboardConfig(AppConfig): <NEW_LINE> <INDENT> name = 'suit_dashboard' <NEW_LINE> verbose_name = 'Suit Dashboard' <NEW_LINE> def ready(self): <NEW_LINE> <INDENT> AppSettings.check() | Django application configuration. | 62598f765e10d32532ce355b |
class Particles(object): <NEW_LINE> <INDENT> def __init__(self, config, cam): <NEW_LINE> <INDENT> self.__config = config <NEW_LINE> self.__cam = cam <NEW_LINE> height, width = config.particle_dimmensions() <NEW_LINE> self.__model = ParticleModel(height, width) <NEW_LINE> self.__generate_shaders(self.__model) <NEW_LINE>... | The glass (or it's visible part) | 62598f768c3a8732951f5e2a |
class Entity(BaseModel): <NEW_LINE> <INDENT> entityType: EntityTypeEnum = Field( ..., title='Type', alias='type' ) <NEW_LINE> inputs : List[Resource] = None <NEW_LINE> requestID : str = Field( None, title = 'Request ID', description = 'User-specified ID that will be echoed in responses.' ) <NEW_LINE> services : List[Se... | Holds information about the main object responsible for a service. | 62598f768da39b475be02abe |
class Configuration: <NEW_LINE> <INDENT> config = ConfigParser.ConfigParser() <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.config.add_section('general') <NEW_LINE> self.config.read(self.name()) <NEW_LINE> <DEDENT> def name(self): <NEW_LINE> <INDENT> return ('%s/.plant-pipeline.ini' % os.path.expanduser('~'))... | Session configuration | 62598f760383005118f6cfde |
class s: <NEW_LINE> <INDENT> t_none = get_type_name(None) <NEW_LINE> t_bool = get_type_name(bool) <NEW_LINE> t_int = get_type_name(int) <NEW_LINE> t_float = get_type_name(float) <NEW_LINE> t_str = get_type_name(six.binary_type) <NEW_LINE> t_unicode = get_type_name(six.text_type) <NEW_LINE> t_list = get_type_name(list) ... | Shortcuts | 62598f7696565a6dacd2cbe9 |
class DummyClient(DummyTransport): <NEW_LINE> <INDENT> pass | DummyClient is a client for the 'dummy' protocol.
Since this protocol is so simple, the client and the server are identical and both just trivially subclass DummyTransport. | 62598f76796e427e5384e072 |
class NoteTHandler(NewebeAuthHandler): <NEW_LINE> <INDENT> def get(self, noteId): <NEW_LINE> <INDENT> note = NoteManager.get_note(noteId) <NEW_LINE> if note: <NEW_LINE> <INDENT> if note.content: <NEW_LINE> <INDENT> note.content = markdown.markdown(note.content) <NEW_LINE> <DEDENT> self.render("templates/note.html", not... | This handler allows to retrieve note at HTML format.
* GET: Return for given id the HTML representation of corresponding note. | 62598f76ac7a0e7691f71df4 |
class Action5(EnableInteractiveAction): <NEW_LINE> <INDENT> name = 'OnDisconnect' | Enable conditions->On disconnect->Interactive | 62598f76be8e80087fbbe93c |
@dataclass(frozen=True) <NEW_LINE> class Changeset: <NEW_LINE> <INDENT> timestamp: datetime <NEW_LINE> changes: Set[ChangesetEntry] = field(default_factory=set) | A collection of filesystem changes during an interval | 62598f7673bcbd0ca4bc9b2b |
class TrieNode(dict): <NEW_LINE> <INDENT> def __init__(self, elem, parent=None): <NEW_LINE> <INDENT> super(TrieNode, self).__init__() <NEW_LINE> self.elem = elem <NEW_LINE> self.parent = parent <NEW_LINE> self.freq = 0 <NEW_LINE> <DEDENT> def add(self, elem): <NEW_LINE> <INDENT> child = self.setdefault(elem, TrieNode(e... | A node of a Trie.
TrieNode inherits from dictionary.
The dictionary entries of TrieNode are its children.
Its keys are the labels of the outgoing transitions,
the values are child nodes.
Every node also has a backlink to its (only) parent.
A root node is expected to have its parent property
set to None.
The node hold... | 62598f763eb6a72ae0389f1f |
class GraphCallback(FieldCallback): <NEW_LINE> <INDENT> def __init__(self, field, interval=None, title=None, reduce="mean", smoothing=0.1, draw_raw=True, quantile=0): <NEW_LINE> <INDENT> super().__init__(field, interval=interval, reduce=reduce) <NEW_LINE> self.graph_values = [] <NEW_LINE> self.smoothing = smoothing <NE... | Saves accumulating matplotlib graphs of stuff | 62598f760fa83653e46f47ce |
class P(Formula): <NEW_LINE> <INDENT> def __init__(self, *states): <NEW_LINE> <INDENT> super(P, self).__init__() <NEW_LINE> if states[0] is TRUE: <NEW_LINE> <INDENT> self.states = TRUE <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.states = frozenset(states) <NEW_LINE> <DEDENT> <DEDENT> def match(self, state, graph... | An atomic proposition.
Currently only allows state assertions -- i.e., that a given state
in the global transition graph contains some subset of states. | 62598f7607d97122c421657e |
class ZeroMQSubscriber(SubscriberBase): <NEW_LINE> <INDENT> def __init__(self, uri=None, context=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import zmq <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> raise RuntimeError('The pyzmq library is required for ' 'the ZeroMQSubscriber.') <NEW_LINE> <DEDENT>... | A helper that acts as ZeroMQ subscriber and will dispatch received
log records to the active handler setup. There are multiple ways to
use this class.
It can be used to receive log records from a queue::
subscriber = ZeroMQSubscriber('tcp://127.0.0.1:5000')
record = subscriber.recv()
But it can also be used... | 62598f7650485f2cf55da84c |
class MockSpawner(SimpleLocalProcessSpawner): <NEW_LINE> <INDENT> def user_env(self, env): <NEW_LINE> <INDENT> env = super().user_env(env) <NEW_LINE> if self.handler: <NEW_LINE> <INDENT> env['HANDLER_ARGS'] = self.handler.request.query <NEW_LINE> <DEDENT> return env <NEW_LINE> <DEDENT> @default('cmd') <NEW_LINE> def _c... | Base mock spawner
- disables user-switching that we need root permissions to do
- spawns `jupyterhub.tests.mocksu` instead of a full single-user server | 62598f768da39b475be02ac0 |
@method_decorator(login_required, name='dispatch') <NEW_LINE> @method_decorator(is_health_professional, name='dispatch') <NEW_LINE> class UnarchiveMessageHealthProfessionalView(View): <NEW_LINE> <INDENT> def post(self, pk): <NEW_LINE> <INDENT> message = Message.objects.get(pk=pk) <NEW_LINE> message.is_active_health_pro... | View to unarchive messages. | 62598f7615baa7234946185d |
@attr.s(init=False) <NEW_LINE> class AwsKmsKeySpec(KeySpec): <NEW_LINE> <INDENT> type_name = attr.ib(validator=membership_validator(("aws-kms",))) <NEW_LINE> def __init__(self, encrypt, decrypt, type_name, key_id): <NEW_LINE> <INDENT> self.type_name = type_name <NEW_LINE> super(AwsKmsKeySpec, self).__init__(encrypt, de... | AWS KMS key specification.
:param bool encrypt: Key can be used to encrypt
:param bool decrypt: Key can be used to decrypt
:param str type_name: Master key type name (must be "aws-kms")
:param str key_id: Master key ID | 62598f76d10714528d69d7ab |
class Category(models.Model): <NEW_LINE> <INDENT> parent = models.ForeignKey( 'self', verbose_name=_("category parent"), null=True, blank=True, on_delete=models.CASCADE) <NEW_LINE> title = models.CharField(_("title"), max_length=75) <NEW_LINE> slug = AutoSlugField(populate_from="title", db_index=False, blank=True) <NEW... | Category model
:ivar reindex_at: Last time this model was marked for reindex. It makes the search re-index the topic, it must be set explicitly
:vartype reindex_at: `:py:class:models.DateTimeField` | 62598f7663f4b57ef00859de |
class Text(RPObject): <NEW_LINE> <INDENT> def __init__(self, text="", parent=None, x=0, y=0, size=10, align="left", color=None, may_change=False, font=None): <NEW_LINE> <INDENT> RPObject.__init__(self) <NEW_LINE> if color is None: <NEW_LINE> <INDENT> color = Vec3(1) <NEW_LINE> <DEDENT> align_mode = TextNode.A_left <NEW... | Simple wrapper around OnscreenText, providing a simpler interface | 62598f76287bf620b6271496 |
class Activity(ModelBase): <NEW_LINE> <INDENT> actor = models.ForeignKey('users.UserProfile') <NEW_LINE> verb = models.URLField(verify_exists=False) <NEW_LINE> status = models.ForeignKey('statuses.Status', null=True, related_name='activity') <NEW_LINE> target_content_type = models.ForeignKey(ContentType, null=True) <NE... | Represents a single activity entry. | 62598f768c3a8732951f5e2d |
class Letter(LocalizedHTMLLetter): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> abstract = True <NEW_LINE> ordering = ["-created_at"] <NEW_LINE> <DEDENT> user = models.ForeignKey( JustfixUser, on_delete=models.CASCADE, related_name="laletterbuilder_letters" ) | A LA Letter Builder letter that's ready to be sent, or has already been sent. | 62598f76711fe17d825dffc4 |
class Deck(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.deck = [] <NEW_LINE> for suit in suits: <NEW_LINE> <INDENT> for rank in ranks: <NEW_LINE> <INDENT> self.deck.append(Card(suit, rank)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> result = "" <NEW_LINE> for car... | The Deck class does not require inputs.
Attributes:
deck(list): A list of all the cards in the deck | 62598f76d164cc6175820854 |
class TicketDetailView(DetailView): <NEW_LINE> <INDENT> template_name = 'tickets/ticket-detail-view.html' <NEW_LINE> extra_context = {'issue': 'issue details', 'already_voted': 'false'} <NEW_LINE> def get_object(self, queryset=Ticket): <NEW_LINE> <INDENT> _id = self.kwargs.get('id') <NEW_LINE> instance = Ticket.objects... | renders the tickets details page, figuring out if the current user is the owner
allows us to check we should show edit and delete controls | 62598f76507cdc57c63a466a |
class FingExp(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.type = self.__class__.__module__.split(".")[-1] + "/" + self.__class__.__name__ <NEW_LINE> self.to_fingerprint.append("type") <NEW_LINE> self.to_export["value"].append("type") <NEW_LINE> <DEDENT> def __setattr__(self, nam... | Base class for exporting and computing the fingerprint of
objects. | 62598f76d53ae8145f917d75 |
class Feature(object): <NEW_LINE> <INDENT> def __init__(self, text_collection): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> self._tc = text_collection <NEW_LINE> deligates = "list words_list".split() <NEW_LINE> for name in deligates: <NEW_LINE> <INDENT> method = getattr(self._tc, name) <NEW_LINE> setattr(sel... | ベクトル空間モデルの特徴量 (ex: tf-idf, pmi)
TODO: 委譲あたりのコードを修正したい
TODO: 素性抽出器みたいな名前にしたい
- 処理の流れ
1. textの取得
2. 特徴量抽出 (subclass) | 62598f7676d4e153a661c4f4 |
class AtomicBehavior(py_trees.behaviour.Behaviour): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> super(AtomicBehavior, self).__init__(name) <NEW_LINE> self.logger.debug("%s.__init__()" % (self.__class__.__name__)) <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> def setup(self, unused_timeout=15): <... | Base class for all atomic behaviors used to setup a scenario
Important parameters:
- name: Name of the atomic behavior | 62598f76287bf620b6271497 |
class FiniteMonoids(CategoryWithAxiom): <NEW_LINE> <INDENT> class ParentMethods: <NEW_LINE> <INDENT> def nerve(self): <NEW_LINE> <INDENT> from sage.homology.simplicial_set_examples import Nerve <NEW_LINE> return Nerve(self) <NEW_LINE> <DEDENT> def rhodes_radical_congruence(self, base_ring=None): <NEW_LINE> <INDENT> fro... | The category of finite (multiplicative) :class:`monoids <Monoids>`.
A finite monoid is a :class:`finite sets <FiniteSets>` endowed
with an associative unital binary operation `*`.
EXAMPLES::
sage: FiniteMonoids()
Category of finite monoids
sage: FiniteMonoids().super_categories()
[Category of monoids... | 62598f765e10d32532ce355d |
class FormatException(Exception): <NEW_LINE> <INDENT> pass | Exception for malformatted entry | 62598f767b25080760ed6d80 |
class Initializer: <NEW_LINE> <INDENT> def __init__(self, fname, ln): <NEW_LINE> <INDENT> nodelist = [] <NEW_LINE> myNode = None <NEW_LINE> self.myDhtNode = None <NEW_LINE> counter = 1 <NEW_LINE> if os.path.exists(fname): <NEW_LINE> <INDENT> with open(fname, 'r') as f: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for l... | This is the entry point for the whole program, everytime dht_node.py was called, Initializer shall be called.
This class mainly read the hostfile, turn all the entries into BaseNode objects, and put them into a list, and
my its own BaseNode | 62598f760383005118f6cfe2 |
class CreateTable(SchemaUpdate): <NEW_LINE> <INDENT> def __init__(self, model_: Type[model.Model]): <NEW_LINE> <INDENT> self._model = model_ <NEW_LINE> <DEDENT> def ddl(self) -> str: <NEW_LINE> <INDENT> key_fields = [ '{} {}'.format(name, field.ddl()) for name, field in self._model.fields.items() ] <NEW_LINE> key_field... | Update that allows creating a new table. | 62598f7630dc7b766599f13d |
class BloomFilter(object): <NEW_LINE> <INDENT> def __init__(self, n, p=0.01): <NEW_LINE> <INDENT> assert 0 < p < 1 <NEW_LINE> self.n = n <NEW_LINE> self.k = int(ceil(-log2(p))) <NEW_LINE> self.m = int(ceil(-n * log2(p) / log(2))) <NEW_LINE> self.array = bitarray(self.m) <NEW_LINE> self.array.setall(0) <NEW_LINE> <DEDEN... | Implementation of a Bloom filter. An instance is initialized by
it's capacity `n` and error rate `p`. The capacity tells how many
elements can be stored while maintaining no more than `p` false
positives. | 62598f7663f4b57ef00859df |
class TestPropertyEc2Subnet(BaseRuleTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestPropertyEc2Subnet, self).setUp() <NEW_LINE> self.collection.register(Subnet()) <NEW_LINE> <DEDENT> success_templates = [ 'templates/good/generic.yaml', 'templates/quickstart/nist_high_master.yaml', 'templat... | Test Ec2 Subnet Resources | 62598f7626238365f5fac455 |
class PostForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = models.Post <NEW_LINE> fields = ('title', 'slug', 'body', 'tags', 'status') <NEW_LINE> widgets = { 'status': forms.RadioSelect( choices=models.Post.PUBLISH_STATUS), } | Specify a couple changes to the default model form for comments | 62598f7673bcbd0ca4bc9b2f |
class ExtendedLocation(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, name: Optional[str] = None, type: Optional[Union[str, "ExtendedLocationTypes"]] = None, **kwargs ): <NEW_LINE> <I... | The complex type of the extended location.
:ivar name: The name of the extended location.
:vartype name: str
:ivar type: The type of the extended location. Possible values include: "EdgeZone".
:vartype type: str or ~azure.mgmt.containerservice.v2021_10_01.models.ExtendedLocationTypes | 62598f76fb3f5b602db47e21 |
class Enum(object): <NEW_LINE> <INDENT> def __init__(self, *keys): <NEW_LINE> <INDENT> self.__dict__.update(zip(keys, range(len(keys)))) <NEW_LINE> <DEDENT> def len(self): <NEW_LINE> <INDENT> return len(self.__dict__.keys()) <NEW_LINE> <DEDENT> def isValid(self, value): <NEW_LINE> <INDENT> return (value >= 0) and (valu... | Provides a 'C'-like enumeration for python
e.g. ERRORS = Enum("OVERFLOW", "DIV_BY_ZERO") | 62598f7615fb5d323ce7e609 |
class VideoCameraPublisher(SocketPublisher): <NEW_LINE> <INDENT> _type_name = 'base64 encoded RGBA image' <NEW_LINE> def process(self, image): <NEW_LINE> <INDENT> if sys.version_info < (3,4): <NEW_LINE> <INDENT> return bytes( image ) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return image <NEW_LINE> <DEDENT> <DEDENT... | Publish a base64 encoded RGBA image | 62598f76bde94217f37072d7 |
class Record(models.Model): <NEW_LINE> <INDENT> TYPE_CHOICES = [ (RECORD_INFO, RECORD_INFO), (RECORD_ERROR, RECORD_ERROR), ] <NEW_LINE> app = models.CharField(max_length=50) <NEW_LINE> src = models.CharField(max_length=50) <NEW_LINE> type = models.CharField(choices=TYPE_CHOICES, max_length=20) <NEW_LINE> action = model... | Defines an audit record for something that happened in translations | 62598f76d164cc6175820856 |
@PluginManager.register_class <NEW_LINE> class SegmentsMenu(bpy.types.Menu, BaseMenu): <NEW_LINE> <INDENT> bl_idname = OPERATOR_PREFIX + "bonemenu" <NEW_LINE> bl_label = "Select Segment" <NEW_LINE> @RDOperator.OperatorLogger <NEW_LINE> def draw(self, context): <NEW_LINE> <INDENT> current_model = context.active_object <... | :ref:`menu` for selecting robot segments. | 62598f76507cdc57c63a466c |
class VimBuffer(object): <NEW_LINE> <INDENT> def __getitem__(self, idx): <NEW_LINE> <INDENT> if isinstance(idx, slice): <NEW_LINE> <INDENT> return self.__getslice__(idx.start, idx.stop) <NEW_LINE> <DEDENT> rv = vim.current.buffer[idx] <NEW_LINE> return as_unicode(rv) <NEW_LINE> <DEDENT> def __getslice__(self, i, j): <N... | Wrapper around the current Vim buffer. | 62598f760fa83653e46f47d2 |
class SimList(ListResource): <NEW_LINE> <INDENT> def __init__(self, version): <NEW_LINE> <INDENT> super(SimList, self).__init__(version) <NEW_LINE> self._solution = {} <NEW_LINE> self._uri = '/Sims'.format(**self._solution) <NEW_LINE> <DEDENT> def stream(self, status=values.unset, iccid=values.unset, rate_plan=values.u... | PLEASE NOTE that this class contains preview products that are subject
to change. Use them with caution. If you currently do not have developer
preview access, please contact help@twilio.com. | 62598f76287bf620b6271499 |
class DNSCache: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> self.cache = {} <NEW_LINE> <DEDENT> def add(self, entry: DNSRecord) -> None: <NEW_LINE> <INDENT> self.cache.setdefault(entry.key, []).insert(0, entry) <NEW_LINE> <DEDENT> def remove(self, entry: DNSRecord) -> None: <NEW_LINE> <INDENT> t... | A cache of DNS entries | 62598f761d351010ab8f3421 |
@injected <NEW_LINE> @setup(IComponentService) <NEW_LINE> class ComponentService(IComponentService): <NEW_LINE> <INDENT> package = '__setup__' <NEW_LINE> default_locale = 'en' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> assert isinstance(self.package, str), 'Invalid package pattern %s' % self.package <NEW_LINE> ... | Provides the implementation for @see: IComponentService. | 62598f760383005118f6cfe4 |
class FolderCreateInPageVisitTest(PageVisitTest): <NEW_LINE> <INDENT> this_url = '/folders/1/create/' <NEW_LINE> page_title = 'Пасічний' <NEW_LINE> page_name = 'Створення теки' <NEW_LINE> def links_in_template(self, user): <NEW_LINE> <INDENT> username, flat_id, flat_No = self.get_user_name_flat(user) <NEW_LINE> s... | Допоміжний клас для функціональних тестів.
Описані тут параметри - для перевірки одної сторінки сайту.
Цей клас буде використовуватися як основа
для класів тестування цієї сторінки з іншими користувачами. | 62598f7623e79379d538bddb |
class Meta: <NEW_LINE> <INDENT> model = ChangeSetStatus <NEW_LINE> fields = ['name', 'active', 'hidden', 'details'] | ChangeSetStatus | 62598f766fece00bbaccb26e |
class TestViews(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> Category.objects.create(name="category 1") <NEW_LINE> Category.objects.create(name="category 2") <NEW_LINE> a = Product.objects.create( product_id='5449000000996', product_name='produit 1', nutriscore="d") <NEW_LINE> a.category_id.add(C... | class that test the view of the 'search' app | 62598f7673bcbd0ca4bc9b31 |
class ThanksView(CheckOutView): <NEW_LINE> <INDENT> implements(IThanksView) <NEW_LINE> template = ViewPageTemplateFile('views/thanks.pt') <NEW_LINE> def __call__(self): <NEW_LINE> <INDENT> shopping_site = self.shopping_site() <NEW_LINE> order = shopping_site.create_order() <NEW_LINE> if order is None: <NEW_LINE> <INDEN... | View for thanks | 62598f76b57a9660fecd1361 |
class ExpDeconvolve(CtrlNode): <NEW_LINE> <INDENT> nodeName = 'ExpDeconvolve' <NEW_LINE> uiTemplate = [ ('tau', 'spin', {'value': 10e-3, 'step': 1, 'minStep': 100e-6, 'dec': True, 'bounds': [0.0, None], 'suffix': 's', 'siPrefix': True}) ] <NEW_LINE> def processData(self, data): <NEW_LINE> <INDENT> tau = self.ctrls['tau... | Exponential deconvolution filter. | 62598f7673bcbd0ca4bc9b32 |
class User(AbstractUser): <NEW_LINE> <INDENT> id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) | User: will contain just a uuid field for now
| 62598f7671ff763f4b5e7050 |
class IVMOperatorTestCase(test.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(IVMOperatorTestCase, self).setUp() <NEW_LINE> ivm_connection = common.Connection('fake_host', 'fake_user', 'fake_password') <NEW_LINE> self.ivm_operator = powervm_operator.IVMOperator(ivm_connection) <NEW_LINE> <DED... | Tests the IVMOperator class. | 62598f76be383301e02530db |
class AMQPType(NetworkType): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _test_connection(url): <NEW_LINE> <INDENT> import pika <NEW_LINE> try: <NEW_LINE> <INDENT> with closing(pika.BlockingConnection(pika.URLParameters(url))) as conn: <NEW_LINE> <INDENT> conn.channel() <NEW_LINE> <DEDENT> <DEDENT> except pika.exc... | Validation type for an AMQP resource | 62598f76a4f1c619b294decf |
class VirtualMachineScaleSet(Resource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'nam... | Describes a Virtual Machine Scale Set.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Resource Id
:vartype id: str
:ivar name: Resource name
:vartype name: str
:ivar type: Resource type
:vartype type: str
:param location: Resource location
:type location: str
:param ... | 62598f761d351010ab8f3422 |
class ADCM: <NEW_LINE> <INDENT> def __init__(self, container, ip, port): <NEW_LINE> <INDENT> self.container = container <NEW_LINE> self.ip = ip <NEW_LINE> self.port = port <NEW_LINE> self.url = f'http://{self.ip}:{self.port}' <NEW_LINE> self.api = ADCMApiWrapper(self.url) <NEW_LINE> <DEDENT> def stop(self): <NEW_LINE> ... | Class that wraps ADCM Api operation over self.api (ADCMApiWrapper)
and wraps docker over self.container (see docker module for info) | 62598f768c3a8732951f5e32 |
class AttentionalPoolingLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.register_buffer('const', torch.FloatTensor([0.0001])) <NEW_LINE> self.softplus = nn.Softplus() <NEW_LINE> <DEDENT> def forward(self, features, weights): <NEW_LINE> <INDENT> features =... | Attentional Pooling layer. | 62598f76d10714528d69d7b1 |
class ReaderSummary: <NEW_LINE> <INDENT> def __init__(self, reader: BaseReader, k: int = 3) -> None: <NEW_LINE> <INDENT> self.k = min(k, len(reader)) <NEW_LINE> self.reader = reader <NEW_LINE> self._iteminfos = ItemInfoFactory.build_all(self.reader, self.k) <NEW_LINE> <DEDENT> def sort(self, key: str = "name", reverse:... | Wraps a reader and its corresponding list of iteminfos | 62598f7615baa72349461863 |
class SwaggerFormat(namedtuple('SwaggerFormat', 'format to_python to_wire validate description')): <NEW_LINE> <INDENT> pass | User-defined format which can be registered with a
:class:`bravado_core.spec.Spec` to handle marshalling to wire format,
unmarshalling to a python type, and format specific validation.
:param format: Name for the user-defined format.
:param to_python: function to unmarshal a value of this format.
Eg. lambda val_st... | 62598f7626068e7796d4c240 |
class ARFieldValueOrArithStruct(Structure): <NEW_LINE> <INDENT> _fields_ = [ ('tag', c_uint), ('u', ARFieldValueOrArithUnion) ] | Structure used to hold values to compare in a relational qualification
operation (ar.h line 1116). | 62598f7623e79379d538bddd |
class PrioQueue: <NEW_LINE> <INDENT> def __init__(self, elist = []): <NEW_LINE> <INDENT> self._elems = list(elist) <NEW_LINE> if elist: <NEW_LINE> <INDENT> self.buildheap() <NEW_LINE> <DEDENT> <DEDENT> def is_empty(self): <NEW_LINE> <INDENT> return not self._elems <NEW_LINE> <DEDENT> def peek(self): <NEW_LINE> <INDENT>... | 利用堆来实现优先队列 | 62598f768a349b6b43685b27 |
class QGraphicsTransform(__PyQt5_QtCore.QObject): <NEW_LINE> <INDENT> def applyTo(self, QMatrix4x4): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def childEvent(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def connectNotify(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def... | QGraphicsTransform(parent: QObject = None) | 62598f760383005118f6cfe6 |
class Genre(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200, help_text="Ingrese el nombre del género (p. ej. Ciencia Ficción, Poesía Francesa etc.)") <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Modelo que representa un género literario (p. ej. ciencia ficción, poesía, etc.). | 62598f7682261d6c5272fb48 |
class AuthenticationMechanism(Model): <NEW_LINE> <INDENT> _attribute_map = { 'symmetric_key': {'key': 'symmetricKey', 'type': 'SymmetricKey'}, 'x509_thumbprint': {'key': 'x509Thumbprint', 'type': 'X509Thumbprint'}, 'type': {'key': 'type', 'type': 'str'}, } <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> su... | AuthenticationMechanism.
:param symmetric_key: The primary and secondary keys used for SAS based
authentication.
:type symmetric_key: ~service.models.SymmetricKey
:param x509_thumbprint: The primary and secondary x509 thumbprints used
for x509 based authentication.
:type x509_thumbprint: ~service.models.X509Thumbpri... | 62598f763eb6a72ae0389f27 |
class _T(object): <NEW_LINE> <INDENT> def __getattr__(self, key): <NEW_LINE> <INDENT> return _Element(key) | a very simple templating engine.
Essentially, you get HTML elements by saying T.elementname, and
you'll get an _Element with that tag name.
This is supposed to be instanciated to a singleton (here, T). | 62598f7615fb5d323ce7e60e |
class MultiShader(object): <NEW_LINE> <INDENT> def __init__(self, program, shader): <NEW_LINE> <INDENT> self._program = program <NEW_LINE> self._shader = shader <NEW_LINE> self._set_items = {} <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> return self._set_items[key] <NEW_LINE> <DEDENT> def __setit... | Emulates the API of a MainFunction while wrapping all vertex or fragment
shaders in a MultiProgram.
Example::
mp = MultiProgram(vert, frag)
mp.add_program('p1')
mp.add_program('p2')
# applies to all programs
mp.vert['u_scale'] = (1, 2)
# applies to one program
mp.get_program('p1'... | 62598f76a4f1c619b294ded0 |
class StyleGuide(object): <NEW_LINE> <INDENT> def __init__( self, options, formatter, stats, filename=None, decider=None, ): <NEW_LINE> <INDENT> self.options = options <NEW_LINE> self.formatter = formatter <NEW_LINE> self.stats = stats <NEW_LINE> self.decider = decider or DecisionEngine(options) <NEW_LINE> self.filenam... | Manage a Flake8 user's style guide. | 62598f766fece00bbaccb271 |
class Chat(protocol.Protocol): <NEW_LINE> <INDENT> def connectionMade(self): <NEW_LINE> <INDENT> self._peer = self.transport.getPeer() <NEW_LINE> <DEDENT> def dataReceived(self, data): <NEW_LINE> <INDENT> user, msg = data.split(":") <NEW_LINE> transports[user] = self.transport <NEW_LINE> for key in transports.keys(): <... | Chat protocol | 62598f767b25080760ed6d86 |
class CreateMixin(object): <NEW_LINE> <INDENT> CREATE = 'create' <NEW_LINE> @consumer(action=CREATE) <NEW_LINE> def create(self, message): <NEW_LINE> <INDENT> serializer = self.get_serializer(data=message.content['data']) <NEW_LINE> if serializer.is_valid(): <NEW_LINE> <INDENT> self.get_queryset().model._default_manage... | Mixin - Adds the consumer that create object.
Using with SerializerMixin and SingleObjectMixin | 62598f7626068e7796d4c242 |
class Polyline(_DateTimeAware, _CZMLBaseObject): <NEW_LINE> <INDENT> show = None <NEW_LINE> followSurface = None <NEW_LINE> _width = None <NEW_LINE> width = class_property(Number, 'width'); <NEW_LINE> _material = None <NEW_LINE> material = class_property(Material, 'material') <NEW_LINE> _positions = None <NEW_LINE> pos... | A polyline, which is a line in the scene composed of multiple segments.
| 62598f768da39b475be02ac8 |
class Config(object): <NEW_LINE> <INDENT> SECRET_KEY = os.environ.get('SECRET_KEY') <NEW_LINE> DEBUG = True | Common configurations | 62598f76be8e80087fbbe946 |
class AppConfigError(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> self.message = message <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.message) | Issue With the App Config | 62598f76dc8b845886d52e9a |
class TestAuditLogsApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = esp_sdk.apis.audit_logs_api.AuditLogsApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_list(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_show(s... | AuditLogsApi unit test stubs | 62598f76fb3f5b602db47e24 |
class PowerSet: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.result = [] <NEW_LINE> <DEDENT> def generate_power_set(self, nums): <NEW_LINE> <INDENT> results = [] <NEW_LINE> self.dfs(sorted(nums), 0, [], results) <NEW_LINE> return results <NEW_LINE> <DEDENT> def dfs(self, nums, index, path, res): <NE... | Class to generate the power set. | 62598f76be383301e02530df |
class Subscription(graphene.ObjectType): <NEW_LINE> <INDENT> on_new_chat_message = OnNewChatMessage.Field() | GraphQL subscriptions. | 62598f7607d97122c4216588 |
class SODARProjectModelSerializer(SODARModelSerializer): <NEW_LINE> <INDENT> project = serializers.SlugRelatedField( slug_field='sodar_uuid', read_only=True ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def to_representation(self, instance): <NEW_LINE> <INDENT> ret = super().to_representation(in... | Base serializer for SODAR models with a project relation.
The project field is read only because it is retrieved through the object
reference in the URL. | 62598f767c178a314d78cd8e |
class DiagramWriter: <NEW_LINE> <INDENT> def __init__(self, config, styles): <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.pkg_edges, self.inh_edges, self.imp_edges, self.ass_edges = styles <NEW_LINE> self.printer = None <NEW_LINE> <DEDENT> def write(self, diadefs): <NEW_LINE> <INDENT> for diagram in diadefs... | base class for writing project diagrams
| 62598f760fa83653e46f47d8 |
class NotImplementedMenu(Menu): <NEW_LINE> <INDENT> PLACEHOLDER = 0 | These are placeholders for menus not yet converted. | 62598f761f5feb6acb16251e |
class IssueSeverity: <NEW_LINE> <INDENT> Critical, High, Medium, Informational = range(4) | Enum for defining severity of an issue | 62598f764e696a045264da72 |
class Adjective(Word): <NEW_LINE> <INDENT> def __init__(self, tag, feature, time): <NEW_LINE> <INDENT> self.feature = feature <NEW_LINE> self.time = time <NEW_LINE> Word.__init__(self, tag) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'A.' + self.tag + '.' + self.feature <NEW_LINE> <DEDENT> def rea... | Adjective describing a feature of an item. | 62598f768c3a8732951f5e36 |
class CocciConfigException(CocciException): <NEW_LINE> <INDENT> pass | Exception raised when configuration parameter are not correct.
For example, it is returned if spatch command can not be found. | 62598f7650485f2cf55da857 |
class MultiBlock(WriterBlock): <NEW_LINE> <INDENT> def __init__(self, blocks): <NEW_LINE> <INDENT> self._blocks = blocks <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> for i in self._blocks: <NEW_LINE> <INDENT> i.__enter__() <NEW_LINE> <DEDENT> <DEDENT> def __exit__(self, *args): <NEW_LINE> <INDENT> for i... | Proxy container for a list of WriterBlocks. | 62598f760383005118f6cfea |
class ScatterPlot(Graph): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ScatterPlot, self).__init__(*args, **kwargs) <NEW_LINE> self._area = 10 ** 2 <NEW_LINE> self._legend_labels = [] <NEW_LINE> self._color_function = lambda c, ps: c <NEW_LINE> <DEDENT> def area(self, area): <NEW_L... | A basic scatter plot implementation. | 62598f76a05bb46b3848a167 |
class IteratorSlice(object): <NEW_LINE> <INDENT> def __init__(self, iterable): <NEW_LINE> <INDENT> self.iterable = iterable <NEW_LINE> <DEDENT> def __getitem__(self, index): <NEW_LINE> <INDENT> if type(index) == slice: <NEW_LINE> <INDENT> (start, end) = (index.start or 0, index.stop or len(self.iterable)) <NEW_LINE> if... | Allows you to iterate through a section of an indexable iterable without creating a new list
or having step through every item till the start index (like islice does) | 62598f76c432627299fa28c1 |
class SNLIDataset(Dataset): <NEW_LINE> <INDENT> def __init__(self, data_list): <NEW_LINE> <INDENT> self.data_list = data_list <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self.data_list) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> token_idx_tuple, label = self.data_list[... | Class that represents a train/validation/test dataset that's readable for PyTorch
Note that this class inherits torch.utils.data.Dataset | 62598f76711fe17d825dffcf |
class TestLeapYear(unittest.TestCase): <NEW_LINE> <INDENT> def test_find_leap(self): <NEW_LINE> <INDENT> obj = LeapYear() <NEW_LINE> res = obj.is_leap_year(2000) <NEW_LINE> assert res is True <NEW_LINE> <DEDENT> def test_find_non_leap(self): <NEW_LINE> <INDENT> obj = LeapYear() <NEW_LINE> res = obj.is_leap_year(2001) <... | Unit test cases for finding leap year | 62598f767c178a314d78cd90 |
class NdCalculateUtil(): <NEW_LINE> <INDENT> def generateMixRandomCode(self,count): <NEW_LINE> <INDENT> base = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" <NEW_LINE> result = [] <NEW_LINE> for index in range(count): <NEW_LINE> <INDENT> result.append(base[random.randint(0, len(base)-1)]) <NEW_LINE> ... | 产生长度为count的随机字符串 | 62598f7666673b3332c2fcab |
class NAC(nn.Module): <NEW_LINE> <INDENT> def __init__(self, num_layers, in_dim, hidden_dim, out_dim): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.num_layers = num_layers <NEW_LINE> self.in_dim = in_dim <NEW_LINE> self.hidden_dim = hidden_dim <NEW_LINE> self.out_dim = out_dim <NEW_LINE> layers = [] <NEW_LINE... | A stack of NAC layers.
Attributes:
num_layers: the number of NAC layers.
in_dim: the size of the input sample.
hidden_dim: the size of the hidden layers.
out_dim: the size of the output. | 62598f7615fb5d323ce7e612 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.