code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class UserAgent(base.UserAgent): <NEW_LINE> <INDENT> def __init__(self, device_object): <NEW_LINE> <INDENT> self.device_object = device_object <NEW_LINE> self.certainty = device_object.accuracy <NEW_LINE> <DEDENT> def getCertainty(self): <NEW_LINE> <INDENT> return self.certainty <NEW_LINE> <DEDENT> def getMatchedUserAg... | Wurfl record wrapper, abstracted in mobile.sniffer way.
| 625990863317a56b869bf306 |
class StatementOfAccountStart(ModelView): <NEW_LINE> <INDENT> __name__ = 'account.statement.of.account.start' <NEW_LINE> fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year', required=True) <NEW_LINE> account = fields.Many2One('account.account', 'Account', domain=[('kind', '!=', 'view')], required=True) <NE... | Statement of Account | 625990863617ad0b5ee07cd5 |
class ChangeItemsHandler(BaseHandler): <NEW_LINE> <INDENT> @check('login') <NEW_LINE> def GET(self): <NEW_LINE> <INDENT> return self.write(success({'items': config.ITEMS})) | 变更条款 | 625990867c178a314d78e9ac |
class ODict(collections.OrderedDict): <NEW_LINE> <INDENT> def __init__(self, pairs=[]): <NEW_LINE> <INDENT> if isinstance(pairs, dict): <NEW_LINE> <INDENT> raise Exception("ODict does not allow construction from a dict") <NEW_LINE> <DEDENT> super(ODict, self).__init__(pairs) <NEW_LINE> old_items = self.items <NEW_LINE>... | A wrapper for OrderedDict that doesn't allow sorting of keys | 6259908644b2445a339b771e |
class JobQueue(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self._queue = {} <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Queue:%s,%d jobs"%(self.name, len(self._queue)) <NEW_LINE> <DEDENT> def __getitem__(self, key): <NEW_LINE> <INDENT> r... | This object represents Queue of Job objects | 6259908663b5f9789fe86cee |
class ContBatchNorm3d(nn.modules.batchnorm._BatchNorm): <NEW_LINE> <INDENT> def _check_input_dim(self, input): <NEW_LINE> <INDENT> if input.dim() != 5: <NEW_LINE> <INDENT> raise ValueError('expected 5D input (got {}D input)' .format(input.dim())) <NEW_LINE> <DEDENT> <DEDENT> def forward(self, input): <NEW_LINE> <INDENT... | Normalize the input and check if the convolution size matrix is 5*5.
For more info check documentation of torch.nn.BatchNorm1d . | 625990864527f215b58eb762 |
class ContactForm(FlaskForm): <NEW_LINE> <INDENT> mail_subject = StringField("Subject: ", validators=[Length(min=5, max=250)]) <NEW_LINE> mail_body = TextAreaField(validators=[DataRequired(), Length(min=5)]) <NEW_LINE> sent_by = StringField("Your Email: ", validators=[DataRequired(), Email()]) <NEW_LINE> submit = Submi... | A Flask-WTF form to send me an email | 6259908626068e7796d4e4c8 |
class ExpasyGetter(Obo): <NEW_LINE> <INDENT> bioversions_key = ontology = PREFIX <NEW_LINE> typedefs = [has_member, has_molecular_function] <NEW_LINE> def iter_terms(self, force: bool = False) -> Iterable[Term]: <NEW_LINE> <INDENT> return get_terms(version=self._version_or_raise, force=force) | A getter for ExPASy Enzyme Classes. | 62599086bf627c535bcb3059 |
class PuzzleView(SubView): <NEW_LINE> <INDENT> def __init__(self, parent: View, frame: tk.Frame): <NEW_LINE> <INDENT> super().__init__(parent, frame) <NEW_LINE> self.clue = tk.StringVar(self.root) <NEW_LINE> self.clue_label = tk.Label(self.frame, textvariable=self.clue) <NEW_LINE> self.time = tk.StringVar(self.root) <N... | The puzzle group of the crossword application. | 625990864a966d76dd5f0a6c |
class _Basis(CombinatorialFreeModule, BindableClass): <NEW_LINE> <INDENT> def __init__(self, algebra, prefix=None): <NEW_LINE> <INDENT> if prefix is None: <NEW_LINE> <INDENT> self._prefix = self._basis_name <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._prefix = prefix <NEW_LINE> <DEDENT> CombinatorialFreeModule._... | Technical methods (i.e., not mathematical) that are inherited by each
basis of the algebra. These methods cannot be defined in the category. | 6259908650812a4eaa621988 |
class Invoice(SerializableModel): <NEW_LINE> <INDENT> customer = db.ReferenceProperty(Customer, collection_name='invoices') <NEW_LINE> total_price = DecimalProperty() <NEW_LINE> currency = db.StringProperty(choices=CURRENCY_CHOICES, default=DEFAULT_CURRENCY) <NEW_LINE> status = db.StringProperty(choices=INVOICE_STATUS_... | Maintains invoice information for orders placed by customers.
Helps answer these questions:
1. What was the total price of the invoice?
2. Who was the customer?
3. What currency was used for invoicing?
4. What was ordered by the customer?
5. When was the invoice generated?
6. How many and which transactions were used... | 6259908697e22403b383ca7e |
class Link(DatetimeModel, NullableGenericModel, AuthorableModel, IconModel, WeightedModel, UUID64Model): <NEW_LINE> <INDENT> TYPES = ((0, _("Text")), (1, _("Icon")), (2, _("Icon and text")), (3, _("oEmbed")), (4, _("Flash"))) <NEW_LINE> group = models.CharField(max_length=16, blank=True, db_index=True, verbose_name=_("... | Lien interne ou externe | 625990867047854f46340f3b |
@dataclass <NEW_LINE> class JobAssignment(object): <NEW_LINE> <INDENT> job: Job <NEW_LINE> assignee: Optional[scroll_util.Brother] <NEW_LINE> signer: Optional[scroll_util.Brother] <NEW_LINE> late: bool <NEW_LINE> bonus: bool <NEW_LINE> def to_raw(self) -> Tuple[str, str, str, str, str, str, str]: <NEW_LINE> <INDENT> si... | Tracks a job's assignment and completion | 62599086283ffb24f3cf5427 |
class Solution: <NEW_LINE> <INDENT> def productExceptSelf(self, nums: List[int]) -> List[int]: <NEW_LINE> <INDENT> result = [1] * len(nums) <NEW_LINE> for i in range(1, len(nums)): <NEW_LINE> <INDENT> result[i] = nums[i-1] * result[i-1] <NEW_LINE> <DEDENT> right_prod = 1 <NEW_LINE> for i in range(len(nums)-1, -1, -1): ... | Time complexity: O(n)
Space complexity: O(1) - output array does not count as extra space as per problem description. | 62599086f9cc0f698b1c608f |
class FileLogObserver(_GlobalStartStopMixIn): <NEW_LINE> <INDENT> timeFormat = None <NEW_LINE> def __init__(self, f): <NEW_LINE> <INDENT> self.write = f.write <NEW_LINE> self.flush = f.flush <NEW_LINE> <DEDENT> def getTimezoneOffset(self, when): <NEW_LINE> <INDENT> offset = datetime.utcfromtimestamp(when) - datetime.fr... | Log observer that writes to a file-like object.
@type timeFormat: C{str} or C{NoneType}
@ivar timeFormat: If not C{None}, the format string passed to strftime(). | 625990867cff6e4e811b75ca |
class TaskThread(): <NEW_LINE> <INDENT> def __init__(self,tid): <NEW_LINE> <INDENT> self.tid = tid <NEW_LINE> <DEDENT> def run_tasks(self,tid): <NEW_LINE> <INDENT> task_obj = TestTask.objects.get(id=tid) <NEW_LINE> case_list = task_obj.cases.split(",") <NEW_LINE> case_list.pop(-1) <NEW_LINE> task_obj.status=1 <NEW_LINE... | '实现测试任务的多线程 | 625990867c178a314d78e9ae |
class Rating(models.Model): <NEW_LINE> <INDENT> Source = models.CharField(max_length=100) <NEW_LINE> Value = models.CharField(max_length=100) <NEW_LINE> movie_detail = models.ForeignKey(MovieDetail, on_delete=models.CASCADE, related_name="Ratings") <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return f'Ratings from... | Stores movie ratings and is related to Movie detail model | 6259908660cbc95b06365b30 |
class Robot: <NEW_LINE> <INDENT> population = 0 <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> print('(Инициализация {0})'.format(self.name)) <NEW_LINE> Robot.population += 1 <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> print('{0} уничтожается!'.format(self.name)) <NE... | 'Представляет робота с именем. | 625990863317a56b869bf309 |
class Version(object): <NEW_LINE> <INDENT> def __init__(self, version, rel_type=None): <NEW_LINE> <INDENT> self._parts = [int(part) for part in version.split(".")] <NEW_LINE> self._str = version <NEW_LINE> self._type = rel_type <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return str(self._parts) <NEW_LIN... | Version control object.
Creates multi-part version number functionality.
Using str(instance) returns a string containing dot separated numbers.
Args:
version (str): Dot separated integer string (e.g. "1.0.2")
rel_type (str): Release type (e.g. "beta", "stable", etc.).
Used to generate decorated string... | 62599086aad79263cf430345 |
class MyPickleableObject(tf.__internal__.tracking.AutoTrackable): <NEW_LINE> <INDENT> @property <NEW_LINE> @layer_utils.cached_per_instance <NEW_LINE> def my_id(self): <NEW_LINE> <INDENT> _PICKLEABLE_CALL_COUNT[self] += 1 <NEW_LINE> return id(self) | Needed for InterfaceTests.test_property_cache_serialization.
This class must be at the top level. This is a constraint of pickle,
unrelated to `cached_per_instance`. | 62599087f9cc0f698b1c6091 |
class name(baseMODS): <NEW_LINE> <INDENT> affiliations = models.ListField(affiliation) <NEW_LINE> altRepGroup = models.Attribute() <NEW_LINE> authority = models.Attribute() <NEW_LINE> authorityURI = models.Attribute() <NEW_LINE> descriptions = models.ListField(description) <NEW_LINE> displayForms = models.ListField(dis... | name MODS element in Redis datastore | 62599087a8370b77170f1f58 |
class EventletServer(ServerAdapter): <NEW_LINE> <INDENT> def run(self, handler): <NEW_LINE> <INDENT> from eventlet import wsgi, listen <NEW_LINE> try: <NEW_LINE> <INDENT> wsgi.server(listen((self.host, self.port)), handler, log_output=(not self.quiet)) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> wsgi.serv... | Untested | 62599087bf627c535bcb305f |
class TicTacToe( TwoPlayersGame ): <NEW_LINE> <INDENT> def __init__(self, players): <NEW_LINE> <INDENT> self.players = players <NEW_LINE> self.board = [0 for i in range(9)] <NEW_LINE> self.nplayer = 1 <NEW_LINE> <DEDENT> def possible_moves(self): <NEW_LINE> <INDENT> return [i+1 for i,e in enumerate(self.board) if e==0]... | The board positions are numbered as follows:
7 8 9
4 5 6
1 2 3 | 62599087656771135c48adf6 |
class Node: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.edges = dict() <NEW_LINE> self.edgeset = set() <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter(self.edges.values()) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str... | A Node correspondes to a graph table 'innode'.
Nodes are attached to each other by Edges. | 62599087283ffb24f3cf542c |
class TransitionAction(object): <NEW_LINE> <INDENT> __slots__ = ("door_id", "_command_list") <NEW_LINE> def __init__(self, InitCommandList=None): <NEW_LINE> <INDENT> assert InitCommandList is None or isinstance(InitCommandList, CommandList), "%s: %s" % (InitCommandList.__class__, InitCommandList) <NEW_LINE> self.door_i... | Object containing information about commands to be executed upon
transition into a state.
.command_list --> list of commands to be executed upon the transition.
.door_id --> An 'id' which is supposed to be unique for a command list.
It is (re-)assigned during the process of
... | 62599087e1aae11d1e7cf5d9 |
class DoubleGaussianNLL(BaseGaussianNLL): <NEW_LINE> <INDENT> posterior_name = 'DoubleGaussianBNNPosterior' <NEW_LINE> def __init__(self, Y_dim): <NEW_LINE> <INDENT> super(DoubleGaussianNLL, self).__init__(Y_dim) <NEW_LINE> self.tril_idx = torch.tril_indices(self.Y_dim, self.Y_dim, offset=0) <NEW_LINE> self.tril_len = ... | The negative log likelihood (NLL) for a mixture of two Gaussians, each
with a full but constrained as low-rank plus diagonal covariance
Only rank 2 is currently supported. `BaseGaussianNLL.__init__` docstring
for the parameter description. | 625990873317a56b869bf30a |
class Solution: <NEW_LINE> <INDENT> def verticalOrder(self, root): <NEW_LINE> <INDENT> vPosToVals = defaultdict(list) <NEW_LINE> leftMost = 0 <NEW_LINE> rightMost = -1 <NEW_LINE> queue = deque() <NEW_LINE> if root: <NEW_LINE> <INDENT> queue.append( (root,0) ) <NEW_LINE> leftMost = 0 <NEW_LINE> rightMost = 0 <NEW_LINE>... | @param root: the root of tree
@return: the vertical order traversal | 62599087283ffb24f3cf542d |
class RedisSet(PassThroughSerializer): <NEW_LINE> <INDENT> def __init__(self, set_key, redis_client=redis_config.CLIENT): <NEW_LINE> <INDENT> self._client = redis_client or redis_pipe.RedisPipe() <NEW_LINE> self.set_key = set_key <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return self._client.scard(self.... | An object which behaves like a Python set, but which is based by Redis. | 625990874527f215b58eb766 |
class ConfFixture(config_fixture.Config): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(ConfFixture, self).setUp() <NEW_LINE> self.conf.set_default('compute_driver', 'fake.SmallFakeDriver') <NEW_LINE> self.conf.set_default('fake_network', True) <NEW_LINE> self.conf.set_default('flat_network_bridge', 'b... | Fixture to manage global conf settings. | 62599087adb09d7d5dc0c0e7 |
class GoogleCommand( CommandObject ): <NEW_LINE> <INDENT> def __init__( self, parameter = None ): <NEW_LINE> <INDENT> CommandObject.__init__( self ) <NEW_LINE> self.parameter = parameter <NEW_LINE> if parameter != None: <NEW_LINE> <INDENT> self.setDescription( u"Performs a Google web search for " u"\u201c%s\u201d." % p... | Implementation of the 'google' command. | 62599087bf627c535bcb3061 |
class Exploit(exploits.Exploit): <NEW_LINE> <INDENT> __info__ = { 'name': 'Comtrend CT 5361T Password Disclosure', 'description': 'WiFi router Comtrend CT 5361T suffers from a Password Disclosure Vulnerability', 'authors': [ 'TUNISIAN CYBER', ], 'references': [ 'https://packetstormsecurity.com/files/126129/Comtrend-CT-... | Exploit implementation for Comtrend CT-5361T Password Disclosure vulnerability.
If the target is vulnerable it allows to read credentials for admin, support and user." | 625990873617ad0b5ee07cdf |
class KickStarter(DB.Model): <NEW_LINE> <INDENT> id = DB.Column(DB.BigInteger, primary_key=True) <NEW_LINE> name = DB.Column(DB.String, nullable=False) <NEW_LINE> usd_goal = DB.Column(DB.Float, nullable=False) <NEW_LINE> country = DB.Column(DB.String, nullable=False) <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> r... | Twitter Users that correspond to tweets | 62599087167d2b6e312b835e |
class BaseTestCase(TestCase): <NEW_LINE> <INDENT> def create_app(self): <NEW_LINE> <INDENT> app.config.from_object('server.config.TestingConfig') <NEW_LINE> return app | Base Tests | 6259908744b2445a339b7723 |
class get_all_tables_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.LIST, 'success', (TType.STRING,None), None, ), (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, o1=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> self.o1 = ... | Attributes:
- success
- o1 | 62599087dc8b845886d55148 |
class Turbidity(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._adc = ADC(Pin.board.X6) <NEW_LINE> <DEDENT> def get(self): <NEW_LINE> <INDENT> volts = ((self._adc.read()/ adc_range) * in_voltage) <NEW_LINE> return volts <NEW_LINE> <DEDENT> def NTU(self): <NEW_LINE> <INDENT> volts = self.get()... | Turbidity meter | 6259908760cbc95b06365b33 |
class UnverifiedEmailError(QiitaError): <NEW_LINE> <INDENT> pass | Email has not been validated | 62599087283ffb24f3cf542f |
class Place(RealmBaseModel, ModelWithDiscussions): <NEW_LINE> <INDENT> TYPE_COUNTRY = 'country' <NEW_LINE> TYPE_LOCALITY = 'locality' <NEW_LINE> TYPE_HOUSE = 'house' <NEW_LINE> TYPES = ( (TYPE_COUNTRY, 'Страна'), (TYPE_LOCALITY, 'Местность'), (TYPE_HOUSE, 'Здание'), ) <NEW_LINE> title = models.CharField('Название', max... | Географическое место. Для людей, событий и пр. | 62599087099cdd3c636761c2 |
class DeviceDetails(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'serial_number': {'readonly': True}, 'management_resource_id': {'readonly': True}, 'management_resource_tenant_id': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'serial_number': {'key': 'serialNumber', 'type': 'str'}, 'managemen... | Device details.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar serial_number: device serial number.
:vartype serial_number: str
:ivar management_resource_id: Management Resource Id.
:vartype management_resource_id: str
:ivar management_resource_tenant_id: Management Reso... | 6259908792d797404e389924 |
class GcfHook(GoogleCloudBaseHook): <NEW_LINE> <INDENT> _conn = None <NEW_LINE> def __init__(self, api_version, gcp_conn_id='google_cloud_default', delegate_to=None): <NEW_LINE> <INDENT> super(GcfHook, self).__init__(gcp_conn_id, delegate_to) <NEW_LINE> self.api_version = api_version <NEW_LINE> <DEDENT> def get_conn(se... | Hook for the Google Cloud Functions APIs. | 62599087d486a94d0ba2db46 |
class LibpcapProvider(InterfaceProvider): <NEW_LINE> <INDENT> name = "libpcap" <NEW_LINE> libpcap = True <NEW_LINE> def load(self): <NEW_LINE> <INDENT> if not conf.use_pcap or WINDOWS: <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> if not conf.cache_pcapiflist: <NEW_LINE> <INDENT> load_winpcapy() <NEW_LINE> <DEDENT>... | Load interfaces from Libpcap on non-Windows machines | 625990874a966d76dd5f0a76 |
class RemuneracionNomenclador(RemuneracionPorcentual): <NEW_LINE> <INDENT> cargo = models.ForeignKey('Cargo', help_text=u'Remuneración porcentual inherente a un cargo en particular.') | Una remuneración porcentual nomenclador inherente a un cargo en particular. | 6259908763b5f9789fe86cfa |
class NotFilter(AbstractFilter): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> AbstractFilter.__init__(self, "NotFilter") <NEW_LINE> <DEDENT> def add_child(self, mo): <NEW_LINE> <INDENT> self._child.append(mo) <NEW_LINE> <DEDENT> def write_xml(self, xml_doc=None, option=None, element_name=None): <NEW_LINE... | NotFilter Class. | 625990877b180e01f3e49e2d |
class Trace: <NEW_LINE> <INDENT> def __init__(self, board, time_limits): <NEW_LINE> <INDENT> self.time_limits = [t for t in time_limits] <NEW_LINE> self.initial_board = board.clone() <NEW_LINE> self.actions = [] <NEW_LINE> self.winner = 0 <NEW_LINE> self.reason = "" <NEW_LINE> <DEDENT> def add_action(self, player, acti... | Keep track of a played game.
Attributes:
time_limits -- a sequence of 2 elements containing the time limits in
seconds for each agent, or None for a time-unlimitted agent
initial_board -- the initial board
actions -- list of tuples (player, action, time) of the played action.
Respectively, the player number, t... | 62599087091ae356687067d3 |
class CurrencyField(DecimalField): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> if 'max_digits' in kwargs.keys(): <NEW_LINE> <INDENT> del kwargs['max_digits'] <NEW_LINE> <DEDENT> if 'decimal_places' in kwargs.keys(): <NEW_LINE> <INDENT> del kwargs['decimal_places'] <NEW_LINE> <DEDENT> default =... | A CurrencyField is simply a subclass of DecimalField with a fixed format:
max_digits = 12, decimal_places=2, and defaults to 0.00 | 6259908792d797404e389925 |
class UpdateField(MoodleDBSession): <NEW_LINE> <INDENT> def __init__(self, database_name, field_name): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.field_name = field_name <NEW_LINE> with self.DBSession() as session: <NEW_LINE> <INDENT> DataFields = self.table_string_to_class('data_fields') <NEW_LINE> Data = ... | Class that is used to update a field in a database module | 62599087e1aae11d1e7cf5dc |
class CassandraKeyspaceResource(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'id': {'required': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(CassandraKeyspaceResource, self).__init__(**kwargs) <NEW_L... | Cosmos DB Cassandra keyspace resource object.
All required parameters must be populated in order to send to Azure.
:param id: Required. Name of the Cosmos DB Cassandra keyspace.
:type id: str | 625990878a349b6b43687df0 |
class RHTicketConfigQRCodeImage(RHManageRegFormBase): <NEW_LINE> <INDENT> def _process(self): <NEW_LINE> <INDENT> qr = qrcode.QRCode( version=6, error_correction=qrcode.constants.ERROR_CORRECT_M, box_size=4, border=1 ) <NEW_LINE> checkin_app = OAuthApplication.find_one(system_app_type=SystemAppType.checkin) <NEW_LINE> ... | Display configuration QRCode. | 62599087ec188e330fdfa43f |
class my_error(Exception): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg | My own exception class
Attributes :
msg -- explanation of the error | 625990877047854f46340f47 |
class XorEncoder(object): <NEW_LINE> <INDENT> def encode(self,data,key): <NEW_LINE> <INDENT> if len(data) % len(key) != 0: <NEW_LINE> <INDENT> raise "Data length must be a multiple of key length" <NEW_LINE> <DEDENT> key_idx=0 <NEW_LINE> xor_data="" <NEW_LINE> for x in range(len(data)): <NEW_LINE> <INDENT> xor_data=xor_... | Base class for architecture-specific XOR encoders. Provides self.encode(). | 62599087aad79263cf43034c |
class GetLatestDocumentsTestCase(TestCase): <NEW_LINE> <INDENT> longMessage = True <NEW_LINE> def test_tag(self): <NEW_LINE> <INDENT> baker.make('document_library.DocumentTranslation', language_code='en', is_published=True) <NEW_LINE> baker.make('document_library.DocumentTranslation', language_code='en', is_published=T... | Tests for the ``get_latest_documents`` tamplatetag. | 6259908797e22403b383ca8a |
class getSquareChatAnnouncements_result(object): <NEW_LINE> <INDENT> def __init__(self, success=None, e=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> self.e = e <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadab... | Attributes:
- success
- e | 62599087dc8b845886d5514c |
@Wrapper.register("reptile") <NEW_LINE> class ReptileWrapper(_FOWrapper): <NEW_LINE> <INDENT> _all_grads = True <NEW_LINE> def __init__( self, model: Model, meta_optimizer: torch.optim.Optimizer, optimizer_cls: str, optimizer_kwargs: Dict[str, Any], grad_norm: Optional[float] = None, grad_clipping: Optional[float] = No... | Wrapper for Reptile.
Arguments:
model (nn.Module): classifier.
optimizer_cls: optimizer class.
meta_optimizer_cls: meta optimizer class.
optimizer_kwargs (dict): kwargs to pass to optimizer upon construction.
meta_optimizer_kwargs (dict): kwargs to pass to meta optimizer upon construction. | 62599087091ae356687067d5 |
class MassExportItemsDialog(MassSelectItemsDialog): <NEW_LINE> <INDENT> data_submitted = Signal(object) <NEW_LINE> def __init__(self, parent, db_mngr, *db_maps): <NEW_LINE> <INDENT> super().__init__(parent, db_mngr, *db_maps) <NEW_LINE> self.setWindowTitle("Export items") <NEW_LINE> <DEDENT> def accept(self): <NEW_LINE... | A dialog to let users chose items for JSON export. | 62599087ec188e330fdfa441 |
class PublisherViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> serializer_class = PublisherSerializer <NEW_LINE> queryset = Publisher.objects.all() | ViewSet for Publishers | 625990872c8b7c6e89bd537a |
class RuleArray(object): <NEW_LINE> <INDENT> def __init__(self, rules=None): <NEW_LINE> <INDENT> self.swagger_types = { 'rules': 'list[OutputRule]' } <NEW_LINE> self.attribute_map = { 'rules': 'rules' } <NEW_LINE> self._rules = rules <NEW_LINE> <DEDENT> @property <NEW_LINE> def rules(self): <NEW_LINE> <INDENT> return s... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259908771ff763f4b5e9342 |
class ModelRelationshipModification(BaseModel): <NEW_LINE> <INDENT> operation = SmallIntegerField( validators=[MinValueValidator(-1), MaxValueValidator(1)], null=True, choices=DjangoOperations, ) <NEW_LINE> field = ForeignKey(ModelField, on_delete=CASCADE) <NEW_LINE> entry = ForeignKey(ModelEntry, on_delete=CASCADE) <N... | Used to record the model entry even modifications of relationships. (M2M, Foreign)
The operation attribute can have 4 valid values:
-1 (delete), 0 (modify), 1 (create), None (n/a)
field is the field where the relationship changed (entry got added or removed)
and model is the entry that got removed/added from the rel... | 62599087fff4ab517ebcf3ab |
class ICountryportlet(IPortletDataProvider): <NEW_LINE> <INDENT> pass | Define your portlet schema here | 6259908763b5f9789fe86cfe |
class PolicyGradientAgent(LearningAgent): <NEW_LINE> <INDENT> def __init__(self, module, learner = None): <NEW_LINE> <INDENT> assert isinstance(module, FeedForwardNetwork) <NEW_LINE> assert len(module.outmodules) == 1 <NEW_LINE> LearningAgent.__init__(self, module, learner) <NEW_LINE> self.explorationlayer = GaussianLa... | PolicyGradientAgent is a learning agent, that adds a GaussianLayer to
its module and stores the log likelihoods (loglh) in the dataset. It is used
for rllearners like enac, reinforce, gpomdp, ... | 6259908726068e7796d4e4d8 |
class BaseDownloadWorker(object): <NEW_LINE> <INDENT> def process(self, request): <NEW_LINE> <INDENT> raise NotImplementedError() | Download worker interface | 625990873346ee7daa33842d |
class TCol: <NEW_LINE> <INDENT> B = '\033[1m' <NEW_LINE> RB = '\033[21m' <NEW_LINE> RE = '\033[91m' <NEW_LINE> GR = '\033[92m' <NEW_LINE> BL = '\033[94m' <NEW_LINE> ST = '\033[0m' | Classe pour les escape sequence de couleurs | 62599087e1aae11d1e7cf5de |
class NotebookTab: <NEW_LINE> <INDENT> @make_thread_safe <NEW_LINE> def __init__(self, widget, **kwargs): <NEW_LINE> <INDENT> if not isinstance(widget.parent, Notebook): <NEW_LINE> <INDENT> raise ValueError("widgets of NotebookTabs must be child widgets " "of a Notebook, but %r is a child widget of %r" % (widget, widge... | Represents a tab that is in a notebook, or is ready to be added to a
notebook.
The *widget* must be a child widget of a :class:`.Notebook` widget. Each
:class:`.NotebookTab` belongs to the widget's parent notebook; for example,
if you create a tab like this...
::
tab = teek.NotebookTab(teek.Label(asd_notebook, "h... | 6259908750812a4eaa621990 |
class DeclarationGroupNode(NonValuedExpressionNode): <NEW_LINE> <INDENT> def _get_declarations(self): <NEW_LINE> <INDENT> return self._declarations <NEW_LINE> <DEDENT> declarations = property(_get_declarations) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(DeclarationGroupNode, self).__init__() <NEW_LINE> se... | Clase C{DeclarationGroupNode} del árbol de sintáxis abstracta.
Este nodo del árbol de sintáxis abstracta es la clase base de los
nodos C{TypeDeclarationGroupNode} y C{FunctionDeclarationGroupNode},
los cuales representan un grupo de declaraciones consecutivas de tipos
o funciones respectivamente. En nodos tienen el o... | 625990873617ad0b5ee07ce7 |
class PassThrough(ExplicitComponent): <NEW_LINE> <INDENT> def __init__(self, i_var, o_var, val, units=None): <NEW_LINE> <INDENT> super(PassThrough, self).__init__() <NEW_LINE> self.i_var = i_var <NEW_LINE> self.o_var = o_var <NEW_LINE> self.units = units <NEW_LINE> self.val = val <NEW_LINE> if isinstance(val, (float, i... | Helper component that is needed when variables must be passed
directly from input to output | 6259908771ff763f4b5e9344 |
class TreeNode: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.left = None <NEW_LINE> self.right = None <NEW_LINE> self.parent = None | Node with left and right children | 6259908799fddb7c1ca63ba7 |
class UsuarioGestionForm(forms.ModelForm): <NEW_LINE> <INDENT> username = forms.RegexField( label=("Nombre de usuario"), max_length=30, regex=r"^[\w.@+-]+$", help_text=("Required. 30 characters or fewer. Letters, digits and " "@/./+/-/_ only."), error_messages={ 'invalid': ("This value may contain only letters, numbers... | Formluario para la modificacion de usuarios
Hereda de forms.ModelForm y utiliza la clase user para
agregar ciertos campos a la hora de la modificacion | 6259908726068e7796d4e4da |
class Clusters(ListModel): <NEW_LINE> <INDENT> _attribute_map = { 'clusters': {'type': list}, } <NEW_LINE> _attribute_defaults = {'clusters': []} <NEW_LINE> _list_attr = 'clusters' <NEW_LINE> _list_class = Cluster | Representation of a group of one or more Clusters. | 62599087099cdd3c636761c6 |
class Server(object): <NEW_LINE> <INDENT> def __init__(self, port, service_info): <NEW_LINE> <INDENT> global monitoring_info <NEW_LINE> monitoring_info = service_info <NEW_LINE> self.__server = SocketServer.TCPServer(('', port), RequestHandler) <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> self.__server.serv... | HTTP server to get monitoring info.
| 6259908792d797404e389928 |
class MonsterFlairCondition(EventCondition): <NEW_LINE> <INDENT> name = "monster_flair" <NEW_LINE> def test(self, session: Session, condition: MapCondition) -> bool: <NEW_LINE> <INDENT> slot = int(condition.parameters[0]) <NEW_LINE> category = condition.parameters[1] <NEW_LINE> name = condition.parameters[2] <NEW_LINE>... | Check to see if the given monster flair matches the expected value.
Script usage:
.. code-block::
is monster_flair <slot>,<category>,<name>
Script parameters:
slot: Position of the monster in the player monster list.
category: Category of the flair.
name: Name of the flair. | 625990872c8b7c6e89bd537e |
class Statistics: <NEW_LINE> <INDENT> def __init__(self, save_path: Path = DEFAULT_SAVE_PATH) -> None: <NEW_LINE> <INDENT> assert isinstance(save_path, Path) <NEW_LINE> self.save_path = save_path <NEW_LINE> self._load_data() <NEW_LINE> self.env = TrueSkill() <NEW_LINE> backends.choose_backend("scipy") <NEW_LINE> <DEDEN... | Class for saving and retrieval of statistics.
This is the main class of this module, and this is considered the public
API. | 6259908797e22403b383ca90 |
class InvalidProtocol(ZmailException, ValueError): <NEW_LINE> <INDENT> pass | Invalid protocol settings used. | 62599087d8ef3951e32c8c2a |
class CoverageConfig(EnvironmentConfig): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> super(CoverageConfig, self).__init__(args, 'coverage') <NEW_LINE> self.group_by = frozenset(args.group_by) if 'group_by' in args and args.group_by else set() <NEW_LINE> self.all = args.all if 'all' in args else Fa... | Configuration for the coverage command. | 6259908760cbc95b06365b38 |
class ClassParticleEdit(Operator): <NEW_LINE> <INDENT> bl_idname = "class.pieparticleedit" <NEW_LINE> bl_label = "Class Particle Edit" <NEW_LINE> bl_options = {'REGISTER', 'UNDO'} <NEW_LINE> bl_description = "Particle Edit (must have active particle system)" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> if... | Particle Edit | 62599087656771135c48adfd |
class Level_01(Level): <NEW_LINE> <INDENT> def __init__(self, player): <NEW_LINE> <INDENT> numGen = random.randint(1,3) <NEW_LINE> Level.__init__(self, player) <NEW_LINE> self.level_limit = -1000 <NEW_LINE> self.background = pygame.image.load("factory.png").convert() <NEW_LINE> self.background.set_colorkey(WHITE) <NEW_... | Definition for level 1. | 625990877047854f46340f4f |
class RecentCounter: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.times = [] <NEW_LINE> <DEDENT> def ping(self, t: int) -> int: <NEW_LINE> <INDENT> self.times.append(t) <NEW_LINE> recent_after = t - 3000 <NEW_LINE> recents = 0 <NEW_LINE> for i in range(len(self.times), 0, -1): <NEW_LINE> <INDENT> if... | My initial attempt worked, however it failed performance tests for a large number of pings. | 62599087ec188e330fdfa447 |
class MarionetteUnittestOutputParser(DesktopUnittestOutputParser): <NEW_LINE> <INDENT> bad_gecko_install = re.compile(r'Error installing gecko!') <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.install_gecko_failed = False <NEW_LINE> super(MarionetteUnittestOutputParser, self).__init__(**kwargs) <NEW_... | A class that extends DesktopUnittestOutputParser such that it can
catch failed gecko installation errors. | 625990873617ad0b5ee07ceb |
class TestItemGiftCertificate(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 testItemGiftCertificate(self): <NEW_LINE> <INDENT> pass | ItemGiftCertificate unit test stubs | 625990877b180e01f3e49e32 |
class GopherServer: <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> server_socket = socket.socket() <NEW_LINE> server_socket.bind(('', 70)) <NEW_LINE> server_socket.listen(5) <NEW_LINE> while True: <NEW_LINE> <INDENT> connection, address = server_socket.accept() <NEW_LINE> requested_selector = connection.recv(10... | Serves Gopher directories and files. | 62599087283ffb24f3cf543b |
class Business(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'business' <NEW_LINE> id = db.Column( db.Integer, Sequence('bussiness_id_seq', start=1, increment=1), primary_key=True, nullable=False ) <NEW_LINE> name = db.Column( db.String(length=255), nullable=False, unique=True ) <NEW_LINE> domain = db.Column( db.Strin... | Business table | 62599087656771135c48adfe |
class Assign(stmt): <NEW_LINE> <INDENT> def init(self, targets, value): <NEW_LINE> <INDENT> assert_exprs(targets, 'targets') <NEW_LINE> assert_expr(value, 'value') <NEW_LINE> self.targets = targets <NEW_LINE> self.value = value | An assignment. Inherits stmt.
targets : a list of expr nodes
value : an expr node | 625990873617ad0b5ee07ced |
class TuningRunManager(tuningrunmain.TuningRunMain): <NEW_LINE> <INDENT> def __init__(self, measurement_interface, args, **kwargs): <NEW_LINE> <INDENT> super(TuningRunManager, self).__init__(measurement_interface, args, **kwargs) <NEW_LINE> self.init() <NEW_LINE> self.tuning_run.state = 'RUNNING' <NEW_LINE> self.commit... | This class manages a tuning run in a "slave" configuration, where main()
is controlled by an another program. | 62599087091ae356687067df |
class Tracker(object): <NEW_LINE> <INDENT> NOT_IMPLEMENTED_MSG = 'To be implemented in device-linked class' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.__connected = False <NEW_LINE> <DEDENT> def connect(self): <NEW_LINE> <INDENT> raise NotImplementedError(Tracker.NOT_IMPLEMENTED_MSG) <NEW_LINE> <DEDENT> de... | This class is an abstraction for all supported trackers. | 62599087283ffb24f3cf543e |
class DjangoModelDereferenceMixin(object): <NEW_LINE> <INDENT> def __get__(self, instance, owner): <NEW_LINE> <INDENT> if instance is None: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> dereference = DjangoModelDereference() <NEW_LINE> if instance._initialised and instance._data.get(self.name): <NEW_LINE> <INDENT... | Mixin class which overrides __get__ behaviour for ModelFields
so it returns Model instances if possible. | 62599087656771135c48adff |
class CoordinationDriverCachedRunWatchers(CoordinationDriver): <NEW_LINE> <INDENT> def __init__(self, member_id, parsed_url, options): <NEW_LINE> <INDENT> super(CoordinationDriverCachedRunWatchers, self).__init__( member_id, parsed_url, options) <NEW_LINE> self._group_members = collections.defaultdict(set) <NEW_LINE> s... | Coordination driver with a `run_watchers` implementation.
This implementation of `run_watchers` is based on a cache of the group
members between each run of `run_watchers` that is being updated between
each run. | 625990877047854f46340f53 |
class ResNetCifar10(model_base.ResNet): <NEW_LINE> <INDENT> def __init__(self, num_layers, is_training, batch_norm_decay, batch_norm_epsilon, data_format='channels_first'): <NEW_LINE> <INDENT> super(ResNetCifar10, self).__init__( is_training, data_format, batch_norm_decay, batch_norm_epsilon ) <NEW_LINE> self.n = (num_... | Cifar10 model with ResNetV1 and basic residual block. | 625990875fdd1c0f98e5fb18 |
class RData( Binary ): <NEW_LINE> <INDENT> file_ext = 'rdata' <NEW_LINE> def sniff( self, filename ): <NEW_LINE> <INDENT> rdata_header = b'RDX2\nX\n' <NEW_LINE> try: <NEW_LINE> <INDENT> header = open(filename, 'rb').read(7) <NEW_LINE> if header == rdata_header: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> header... | Generic R Data file datatype implementation | 6259908771ff763f4b5e934c |
class FunctionCache: <NEW_LINE> <INDENT> __slots__ = [ "_primary", "_dispatch_table", "_garbage_collectors" ] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self._primary = collections.OrderedDict() <NEW_LINE> self._dispatch_table = type_dispatch.TypeDispatchTable() <NEW_LINE> self._garbage_collectors = [ _Function... | A container for managing concrete functions. | 6259908723849d37ff852c59 |
@INDEX.doc_type <NEW_LINE> class ExerciseDocument(Document): <NEW_LINE> <INDENT> id = fields.IntegerField(attr='id') <NEW_LINE> exercise_title = fields.TextField( attr='exercise_title', analyzer=html_strip, fields={ 'raw': fields.TextField(analyzer='keyword', multi=True), 'suggest': fields.CompletionField(multi=True), ... | Book Elasticsearch document. | 62599087f9cc0f698b1c609b |
class Command(BaseCommand): <NEW_LINE> <INDENT> help = 'This command imports fixed spellings for lexemes in the database.' 'The format that is expected "lang;correct_spelling;POS;ID;misspelled_word;POS"' <NEW_LINE> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument('-f', '--file', type=s... | Example: python manage.py fix_spellings -f ../data/Adj-workspace_2020-05-19b.csv -d ';' | 62599087e1aae11d1e7cf5e3 |
class Autoshare(Entity): <NEW_LINE> <INDENT> __entityName__ = "security-policy" <NEW_LINE> __isLegacy__ = True <NEW_LINE> def edit( self, experiment_sharing=UNSPECIFIED, protocol_sharing=UNSPECIFIED, resource_sharing=UNSPECIFIED, extraParams={}, ): <NEW_LINE> <INDENT> from labstep.generic.entity.repository import editE... | Represents an Autosharing rule on Labstep. | 625990878a349b6b43687dfe |
class matchesPattern(Validator): <NEW_LINE> <INDENT> def __init__(self, pattern): <NEW_LINE> <INDENT> self._pattern = re.compile(pattern) <NEW_LINE> <DEDENT> def test(self,x): <NEW_LINE> <INDENT> x = str(x) <NEW_LINE> print('testing %s against %s' % (x, self._pattern)) <NEW_LINE> return (self._pattern.match(x) != None) | Matches value, or its string representation, against regex | 625990874a966d76dd5f0a86 |
class AmuletDeployment(object): <NEW_LINE> <INDENT> def __init__(self, series=None): <NEW_LINE> <INDENT> self.series = None <NEW_LINE> if series: <NEW_LINE> <INDENT> self.series = series <NEW_LINE> self.d = amulet.Deployment(series=self.series) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.d = amulet.Deployment() ... | Amulet deployment.
This class provides generic Amulet deployment and test runner
methods. | 6259908755399d3f056280b5 |
class RconPacketException(Exception): <NEW_LINE> <INDENT> pass | Rcon Packet Exception | 62599087a05bb46b3848bef7 |
class itkDicomImageIO(itkGDCMImageIO): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def __New_orig__()... | Proxy of C++ itkDicomImageIO class | 62599087283ffb24f3cf5441 |
class ProgramGroupBonus(Model): <NEW_LINE> <INDENT> COLUMNS = { "id": ColumnInteger(autoincrement=True, primary_key=True), "amount_minutes": ColumnInteger(null=False), "created": ColumnDatetime(null=False), "creator": ColumnText(null=False), "effective_date": ColumnDate(null=False), "message": ColumnText(null=False), "... | Bonus time for a program group. | 625990874527f215b58eb770 |
class SkillProxy(EveItemWrapper): <NEW_LINE> <INDENT> def __init__(self, type_id, level): <NEW_LINE> <INDENT> EveItemWrapper.__init__(self, type_id) <NEW_LINE> self.__parent_char_proxy = None <NEW_LINE> self.__eos_skill = EosSkill(type_id, level=level) <NEW_LINE> <DEDENT> @property <NEW_LINE> def _source(self): <NEW_LI... | Pyfa model: character_proxy.RestrictedSet(skills)
Eos model: efit.RestrictedSet(skills)
DB model: none (SkillCore handles it) | 625990875fc7496912d4903b |
class TermsAndAgreements(BrowserView): <NEW_LINE> <INDENT> pass | Terms-and-agreements View
| 62599087091ae356687067e3 |
class RNN(vae_module.VAECore): <NEW_LINE> <INDENT> def __init__(self, hparams, obs_encoder, obs_decoder, name=None): <NEW_LINE> <INDENT> super(RNN, self).__init__(hparams, obs_encoder, obs_decoder, name) <NEW_LINE> with self._enter_variable_scope(): <NEW_LINE> <INDENT> self._d_core = util.make_rnn(hparams, name="d_core... | Implementation of an RNN as a sequential VAE where all latent
variables are deterministic. | 62599087f9cc0f698b1c609c |
class view_config(object): <NEW_LINE> <INDENT> venusian = venusian <NEW_LINE> def __init__(self, name='', request_type=None, for_=None, permission=None, route_name=None, request_method=None, request_param=None, containment=None, attr=None, renderer=None, wrapper=None, xhr=False, accept=None, header=None, path_info=None... | A function, class or method :term:`decorator` which allows a
developer to create view registrations nearer to a :term:`view
callable` definition than use :term:`imperative
configuration` to do the same.
For example, this code in a module ``views.py``::
from resources import MyResource
@view_config(name='my_view'... | 62599087ec188e330fdfa44f |
class UserConfig(dict): <NEW_LINE> <INDENT> def init(self): <NEW_LINE> <INDENT> envs = { k.split("DIRECTOR_")[1]: v for k, v in os.environ.items() if k.startswith("DIRECTOR_") and k not in HIDDEN_CONFIG } <NEW_LINE> super().__init__(**envs) <NEW_LINE> <DEDENT> def __getattr__(self, attr): <NEW_LINE> <INDENT> try: <NEW_... | Handle the user configuration | 62599087be7bc26dc9252c27 |
@pytest.mark.usefixtures("set_device_parameters") <NEW_LINE> class TestGetter(BaseTestGetters): <NEW_LINE> <INDENT> def test_method_signatures(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> super(TestGetter, self).test_method_signatures() <NEW_LINE> <DEDENT> except AssertionError: <NEW_LINE> <INDENT> pass | Test get_* methods. | 625990877cff6e4e811b75e5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.