code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class ContactTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.mailinglist_1 = MailingList.objects.create(name='Test MailingList') <NEW_LINE> self.mailinglist_2 = MailingList.objects.create(name='Test MailingList 2') <NEW_LINE> <DEDENT> def test_unique(self): <NEW_LINE> <INDENT> contact ...
Tests for the Contact model
62598fbb236d856c2adc9516
class TestBaseModel(TestCase): <NEW_LINE> <INDENT> def test_createModel(self): <NEW_LINE> <INDENT> my_model = BaseModel() <NEW_LINE> <DEDENT> def test_BaseModelAssignment(self): <NEW_LINE> <INDENT> my_model = BaseModel() <NEW_LINE> my_model.aString = "a string" <NEW_LINE> my_model.aNumber = 98 <NEW_LINE> <DEDENT> def t...
Testing base model
62598fbbaad79263cf42e981
class getitem: <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self.c = Collection() <NEW_LINE> <DEDENT> def finds_own_tasks_by_name(self): <NEW_LINE> <INDENT> self.c.add_task(_mytask, "foo") <NEW_LINE> assert self.c["foo"] == _mytask <NEW_LINE> <DEDENT> def finds_subcollection_tasks_by_dotted_name(self): <NEW...
__getitem__
62598fbbcc40096d6161a2af
class TestTrialBalance(a_t_f_c.AbstractTestForeignCurrency): <NEW_LINE> <INDENT> def _getReportModel(self): <NEW_LINE> <INDENT> return self.env['report_trial_balance'] <NEW_LINE> <DEDENT> def _getQwebReportName(self): <NEW_LINE> <INDENT> return 'account_financial_report.report_trial_balance_qweb' <NEW_LINE> <DEDENT> de...
Technical tests for Trial Balance Report.
62598fbb956e5f7376df5754
class Transformer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, hidden_size, nlayers, ntokens, nhead=8, dropout=0.1, dropatt=0.1, relative_bias=True, pos_emb=False, pad=0): <NEW_LINE> <INDENT> super(Transformer, self).__init__() <NEW_LINE> self.drop = nn.Dropout(dropout) <NEW_LINE> self.emb = nn.Embedding(ntokens,...
Transformer model.
62598fbb2c8b7c6e89bd3972
class RegressionForestTest(SerializationTestMixin, unittest.TestCase): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> import forpy <NEW_LINE> self.FOREST_CLASS = forpy.RegressionForest <NEW_LINE> self.FPNAME_END = ".fpf" <NEW_LINE> super(RegressionForestTest, self).__init__(*args, **kwargs...
Test the Regression Forest serialization.
62598fbbad47b63b2c5a7a01
class RunCommandDocument(RunCommandDocumentBase): <NEW_LINE> <INDENT> _validation = { 'schema': {'required': True}, 'id': {'required': True}, 'os_type': {'required': True}, 'label': {'required': True}, 'description': {'required': True}, 'script': {'required': True}, } <NEW_LINE> _attribute_map = { 'schema': {'key': '$s...
Describes the properties of a Run Command. All required parameters must be populated in order to send to Azure. :ivar schema: Required. The VM run command schema. :vartype schema: str :ivar id: Required. The VM run command id. :vartype id: str :ivar os_type: Required. The Operating System type. Possible values includ...
62598fbb56b00c62f0fb2a68
class Int(CliType): <NEW_LINE> <INDENT> def get_help_str(self): <NEW_LINE> <INDENT> if self.help_str: <NEW_LINE> <INDENT> return super(Int, self).get_help_str() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'Enter a number' <NEW_LINE> <DEDENT> <DEDENT> def validate(self, value): <NEW_LINE> <INDENT> try: <NEW_LIN...
Int class is the class for any integer argument.
62598fbb97e22403b383b0b4
class ListZones(CLIRunnable): <NEW_LINE> <INDENT> action = 'list' <NEW_LINE> def execute(self, args): <NEW_LINE> <INDENT> if args['<zone>']: <NEW_LINE> <INDENT> return self.list_zone(args) <NEW_LINE> <DEDENT> return self.list_all_zones() <NEW_LINE> <DEDENT> def list_zone(self, args): <NEW_LINE> <INDENT> manager = DNSMa...
usage: sl dns list [<zone>] [options] List zones and optionally, records Filters: --data=DATA Record data, such as an IP address --record=HOST Host record, such as www --ttl=TTL TTL value in seconds, such as 86400 --type=TYPE Record type, such as A or CNAME
62598fbb4527f215b58ea081
class GetEditLockResponse: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swaggerTypes = { 'result': 'GetEditLockResult', 'status': 'str', 'error_message': 'str' } <NEW_LINE> self.result = None <NEW_LINE> self.status = None <NEW_LINE> self.error_message = None
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598fbb3317a56b869be625
class RandomRotate(object): <NEW_LINE> <INDENT> def __init__(self, degrees, axes=[0, 1, 2]): <NEW_LINE> <INDENT> if isinstance(degrees, numbers.Number): <NEW_LINE> <INDENT> degrees = (-abs(degrees), abs(degrees)) <NEW_LINE> <DEDENT> assert isinstance(degrees, (tuple, list)) and len(degrees) == 2 <NEW_LINE> self.degrees...
Rotates node positions around a specific axis by a randomly sampled factor within a given interval. Args: degrees (tuple or float): Rotation interval from which the rotation angle is sampled. If `degrees` is a number instead of a tuple, the interval is given by :math:`[-\mathrm{degrees}, \m...
62598fbbd7e4931a7ef3c241
class BUIClients: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.clientsobj = Clients <NEW_LINE> self.clients = self.clientsobj.get_clients() <NEW_LINE> <DEDENT> def translate_clients_stats(self): <NEW_LINE> <INDENT> clients_list_api = TranslateBurpuiAPI(clients=self.clients) <NEW_LINE> clients_report...
" Get data from burp ui clients
62598fbb4f6381625f199599
class Bewerking(Codelijst): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return f"Bewerking({self.id}, '{self.naam}', '{self.definitie}')"
An edit.
62598fbb4c3428357761a469
class MessagesMixin(object): <NEW_LINE> <INDENT> def _get_messages_from_response_cookies(self, response): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return messages.storage.cookie.CookieStorage(response)._decode(response.cookies['messages'].value) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> return None <...
Mixin for testing expected Django messages.
62598fbba05bb46b3848aa19
class DatabaseError(RedsError): <NEW_LINE> <INDENT> pass
Raised if there was an error regarding the access control database.
62598fbb5fcc89381b266223
class ADMMParameters: <NEW_LINE> <INDENT> def __init__( self, rho_initial: float = 10000, factor_c: float = 100000, beta: float = 1000, maxiter: int = 10, tol: float = 1.0e-4, max_time: float = np.inf, three_block: bool = True, vary_rho: int = UPDATE_RHO_BY_TEN_PERCENT, tau_incr: float = 2, tau_decr: float = 2, mu_res:...
Defines a set of parameters for ADMM optimizer.
62598fbb3539df3088ecc45a
class OperationFailed (Exception): <NEW_LINE> <INDENT> def __init__(self, op, message=None): <NEW_LINE> <INDENT> Exception.__init__(self, message) <NEW_LINE> self.op = op <NEW_LINE> self.clab_message = 'The requested operation failed: (%s) # DETAILS: %s'%(op, message) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <...
Exception indicating that the operation requested failed in its execution Encapsulates orm.api.ResponseStatusError and uses its message to provide information about the failure
62598fbb44b2445a339b6a4c
class Json: <NEW_LINE> <INDENT> def __init__(self, obj, encode=None): <NEW_LINE> <INDENT> self.obj = obj <NEW_LINE> self.encode = encode or jsonencode <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> obj = self.obj <NEW_LINE> if isinstance(obj, basestring): <NEW_LINE> <INDENT> return obj <NEW_LINE> <DEDENT> r...
Construct a wrapper for holding an object serializable to JSON.
62598fbb8a349b6b436863ea
class PortScannerAsync(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._process = None <NEW_LINE> self._nm = PortScanner() <NEW_LINE> return <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> if self._process is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self._process.is...
PortScannerAsync allows to use nmap from python asynchronously for each host scanned, callback is called with scan result for the host
62598fbb656771135c48981c
class PatternHostTaskWebSocket(BaseWebSocket): <NEW_LINE> <INDENT> def open(self, callback_timeout=500): <NEW_LINE> <INDENT> super().open(callback_timeout=callback_timeout) <NEW_LINE> self.limit = 10 <NEW_LINE> self.offset = 0 <NEW_LINE> self.pattern_task_status = [] <NEW_LINE> <DEDENT> def on_message(self, message): <...
request arguments: { "publish_pattern_host_id": 0 } response: { "code": 200, "msg": "", "res": { 'publish_task': [], 'publish_pattern_task': [] }, }
62598fbb7d847024c075c56a
class NodeSelector(_kuber_definitions.Definition): <NEW_LINE> <INDENT> def __init__( self, node_selector_terms: typing.List["NodeSelectorTerm"] = None, ): <NEW_LINE> <INDENT> super(NodeSelector, self).__init__(api_version="core/v1", kind="NodeSelector") <NEW_LINE> self._properties = { "nodeSelectorTerms": node_selector...
A node selector represents the union of the results of one or more label queries over a set of nodes; that is, it represents the OR of the selectors represented by the node selector terms.
62598fbb97e22403b383b0b5
class TestExternalPower(unittest.TestCase): <NEW_LINE> <INDENT> @patch('ups_lite.UPS.__init__', return_value=None) <NEW_LINE> @patch('RPi.GPIO.input', return_value=GPIO.HIGH) <NEW_LINE> def test_external_power_on(self, gpio_mock, ups_mock): <NEW_LINE> <INDENT> ups = ups_lite.UPS() <NEW_LINE> self.assertTrue(ups.externa...
Test cases for external_power.
62598fbcadb09d7d5dc0a72b
class PWMError(IOError): <NEW_LINE> <INDENT> pass
Base class for PWM errors.
62598fbc7d43ff24874274db
class InvalidInput(RuntimeError): <NEW_LINE> <INDENT> pass
Signify that the input to the API was invalid.
62598fbcaad79263cf42e983
class Triggers: <NEW_LINE> <INDENT> trigger_list = []
Playing an animation trigger causes the game engine play an animation of a particular type. The engine may pick one of a number of actual animations to play based on Cozmo's mood or emotion, or with random weighting. Thus playing the same trigger twice may not result in the exact same underlying animation playing twi...
62598fbcd268445f26639c5b
class Operation(object): <NEW_LINE> <INDENT> def __init__(self, message=None, op_dict=None): <NEW_LINE> <INDENT> self.type = None <NEW_LINE> self.id = None <NEW_LINE> self.plugin = None <NEW_LINE> self.data = None <NEW_LINE> self.result = None <NEW_LINE> if message: <NEW_LINE> <INDENT> self._load_message(message) <NEW_...
Represents an operation to be run by the agent.
62598fbc23849d37ff851262
class MediaDefiningClass(type): <NEW_LINE> <INDENT> def __new__(mcs, name, bases, attrs): <NEW_LINE> <INDENT> new_class = super(MediaDefiningClass, mcs).__new__(mcs, name, bases, attrs) <NEW_LINE> if 'media' not in attrs: <NEW_LINE> <INDENT> new_class.media = media_property(new_class) <NEW_LINE> <DEDENT> return new_cla...
元类:媒体定义。
62598fbcbe7bc26dc9251f33
class Walker(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.visitors = list() <NEW_LINE> <DEDENT> def accept(self, node, **kwargs): <NEW_LINE> <INDENT> if node is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for v in self.visitors: v.enter(node) <NEW_LINE> name = 'accept_' + node.__cl...
A walker may be used to walk a tree.
62598fbc377c676e912f6e48
class Help(click.Command): <NEW_LINE> <INDENT> def parse_args(self, ctx, args): <NEW_LINE> <INDENT> return []
Do not parse any arguments, allow any args past the `help` command, always return the help output
62598fbc97e22403b383b0b6
class TradeOrderBookQueueHandler(QueueHandler): <NEW_LINE> <INDENT> def __init__(self, queue): <NEW_LINE> <INDENT> QueueHandler.__init__(self,queue) <NEW_LINE> <DEDENT> def prepare(self, record): <NEW_LINE> <INDENT> record.args = None <NEW_LINE> record.exc_info = None <NEW_LINE> return record
We ant to avoid doing any text transform of the record object we with format in the other thread as above in prepare This is operating in the main thread
62598fbc5166f23b2e24358d
class Extension(extensions.Extension): <NEW_LINE> <INDENT> _action_collection_class = actions.Actions <NEW_LINE> _panel_widget_class = widget.Widget <NEW_LINE> _panel_dock_area = Qt.LeftDockWidgetArea <NEW_LINE> _config_widget_class = config.Config <NEW_LINE> _settings_config = { 'show': True, 'message': _("Initial ext...
Boilerplate extension "My Extension". This is a minimal, working Frescobaldi extension providing stubs for all relevant functions.
62598fbc1f5feb6acb162dcf
class XAccelRedirectResponse(HttpResponse): <NEW_LINE> <INDENT> def __init__(self, redirect_url, content_type, basename=None, expires=None, with_buffering=None, limit_rate=None, attachment=True): <NEW_LINE> <INDENT> super(XAccelRedirectResponse, self).__init__(content_type=content_type) <NEW_LINE> if attachment: <NEW_L...
Http response that delegates serving file to Nginx.
62598fbc67a9b606de54617c
class LoudDict(dict): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> dict.__init__(self, *args, **kwargs) <NEW_LINE> self.callback = lambda x: None <NEW_LINE> <DEDENT> def __setitem__(self, key, value): <NEW_LINE> <INDENT> if key in self and self.__getitem__(key) == value: <NEW_LINE> <INDE...
A Dictionary with a callback for item changes.
62598fbc796e427e5384e945
class Ice(Data): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Ice, self).__init__() <NEW_LINE> <DEDENT> def load(self, filename, build_hkl=True, load_instrument=False): <NEW_LINE> <INDENT> with open(filename) as f: <NEW_LINE> <INDENT> file_header = [] <NEW_LINE> for line in f: <NEW_LINE> <INDENT> i...
Loads ICE (NCNR) format ascii data file.
62598fbc498bea3a75a57cd4
class Rectangle: <NEW_LINE> <INDENT> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> self.__width = width <NEW_LINE> self.__height = height <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> string = "" <NEW_LINE> if self.width == 0 or self.height == 0: <NEW_LINE> <INDENT> return string <NEW_LINE> <D...
create a rectangle class
62598fbc5fdd1c0f98e5e141
class TestUrlSsrfResponseBatch(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 testUrlSsrfResponseBatch(self): <NEW_LINE> <INDENT> pass
UrlSsrfResponseBatch unit test stubs
62598fbca8370b77170f058f
class Solution(object): <NEW_LINE> <INDENT> def nthUglyNumber(self, n): <NEW_LINE> <INDENT> heap = [1] <NEW_LINE> visited = {1: True} <NEW_LINE> while 1: <NEW_LINE> <INDENT> min_num = heappop(heap) <NEW_LINE> n -= 1 <NEW_LINE> if n == 0: <NEW_LINE> <INDENT> return min_num <NEW_LINE> <DEDENT> for num in [min_num*2, min_...
Heap. TODO: DP.
62598fbcaad79263cf42e984
class ValidationWarning(object): <NEW_LINE> <INDENT> def __init__(self, key, details): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> self.details = details
Tracks job data configuration warnings during validation that may not prevent the job from working.
62598fbc851cf427c66b8466
class PolynomialBase(ParametricModel): <NEW_LINE> <INDENT> _param_names = [] <NEW_LINE> linear = True <NEW_LINE> col_fit_deriv = False <NEW_LINE> @lazyproperty <NEW_LINE> def param_names(self): <NEW_LINE> <INDENT> return self._param_names <NEW_LINE> <DEDENT> def __getattr__(self, attr): <NEW_LINE> <INDENT> if self._par...
Base class for all polynomial-like models with an arbitrary number of parameters in the form of coeffecients. In this case Parameter instances are returned through the class's ``__getattr__`` rather than through class descriptors.
62598fbc7d43ff24874274dc
class EnumSpace(Generic[T], GymSpace[T], EnumerableSpace[T]): <NEW_LINE> <INDENT> def __init__(self, enum_class: EnumMeta) -> None: <NEW_LINE> <INDENT> self._enum_class = enum_class <NEW_LINE> self._list_enum = list(enum_class) <NEW_LINE> gym_space = gym_spaces.Discrete(len(enum_class)) <NEW_LINE> super().__init__(gym_...
This class creates an OpenAI Gym Discrete space (gym.spaces.Discrete) from an enumeration and wraps it as a scikit-decide enumerable space. !!! warning Using this class requires OpenAI Gym to be installed.
62598fbcaad79263cf42e985
class NegateOperator(Node): <NEW_LINE> <INDENT> def __init__(self, expr): <NEW_LINE> <INDENT> self.left = expr <NEW_LINE> <DEDENT> def name(self): <NEW_LINE> <INDENT> return "not operator at %s" % (self.position) <NEW_LINE> <DEDENT> @failure_info <NEW_LINE> def eval(self, ctx): <NEW_LINE> <INDENT> return not self.left....
Used to negate a result
62598fbc9f28863672818953
class W16(VOSIWarning, XMLWarning): <NEW_LINE> <INDENT> message_template = ( "The element table is not a valid root element in VOSI below v1.1")
The table element is not a valid root element in VOSI before version 1.1
62598fbc2c8b7c6e89bd3976
class InvalidObjectId(BadRequest): <NEW_LINE> <INDENT> def __init__(self, description=None, response=None): <NEW_LINE> <INDENT> desc = {'description': 'Resource ID is not a valid monogdb ObjectId'} <NEW_LINE> if description is not None: <NEW_LINE> <INDENT> desc.update(description) <NEW_LINE> <DEDENT> super().__init__(d...
*400* `Bad Request` Raise if the browser sends something to the application the application or server cannot handle.
62598fbc56ac1b37e630239e
class InstructHelper(object): <NEW_LINE> <INDENT> proxy_process = 'iproxy' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.subprocessHandle = [] <NEW_LINE> reg_cleanup(self.teardown) <NEW_LINE> <DEDENT> @on_method_ready('start') <NEW_LINE> def get_ready(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def te...
ForwardHelper class or help run other Instruction
62598fbc55399d3f056266c5
class HttpInvalidRequestLine(_BaseTest): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(self.__class__, self).__init__(b"http_invalid_request_line")
OONI's http-invalid-request-line test
62598fbc5166f23b2e24358f
class IndicatorTypeListAPIView(ListAPIView): <NEW_LINE> <INDENT> queryset = IndicatorType.objects.all() <NEW_LINE> serializer_class = indicator_type_serializer['IndicatorTypeListSerializer'] <NEW_LINE> filter_backends = (DjangoFilterBackend,) <NEW_LINE> filter_class = IndicatorTypeListFilter <NEW_LINE> pagination_class...
API list view. Gets all records API.
62598fbcdc8b845886d5376a
class log_save(object): <NEW_LINE> <INDENT> def __enter__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __exit__(self, type, value, traceback): <NEW_LINE> <INDENT> if value is not None and isinstance(value, LoggedException): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> value.save() <NEW_LINE> <DEDENT> except:...
with-statement addition that makes sure that if the exception seen is of type 'LoggedException' it will be saved. This *will* propagate the exception upwards and not stop it.
62598fbc7047854f4633f586
class ItemUsefulnessSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> item = AsymetricRelatedField.from_serializer( ItemSerializer, kwargs={'required': True}) <NEW_LINE> usefulness = AsymetricRelatedField.from_serializer( UsefulnessSerializer, kwargs={'required': True}) <NEW_LINE> class Meta: <NEW_LINE> <IND...
Common serializer for all ItemUsefulness actions
62598fbc4f6381625f19959b
class VersionException(ApiException): <NEW_LINE> <INDENT> def __init__(self, expected_version, received_version): <NEW_LINE> <INDENT> ApiException.__init__(self) <NEW_LINE> self.expected_version = expected_version <NEW_LINE> self.received_version = received_version <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <IND...
Exception used to indicate that the client's requested api version is not supported.
62598fbc3d592f4c4edbb06f
class is_title(Predicate): <NEW_LINE> <INDENT> def __call__(self, token): <NEW_LINE> <INDENT> return token.value.istitle()
str.istitle >>> predicate = is_title() >>> a, b = tokenize('XXX Xxx') >>> predicate(a) False >>> predicate(b) True
62598fbc0fa83653e46f5095
class DescribeTagRetentionExecutionTaskResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.RetentionTaskList = None <NEW_LINE> self.TotalCount = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("RetentionTas...
DescribeTagRetentionExecutionTask返回参数结构体
62598fbc7c178a314d78d651
class PollEvents(threading.Thread): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(PollEvents, self).__init__() <NEW_LINE> self.alive = True <NEW_LINE> self._callback = {} <NEW_LINE> <DEDENT> def __del__(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.alive = False <NEW_LINE> <DEDENT> except...
Class to poll callback events, NOTE: *NOT* for external use
62598fbc656771135c489820
class _PlecostBase(object, metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self, ver1, ver2): <NEW_LINE> <INDENT> if ver1 is None or ver1 is None: <NEW_LINE> <INDENT> self._outdated = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if not isinstance(ver1, str): <NEW_LINE> <INDENT> raise TypeError("Expected bas...
Abstract class for all Plecost types
62598fbca8370b77170f0591
class Genre(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=100) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return unicode(self.name) <NEW_LINE> <DEDENT> def from_dict(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.save()
Жанр фильмов
62598fbc97e22403b383b0b9
class GeneratorConditionNumberTask(EvalTask): <NEW_LINE> <INDENT> _CONDITION_NUMBER_COUNT = "log_condition_number_count" <NEW_LINE> _CONDITION_NUMBER_MEAN = "log_condition_number_mean" <NEW_LINE> _CONDITION_NUMBER_STD = "log_condition_number_std" <NEW_LINE> def MetricsList(self): <NEW_LINE> <INDENT> return frozenset([ ...
Computes the generator condition number. Computes the condition number for metric Tensor of the generator Jacobian. This condition number is computed locally for each z sample in a minibatch. Returns the mean log condition number and standard deviation across the minibatch. Follows the methods in https://arxiv.org/ab...
62598fbc091ae35668704dd5
class Order_Truck(Order): <NEW_LINE> <INDENT> def __init__(self,count_car,speed=80,distance_max=400,weight_min=1000,weight_max=9000,size_min=60,size_max=180, cost=4000,price=7 ,profit=9): <NEW_LINE> <INDENT> super().__init__(count_car,speed,distance_max,weight_min,weight_max,size_min,size_max, cost,price)
грузові автомобілі
62598fbcaad79263cf42e986
class PyCRYPTHASH(object): <NEW_LINE> <INDENT> def __new__(cls): <NEW_LINE> <INDENT> raise Exception('This class just for typing, can not be instanced!') <NEW_LINE> <DEDENT> def CryptDestroyHash(self,) -> 'None': <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def CryptDuplicateHash(self,Flags:'Any'=0) -> 'PyCRYPTHASH': <...
Handle to a cryptographic hash
62598fbcaad79263cf42e987
class StringMultichoice(Choice): <NEW_LINE> <INDENT> paramType = 'string-enumeration-multiple' <NEW_LINE> multiple = True
Define a multichose string parameter type. Values of this type are iterable sequences of strings all of which must be an element of a predefined set. >>> @argument('people', types.StringMultichoice, choices=('alice', 'bob', 'charlie')) ... def func(people=('alice', 'bob')): ... pass
62598fbc71ff763f4b5e792c
class GetTransactionStatusInputSet(InputSet): <NEW_LINE> <INDENT> def set_AWSAccessKeyId(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'AWSAccessKeyId', value) <NEW_LINE> <DEDENT> def set_AWSSecretKeyId(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'AWSSecretKeyId', value) <NEW_LINE> <DEDENT...
An InputSet with methods appropriate for specifying the inputs to the GetTransactionStatus Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
62598fbcbe7bc26dc9251f35
class Stack(): <NEW_LINE> <INDENT> def __init__(self, d=None): <NEW_LINE> <INDENT> if d is None: <NEW_LINE> <INDENT> d = [] <NEW_LINE> <DEDENT> self.d = d <NEW_LINE> <DEDENT> def dump(self): <NEW_LINE> <INDENT> return self.d <NEW_LINE> <DEDENT> def peek(self): <NEW_LINE> <INDENT> return self.d[-1] if len(self) != 0 els...
Stack implementation wrapping Python Lists
62598fbc2c8b7c6e89bd3978
class TD_IPSO_3302_04(CoAPTestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> @typecheck <NEW_LINE> def get_stimulis(cls) -> list_of(Value): <NEW_LINE> <INDENT> return [CoAP(type='con', code='put')] <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> self.match('server', CoAP(type='con', code='put', opt=self.uri(...
testcase_id: TD_IPSO_3302_04 uri: http://openmobilealliance.org/iot/lightweight-m2m-lwm2m configuration: LWM2M_CFG_01 objective: - Setting the writable resources of object 3302 (Presence) Instance 0 using JSON data format (11543) - This test has to be run for the following resources - - Busy to Clear delay - -...
62598fbc56b00c62f0fb2a6e
class LogisticRegression(object): <NEW_LINE> <INDENT> def __init__(self, rng, input, n_in, n_out): <NEW_LINE> <INDENT> W_values = numpy.asarray( rng.uniform( low=-numpy.sqrt(6. / (n_in + n_out)), high=numpy.sqrt(6. / (n_in + n_out)), size=(n_in, n_out) ), dtype=theano.config.floatX ) <NEW_LINE> self.W = theano.shared( ...
Multi-class Logistic Regression Class The logistic regression is fully described by a weight matrix :math:`W` and bias vector :math:`b`. Classification is done by projecting data points onto a set of hyperplanes, the distance to which is used to determine a class membership probability.
62598fbc56ac1b37e63023a0
class ErrorNonDict(Exception): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return u'Аргумент функции должен быть словарём.'
Исключение - аргумент функции не словарь
62598fbc5166f23b2e243591
class hybrid_ann_consistency_diagnoser(a_star_frame): <NEW_LINE> <INDENT> def __init__(self, alpha=0.95): <NEW_LINE> <INDENT> super(hybrid_ann_consistency_diagnoser, self).__init__() <NEW_LINE> self.res_set = [] <NEW_LINE> self.res_values = [] <NEW_LINE> self.alpha = alpha <NEW_LINE> <DEDENT> def...
the hybrid diagnoser just based on hybrid ann diagnoser
62598fbc3539df3088ecc460
class ForbiddenTest(RuleTest): <NEW_LINE> <INDENT> def _do_test(self): <NEW_LINE> <INDENT> self.assertTrue(len(self.rv) != 0, "Rule '%s' failed. Example '%s' should fail, but passed" % (self.c.name, self.tv))
Tests forbidden constructs. The rule checker should find errors in the example code.
62598fbc796e427e5384e949
class _EagerContext(threading.local): <NEW_LINE> <INDENT> def __init__(self, config=None): <NEW_LINE> <INDENT> super(_EagerContext, self).__init__() <NEW_LINE> self.device_spec = _starting_device_spec <NEW_LINE> self.device_name = "" <NEW_LINE> self.mode = default_execution_mode <NEW_LINE> self.is_eager = default_execu...
Thread local eager context.
62598fbc26068e7796d4cb0e
class Teams(View): <NEW_LINE> <INDENT> @method_decorator(require_login) <NEW_LINE> def dispatch(self, *args, **kwargs): <NEW_LINE> <INDENT> return super(Teams, self).dispatch(*args, **kwargs) <NEW_LINE> <DEDENT> def get(self, request): <NEW_LINE> <INDENT> users = User.objects.all() <NEW_LINE> teams = [] <NEW_LINE> for ...
Gets a list of all teams.
62598fbc44b2445a339b6a4f
@attr.s <NEW_LINE> class MutationAcquisition(AcquisitionStrategy): <NEW_LINE> <INDENT> breadth: int = attr.ib() <NEW_LINE> breadth.validator(Validator.is_posint) <NEW_LINE> @staticmethod <NEW_LINE> @yaml_constructor('!MutationAcquisition', safe=True) <NEW_LINE> def from_yaml(loader, node) -> 'MutationAcquisition': <NEW...
Randomly mutate each parent to create new samples in their neighborhood.
62598fbca8370b77170f0593
class FirstReducer(Reducer): <NEW_LINE> <INDENT> def __call__(self, group_key: tp.Tuple[str, ...], rows: TRowsIterable) -> TRowsGenerator: <NEW_LINE> <INDENT> for row in rows: <NEW_LINE> <INDENT> yield row <NEW_LINE> break
Yield only first row from passed ones
62598fbcfff4ab517ebcd998
class BoxTagTests(TagTest): <NEW_LINE> <INDENT> def test_plain(self): <NEW_LINE> <INDENT> t = Template('{% load djblets_deco %}' '{% box %}content{% endbox %}') <NEW_LINE> self.assertHTMLEqual( t.render(Context({})), '<div class="box-container"><div class="box">' '<div class="box-inner">\ncontent\n ' '</div></div></di...
Unit tests for the {% box %} template tag.
62598fbc442bda511e95c610
class TestIpamsvcCreateServerResponse(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 testIpamsvcCreateServerResponse(self): <NEW_LINE> <INDENT> pass
IpamsvcCreateServerResponse unit test stubs
62598fbc099cdd3c636754bc
class Controller(object): <NEW_LINE> <INDENT> klass = None <NEW_LINE> @classmethod <NEW_LINE> def get(cls, id): <NEW_LINE> <INDENT> return DB.get(cls.klass).get(id)
Main controller object to subclass other controllers from. Contains some common logic. TODO: De-dupe the create methods - requires a factory of sorts to create the model objects
62598fbcec188e330fdf8a46
class SQLGraph_Test(Mapping_Test): <NEW_LINE> <INDENT> dbname = 'test.dumbo_foo_test' <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> if not testutil.mysql_enabled(): <NEW_LINE> <INDENT> raise SkipTest("no MySQL") <NEW_LINE> <DEDENT> createOpts = dict(source_id='int', target_id='int', edge_id='int') <NEW_LINE> self.dat...
Runs the same tests on mapping.SQLGraph class
62598fbcd486a94d0ba2c183
class Filesystem(ICanonicalSource): <NEW_LINE> <INDENT> def __init__(self, base_path: str) -> None: <NEW_LINE> <INDENT> self._base_path = base_path <NEW_LINE> <DEDENT> def _make_path(self, uri: D.URI) -> str: <NEW_LINE> <INDENT> return os.path.abspath(uri.path) <NEW_LINE> <DEDENT> def can_resolve(self, uri: D.URI) -> b...
Retrieves content from a filesystem (outside the canonical record).
62598fbc3617ad0b5ee062fb
class AddReplicationInstanceResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TaskId = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TaskId = params.get("TaskId") <NEW_LINE> self.RequestId = params.get("RequestI...
AddReplicationInstance返回参数结构体
62598fbc4527f215b58ea089
class VideoFileInvalid(BadRequest): <NEW_LINE> <INDENT> ID = "VIDEO_FILE_INVALID" <NEW_LINE> MESSAGE = __doc__
The video file is invalid
62598fbc3317a56b869be629
class ApplicationSecurityGroupListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'next_link': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'value': {'key': 'value', 'type': '[ApplicationSecurityGroup]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__( self, *,...
A list of application security groups. Variables are only populated by the server, and will be ignored when sending a request. :param value: A list of application security groups. :type value: list[~azure.mgmt.network.v2018_07_01.models.ApplicationSecurityGroup] :ivar next_link: The URL to get the next set of results...
62598fbc5fcc89381b266227
class UpdateQuery(_BaseSQLQuery): <NEW_LINE> <INDENT> def __init__(self, model, query=None, query_kwargs=None, raw_values=None, values=None, where_str=None): <NEW_LINE> <INDENT> if query is None: <NEW_LINE> <INDENT> query = 'UPDATE %s' % model.__table__ <NEW_LINE> <DEDENT> super(UpdateQuery, self).__init__(model, query...
UPDATE query. Be care with raw_values. See each method doc string below.
62598fbce5267d203ee6bab5
class PreCompFirstOrder(Base, SparseRWGraph): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> Base.__init__(self, *args, **kwargs) <NEW_LINE> self.alias_j = self.alias_q = None <NEW_LINE> <DEDENT> def get_move_forward(self): <NEW_LINE> <INDENT> indices = self.indices <NEW_LINE> indptr = sel...
Precompute transition probabilities for first order random walks.
62598fbc9c8ee8231304024f
class MachineSpiNNakerLinkVertex(MachineVertex, AbstractSpiNNakerLinkVertex): <NEW_LINE> <INDENT> __slots__ = ( "_spinnaker_link_id", "_board_address", "_virtual_chip_x", "_virtual_chip_y" ) <NEW_LINE> def __init__( self, spinnaker_link_id, board_address=None, label=None, constraints=None): <NEW_LINE> <INDENT> MachineV...
A virtual vertex on a SpiNNaker Link
62598fbc8a349b6b436863f2
class Launcher(DesktopEntry): <NEW_LINE> <INDENT> defaultGroup = 'GinfoTweaks Entry' <NEW_LINE> def parse(self, file): <NEW_LINE> <INDENT> IniFile.parse(self, file, allowedGroups) <NEW_LINE> <DEDENT> def launch(self): <NEW_LINE> <INDENT> exe = self.getExec() <NEW_LINE> command = [x for x in exe.split() if not '%' in x]...
Launcher class
62598fbc7b180e01f3e4912a
class Port(PortMixin,db.Model): <NEW_LINE> <INDENT> __tablename__ = 'ports' <NEW_LINE> __table_args__ = {'implicit_returning':False} <NEW_LINE> node_id = db.Column(db.Integer, db.ForeignKey('nodes.id'))
Port
62598fbcaad79263cf42e98a
class Mcp3002(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.device_no = 0 <NEW_LINE> self.speed = 1200000 <NEW_LINE> self.Vdd = 3.3 <NEW_LINE> self.step = 1023 <NEW_LINE> self.mode = 1 <NEW_LINE> self.msbf = 1 <NEW_LINE> self.extbus = Spi(spi_ch=0,mode=self.mode,speed=self.speed,bits_word=8) <NEW_...
mode :0 CPOL:0 CPHA:0 mode :1 CPOL:0 CPHA:1 mode :2 CPOL:1 CPHA:0 mode :3 CPOL:1 CPHA:1
62598fbcff9c53063f51a804
class TrelloActionData(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> <DEDENT> @property <NEW_LINE> def board_name(self): <NEW_LINE> <INDENT> return self.data['board']['name'] <NEW_LINE> <DEDENT> @property <NEW_LINE> def card_name(self): <NEW_LINE> <INDENT> return...
Provide simple attribute access to action data.
62598fbc7d43ff24874274df
class _AxisMasking: <NEW_LINE> <INDENT> def __init__( self, max_len: int, min_num: int = 0, max_num: int = 1, mask_value: float = 0, deterministic: bool = False, start_index: int = 0): <NEW_LINE> <INDENT> self.max_len = max_len <NEW_LINE> self.min_num = min_num <NEW_LINE> self.max_num = max_num <NEW_LINE> self.mask_val...
Applies masking along a given axis with option for overlapping masks :param max_len: maximum length for a single mask; mask length would be sampled from [0, max_len] :type max_len: int :param min_num: minimum number of masks to apply; defaults to 0 :type min_num: int :param max_num: maximum number of masks to appl...
62598fbccc40096d6161a2b4
class TimingDiagram: <NEW_LINE> <INDENT> def __init__(self, width = 800, height = 600, margin = 20, font_size = 12, font_family = 'Times New Roman', background = 0xffffff, foreground = 0x000000, start = 0, end = 100, step = None, delay = 10, signals = None): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height...
The main timing diagram struct. Holds global style and timing information, as well as a list of signals (each a Clock, Bus or Line). Style properties are self-explantory, while the timing properties are as follows: start: The minimum time value displayed in the chart. For example, if start is set to 20, and a s...
62598fbc63b5f9789fe85326
class HelloSerializer(serializers.Serializer): <NEW_LINE> <INDENT> name = serializers.CharField(max_length=10)
serializes a name field for testing our APIView
62598fbc23849d37ff85126a
class DragAndDropTests(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> Timings.defaults() <NEW_LINE> self.app = Application() <NEW_LINE> self.app.start(os.path.join(mfc_samples_folder, u"CmnCtrl1.exe")) <NEW_LINE> self.dlg = self.app.Common_Controls_Sample <NEW_LINE> self.ctrl = self.dlg.Tr...
Unit tests for mouse actions like drag-n-drop
62598fbc4c3428357761a473
class ParameterOptions: <NEW_LINE> <INDENT> def __init__(self): pass
Empty class to assemble related settings
62598fbc4f6381625f19959e
class PrivateKeyJwt(ClientSecretJwt): <NEW_LINE> <INDENT> def verify_assertion(self, param): <NEW_LINE> <INDENT> return False
Clients that have registered a public key sign a JWT using that key. The Client authenticates in accordance with JSON Web Token (JWT) Profile for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.JWT] and Assertion Framework for OAuth 2.0 Client Authentication and Authorization Grants [OAuth.Assert...
62598fbc796e427e5384e94d
class FUNCtion(SCPINode, SCPIQuery, SCPISet): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "FUNCtion" <NEW_LINE> args = ["GAUSsian", "NOISe", "RAMP", "SINusoid", "SQUare", "TRIangle", "UNIForm"] <NEW_LINE> class NOISe(SCPINode, SCPIQuery, SCPISet): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "NOISe" <N...
SOURce:PM:INTernal:FUNCtion Arguments: GAUSsian, NOISe, RAMP, SINusoid, SQUare, TRIangle, UNIForm
62598fbce5267d203ee6bab7
class CleanUpFile(object): <NEW_LINE> <INDENT> def __init__(self, fpath): <NEW_LINE> <INDENT> self._fpath = fpath <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __exit__(self, *args): <NEW_LINE> <INDENT> if os.path.exists(self._fpath): <NEW_LINE> <INDENT> os.remove(self._fpath...
Context utility for ensuring that a given file is always removed after a test is run
62598fbc8a349b6b436863f4
class Token: <NEW_LINE> <INDENT> def __init__(self, type, val): <NEW_LINE> <INDENT> self.type = type; <NEW_LINE> self.val = val; <NEW_LINE> <DEDENT> def un_op(self): <NEW_LINE> <INDENT> return calcapi.uop_bind[self.val] <NEW_LINE> <DEDENT> def bin_op(self): <NEW_LINE> <INDENT> return calcapi.bop_bind[self.val]
Represents a token placed in the expression Tokens represent separated entities in a mathematical expression which include operators and numbers.
62598fbc7d847024c075c574
class CommentView(LoginRequiredMixin, View): <NEW_LINE> <INDENT> def get(self, request, order_id): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if not order_id: <NEW_LINE> <INDENT> return redirect(reverse('user:userorder')) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> order = OrderInfo.objects.get(order_id=order_...
订单评论
62598fbc099cdd3c636754be
@unittest.skip("The tests fail because the status of a MockPayment is NULL when saving, triggering an integrity error") <NEW_LINE> class PaymentMockTests(BluebottleTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(PaymentMockTests, self).setUp() <NEW_LINE> self.order_payment = OrderPaymentFactor...
Tests for updating and order payment via mock PSP listener. The listener calls the service to fetch the appropriate adapter and update the OrderPayment status. It sets the status of the order payment to
62598fbcaad79263cf42e98c
class UnbindDevicesRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.GatewayProductId = None <NEW_LINE> self.GatewayDeviceName = None <NEW_LINE> self.ProductId = None <NEW_LINE> self.DeviceNames = None <NEW_LINE> self.Skey = None <NEW_LINE> <DEDENT> def _deserialize(self, params):...
UnbindDevices请求参数结构体
62598fbc7d43ff24874274e0
class BooleanField(BaseField): <NEW_LINE> <INDENT> def process(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.value = bool(value) <NEW_LINE> <DEDENT> except Exception: <NEW_LINE> <INDENT> self.error = "Not a valid bool value" <NEW_LINE> return False <NEW_LINE> <DEDENT> return True
You should process and validate bool value with this field.
62598fbc956e5f7376df575a
class InExpression(FieldExpression): <NEW_LINE> <INDENT> def __init__(self, field: Field, right: Iterable): <NEW_LINE> <INDENT> super().__init__(field) <NEW_LINE> self.right = right <NEW_LINE> <DEDENT> def get_operator_expression(self): <NEW_LINE> <INDENT> return {'$in': list(self.right)}
Matches any of values specified in an array
62598fbc4f6381625f19959f
class FileType(object): <NEW_LINE> <INDENT> def __init__(self, extension, change_name, force_thumb, thumbnail): <NEW_LINE> <INDENT> self.extension = extension <NEW_LINE> self.change_name = change_name <NEW_LINE> self.force_thumb = force_thumb <NEW_LINE> self.thumbnail = thumbnail
File type information. This class is pretty mundane. 'thumbnail' here is used if force_thumb is enabled or if the image thumbnailer failed.
62598fbc0fa83653e46f509d
class LowLightEnhance(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Type = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Type = params.get("Type") <NEW_LINE> memeber_set = set(params.keys()) <NEW_LINE> for name, value in vars(self).items(): <NEW_LIN...
低光照增强参数
62598fbc4527f215b58ea08d