code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MappingForm(ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Mapping <NEW_LINE> fields = ['ip_or_cname', 'hostname'] <NEW_LINE> <DEDENT> def clean(self): <NEW_LINE> <INDENT> invalid_chars = '!@#$%^&*()+=<>,/? :;"\'{}[]|\\`~' <NEW_LINE> field1 = self.cleaned_data.get('ip_or_cname') <NEW_LINE... | Creates a modelform from the Mapping model. Specifies which fields to display and has a custom clean method to check for duplicate fields and invalid characters in the entered data | 62598fa9a8370b77170f0334 |
class GenericModel(BaseModel, SourceMixin, ContactDetailMixin, LinkMixin, AssociatedLinkMixin, OtherNameMixin, IdentifierMixin): <NEW_LINE> <INDENT> _type = "generic" <NEW_LINE> _schema = schema <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(GenericModel, self).__init__() <NEW_LINE> self._associated = [] | a generic model used for testing the base and mixins | 62598fa938b623060ffa8ff1 |
class some_of(CustomType): <NEW_LINE> <INDENT> def __init__(self, choices, separator=', ', **Config): <NEW_LINE> <INDENT> if not 'type_str' in Config: <NEW_LINE> <INDENT> Config['type_str'] = 'some of: %s' % separator.join(choices) <NEW_LINE> <DEDENT> CustomType.__init__(self, **Config) <NEW_LINE> self.choices = choice... | Get mutilple items from a list of choices.
| 62598fa9aad79263cf42e72e |
class DeleteRawModifiedDetails(FrozenClass): <NEW_LINE> <INDENT> ua_types = { 'NodeId': 'NodeId', 'IsDeleteModified': 'Boolean', 'StartTime': 'DateTime', 'EndTime': 'DateTime', } <NEW_LINE> def __init__(self, binary=None): <NEW_LINE> <INDENT> if binary is not None: <NEW_LINE> <INDENT> self._binary_init(binary) <NEW_LIN... | :ivar NodeId:
:vartype NodeId: NodeId
:ivar IsDeleteModified:
:vartype IsDeleteModified: Boolean
:ivar StartTime:
:vartype StartTime: DateTime
:ivar EndTime:
:vartype EndTime: DateTime | 62598fa9a219f33f346c6770 |
class Command(BaseCommand): <NEW_LINE> <INDENT> description = 'Delete remember tokens older then AUTH_REMEMBER_COOKIE_AGE' <NEW_LINE> def handle(self, *args, **options): <NEW_LINE> <INDENT> RememberToken.objects.clean_remember_tokens() | Delete remember tokens older then AUTH_REMEMBER_COOKIE_AGE | 62598fa9eab8aa0e5d30bce4 |
class Params: <NEW_LINE> <INDENT> fps = 60 <NEW_LINE> num_agents = 200 <NEW_LINE> natural_frequency = 1 <NEW_LINE> num_neighbors = 30 <NEW_LINE> epsilon = 0.02 | parameters for simulation | 62598fa9bd1bec0571e15070 |
class LDAPGroupRead(object): <NEW_LINE> <INDENT> swagger_types = { 'name': 'str', 'roles': 'list[Role]', 'url': 'str', 'can': 'dict(str, bool)' } <NEW_LINE> attribute_map = { 'name': 'name', 'roles': 'roles', 'url': 'url', 'can': 'can' } <NEW_LINE> def __init__(self, name=None, roles=None, url=None, can=None): <NEW_LIN... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa9851cf427c66b821f |
class CrawlError(IOError): <NEW_LINE> <INDENT> pass | Error which rises when crawling given url failed. | 62598fa94428ac0f6e65847d |
class Snapshot(Artifact): <NEW_LINE> <INDENT> class __mongometa__: <NEW_LINE> <INDENT> session = artifact_orm_session <NEW_LINE> name = 'artifact_snapshot' <NEW_LINE> unique_indexes = [('artifact_class', 'artifact_id', 'version')] <NEW_LINE> indexes = [ ('artifact_id', 'version'), ('artifact_id', '_id') ] <NEW_LINE> <D... | A snapshot of an :class:`Artifact <vulcanforge.artifact.model.Artifact>`,
used in
:class:`VersionedArtifact <vulcanforge.artifact.model.VersionedArtifact>` | 62598fa93317a56b869be4f7 |
class Image: <NEW_LINE> <INDENT> _last_id = 0 <NEW_LINE> def __init__(self, imgtype, name=None, cnf={}, master=None, **kw): <NEW_LINE> <INDENT> self.name = None <NEW_LINE> if not master: <NEW_LINE> <INDENT> master = _default_root <NEW_LINE> if not master: <NEW_LINE> <INDENT> raise RuntimeError('Too early to create imag... | Base class for images. | 62598fa9cc0a2c111447af6a |
class TestFiFI(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.fake = Faker('fi_FI') <NEW_LINE> Faker.seed(0) <NEW_LINE> self.provider = fi_Provider <NEW_LINE> <DEDENT> def test_century_code(self): <NEW_LINE> <INDENT> assert self.provider._get_century_code(1900) == '-' <NEW_LINE> asser... | Tests SSN in the fi_FI locale | 62598fa93d592f4c4edbae26 |
class GPVirtualTableDomain(CoClass): <NEW_LINE> <INDENT> _reg_clsid_ = GUID('{BE355340-B5A9-4432-B2F4-497A50E05115}') <NEW_LINE> _idlflags_ = [] <NEW_LINE> _typelib_path_ = typelib_path <NEW_LINE> _reg_typelib_ = ('{C031A050-82C6-4F8F-8836-5692631CFFE6}', 10, 2) | Object for filtering out the virtual tables. | 62598fa9be383301e0253753 |
class ResponseWithRetrieveSerializerMixin: <NEW_LINE> <INDENT> def response(self, instance, status, headers=None): <NEW_LINE> <INDENT> retrieve_serializer_class = self.get_serializer_class(action='retrieve') <NEW_LINE> context = self.get_serializer_context() <NEW_LINE> retrieve_serializer = retrieve_serializer_class(in... | Always response with 'retrieve' serializer or fallback to `serializer_class`.
Usage:
class MyViewSet(DefaultModelViewSet):
serializer_class = MyDefaultSerializer
serializer_action_classes = {
'list': MyListSerializer,
'my_action': MyActionSerializer,
}
@action
def my_action:
.... | 62598fa945492302aabfc42b |
class OrderInfo(Object): <NEW_LINE> <INDENT> ID = "orderInfo" <NEW_LINE> def __init__(self, name, phone_number, email_address, shipping_address, **kwargs): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.phone_number = phone_number <NEW_LINE> self.email_address = email_address <NEW_LINE> self.shipping_address = sh... | Order information
Attributes:
ID (:obj:`str`): ``OrderInfo``
Args:
name (:obj:`str`):
Name of the user
phone_number (:obj:`str`):
Phone number of the user
email_address (:obj:`str`):
Email address of the user
shipping_address (:class:`telegram.api.types.address`):
... | 62598fa9435de62698e9bd50 |
class EmailVisionClient(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.client = Client(WSDL_URL) <NEW_LINE> <DEDENT> def create_request(self, mailing_name): <NEW_LINE> <INDENT> req = self.client.factory.create('sendRequest') <NEW_LINE> req.notificationId = TEMPLATES[mailing_name] <NEW_LINE> r... | EmailVision SOAP Client | 62598fa9f548e778e596b4fe |
class PlainTextParser(ParserBase): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def is_gz_file(filepath): <NEW_LINE> <INDENT> with open(filepath, 'rb') as test_f: <NEW_LINE> <INDENT> return binascii.hexlify(test_f.read(2)) == b'1f8b' <NEW_LINE> <DEDENT> <DEDENT> def parse_file(self, file_entry, is_stream=False): <NEW_L... | Class to extract IP addresses from plain text and gzipped plain text files. | 62598fa9be8e80087fbbefbd |
class APIRouterV21(nova.api.openstack.APIRouterV21): <NEW_LINE> <INDENT> def __init__(self, init_only=None): <NEW_LINE> <INDENT> self._loaded_extension_info = extension_info.LoadedExtensionInfo() <NEW_LINE> super(APIRouterV21, self).__init__(init_only) <NEW_LINE> <DEDENT> def _register_extension(self, ext): <NEW_LINE> ... | Routes requests on the OpenStack API to the appropriate controller
and method. | 62598fa956ac1b37e6302146 |
class OntologyTerm(object): <NEW_LINE> <INDENT> def __init__(self, term_id, term_name, attrs = {}): <NEW_LINE> <INDENT> self.id = term_id <NEW_LINE> self.name = term_name <NEW_LINE> self.attrs = attrs <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> s = "[Term]\n" <NEW_LINE> s += "id: " + self.id + "\n" <NEW_... | Represents ontology term. | 62598fa930bbd72246469925 |
class CycleCache(object): <NEW_LINE> <INDENT> def __init__(self, size): <NEW_LINE> <INDENT> object.__init__(self) <NEW_LINE> self._list = list() <NEW_LINE> self._cpos = -1 <NEW_LINE> self._size = size <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self._list) <NEW_LINE> <DEDENT> def NextIndex(sel... | A simple circular cache. All items are added to the end of the cache
regardless of the current reference position. As items are accessed from
the cache the cache reference pointer is incremeneted, if it passes the
end it will go back to the beginning. | 62598fa91f037a2d8b9e4047 |
class dg: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name: str = "DeciGram" <NEW_LINE> self.unit: str = "dg" <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return f"dg(name={self.name}, unit={self.unit})" <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return ... | Decigram class | 62598fa901c39578d7f12cda |
class _TkVar(RO.AddCallback.TkVarMixin): <NEW_LINE> <INDENT> def __init__(self, var=None, callFunc = None, callNow = False, ): <NEW_LINE> <INDENT> if var == None: <NEW_LINE> <INDENT> var = Tkinter.StringVar() <NEW_LINE> <DEDENT> RO.AddCallback.TkVarMixin.__init__(self, var, callFunc, callNow) <NEW_LINE> <DEDENT> def _d... | A container for a Tkinter Variable;
basically provides a slightly nicer interface
(since they already support callbacks). | 62598fa910dbd63aa1c70b0d |
class MRWordCount(MRJob): <NEW_LINE> <INDENT> def mapper(self, _, line): <NEW_LINE> <INDENT> for word in WORD_RE.findall(line): <NEW_LINE> <INDENT> yield (jobconf_from_env("mapreduce.map.input.file"), 1) <NEW_LINE> <DEDENT> <DEDENT> def reducer(self, name, counts): <NEW_LINE> <INDENT> yield (name, sum(counts)) <NEW_LIN... | Trivial Job that returns the number of words in each input file
| 62598fa91b99ca400228f4dd |
class PathHash(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._string_hash = StringHash() <NEW_LINE> self._current_path = '' <NEW_LINE> <DEDENT> def set_path(self, path): <NEW_LINE> <INDENT> self._current_path = path <NEW_LINE> <DEDENT> def get_path(self, fn, ln): <NEW_LINE> <INDENT> self._cu... | Used for encoding the stacktrace.
A stacktrace can be seen by a list of tuples (filename and linenumber): e.g. [(fn1, 25), (fn2, 30)]
this is encoded as a string:
encoded = 'fn1:25->fn2->30'
However, the filename could possibly contain '->', therefore the filename is hashed into a number.
So, the encoding be... | 62598fa90a50d4780f705338 |
class WormStatistics(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def initObject(self, exp_hist, ctl_hist, p_t): <NEW_LINE> <INDENT> pass <NEW_LINE> pass | Notes
--------------------
Formerly: seg_worm.stats
Some of the statistics are aggegrate:
- p_value
- q_value
List of exclusive features:
properties
#TODO: Move to object that both hist and stats display
#
#ALSO: We need two, one for experiment and one for controls
#Defin... | 62598fa93539df3088ecc20e |
class Get(JobCommandBase): <NEW_LINE> <INDENT> def latest_build_info(self, input, kwargs): <NEW_LINE> <INDENT> task_subject = "Latest Build Details" <NEW_LINE> task_log = OrderedDict() <NEW_LINE> package = input.get('pkg_downstream_name') or input.get('package') <NEW_LINE> builds = self.api_resources.build_info( hub_ur... | Handles all operations for GET Command | 62598fa9a8370b77170f0336 |
class IntervalTimer(Thread): <NEW_LINE> <INDENT> def __init__(self, interval, function, iteration=-1, args=None, kwargs=None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.interval = interval <NEW_LINE> self.function = function <NEW_LINE> self.iteration = iteration <NEW_LINE> self.args = args if args is not N... | Call a function after a specified number of seconds:
t = Timer(30.0, f, args=None, kwargs=None)
t.start()
t.cancel() # stop the timer's action if it's still waiting | 62598fa999fddb7c1ca62d96 |
class Timer: <NEW_LINE> <INDENT> def __init__(self, description: str): <NEW_LINE> <INDENT> self.description = description <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.start = time.time() <NEW_LINE> <DEDENT> def __exit__(self, exc_type, value, traceback): <NEW_LINE> <INDENT> self.end = time.time() <... | Context manager to time code section.
.. example::
with Timer("Timing code section"):
do_stuff() | 62598fa99c8ee8231304011e |
class ProteinPosition(MapPosition): <NEW_LINE> <INDENT> def __init__(self, ppos, index=None, **kwargs): <NEW_LINE> <INDENT> MapPosition.__init__(self, ppos, index) <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> if isinstance(other, int): <NEW_LINE> <INDENT> return self.pos == other <NEW_LINE> <DEDENT>... | Protein position for coordinate mapping | 62598fa97047854f4633f334 |
class TestMagratheaCliBase(TestCase): <NEW_LINE> <INDENT> def test_01(self): <NEW_LINE> <INDENT> obj = BaseCommand() <NEW_LINE> self.assertIsInstance(obj, BaseCommand) <NEW_LINE> <DEDENT> def test_02(self): <NEW_LINE> <INDENT> obj = BaseCommand() <NEW_LINE> with self.assertRaises(NotImplementedError): <NEW_LINE> <INDEN... | Unit tests for :py:mod:`magrathea.cli.base` | 62598fa930dc7b766599f7a9 |
class type(object): <NEW_LINE> <INDENT> def mro(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __delattr__(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __dir__(self, *args, **kwargs): ... | type(object_or_name, bases, dict)
type(object) -> the object's type
type(name, bases, dict) -> a new type | 62598fa92ae34c7f260ab03d |
class app: <NEW_LINE> <INDENT> def __init__(self,a,b): <NEW_LINE> <INDENT> self.a=a <NEW_LINE> self.b=b <NEW_LINE> <DEDENT> def fun1(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.a+self.b <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> def fun2(self): <NEW_LINE... | App calss | 62598fa9851cf427c66b8220 |
class NopClaim(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def disk_gb(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def memory_mb(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def vcpus(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> def __ent... | For use with compute drivers that do not support resource tracking | 62598fa9435de62698e9bd52 |
class InstitutionNodeList(JSONAPIBaseView, generics.ListAPIView, InstitutionMixin, NodesFilterMixin): <NEW_LINE> <INDENT> permission_classes = ( drf_permissions.IsAuthenticatedOrReadOnly, base_permissions.TokenHasScope, ) <NEW_LINE> required_read_scopes = [CoreScopes.INSTITUTION_READ, CoreScopes.NODE_BASE_READ] <NEW_LI... | The documentation for this endpoint can be found [here](https://developer.osf.io/#operation/institutions_node_list).
| 62598fa9a17c0f6771d5c191 |
class Distribution(object): <NEW_LINE> <INDENT> r <NEW_LINE> has_rsample = False <NEW_LINE> has_enumerate_support = False <NEW_LINE> def __init__(self, batch_shape=torch.Size(), event_shape=torch.Size()): <NEW_LINE> <INDENT> self._batch_shape = batch_shape <NEW_LINE> self._event_shape = event_shape <NEW_LINE> <DEDENT> ... | Distribution is the abstract base class for probability distributions. | 62598fa9be8e80087fbbefbf |
class EntityMissing(KeyError, Passthrough): <NEW_LINE> <INDENT> pass | Signal that a required entity does not exist in our schema. | 62598fa985dfad0860cbfa22 |
class Restaurant(models.Model): <NEW_LINE> <INDENT> name = models.CharField(blank = False, max_length = 60, verbose_name = u"名称") <NEW_LINE> phone1 = models.CharField(blank = False, max_length = 60, verbose_name = u"电话1") <NEW_LINE> phone2 = models.CharField(blank = True, null = True, max_length = 60, verbose_name = u"... | A Restaurant object
#create some restaurants
>>> r1 = Restaurant(name = u"test1", phone1 = u"12222", address = u"good", tips = u"test")
>>> r1.save()
>>> print r1
test1
>>> r1.add_timestamp = 0
>>> print r1.readable_add_timestamp()
1970-01-01 08:00:00
>>> print r1.get_menu_num()
0
>>> r1.add_order_number(10)
>>> r1.sa... | 62598fa96e29344779b005b8 |
class ExtensionsPool(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.extensions = {} <NEW_LINE> <DEDENT> def register_extension(self, ext, show=True): <NEW_LINE> <INDENT> self.extensions[ext.name] = dict(cls=ext, show=show) <NEW_LINE> <DEDENT> def get_extension(self, name): <NEW_LINE> <INDENT>... | The extensions manager | 62598fa966673b3332c30327 |
class Configurator(object): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> <DEDENT> def update_flask_config(self, conf): <NEW_LINE> <INDENT> self.app.config.update(conf) <NEW_LINE> <DEDENT> def register_blueprints(self, blueprints): <NEW_LINE> <INDENT> for name, conf in bluep... | Provides basic configuration within Moxie. Currently we handle
our configuration through `YAML <http://yaml.org>`_ files. | 62598fa93539df3088ecc20f |
@add_metaclass(ABCMeta) <NEW_LINE> class NetworkResponse(object): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def json(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @abstractproperty <NEW_LINE> def content(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @abstractpr... | Abstract base class specifying the interface for a network response. | 62598fa9aad79263cf42e731 |
class TestConf(unittest.TestCase): <NEW_LINE> <INDENT> def test_defaults_syntax(self): <NEW_LINE> <INDENT> with open(CONF_FILES['defaults']) as fhandle: <NEW_LINE> <INDENT> fcontent = fhandle.read() <NEW_LINE> <DEDENT> interpreted = json.loads(fcontent) <NEW_LINE> self.assertEqual(to_json(interpreted), fcontent) <NEW_L... | A TestCase for configutation files. | 62598fa97d43ff24874273b0 |
class MusicError(FrontException): <NEW_LINE> <INDENT> pass | Exception raised upon encountering an error in the music domain. | 62598fa976e4537e8c3ef50a |
class TestV1HTTPHeader(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 testV1HTTPHeader(self): <NEW_LINE> <INDENT> pass | V1HTTPHeader unit test stubs | 62598fa94527f215b58e9e3f |
class ProxyRateLimitModelBackend(RateLimitModelBackend): <NEW_LINE> <INDENT> def get_ip(self, request): <NEW_LINE> <INDENT> return request.META["HTTP_X_FORWARDED_FOR"] | A rate limiting Backend that works behind a proxy. | 62598fa99c8ee8231304011f |
class ocni_server(object): <NEW_LINE> <INDENT> operationQuery = url_mapper.rest_controller(QueryDispatcher) <NEW_LINE> operationSingleEntity = url_mapper.rest_controller(SingleEntityDispatcher) <NEW_LINE> operationMultiEntity = url_mapper.rest_controller(MultiEntityDispatcher) <NEW_LINE> app = url_mapper.Router() <NEW_... | The main OCNI REST server | 62598fa9925a0f43d25e7f9c |
class Triggered(Modifier): <NEW_LINE> <INDENT> points_per_rank_modifier = points.Points_Flat_Modifier(1) <NEW_LINE> modifier_needs_rank = True <NEW_LINE> modifier_name = "Triggered" <NEW_LINE> modifier_list_type = False <NEW_LINE> flat_modifier = True <NEW_LINE> def __init__(self, power, rank, starting_rank=0): <NEW_LI... | You can “set” an instant duration effect with this modifier
to activate under particular circumstances, such as in re196
Mutants & Master Mutants & Mastermminds D Deluxe Hero’s Handbook eluxe Hero’s Handbook
Chapter 6: Powers Chapter 6: Powers
sponse to a particular danger, after a set amount of time,
in response to a ... | 62598fa9a219f33f346c6774 |
class UserProfile(AbstractBaseUser, PermissionsMixin): <NEW_LINE> <INDENT> email = models.EmailField(max_length=255,unique=True) <NEW_LINE> name = models.CharField(max_length=255) <NEW_LINE> is_activate = models.BooleanField(default=True) <NEW_LINE> is_staff= models.BooleanField(default=False) <NEW_LINE> objects = User... | Represent a "user profile" inside our system. | 62598fa97c178a314d78d3fa |
class IterableLengthMismatch(Exception): <NEW_LINE> <INDENT> pass | Custom error for equizip. | 62598fa92ae34c7f260ab03f |
class CustomerSingleResource(BaseResource): <NEW_LINE> <INDENT> def on_get(self, req, resp, id): <NEW_LINE> <INDENT> dbsession = self.db.session <NEW_LINE> customer = dbsession.query(Customer).filter(Customer.id == id).first() <NEW_LINE> if customer is None: <NEW_LINE> <INDENT> raise falcon.HTTPNotFound() <NEW_LINE> <D... | CustomerSingleResource class handles the enpoints for single customers | 62598fa93617ad0b5ee060b1 |
class DebtManager(models.Manager): <NEW_LINE> <INDENT> def create_debt(self, new_data, user): <NEW_LINE> <INDENT> data = new_data.cleaned_data <NEW_LINE> debt = self.model( user = data['user'], title = data['title'], amount = data['amount'], date_of_loan = data['date_of_loan'], date_of_repayment = data['date_of_repayme... | class DebtManager - interfejs opowiedzialny za dostarczanie zapytań bazy danych do modelu Debts | 62598fa9eab8aa0e5d30bce8 |
class MembraneRoleManager(BasePlugin, Cacheable): <NEW_LINE> <INDENT> meta_type = 'Membrane Role Manager' <NEW_LINE> security = ClassSecurityInfo() <NEW_LINE> implements(IMembraneRoleManagerPlugin) <NEW_LINE> def __init__(self, id, title=None): <NEW_LINE> <INDENT> self._id = self.id = id <NEW_LINE> self.title = title <... | PAS plugin for managing roles with Membrane.
| 62598fa9bd1bec0571e15072 |
@python_2_unicode_compatible <NEW_LINE> class LikeOfSong(TimeStampModel): <NEW_LINE> <INDENT> creator = models.ForeignKey(user_models.User, on_delete=models.PROTECT, null=True) <NEW_LINE> song = models.ForeignKey(Song, on_delete=models.PROTECT, null=True, related_name='like') <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ... | LikeOfSong Model | 62598fa963b5f9789fe850c3 |
class ProductInfoViewSet(viewsets.ReadOnlyModelViewSet): <NEW_LINE> <INDENT> serializer_class = ProductInfoSerializer <NEW_LINE> filterset_fields = ('shop',) <NEW_LINE> ordering_fields = ('product', 'shop', 'quantity', 'price', 'price_rrc', 'id',) <NEW_LINE> search_fields = ('product__name', 'shop__name',) <NEW_LINE> o... | Поиск товаров | 62598fa9796e427e5384e6f1 |
class FlatBottomRestraintForce(FlatBottomRestraintForceMixIn, RadiallySymmetricCentroidRestraintForce): <NEW_LINE> <INDENT> pass | A restraint between the centroids of two groups of atoms using a flat potential well with harmonic walls.
An alternative choice to receptor-ligand restraints that uses a flat
potential inside most of the protein volume with harmonic restraining
walls outside of this. It can be used to prevent the ligand from
drifting ... | 62598fa956ac1b37e6302149 |
class MerchantTransaction(models.Model): <NEW_LINE> <INDENT> TRANSACTION_STATUS_CHOICE = ( ('success', 'Success'), ('failure', 'Failure'), ) <NEW_LINE> merchant_id = models.CharField(max_length = 20, verbose_name="Merchant id") <NEW_LINE> user = models.ForeignKey(User, verbose_name="User") <NEW_LINE> amount = models.De... | merchant_id: Identifier of the Merchant used for this transaction
user: User who made this transaction
gateway: gateway used
status: Status of the transaction
message: Message returned by the Merchant
response: Complete response of the Merchant | 62598fa945492302aabfc42f |
class InsuffcientPermissions(Exception): <NEW_LINE> <INDENT> def __init__(self, model, action): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.action = action | Token error for permissions failure. | 62598fa9a17c0f6771d5c193 |
class ClientMemo(object): <NEW_LINE> <INDENT> def __init__(self, id=0, client_id=0, notes=None, date=None, modified_date=None, created_date=None): <NEW_LINE> <INDENT> self.id = id <NEW_LINE> self.client_id = client_id <NEW_LINE> self.notes = notes <NEW_LINE> self.date = date <NEW_LINE> self.modified_date = dt.strptime(... | Memo Data Shadowing AppletFormMemoEdit/Create Elements | 62598fa9009cb60464d0147d |
class TestContainerSerialiser(tests.TestCase): <NEW_LINE> <INDENT> def test_construct(self): <NEW_LINE> <INDENT> pack.ContainerSerialiser() <NEW_LINE> <DEDENT> def test_begin(self): <NEW_LINE> <INDENT> serialiser = pack.ContainerSerialiser() <NEW_LINE> self.assertEqual('Bazaar pack format 1 (introduced in 0.18)\n', ser... | Tests for the ContainerSerialiser class. | 62598fa956ac1b37e630214a |
class TextRNN(Classifier): <NEW_LINE> <INDENT> def __init__(self, dataset, config): <NEW_LINE> <INDENT> super(TextRNN, self).__init__(dataset, config) <NEW_LINE> self.doc_embedding_type = config.TextRNN.doc_embedding_type <NEW_LINE> self.rnn = RNN( config.embedding.dimension, config.TextRNN.hidden_dimension, num_layers... | Implement TextRNN, contains LSTM,BiLSTM,GRU,BiGRU
Reference: "Effective LSTMs for Target-Dependent Sentiment Classification"
"Bidirectional LSTM-CRF Models for Sequence Tagging"
"Generative and discriminative text classification
with recurrent neural networks" | 62598fa955399d3f05626482 |
class _SelectorIOLoopIOHandle(nbio_interface.AbstractIOReference): <NEW_LINE> <INDENT> def __init__(self, subject): <NEW_LINE> <INDENT> self._cancel = subject.cancel <NEW_LINE> <DEDENT> def cancel(self): <NEW_LINE> <INDENT> return self._cancel() | This module's adaptation of `nbio_interface.AbstractIOReference`
| 62598fa9d7e4931a7ef3bff9 |
class VersionCommitError(VersionError): <NEW_LINE> <INDENT> pass | An invalid combination of versions was used in a version commit. | 62598fa957b8e32f525080ca |
class MitsubaRenderSettingsPanel(bpy.types.Panel): <NEW_LINE> <INDENT> bl_label = "Mitsuba Render settings" <NEW_LINE> bl_idname = "SCENE_PT_layout" <NEW_LINE> bl_space_type = 'PROPERTIES' <NEW_LINE> bl_region_type = 'WINDOW' <NEW_LINE> bl_context = "render" <NEW_LINE> COMPAT_ENGINES = {'Mitsuba2_Renderer'} <NEW_LINE> ... | Creates a Mitsuba settings panel in the render context of the properties editor | 62598fa923849d37ff851013 |
class listNode: <NEW_LINE> <INDENT> def __init__(self, data, next = None): <NEW_LINE> <INDENT> self.__data = data <NEW_LINE> self.__next = next <NEW_LINE> <DEDENT> def getData(self): <NEW_LINE> <INDENT> return self.__data <NEW_LINE> <DEDENT> def setData(self, data): <NEW_LINE> <INDENT> self.__data = data <NEW_LINE> <DE... | Node class | 62598fa94f88993c371f04b9 |
@benchmark.Enabled('linux', 'mac', 'win', 'chromeos') <NEW_LINE> class PowerPPSControlDisabled(perf_benchmark.PerfBenchmark): <NEW_LINE> <INDENT> test = power.QuiescentPower <NEW_LINE> page_set = page_sets.PluginPowerSaverPageSet <NEW_LINE> options = {'pageset_repeat': 5} <NEW_LINE> def SetExtraBrowserOptions(self, opt... | A single page with a small-ish non-essential plugin. In this test, Plugin
Power Saver (PPS) is disabled, so the plugin should continue animating and
taking power. | 62598fa9a8370b77170f033a |
class IFrontEndFactory(Interface): <NEW_LINE> <INDENT> def __call__(engine=None, history=None): <NEW_LINE> <INDENT> pass | Factory interface for frontends. | 62598fa9097d151d1a2c0f88 |
class ItemBehaviorDefinitionResource(object): <NEW_LINE> <INDENT> swagger_types = { 'behavior': 'Behavior', 'modifiable': 'bool', 'required': 'bool' } <NEW_LINE> attribute_map = { 'behavior': 'behavior', 'modifiable': 'modifiable', 'required': 'required' } <NEW_LINE> def __init__(self, behavior=None, modifiable=None, r... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa95fc7496912d48232 |
class GameClass(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pygame.init() <NEW_LINE> self.screen = pygame.display.set_mode(config.screen_res) <NEW_LINE> self.clock = pygame.time.Clock() <NEW_LINE> self.inputHandler = InputHandler() <NEW_LINE> self.allSprites = pygame.sprite.RenderUpdates() <NEW_LINE>... | The game class for the Mayhem game. Handles pygame initialization and the game loop | 62598fa97047854f4633f338 |
class WebTestGeolocation(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'location': {'key': 'Id', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, location: Optional[str] = None, **kwargs ): <NEW_LINE> <INDENT> super(WebTestGeolocation, self).__init__(**kwargs) <NEW_LINE> self.location = locatio... | Geo-physical location to run a web test from. You must specify one or more locations for the test to run from.
:ivar location: Location ID for the webtest to run from.
:vartype location: str | 62598fa9fff4ab517ebcd744 |
class TLETest(unittest.TestCase): <NEW_LINE> <INDENT> def check_example(self, tle): <NEW_LINE> <INDENT> self.assertEqual(tle.satnumber, "25544") <NEW_LINE> self.assertEqual(tle.classification, "U") <NEW_LINE> self.assertEqual(tle.id_launch_year, "98") <NEW_LINE> self.assertEqual(tle.id_launch_number, "067") <NEW_LINE> ... | Test TLE reading.
We're using the wikipedia example::
ISS (ZARYA)
1 25544U 98067A 08264.51782528 -.00002182 00000-0 -11606-4 0 2927
2 25544 51.6416 247.4627 0006703 130.5360 325.0288 15.72125391563537 | 62598fa9aad79263cf42e734 |
class UserActivityUpdateSerializer(serializers.Serializer): <NEW_LINE> <INDENT> uuid = serializers.UUIDField() <NEW_LINE> name = serializers.CharField(required=False) <NEW_LINE> is_significant_activity = serializers.BooleanField(required=False) <NEW_LINE> is_negative_activity = serializers.BooleanField(required=False) ... | The create and update serializers "could" be combined, but I rather
be explicit separation for now, I can combine them later -- just don't want to build
tests that assume they're nested. | 62598fa967a9b606de545f2b |
class LoadError(Exception): <NEW_LINE> <INDENT> pass | Load game from file exception | 62598fa94428ac0f6e658483 |
class RequestTimeout(BaseError): <NEW_LINE> <INDENT> pass | The data provider is not responding | 62598fa97d847024c075c323 |
class ML_CompoundVectorFormat(ML_VectorFormat, ML_Compound_Format): <NEW_LINE> <INDENT> def __init__(self, c_format_name, opencl_format_name, vector_size, scalar_format, sollya_precision = None, cst_callback = None, display_format="", header=None): <NEW_LINE> <INDENT> ML_VectorFormat.__init__(self, scalar_format, vecto... | Generic class for ml_support_lib vector format | 62598fa963b5f9789fe850c4 |
class Modal(lv.mbox): <NEW_LINE> <INDENT> def __init__(self, parent, *args, **kwargs): <NEW_LINE> <INDENT> modal_style = lv.style_t() <NEW_LINE> lv.style_copy(modal_style, lv.style_plain_color) <NEW_LINE> modal_style.body.main_color = modal_style.body.grad_color = lv.color_make(0,0,0) <NEW_LINE> modal_style.body.opa = ... | mbox with semi-transparent background | 62598fa9d268445f26639b33 |
class NetCDFDataProxy(object): <NEW_LINE> <INDENT> __slots__ = ('shape', 'dtype', 'path', 'variable_name', 'fill_value') <NEW_LINE> def __init__(self, shape, dtype, path, variable_name, fill_value): <NEW_LINE> <INDENT> self.shape = shape <NEW_LINE> self.dtype = dtype <NEW_LINE> self.path = path <NEW_LINE> self.variable... | A reference to the data payload of a single NetCDF file variable. | 62598fa945492302aabfc431 |
class WeightEntrySerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = WeightEntry <NEW_LINE> exclude = ('user',) | Weight serializer | 62598fa95fcc89381b2660fc |
class DeviceConfigVariable: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.base_request = BaseRequest() <NEW_LINE> self.device = Device() <NEW_LINE> self.settings = Settings() <NEW_LINE> <DEDENT> def get_all(self, uuid): <NEW_LINE> <INDENT> device = self.device.get(uuid) <NEW_LINE> params = { 'filter'... | This class implements device config variable model for balena python SDK. | 62598fa93539df3088ecc213 |
class VolumeHelper(AWSHelper): <NEW_LINE> <INDENT> def __init__(self, heet, size, instance, name, device, zone=None, snapshot=None, volume_type=None, iops=None, dry_run=False): <NEW_LINE> <INDENT> self.heet = heet <NEW_LINE> self.size = size <NEW_LINE> self.instance = instance <NEW_LINE> self.name = name <NEW_LINE> sel... | modular and convergent EBS volumes. support for standard and io1 types (provisioned iops) | 62598fa91f037a2d8b9e404d |
class SrqMask(Flag): <NEW_LINE> <INDENT> NONE = 0b0 <NEW_LINE> DATA_READY = 0b1 <NEW_LINE> SYNTAX_ERROR = 0b100 <NEW_LINE> HARDWARE_ERROR = 0b1000 <NEW_LINE> FRONT_PANEL_SRQ = 0b10000 <NEW_LINE> CALIBRATION_FAILURE = 0b100000 | The service interrupt register flags. See page 46 of the manual for details. | 62598fa97d43ff24874273b2 |
class Media(object): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def validate(cls, filename): <NEW_LINE> <INDENT> pass | Represents a HLS media playlist.
Attributes:
filename (str): Media playlist filename
Examples:
>>> media_playlist = Media('media.m3u8') | 62598fa9090684286d59368c |
class BugfixTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_empty_file(self): <NEW_LINE> <INDENT> temp = tempfile.NamedTemporaryFile() <NEW_LINE> temp.flush() <NEW_LINE> self.assertRaises(MalformedFileError, NBTFile, temp.name) | Bugfix regression tests.
These tend to not fit into nice categories. | 62598fa96aa9bd52df0d4e29 |
class CamVidDataset(chainer.dataset.DatasetMixin): <NEW_LINE> <INDENT> def __init__(self, data_dir='auto', split='train'): <NEW_LINE> <INDENT> if split not in ['train', 'val', 'test']: <NEW_LINE> <INDENT> raise ValueError( 'Please pick split from \'train\', \'val\', \'test\'') <NEW_LINE> <DEDENT> if data_dir == 'auto':... | Semantic segmentation dataset for `CamVid`_.
.. _`CamVid`:
https://github.com/alexgkendall/SegNet-Tutorial/tree/master/CamVid
Args:
data_dir (string): Path to the root of the training data. If this is
:obj:`auto`, this class will automatically download data for you
under :obj:`$CHAINER_DATASET... | 62598fa9e5267d203ee6b86b |
class CHGate(TwoQubitGate, IFallbackOperation): <NEW_LINE> <INDENT> lowername = "ch" <NEW_LINE> cu_params = (-math.pi / 2.0, math.pi, 0.0, 0.0) <NEW_LINE> @classmethod <NEW_LINE> def create(cls, targets: Targets, params: tuple, options: Optional[dict] = None) -> 'CHGate': <NEW_LINE> <INDENT> if options: <NEW_LINE> <IND... | Controlled-H gate | 62598fa95fc7496912d48233 |
class ACVStepMode(enum.Enum): <NEW_LINE> <INDENT> Off = "@OFF" <NEW_LINE> Top = "@1" <NEW_LINE> MiddleTop1 = "@2" <NEW_LINE> MiddleTop2 = "@3" <NEW_LINE> MiddleBottom2 = "@4" <NEW_LINE> MiddleBottom1 = "@5" <NEW_LINE> Bottom = "@6" <NEW_LINE> Swing = "@100" | The vertical step mode for an AC/HVAC device.
Blades are numbered vertically from 1 (topmost)
to 6.
All is 100. | 62598fa938b623060ffa8ff9 |
class TestSmartbchSep20Api(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = mainnet.api.smartbch_sep20_api.SmartbchSep20Api() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_smart_bch_sep20_all_balances(self): <NEW_LINE> <INDENT> pass ... | SmartbchSep20Api unit test stubs | 62598fa999fddb7c1ca62d99 |
class BaseCLITest(object): <NEW_LINE> <INDENT> @pytest.fixture <NEW_LINE> def mock_client(self, mocker): <NEW_LINE> <INDENT> m_client = mocker.patch('dropme.client.get_client') <NEW_LINE> return m_client.return_value <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def exec_command(command=''): <NEW_LINE> <INDENT> argv = s... | Base class for testing CLI. | 62598fa99c8ee82313040121 |
class ProfileForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Profile <NEW_LINE> fields = ( 'language', 'languages', 'secondary_languages', ) <NEW_LINE> <DEDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ProfileForm, self).__init__(*args, **kwargs) <NEW_LINE> qs = ... | User profile editing. | 62598fa9925a0f43d25e7fa0 |
class CliCommand(): <NEW_LINE> <INDENT> def __init__(self, subcommand, action, parser, req_method, req_path, success_codes): <NEW_LINE> <INDENT> self.subcommand = subcommand <NEW_LINE> self.action = action <NEW_LINE> self.parser = parser <NEW_LINE> self.req_method = req_method <NEW_LINE> self.req_path = req_path <NEW_L... | Base class for all sub-commands. | 62598fa97b25080760ed740e |
class PyFunction(PyObject): <NEW_LINE> <INDENT> option_spec = PyObject.option_spec.copy() <NEW_LINE> option_spec.update({ 'async': directives.flag, }) <NEW_LINE> def get_signature_prefix(self, sig): <NEW_LINE> <INDENT> if 'async' in self.options: <NEW_LINE> <INDENT> return 'async ' <NEW_LINE> <DEDENT> else: <NEW_LINE> ... | Description of a function. | 62598fa97d847024c075c325 |
class MyStaticMplCanvas(MyMplCanvas): <NEW_LINE> <INDENT> def compute_initial_figure(self): <NEW_LINE> <INDENT> t = arange(0.0, 3.0, 0.01) <NEW_LINE> s = sin(2*pi*t) <NEW_LINE> s1 = cos( 2 * pi * t) <NEW_LINE> self.axes.plot(t, s,label='sin',color='r') <NEW_LINE> self.axes.plot( t, s1,label='cos',color='b' ) <NEW_LINE>... | 静态画布:一条正弦线 | 62598fa9796e427e5384e6f5 |
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0): <NEW_LINE> <INDENT> self.__size = size <NEW_LINE> <DEDENT> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> return self.__size <NEW_LINE> <DEDENT> @size.setter <NEW_LINE> def size(self, value): <NEW_LINE> <INDENT> if type(value) is not int: <NEW_LINE... | creates square | 62598fa999cbb53fe6830e38 |
class SensorData: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.logger = logger_variable(__name__, 'SensorData.log') <NEW_LINE> self.serialOpen = serial.Serial('/dev/ttyACM0', 115200) <NEW_LINE> wpi.wiringPiSetupGpio() <NEW_LINE> wpi.pinMode(self.interrupt_pin, 1) <NEW_LINE> wpi.pinMode(26, 1) <NEW_L... | functions: get_data(), filter_data(), convert_to_json()
public variables: | 62598fa90a50d4780f70533f |
class DummyClass(object): <NEW_LINE> <INDENT> def __init__(self, parent, **attrlinks): <NEW_LINE> <INDENT> dataDict = self.__dict__ <NEW_LINE> dataDict['parent'] = parent <NEW_LINE> storage = parent.__dict__['storage'] <NEW_LINE> dataDict['storage'] = storage <NEW_LINE> tag = self.__class__.siblingValues <NEW_LINE> ll ... | dummy class to store temporarily attributes of classes that
are removed (not just changed).
NB Assumes that class.storage == parent.storage | 62598fa9cc0a2c111447af72 |
class Repository(Settings): <NEW_LINE> <INDENT> valid_keys = ["use-profile", "directory", "groups", "tag"] + Profile.valid_keys <NEW_LINE> def __init__(self, repo: str): <NEW_LINE> <INDENT> super().__init__(Repository.valid_keys) <NEW_LINE> self.repo = repo <NEW_LINE> <DEDENT> def get_repo(self): <NEW_LINE> <INDENT> re... | Stores all settings related to a repository. | 62598fa9d268445f26639b34 |
class V1CrossVersionObjectReference(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'kind': 'str', 'name': 'str', 'api_version': 'str' } <NEW_LINE> self.attribute_map = { 'kind': 'kind', 'name': 'name', 'api_version': 'apiVersion' } <NEW_LINE> self._kind = None <NEW_LINE> sel... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598fa98a43f66fc4bf20de |
class CentralizedSGD(GenericCentralizedOptimizer): <NEW_LINE> <INDENT> def __init__( self, world_size=None, model=None, lr=required, momentum=0, dampening=0, weight_decay=0, nesterov=False, use_cuda=False, by_layer=False, agg_grad=True, ): <NEW_LINE> <INDENT> super().__init__( model=model, world_size=world_size, use_cu... | Implements centralized stochastic gradient descent (optionally with momentum).
Averages the reduced parameters over the world size.
Args:
world_size (int): Size of the network
model (:obj:`nn.Module`): Model which contains parameters for SGD
lr (float): learning rate
momentum (float, optional): momentu... | 62598fa95fcc89381b2660fd |
class EntryState(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @log <NEW_LINE> def evaluate(self, app, kw, context, test_answer): <NEW_LINE> <INDENT> if (not kw) and (not context): <NEW_LINE> <INDENT> logger.debug("not kw and not context", extra={'className': strip(self._... | Makes an initial evaluation of keyword & context and decides which is
the next state. | 62598fa9d7e4931a7ef3bffb |
class PluginError(Exception): <NEW_LINE> <INDENT> pass | Raise when a parser is missing | 62598fa976e4537e8c3ef50f |
class SubnetMapping(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "SubnetId": (str, True), } | `SubnetMapping <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-networkfirewall-firewall-subnetmapping.html>`__ | 62598fa9167d2b6e312b6ed3 |
class TabuHillClimber(TabuOptimizer, HillClimber): <NEW_LINE> <INDENT> pass | Applies the tabu proccess in addition to a hill climbing search. | 62598fa9a8370b77170f033d |
class ServerConfig: <NEW_LINE> <INDENT> config_fp='/home/%s/qiime_web.conf' % getpass.getuser() <NEW_LINE> filefp=open(config_fp).read().split('\n') <NEW_LINE> config_options={} <NEW_LINE> for line in filefp: <NEW_LINE> <INDENT> if line != '': <NEW_LINE> <INDENT> key,val=line.strip().split('=') <NEW_LINE> config_option... | this is the cluster's server configuration to determine if it is a
production or development server | 62598fa991f36d47f2230e56 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.