code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class DataExtractor2003(DataExtractor): <NEW_LINE> <INDENT> def _getSubjectPattern(self): <NEW_LINE> <INDENT> return "Betreff:(.*)Antragstellende Fraktion:" <NEW_LINE> <DEDENT> def _getPartyPattern(self): <NEW_LINE> <INDENT> return "Antragstellende Fraktion:(.*)Vertraulichkeit:" <NEW_LINE> <DEDENT> def _getStatementPattern(self): <NEW_LINE> <INDENT> return "Begr\xc3\xbcndung:</p>(.*)Antragstellende Fraktion:" <NEW_LINE> <DEDENT> def _getSubjectNoooooow(self, matchBetreff): <NEW_LINE> <INDENT> bet = self._quoteChange(matchBetreff.group(0)) <NEW_LINE> bet2 = re.sub("Betreff: </p>", "", bet) <NEW_LINE> returnSubject = re.sub("Begr\xc3\xbcndung:", "", bet2) <NEW_LINE> return returnSubject <NEW_LINE> <DEDENT> def _getTitleMatch(self, matchTitle): <NEW_LINE> <INDENT> return matchTitle.group(1) <NEW_LINE> <DEDENT> def _getAntragstellerPattern(self): <NEW_LINE> <INDENT> return "Antragstellende Fraktion:"
classdocs
62598fa7a8370b77170f02f4
class ModifySecretRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.EdgeUnitID = None <NEW_LINE> self.SecretName = None <NEW_LINE> self.Yaml = None <NEW_LINE> self.SecretNamespace = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.EdgeUnitID = params.get("EdgeUnitID") <NEW_LINE> self.SecretName = params.get("SecretName") <NEW_LINE> self.Yaml = params.get("Yaml") <NEW_LINE> self.SecretNamespace = params.get("SecretNamespace") <NEW_LINE> memeber_set = set(params.keys()) <NEW_LINE> for name, value in vars(self).items(): <NEW_LINE> <INDENT> if name in memeber_set: <NEW_LINE> <INDENT> memeber_set.remove(name) <NEW_LINE> <DEDENT> <DEDENT> if len(memeber_set) > 0: <NEW_LINE> <INDENT> warnings.warn("%s fileds are useless." % ",".join(memeber_set))
ModifySecret请求参数结构体
62598fa73539df3088ecc1ce
class setPrize_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRING, 'success', None, None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: <NEW_LINE> <INDENT> fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) <NEW_LINE> return <NEW_LINE> <DEDENT> iprot.readStructBegin() <NEW_LINE> while True: <NEW_LINE> <INDENT> (fname, ftype, fid) = iprot.readFieldBegin() <NEW_LINE> if ftype == TType.STOP: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> if fid == 0: <NEW_LINE> <INDENT> if ftype == TType.STRING: <NEW_LINE> <INDENT> self.success = iprot.readString(); <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> iprot.skip(ftype) <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> iprot.skip(ftype) <NEW_LINE> <DEDENT> iprot.readFieldEnd() <NEW_LINE> <DEDENT> iprot.readStructEnd() <NEW_LINE> <DEDENT> def write(self, oprot): <NEW_LINE> <INDENT> if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: <NEW_LINE> <INDENT> oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) <NEW_LINE> return <NEW_LINE> <DEDENT> oprot.writeStructBegin('setPrize_result') <NEW_LINE> if self.success is not None: <NEW_LINE> <INDENT> oprot.writeFieldBegin('success', TType.STRING, 0) <NEW_LINE> oprot.writeString(self.success) <NEW_LINE> oprot.writeFieldEnd() <NEW_LINE> <DEDENT> oprot.writeFieldStop() <NEW_LINE> oprot.writeStructEnd() <NEW_LINE> <DEDENT> def validate(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <INDENT> value = 17 <NEW_LINE> value = (value * 31) ^ hash(self.success) <NEW_LINE> return value <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> L = ['%s=%r' % (key, value) for key, value in self.__dict__.iteritems()] <NEW_LINE> return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return not (self == other)
Attributes: - success
62598fa7d58c6744b42dc262
class Student: <NEW_LINE> <INDENT> studentCount = 0 <NEW_LINE> def __init__(self, name, sex, age, number): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.sex = sex <NEW_LINE> self.age = age <NEW_LINE> self.number = number <NEW_LINE> Student.studentCount = Student.studentCount + 1 <NEW_LINE> <DEDENT> def printeeee(self): <NEW_LINE> <INDENT> print('--------------------------------------------------') <NEW_LINE> print('| student name: ', self.name) <NEW_LINE> print('| student number: ', self.number) <NEW_LINE> if (self.sex == 0): <NEW_LINE> <INDENT> print('| student sex: 男') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> print('| student sex: 女') <NEW_LINE> <DEDENT> print('| student age:', self.age) <NEW_LINE> print('--------------------------------------------------')
这是一个学生类
62598fa7009cb60464d01439
class IIndependenceOfIrrelevantAlternativesCriterion(ICriterion): <NEW_LINE> <INDENT> pass
In voting systems, independence of irrelevant alternatives is often interpreted as, if one candidate (X) wins the election, and a new alternative (Y) is added, only X or Y will win the election. Approval voting and range voting satisfy the independence of irrelevant alternatives criterion. Another cardinal system, cumulative voting, does not satisfy the criterion. An anecdote which illustrates a violation of this property has been attributed to Sidney Morgenbesser: After finishing dinner, Sidney Morgenbesser decides to order dessert. The waitress tells him he has two choices: apple pie and blueberry pie. Sidney orders the apple pie. After a few minutes the waitress returns and says that they also have cherry pie at which point Morgenbesser says "In that case I'll have the blueberry pie." All voting systems have some degree of inherent susceptibility to strategic nomination considerations. Some regard these considerations as less serious unless the voting system specifically fails the (easier to satisfy) independence of clones criterion.
62598fa77b25080760ed73c7
class InterruptException(Exception): <NEW_LINE> <INDENT> def __init__(self, msg=None): <NEW_LINE> <INDENT> msg=msg or "thread interrupt" <NEW_LINE> super().__init__(msg)
Generic interrupt exception (raised by some function to signal interrupts from other threads)
62598fa74f6381625f19944b
class MultinicPolicyTest(base.BasePolicyTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(MultinicPolicyTest, self).setUp() <NEW_LINE> self.controller = multinic.MultinicController() <NEW_LINE> self.req = fakes.HTTPRequest.blank('') <NEW_LINE> self.mock_get = self.useFixture( fixtures.MockPatch('nova.api.openstack.common.get_instance')).mock <NEW_LINE> uuid = uuids.fake_id <NEW_LINE> self.instance = fake_instance.fake_instance_obj( self.project_member_context, project_id=self.project_id, id=1, uuid=uuid, vm_state=vm_states.ACTIVE, task_state=None, launched_at=timeutils.utcnow()) <NEW_LINE> self.mock_get.return_value = self.instance <NEW_LINE> self.project_action_authorized_contexts = [ self.legacy_admin_context, self.system_admin_context, self.project_admin_context, self.project_member_context, self.project_reader_context, self.project_foo_context] <NEW_LINE> <DEDENT> @mock.patch('nova.compute.api.API.add_fixed_ip') <NEW_LINE> def test_add_fixed_ip_policy(self, mock_add): <NEW_LINE> <INDENT> rule_name = "os_compute_api:os-multinic:add" <NEW_LINE> body = dict(addFixedIp=dict(networkId='test_net')) <NEW_LINE> self.common_policy_auth(self.project_action_authorized_contexts, rule_name, self.controller._add_fixed_ip, self.req, self.instance.uuid, body=body) <NEW_LINE> <DEDENT> @mock.patch('nova.compute.api.API.remove_fixed_ip') <NEW_LINE> def test_remove_fixed_ip_policy(self, mock_remove): <NEW_LINE> <INDENT> rule_name = "os_compute_api:os-multinic:remove" <NEW_LINE> body = dict(removeFixedIp=dict(address='1.2.3.4')) <NEW_LINE> self.common_policy_auth(self.project_action_authorized_contexts, rule_name, self.controller._remove_fixed_ip, self.req, self.instance.uuid, body=body)
Test Multinic APIs policies with all possible context. This class defines the set of context with different roles which are allowed and not allowed to pass the policy checks. With those set of context, it will call the API operation and verify the expected behaviour.
62598fa74f88993c371f0497
class NotificationFailure(Exception): <NEW_LINE> <INDENT> pass
Custom exception for notification failures, inherits Exception.
62598fa7fff4ab517ebcd700
class EdiLocationDocument(models.AbstractModel): <NEW_LINE> <INDENT> _name = 'edi.location.document' <NEW_LINE> _inherit = 'edi.document.sync' <NEW_LINE> _description = "Stock Locations" <NEW_LINE> @api.model <NEW_LINE> def location_record_model(self, doc, supermodel='edi.location.record'): <NEW_LINE> <INDENT> return self.record_model(doc, supermodel=supermodel) <NEW_LINE> <DEDENT> @api.model <NEW_LINE> def location_record_values(self, _data): <NEW_LINE> <INDENT> return self.no_record_values() <NEW_LINE> <DEDENT> @api.model <NEW_LINE> def prepare(self, doc): <NEW_LINE> <INDENT> super().prepare(doc) <NEW_LINE> self.location_record_model(doc).prepare(doc, ( record_vals for _fname, data in doc.inputs() for record_vals in self.location_record_values(data) ))
EDI location document This is the base model for EDI location documents. Each row represents a collection of EDI location records that, in turn, represent a location that will be created or updated when the document is executed. All input attachments are parsed to generate a list of potential EDI location records, represented in the form of a values dictionary that could be used to create the EDI location record. Location definitions typically change infrequently. To minimise unnecessary duplication, any EDI location records that would not result in a new or modified ``location.location`` record will be automatically elided from the document. Derived models should implement either :meth:`~.prepare` or :meth:`~.location_record_values`.
62598fa7627d3e7fe0e06dc7
class Scroller(object): <NEW_LINE> <INDENT> def __init__(self, lines=[], space = " :: ", width=16, height=2): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height <NEW_LINE> self.space = space <NEW_LINE> self.setLines(lines) <NEW_LINE> <DEDENT> def setLines(self, lines): <NEW_LINE> <INDENT> if isinstance(lines, basestring): <NEW_LINE> <INDENT> lines = lines.split("\n") <NEW_LINE> <DEDENT> elif not isinstance(lines, list): <NEW_LINE> <INDENT> raise Exception("Argument passed to lines parameter must be list, instead got: %s"%type(lines)) <NEW_LINE> <DEDENT> if len(lines) > self.height: <NEW_LINE> <INDENT> raise Exception("Have more lines to display (%s) than you have lcd rows (%s)"%(len(lines), height)) <NEW_LINE> <DEDENT> self.lines = lines <NEW_LINE> for i,ln in enumerate(self.lines[:]): <NEW_LINE> <INDENT> if len(ln) > self.width: <NEW_LINE> <INDENT> self.lines[i] = "%s%s"%(ln,self.space) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def scroll(self): <NEW_LINE> <INDENT> for i,ln in enumerate(self.lines[:]): <NEW_LINE> <INDENT> if len(ln) > 16: <NEW_LINE> <INDENT> shift = "%s%s"%(ln[1:], ln[0]) <NEW_LINE> self.lines[i] = shift <NEW_LINE> <DEDENT> <DEDENT> truncated = [ln[:self.width] for ln in self.lines] <NEW_LINE> return "\n".join(truncated)
Object designed to auto-scroll text on a LCD screen. Every time the scroll() method is called to, it will scroll the text from right to left by one character on any line that is greater than the provided with. If the lines ever need to be reset \ updated, call to the setLines() method.
62598fa71b99ca400228f4bd
@six.python_2_unicode_compatible <NEW_LINE> class IPO(Node): <NEW_LINE> <INDENT> KNOWN_RELATIONSHIPS = [ 'funded_company', 'stock_exchange', 'images', 'videos', 'news', ] <NEW_LINE> KNOWN_PROPERTIES = [ "api_path", "web_path", "went_public_on", "went_public_on_trust_code", "stock_exchange_symbol", "stock_symbol", "shares_sold", "opening_share_price", "opening_share_price_currency_code", "opening_share_price_usd", "opening_valuation", "opening_valuation_currency_code", "opening_valuation_usd", "money_raised", "money_raised_currency_code", "money_raised_usd", "created_at", "updated_at", ] <NEW_LINE> def _coerce_values(self): <NEW_LINE> <INDENT> for attr in ['went_public_on']: <NEW_LINE> <INDENT> if getattr(self, attr, None): <NEW_LINE> <INDENT> setattr(self, attr, parse_date(getattr(self, attr))) <NEW_LINE> <DEDENT> <DEDENT> for attr in ['opening_share_price_usd', 'opening_share_price']: <NEW_LINE> <INDENT> if getattr(self, attr, None): <NEW_LINE> <INDENT> setattr(self, attr, float(getattr(self, attr))) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'IPO: %s' % self.stock_symbol <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.__str__()
Represents an IPO on CrunchBase
62598fa7498bea3a75a57a38
class Unsigned(tb.SQLType): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> @lru_cache <NEW_LINE> def __class_getitem__(cls, t): <NEW_LINE> <INDENT> if t == TinyInt: <NEW_LINE> <INDENT> return UnsignedTinyInt <NEW_LINE> <DEDENT> if t == SmallInt: <NEW_LINE> <INDENT> return UnsignedSmallInt <NEW_LINE> <DEDENT> if t == MediumInt: <NEW_LINE> <INDENT> return UnsignedMediumInt <NEW_LINE> <DEDENT> if t == Int: <NEW_LINE> <INDENT> return UnsignedInt <NEW_LINE> <DEDENT> if t == BigInt: <NEW_LINE> <INDENT> return UnsignedBigInt <NEW_LINE> <DEDENT> raise RuntimeError('Invalid type.') <NEW_LINE> <DEDENT> def __new__(cls, *_args, **_kwargs): <NEW_LINE> <INDENT> if not issubclass(cls, tb.Final): <NEW_LINE> <INDENT> raise RuntimeError('Type is not specified.') <NEW_LINE> <DEDENT> return super().__new__(cls)
Unsigned sql type
62598fa799fddb7c1ca62d76
class QLearningAgent(ReinforcementAgent): <NEW_LINE> <INDENT> def __init__(self, **args): <NEW_LINE> <INDENT> ReinforcementAgent.__init__(self, **args) <NEW_LINE> "*** YOUR CODE HERE ***" <NEW_LINE> self.Q = {} <NEW_LINE> <DEDENT> def getQValue(self, state, action): <NEW_LINE> <INDENT> if (state, action) not in self.Q: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self.Q[(state, action)] <NEW_LINE> <DEDENT> <DEDENT> def computeValueFromQValues(self, state): <NEW_LINE> <INDENT> qList = [self.getQValue(state, a) for a in self.getLegalActions(state)] <NEW_LINE> if len(qList) == 0: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return max(qList) <NEW_LINE> <DEDENT> <DEDENT> def computeActionFromQValues(self, state): <NEW_LINE> <INDENT> actions = self.getLegalActions(state) <NEW_LINE> bestAct = [a for a in actions if self.getQValue(state, a) == self.getValue(state)] <NEW_LINE> if len(bestAct) == 0: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return random.choice(bestAct) <NEW_LINE> <DEDENT> <DEDENT> def getAction(self, state): <NEW_LINE> <INDENT> legalActions = self.getLegalActions(state) <NEW_LINE> action = None <NEW_LINE> if util.flipCoin(self.epsilon): <NEW_LINE> <INDENT> action = random.choice(legalActions) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> action = self.getPolicy(state) <NEW_LINE> <DEDENT> return action <NEW_LINE> <DEDENT> def update(self, state, action, nextState, reward): <NEW_LINE> <INDENT> self.Q[(state, action)] = (1-self.alpha) * self.getQValue(state, action) + self.alpha * (reward + self.discount * self.getValue(nextState)) <NEW_LINE> <DEDENT> def getPolicy(self, state): <NEW_LINE> <INDENT> return self.computeActionFromQValues(state) <NEW_LINE> <DEDENT> def getValue(self, state): <NEW_LINE> <INDENT> return self.computeValueFromQValues(state)
Q-Learning Agent Functions you should fill in: - computeValueFromQValues - computeActionFromQValues - getQValue - getAction - update Instance variables you have access to - self.epsilon (exploration prob) - self.alpha (learning rate) - self.discount (discount rate) Functions you should use - self.getLegalActions(state) which returns legal actions for a state
62598fa763d6d428bbee26cd
class DBDataError(DBError): <NEW_LINE> <INDENT> pass
Raised for errors that are due to problems with the processed data. E.g. division by zero, numeric value out of range, incorrect data type, etc
62598fa7a8ecb0332587112b
class PlayQuestionDecoratorTests(test_utils.GenericTestBase): <NEW_LINE> <INDENT> question_id = 'question_id' <NEW_LINE> class MockHandler(base.BaseHandler): <NEW_LINE> <INDENT> GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON <NEW_LINE> URL_PATH_ARGS_SCHEMAS = { 'question_id': { 'schema': { 'type': 'basestring' } } } <NEW_LINE> HANDLER_ARGS_SCHEMAS = {'GET': {}} <NEW_LINE> @acl_decorators.can_play_question <NEW_LINE> def get(self, question_id): <NEW_LINE> <INDENT> self.render_json({'question_id': question_id}) <NEW_LINE> <DEDENT> <DEDENT> def setUp(self): <NEW_LINE> <INDENT> super(PlayQuestionDecoratorTests, self).setUp() <NEW_LINE> self.signup(self.OWNER_EMAIL, self.OWNER_USERNAME) <NEW_LINE> self.owner_id = self.get_user_id_from_email(self.OWNER_EMAIL) <NEW_LINE> self.mock_testapp = webtest.TestApp(webapp2.WSGIApplication( [webapp2.Route( '/mock_play_question/<question_id>', self.MockHandler)], debug=feconf.DEBUG, )) <NEW_LINE> self.save_new_question( self.question_id, self.owner_id, self._create_valid_question_data('ABC'), ['skill_1']) <NEW_LINE> <DEDENT> def test_can_play_question_with_valid_question_id(self): <NEW_LINE> <INDENT> with self.swap(self, 'testapp', self.mock_testapp): <NEW_LINE> <INDENT> response = self.get_json('/mock_play_question/%s' % ( self.question_id)) <NEW_LINE> self.assertEqual(response['question_id'], self.question_id)
Tests the decorator can_play_question.
62598fa7a8370b77170f02f6
class Comment(BaseComment): <NEW_LINE> <INDENT> created_by = models.ForeignKey(User, unique=False, blank=True, null=True) <NEW_LINE> user_url = models.CharField(max_length=100) <NEW_LINE> email_id = models.EmailField() <NEW_LINE> is_spam = models.BooleanField(default=False) <NEW_LINE> is_public = models.NullBooleanField(null=True, blank=True) <NEW_LINE> default = models.Manager() <NEW_LINE> objects = CommentManager() <NEW_LINE> @permalink <NEW_LINE> def get_absolute_url (self): <NEW_LINE> <INDENT> return ('comment_details', self.id)
Comments for each blog. text: The comment text. comment_for: the Post/Page this comment is created for. created_on: The date this comment was written on. created_by: THe user who wrote this comment. user_name = If created_by is null, this comment was by anonymous user. Name in that case. email_id: Email-id, as in user_name. is_spam: Is comment marked as spam? We do not display the comment in those cases. is_public: null for comments waiting to be approved, True if approved, False if rejected
62598fa7d268445f26639b11
class TestRequestResource(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.app.config.from_object(app_config['testing']) <NEW_LINE> self.app_context = self.app.app_context() <NEW_LINE> self.app_context.push() <NEW_LINE> init() <NEW_LINE> self.client = self.app.test_client() <NEW_LINE> self.data = { "user": { "username": "user1", "email": "user@gmail.com", "name": "User One", "password": "My_supersecret1", "confirm_password": "My_supersecret1" }, "user_login": { "username": "user2", "email": "user2@gmail.com", "name": "User One", "password": "My_supersecret1", "confirm_password": "My_supersecret1" }, "creds_login": { "username": "user2", "password": "My_supersecret1" } } <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> drop() <NEW_LINE> <DEDENT> def test_signup(self): <NEW_LINE> <INDENT> response = self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(self.data["user"]), content_type=("application/json") ) <NEW_LINE> self.assertEqual(response.status_code, 201) <NEW_LINE> <DEDENT> def test_signin(self): <NEW_LINE> <INDENT> self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(self.data["user_login"]), content_type=("application/json") ) <NEW_LINE> response = self.client.post( '/api/v2/users/auth/signin/', data=json.dumps(self.data["creds_login"]), content_type=("application/json") ) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE> <DEDENT> def test_username_taken(self): <NEW_LINE> <INDENT> self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(self.data["user"]), content_type=("application/json") ) <NEW_LINE> response = self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(self.data["user"]), content_type=("application/json") ) <NEW_LINE> self.assertEqual(response.status_code, 400) <NEW_LINE> <DEDENT> def test_email_taken(self): <NEW_LINE> <INDENT> self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(dict( username="dennis", email="user1@gmail.com", name="Dennis", password="root", confirm_password="root" )), content_type=("application/json") ) <NEW_LINE> response = self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(dict( username="creez", email="user1@gmail.com", name="Dennis", password="root", confirm_password="root" )), content_type=("application/json") ) <NEW_LINE> self.assertEqual(response.status_code, 400) <NEW_LINE> <DEDENT> def test_password_missmatch(self): <NEW_LINE> <INDENT> response = self.client.post( '/api/v2/users/auth/signup/', data=json.dumps(dict( username="test_user", email="dennis@gmail.com", name="Dennis", password="root", confirm_password="rooter" )), content_type=("application/json") ) <NEW_LINE> self.assertEqual(response.status_code, 400)
A class to perform tests for the Request Resource
62598fa72c8b7c6e89bd36e1
class Ipv4Header(object): <NEW_LINE> <INDENT> __slots__ = ['version', 'internet_hdr_length', 'dscp', 'explicit_congestion_notification', 'total_length', 'identification', 'flags', 'fragment_offset', 'time_to_live', 'protocol', 'header_checksum', 'source_ip', 'destination_ip', 'options'] <NEW_LINE> def __init__(self, version, internet_hdr_length, dscp, explicit_congestion_notification, total_length, identification, flags, fragment_offset, time_to_live, protocol, header_checksum, source_ip, destination_ip, options=[]): <NEW_LINE> <INDENT> self.version = version <NEW_LINE> self.internet_hdr_length = internet_hdr_length <NEW_LINE> self.dscp = dscp <NEW_LINE> self.explicit_congestion_notification = explicit_congestion_notification <NEW_LINE> self.total_length = total_length <NEW_LINE> self.identification = identification <NEW_LINE> self.flags = flags <NEW_LINE> self.fragment_offset = fragment_offset <NEW_LINE> self.time_to_live = time_to_live <NEW_LINE> self.protocol = protocol <NEW_LINE> self.header_checksum = header_checksum <NEW_LINE> self.source_ip = source_ip <NEW_LINE> self.destination_ip = destination_ip <NEW_LINE> self.options = options <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return self.internet_hdr_length
RFC791, RFC2474, RFC3168 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |Version| IHL | DSCP |ECN| Total Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Identification |Flags| Fragment Offset | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Time to Live | Protocol | Header Checksum | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Destination Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Options | Padding | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
62598fa78da39b475be030fe
class MockSingleUserServer(SingleUserNotebookApp): <NEW_LINE> <INDENT> def init_signal(self): <NEW_LINE> <INDENT> pass
Mock-out problematic parts of single-user server when run in a thread Currently: - disable signal handler
62598fa7dd821e528d6d8e51
class Data(Statement): <NEW_LINE> <INDENT> match = re.compile(r'data\b', re.I).match <NEW_LINE> def process_item(self): <NEW_LINE> <INDENT> line = self.item.get_line()[4:].lstrip() <NEW_LINE> stmts = [] <NEW_LINE> self.isvalid = False <NEW_LINE> while line: <NEW_LINE> <INDENT> i = line.find('/') <NEW_LINE> if i == -1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> j = line.find('/', i + 1) <NEW_LINE> if j == -1: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> l1, l2 = line[:i].rstrip(), line[i + 1:j].strip() <NEW_LINE> l1 = split_comma(l1, self.item) <NEW_LINE> l2 = split_comma(l2, self.item) <NEW_LINE> stmts.append((l1, l2)) <NEW_LINE> line = line[j + 1:].lstrip() <NEW_LINE> if line.startswith(','): <NEW_LINE> <INDENT> line = line[1:].lstrip() <NEW_LINE> <DEDENT> <DEDENT> self.stmts = stmts <NEW_LINE> self.isvalid = True <NEW_LINE> return <NEW_LINE> <DEDENT> def tofortran(self, isfix=None): <NEW_LINE> <INDENT> tab = self.get_indent_tab(isfix=isfix) <NEW_LINE> l = [] <NEW_LINE> for o, v in self.stmts: <NEW_LINE> <INDENT> l.append('%s / %s /' % (', '.join(o), ', '.join(v))) <NEW_LINE> <DEDENT> return tab + 'data ' + ' '.join(l) <NEW_LINE> <DEDENT> def analyze(self): return
DATA <data-stmt-set> [ [ , ] <data-stmt-set> ]... <data-stmt-set> = <data-stmt-object-list> / <data-stmt-value-list> / <data-stmt-object> = <variable> | <data-implied-do> <data-implied-do> = ( <data-i-do-object-list> , <data-i-do-variable> = <scalar-int-expr> , <scalar-int-expr> [ , <scalar-int-expr> ] ) <data-i-do-object> = <array-element> | <scalar-structure-component> | <data-implied-do> <data-i-do-variable> = <scalar-int-variable> <variable> = <designator> <designator> = <object-name> | <array-element> | <array-section> | <structure-component> | <substring> <array-element> = <data-ref> <array-section> = <data-ref> [ ( <substring-range> ) ]
62598fa73539df3088ecc1d0
class TestAutoRegOLSConstant(CheckAutoRegMixin): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setup_class(cls): <NEW_LINE> <INDENT> data = sm.datasets.sunspots.load(as_pandas=True) <NEW_LINE> data.endog.index = list(range(len(data.endog))) <NEW_LINE> cls.res1 = AutoReg(data.endog, lags=9, old_names=False).fit() <NEW_LINE> cls.res2 = results_ar.ARResultsOLS(constant=True) <NEW_LINE> <DEDENT> def test_predict(self): <NEW_LINE> <INDENT> model = self.res1.model <NEW_LINE> params = self.res1.params <NEW_LINE> assert_almost_equal(model.predict(params), self.res2.FVOLSnneg1start0, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params), self.res2.FVOLSnneg1start9, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=100), self.res2.FVOLSnneg1start100, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=9, end=200), self.res2.FVOLSn200start0, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params), self.res2.FVOLSdefault, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=200, end=400), self.res2.FVOLSn200start200, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=308, end=424), self.res2.FVOLSn100start325, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=9, end=310), self.res2.FVOLSn301start9, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=308, end=316), self.res2.FVOLSn4start312, DECIMAL_4) <NEW_LINE> assert_almost_equal(model.predict(params, start=308, end=327), self.res2.FVOLSn15start312, DECIMAL_4)
Test AutoReg fit by OLS with a constant.
62598fa77d43ff2487427390
class CloudErrorBody(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'code': {'key': 'code', 'type': 'str'}, 'message': {'key': 'message', 'type': 'str'}, 'target': {'key': 'target', 'type': 'str'}, 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(CloudErrorBody, self).__init__(**kwargs) <NEW_LINE> self.code = kwargs.get('code', None) <NEW_LINE> self.message = kwargs.get('message', None) <NEW_LINE> self.target = kwargs.get('target', None) <NEW_LINE> self.details = kwargs.get('details', None)
An error response from the service. :param code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. :type code: str :param message: A message describing the error, intended to be suitable for display in a user interface. :type message: str :param target: The target of the particular error. For example, the name of the property in error. :type target: str :param details: A list of additional details about the error. :type details: list[~azure.mgmt.privatedns.models.CloudErrorBody]
62598fa7d7e4931a7ef3bfb7
class Healpix2SphericalOperator(_HealPixSpherical): <NEW_LINE> <INDENT> def __init__(self, nside, convention, nest=False, **keywords): <NEW_LINE> <INDENT> _HealPixSpherical.__init__( self, nside, convention, nest=nest, reshapein=self._reshapehealpix, reshapeout=self._reshapespherical, validateout=self._validatespherical, **keywords) <NEW_LINE> self.set_rule( 'I', lambda s: Spherical2HealpixOperator(s.nside, s.convention, nest=s.nest)) <NEW_LINE> self.set_rule(('.', Spherical2HealpixOperator), self._rule_identity, CompositionOperator) <NEW_LINE> <DEDENT> def direct(self, input, output): <NEW_LINE> <INDENT> input = input.astype(int) <NEW_LINE> func = pixlib._pix2ang_nest if self.nest else pixlib._pix2ang_ring <NEW_LINE> if self.convention.startswith('azimuth'): <NEW_LINE> <INDENT> o1, o2 = output[..., 1], output[..., 0] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> o1, o2 = output[..., 0], output[..., 1] <NEW_LINE> <DEDENT> func(self.nside, input, o1, o2) <NEW_LINE> if 'elevation' in self.convention: <NEW_LINE> <INDENT> np.subtract(0.5 * pi(self.dtype), o1, o1)
Convert Healpix pixels into spherical coordinates in radians. The last dimension of the operator's output is 2 and it encodes the two spherical angles. Four conventions define what these angles are: - 'zenith,azimuth': (theta, phi) angles commonly used in physics or the (colatitude, longitude) angles used in the celestial and geographical coordinate systems - 'azimuth,zenith': (longitude, colatitude) convention - 'elevation,azimuth: (latitude, longitude) convention - 'azimuth,elevation': (longitude, latitude) convention
62598fa7be383301e0253714
class ApplicationGatewayRewriteRuleSet(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'rewrite_rules': {'key': 'properties.rewriteRules', 'type': '[ApplicationGatewayRewriteRule]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(ApplicationGatewayRewriteRuleSet, self).__init__(**kwargs) <NEW_LINE> self.name = kwargs.get('name', None) <NEW_LINE> self.etag = None <NEW_LINE> self.rewrite_rules = kwargs.get('rewrite_rules', None) <NEW_LINE> self.provisioning_state = None
Rewrite rule set of an application gateway. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: Name of the rewrite rule set that is unique within an Application Gateway. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :param rewrite_rules: Rewrite rules in the rewrite rule set. :type rewrite_rules: list[~azure.mgmt.network.v2020_11_01.models.ApplicationGatewayRewriteRule] :ivar provisioning_state: The provisioning state of the rewrite rule set resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_11_01.models.ProvisioningState
62598fa76e29344779b00578
class TestTransactionAPI(APITestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = UserFactory.build() <NEW_LINE> self.user.save() <NEW_LINE> self.ledger = LedgerFactory.build() <NEW_LINE> self.ledger.user = self.user <NEW_LINE> self.ledger.save() <NEW_LINE> self.account = AccountFactory.build() <NEW_LINE> self.account.ledger = self.ledger <NEW_LINE> self.account.save() <NEW_LINE> self.payee = PayeeFactory.build() <NEW_LINE> self.payee.ledger = self.ledger <NEW_LINE> self.payee.save() <NEW_LINE> self.client.credentials(HTTP_AUTHORIZATION='Token {}'.format(self.user.auth_token)) <NEW_LINE> self.url = reverse('transactions-list', kwargs={'ledger_pk': self.ledger.pk}) <NEW_LINE> transaction = TransactionFactory.build() <NEW_LINE> transaction.account = self.account <NEW_LINE> self.transaction_data = model_to_dict(transaction) <NEW_LINE> <DEDENT> def test_post_request_with_no_data_fails(self): <NEW_LINE> <INDENT> response = self.client.post(self.url, {}) <NEW_LINE> eq_(response.status_code, 400) <NEW_LINE> <DEDENT> def test_create_transaction(self): <NEW_LINE> <INDENT> obj = self.transaction_data.copy() <NEW_LINE> obj['payee'] = {} <NEW_LINE> obj['payee']['name'] = self.payee.name <NEW_LINE> response = self.client.post(self.url, obj, format='json') <NEW_LINE> print(response.__dict__) <NEW_LINE> eq_(response.status_code, 201)
Tests the /transactions endpoint.
62598fa767a9b606de545ee8
class AuthenticatedHandler(BaseHandler): <NEW_LINE> <INDENT> __metaclass__ = _HandlerMeta <NEW_LINE> @requires_auth <NEW_LINE> @xsrf_protected <NEW_LINE> def dispatch(self): <NEW_LINE> <INDENT> super(AuthenticatedHandler, self).dispatch() <NEW_LINE> <DEDENT> def _RequestContainsValidXsrfToken(self): <NEW_LINE> <INDENT> token = self.request.get('xsrf') or self.request.headers.get('X-XSRF-TOKEN') <NEW_LINE> if (token and self.app.config.get('using_angular', constants.DEFAULT_ANGULAR) and token[0] == '"' and token[-1] == '"'): <NEW_LINE> <INDENT> token = token[1:-1] <NEW_LINE> <DEDENT> if xsrf.ValidateToken(_GetXsrfKey(), self.current_user.email(), token): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def DenyAccess(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def XsrfFail(self): <NEW_LINE> <INDENT> pass
Base handler for servicing authenticated user requests. Implementations should provide an implementation of DenyAccess() and XsrfFail() to handle unauthenticated requests or invalid XSRF tokens. POST requests will be rejected unless the request contains a parameter named 'xsrf' which is a valid XSRF token for the currently authenticated user.
62598fa74e4d562566372341
class SBSku(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'name': {'required': True}, } <NEW_LINE> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, 'capacity': {'key': 'capacity', 'type': 'int'}, } <NEW_LINE> def __init__( self, *, name: Union[str, "SkuName"], tier: Optional[Union[str, "SkuTier"]] = None, capacity: Optional[int] = None, **kwargs ): <NEW_LINE> <INDENT> super(SBSku, self).__init__(**kwargs) <NEW_LINE> self.name = name <NEW_LINE> self.tier = tier <NEW_LINE> self.capacity = capacity
SKU of the namespace. All required parameters must be populated in order to send to Azure. :param name: Required. Name of this SKU. Possible values include: "Basic", "Standard", "Premium". :type name: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuName :param tier: The billing tier of this particular SKU. Possible values include: "Basic", "Standard", "Premium". :type tier: str or ~azure.mgmt.servicebus.v2018_01_01_preview.models.SkuTier :param capacity: The specified messaging units for the tier. For Premium tier, capacity are 1,2 and 4. :type capacity: int
62598fa76aa9bd52df0d4de5
class RPlogr(RPackage): <NEW_LINE> <INDENT> homepage = "https://cloud.r-project.org/package=plogr" <NEW_LINE> url = "https://cloud.r-project.org/src/contrib/plogr_0.2.0.tar.gz" <NEW_LINE> list_url = "https://cloud.r-project.org/src/contrib/Archive/plogr" <NEW_LINE> version('0.2.0', sha256='0e63ba2e1f624005fe25c67cdd403636a912e063d682eca07f2f1d65e9870d29') <NEW_LINE> version('0.1-1', sha256='22755c93c76c26252841f43195df31681ea865e91aa89726010bd1b9288ef48f')
A simple header-only logging library for C++. Add 'LinkingTo: plogr' to 'DESCRIPTION', and '#include <plogr.h>' in your C++ modules to use it.
62598fa7796e427e5384e6af
class MatchOptions: <NEW_LINE> <INDENT> def __init__(self,allowPrefix=False,requireContiguousSublist=False): <NEW_LINE> <INDENT> self.AllowPrefix=allowPrefix <NEW_LINE> self.requireContiguousSublist=requireContiguousSublist
A set of options for how lists of strings are compared. Used in functions like IsSubsetOf and IsSublistOf
62598fa766656f66f7d5a30c
class CollectionRnkMETHOD(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'collection_rnkMETHOD' <NEW_LINE> id_collection = db.Column(db.MediumInteger(9, unsigned=True), db.ForeignKey(Collection.id), primary_key=True, nullable=False) <NEW_LINE> id_rnkMETHOD = db.Column(db.MediumInteger(9, unsigned=True), db.ForeignKey(RnkMETHOD.id), primary_key=True, nullable=False) <NEW_LINE> score = db.Column(db.TinyInteger(4, unsigned=True), nullable=False, server_default='0') <NEW_LINE> collection = db.relationship(Collection, backref='rnkMETHODs') <NEW_LINE> rnkMETHOD = db.relationship(RnkMETHOD, backref='collections')
Represents a CollectionRnkMETHOD record.
62598fa70c0af96317c5629e
class Condition1(Condition): <NEW_LINE> <INDENT> def check(self, instance): <NEW_LINE> <INDENT> return instance.visible
Is visible ?
62598fa726068e7796d4c875
class PasswordForm(Form): <NEW_LINE> <INDENT> password = PasswordField('Password', validators=[validators.Required()])
Used to reset a password.
62598fa71f5feb6acb162b3e
class CertificateCreateParameters(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'certificate_policy': {'key': 'policy', 'type': 'CertificatePolicy'}, 'certificate_attributes': {'key': 'attributes', 'type': 'CertificateAttributes'}, 'tags': {'key': 'tags', 'type': '{str}'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(CertificateCreateParameters, self).__init__(**kwargs) <NEW_LINE> self.certificate_policy = kwargs.get('certificate_policy', None) <NEW_LINE> self.certificate_attributes = kwargs.get('certificate_attributes', None) <NEW_LINE> self.tags = kwargs.get('tags', None)
The certificate create parameters. :param certificate_policy: The management policy for the certificate. :type certificate_policy: ~azure.keyvault.v7_0.models.CertificatePolicy :param certificate_attributes: The attributes of the certificate (optional). :type certificate_attributes: ~azure.keyvault.v7_0.models.CertificateAttributes :param tags: A set of tags. Application specific metadata in the form of key-value pairs. :type tags: dict[str, str]
62598fa799cbb53fe6830df2
class InputElement(InputMixin, HtmlElement): <NEW_LINE> <INDENT> @property <NEW_LINE> def value(self): <NEW_LINE> <INDENT> if self.checkable: <NEW_LINE> <INDENT> if self.checked: <NEW_LINE> <INDENT> return self.get('value') or 'on' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> return self.get('value') <NEW_LINE> <DEDENT> @value.setter <NEW_LINE> def value(self, value): <NEW_LINE> <INDENT> if self.checkable: <NEW_LINE> <INDENT> if not value: <NEW_LINE> <INDENT> self.checked = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.checked = True <NEW_LINE> if isinstance(value, basestring): <NEW_LINE> <INDENT> self.set('value', value) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> else: <NEW_LINE> <INDENT> self.set('value', value) <NEW_LINE> <DEDENT> <DEDENT> @value.deleter <NEW_LINE> def value(self): <NEW_LINE> <INDENT> if self.checkable: <NEW_LINE> <INDENT> self.checked = False <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if 'value' in self.attrib: <NEW_LINE> <INDENT> del self.attrib['value'] <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> @property <NEW_LINE> def type(self): <NEW_LINE> <INDENT> return self.get('type', 'text').lower() <NEW_LINE> <DEDENT> @type.setter <NEW_LINE> def type(self, value): <NEW_LINE> <INDENT> self.set('type', value) <NEW_LINE> <DEDENT> @property <NEW_LINE> def checkable(self): <NEW_LINE> <INDENT> return self.type in ('checkbox', 'radio') <NEW_LINE> <DEDENT> @property <NEW_LINE> def checked(self): <NEW_LINE> <INDENT> if not self.checkable: <NEW_LINE> <INDENT> raise AttributeError('Not a checkable input type') <NEW_LINE> <DEDENT> return 'checked' in self.attrib <NEW_LINE> <DEDENT> @checked.setter <NEW_LINE> def checked(self, value): <NEW_LINE> <INDENT> if not self.checkable: <NEW_LINE> <INDENT> raise AttributeError('Not a checkable input type') <NEW_LINE> <DEDENT> if value: <NEW_LINE> <INDENT> self.set('checked', '') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> attrib = self.attrib <NEW_LINE> if 'checked' in attrib: <NEW_LINE> <INDENT> del attrib['checked']
Represents an ``<input>`` element. You can get the type with ``.type`` (which is lower-cased and defaults to ``'text'``). Also you can get and set the value with ``.value`` Checkboxes and radios have the attribute ``input.checkable == True`` (for all others it is false) and a boolean attribute ``.checked``.
62598fa7167d2b6e312b6e8d
class Plate4ti0130(Plate96): <NEW_LINE> <INDENT> class PlateWell(Well): <NEW_LINE> <INDENT> capacity = 1900e-6
96-well plate with 2ml deepwells from 4titude
62598fa78c0ade5d55dc361f
class KalturaScheduleResourceService(KalturaServiceBase): <NEW_LINE> <INDENT> def __init__(self, client = None): <NEW_LINE> <INDENT> KalturaServiceBase.__init__(self, client) <NEW_LINE> <DEDENT> def add(self, scheduleResource): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addObjectIfDefined("scheduleResource", scheduleResource) <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "add", "KalturaScheduleResource", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaScheduleResource') <NEW_LINE> <DEDENT> def addFromBulkUpload(self, fileData, bulkUploadData = NotImplemented): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kfiles = {"fileData": fileData} <NEW_LINE> kparams.addObjectIfDefined("bulkUploadData", bulkUploadData) <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "addFromBulkUpload", "KalturaBulkUpload", kparams, kfiles) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaBulkUpload') <NEW_LINE> <DEDENT> def delete(self, scheduleResourceId): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addIntIfDefined("scheduleResourceId", scheduleResourceId); <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "delete", "KalturaScheduleResource", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaScheduleResource') <NEW_LINE> <DEDENT> def get(self, scheduleResourceId): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addIntIfDefined("scheduleResourceId", scheduleResourceId); <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "get", "KalturaScheduleResource", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaScheduleResource') <NEW_LINE> <DEDENT> def list(self, filter = NotImplemented, pager = NotImplemented): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addObjectIfDefined("filter", filter) <NEW_LINE> kparams.addObjectIfDefined("pager", pager) <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "list", "KalturaScheduleResourceListResponse", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaScheduleResourceListResponse') <NEW_LINE> <DEDENT> def update(self, scheduleResourceId, scheduleResource): <NEW_LINE> <INDENT> kparams = KalturaParams() <NEW_LINE> kparams.addIntIfDefined("scheduleResourceId", scheduleResourceId); <NEW_LINE> kparams.addObjectIfDefined("scheduleResource", scheduleResource) <NEW_LINE> self.client.queueServiceActionCall("schedule_scheduleresource", "update", "KalturaScheduleResource", kparams) <NEW_LINE> if self.client.isMultiRequest(): <NEW_LINE> <INDENT> return self.client.getMultiRequestResult() <NEW_LINE> <DEDENT> resultNode = self.client.doQueue() <NEW_LINE> return KalturaObjectFactory.create(resultNode, 'KalturaScheduleResource')
The ScheduleResource service enables you to create and manage (update, delete, retrieve, etc.) the resources required for scheduled events (cameras, capture devices, etc.).
62598fa767a9b606de545ee9
class color(enum.Enum): <NEW_LINE> <INDENT> black = "black" <NEW_LINE> dark_blue = "dark_blue" <NEW_LINE> dark_green = "dark_green" <NEW_LINE> dark_aqua = "dark_aqua" <NEW_LINE> dark_red = "dark_red" <NEW_LINE> dark_purple = "dark_purple" <NEW_LINE> gold = "gold" <NEW_LINE> gray = "gray" <NEW_LINE> dark_gray = "dark_gray" <NEW_LINE> blue = "blue" <NEW_LINE> green = "green" <NEW_LINE> aqua = "aqua" <NEW_LINE> red = "red" <NEW_LINE> light_purple = "light_purple" <NEW_LINE> yellow = "yellow" <NEW_LINE> white = "white"
color * black * dark_blue * dark_green * dark_aqua * dark_red * dark_purple * gold * gray * dark_gray * blue * green * aqua * red * light_purple * yellow * white
62598fa7090684286d59366a
class TestImageCacheSqlite(test_utils.BaseTestCase, ImageCacheTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestImageCacheSqlite, self).setUp() <NEW_LINE> if getattr(self, 'disable', False): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if not getattr(self, 'inited', False): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> import sqlite3 <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> self.inited = True <NEW_LINE> self.disabled = True <NEW_LINE> self.disabled_message = ("python-sqlite3 not installed.") <NEW_LINE> return <NEW_LINE> <DEDENT> <DEDENT> self.inited = True <NEW_LINE> self.disabled = False <NEW_LINE> self.cache_dir = os.path.join("/", "tmp", "test.cache.%d" % random.randint(0, 1000000)) <NEW_LINE> self.config(image_cache_dir=self.cache_dir, image_cache_driver='sqlite', image_cache_max_size=1024 * 5, registry_host='127.0.0.1', registry_port=9191) <NEW_LINE> self.cache = image_cache.ImageCache() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> super(TestImageCacheSqlite, self).tearDown() <NEW_LINE> if os.path.exists(self.cache_dir): <NEW_LINE> <INDENT> shutil.rmtree(self.cache_dir)
Tests image caching when SQLite is used in cache
62598fa74428ac0f6e658440
class WeightingQuery(WrappingQuery): <NEW_LINE> <INDENT> def __init__(self, child, weighting): <NEW_LINE> <INDENT> WrappingQuery.__init__(self, child) <NEW_LINE> self.weighting = weighting <NEW_LINE> <DEDENT> def matcher(self, searcher, weighting=None): <NEW_LINE> <INDENT> return self.child.matcher(searcher, self.weighting)
Wraps a query and uses a specific :class:`whoosh.sorting.WeightingModel` to score documents that match the wrapped query.
62598fa78e7ae83300ee8fbf
class SharedArgument(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.args = args <NEW_LINE> self.kwargs = kwargs <NEW_LINE> <DEDENT> def add_to_parser(self, target_parser): <NEW_LINE> <INDENT> target_parser.add_argument(*self.args, **self.kwargs) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def add_group_to_parser(target_parser, shared_arguments): <NEW_LINE> <INDENT> for arg in shared_arguments: <NEW_LINE> <INDENT> arg.add_to_parser(target_parser)
Definition of an argparse argument which can be added to multiple subparsers (AKA commands).
62598fa738b623060ffa8fb5
class GaussValuationFactory(UniqueFactory): <NEW_LINE> <INDENT> def create_key(self, domain, v = None): <NEW_LINE> <INDENT> from sage.rings.polynomial.polynomial_ring import is_PolynomialRing <NEW_LINE> if not is_PolynomialRing(domain): <NEW_LINE> <INDENT> raise TypeError("GaussValuations can only be created over polynomial rings but %r is not a polynomial ring"%(domain,)) <NEW_LINE> <DEDENT> if not domain.ngens() == 1: <NEW_LINE> <INDENT> raise NotImplementedError("domain must be univariate but %r is not univariate"%(domain,)) <NEW_LINE> <DEDENT> if v is None: <NEW_LINE> <INDENT> v = domain.base_ring().valuation() <NEW_LINE> <DEDENT> if not v.domain() is domain.base_ring(): <NEW_LINE> <INDENT> raise ValueError("the domain of v must be the base ring of domain but %r is not defined over %r but over %r"%(v, domain.base_ring(), v.domain())) <NEW_LINE> <DEDENT> if not v.is_discrete_valuation(): <NEW_LINE> <INDENT> raise ValueError("v must be a discrete valuation but %r is not"%(v,)) <NEW_LINE> <DEDENT> return (domain, v) <NEW_LINE> <DEDENT> def create_object(self, version, key, **extra_args): <NEW_LINE> <INDENT> domain, v = key <NEW_LINE> from sage.rings.valuation.valuation_space import DiscretePseudoValuationSpace <NEW_LINE> parent = DiscretePseudoValuationSpace(domain) <NEW_LINE> return parent.__make_element_class__(GaussValuation_generic)(parent, v)
Create a Gauss valuation on ``domain``. INPUT: - ``domain`` -- a univariate polynomial ring - ``v`` -- a valuation on the base ring of ``domain``, the underlying valuation on the constants of the polynomial ring (if unspecified take the natural valuation on the valued ring ``domain``.) EXAMPLES: The Gauss valuation is the minimum of the valuation of the coefficients:: sage: v = QQ.valuation(2) sage: R.<x> = QQ[] sage: w = GaussValuation(R, v) sage: w(2) 1 sage: w(x) 0 sage: w(x + 2) 0
62598fa7d268445f26639b12
class NodeBuild(NodeTask): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def product_types(cls): <NEW_LINE> <INDENT> return ['bundleable_js', 'runtime_classpath'] <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def prepare(cls, options, round_manager): <NEW_LINE> <INDENT> super(NodeBuild, cls).prepare(options, round_manager) <NEW_LINE> round_manager.require_data(NodePaths) <NEW_LINE> <DEDENT> @property <NEW_LINE> def create_target_dirs(self): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def _run_build_script(self, target, results_dir, node_installed_path, node_paths): <NEW_LINE> <INDENT> target_address = target.address.reference() <NEW_LINE> if target.payload.build_script: <NEW_LINE> <INDENT> self.context.log.info('Running node build {} for {} at {}\n'.format( target.payload.build_script, target_address, node_installed_path)) <NEW_LINE> result, build_command = self.run_script( target.payload.build_script, target=target, node_paths=node_paths, workunit_name=target_address, workunit_labels=[WorkUnitLabel.COMPILER] ) <NEW_LINE> if result != 0: <NEW_LINE> <INDENT> raise TaskError( 'Failed to run build for {}:\n\t{} failed with exit code {}'.format( target_address, build_command, result)) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def _get_output_dir(self, target, node_installed_path): <NEW_LINE> <INDENT> return os.path.normpath(os.path.join( node_installed_path, target.payload.output_dir if target.payload.build_script else '')) <NEW_LINE> <DEDENT> def execute(self): <NEW_LINE> <INDENT> node_paths = self.context.products.get_data(NodePaths) <NEW_LINE> runtime_classpath_product = self.context.products.get_data( 'runtime_classpath', init_func=ClasspathProducts.init_func(self.get_options().pants_workdir)) <NEW_LINE> bundleable_js_product = self.context.products.get_data( 'bundleable_js', init_func=lambda: defaultdict(MultipleRootedProducts)) <NEW_LINE> targets = self.context.targets(predicate=self.is_node_module) <NEW_LINE> with self.invalidated(targets, invalidate_dependents=True) as invalidation_check: <NEW_LINE> <INDENT> for vt in invalidation_check.all_vts: <NEW_LINE> <INDENT> target = vt.target <NEW_LINE> node_installed_path = node_paths.node_path(target) <NEW_LINE> with pushd(node_installed_path): <NEW_LINE> <INDENT> if not vt.valid: <NEW_LINE> <INDENT> self._run_build_script( target, vt.results_dir, node_installed_path, node_paths.all_node_paths) <NEW_LINE> <DEDENT> if not target.payload.dev_dependency: <NEW_LINE> <INDENT> output_dir = self._get_output_dir(target, node_installed_path) <NEW_LINE> if not os.path.exists(output_dir): <NEW_LINE> <INDENT> raise TaskError( 'Target {} has build script {} specified, but did not generate any output ' 'at {}.\n'.format( target.address.reference(), target.payload.build_script, output_dir)) <NEW_LINE> <DEDENT> absolute_symlink(output_dir, os.path.join(vt.results_dir, target.address.target_name)) <NEW_LINE> bundleable_js_product[target].add_abs_paths(output_dir, [output_dir]) <NEW_LINE> runtime_classpath_product.add_for_target(target, [('default', vt.results_dir)])
Create an archive bundle of NodeModule targets.
62598fa7925a0f43d25e7f5c
class URFrequency: <NEW_LINE> <INDENT> ur_freq_re = re.compile(r'^\d{3}\.\d{3};[ASF]$') <NEW_LINE> def __init__(self, freq: str) -> None: <NEW_LINE> <INDENT> if not URFrequency.ur_freq_re.match(freq): <NEW_LINE> <INDENT> raise ValueError() <NEW_LINE> <DEDENT> self.freq = freq <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.freq <NEW_LINE> <DEDENT> def long_freq(self): <NEW_LINE> <INDENT> freq, mod = self.freq.split(';') <NEW_LINE> if mod == 'S': <NEW_LINE> <INDENT> mod = 'SATCOM' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> mod = f'{mod}M' <NEW_LINE> <DEDENT> return f'{freq} {mod}'
Frequency for the ATIS Format: XXX.XXX;MOD Where XXX.XXX is the frequency and MOD is one of: A: AM F: FM S: SATCOM
62598fa716aa5153ce400420
class ExecuteOnlyVersionPreProcessor(ExecutePreprocessor): <NEW_LINE> <INDENT> def preprocess_cell(self, cell, resources, cell_index): <NEW_LINE> <INDENT> if cell.source.startswith('%run "../version.ipynb"'): <NEW_LINE> <INDENT> return super(ExecuteOnlyVersionPreProcessor, self).preprocess_cell(cell, resources, cell_index) <NEW_LINE> <DEDENT> return cell, resources
ExecutePreprocessor that only runs "version" cells.
62598fa76aa9bd52df0d4de7
class URLLoader: <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> self._error_info = None <NEW_LINE> self._url = None <NEW_LINE> self.url = '' <NEW_LINE> self.url = url <NEW_LINE> <DEDENT> def parse_url(self): <NEW_LINE> <INDENT> if len(self.url) == 0: <NEW_LINE> <INDENT> self._error_info = 'URLLoader: URL is empty' <NEW_LINE> return False <NEW_LINE> <DEDENT> url_parsed = urlparse(self.url) <NEW_LINE> if url_parsed.scheme != 'http' and url_parsed.scheme != 'https': <NEW_LINE> <INDENT> self._error_info = 'URLLoader: HTTP/HTTPS URL expected' <NEW_LINE> return False <NEW_LINE> <DEDENT> if len(url_parsed.netloc) == 0: <NEW_LINE> <INDENT> self._error_info = 'URLLoader: URL is not valid' <NEW_LINE> return False <NEW_LINE> <DEDENT> return True <NEW_LINE> <DEDENT> def open(self): <NEW_LINE> <INDENT> self._error_info = None <NEW_LINE> page = None <NEW_LINE> if not self.parse_url(): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> with urlopen(self.url) as my_response: <NEW_LINE> <INDENT> page = my_response.read() <NEW_LINE> <DEDENT> <DEDENT> except URLError as e: <NEW_LINE> <INDENT> self._error_info = str.format('URLLoader: Error opening URL: {0}', e.reason) <NEW_LINE> return None <NEW_LINE> <DEDENT> except Exception as e: <NEW_LINE> <INDENT> self._error_info = str.format('URLLoader: Error opening URL: {0}', e) <NEW_LINE> return None <NEW_LINE> <DEDENT> finally: <NEW_LINE> <INDENT> return page <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def error_info(self): <NEW_LINE> <INDENT> return self._error_info <NEW_LINE> <DEDENT> @error_info.setter <NEW_LINE> def error_info(self, error_info): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @property <NEW_LINE> def url(self): <NEW_LINE> <INDENT> return self._url <NEW_LINE> <DEDENT> @url.setter <NEW_LINE> def url(self, url): <NEW_LINE> <INDENT> if isinstance(url, str): <NEW_LINE> <INDENT> self._url = url <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._url = ''
Simple class for opening a web page selected by given url.
62598fa72c8b7c6e89bd36e4
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 = UserProfileManager() <NEW_LINE> USERNAME_FIELD = 'email' <NEW_LINE> REQUIRED_FIELDS = ['name'] <NEW_LINE> def get_full_name(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> def get_short_name(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.email
Database model for users in the system
62598fa766656f66f7d5a30e
class WikiWorker(Worker): <NEW_LINE> <INDENT> def __init__(self, options, meta, data_path=None): <NEW_LINE> <INDENT> self.options = options <NEW_LINE> for check in options['checks']: <NEW_LINE> <INDENT> self.options['checks'][check] = Check( check, *options['checks'][check]) <NEW_LINE> <DEDENT> self.meta = meta <NEW_LINE> for check in meta['checks']: <NEW_LINE> <INDENT> self.meta['checks'][check] = Check(check, *meta['checks'][check]) <NEW_LINE> <DEDENT> self.site = pywikibot.Site(options['lang'], options['family']) <NEW_LINE> repo = self.site.data_repository() <NEW_LINE> super(WikiWorker, self).__init__( 'WikiWorker:' + self.options['dbname'], self.options['dbname'], data_path, repo) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_config(cls, file): <NEW_LINE> <INDENT> options = json.load(file) <NEW_LINE> meta_path = os.path.join(os.path.dirname(file.name), 'meta.json') <NEW_LINE> data_path = os.path.join(os.path.dirname(file.name), '../data') <NEW_LINE> return cls(options, json.load(open(meta_path, 'r')), data_path) <NEW_LINE> <DEDENT> def _run(self): <NEW_LINE> <INDENT> items = self._load_pages() <NEW_LINE> for item in items: <NEW_LINE> <INDENT> for check in self.meta['checks']: <NEW_LINE> <INDENT> self.run_check(self.meta['checks'][check], item) <NEW_LINE> <DEDENT> for check in self.options['checks']: <NEW_LINE> <INDENT> self.run_check(self.options['checks'][check], item) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def run_check(self, check, item): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> item.get() <NEW_LINE> <DEDENT> except pywikibot.NoPage: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> except pywikibot.isRedirectPage: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> page_name = item.sitelinks.get(self.options['dbname']) <NEW_LINE> if not page_name: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> page = pywikibot.Page(self.site, page_name) <NEW_LINE> try: <NEW_LINE> <INDENT> page.get() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> check.run()
docstring for Wiki
62598fa7a17c0f6771d5c153
class UserManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self, email, password=None, **extra_fields): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError("User must have an email address") <NEW_LINE> <DEDENT> user = self.model(email=self.normalize_email(email), **extra_fields) <NEW_LINE> user.set_password(password) <NEW_LINE> user.save(using=self._db) <NEW_LINE> return user <NEW_LINE> <DEDENT> def create_superuser(self, email, password): <NEW_LINE> <INDENT> user = self.create_user(email, password) <NEW_LINE> user.is_staff = True <NEW_LINE> user.is_superuser = True <NEW_LINE> user.save(using=self._db) <NEW_LINE> return user
Custom user manger class to create user
62598fa7097d151d1a2c0f47
class GenerateAnsibleException(Exception): <NEW_LINE> <INDENT> pass
General Exception for generate function
62598fa7167d2b6e312b6e8f
class VersionedFlowsEntity(object): <NEW_LINE> <INDENT> swagger_types = { 'versioned_flows': 'list[VersionedFlowEntity]' } <NEW_LINE> attribute_map = { 'versioned_flows': 'versionedFlows' } <NEW_LINE> def __init__(self, versioned_flows=None): <NEW_LINE> <INDENT> self._versioned_flows = None <NEW_LINE> if versioned_flows is not None: <NEW_LINE> <INDENT> self.versioned_flows = versioned_flows <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def versioned_flows(self): <NEW_LINE> <INDENT> return self._versioned_flows <NEW_LINE> <DEDENT> @versioned_flows.setter <NEW_LINE> def versioned_flows(self, versioned_flows): <NEW_LINE> <INDENT> self._versioned_flows = versioned_flows <NEW_LINE> <DEDENT> def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <DEDENT> elif hasattr(value, "to_dict"): <NEW_LINE> <INDENT> result[attr] = value.to_dict() <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result[attr] = value <NEW_LINE> <DEDENT> <DEDENT> return result <NEW_LINE> <DEDENT> def to_str(self): <NEW_LINE> <INDENT> return pformat(self.to_dict()) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.to_str() <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, VersionedFlowsEntity): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return not self == other
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598fa7d7e4931a7ef3bfba
class PoliticianTagLinkDisputed(models.Model): <NEW_LINE> <INDENT> tag = models.ForeignKey(Tag, null=False, blank=False, verbose_name='tag unique identifier', on_delete=models.deletion.DO_NOTHING) <NEW_LINE> politician = models.ForeignKey(Politician, null=False, blank=False, verbose_name='politician unique identifier', on_delete=models.deletion.DO_NOTHING)
This is a highly disputed link between tag & item of interest. Generated from 'tag_added', and tag results are only shown to people within the cloud of the voter who posted We split off how things are tagged to avoid conflict wars between liberals & conservatives (Deal with some tags visible in some networks, and not in others - ex/ #ObamaSucks)
62598fa7b7558d589546354e
class TemplateTests(ManifestTestCase): <NEW_LINE> <INDENT> def test_page_not_found(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("page_not_found")) <NEW_LINE> self.assertTemplateUsed(response, "404.html") <NEW_LINE> <DEDENT> def test_server_error(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("server_error")) <NEW_LINE> self.assertTemplateUsed(response, "500.html") <NEW_LINE> <DEDENT> def test_homepage(self): <NEW_LINE> <INDENT> response = self.client.get(reverse("homepage")) <NEW_LINE> self.assertTemplateUsed(response, "homepage.html") <NEW_LINE> <DEDENT> def test_flatpage(self): <NEW_LINE> <INDENT> response = self.client.get("/flatpages/flatpage-url/") <NEW_LINE> self.assertTemplateUsed(response, "flatpages/default.html")
Tests for templates used by various views and errors.
62598fa710dbd63aa1c70ad1
class ValidationError(Exception): <NEW_LINE> <INDENT> def __init__(self, field, value, msg=None): <NEW_LINE> <INDENT> self.field = field <NEW_LINE> self.value = value <NEW_LINE> if msg: <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.msg = 'Invalid value for \'{}\': {}'.format(field, value) <NEW_LINE> <DEDENT> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.msg) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return repr(self.msg)
A simple validation error.
62598fa7e5267d203ee6b82a
@six.python_2_unicode_compatible <NEW_LINE> class TransportProtocol(enum.IntEnum): <NEW_LINE> <INDENT> FCP = 0 <NEW_LINE> SPI = 1 <NEW_LINE> SSA = 2 <NEW_LINE> IEEE1394 = 3 <NEW_LINE> SRP = 4 <NEW_LINE> ISCSI = 5 <NEW_LINE> SAS = 6 <NEW_LINE> ADT = 7 <NEW_LINE> ATA = 8 <NEW_LINE> UAS = 9 <NEW_LINE> SOP = 0xa <NEW_LINE> PCIE = 0xb <NEW_LINE> NONE = 0xf <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return sg_get_trans_proto_str(self)
Transport protocol identifiers or just Protocol identifiers
62598fa701c39578d7f12c9e
class DylanConstantDesc (DylanConstOrVarDesc): <NEW_LINE> <INDENT> display_name = "constant"
A Dylan constant.
62598fa799fddb7c1ca62d78
class InscricaoApnPersistencia(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.swagger_types = { 'device_token': 'str', 'id_aplicacao_mobile': 'int', 'id_cartoes': 'list[int]' } <NEW_LINE> self.attribute_map = { 'device_token': 'deviceToken', 'id_aplicacao_mobile': 'idAplicacaoMobile', 'id_cartoes': 'idCartoes' } <NEW_LINE> self._device_token = None <NEW_LINE> self._id_aplicacao_mobile = None <NEW_LINE> self._id_cartoes = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def device_token(self): <NEW_LINE> <INDENT> return self._device_token <NEW_LINE> <DEDENT> @device_token.setter <NEW_LINE> def device_token(self, device_token): <NEW_LINE> <INDENT> self._device_token = device_token <NEW_LINE> <DEDENT> @property <NEW_LINE> def id_aplicacao_mobile(self): <NEW_LINE> <INDENT> return self._id_aplicacao_mobile <NEW_LINE> <DEDENT> @id_aplicacao_mobile.setter <NEW_LINE> def id_aplicacao_mobile(self, id_aplicacao_mobile): <NEW_LINE> <INDENT> self._id_aplicacao_mobile = id_aplicacao_mobile <NEW_LINE> <DEDENT> @property <NEW_LINE> def id_cartoes(self): <NEW_LINE> <INDENT> return self._id_cartoes <NEW_LINE> <DEDENT> @id_cartoes.setter <NEW_LINE> def id_cartoes(self, id_cartoes): <NEW_LINE> <INDENT> self._id_cartoes = id_cartoes <NEW_LINE> <DEDENT> def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <DEDENT> elif hasattr(value, "to_dict"): <NEW_LINE> <INDENT> result[attr] = value.to_dict() <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result[attr] = value <NEW_LINE> <DEDENT> <DEDENT> return result <NEW_LINE> <DEDENT> def to_str(self): <NEW_LINE> <INDENT> return pformat(self.to_dict()) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.to_str() <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return not self == other
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598fa74428ac0f6e658442
class Session(object): <NEW_LINE> <INDENT> def __init__(self, verbosity, app_data, interpreter, creator, seeder, activators): <NEW_LINE> <INDENT> self._verbosity = verbosity <NEW_LINE> self._app_data = app_data <NEW_LINE> self._interpreter = interpreter <NEW_LINE> self._creator = creator <NEW_LINE> self._seeder = seeder <NEW_LINE> self._activators = activators <NEW_LINE> <DEDENT> @property <NEW_LINE> def verbosity(self): <NEW_LINE> <INDENT> return self._verbosity <NEW_LINE> <DEDENT> @property <NEW_LINE> def interpreter(self): <NEW_LINE> <INDENT> return self._interpreter <NEW_LINE> <DEDENT> @property <NEW_LINE> def creator(self): <NEW_LINE> <INDENT> return self._creator <NEW_LINE> <DEDENT> @property <NEW_LINE> def seeder(self): <NEW_LINE> <INDENT> return self._seeder <NEW_LINE> <DEDENT> @property <NEW_LINE> def activators(self): <NEW_LINE> <INDENT> return self._activators <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> self._create() <NEW_LINE> self._seed() <NEW_LINE> self._activate() <NEW_LINE> self.creator.pyenv_cfg.write() <NEW_LINE> <DEDENT> def _create(self): <NEW_LINE> <INDENT> logging.info("create virtual environment via %s", ensure_text(str(self.creator))) <NEW_LINE> self.creator.run() <NEW_LINE> logging.debug(_DEBUG_MARKER) <NEW_LINE> logging.debug("%s", _Debug(self.creator)) <NEW_LINE> <DEDENT> def _seed(self): <NEW_LINE> <INDENT> if self.seeder is not None and self.seeder.enabled: <NEW_LINE> <INDENT> logging.info("add seed packages via %s", self.seeder) <NEW_LINE> self.seeder.run(self.creator) <NEW_LINE> <DEDENT> <DEDENT> def _activate(self): <NEW_LINE> <INDENT> if self.activators: <NEW_LINE> <INDENT> logging.info( "add activators for %s", ", ".join(type(i).__name__.replace("Activator", "") for i in self.activators), ) <NEW_LINE> for activator in self.activators: <NEW_LINE> <INDENT> activator.generate(self.creator) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __exit__(self, exc_type, exc_val, exc_tb): <NEW_LINE> <INDENT> self._app_data.close()
Represents a virtual environment creation session
62598fa7e1aae11d1e7ce7b3
class AudioDataEntry(Base, AudioDataDefinition): <NEW_LINE> <INDENT> pass
Provides the mapping for AudioData table.
62598fa7d486a94d0ba2beed
class User(UserMixin): <NEW_LINE> <INDENT> pass
flask-login 的 UserMixin 类,实现了 is_authenticated,is_active,is_anonymous 等方法,直接继承
62598fa738b623060ffa8fb7
class OwnedEntities(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> player_id = db.Column(db.Integer, db.ForeignKey('player.id')) <NEW_LINE> entity_id = db.Column(db.Integer, db.ForeignKey('entity.id')) <NEW_LINE> amount = db.Column(db.Integer) <NEW_LINE> def __init__(self, player_id, entity_id, amount): <NEW_LINE> <INDENT> self.player_id = player_id <NEW_LINE> self.entity_id = entity_id <NEW_LINE> self.amount = amount <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def set_owned_amount_for_player(cls, player_id, entity_id, amount): <NEW_LINE> <INDENT> currently_owned = cls.query.filter_by(player_id=player_id, entity_id=entity_id).first() <NEW_LINE> if currently_owned is None: <NEW_LINE> <INDENT> currently_owned = cls(player_id=player_id, entity_id=entity_id, amount=amount) <NEW_LINE> db.session.add(currently_owned) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> currently_owned.amount = amount <NEW_LINE> <DEDENT> db.session.commit() <NEW_LINE> return True
The table containing how much entities are owned by whom
62598fa78da39b475be03102
class MultiverbNewline(Multiverbation, Joiner): <NEW_LINE> <INDENT> pass
=|
62598fa77d43ff2487427392
class ExplicitRungeKutta(ExplicitTimeIntegration): <NEW_LINE> <INDENT> def __init__(self, bc, rate_of_change, tableau): <NEW_LINE> <INDENT> super().__init__(bc, rate_of_change) <NEW_LINE> self.tableau = tableau <NEW_LINE> self.dudt_buffers = None <NEW_LINE> <DEDENT> def __call__(self, u0, t, dt): <NEW_LINE> <INDENT> self.allocate_buffers(u0) <NEW_LINE> k = self.dudt_buffers <NEW_LINE> k[..., 0] = self.rate_of_change(u0, t) <NEW_LINE> for s in range(1, self.tableau.stages): <NEW_LINE> <INDENT> dt_star = self.tableau.c[s] * dt <NEW_LINE> t_star = t + dt_star <NEW_LINE> u_star = u0 + dt * np.sum(self.tableau.a[s, :s] * k[..., :s], axis=-1) <NEW_LINE> self.bc(u_star, t_star) <NEW_LINE> k[..., s] = self.rate_of_change(u_star, t_star) <NEW_LINE> <DEDENT> u1 = u0 + dt * np.sum(self.tableau.b * k, axis=-1) <NEW_LINE> self.bc(u1, t + dt) <NEW_LINE> return u1 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return type(self).__name__ + "(..)" <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "".join([type(self).__name__, "(bc = ", repr(self.bc), ", ", "rate_of_change = ", repr(self.rate_of_change), ", ", "tableau = ", repr(self.tableau), ")"]) <NEW_LINE> <DEDENT> def allocate_buffers(self, u): <NEW_LINE> <INDENT> shape = u.shape + (self.tableau.stages,) <NEW_LINE> if self.dudt_buffers is None or self.dudt_buffers.shape != shape: <NEW_LINE> <INDENT> self.dudt_buffers = np.zeros(shape)
Base class for explicit Runge-Kutta methods. We write Runge-Kutta methods for du/dt = L(u, t) with s-stages as: u[j] = u0 + dt_j * sum_i a[j,i] * k[j] k[j] = L(u[j], t + c[j]*dt) u1 = u0 + dt * sum_j b[j]*k[j]
62598fa7f7d966606f747f04
class Disintegrate(Spell): <NEW_LINE> <INDENT> name = "Disintegrate" <NEW_LINE> level = 6 <NEW_LINE> casting_time = "1 action" <NEW_LINE> casting_range = "60 feet" <NEW_LINE> components = ('V', 'S', 'M') <NEW_LINE> materials = """A lodestone and a pinch of dust""" <NEW_LINE> duration = "Instantaneous" <NEW_LINE> ritual = False <NEW_LINE> magic_school = "Transmutation" <NEW_LINE> classes = ('Sorcerer', 'Wizard')
A thin green ray springs from your pointing finger to a target that you can see within range. The target can be a creature, an object, or a creation of magical force, such as the wall created by wall of force. A creature targeted by this spell must make a Dexterity saving throw. On a failed save, the target takes 10d6 + 40 force damage. If this damage reduces the target to 0 hit points, it is disintegrated. A disintegrated creature and everything it is wearing and carrying, except magic items, are reduced to a pile of fine gray dust. The creature can be restored to life only by means of a true resurrection or a wish spell. This spell automatically disintegrates a Large or smaller nonmagical object or a creation of magical force. If the target is a Huge or larger object or creation of force, this spell disintegrates a 10-foot-cube portion of it. A magic item is unaffected by this spell. At Higher Levels: When you cast this spell using a spell slot of 7th level or higher, the damage increases by 3d6 for each slot level above 6th.
62598fa7e5267d203ee6b82b
@mock.patch("time.sleep") <NEW_LINE> @mock.patch("requests.Session.request") <NEW_LINE> @mock.patch("singer.utils.parse_args") <NEW_LINE> class TestTimeoutAndConnnectionErrorBackoff(unittest.TestCase): <NEW_LINE> <INDENT> def test_timeout_backoff(self, mocked_parse_args, mocked_request, mocked_sleep): <NEW_LINE> <INDENT> mocked_request.side_effect = requests.Timeout <NEW_LINE> mock_config = {} <NEW_LINE> mocked_parse_args.return_value = get_args(mock_config) <NEW_LINE> try: <NEW_LINE> <INDENT> tap_github.authed_get("test_source", "") <NEW_LINE> <DEDENT> except requests.Timeout: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.assertEquals(5, mocked_request.call_count) <NEW_LINE> <DEDENT> def test_connection_error_backoff(self, mocked_parse_args, mocked_request, mocked_sleep): <NEW_LINE> <INDENT> mocked_request.side_effect = requests.ConnectionError <NEW_LINE> mock_config = {} <NEW_LINE> mocked_parse_args.return_value = get_args(mock_config) <NEW_LINE> try: <NEW_LINE> <INDENT> tap_github.authed_get("test_source", "") <NEW_LINE> <DEDENT> except requests.ConnectionError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> self.assertEquals(5, mocked_request.call_count)
Test case to verify that we backoff for 5 times for Connection and Timeout error
62598fa73317a56b869be4da
class ErasureDecoder(Decoder): <NEW_LINE> <INDENT> def __init__(self, code, name=None): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> name = 'ErasureDecoder' <NEW_LINE> <DEDENT> Decoder.__init__(self, code, name) <NEW_LINE> self.fg = FactorGraph.fromLinearCode(code) <NEW_LINE> self.solution = np.zeros(code.blocklength) <NEW_LINE> self.corrected = np.zeros(code.blocklength) <NEW_LINE> <DEDENT> def setStats(self, stats): <NEW_LINE> <INDENT> if 'iterations' not in stats: <NEW_LINE> <INDENT> stats['iterations'] = 0 <NEW_LINE> <DEDENT> Decoder.setStats(self, stats) <NEW_LINE> <DEDENT> def solve(self, lb=-np.inf, ub=np.inf): <NEW_LINE> <INDENT> self.corrected.setfield(-1, np.double) <NEW_LINE> self.objectiveValue = 0 <NEW_LINE> for val, varNode in zip(self.llrs, self.fg.varNodes): <NEW_LINE> <INDENT> varNode.value = -1 + (val != 0) + (val < 0) <NEW_LINE> <DEDENT> for check in self.fg.checkNodes: <NEW_LINE> <INDENT> check.value = sum(1 for varNode in check.neighbors if varNode.value == 1) <NEW_LINE> check.finished = False <NEW_LINE> <DEDENT> for iteration in itertools.count(1): <NEW_LINE> <INDENT> action = False <NEW_LINE> for check in self.fg.checkNodes: <NEW_LINE> <INDENT> if check.finished: <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> erasedNeighbors = [var for var in check.neighbors if var.value == -1] <NEW_LINE> if len(erasedNeighbors) == 1: <NEW_LINE> <INDENT> action = True <NEW_LINE> filledInVar = erasedNeighbors[0] <NEW_LINE> filledInVar.value = self.corrected[filledInVar.identifier] = check.value % 2 <NEW_LINE> self.objectiveValue -= 1 <NEW_LINE> for check2 in erasedNeighbors[0].neighbors: <NEW_LINE> <INDENT> check2.value += 1 <NEW_LINE> <DEDENT> check.finished = True <NEW_LINE> <DEDENT> elif len(erasedNeighbors) == 0: <NEW_LINE> <INDENT> check.finished = True <NEW_LINE> action = True <NEW_LINE> if check.value % 2 != 0: <NEW_LINE> <INDENT> self.objectiveValue = np.inf <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> if not action: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> <DEDENT> self._stats['iterations'] += iteration <NEW_LINE> for i, var in enumerate(self.fg.varNodes): <NEW_LINE> <INDENT> self.solution[i] = var.value
A simple decoder for the binary erasure channel. The decoder behaves a little different than others with respect to the interpretation of LLRs, objective value and solution: * A zero LLR is interpreted as an erasure, any positive value as a guaranteed 0, and any negative value as a guaranteed 1. This has the same effect as multiplying the LLR with :math:`+\infty` in the normal meaning. * The objective value is :math:`-n`, where :math:`n` is the number of filled out erasures. An objective value of :math:`\infty` indicates a contradictory setting at a check, i.e., a degree-2 check with neighbors fixed to 0 and 1, respectively. This can not occur on the BEC but, for instance, in the context of branch-and-bound. * The solution contains entries :math:`-1` at positions that could not be filled out. .. attribute:: corrected Contains 0s and 1s in the positions that were filled out by the algorithm, and -1s otherwise.
62598fa7435de62698e9bd15
class AnalyticsApi(object): <NEW_LINE> <INDENT> def __init__(self, api_client=None): <NEW_LINE> <INDENT> if api_client is None: <NEW_LINE> <INDENT> api_client = ApiClient() <NEW_LINE> <DEDENT> self.api_client = api_client <NEW_LINE> <DEDENT> def aggregate(self, type, **kwargs): <NEW_LINE> <INDENT> kwargs['_return_http_data_only'] = True <NEW_LINE> if kwargs.get('async_req'): <NEW_LINE> <INDENT> return self.aggregate_with_http_info(type, **kwargs) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> (data) = self.aggregate_with_http_info(type, **kwargs) <NEW_LINE> return data <NEW_LINE> <DEDENT> <DEDENT> def aggregate_with_http_info(self, type, **kwargs): <NEW_LINE> <INDENT> all_params = ['type', 'body'] <NEW_LINE> all_params.append('async_req') <NEW_LINE> all_params.append('_return_http_data_only') <NEW_LINE> all_params.append('_preload_content') <NEW_LINE> all_params.append('_request_timeout') <NEW_LINE> params = locals() <NEW_LINE> for key, val in six.iteritems(params['kwargs']): <NEW_LINE> <INDENT> if key not in all_params: <NEW_LINE> <INDENT> raise TypeError( "Got an unexpected keyword argument '%s'" " to method aggregate" % key ) <NEW_LINE> <DEDENT> params[key] = val <NEW_LINE> <DEDENT> del params['kwargs'] <NEW_LINE> if ('type' not in params or params['type'] is None): <NEW_LINE> <INDENT> raise ValueError("Missing the required parameter `type` when calling `aggregate`") <NEW_LINE> <DEDENT> collection_formats = {} <NEW_LINE> path_params = {} <NEW_LINE> if 'type' in params: <NEW_LINE> <INDENT> path_params['type'] = params['type'] <NEW_LINE> <DEDENT> query_params = [] <NEW_LINE> header_params = {} <NEW_LINE> form_params = [] <NEW_LINE> local_var_files = {} <NEW_LINE> body_params = None <NEW_LINE> if 'body' in params: <NEW_LINE> <INDENT> body_params = params['body'] <NEW_LINE> <DEDENT> header_params['Accept'] = self.api_client.select_header_accept( ['application/json']) <NEW_LINE> header_params['Content-Type'] = self.api_client.select_header_content_type( ['application/json']) <NEW_LINE> auth_settings = [] <NEW_LINE> return self.api_client.call_api( '/api2/v1/analytics/{type}', 'POST', path_params, query_params, header_params, body=body_params, post_params=form_params, files=local_var_files, response_type='AnalyticsResponseDto', auth_settings=auth_settings, async_req=params.get('async_req'), _return_http_data_only=params.get('_return_http_data_only'), _preload_content=params.get('_preload_content', True), _request_timeout=params.get('_request_timeout'), collection_formats=collection_formats)
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. Ref: https://github.com/swagger-api/swagger-codegen
62598fa7f548e778e596b4c4
class JudgmentAggregate(JobResource): <NEW_LINE> <INDENT> agreement = RoAttribute(name='_agreement') <NEW_LINE> ids = RoAttribute(name='_ids') <NEW_LINE> state = RoAttribute(name='_state') <NEW_LINE> updated_at = RoAttribute(name='_updated_at') <NEW_LINE> def get_fields(self): <NEW_LINE> <INDENT> return {field: self._json[field] for field in self.job.fields.keys()} <NEW_LINE> <DEDENT> def get_aggregate(self, field): <NEW_LINE> <INDENT> return self._json[field]['agg'] <NEW_LINE> <DEDENT> def get_results(self, field): <NEW_LINE> <INDENT> return self._json[field]['res'] <NEW_LINE> <DEDENT> @property <NEW_LINE> def judgments(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._judgments <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> self._judgments = [self._client.get_judgment(self.job, id_) for id_ in self.ids] <NEW_LINE> return self._judgments
CrowdFlower Judgment aggregate. :param job: :class:`~.job.Job` instance that this :class:`JudgmentAggregate` belongs to :type job: crowdflower.job.Job :param client: :class:`~.client.Client` instance :type client: crowdflower.client.Client :param data: Job JSON dictionary :type data: dict
62598fa7236d856c2adc93cc
class Worker(Base): <NEW_LINE> <INDENT> __tablename__ = "worker" <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> phone_number = Column(String) <NEW_LINE> worker_id = Column(String) <NEW_LINE> def __init__(self, phone_number, worker_id): <NEW_LINE> <INDENT> self.phone_number = phone_number <NEW_LINE> self.worker_id = worker_id <NEW_LINE> <DEDENT> def get_submissions_since(self, session, timestamp): <NEW_LINE> <INDENT> return session.query(Submission).filter(and_(Submission.worker==self, Submission.timestamp >= timestamp))
Holds data about workers that had worked.
62598fa73d592f4c4edbaded
class Status(models.Model): <NEW_LINE> <INDENT> description = models.CharField( max_length=1024, help_text='Описание типа задания' ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_table = 'statuses' <NEW_LINE> verbose_name = 'Статус задачи' <NEW_LINE> verbose_name_plural = 'Статусы задачи'
Модель данных статуса задания
62598fa7d58c6744b42dc265
class MAVLink_component_state_message(MAVLink_message): <NEW_LINE> <INDENT> id = MAVLINK_MSG_ID_COMPONENT_STATE <NEW_LINE> name = 'COMPONENT_STATE' <NEW_LINE> fieldnames = ['time_usec', 'heaters', 'nichrome_wire'] <NEW_LINE> ordered_fieldnames = [ 'time_usec', 'heaters', 'nichrome_wire' ] <NEW_LINE> format = '<QBB' <NEW_LINE> native_format = bytearray('<QBB', 'ascii') <NEW_LINE> orders = [0, 1, 2] <NEW_LINE> lengths = [1, 1, 1] <NEW_LINE> array_lengths = [0, 0, 0] <NEW_LINE> crc_extra = 133 <NEW_LINE> def __init__(self, time_usec, heaters, nichrome_wire): <NEW_LINE> <INDENT> MAVLink_message.__init__(self, MAVLink_component_state_message.id, MAVLink_component_state_message.name) <NEW_LINE> self._fieldnames = MAVLink_component_state_message.fieldnames <NEW_LINE> self.time_usec = time_usec <NEW_LINE> self.heaters = heaters <NEW_LINE> self.nichrome_wire = nichrome_wire <NEW_LINE> <DEDENT> def pack(self, mav, force_mavlink1=False): <NEW_LINE> <INDENT> return MAVLink_message.pack(self, mav, 133, struct.pack('<QBB', self.time_usec, self.heaters, self.nichrome_wire), force_mavlink1=force_mavlink1)
The state of the different components onboard the balloon
62598fa7a8370b77170f02fb
class HedcoPanel(DevPanel): <NEW_LINE> <INDENT> def onSelect(self, e): <NEW_LINE> <INDENT> num = int(e.GetEventObject().GetName()) <NEW_LINE> hedco.change([num, num]) <NEW_LINE> <DEDENT> def __init__(self, parent, *args, **kwargs): <NEW_LINE> <INDENT> DevPanel.__init__(self, parent, dev = 'hedco', *args, **kwargs) <NEW_LINE> sizer = wx.GridSizer(cols = 8) <NEW_LINE> buttons = [] <NEW_LINE> for i in range(16): <NEW_LINE> <INDENT> button = wx.Button(self, label = str(i + 1), name = str(i + 1)) <NEW_LINE> buttons.append(button) <NEW_LINE> sizer.Add(button) <NEW_LINE> self.Bind(wx.EVT_BUTTON, self.onSelect, button) <NEW_LINE> <DEDENT> self.SetSizer(sizer)
Panel for control of Hedco.
62598fa792d797404e388af5
class VolumeConfigMapKeyToPath(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Key = None <NEW_LINE> self.Path = None <NEW_LINE> self.Mode = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Key = params.get("Key") <NEW_LINE> self.Path = params.get("Path") <NEW_LINE> self.Mode = params.get("Mode") <NEW_LINE> memeber_set = set(params.keys()) <NEW_LINE> for name, value in vars(self).items(): <NEW_LINE> <INDENT> if name in memeber_set: <NEW_LINE> <INDENT> memeber_set.remove(name) <NEW_LINE> <DEDENT> <DEDENT> if len(memeber_set) > 0: <NEW_LINE> <INDENT> warnings.warn("%s fileds are useless." % ",".join(memeber_set))
ConfigMap的key挂载到路径
62598fa7009cb60464d0143f
class Pay(PaypalAdaptiveEndpoint): <NEW_LINE> <INDENT> url = '%s%s' % (settings.PAYPAL_ENDPOINT, 'Pay') <NEW_LINE> error_class = PayError <NEW_LINE> def prepare_data(self, money, return_url, cancel_url, receivers, ipn_url=None, **kwargs): <NEW_LINE> <INDENT> if (not money or not isinstance(money, Money) or money <= Money('0.00', money.currency)): <NEW_LINE> <INDENT> raise ValueError("amount must be a positive instance of Money") <NEW_LINE> <DEDENT> if (not isinstance(receivers, ReceiverList) or len(receivers) < 1): <NEW_LINE> <INDENT> raise ValueError("receivers must be an instance of ReceiverList") <NEW_LINE> <DEDENT> data = {'actionType': 'PAY', 'currencyCode': money.currency.code, 'returnUrl': return_url, 'cancelUrl': cancel_url} <NEW_LINE> receiverList = {'receiver': receivers.to_dict()} <NEW_LINE> data.update({'receiverList': receiverList}) <NEW_LINE> if ipn_url: <NEW_LINE> <INDENT> data.update({'ipnNotificationUrl': ipn_url}) <NEW_LINE> <DEDENT> if kwargs: <NEW_LINE> <INDENT> data.update(**kwargs) <NEW_LINE> <DEDENT> return data <NEW_LINE> <DEDENT> @property <NEW_LINE> def status(self): <NEW_LINE> <INDENT> return self.response.get('paymentExecStatus', None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def paykey(self): <NEW_LINE> <INDENT> return self.response.get('payKey', None)
Models the Pay API operation
62598fa791af0d3eaad39d2f
class BHShannon_MaxEnt2(InitX, VerOneDSignal): <NEW_LINE> <INDENT> def estimation(self, y): <NEW_LINE> <INDENT> self.verification_one_d_signal(y) <NEW_LINE> num_of_samples = y.shape[0] <NEW_LINE> y = y - mean(y) <NEW_LINE> s = sqrt(sum(y**2) / (num_of_samples - 1)) <NEW_LINE> y /= s <NEW_LINE> h_whiten = log(s) <NEW_LINE> h1 = (1 + log(2 * pi)) / 2 <NEW_LINE> k1 = 36 / (8 * sqrt(3) - 9) <NEW_LINE> k2b = 24 / (16 * sqrt(3) - 27) <NEW_LINE> h2 = k1 * mean(y * exp(-y**2 / 2))**2 + k2b * (mean(exp(-y**2 / 2)) - sqrt(1/2))**2 <NEW_LINE> h = h1 - h2 <NEW_LINE> h += h_whiten <NEW_LINE> return h
Maximum entropy distribution based Shannon entropy estimator. The used Gi functions are G1(x) = x exp(-x^2/2) and G2(x) = exp(-x^2/2). Initialization is inherited from 'InitX', verification comes from 'VerOneDSignal' (see 'ite.cost.x_initialization.py', 'ite.cost.x_verification.py'). Examples -------- >>> import ite >>> co = ite.cost.BHShannon_MaxEnt2()
62598fa7d7e4931a7ef3bfbc
class FlairList(Templated): <NEW_LINE> <INDENT> def __init__(self, num, after, reverse, name, user): <NEW_LINE> <INDENT> Templated.__init__(self, num=num, after=after, reverse=reverse, name=name, user=user) <NEW_LINE> <DEDENT> @property <NEW_LINE> def flair(self): <NEW_LINE> <INDENT> if self.user: <NEW_LINE> <INDENT> return [FlairListRow(self.user)] <NEW_LINE> <DEDENT> if self.name: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> query = Flair.flair_id_query(c.site, self.num + 1, self.after, self.reverse) <NEW_LINE> flair_rows = list(query) <NEW_LINE> if len(flair_rows) > self.num: <NEW_LINE> <INDENT> next_page = flair_rows.pop() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> next_page = None <NEW_LINE> <DEDENT> uids = [row._thing2_id for row in flair_rows] <NEW_LINE> users = Account._byID(uids, data=True) <NEW_LINE> users = {id: u for id, u in users.iteritems() if not u._deleted} <NEW_LINE> result = [FlairListRow(users[row._thing2_id]) for row in flair_rows if row._thing2_id in users] <NEW_LINE> links = [] <NEW_LINE> if self.after: <NEW_LINE> <INDENT> links.append( FlairNextLink(result[0].user._fullname, reverse=not self.reverse, needs_border=bool(next_page))) <NEW_LINE> <DEDENT> if next_page: <NEW_LINE> <INDENT> links.append( FlairNextLink(result[-1].user._fullname, reverse=self.reverse)) <NEW_LINE> <DEDENT> if self.reverse: <NEW_LINE> <INDENT> result.reverse() <NEW_LINE> links.reverse() <NEW_LINE> if len(links) == 2 and links[1].needs_border: <NEW_LINE> <INDENT> links[0].needs_border = True <NEW_LINE> links[1].needs_border = False <NEW_LINE> <DEDENT> <DEDENT> return result + links
List of users who are tagged with flair within a subreddit.
62598fa7cc0a2c111447af31
class FeedParser(object): <NEW_LINE> <INDENT> def __init__(self, _cls): <NEW_LINE> <INDENT> self.feed_class = _cls <NEW_LINE> self._reset() <NEW_LINE> <DEDENT> def _reset(self): <NEW_LINE> <INDENT> self.feed_elements = [] <NEW_LINE> self.tag_stack = [] <NEW_LINE> self.roots = [] <NEW_LINE> <DEDENT> def _find_element_class(self, tag): <NEW_LINE> <INDENT> if len(self.feed_elements) > 0: <NEW_LINE> <INDENT> if self.feed_elements[-1] is not None: <NEW_LINE> <INDENT> return getattr(self.feed_elements[-1], tag, None) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return getattr(self.feed_class, tag, None) <NEW_LINE> <DEDENT> <DEDENT> return getattr(self.feed_class, tag, None) <NEW_LINE> <DEDENT> def start(self, tag, attributes): <NEW_LINE> <INDENT> self.tag_stack.append(tag) <NEW_LINE> cls = self._find_element_class(tag) <NEW_LINE> if cls is not None: <NEW_LINE> <INDENT> self.feed_elements.append(cls(**attributes)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.feed_elements.append(None) <NEW_LINE> <DEDENT> <DEDENT> def data(self, data): <NEW_LINE> <INDENT> element = self.feed_elements[-1] <NEW_LINE> if element is not None: <NEW_LINE> <INDENT> element.add_data(data) <NEW_LINE> <DEDENT> <DEDENT> def end(self, tag): <NEW_LINE> <INDENT> ending_element = self.feed_elements.pop() <NEW_LINE> _ = self.tag_stack.pop() <NEW_LINE> if ending_element is None: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if len(self.feed_elements) > 0: <NEW_LINE> <INDENT> if self.feed_elements[-1] is not None: <NEW_LINE> <INDENT> self.feed_elements[-1].add_child(ending_element) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.roots.append(ending_element) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def close(self): <NEW_LINE> <INDENT> roots = self.roots <NEW_LINE> self._reset() <NEW_LINE> return roots
Target parser class for XML document with known structure.
62598fa70c0af96317c562a3
class _Run(object): <NEW_LINE> <INDENT> def init_params(parameters): <NEW_LINE> <INDENT> Atom_params = { 'Argon': {'Cl': 2.44, 'I_p': 0.579, 'Z_c': 1, 'l': 1, 'alpha': 9}, 'Neon': {'Cl': 2.10, 'I_p': 0.793, 'Z_c': 1, 'l': 1, 'alpha': 9}, 'Helium':{'Cl': 3.13, 'I_p': 0.904, 'Z_c': 1, 'l': 0, 'alpha': 7}} <NEW_LINE> ADK_params = Atom_params[parameters['Atom']] <NEW_LINE> t, dt = np.linspace(-parameters['mintime'],parameters['maxtime'], parameters['timesteps'],retstep=True) <NEW_LINE> pbins = _Ionization.p_bins(parameters['pmax'],parameters['npbins']) <NEW_LINE> delays = np.linspace(-50,50,parameters['delaysteps'],endpoint=False) <NEW_LINE> return ADK_params, t, dt, pbins, delays <NEW_LINE> <DEDENT> def calculation(delay,nI,pbins,npbins,timesteps, laser_parameters): <NEW_LINE> <INDENT> output = _Ionization.final_distribution_intensity_atoms(nI,pbins, npbins, delay,timesteps,laser_parameters) <NEW_LINE> S_avg = _Avg.focus_avg(output[0]) <NEW_LINE> p_avg = _Avg.focus_avg(output[6]) <NEW_LINE> output = output + (S_avg,p_avg,) <NEW_LINE> return output <NEW_LINE> <DEDENT> def main(delaysteps, npbins, timesteps, nI, pbins, laser_parameters): <NEW_LINE> <INDENT> averaged_dist = np.zeros((delaysteps,npbins)) <NEW_LINE> E_fields = np.zeros((delaysteps,timesteps)) <NEW_LINE> inputs = (nI,pbins,npbins,timesteps,laser_parameters) <NEW_LINE> num_cores = multiprocessing.cpu_count() <NEW_LINE> outputs = Parallel(n_jobs=num_cores)(delayed(_Run.calculation)(delay, *inputs) for delay in delays) <NEW_LINE> for i in range(delaysteps): <NEW_LINE> <INDENT> averaged_dist[i,:] = outputs[i][7] <NEW_LINE> E_fields[i,:] = outputs[i][5] <NEW_LINE> <DEDENT> asymmetry = (averaged_dist,) + (E_fields,) <NEW_LINE> return outputs, asymmetry
docstring for _Run
62598fa73539df3088ecc1d5
class Settings(object): <NEW_LINE> <INDENT> def __init__(self, path='%s/.github2hackpad' % os.environ['HOME'], config={}): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.config = {} <NEW_LINE> try: <NEW_LINE> <INDENT> with open(self.path, 'r') as f: <NEW_LINE> <INDENT> file_contents = yaml.load(f) <NEW_LINE> if file_contents: <NEW_LINE> <INDENT> self.config = file_contents <NEW_LINE> <DEDENT> self.set(config) <NEW_LINE> <DEDENT> <DEDENT> except IOError: <NEW_LINE> <INDENT> self.clear() <NEW_LINE> <DEDENT> <DEDENT> def save(self): <NEW_LINE> <INDENT> with open(self.path, 'w') as f: <NEW_LINE> <INDENT> yaml.dump(self.config, f) <NEW_LINE> <DEDENT> <DEDENT> def set(self, github_user='', github_password='', github_org='', github_label='', github_projects=[], hackpad_key='', hackpad_secret='', hackpad_subdomain='', hackpad_title='', format_section_sep='\n', format_item_sep='\n'): <NEW_LINE> <INDENT> for k, v in locals().iteritems(): <NEW_LINE> <INDENT> if v: <NEW_LINE> <INDENT> self.config[k] = v <NEW_LINE> <DEDENT> <DEDENT> self.save() <NEW_LINE> <DEDENT> def get(self, var, default=''): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self.config[var] <NEW_LINE> <DEDENT> except LookupError as e: <NEW_LINE> <INDENT> if default: <NEW_LINE> <INDENT> return default <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception('%s var is not set!' % var) <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> def clear(self): <NEW_LINE> <INDENT> open(self.path, 'w').close()
Credentials handling class; for to not write down my keys and secrets in a public repository.
62598fa74527f215b58e9e03
class GenerateStub(object): <NEW_LINE> <INDENT> def __init__(self, channel): <NEW_LINE> <INDENT> self.GenerateParticles = channel.unary_stream( '/Generate/GenerateParticles', request_serializer=proto_dot_particle__system__pb2.RenderInstructions.SerializeToString, response_deserializer=proto_dot_particle__system__pb2.Frame.FromString, )
Missing associated documentation comment in .proto file
62598fa77d847024c075c2e5
class ListenerEvent(Enum): <NEW_LINE> <INDENT> COMMAND = "command" <NEW_LINE> EXEC = "exec" <NEW_LINE> INIT = "init" <NEW_LINE> LOAD = "load" <NEW_LINE> MODIFY = "modify" <NEW_LINE> NEW = "new" <NEW_LINE> PASTE = "paste" <NEW_LINE> RELOAD = "reload" <NEW_LINE> REVERT = "revert" <NEW_LINE> SAVE = "save" <NEW_LINE> UNTRANSIENTIZE = "untransientize" <NEW_LINE> def __str__(self) -> str: <NEW_LINE> <INDENT> return str(self._value_) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_value(cls, value: Any) -> Optional[ListenerEvent]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return cls(value) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None
Events used in AutoSetSyntax.
62598fa71b99ca400228f4c0
class AddUserAskView(View): <NEW_LINE> <INDENT> def post(self, request): <NEW_LINE> <INDENT> userask_form = UserAskForm(request.POST) <NEW_LINE> if userask_form.is_valid(): <NEW_LINE> <INDENT> user_ask = userask_form.save(commit=True) <NEW_LINE> return HttpResponse('{"status":"success"}', content_type='application/json') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return HttpResponse('{"status": "fail", "msg": "添加出错"}', content_type='application/json')
用户添加咨询
62598fa730dc7b766599f76f
class OutboundRule(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'allocated_outbound_ports': {'key': 'properties.allocatedOutboundPorts', 'type': 'int'}, 'frontend_ip_configurations': {'key': 'properties.frontendIPConfigurations', 'type': '[SubResource]'}, 'backend_address_pool': {'key': 'properties.backendAddressPool', 'type': 'SubResource'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'enable_tcp_reset': {'key': 'properties.enableTcpReset', 'type': 'bool'}, 'idle_timeout_in_minutes': {'key': 'properties.idleTimeoutInMinutes', 'type': 'int'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(OutboundRule, self).__init__(**kwargs) <NEW_LINE> self.name = kwargs.get('name', None) <NEW_LINE> self.etag = None <NEW_LINE> self.type = None <NEW_LINE> self.allocated_outbound_ports = kwargs.get('allocated_outbound_ports', None) <NEW_LINE> self.frontend_ip_configurations = kwargs.get('frontend_ip_configurations', None) <NEW_LINE> self.backend_address_pool = kwargs.get('backend_address_pool', None) <NEW_LINE> self.provisioning_state = None <NEW_LINE> self.protocol = kwargs.get('protocol', None) <NEW_LINE> self.enable_tcp_reset = kwargs.get('enable_tcp_reset', None) <NEW_LINE> self.idle_timeout_in_minutes = kwargs.get('idle_timeout_in_minutes', None)
Outbound rule of the load balancer. Variables are only populated by the server, and will be ignored when sending a request. :param id: Resource ID. :type id: str :param name: The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource. :type name: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar type: Type of the resource. :vartype type: str :param allocated_outbound_ports: The number of outbound ports to be used for NAT. :type allocated_outbound_ports: int :param frontend_ip_configurations: The Frontend IP addresses of the load balancer. :type frontend_ip_configurations: list[~azure.mgmt.network.v2020_07_01.models.SubResource] :param backend_address_pool: A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. :type backend_address_pool: ~azure.mgmt.network.v2020_07_01.models.SubResource :ivar provisioning_state: The provisioning state of the outbound rule resource. Possible values include: "Succeeded", "Updating", "Deleting", "Failed". :vartype provisioning_state: str or ~azure.mgmt.network.v2020_07_01.models.ProvisioningState :param protocol: The protocol for the outbound rule in load balancer. Possible values include: "Tcp", "Udp", "All". :type protocol: str or ~azure.mgmt.network.v2020_07_01.models.LoadBalancerOutboundRuleProtocol :param enable_tcp_reset: Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. :type enable_tcp_reset: bool :param idle_timeout_in_minutes: The timeout for the TCP idle connection. :type idle_timeout_in_minutes: int
62598fa785dfad0860cbfa05
class V1FlockerVolumeSource(object): <NEW_LINE> <INDENT> def __init__(self, datasetName=None): <NEW_LINE> <INDENT> self.swagger_types = { 'datasetName': 'str' } <NEW_LINE> self.attribute_map = { 'datasetName': 'datasetName' } <NEW_LINE> self._datasetName = datasetName <NEW_LINE> <DEDENT> @property <NEW_LINE> def datasetName(self): <NEW_LINE> <INDENT> return self._datasetName <NEW_LINE> <DEDENT> @datasetName.setter <NEW_LINE> def datasetName(self, datasetName): <NEW_LINE> <INDENT> self._datasetName = datasetName <NEW_LINE> <DEDENT> def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in iteritems(self.swagger_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <DEDENT> elif hasattr(value, "to_dict"): <NEW_LINE> <INDENT> result[attr] = value.to_dict() <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result[attr] = value <NEW_LINE> <DEDENT> <DEDENT> return result <NEW_LINE> <DEDENT> def to_str(self): <NEW_LINE> <INDENT> return pformat(self.to_dict()) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.to_str() <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return not self == other
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598fa7656771135c4895a3
class HomematicipPassageDetectorDeltaCounter(HomematicipGenericEntity, SensorEntity): <NEW_LINE> <INDENT> @property <NEW_LINE> def native_value(self) -> int: <NEW_LINE> <INDENT> return self._device.leftRightCounterDelta <NEW_LINE> <DEDENT> @property <NEW_LINE> def extra_state_attributes(self) -> dict[str, Any]: <NEW_LINE> <INDENT> state_attr = super().extra_state_attributes <NEW_LINE> state_attr[ATTR_LEFT_COUNTER] = self._device.leftCounter <NEW_LINE> state_attr[ATTR_RIGHT_COUNTER] = self._device.rightCounter <NEW_LINE> return state_attr
Representation of the HomematicIP passage detector delta counter.
62598fa760cbc95b0636426e
class Resnet_SIIS(BasicModule): <NEW_LINE> <INDENT> def __init__(self, num_classes=2, siis_size=[32, 32], width=1, kw=9, dim=128, arch=1, resnet_arch='resnet50', output_stride=8, layer_num=2): <NEW_LINE> <INDENT> super(Resnet_SIIS, self).__init__() <NEW_LINE> self.siis_size = siis_size <NEW_LINE> self.output_stride = output_stride <NEW_LINE> self.layer_num = layer_num <NEW_LINE> if resnet_arch == 'resnet50': <NEW_LINE> <INDENT> encoder = resnet.resnet50(True, output_stride=self.output_stride) <NEW_LINE> <DEDENT> elif resnet_arch == 'resnet101': <NEW_LINE> <INDENT> encoder = resnet.resnet101(True, output_stride=self.output_stride) <NEW_LINE> <DEDENT> encoder = encoder._modules <NEW_LINE> self.conv1 = nn.Sequential(encoder['conv1'], encoder['bn1'], encoder['relu']) <NEW_LINE> self.pool1 = encoder['maxpool'] <NEW_LINE> self.layers = nn.Sequential() <NEW_LINE> for i in range(layer_num): <NEW_LINE> <INDENT> self.layers.add_module('layer%d' % (i+1), encoder['layer%d' % (i+1)]) <NEW_LINE> <DEDENT> layers_dim = [256, 512, 1024, 2048, 2048, 1024, 512] <NEW_LINE> self.conv_s = self._make_layer(layers_dim[layer_num-1], dim, 1) <NEW_LINE> self.siis = SIIS(siis_size, width, kw, dim, arch) <NEW_LINE> self.decoder_conv1 = self._make_layer(dim, dim, 3, padding=1) <NEW_LINE> self.decoder_conv2 = self._make_layer(dim, dim, 3, padding=1) <NEW_LINE> self.out_conv = nn.Conv2d(dim, num_classes, 1, 1) <NEW_LINE> self.model_name = resnet_arch + self.siis.name <NEW_LINE> <DEDENT> def _make_layer(self, in_channel, out_channel, kernel_size, padding=0): <NEW_LINE> <INDENT> return nn.Sequential( nn.Conv2d(in_channel, out_channel, kernel_size, 1, padding=padding), nn.BatchNorm2d(out_channel), nn.ReLU(inplace=True) ) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> size = x.shape[2:] <NEW_LINE> x = self.conv1(x) <NEW_LINE> x = self.pool1(x) <NEW_LINE> size_4 = x.shape[2:] <NEW_LINE> x = self.layers(x) <NEW_LINE> x = self.conv_s(x) <NEW_LINE> if list(x.shape[2:]) != self.siis_size: <NEW_LINE> <INDENT> x = resize(x, newsize=self.siis_size) <NEW_LINE> <DEDENT> x = self.siis(x) <NEW_LINE> x = self.decoder_conv1(x) <NEW_LINE> x = resize(x, newsize=size_4) <NEW_LINE> x = self.decoder_conv2(x) <NEW_LINE> x = resize(x, newsize=size) <NEW_LINE> x = self.out_conv(x) <NEW_LINE> return x
Main module: Resnet_SIIS
62598fa75fdd1c0f98e5deba
class MyLayout(Widget): <NEW_LINE> <INDENT> checks = [] <NEW_LINE> def checkbox_click(self, instance, value, topping): <NEW_LINE> <INDENT> if value: <NEW_LINE> <INDENT> MyLayout.checks.append(topping) <NEW_LINE> tops = '' <NEW_LINE> for i in MyLayout.checks: <NEW_LINE> <INDENT> tops = f"{tops} {i}" <NEW_LINE> <DEDENT> self.ids.output_label.text = f"Vous avez sélectionné : {tops}" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> MyLayout.checks.remove(topping) <NEW_LINE> tops = '' <NEW_LINE> for i in MyLayout.checks: <NEW_LINE> <INDENT> tops = f"{tops} {i}" <NEW_LINE> <DEDENT> self.ids.output_label.text = f"Vous avez sélectionné : {tops}"
Assignation d'une liste vide
62598fa7379a373c97d98f33
class RuleBasedModel: <NEW_LINE> <INDENT> def __init__(self, mol_defs: List[MolDef], initial_conditions: List[InitialCondition], parameters: List[Parameter], observables: List[Observable], rules: List[Rule]) -> None: <NEW_LINE> <INDENT> self.mol_defs, self.initial_conditions, self.parameters, self.observables, self.rules = mol_defs, initial_conditions, parameters, observables, rules <NEW_LINE> <DEDENT> @property <NEW_LINE> def rate_parameters(self) -> List[Parameter]: <NEW_LINE> <INDENT> return sorted(set(rule.rate for rule in self.rules), key=lambda x: x.name)
RuleBasedModel holds everything that is necessary to define a full RBM.
62598fa73539df3088ecc1d6
class DAQProvider(object): <NEW_LINE> <INDENT> LINE_PATTERN = re.compile("^[a-zA-Z0-9+-.,:()=$/#?!%_@*|~' ]*[\n\r]*$") <NEW_LINE> def __init__(self, logger=None): <NEW_LINE> <INDENT> if logger is None: <NEW_LINE> <INDENT> logger = logging.getLogger() <NEW_LINE> <DEDENT> self.logger = logger <NEW_LINE> self.out_queue = mp.Queue() <NEW_LINE> self.in_queue = mp.Queue() <NEW_LINE> self.daq = DAQConnection(self.in_queue, self.out_queue, self.logger) <NEW_LINE> self.read_thread = mp.Process(target=self.daq.read, name="pREADER") <NEW_LINE> self.read_thread.daemon = True <NEW_LINE> self.read_thread.start() <NEW_LINE> self.write_thread = mp.Process(target=self.daq.write, name="pWRITER") <NEW_LINE> self.write_thread.daemon = True <NEW_LINE> self.write_thread.start() <NEW_LINE> <DEDENT> def get(self, *args): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> line = self.out_queue.get(*args) <NEW_LINE> <DEDENT> except queue.Empty: <NEW_LINE> <INDENT> raise DAQIOError("Queue is empty") <NEW_LINE> <DEDENT> return self.validate_line(line) <NEW_LINE> <DEDENT> def put(self, *args): <NEW_LINE> <INDENT> self.in_queue.put(*args) <NEW_LINE> <DEDENT> def data_available(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> size = self.out_queue.qsize() <NEW_LINE> <DEDENT> except NotImplementedError: <NEW_LINE> <INDENT> self.logger.debug("Running macOS version of muonic") <NEW_LINE> size = not self.out_queue.empty() <NEW_LINE> <DEDENT> return size <NEW_LINE> <DEDENT> def validate_line(self, line): <NEW_LINE> <INDENT> if self.LINE_PATTERN.match(line.decode("ascii")) is None: <NEW_LINE> <INDENT> line = line.rstrip('\r\n') <NEW_LINE> self.logger.warning(f"Got invalid data from the DAQ card: {line}") <NEW_LINE> return None <NEW_LINE> <DEDENT> return line
Class providing the public API and helpers for the communication with the DAQ card
62598fa7f7d966606f747f06
class FirewallRule(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def fw_ipv4_access_rules(self): <NEW_LINE> <INDENT> return rule_collection( self.get_relation('fw_ipv4_access_rules'), IPv4Rule) <NEW_LINE> <DEDENT> @property <NEW_LINE> def fw_ipv4_nat_rules(self): <NEW_LINE> <INDENT> return rule_collection( self.get_relation('fw_ipv4_nat_rules'), IPv4NATRule) <NEW_LINE> <DEDENT> @property <NEW_LINE> def fw_ipv6_access_rules(self): <NEW_LINE> <INDENT> return rule_collection( self.get_relation('fw_ipv6_access_rules'), IPv6Rule) <NEW_LINE> <DEDENT> @property <NEW_LINE> def fw_ipv6_nat_rules(self): <NEW_LINE> <INDENT> return rule_collection( self.get_relation('fw_ipv6_nat_rules'), IPv6NATRule)
Encapsulates all references to firewall rule related entry points. This is referenced by multiple classes such as FirewallPolicy and FirewallPolicyTemplate.
62598fa7d7e4931a7ef3bfbd
class TestMissing(unittest.TestCase): <NEW_LINE> <INDENT> def test_representation(self): <NEW_LINE> <INDENT> value = _MISSING <NEW_LINE> self.assertEqual(str(value), "<MISSING CONFIGURATION>") <NEW_LINE> <DEDENT> def test_exception_default(self): <NEW_LINE> <INDENT> exception = MissingConfigurationException("MY_VALUE") <NEW_LINE> self.assertEqual(exception.name, "MY_VALUE") <NEW_LINE> self.assertEqual(str(exception), "Configuration 'MY_VALUE' is not present in environment") <NEW_LINE> <DEDENT> def test_exception_custom_message(self): <NEW_LINE> <INDENT> exception = MissingConfigurationException("MY_VALUE", "Invalid Configuration! Please provide MY_VALUE.") <NEW_LINE> self.assertEqual(exception.name, "MY_VALUE") <NEW_LINE> self.assertEqual(str(exception), "Invalid Configuration! Please provide MY_VALUE.")
Pointless tests for code coverage
62598fa7dd821e528d6d8e57
class ReportArticlesSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = ReportArticle <NEW_LINE> fields = ('article', 'user', 'report_msg')
This class adds a model serializer for reporting article
62598fa7b7558d5895463551
class OBJECT_OT_wf_fix_materials(Operator, AddObjectHelper): <NEW_LINE> <INDENT> bl_idname = 'mesh.wf_fix_materials' <NEW_LINE> bl_label = 'WF Material Generator' <NEW_LINE> bl_category = 'WorldForge' <NEW_LINE> @classmethod <NEW_LINE> def poll(cls, context): <NEW_LINE> <INDENT> obj = context.active_object <NEW_LINE> return obj is not None <NEW_LINE> <DEDENT> def execute(self, context): <NEW_LINE> <INDENT> OMM = OgreMaterialManager() <NEW_LINE> OMM.wf_fix_materials(self) <NEW_LINE> return {'FINISHED'}
Generates OGRE required material files for textures
62598fa7236d856c2adc93cd
class OpencartBinding(models.AbstractModel): <NEW_LINE> <INDENT> _name = 'opencart.binding' <NEW_LINE> _inherit = 'external.binding' <NEW_LINE> _description = 'OpenCart Binding (abstract)' <NEW_LINE> backend_id = fields.Many2one( comodel_name='opencart.backend', string='OpenCart Backend', required=True, ondelete='restrict', ) <NEW_LINE> external_id = fields.Char(string='ID on OpenCart') <NEW_LINE> _sql_constraints = [ ('opencart_uniq', 'unique(backend_id, external_id)', 'A binding already exists with the same OpenCart ID.'), ] <NEW_LINE> @job(default_channel='root.opencart') <NEW_LINE> @api.model <NEW_LINE> def import_batch(self, backend, filters=None, results_per_page=None, current_page=None): <NEW_LINE> <INDENT> if filters is None: <NEW_LINE> <INDENT> filters = {} <NEW_LINE> <DEDENT> with backend.work_on(self._name) as work: <NEW_LINE> <INDENT> importer = work.component(usage='batch.importer') <NEW_LINE> return importer.run(filters=filters, results_per_page=results_per_page, current_page=current_page) <NEW_LINE> <DEDENT> <DEDENT> @job(default_channel='root.opencart') <NEW_LINE> @related_action(action='related_action_opencart_link') <NEW_LINE> @api.model <NEW_LINE> def import_record(self, backend, external_id, force=False): <NEW_LINE> <INDENT> with backend.work_on(self._name) as work: <NEW_LINE> <INDENT> importer = work.component(usage='record.importer') <NEW_LINE> return importer.run(external_id, force=force) <NEW_LINE> <DEDENT> <DEDENT> @job(default_channel='root.opencart') <NEW_LINE> @related_action(action='related_action_unwrap_binding') <NEW_LINE> def export_record(self, fields=None): <NEW_LINE> <INDENT> self.ensure_one() <NEW_LINE> with self.backend_id.work_on(self._name) as work: <NEW_LINE> <INDENT> exporter = work.component(usage='record.exporter') <NEW_LINE> return exporter.run(self, fields) <NEW_LINE> <DEDENT> <DEDENT> @job(default_channel='root.opencart') <NEW_LINE> @related_action(action='related_action_opencart_link') <NEW_LINE> def export_delete_record(self, backend, external_id): <NEW_LINE> <INDENT> with backend.work_on(self._name) as work: <NEW_LINE> <INDENT> deleter = work.component(usage='record.exporter.deleter') <NEW_LINE> return deleter.run(external_id)
Abstract Model for the Bindings. All of the models used as bindings between OpenCart and Odoo (such as ``opencart.res.partner``, ``opencart.product.product``, etc.) should ``_inherit`` it.
62598fa7be383301e025371a
class TypeDefinitions(api_types.Base): <NEW_LINE> <INDENT> type_definition_links = [common_types.Link] <NEW_LINE> def __init__(self, **kwds): <NEW_LINE> <INDENT> super(TypeDefinitions, self).__init__(**kwds)
CAMP v1.1 type_definitions resource.
62598fa73d592f4c4edbadef
class FunctionFilter(Filter): <NEW_LINE> <INDENT> function = None <NEW_LINE> def __init__(self, **options): <NEW_LINE> <INDENT> if not hasattr(self, 'function'): <NEW_LINE> <INDENT> raise TypeError('%r used without bound function' % self.__class__.__name__) <NEW_LINE> <DEDENT> Filter.__init__(self, **options) <NEW_LINE> <DEDENT> def filter(self, lexer, stream): <NEW_LINE> <INDENT> yield from self.function(lexer, stream, self.options)
Abstract class used by `simplefilter` to create simple function filters on the fly. The `simplefilter` decorator automatically creates subclasses of this class for functions passed to it.
62598fa797e22403b383ae2e
class TetOpSplit(stepslib._py_TetOpSplitP, _Base_Solver) : <NEW_LINE> <INDENT> def run(self, end_time, cp_interval=0.0, prefix=""): <NEW_LINE> <INDENT> self._advance_checkpoint_run(end_time, cp_interval, prefix, 'tetopsplitP' ) <NEW_LINE> <DEDENT> def advance(self, advance_time, cp_interval=0.0, prefix=""): <NEW_LINE> <INDENT> end_time = self.getTime() + advance_time <NEW_LINE> self._advance_checkpoint_run(end_time, cp_interval, prefix, 'tetopsplitP') <NEW_LINE> <DEDENT> def getIndexMapping(self): <NEW_LINE> <INDENT> return self._getIndexMapping()
Construction:: sim = steps.solver.TetOpSplit(model, geom, rng, tet_hosts=[], tri_hosts={}, wm_hosts=[], calcMembPot=0) Create a spatial stochastic solver based on operator splitting, that is that reaction events are partitioned and diffusion is approximated. If voltage is to be simulated, argument calcMembPot specifies the solver e.g. calcMembPot=steps.solver.EF_DV_PETSC will utilise the PETSc library. calcMembPot=0 means voltage will not be simulated. Arguments: steps.model.Model model steps.geom.Geom geom steps.rng.RNG rng list<int> tet_hosts (default=[]) dict<int, int> tri_hosts (default={}) list<int> wm_hosts (default=[]) int calcMemPot (default=0)
62598fa74e4d562566372347
class ARTClassifier(Transformer): <NEW_LINE> <INDENT> def __init__(self, art_classifier): <NEW_LINE> <INDENT> super(ARTClassifier, self).__init__(art_classifier=art_classifier) <NEW_LINE> self._art_classifier = art_classifier <NEW_LINE> <DEDENT> def fit(self, dataset, batch_size=128, nb_epochs=20): <NEW_LINE> <INDENT> self._art_classifier.fit(dataset.features, dataset.labels, batch_size=batch_size, nb_epochs=nb_epochs) <NEW_LINE> return self <NEW_LINE> <DEDENT> def predict(self, dataset, logits=False): <NEW_LINE> <INDENT> pred_labels = self._art_classifier.predict(dataset.features, dataset.labels, logits=logits) <NEW_LINE> if isinstance(dataset, BinaryLabelDataset): <NEW_LINE> <INDENT> pred_labels = np.argmax(pred_labels, axis=1).reshape((-1, 1)) <NEW_LINE> <DEDENT> pred_dataset = dataset.copy() <NEW_LINE> pred_dataset.labels = pred_labels <NEW_LINE> return pred_dataset
Wraps an instance of an :obj:`art.classifiers.Classifier` to extend :obj:`~aiflearn.algorithms.Transformer`.
62598fa732920d7e50bc5f77
class ViewBuilder(common.ViewBuilder): <NEW_LINE> <INDENT> _collection_name = "backups" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(ViewBuilder, self).__init__() <NEW_LINE> <DEDENT> def summary_list(self, request, backups, backup_count=None): <NEW_LINE> <INDENT> return self._list_view(self.summary, request, backups, backup_count) <NEW_LINE> <DEDENT> def detail_list(self, request, backups, backup_count=None): <NEW_LINE> <INDENT> return self._list_view(self.detail, request, backups, backup_count) <NEW_LINE> <DEDENT> def summary(self, request, backup): <NEW_LINE> <INDENT> return { 'backup': { 'id': backup['id'], 'name': backup['display_name'], 'links': self._get_links(request, backup['id']), }, } <NEW_LINE> <DEDENT> def restore_summary(self, request, restore): <NEW_LINE> <INDENT> return { 'restore': { 'backup_id': restore['backup_id'], 'volume_id': restore['volume_id'], 'volume_name': restore['volume_name'], }, } <NEW_LINE> <DEDENT> def detail(self, request, backup): <NEW_LINE> <INDENT> backup_dict = { 'backup': { 'id': backup.get('id'), 'status': backup.get('status'), 'size': backup.get('size'), 'object_count': backup.get('object_count'), 'availability_zone': backup.get('availability_zone'), 'container': backup.get('container'), 'created_at': backup.get('created_at'), 'updated_at': backup.get('updated_at'), 'name': backup.get('display_name'), 'description': backup.get('display_description'), 'fail_reason': backup.get('fail_reason'), 'volume_id': backup.get('volume_id'), 'links': self._get_links(request, backup['id']), 'is_incremental': backup.is_incremental, 'has_dependent_backups': backup.has_dependent_backups, 'snapshot_id': backup.snapshot_id, 'data_timestamp': backup.data_timestamp, } } <NEW_LINE> return backup_dict <NEW_LINE> <DEDENT> def _list_view(self, func, request, backups, backup_count): <NEW_LINE> <INDENT> backups_list = [func(request, backup)['backup'] for backup in backups] <NEW_LINE> backups_links = self._get_collection_links(request, backups, self._collection_name, backup_count) <NEW_LINE> backups_dict = dict(backups=backups_list) <NEW_LINE> if backups_links: <NEW_LINE> <INDENT> backups_dict['backups_links'] = backups_links <NEW_LINE> <DEDENT> if backup_count is not None: <NEW_LINE> <INDENT> backups_dict['count'] = backup_count <NEW_LINE> <DEDENT> return backups_dict <NEW_LINE> <DEDENT> def export_summary(self, request, export): <NEW_LINE> <INDENT> return { 'backup-record': { 'backup_service': export['backup_service'], 'backup_url': export['backup_url'], }, }
Model backup API responses as a python dictionary.
62598fa72c8b7c6e89bd36e8
class Finder(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def find_recursive(path: str, allow_links: bool=False, continue_in_repository: bool=False, callback: typing.Callable[[str], None]=lambda s: None) -> typing.Generator[description.RepositoryDescription, None, None]: <NEW_LINE> <INDENT> callback(path) <NEW_LINE> is_in_repo = False <NEW_LINE> if not allow_links and os.path.islink(path): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> yield Finder.get_from_path(path) <NEW_LINE> is_in_repo = True <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> if is_in_repo and not continue_in_repository: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> for name in os.listdir(path): <NEW_LINE> <INDENT> dpath = os.path.join(path, name) <NEW_LINE> if os.path.isdir(dpath): <NEW_LINE> <INDENT> for desc in Finder.find_recursive( dpath, allow_links=allow_links, continue_in_repository=continue_in_repository, callback=callback): <NEW_LINE> <INDENT> yield desc <NEW_LINE> <DEDENT> <DEDENT> <DEDENT> <DEDENT> @staticmethod <NEW_LINE> def get_from_path(path: str) -> description.RepositoryDescription: <NEW_LINE> <INDENT> local = implementation.LocalRepository(path) <NEW_LINE> if not local.exists(): <NEW_LINE> <INDENT> raise ValueError("No repository available in {}".format(path)) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> remote_url = local.get_remote_url('origin') <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> remotes = local.remotes <NEW_LINE> if len(remotes) == 0: <NEW_LINE> <INDENT> raise ValueError('No remotes available') <NEW_LINE> <DEDENT> remote_url = local.get_remote_url(remotes[0]) <NEW_LINE> <DEDENT> return description.RepositoryDescription(remote_url, path)
Class that helps finding existing repositories
62598fa7d58c6744b42dc266
class FunctionExpression(object): <NEW_LINE> <INDENT> openapi_types = { 'type': 'str', 'params': 'list[ModelProperty]', 'body': 'Node' } <NEW_LINE> attribute_map = { 'type': 'type', 'params': 'params', 'body': 'body' } <NEW_LINE> def __init__(self, type=None, params=None, body=None): <NEW_LINE> <INDENT> self._type = None <NEW_LINE> self._params = None <NEW_LINE> self._body = None <NEW_LINE> self.discriminator = None <NEW_LINE> if type is not None: <NEW_LINE> <INDENT> self.type = type <NEW_LINE> <DEDENT> if params is not None: <NEW_LINE> <INDENT> self.params = params <NEW_LINE> <DEDENT> if body is not None: <NEW_LINE> <INDENT> self.body = body <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def type(self): <NEW_LINE> <INDENT> return self._type <NEW_LINE> <DEDENT> @type.setter <NEW_LINE> def type(self, type): <NEW_LINE> <INDENT> self._type = type <NEW_LINE> <DEDENT> @property <NEW_LINE> def params(self): <NEW_LINE> <INDENT> return self._params <NEW_LINE> <DEDENT> @params.setter <NEW_LINE> def params(self, params): <NEW_LINE> <INDENT> self._params = params <NEW_LINE> <DEDENT> @property <NEW_LINE> def body(self): <NEW_LINE> <INDENT> return self._body <NEW_LINE> <DEDENT> @body.setter <NEW_LINE> def body(self, body): <NEW_LINE> <INDENT> self._body = body <NEW_LINE> <DEDENT> def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.openapi_types): <NEW_LINE> <INDENT> value = getattr(self, attr) <NEW_LINE> if isinstance(value, list): <NEW_LINE> <INDENT> result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) <NEW_LINE> <DEDENT> elif hasattr(value, "to_dict"): <NEW_LINE> <INDENT> result[attr] = value.to_dict() <NEW_LINE> <DEDENT> elif isinstance(value, dict): <NEW_LINE> <INDENT> result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> result[attr] = value <NEW_LINE> <DEDENT> <DEDENT> return result <NEW_LINE> <DEDENT> def to_str(self): <NEW_LINE> <INDENT> return pprint.pformat(self.to_dict()) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.to_str() <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> if not isinstance(other, FunctionExpression): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return self.__dict__ == other.__dict__ <NEW_LINE> <DEDENT> def __ne__(self, other): <NEW_LINE> <INDENT> return not self == other
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually.
62598fa7a8370b77170f02fd