code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ReadingWorker(Worker): <NEW_LINE> <INDENT> def __init__(self, number=0): <NEW_LINE> <INDENT> super().__init__(number) <NEW_LINE> self.input_folder = "input_files" <NEW_LINE> self.file_pattern = "input" <NEW_LINE> <DEDENT> @run_async <NEW_LINE> def work(self): <NEW_LINE> <INDENT> log = create_logger() <NEW_LINE> f... | ReadingWorker class | 62598ee356b00c62f0fb0f14 |
class AddPositionEmbs(nn.Module): <NEW_LINE> <INDENT> config: TransformerConfig <NEW_LINE> @nn.compact <NEW_LINE> def __call__(self, inputs, permutations): <NEW_LINE> <INDENT> cfg = self.config <NEW_LINE> assert inputs.ndim == 3, ('Number of dimensions should be 3,' ' but it is: %d' % inputs.ndim) <NEW_LINE> total_leng... | Adds (optionally learned) positional embeddings to the inputs.
Attributes:
config: TransformerConfig dataclass containing hyperparameters.
decode: whether to run in single-position autoregressive mode. | 62598ee3cad5886f8bdc3944 |
class DefaultConfig: <NEW_LINE> <INDENT> PORT = 3978 <NEW_LINE> APP_ID = os.environ.get("MicrosoftAppId", "") <NEW_LINE> APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "") <NEW_LINE> LUIS_APP_ID = os.environ.get("LuisAppId", "") <NEW_LINE> LUIS_API_KEY = os.environ.get("LuisAPIKey", "") <NEW_LINE> LUIS_API_HOST_... | Bot Configuration | 62598ee3fbf16365ca7926e7 |
class TestSupportBundleResult(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 testSupportBundleResult(self): <NEW_LINE> <INDENT> pass | SupportBundleResult unit test stubs | 62598ee321a7993f00c645b1 |
class ConvertChromeCrashStackLineTest(helpers.ExtendedTestCase): <NEW_LINE> <INDENT> def test_ignore(self): <NEW_LINE> <INDENT> self.assertIsNone(android.convert_chrome_crash_stack_line('SAWEgwwegweg')) <NEW_LINE> <DEDENT> def test_convert(self): <NEW_LINE> <INDENT> self.assertEqual( ' #12 0xcde (binary+0xabc)', and... | Tests convert_chrome_crash_stack_line. | 62598ee330bbd7224646827d |
@registerElement <NEW_LINE> class SharedURL (WebDAVTextElement): <NEW_LINE> <INDENT> namespace = calendarserver_namespace <NEW_LINE> name = "shared-url" <NEW_LINE> protected = True <NEW_LINE> hidden = True | The source url for a shared calendar. | 62598ee399cbb53fe682f4f5 |
class Admin(User): <NEW_LINE> <INDENT> def __init__(self, first_name, last_name,year,nick_name): <NEW_LINE> <INDENT> super().__init__(first_name, last_name,year,nick_name) <NEW_LINE> self.teste = Privileges() <NEW_LINE> <DEDENT> def permisao_de_administrador(self): <NEW_LINE> <INDENT> if self.nick_name == "admin": <NEW... | docstring for Admin | 62598ee33617ad0b5ee04774 |
class ModuleError(Exception): <NEW_LINE> <INDENT> pass | Base class for exceptions in this module. | 62598ee3097d151d1a2bf664 |
class ServiceEntryPoint(object): <NEW_LINE> <INDENT> def __init__(self, entry_id, dataset_type, path_or_uri): <NEW_LINE> <INDENT> self.entry_id = entry_id <NEW_LINE> self.dataset_type = dataset_type <NEW_LINE> self._resource = path_or_uri <NEW_LINE> <DEDENT> @property <NEW_LINE> def resource(self): <NEW_LINE> <INDENT> ... | Entry Points to initialize Pipelines | 62598ee301c39578d7f113ed |
class UrlMarkManager(QObject): <NEW_LINE> <INDENT> changed = pyqtSignal() <NEW_LINE> added = pyqtSignal(str, str) <NEW_LINE> removed = pyqtSignal(str) <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> super().__init__(parent) <NEW_LINE> self.marks = collections.OrderedDict() <NEW_LINE> self._lineparser = ... | Base class for BookmarkManager and QuickmarkManager.
Attributes:
marks: An OrderedDict of all quickmarks/bookmarks.
_lineparser: The LineParser used for the marks, or None
(when qutebrowser is started with -c '').
Signals:
changed: Emitted when anything changed.
added: Emitted when a ... | 62598ee30c0af96317c549e1 |
class NummeraanduidingExpanded(BagMixin, rest.HALSerializer): <NEW_LINE> <INDENT> _display = rest.DisplayField() <NEW_LINE> type = serializers.CharField(source='get_type_display') <NEW_LINE> bouwblok = Bouwblok() <NEW_LINE> buurt = Buurt() <NEW_LINE> buurtcombinatie = Buurtcombinatie() <NEW_LINE> stadsdeel = Stadsdeel(... | Serializer used in custom nummeraanduiding endpoint | 62598ee36fb2d068a7693145 |
@attr.s(auto_attribs=True) <NEW_LINE> class BinningInterval: <NEW_LINE> <INDENT> start: Quantity <NEW_LINE> end: Quantity <NEW_LINE> substitute: Quantity | Holds a binning interval and the value to replace it by. | 62598ee37cff6e4e811b4032 |
class ServerViewset(viewsets.ModelViewSet): <NEW_LINE> <INDENT> permission_classes = (permissions.IsAuthenticated, permissions.DjangoObjectPermissions) <NEW_LINE> queryset = Server.objects.all() <NEW_LINE> serializer_class = ServerSerializer <NEW_LINE> filter_class = ServerFilter <NEW_LINE> filter_fields = ('hostname',... | list:
获取服务器列表
create:
创建服务器
retrieve:
获取指定服务器记录
update:
修改服务器记录 | 62598ee301c39578d7f113ee |
class PRelu(Operator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(PRelu, self).__init__() <NEW_LINE> <DEDENT> def forward(self, x, slope): <NEW_LINE> <INDENT> mask0 = singa.LTFloat(x, 0.0) <NEW_LINE> res = singa.__mul__(x, mask0) <NEW_LINE> res = singa.__mul__(res, slope) <NEW_LINE> res += singa.... | PRelu applies the function `f(x) = slope * x` for x < 0,
`f(x) = x` for x >= 0 to the data tensor elementwise. | 62598ee3f7d966606f746635 |
class ImmutableInterface(BasicInterface): <NEW_LINE> <INDENT> __metaclass__ = ImmutableMeta <NEW_LINE> sid_ignore = frozenset({'_locked', '_logger', '_name', '_uid', '_sid_contains_cycles', '_with_arguments_error', 'sid'}) <NEW_LINE> def unlock(self): <NEW_LINE> <INDENT> super(ImmutableInterface, self).unlock() <NEW_LI... | Base class for immutable objects in pyMOR.
Instances of `ImmutableInterface` are immutable in the sense that
they are :meth:`locked <BasicInterface.lock>` after `__init__` returns.
.. _ImmutableInterfaceWarning:
.. warning::
For instances of `ImmutableInterface`, the following should always
be true ::
T... | 62598ee363d6d428bbee0e17 |
class Extension(interface.Extension): <NEW_LINE> <INDENT> name = 'core' <NEW_LINE> description = 'Complete the common core RPM metadata fields.' <NEW_LINE> version = '1.0.0' <NEW_LINE> requirements = {} <NEW_LINE> @staticmethod <NEW_LINE> def generate(config, spec): <NEW_LINE> <INDENT> name = config.core.name <NEW_LINE... | Common core RPM metadata fields. | 62598ee31f5feb6acb161297 |
class BaseHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def write(self, *a, **kw): <NEW_LINE> <INDENT> self.response.out.write(*a, **kw) <NEW_LINE> <DEDENT> def render_str(self, template, **params): <NEW_LINE> <INDENT> t = jinja_env.get_template(template) <NEW_LINE> return t.render(params) <NEW_LINE> <DEDENT> de... | BaseHandler, generic helper functions and user handling | 62598ee3fff4ab517ebcbe28 |
class GetFwLeaderboardsCorporationsVictoryPoints(object): <NEW_LINE> <INDENT> def __init__(self, active_total=None, last_week=None, yesterday=None): <NEW_LINE> <INDENT> self.swagger_types = { 'active_total': 'list[GetFwLeaderboardsCorporationsActiveTotal1]', 'last_week': 'list[GetFwLeaderboardsCorporationsLastWeek1]', ... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598ee3e5267d203ee69f4a |
class StructuredData: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.context = {} <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def get_jsonld(self): <NEW_LINE> <INDENT> return {"@context": self.context, "@graph": self.data} <NEW_LINE> <DEDENT> def get_context(self): <NEW_LINE> <INDENT> return... | Generic structered data class for models | 62598ee363d6d428bbee0e18 |
class ResizeReq(SessionTokenReq): <NEW_LINE> <INDENT> srcFilePath = request.CharVariable(required=True) <NEW_LINE> destFilePath = request.CharVariable(required=True) <NEW_LINE> width = request.CharVariable(required=True) <NEW_LINE> height = request.CharVariable(required=True) <NEW_LINE> callbackURL = request.CharVariab... | Nirvanix Resize Request | 62598ee338b623060ffa76db |
class IncompleteStoreBackend(StoreBackendBase): <NEW_LINE> <INDENT> pass | This backend cannot be instantiated and should raise a TypeError. | 62598ee376e4537e8c3edbfd |
class PluginProvider(object): <NEW_LINE> <INDENT> PLUGIN_NAME = 'PluginProvider' <NEW_LINE> EXTENSION_SET = '.pp' <NEW_LINE> def __init__(self, target, data): <NEW_LINE> <INDENT> self._target = str(target) <NEW_LINE> self._data = {} <NEW_LINE> self.__set_data(data) <NEW_LINE> <DEDENT> def __set_data(self, data): <NEW_L... | "PluginProvider class | 62598ee3b7558d5895461c8b |
class ContactTestCase(DatastoreTestbedCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(ContactTestCase, self).setUp() <NEW_LINE> self.myaddressbook_key = ndb.Key('AddressBook', 'tmatsuo') <NEW_LINE> friends = models.Group(parent=self.myaddressbook_key, name='friends') <NEW_LINE> friends.put() <NEW_... | A test case for the Contact model with groups. | 62598ee3442bda511e95aaa6 |
class ComputeRoutersInsertRequest(_messages.Message): <NEW_LINE> <INDENT> project = _messages.StringField(1, required=True) <NEW_LINE> region = _messages.StringField(2, required=True) <NEW_LINE> requestId = _messages.StringField(3) <NEW_LINE> router = _messages.MessageField('Router', 4) | A ComputeRoutersInsertRequest object.
Fields:
project: Project ID for this request.
region: Name of the region for this request.
requestId: An optional request ID to identify requests. Specify a unique
request ID so that if you must retry your request, the server will know
to ignore the request if it has... | 62598ee3498bea3a75a5617b |
class FlaskrTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.db_fd, flaskr.app.config['DATABASE'] = tempfile.mkstemp() <NEW_LINE> flaskr.app.config['TESTING'] = True <NEW_LINE> self.app = flaskr.app.test_client() <NEW_LINE> flaskr.init_db() <NEW_LINE> <DEDENT> def tearDown(self... | A simple test case for the flaskr app.
Database is assumed to be local sqlite3 (file) and is initialized/destroyed during the test. | 62598ee3097d151d1a2bf665 |
class MagmaFree: <NEW_LINE> <INDENT> def eval(self, x, **kwds): <NEW_LINE> <INDENT> return magma_free_eval(x) <NEW_LINE> <DEDENT> def __call__(self, code, strip=True, columns=0): <NEW_LINE> <INDENT> return magma_free_eval(code, strip=strip, columns=columns) | Evaluate MAGMA code without requiring that MAGMA be installed
on your computer by using the free online MAGMA calculator.
EXAMPLES:
sage: magma_free("Factorization(9290348092384)") # optional - internet
[ <2, 5>, <290323377887, 1> ] | 62598ee3bd1bec0571e143ee |
class SecurityPolicyProperties(AFDStateProperties): <NEW_LINE> <INDENT> _validation = { 'provisioning_state': {'readonly': True}, 'deployment_status': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, 'deployment_status': {'key': 'deploymentStatus', '... | The json object that contains properties required to create a security policy.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar provisioning_state: Provisioning status. Possible values include: "Succeeded", "Failed",
"Updating", "Deleting", "Creating".
:vartype provisioni... | 62598ee38e7ae83300ee76d5 |
class Tag: <NEW_LINE> <INDENT> def __init__(self, original="", lemma="", tag="", certainty=-1): <NEW_LINE> <INDENT> self.original = original <NEW_LINE> self.lemma = lemma <NEW_LINE> self.tag = tag <NEW_LINE> self.certainty = certainty | A tag object will be composed of four elements:
The original word, the lemma, the tag, and the tag certainty (probability; if available). | 62598ee385dfad0860cbed8b |
class MultiGreeterServicer(object): <NEW_LINE> <INDENT> def sayHello(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | The greeting service definition.
| 62598ee3fbf16365ca7926e9 |
class AddInterfaceTag(Method): <NEW_LINE> <INDENT> roles = ['admin', 'pi', 'tech', 'user'] <NEW_LINE> accepts = [ Auth(), InterfaceTag.fields['interface_id'], Mixed(TagType.fields['tag_type_id'], TagType.fields['tagname']), InterfaceTag.fields['value'], ] <NEW_LINE> returns = Parameter(int, 'New interface_tag_id (> 0) ... | Sets the specified setting for the specified interface
to the specified value.
Admins have full access. Non-admins need to
(1) have at least one of the roles attached to the tagtype,
and (2) belong in the same site as the tagged subject.
Returns the new interface_tag_id (> 0) if successful, faults
otherwise. | 62598ee332920d7e50bc4673 |
class PublicUserApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> <DEDENT> def test_create_valid_user_success(self): <NEW_LINE> <INDENT> payload = { "email": "test@gmail.com", "password": "testpass", "name": "Test Name", } <NEW_LINE> res = self.client.post... | Test the users api public | 62598ee330bbd7224646827f |
class AdjustGamma(ImageProcessorModule): <NEW_LINE> <INDENT> def __init__(self, mode, gamma=1, gain=1, name="AdjustGamma"): <NEW_LINE> <INDENT> super(AdjustGamma, self).__init__(mode=mode, name=name) <NEW_LINE> self.gamma = gamma <NEW_LINE> self.gain = gain <NEW_LINE> <DEDENT> def _build(self, incoming, *args, **kwargs... | See `plx.image.adjust_gamma`'s docstring | 62598ee3e5267d203ee69f4b |
class DatabaseLoadingThread(Thread): <NEW_LINE> <INDENT> STOP_SIGNAL = '--stop--' <NEW_LINE> SIZE_MAP = dict() <NEW_LINE> def __init__(self, threadsafe_session_maker, queue, sql_object, raise_on_error=True, commit_interval=10, **kwargs): <NEW_LINE> <INDENT> self.session_maker = threadsafe_session_maker <NEW_LINE> self.... | A thread class that handles the loading of dict objects
from a Queue to a SQLAlchemy table.
Useful for consuming large amounts of data without bottle-necks. | 62598ee3ac7a0e7691f70b5c |
class FilterModule(object): <NEW_LINE> <INDENT> def filters(self): <NEW_LINE> <INDENT> return { 'split' : split_string } | A filter to split a string into a list. | 62598ee37047854f4633da1c |
class Test_UT_KeyError(Test_UT_Exception): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls.TestClass = testmodule.UT_KeyError <NEW_LINE> cls.ChildOf = [Exception, BaseException, testmodule.UT_Exception, KeyError] <NEW_LINE> cls.NotChildOf = [TypeError, testmodule.UT_TypeError, V... | Test cases for the class introspection_lib.base_exceptions.UT_KeyError.
Implements tests: TEST-T-200, TEST-T-201, TEST-T-202 and TEST-T-260. Covers
the requirements REQ-FUN-200, REQ-FUN-201, REQ-FUN-202 and REQ-FUN-260. | 62598ee33d592f4c4edb953b |
@unittest.skipUnless( HAS_CASSANDRA_HOME, "CASSANDRA_HOME must be set to a >=3.5 install", ) <NEW_LINE> class TestCaseWithAccessor(TestCaseWithTempDir): <NEW_LINE> <INDENT> KEYSPACE = "testkeyspace" <NEW_LINE> CACHE_CLASS = bg_metadata_cache.MemoryCache <NEW_LINE> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE>... | A TestCase with an Accessor for an ephemeral Cassandra cluster. | 62598ee3097d151d1a2bf666 |
class DataView(View): <NEW_LINE> <INDENT> def __init__(self, path, viewParams={}, **kwargs): <NEW_LINE> <INDENT> View.__init__(self) <NEW_LINE> self._memory = '2g' <NEW_LINE> self._loadPath(path) <NEW_LINE> self._env = kwargs.get('env', {}) <NEW_LINE> self._viewParams = viewParams <NEW_LINE> <DEDENT> def _loadPath(self... | Wrapper the arguments to showj (either web or desktop). | 62598ee30a50d4780f7039f0 |
class EndpointUrlListDataType(FrozenClass): <NEW_LINE> <INDENT> ua_types = [ ('EndpointUrlList', 'ListOfString'), ] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.EndpointUrlList = [] <NEW_LINE> self._freeze = True <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'EndpointUrlListDataType(Endp... | :ivar EndpointUrlList:
:vartype EndpointUrlList: String | 62598ee3462c4b4f79dba040 |
class Epsilon: <NEW_LINE> <INDENT> ZERO_RELATIVE = None <NEW_LINE> ZERO_ABSOLUTE = None <NEW_LINE> ZERO_ANGLE = None <NEW_LINE> __slots__ = '_zero_relative', '_zero_absolute', '_zero_angle', '_map_range' <NEW_LINE> def __init__(self, features): <NEW_LINE> <INDENT> if len(features) >= 1: <NEW_LINE> <INDENT> b_box = feat... | Class defining the value of the zero | 62598ee366673b3332c2e9ee |
class ssv_sp_parms4(BaseObj): <NEW_LINE> <INDENT> _attrlist = ("ops", "hash_algs", "encr_algs", "window", "num_gss_handles") <NEW_LINE> def __init__(self, unpack): <NEW_LINE> <INDENT> self.ops = state_protect_ops4(unpack) <NEW_LINE> self.hash_algs = unpack.unpack_array(sec_oid4) <NEW_LINE> self.encr_a... | struct ssv_sp_parms4 {
state_protect_ops4 ops;
sec_oid4 hash_algs<>;
sec_oid4 encr_algs<>;
uint32_t window;
uint32_t num_gss_handles;
}; | 62598ee3cc0a2c1114479649 |
class MultiConsentRequirementsFieldTests(ConsentTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(MultiConsentRequirementsFieldTests, self).setUp() <NEW_LINE> self.consent_requirement_1 = MyConsentRequirement1() <NEW_LINE> self.consent_requirement_2 = MyConsentRequirement2() <NEW_LINE> self.fiel... | Unit tests for MultiConsentRequirementsField. | 62598ee30c0af96317c549e3 |
class ColorProperty(StringProperty): <NEW_LINE> <INDENT> widget_type = 'color' <NEW_LINE> pass | A descriptor that will cast values to strings and can optionally clamp
values to a minimum and maximum. Has a color widget as the default widget.
Expects its label to be set or passed to __init__. | 62598ee3a219f33f346c4e80 |
class ColorScheme(object): <NEW_LINE> <INDENT> def __init__(self, groups = [], title = "", description = "", default_color = "black", alphabet = seq.generic_alphabet) : <NEW_LINE> <INDENT> self.title= title <NEW_LINE> self.description = description <NEW_LINE> self.default_color = Color.from_string(default_color) <NEW_L... | A coloring of an alphabet.
title : string -- A human readable description
defualt_color : Color --
groups : list of color groups
alphabet : string -- The set of colored symbols
color -- A map between a symbol and a Coloring | 62598ee3aad79263cf42ce57 |
class SegmentClassifier(object): <NEW_LINE> <INDENT> def __init__(self, classifier, clip_class_names): <NEW_LINE> <INDENT> super(SegmentClassifier, self).__init__() <NEW_LINE> self._classifier = classifier <NEW_LINE> self._clip_class_names = sorted(clip_class_names) <NEW_LINE> <DEDENT> @property <NEW_LINE> def clip_cla... | Multi-class segment classifier that wraps a scikit-learn multi-class
classifier. | 62598ee3f7d966606f746637 |
class Egograph(DetailView): <NEW_LINE> <INDENT> model = Person <NEW_LINE> template_name = 'people/person_egograph.html' | Display an egograph for a single
:class:`~zurnatikl.apps.people.models.Person`. | 62598ee33539df3088eca8f9 |
@dataclass <NEW_LINE> class RequestsCustomError(Exception): <NEW_LINE> <INDENT> status_code: int = 0 | Class for Custom Exception | 62598ee3a8370b77170eea2b |
class static(object): <NEW_LINE> <INDENT> def __call__(self, environ, start_response): <NEW_LINE> <INDENT> from paste.urlparser import make_static <NEW_LINE> project_dir = environ['zohmg_project_dir'] <NEW_LINE> static = make_static({}, project_dir + '/static') <NEW_LINE> return static(environ, start_response) | Application that serves static files from the 'static' directory in the
project directory. | 62598ee3627d3e7fe0e054cf |
class TypeClass(Type): <NEW_LINE> <INDENT> __slots__ = ('clazz',) <NEW_LINE> def __init__(self, clazz, isPrimitive=False, isContainable=True): <NEW_LINE> <INDENT> assert isclass(clazz), 'Invalid class %s' % clazz <NEW_LINE> Type.__init__(self, isPrimitive, isContainable) <NEW_LINE> self.clazz = clazz <NEW_LINE> <DEDENT... | The class that represents the API types used for mapping data. | 62598ee31f037a2d8b9e274e |
class InvalidPick(ValueError): <NEW_LINE> <INDENT> pass | This is a base exception for invalid picking | 62598ee34428ac0f6e656b9a |
class UserProfileForm(ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = UserProfile <NEW_LINE> fields = ['description', 'profile_image'] <NEW_LINE> widgets = { 'description': forms.Textarea(attrs={'class': 'form-control', 'rows': 2}), } | This module is the model class for user profile form, which is an
extension of the user form. This is the model for the form with which
a user adds and edits his profile information such as description and
profile image. | 62598ee367a9b606de544615 |
class PasswordLengthValidator(object): <NEW_LINE> <INDENT> def clean_new_password1(self): <NEW_LINE> <INDENT> password1 = self.cleaned_data.get('new_password1') <NEW_LINE> if len(password1) < 4: <NEW_LINE> <INDENT> raise ValidationError("Password must be at least 4 characters.") <NEW_LINE> <DEDENT> return password1 | check password length | 62598ee3f9cc0f698b1c45f2 |
class SimplePasswordMaker: <NEW_LINE> <INDENT> CHARSET = string.ascii_uppercase + string.ascii_lowercase + string.digits + string.punctuation <NEW_LINE> def generate_password(self, algorithm, master, data, length, charset): <NEW_LINE> <INDENT> self.verify_algorithm(algorithm) <NEW_LINE> hash = hashlib.new(algori... | Main class used for generating passwords. | 62598ee32c8b7c6e89bd1e08 |
class DecoderConv(nn.Module): <NEW_LINE> <INDENT> def __init__(self, params, dim_z: int, ch_out: int): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.width = params["architecture"]["width_input_image"] <NEW_LINE> assert self.width == 28 <NEW_LINE> self.dim_z = dim_z <NEW_LINE> self.ch_out = ch_out <NEW_LINE> se... | Decode z -> x
INPUT: z of shape: ..., dim_z
OUTPUT: image of shape: ..., ch_out, width, height
where ... are all the independent dimensions, i.e. box, batch_size, enumeration_dim etc. | 62598ee3d268445f26638eb2 |
class CommonMixOutputParams(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.OutputStreamName = None <NEW_LINE> self.OutputStreamType = None <NEW_LINE> self.OutputStreamBitRate = None <NEW_LINE> self.OutputStreamGop = None <NEW_LINE> self.OutputStreamFrameRate = None <NEW_LINE> self.Outp... | 通用混流输出参数。
| 62598ee32eb69b55b15a06ad |
class MongoModel(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self.pk = None <NEW_LINE> self._set_mongo_dict(kwargs) <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> db_table = 'my_collection' <NEW_LINE> abstract = True <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def new(cls, **doc)... | A pymongo object wrapper that
that implements some of the django Model interface.
The object instance variables that don't start with _
are used both like django model attributes and
mongodb field.
between the dajngo model and mongo document.
The primary key field is called 'pk', NOT 'id'. | 62598ee34f6381625f1987e0 |
class AtariIntegrationTest(tf.test.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> FLAGS.base_dir = os.path.join( '/tmp/dopamine_tests', datetime.datetime.utcnow().strftime('run_%Y_%m_%d_%H_%M_%S')) <NEW_LINE> self._checkpoint_dir = os.path.join(FLAGS.base_dir, 'checkpoints') <NEW_LINE> self._loggin... | Tests for Atari environment with various agents.
| 62598ee3be8e80087fbbd695 |
class BatchMeta(type): <NEW_LINE> <INDENT> def __init__(cls, name, bases, dct): <NEW_LINE> <INDENT> global G_batchModels <NEW_LINE> btch_sys_prefix = "BatchLetSys_" <NEW_LINE> btch_lib_prefix = "BatchLetLib_" <NEW_LINE> if name.startswith(btch_sys_prefix): <NEW_LINE> <INDENT> syscall_name = name[len(btch_sys_prefix):] ... | This metaclass allows derived class of BatchLetBase to self-register their function name.
So, the name of a system call is used to lookup the class which represents it. | 62598ee32ae34c7f260a972f |
class Stats(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.game_started = False <NEW_LINE> self.game_over = False | This class keeps all game statistics | 62598ee3a17c0f6771d5a89c |
class ClientsCache(BrowserView): <NEW_LINE> <INDENT> implements(IClientsCache) <NEW_LINE> def __init__(self, context, request): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> self.request = request <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> props = getToolByName(self.context, 'portal_properties'... | ClientsCache BrowserView
| 62598ee37047854f4633da1d |
class VarianceConvention(EnumBase, Enum): <NEW_LINE> <INDENT> Annualized = 'Annualized' <NEW_LINE> Total = 'Total' <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return self.value | Specifies whether the variance is Annualized or Total | 62598ee34f88993c371ef80a |
class TrackerInfo (BaseModel): <NEW_LINE> <INDENT> tracker_key: str <NEW_LINE> grouping: str <NEW_LINE> category: str <NEW_LINE> season: str <NEW_LINE> mode: GameMode <NEW_LINE> active: bool <NEW_LINE> legend: str | Tracker Info Class | 62598ee33c8af77a43b67257 |
class Asset(models.Model): <NEW_LINE> <INDENT> type_choices = Choices('SERVER', 'NETWORK') <NEW_LINE> status_choices = Choices('RUNNING', 'MAINTANCING', 'STOCK') <NEW_LINE> orgid = models.CharField(u'所属ID', max_length=24) <NEW_LINE> device_type = StatusField(u'资产类型', choices_name='type_choices', null=True, blank=True) ... | 资产信息表,所有资产信息(服务器,网络设备) | 62598ee30a50d4780f7039f2 |
class ActionFactory: <NEW_LINE> <INDENT> def __init__(self, remote_tool = None, fileput_tool = None, fileget_tool = None): <NEW_LINE> <INDENT> if remote_tool == None: <NEW_LINE> <INDENT> remote_tool = configuration.get("remote_tool") <NEW_LINE> <DEDENT> if fileput_tool == None: <NEW_LINE> <INDENT> fileput_tool = config... | Instanciate multiple remote process execution and file copies using configurable connector tools: ``ssh``, ``scp``, ``taktuk`` | 62598ee3462c4b4f79dba042 |
class Core: <NEW_LINE> <INDENT> def __init__( self, loop: asyncio.AbstractEventLoop, config: BaseConfig, service: BaseService, device_listener: StateProducer, session_manager: ClientSessionManager, takeover: TakeoverMethod, state_dispatcher: ProtocolStateDispatcher, ) -> None: <NEW_LINE> <INDENT> self.loop = loop <NEW_... | Instance for protocols to access core features. | 62598ee36fb2d068a7693147 |
class WorkspaceSettingList(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'value': {'required': True}, 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[WorkspaceSetting]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( s... | List of workspace settings response.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:param value: Required. List of workspace settings.
:type value: list[~azure.mgmt.security.models.WorkspaceSetting]
:ivar n... | 62598ee3a219f33f346c4e82 |
class melee_bot(base_bot): <NEW_LINE> <INDENT> def get_bot_name(self): <NEW_LINE> <INDENT> return 'melee_bot' <NEW_LINE> <DEDENT> def get_player_name(self): <NEW_LINE> <INDENT> return 'examples' <NEW_LINE> <DEDENT> def reset(self, no): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get_action(self, shalf, ohalf): <NE... | Ranged weapon? What ranged weapon? | 62598ee37cff6e4e811b4036 |
class UserInfoListResponse(object): <NEW_LINE> <INDENT> def __init__(self, user_info_list=None,): <NEW_LINE> <INDENT> self.user_info_list = user_info_list <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.... | Attributes:
- user_info_list | 62598ee3aad79263cf42ce59 |
class TeamPermissionViewSet( NestedViewSetMixin, DestroyModelMixin, GenericViewSet): <NEW_LINE> <INDENT> queryset = SeedPermission.objects.all() <NEW_LINE> serializer_class = PermissionSerializer <NEW_LINE> permission_classes = (permissions.TeamPermissionPermission,) <NEW_LINE> def check_team_permissions(self, request,... | Nested viewset to add and remove permissions from teams. | 62598ee3eab8aa0e5d30a3c1 |
class JobTemplateBase(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> def __init__(self, name, write_lock=None, max_attempts=1, emails=None, priority=None, warn_timeout_sec=None, abort_timeout_sec=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.write_lock = write_lock <NEW_LINE> self._ma... | An interface for job templates. | 62598ee363d6d428bbee0e1b |
class SScreenSSD1306( SSPILScreen ): <NEW_LINE> <INDENT> def __init__(self, display, bufferColorMode, bufferSize=None, displayDirection=0 ): <NEW_LINE> <INDENT> self._checkBufferColorMode(bufferColorMode) <NEW_LINE> self._display_color_mode = "1" <NEW_LINE> self._initDisplay(display, displayDirection, (display.width, d... | !
\~english
Using SSD1306 chip to implement the SScreen object
Supported: JMRPiDisplay SSD1306 driver and Adafruit SSD1306 driver
\~chinese
使用 SSD1306 显示芯片实现的 SScreen 对象
支持: JMRPiDisplay_SSD1306 和 Adafruit SSD1306 driver | 62598ee33539df3088eca8fb |
class HttpStatusError(Exception): <NEW_LINE> <INDENT> pass | Whenever the response code is not a 200. | 62598ee34527f215b58e854f |
class QueryGenTests(DefaultDrySiteTestCase): <NEW_LINE> <INDENT> def test_query_constructor(self): <NEW_LINE> <INDENT> qGen1 = QueryGenerator(site=self.get_site(), action="query", meta="siteinfo") <NEW_LINE> qGen2 = QueryGenerator(site=self.get_site(), meta="siteinfo") <NEW_LINE> self.assertCountEqual(qGen1.request._pa... | Test QueryGenerator with a real site. | 62598ee376e4537e8c3edc01 |
class MyException(Exception): <NEW_LINE> <INDENT> pass | Local exception class used in this testing module. | 62598ee3009cb60464cffb98 |
class Routine(object): <NEW_LINE> <INDENT> def __init__(self, name, arguments, results): <NEW_LINE> <INDENT> if len(results) == 0: <NEW_LINE> <INDENT> raise ValueError("At least one result is required.") <NEW_LINE> <DEDENT> self.name = name <NEW_LINE> self.arguments = arguments <NEW_LINE> self.results = results | Generic description of an evaluation routine for a set of sympy expressions.
A CodeGen class can translate instances of this class into C/Fortran/...
code. The routine specification covers all the features present in these
languages. The CodeGen part must raise an exception when certain features
are not present in the... | 62598ee3435de62698e9a420 |
class Solution: <NEW_LINE> <INDENT> def groupThePeople(self, groupSizes: List[int]) -> List[List[int]]: <NEW_LINE> <INDENT> mp = collections.defaultdict(list) <NEW_LINE> for i, size in enumerate(groupSizes): <NEW_LINE> <INDENT> mp[size].append(i) <NEW_LINE> <DEDENT> res = [] <NEW_LINE> for s in mp: <NEW_LINE> <INDENT> ... | [3,3,3,3,3,1,3]
0 1 2 3 4 5 6
3: [0,1,2,3,4,6]
1: [5]
append [0,1,2] to res, then next three item
# guaranteed that there exists at least one solution. | 62598ee38e7ae83300ee76d9 |
class PuzzleModelError(Exception): <NEW_LINE> <INDENT> pass | Base class for puzzle exceptions | 62598ee3cc0a2c111447964c |
class Message(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.fields = [] <NEW_LINE> <DEDENT> def AddField(self, attribute, field_type, field_name): <NEW_LINE> <INDENT> self.fields.append(Field(repeated=attribute == 'repeated', type_=field_type, name=field_nam... | Holds information about a protobuf message.
Attributes:
name: The name of the message.
fields: A list of Field tuples. | 62598ee32c8b7c6e89bd1e0a |
class MoexClient: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get_all_securities(self): <NEW_LINE> <INDENT> start = 0 <NEW_LINE> shift = 1 <NEW_LINE> result = [] <NEW_LINE> columns = [] <NEW_LINE> while shift > 0: <NEW_LINE> <INDENT> url = 'https://iss.moex.com/iss/securitie... | Implementation free API Moscow Exchange
https://iss.moex.com/iss/reference/ - official documentation Moscow Exchange | 62598ee38da39b475be017f4 |
class CategoricalMoments(MultinomialMoments): <NEW_LINE> <INDENT> def compute_fixed_moments(self, x): <NEW_LINE> <INDENT> x = np.asanyarray(x) <NEW_LINE> if not misc.isinteger(x): <NEW_LINE> <INDENT> raise ValueError("Values must be integers") <NEW_LINE> <DEDENT> if np.any(x < 0) or np.any(x >= self.categories): <NEW_L... | Class for the moments of categorical variables. | 62598ee367a9b606de544618 |
class TestVSPTDTechProcTable(unittest.TestCase): <NEW_LINE> <INDENT> def test_init(self): <NEW_LINE> <INDENT> _ = VSPTDTechProcTable( TrpStr(Trp('A', 'N', '0000'), Trp('P', 'N', '000'), Trp('P', 'KWO', '000'), Trp('Q', 'DI', '00')), TrpStr(Trp('A', 'N', 1), Trp('P', 'N', 3), Trp('P', 'KWO', '000'), Trp('Q', 'DI', '00')... | Класс VSPTDTechProcTable | 62598ee37d43ff2487426720 |
class APIError(Exception): <NEW_LINE> <INDENT> def __init__(self, message, **kwargs): <NEW_LINE> <INDENT> super(APIError, self).__init__(message) <NEW_LINE> self.response = kwargs.pop('response', None) | An error while querying the API. | 62598ee4cad5886f8bdc394a |
class JDBVariablesView(JDBView): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(JDBVariablesView, self).__init__("JDB Variables", False, settingsprefix="variables") <NEW_LINE> self.variables = [] <NEW_LINE> <DEDENT> def open(self): <NEW_LINE> <INDENT> super(JDBVariablesView, self).open() <NEW_LINE> s... | Debugger view displaying local variables while at a breakpoint / stepping through | 62598ee44a966d76dd5ed52e |
class WorkerEvent(QEvent): <NEW_LINE> <INDENT> EVENT_TYPE = QEvent.Type(QEvent.registerEventType()) <NEW_LINE> def __init__(self, callback, response): <NEW_LINE> <INDENT> QEvent.__init__(self, WorkerEvent.EVENT_TYPE) <NEW_LINE> self.callback = callback <NEW_LINE> self.response = response | thread-safe callback execution by raising
these custom events in the main ui loop | 62598ee43c8af77a43b67258 |
class Mob(BaseObject): <NEW_LINE> <INDENT> health_max = 100 <NEW_LINE> def __init__(self, char, name, sight=11): <NEW_LINE> <INDENT> super(Mob, self).__init__() <NEW_LINE> self._color = None <NEW_LINE> self.char = char <NEW_LINE> self.coords = (0, 0) <NEW_LINE> self.equipment = { 'hands': None, 'head': None, 'torso': N... | Base class for players and alike. | 62598ee4462c4b4f79dba044 |
class ATFolder : <NEW_LINE> <INDENT> def getNextPreviousParentValue(self): <NEW_LINE> <INDENT> pass | a folder suitable for holding a very large number of items | 62598ee4a79ad16197768663 |
class SuccessF(EmptyFunction, NamedFunction): <NEW_LINE> <INDENT> name = 'success' | https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#success
>>> f = SuccessF()
>>> repr(f)
'success()'
>>> str(f)
'success()' | 62598ee4cc0a2c111447964d |
class Gate(object): <NEW_LINE> <INDENT> def __init__(self, name, targets=None, controls=None, arg_value=None, arg_label=None): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.targets = None <NEW_LINE> self.controls = None <NEW_LINE> if not isinstance(targets, list) and targets is not None: <NEW_LINE> <INDENT> self... | Representation of a quantum gate, with its required parametrs, and target
and control qubits. | 62598ee40c0af96317c549e7 |
class UnixTimestampField(models.DateTimeField): <NEW_LINE> <INDENT> def __init__(self, null=False, blank=False, **kwargs): <NEW_LINE> <INDENT> super(UnixTimestampField, self).__init__(**kwargs) <NEW_LINE> self.blank, self.isnull = blank, null <NEW_LINE> self.null = True <NEW_LINE> <DEDENT> def db_type(self, connection)... | UnixTimestampField: creates a DateTimeField that is represented on the
database as a TIMESTAMP field rather than the usual DATETIME field. | 62598ee41b99ca400228e832 |
class ProductDetail(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> queryset = Product.objects.all() <NEW_LINE> serializer_class = ProductSerializer | Product detail API View. | 62598ee40c0af96317c549e8 |
class PublicUserApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> <DEDENT> def test_create_valid_user_success(self): <NEW_LINE> <INDENT> payload = { 'email': 'test@test.com', 'password': '12345654', 'name': 'Test name' } <NEW_LINE> res = self.client.post(C... | Test the users API (public) | 62598ee407f4c71912bada9f |
class DrawingExportOptions(core.Base): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def cast(arg): <NEW_LINE> <INDENT> return DrawingExportOptions() <NEW_LINE> <DEDENT> @property <NEW_LINE> def filename(self): <NEW_LINE> <INDENT> return str() <NEW_LINE> <... | The base class for the different drawing export types. This class is never directly used in an export because you need the specific export type to specify the type of export to be performed. | 62598ee46fb2d068a7693148 |
class AnalysisNavigationNotification(Notification): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> <DEDENT> @property <NEW_LINE> def event(self): <NEW_LINE> <INDENT> return self.data.get('event') <NEW_LINE> <DEDENT> @property <NEW_LINE> def file(self): <NEW_LINE> <INDENT> ... | Reports the navigation targets associated with a given file.
This notification is not subscribed to by default. Clients can subscribe by
including the value "NAVIGATION" in the list of services passed in an
analysis.setSubscriptions request. | 62598ee4adb09d7d5dc08c11 |
class CrawlerKuaiShou(crawler.Crawler): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> def _real_worker(self, urlPack): <NEW_LINE> <INDENT> for _ in range(2): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> json_data = {} <NEW_LINE> json_data['target_url'] = urlPack.url <NEW_LINE> j... | classdocs | 62598ee460cbc95b06362987 |
class FetchDraftTestCase(FetchStatusHelperMixin, TestCase): <NEW_LINE> <INDENT> def common_tests(self): <NEW_LINE> <INDENT> super().common_tests() <NEW_LINE> self.usi_submission.refresh_from_db() <NEW_LINE> self.assertEqual(self.usi_submission.status, SUBMITTED) <NEW_LINE> <DEDENT> def test_fetch_status(self): <NEW_LIN... | a draft submission without errors | 62598ee4656771135c487cde |
class wordAssociation(Command): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.N = 0 <NEW_LINE> self.m = 0 <NEW_LINE> self.termdocumentmatrix = None <NEW_LINE> self.unigramList = None <NEW_LINE> self.cosinematrix = None <NEW_LINE> self.associationDict = defaultdict(list) <NEW_LINE> <DEDENT> def proces... | Finds association between two words. Words can be unigram or bigram or trigrams
Usually called in a chain after creating term document matrix. Using the term document
matrix as input, produces word associations.
Algorithm :
input : Term document matrix ,A
1. A * transpose(A) = B, a term term, coweight matrix
2. ... | 62598ee44e4d562566370a64 |
class Browser(db.Model): <NEW_LINE> <INDENT> created = db.DateTimeProperty(auto_now_add=True) <NEW_LINE> user_agent = db.StringProperty() <NEW_LINE> init_path = db.StringProperty() <NEW_LINE> init_referrer = db.StringProperty() <NEW_LINE> init_address = db.StringProperty() | The Browser model definition.
Browser instances represent a unique browser that has visited one of our
pages. It is not a session ID, but a unique identifier associated with the
user agent. We use a cookie to set the browser ID and ask the browser to
identify itself on each subsequent request. Obviously user agents th... | 62598ee4090684286d592a05 |
class db(object): <NEW_LINE> <INDENT> engine = None <NEW_LINE> redis = None | lazy loading of db | 62598ee44428ac0f6e656b9e |
class StorageClientGeneral(object): <NEW_LINE> <INDENT> def __init__(self, client): <NEW_LINE> <INDENT> self._client = client <NEW_LINE> <DEDENT> @inlineCallbacks <NEW_LINE> def get_version(self): <NEW_LINE> <INDENT> url = self._client.relative_url("/v1/version") <NEW_LINE> response = yield self._client.request("GET", ... | High-level HTTP APIs that aren't immutable- or mutable-specific. | 62598ee4460517430c430ad3 |
class ServiceUnavailable(HTTPException): <NEW_LINE> <INDENT> code = 503 <NEW_LINE> description = ( 'The server is temporarily unable to service your request due to ' 'maintenance downtime or capacity problems. Please try again ' 'later.' ) | *503* `Service Unavailable`
Status code you should return if a service is temporarily unavailable. | 62598ee466656f66f7d58a2c |
class CQCXtraHeader(Header): <NEW_LINE> <INDENT> PACKAGING_FORMAT = "!HHLLHBB" <NEW_LINE> HDR_LENGTH = struct.calcsize(PACKAGING_FORMAT) <NEW_LINE> def __init__(self, headerBytes=None): <NEW_LINE> <INDENT> warnings.warn("Xtra Header is deprecated, it is split into different headers", DeprecationWarning) <NEW_LINE> supe... | Optional addtional cmd header information. Only relevant for certain commands. | 62598ee4cc0a2c111447964e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.