code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class StateHitEventHandler(BaseEventHandler): <NEW_LINE> <INDENT> EVENT_TYPE = feconf.EVENT_TYPE_STATE_HIT <NEW_LINE> @classmethod <NEW_LINE> def _handle_event( cls, exp_id, exp_version, state_name, session_id, params, play_type): <NEW_LINE> <INDENT> stats_models.StateHitEventLogEntryModel.create( exp_id, exp_version, ...
Event handler for recording state hit events.
62598fac10dbd63aa1c70b6e
class orbit: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.rot = [0.,0.,0.] <NEW_LINE> self.tgt = [0.,0.,0.] <NEW_LINE> self.dist = 1.0 <NEW_LINE> self.ori = ['x','-z','y'] <NEW_LINE> <DEDENT> def matrix(self): <NEW_LINE> <INDENT> o = orientation_matrix(*self.ori) <NEW_LINE> Rz = so3.rotation([0.,0.,...
An orbit camera that is controlled using a rotation, target point, distance, and orientation. Attributes: - tgt: target point - rot: euler angle rotation (roll-pitch-yaw entries relative to default view with fwd = +y, right = +x, up = +z) - dist: target distance - ori: orientation matrix type ...
62598fac1f5feb6acb162bda
class Slack_ForeachWriter: <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> self.webhook_url = url <NEW_LINE> <DEDENT> def open(self, partition_id, epoch_id): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def process(self, row): <NEW_LINE> <INDENT> import json <NEW_LINE> import requests <NEW_LINE>...
Class to send alerts to a Slack Channel. When used with `foreach`, copies of this class is going to be used to write multiple rows in the executor. See the python docs for `DataStreamWriter.foreach` for more details.
62598face1aae11d1e7ce801
class Structured_Imitation(Dynamics): <NEW_LINE> <INDENT> def interact(self): <NEW_LINE> <INDENT> i = self.net.get_random_vertex() <NEW_LINE> group_trait = 0.0 <NEW_LINE> if self.params["group"] == 0: <NEW_LINE> <INDENT> for j in self.net.get_neighbors(i): <NEW_LINE> <INDENT> group_trait += j.get_trait() <NEW_LINE> <DE...
Imitation dynamics on a structured network.
62598fac6e29344779b00618
class TweetActions: <NEW_LINE> <INDENT> space_gif = 'space_gif' <NEW_LINE> retweet_scott_kelly = 'retweet_scott_kelly' <NEW_LINE> retweet_astro_kjell = 'retweet_astro_kjell' <NEW_LINE> retweet_astro_kimiya = 'retweet_astro_kimiya' <NEW_LINE> retweet_volkov_iss = 'retweet_volkov_iss' <NEW_LINE> retweet_astro_jeff = 'ret...
Tweets constants TODO: write once those freaking actons
62598fac796e427e5384e74f
class Category(AtomBase): <NEW_LINE> <INDENT> _tag = 'category' <NEW_LINE> _namespace = ATOM_NAMESPACE <NEW_LINE> _children = AtomBase._children.copy() <NEW_LINE> _attributes = AtomBase._attributes.copy() <NEW_LINE> _attributes['term'] = 'term' <NEW_LINE> _attributes['scheme'] = 'scheme' <NEW_LINE> _attributes['label']...
The atom:category element
62598fac4c3428357761a275
class WindowsVolumeCreationEventFormatterTest( test_lib.EventFormatterTestCase): <NEW_LINE> <INDENT> def testInitialization(self): <NEW_LINE> <INDENT> event_formatter = windows.WindowsVolumeCreationEventFormatter() <NEW_LINE> self.assertNotEqual(event_formatter, None) <NEW_LINE> <DEDENT> def testGetFormatStringAttribut...
Tests for the Windows volume creation event formatter.
62598fac57b8e32f525080f9
class TestRadians(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.g = Geod(ellps='clrk66') <NEW_LINE> self.boston_d = (-71. - (7. / 60.), 42. + (15. / 60.)) <NEW_LINE> self.boston_r = (math.radians(self.boston_d[0]), math.radians(self.boston_d[1])) <NEW_LINE> self.portland_d = (-123. -...
Tests issue #84
62598fac63b5f9789fe85122
class RelatedObjectSegmentValue(BaseValue): <NEW_LINE> <INDENT> def __init__(self, path, content_type, translation_key, **kwargs): <NEW_LINE> <INDENT> self.content_type = content_type <NEW_LINE> self.translation_key = translation_key <NEW_LINE> super().__init__(path, **kwargs) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE...
Represents a reference to a foreign translatable object. Attributes: path (str): The content path of the segment. content_type (ContentType): The content type of the base model of the foreign object. translation_key (UUID): The value of the foreign object's `translation_key` field. order (int): The ind...
62598fac851cf427c66b8278
class LoadProjectsBucketsAclsPipelineTest(ForsetiTestCase): <NEW_LINE> <INDENT> FAKE_PROJECT_NUMBERS = ['11111'] <NEW_LINE> FAKE_BUCKETS = ['fakebucket1'] <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.cycle_timestamp = '20001225T120000Z' <NEW_LINE> self.configs = fake_configs.FAKE_CONFIGS <NEW_LINE> self.mock_gc...
Tests for the load_projects_buckets_acls_pipeline.
62598fac4428ac0f6e6584e0
@dataclasses.dataclass <NEW_LINE> class AudioListenerWillBeDestroyed: <NEW_LINE> <INDENT> contextId: GraphObjectId <NEW_LINE> listenerId: GraphObjectId <NEW_LINE> @classmethod <NEW_LINE> def from_json(cls, json: dict) -> AudioListenerWillBeDestroyed: <NEW_LINE> <INDENT> return cls(GraphObjectId(json["contextId"]), Grap...
Notifies that a new AudioListener has been created. Attributes ---------- contextId: GraphObjectId listenerId: GraphObjectId
62598fac7d43ff24874273e0
class suppress_stdout_stderr(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.null_fds = [os.open(os.devnull, os.O_RDWR) for _ in range(2)] <NEW_LINE> self.save_fds = [os.dup(1), os.dup(2)] <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> os.dup2(self.null_fds[0], 1) <NEW_LINE> os.d...
A context manager for doing a "deep suppression" of stdout and stderr in Python, i.e. will suppress all print, even if the print originates in a compiled C/Fortran sub-function. This will not suppress raised exceptions, since exceptions are printed to stderr just before a script exits, and after the context manager has...
62598fac2c8b7c6e89bd3781
class PrivateIPAddress(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'ip_address': {'key': 'ipAddress', 'type': 'str'}, 'subnet_resource_id': {'key': 'subnetResourceId', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, ip_address: Optional[str] = None, subnet_resource_id: Optional[str] = None, ...
A private IP address bound to the availability group listener. :ivar ip_address: Private IP address bound to the availability group listener. :vartype ip_address: str :ivar subnet_resource_id: Subnet used to include private IP. :vartype subnet_resource_id: str
62598fac3539df3088ecc26e
class ICalendarView(generic_views.View): <NEW_LINE> <INDENT> def get_meetup_summary(self, meetup): <NEW_LINE> <INDENT> return "PyGRAZ-Meetup am {0}".format(meetup.start_date.date()) <NEW_LINE> <DEDENT> def get_meetup_description(self, meetup): <NEW_LINE> <INDENT> return """Details: https://{0}{1}""".format( Site.object...
This offers a simple ical rendering of all the meetups.
62598fac23849d37ff851071
class OperationValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> OPERATION_UNSPECIFIED = 0 <NEW_LINE> FORWARD = 1 <NEW_LINE> REWRITE = 2
Required. Indicates which action will be applied. If FORWARD, the messages will be imported from cloud to edge or exported from edge to cloud. If REWRITE, the messages will be republished within the edge device with new topic name, that is defined in `rewrite_topic_name`. Cannot be unspecified. Values: OPERATION_UNS...
62598fac7c178a314d78d459
class HoldingChangeList: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def pack_req(cls, code, holder_type, conn_id, start_date, end_date=None): <NEW_LINE> <INDENT> ret, content = split_stock_str(code) <NEW_LINE> if ret == RET_ERROR: <NEW_LINE> <INDENT> err...
Query Conversion for getting holding change list.
62598fac0c0af96317c5633f
class RequestTimeMiddleware(object): <NEW_LINE> <INDENT> def __init__(self, get_response): <NEW_LINE> <INDENT> self.get_response = get_response <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> request.start_time = datetime.now() <NEW_LINE> response = self.get_response(request) <NEW_LINE> request.end...
Display request time on a page
62598facaad79263cf42e791
class Module(ModMetricFranke): <NEW_LINE> <INDENT> def save(self, mod, ev): <NEW_LINE> <INDENT> if self._stage != 3: <NEW_LINE> <INDENT> raise ModuleExecutionError('save initiated when module was not finalised!') <NEW_LINE> <DEDENT> for row in self.result[0].value: <NEW_LINE> <INDENT> rval = ResultMetricFFranke(evaluat...
module for the ffranke spikesorting metric - for use in the django context
62598facf548e778e596b561
class PausingTask(Task): <NEW_LINE> <INDENT> def __init__(self, config, control_protocol=protocols.task_control): <NEW_LINE> <INDENT> super().__init__(config, control_protocol) <NEW_LINE> self.paused = False <NEW_LINE> <DEDENT> def handle_control(self, queue): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> super().handle...
Derivative of :class:`Task` that uses a :attr:`paused` flag to indicate to internal handlers when it's paused. It is up to your queue handlers to honour :attr:`paused` when it's set.
62598fac4f6381625f19949d
class HG12(HG12BaseClass): <NEW_LINE> <INDENT> H = Parameter(description='H parameter') <NEW_LINE> G12 = Parameter(description='G12 parameter') <NEW_LINE> @property <NEW_LINE> def _G1(self): <NEW_LINE> <INDENT> return self._G12_to_G1(self.G12.value) <NEW_LINE> <DEDENT> @property <NEW_LINE> def _G2(self): <NEW_LINE> <IN...
HG12 photometric phase model (Muinonen et al. 2010) Examples -------- >>> # Define the phase function for Themis with >>> # H = 7.121, G12 = 0.68 >>> >>> from sbpy.photometry import HG12 >>> themis = HG12(7.121, 0.68, radius=100) >>> print('{0:.4f}'.format(themis.geoalb)) 0.0639 >>> print('{0:.4f}'.format(themis.phas...
62598fac7b180e01f3e4902f
class ParsingException(Exception): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.msg
Represent a controlled exception raised by the library.
62598fac55399d3f056264e1
class rayleigh_gen(rv_continuous): <NEW_LINE> <INDENT> _support_mask = rv_continuous._open_support_mask <NEW_LINE> def _rvs(self): <NEW_LINE> <INDENT> return chi.rvs(2, size=self._size, random_state=self._random_state) <NEW_LINE> <DEDENT> def _pdf(self, r): <NEW_LINE> <INDENT> return np.exp(self._logpdf(r)) <NEW_LINE> ...
A Rayleigh continuous random variable. %(before_notes)s Notes ----- The probability density function for `rayleigh` is: .. math:: f(r) = r \exp(-r^2/2) for :math:`x \ge 0`. `rayleigh` is a special case of `chi` with ``df == 2``. %(after_notes)s %(example)s
62598fac63d6d428bbee2768
class Operations: <NEW_LINE> <INDENT> models = _models <NEW_LINE> def __init__(self, client, config, serializer, deserializer) -> None: <NEW_LINE> <INDENT> self._client = client <NEW_LINE> self._serialize = serializer <NEW_LINE> self._deserialize = deserializer <NEW_LINE> self._config = config <NEW_LINE> <DEDENT> @dist...
Operations async operations. You should not instantiate this class directly. Instead, you should create a Client instance that instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. :type models: ~azure.mgmt.resource.subscriptions.v2019_11_01.models...
62598fac097d151d1a2c0fe6
class AdminSplitDateTime(forms.SplitDateTimeWidget): <NEW_LINE> <INDENT> def __init__(self, attrs=None): <NEW_LINE> <INDENT> widgets = [AdminDateWidget, AdminTimeWidget] <NEW_LINE> forms.MultiWidget.__init__(self, widgets, attrs) <NEW_LINE> <DEDENT> def render(self, name, value, attrs=None): <NEW_LINE> <INDENT> input_h...
A SplitDateTime Widget that has some myadmin-specific styling.
62598fac56b00c62f0fb2872
class Token(Authentication): <NEW_LINE> <INDENT> def __init__(self, token, name=None): <NEW_LINE> <INDENT> self._token = token <NEW_LINE> self._name = name <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def from_json(parsed_json): <NEW_LINE> <INDENT> name = json_get(parsed_json, "name") <NEW_LINE> sha1 = json_get(parsed_...
An immutable representation of a Gitea authentication token
62598fac167d2b6e312b6f2f
class Game_tree(): <NEW_LINE> <INDENT> def __init__(self, player_at_move=1, field=np.zeros(9)): <NEW_LINE> <INDENT> self.node_count = 1 <NEW_LINE> self.leaf_count = 0 <NEW_LINE> self.queue = BetterPriorityQueue() <NEW_LINE> self.tree = Game_state(player=player_at_move, depth=7, tree=self, field_vec=field) <NEW_LINE> <D...
class holding game tree and performing backpropagation and so...
62598fac66673b3332c30389
class ExportListView(TemplateView): <NEW_LINE> <INDENT> template_name = 'openslides_export/export_list.html' <NEW_LINE> required_permission = 'openslides_export.can_export' <NEW_LINE> def get_context_data(self, *args, **kwargs): <NEW_LINE> <INDENT> context = super(ExportListView, self).get_context_data(*args, **kwargs)...
View of the overview page of all exportable elements
62598fac4c3428357761a277
class ProcessedData(object): <NEW_LINE> <INDENT> def __init__(self, did_close, new_stdout=None, new_stderr=None, new_stdin=None): <NEW_LINE> <INDENT> self.new_stdout = new_stdout <NEW_LINE> self.new_stderr = new_stderr <NEW_LINE> self.new_stdin = new_stdin <NEW_LINE> self.did_close = did_close <NEW_LINE> <DEDENT> def _...
Container for new data processed by the job. IO data that is processed by a process will be stored in an object of this type. Attributes: new_stdout: Any new data that came from stdout. None if no data came. new_stderr: Any new data that came from stderr. None if no data came. new_stdin: Any new data that...
62598fac60cbc95b0636430c
class IsSuperAdminUser(BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> return request.user and request.user.is_superuser
Allows access only to admin users.
62598fac57b8e32f525080fa
class Model(with_metaclass(ModelMeta)): <NEW_LINE> <INDENT> def __init__(self, init_method='from_initialization', **kwargs): <NEW_LINE> <INDENT> super(Model, self).__init__() <NEW_LINE> defined_fields = type(self).fields or {} <NEW_LINE> for key in kwargs: <NEW_LINE> <INDENT> if key not in defined_fields: <NEW_LINE> <I...
Model is a base class for all models. Models are defining the data structure of the payload of messages and the metadata required, such as a name and topic.
62598facf9cc0f698b1c52a8
class SenderMixinSentMailTests(unittest.TestCase): <NEW_LINE> <INDENT> def test_onlyLogFailedAddresses(self): <NEW_LINE> <INDENT> onDone = self.assertFailure(defer.Deferred(), smtp.SMTPDeliveryError) <NEW_LINE> onDone.addCallback(lambda e: self.assertEqual( e.log, "bob@example.com: 199 Error in sending.\n")) <NEW_LINE>...
Tests for L{smtp.SenderMixin.sentMail}, used in particular by L{smtp.SMTPSenderFactory} and L{smtp.ESMTPSenderFactory}.
62598fac5fcc89381b26612b
class UserFavorite(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(UserProfile, verbose_name="用户收藏") <NEW_LINE> fav_id = models.IntegerField(default=0, verbose_name="数据ID") <NEW_LINE> fav_type_choices = ( (1, "课程"), (2, "课程机构"), (3, "讲师"), ) <NEW_LINE> fav_type = models.IntegerField(choices=fav_type_choices...
用户收藏
62598fac460517430c43203c
class AbbrevMixin: <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.abbrev = False <NEW_LINE> self.add_settable(cmd2.Settable('abbrev', bool, 'Accept command abbreviations')) <NEW_LINE> self.register_postparsing_hook(self.cmd2_abbrev_hook) <N...
A cmd2 plugin (mixin class) which adds support for abbreviated commands.
62598fac7d43ff24874273e1
class urlfetch(PackageGet): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _extract_raw(cls, value): <NEW_LINE> <INDENT> return value.body
Wrapper for urlfetch.
62598fac9c8ee82313040150
class UserSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = get_user_model() <NEW_LINE> fields = ('email', 'password', 'name') <NEW_LINE> extra_kwargs = {'password': {'write_only': True, 'min_length': 5}} <NEW_LINE> <DEDENT> def create(self, validated_data): <NEW_LINE>...
Serializer for users objects
62598fac5fdd1c0f98e5df50
class SimpleAsyncRam(Unit): <NEW_LINE> <INDENT> def _declr(self): <NEW_LINE> <INDENT> self.addr_in = VectSignal(2) <NEW_LINE> self.din = VectSignal(8) <NEW_LINE> self.addr_out = VectSignal(2) <NEW_LINE> self.dout = VectSignal(8)._m() <NEW_LINE> <DEDENT> def _impl(self): <NEW_LINE> <INDENT> self._ram = ram = self._sig("...
Note that there is no such a thing in hw yet... .. hwt-autodoc::
62598fac67a9b606de545f8b
class SigninForm(Form): <NEW_LINE> <INDENT> email = StringField('邮箱', validators=[ DataRequired("邮箱不能为空"), Email('邮箱格式错误') ], description="邮箱") <NEW_LINE> password = PasswordField('密码', validators=[DataRequired("密码不能为空")], description="密码") <NEW_LINE> remember = BooleanField('保持登录') <NEW_LINE> def validate_email(self, ...
Form for signin
62598fac2c8b7c6e89bd3784
class InsertionSort: <NEW_LINE> <INDENT> __slots__ = 'original_data' <NEW_LINE> def __init__(self, data): <NEW_LINE> <INDENT> self.original_data = data <NEW_LINE> <DEDENT> def insertion_sort(self): <NEW_LINE> <INDENT> data = self.original_data <NEW_LINE> for index in range(1, len(data)): <NEW_LINE> <INDENT> position = ...
This class implements the insertion sort.
62598fac5fc7496912d48261
class NoSuchTestError(DigressError): <NEW_LINE> <INDENT> pass
Raised when no such test exists.
62598fac009cb60464d014df
class CannotCommunicate(exceptions.HomeAssistantError): <NEW_LINE> <INDENT> pass
Error to indicate we cannot connect.
62598fac38b623060ffa9058
class _PlayerDatabase(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name = None <NEW_LINE> self.time_stamp = time() <NEW_LINE> self.last_win = None <NEW_LINE> self.wins = 0
Class used to hold values for a player in the winners database.
62598fac99cbb53fe6830e96
class BasicProvider: <NEW_LINE> <INDENT> _method = "post" <NEW_LINE> def get_action(self, payment): <NEW_LINE> <INDENT> return self.get_return_url(payment) <NEW_LINE> <DEDENT> def __init__(self, capture=True): <NEW_LINE> <INDENT> self._capture = capture <NEW_LINE> <DEDENT> def get_hidden_fields(self, payment): <NEW_LIN...
This class defines the provider API. It should not be instantiated directly. Use factory instead.
62598facaad79263cf42e792
class AzureFirewallNetworkRuleCollection(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'priority': {'maximum': 65000, 'minimum': 100}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'et...
Network rule collection resource. 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 Azure firewall. This name can be used to access the resource. :type name: str :ivar etag: A u...
62598fac91f36d47f2230e85
class AverageMeter(object): <NEW_LINE> <INDENT> def __init__(self, window_size=20): <NEW_LINE> <INDENT> self.values = deque(maxlen=window_size) <NEW_LINE> self.counts = deque(maxlen=window_size) <NEW_LINE> self.sum = 0.0 <NEW_LINE> self.count = 0 <NEW_LINE> <DEDENT> def update(self, value, count=1): <NEW_LINE> <INDENT>...
Track a series of values and provide access to smoothed values over a window or the global series average.
62598fac3346ee7daa337628
class ParameterHandler(object): <NEW_LINE> <INDENT> def __init__(self, *pv_pairs): <NEW_LINE> <INDENT> super(ParameterHandler, self).__init__() <NEW_LINE> self._parameters = list(zip(pv_pairs[::2], pv_pairs[1::2])) <NEW_LINE> if len(pv_pairs) % 2: <NEW_LINE> <INDENT> self._parameters.extend(pv_pairs[-1].items()) <NEW_L...
ParameterHandler(p0, v0[, p1, v1, ...][, parameter_dict]) :class:`~uqtools.parameter.Parameter` backend for :class:`Set` and :class:`Revert`. `pN.set(vN)` is called for every pair `pN`, `vN` and every item in `parameter_dict` on `__enter__`. Parameters ---------- p0, p1, ... : `Parameter` Set parameters. v0, v1,...
62598fac1b99ca400228f50f
class Connector(QObject, Object, DeviceBase): <NEW_LINE> <INDENT> def __init__(self, uri=None, attributes=[], policy=UpdatePolicy.POLLING, interval=1.0): <NEW_LINE> <INDENT> QObject.__init__(self) <NEW_LINE> Object.__init__(self) <NEW_LINE> self.uri = uri <NEW_LINE> self.attributes = {} <NEW_LINE> for attribute in attr...
A Connector object interfaces between devices and control systems. This is the base class to all connectors. It provides a mapping between Janus attribute names and identifiers of the control system. Derived objects should care to keep the attribute values up to date, either by polling them or through event based mec...
62598facd58c6744b42dc2b6
class RuoteWorkitem(Workitem): <NEW_LINE> <INDENT> def loads(self, blob): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._body = json.loads(blob) <NEW_LINE> self._worker_type = self._body["fields"]["params"]["worker_type"] <NEW_LINE> <DEDENT> except (ValueError, KeyError, TypeError): <NEW_LINE> <INDENT> raise RuoteW...
Ruote workitem. This class is used to parse JSON-based Ruote workitems like: .. code-block:: guess { "re_dispatch_count": 0, "participant_name": "hardworker", "wf_revision": null, "fields": { "repo": "testrepo1", "pkgname": "python-riak", "pkgve...
62598fac66656f66f7d5a3af
class TestQuota: <NEW_LINE> <INDENT> def test_per_second(self): <NEW_LINE> <INDENT> q = quota.Quota.per_second(6, maximum_burst=1) <NEW_LINE> assert q.period == datetime.timedelta(seconds=1) <NEW_LINE> assert q.limit == 7 <NEW_LINE> <DEDENT> def test_per_minute(self): <NEW_LINE> <INDENT> q = quota.Quota.per_minute(SECO...
Tests for our Quota class.
62598fac55399d3f056264e3
class Update(show.ShowOne): <NEW_LINE> <INDENT> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(Update, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'name', help='Workbook name') <NEW_LINE> parser.add_argument( 'description', nargs='?', help='Workbook description') <NEW_LINE> parser.a...
Update workbook
62598fac63d6d428bbee276a
class RandomMotion(): <NEW_LINE> <INDENT> def __init__(self, num_points=5000): <NEW_LINE> <INDENT> self.num_points = num_points <NEW_LINE> self.x_values = [0] <NEW_LINE> self.y_values = [0] <NEW_LINE> <DEDENT> def fill_motion(self): <NEW_LINE> <INDENT> while len(self.x_values) < self.num_points: <NEW_LINE> <INDENT> x_s...
A class to simulate random molecular motion
62598fac0c0af96317c56342
class KalmanBoxTracker(object): <NEW_LINE> <INDENT> count = 0 <NEW_LINE> def __init__(self,bbox,img=None): <NEW_LINE> <INDENT> self.kf = KalmanFilter(dim_x=7, dim_z=4) <NEW_LINE> self.kf.F = np.array([[1,0,0,0,1,0,0],[0,1,0,0,0,1,0],[0,0,1,0,0,0,1],[0,0,0,1,0,0,0], [0,0,0,0,1,0,0],[0,0,0,0,0,1,0],[0,0,0,0,0,0,1]]) <NE...
This class represents the internal state of individual tracked objects observed as bbox.
62598fac56ac1b37e63021ab
class HFSFileTest(test_lib.HFSImageFileTestCase): <NEW_LINE> <INDENT> _IDENTIFIER_ANOTHER_FILE = 21 <NEW_LINE> _IDENTIFIER_PASSWORDS_TXT = 20 <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> super(HFSFileTest, self).setUp() <NEW_LINE> self._resolver_context = context.Context() <NEW_LINE> test_path = self._GetTestFilePat...
Tests the file-like object implementation using pyfshfs.file_entry.
62598fac63b5f9789fe85126
class ListBucket(list): <NEW_LINE> <INDENT> pass
Subclass of :py:class:`list` allowing for weak references
62598fac5166f23b2e243398
class Handshake(Packet): <NEW_LINE> <INDENT> __slots__ = ['crypto_set', 'port', 'onion_address', 'protocol', 'open', 'peer_id', 'rev', 'version'] <NEW_LINE> @use_condition <NEW_LINE> def parse(self, c, params): <NEW_LINE> <INDENT> crypto_list = c.as_type('crypt_supported', list) <NEW_LINE> self.crypto_set = set() <NEW_...
Unpacked [handshake] packet sent when the connection is initialized.
62598fac7cff6e4e811b59ec
class FComboBox(QComboBox): <NEW_LINE> <INDENT> def __init__(self, parent, delegate): <NEW_LINE> <INDENT> super(FComboBox, self).__init__(parent) <NEW_LINE> self.delegate = delegate <NEW_LINE> <DEDENT> def focusOutEvent(self, event): <NEW_LINE> <INDENT> logging.debug('focusOut!') <NEW_LINE> logging.debug(self.currentTe...
not used, just for remember the focusOutEvent possibility. See TODO file
62598fac3317a56b869be52a
class AstPatternFormatter(AstFormatter): <NEW_LINE> <INDENT> def do_BoolOp(self, node): <NEW_LINE> <INDENT> return 'Bool' <NEW_LINE> <DEDENT> def do_Bytes(self, node): <NEW_LINE> <INDENT> assert g.isPython3 <NEW_LINE> return 'Bytes' <NEW_LINE> <DEDENT> def do_Constant(self, node): <NEW_LINE> <INDENT> assert g.isPython3...
A subclass of AstFormatter that replaces values of constants by Bool, Bytes, Int, Name, Num or Str.
62598fac5fcc89381b26612c
class ShowSecurityGroupRule(neutronV20.ShowCommand): <NEW_LINE> <INDENT> resource = 'security_group_rule' <NEW_LINE> log = logging.getLogger(__name__ + '.ShowSecurityGroupRule') <NEW_LINE> allow_names = False
Show information of a given security group rule.
62598faceab8aa0e5d30bd4c
class _SmoothMAC(object): <NEW_LINE> <INDENT> def __init__(self, block_size, msg=b(""), min_digest=0): <NEW_LINE> <INDENT> self._bs = block_size <NEW_LINE> self._buffer = [] <NEW_LINE> self._buffer_len = 0 <NEW_LINE> self._total_len = 0 <NEW_LINE> self._min_digest = min_digest <NEW_LINE> self._mac = None <NEW_LINE> sel...
Turn a MAC that only operates on aligned blocks of data into a MAC with granularity of 1 byte.
62598fac26068e7796d4c915
class Nest(SaveAndCheck): <NEW_LINE> <INDENT> def _casting(self, thething): <NEW_LINE> <INDENT> self.save_and_check( {"almonds": thething}, 'almonds', [(repr(thething),)] )
This needs to be verified with actual ScraperWiki.
62598faca17c0f6771d5c1f6
class Solution(object): <NEW_LINE> <INDENT> def canJump(self, nums): <NEW_LINE> <INDENT> max_reach, n = 0, len(nums) <NEW_LINE> for i, x in enumerate(nums): <NEW_LINE> <INDENT> if max_reach < i: return False <NEW_LINE> if max_reach >= n - 1: return True <NEW_LINE> max_reach = max(max_reach, i + x)
Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index.
62598fac2c8b7c6e89bd3786
class User(models.Model): <NEW_LINE> <INDENT> id = fields.IntField(pk=True) <NEW_LINE> email = fields.CharField(max_length=100, unique=True) <NEW_LINE> hashed_password = fields.CharField(max_length=1000) <NEW_LINE> is_active = fields.BooleanField(default=True) <NEW_LINE> async def save(self, *args, **kwargs) -> None: <...
Модель пользователя
62598fac3d592f4c4edbae8c
class FullVector(Vector): <NEW_LINE> <INDENT> def __init__(self, lst, zero_test = lambda x : (x == 0)): <NEW_LINE> <INDENT> super(FullVector, self).__init__(lst, zero_test) <NEW_LINE> self.data = lst <NEW_LINE> <DEDENT> def split(self): <NEW_LINE> <INDENT> vec1 = self[:int(len(self)/2)] <NEW_LINE> vec2 = self[int(len(s...
A subclass of Vector where all elements are kept explicitly as a list
62598facd486a94d0ba2bf8f
class StyledAuthenticationForm(AuthenticationForm): <NEW_LINE> <INDENT> username = UsernameField( max_length=254, widget=TextInput(attrs={'class': 'form-control'}), ) <NEW_LINE> password = forms.CharField( label="Password", strip=False, widget=PasswordInput(attrs={'class': 'form-control'}) )
User authentication form with bootstrap styles
62598fac01c39578d7f12d3f
class msg(SecActionMetadata): <NEW_LINE> <INDENT> def evaluate(self, core): <NEW_LINE> <INDENT> a = self.action[4:] <NEW_LINE> if a[0] == "'": <NEW_LINE> <INDENT> a = a[1:-1] <NEW_LINE> <DEDENT> core.msg = a <NEW_LINE> return a
https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#msg
62598fac009cb60464d014e1
class GuillotineSas(Guillotine): <NEW_LINE> <INDENT> def _split(self, section, width, height): <NEW_LINE> <INDENT> if section.width < section.height: <NEW_LINE> <INDENT> return self._split_horizontal(section, width, height) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return self._split_vertical(section, width, height...
Implements Short Axis Split (SAS) selection rule for Guillotine algorithm.
62598fac3346ee7daa337629
class Model(DB.Model): <NEW_LINE> <INDENT> __tablename__ = 'batches' <NEW_LINE> identifier = DB.Column(DB.Integer(), primary_key=True) <NEW_LINE> speed = DB.Column(DB.Integer()) <NEW_LINE> amount_to_produce = DB.Column(DB.Integer()) <NEW_LINE> started_dt = DB.Column(DB.DateTime()) <NEW_LINE> recipe_id = DB.Column(DB.St...
Model. TODO(Add DOC)
62598fac1f037a2d8b9e40af
class WebMercatorProjection(Projection): <NEW_LINE> <INDENT> EARTH_RADIUS = 6378137 <NEW_LINE> def project(self, latlon): <NEW_LINE> <INDENT> x = latlon.lon * self.pixels_per_degree <NEW_LINE> y = self.pixels_per_radian * math.log( math.tan(math.pi/4 + math.radians(latlon.lat/2))) <NEW_LINE> return Coord(x, y)
WGS 84 Web Mercator / Spherical Mercator projection used by Google Maps. See: https://en.wikipedia.org/wiki/Mercator_projection https://en.wikipedia.org/wiki/Web_Mercator
62598fac71ff763f4b5e7730
class DocumentPatchedEvent(DocumentChangedEvent): <NEW_LINE> <INDENT> def dispatch(self, receiver): <NEW_LINE> <INDENT> super().dispatch(receiver) <NEW_LINE> if hasattr(receiver, '_document_patched'): <NEW_LINE> <INDENT> receiver._document_patched(self) <NEW_LINE> <DEDENT> <DEDENT> def generate(self, references, buffer...
A Base class for events that represent updating Bokeh Models and their properties.
62598facadb09d7d5dc0a54b
class Deploy(Command): <NEW_LINE> <INDENT> name = "deploy" <NEW_LINE> doc_usage = "" <NEW_LINE> doc_purpose = "deploy the site" <NEW_LINE> logger = None <NEW_LINE> def _execute(self, command, args): <NEW_LINE> <INDENT> self.logger = get_logger('deploy', self.site.loghandlers) <NEW_LINE> timestamp_path = os.path.join(se...
Deploy site.
62598fac63d6d428bbee276c
class TokenStore(SessionStore): <NEW_LINE> <INDENT> def __init__(self, token=None, namespace=None, cache_alias=settings.SESSION_CACHE_ALIAS): <NEW_LINE> <INDENT> self._cache = caches[cache_alias] <NEW_LINE> self._namespace = None <NEW_LINE> self.set_namespace(namespace) <NEW_LINE> super(SessionStore, self).__init__(tok...
Cache-based token store system. It used like http sessions.
62598fac10dbd63aa1c70b74
class HAIL(WEATHER): <NEW_LINE> <INDENT> name="冰雹" <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name
class inherent = WEATHER attribute: name = 中文名稱 effect = 效果解說
62598fac56b00c62f0fb2876
class ProgramViewSet(DRFCacheMixin, MultiSerializerActionClassMixin, viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = ( training_program.models.Program.objects.all() .select_related('department') ) <NEW_LINE> serializer_class = training_program.serializers.ProgramSerializer <NEW_LINE> serializer_action_classes = ...
Create API views for Progarm.
62598fac60cbc95b06364310
class Location: <NEW_LINE> <INDENT> def __init__(self, city, x, y): <NEW_LINE> <INDENT> self.city: City = city <NEW_LINE> self.x: int = x <NEW_LINE> self.y: int = y <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.city.name) + ", (" + str(self.x) + ", " + str(self.y) + ")" <NEW_LINE> <DEDENT> ...
This class contains attributes of a location in this game.
62598facbd1bec0571e150a4
class coin_bw_info(coininfo.publish): <NEW_LINE> <INDENT> eventname = "Interface Bandwidth Used Information" <NEW_LINE> keys = ["interface", "tx_bps", "tx_pps", "rx_bps", "rx_pps", "timestamp"] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.values = [] <NEW_LINE> <DEDENT> def add(self, intf_name, tx_bps, tx_pp...
Event to publish bandwidth used @author ykk @date August 2011
62598fac57b8e32f525080fc
class Parameters(models.Model): <NEW_LINE> <INDENT> pass
Character parameters: strength, agility, luck etc
62598fac7cff6e4e811b59ee
class Router: <NEW_LINE> <INDENT> _connector = None <NEW_LINE> _services = [] <NEW_LINE> def __init__(self, connector): <NEW_LINE> <INDENT> self._connector = connector <NEW_LINE> self._connector.on_connect = self._onConnect <NEW_LINE> self._connector.on_message = self._onMessage <NEW_LINE> self._connector.connect("loca...
Core router for messages
62598fac851cf427c66b827e
class TestOntologyManagerPrefixEnum(): <NEW_LINE> <INDENT> def test_ontology_manager_prefix_enum_alias_uri(self): <NEW_LINE> <INDENT> assert PREFIX.ROOT.alias_uri('lol') == 'bem:lol' <NEW_LINE> <DEDENT> def test_ontology_manager_prefix_enum_get_name(self): <NEW_LINE> <INDENT> assert PREFIX.get_name( 'http://qudt.org/sc...
Unit test for PREFIX
62598fac3317a56b869be52b
class Centities: <NEW_LINE> <INDENT> def __init__(self,node=None,type='NAF'): <NEW_LINE> <INDENT> self.type = type <NEW_LINE> self.map_entity_id_to_node = {} <NEW_LINE> if node is None: <NEW_LINE> <INDENT> self.node = etree.Element('entities') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.node = node <NEW_LINE> fo...
This class encapsulates the entity layer in KAF/NAF
62598face5267d203ee6b8cc
class LongValuedFlagListArgument(ValuedFlagListArgument): <NEW_LINE> <INDENT> _pattern = "--{0}={1}"
Represents a :py:class:`ValuedFlagListArgument` with a double dash. Example: ``--file=file1.txt --file=file2.txt``
62598facac7a0e7691f724cb
class ExtractSliceSchemaViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> base_name = 'extract-slice-schema' <NEW_LINE> permission_classes = (IsAuthenticated,) <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> return json_response( ExtractRule.get_schemas(request.user) )
Returns data dictionary for the extract slice
62598facdd821e528d6d8ef7
class AIAircraftWasDamagedByStationaryUnit(ParsableEvent): <NEW_LINE> <INDENT> __slots__ = ['time', 'actor', 'attacker', 'pos', ] <NEW_LINE> verbose_name = _("AI aircraft was damaged by stationary unit") <NEW_LINE> matcher = make_matcher( "{time}{actor}{s}damaged{s}by{s}{attacker}{pos}" .format( time=TIME_GROUP_PREFIX,...
Example: "[8:33:05 PM] r01000 damaged by 0_Static at 100.0 200.99"
62598facbe383301e02537bb
class DisconnectingError(Exception): <NEW_LINE> <INDENT> pass
Error disconnecting
62598fac3539df3088ecc274
class CTD_ANON_ (pyxb.binding.basis.complexTypeDefinition): <NEW_LINE> <INDENT> _TypeDefinition = pyxb.binding.datatypes.string <NEW_LINE> _ContentTypeTag = pyxb.binding.basis.complexTypeDefinition._CT_SIMPLE <NEW_LINE> _Abstract = False <NEW_LINE> _ExpandedName = None <NEW_LINE> _XSDLocation = pyxb.utils.utility.Locat...
Complex type [anonymous] with content type SIMPLE
62598fac4e4d5625663723e8
class OpenMapQuest(Geocoder): <NEW_LINE> <INDENT> def __init__( self, api_key=None, format_string=DEFAULT_FORMAT_STRING, scheme=DEFAULT_SCHEME, timeout=DEFAULT_TIMEOUT, proxies=None, user_agent=None, ): <NEW_LINE> <INDENT> super(OpenMapQuest, self).__init__( format_string, scheme, timeout, proxies, user_agent=user_agen...
Geocoder using MapQuest Open Platform Web Services. Documentation at: https://developer.mapquest.com/documentation/open/
62598fac498bea3a75a57ae0
class ChecklistPage(ContentPage): <NEW_LINE> <INDENT> pass
Checklist page.
62598fac67a9b606de545f8f
class Instance: <NEW_LINE> <INDENT> def __init__(self, name, spicehost = None, spiceport = 0, owner = None, type = None, nth = 0): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.spicehost = spicehost <NEW_LINE> self.spiceport = spiceport <NEW_LINE> self.uuid = smIO.NewUUID() <NEW_LINE> self.owner = owner <NEW_LIN...
Config object representing an instance. This class can be extented to store more info about an vm, which can be accessed by getinstanceinfo
62598fac009cb60464d014e3
class Product(models.Model): <NEW_LINE> <INDENT> CONDITION_TYPE = ( ("New", "New"), ("Used", "Used") ) <NEW_LINE> name = models.CharField(max_length=100) <NEW_LINE> owner = models.ForeignKey(User, on_delete=models.CASCADE) <NEW_LINE> description = models.TextField(max_length=500) <NEW_LINE> condition = models.CharField...
Class for managing Product Details
62598fac91f36d47f2230e87
class GetQueueDailyStatisticsStateRequest(object): <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.STRING, 'queueName', None, None, ), ) <NEW_LINE> def __init__(self, queueName=None,): <NEW_LINE> <INDENT> self.queueName = queueName <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ ==...
Attributes: - queueName: Queue name;
62598fac71ff763f4b5e7732
class CeilometerAlarms(ceiloutils.CeilometerScenario): <NEW_LINE> <INDENT> @validation.required_services(consts.Service.CEILOMETER) <NEW_LINE> @validation.required_openstack(users=True) <NEW_LINE> @scenario.configure(context={"cleanup": ["ceilometer"]}) <NEW_LINE> def create_alarm(self, meter_name, threshold, **kwargs)...
Benchmark scenarios for Ceilometer Alarms API.
62598facadb09d7d5dc0a54d
class VelbusConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): <NEW_LINE> <INDENT> VERSION = 1 <NEW_LINE> def __init__(self) -> None: <NEW_LINE> <INDENT> self._errors = {} <NEW_LINE> <DEDENT> def _create_device(self, name: str, prt: str): <NEW_LINE> <INDENT> return self.async_create_entry(title=name, data={CONF_PORT...
Handle a config flow.
62598facdd821e528d6d8ef8
class OutboundNatRule(SubResource): <NEW_LINE> <INDENT> _validation = { 'backend_address_pool': {'required': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'allocated_outbound_ports': {'key': 'properties.allocatedOutboundPorts', 'type': 'int'}, 'frontend_ip_configurations': {'key': 'properti...
Outbound NAT pool of the load balancer. All required parameters must be populated in order to send to Azure. :param id: Resource Identifier. :type id: 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 Front...
62598fac1f5feb6acb162be2
class PasswordResetConfirmView(View): <NEW_LINE> <INDENT> def get(self, request, uidb64, token): <NEW_LINE> <INDENT> if not self._validate_data(request, uidb64, token): <NEW_LINE> <INDENT> return redirect('users:password-reset') <NEW_LINE> <DEDENT> form = PasswordResentConfirmForm() <NEW_LINE> return render(request, 'u...
View to set new password for the account. Using default implementation provided by django.
62598fac30bbd7224646995a
class TopicUniqueness: <NEW_LINE> <INDENT> def __init__(self, topics): <NEW_LINE> <INDENT> self.topics = topics <NEW_LINE> self.K = len(topics) <NEW_LINE> self.n = len(self.topics[0]) <NEW_LINE> self.cnt_lookup = {} <NEW_LINE> self.topic_uniqueness = {} <NEW_LINE> <DEDENT> def compute_cnt_per_topic(self, k): <NEW_LINE>...
Implementation of the Topic Uniqueness metric from the Amazon NTM blog : https://aws.amazon.com/blogs/machine-learning/amazon-sagemaker-neural-topic-model-now-supports-auxiliary-vocabulary-channel-new-topic-evaluation-metrics-and-training-subsampling/#:~:text=Word%20embedding%20topic%20coherence%20metric,top%20words%20...
62598fac4c3428357761a27d
class TDNN(Model): <NEW_LINE> <INDENT> def __init__(self, input_, embed_dim=650, feature_maps=[50, 100, 150, 200, 200, 200, 200], kernels=[1,2,3,4,5,6,7], checkpoint_dir="checkpoint", forward_only=False): <NEW_LINE> <INDENT> self.embed_dim = embed_dim <NEW_LINE> self.feature_maps = feature_maps <NEW_LINE> self.kernels ...
Time-delayed Nueral Network (cf. http://arxiv.org/abs/1508.06615v4)
62598facbd1bec0571e150a5
class Asteroid: <NEW_LINE> <INDENT> def __init__(self, x, y, random_size, velocity): <NEW_LINE> <INDENT> if isinstance(x, int) == False or isinstance(y, int) == False: <NEW_LINE> <INDENT> raise ValueError('Please use integer values.') <NEW_LINE> <DEDENT> elif isinstance(random_size, int) == False or isinstance(velocity...
A class to model an asteroid for the game "SpaceShip Adventure." Invariants: x must be between 15 and 465. y must be -70. Velocity must be between 2 and 6.
62598fac63b5f9789fe8512a
class Filters(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Type = None <NEW_LINE> self.DeptIds = None <NEW_LINE> self.UserIds = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Type = params.get("Type") <NEW_LINE> self.DeptIds = params.get("DeptIds") ...
可见范围过滤参数
62598fac57b8e32f525080fd
class IHeaderAndFooter(Interface): <NEW_LINE> <INDENT> pass
Utility (function) to add header/footer.
62598fac3317a56b869be52c
class HDFDataset(Dataset): <NEW_LINE> <INDENT> def __init__( self, data_path, batch_size, train_group="train", val_group="validation", test_group="test", dataset="images", target="masks", prefetch=1, preprocessor=None, is_training=None, is_testing=None, ): <NEW_LINE> <INDENT> self.data_path = str(data_path) <NEW_LINE> ...
A wrapper for the dataset class that makes it easier to create datasets with HDFReaders.
62598face5267d203ee6b8ce
class Integer(object): <NEW_LINE> <INDENT> def __init__(self, min_value=None, max_value=None): <NEW_LINE> <INDENT> self.min_value = min_value <NEW_LINE> self.max_value = max_value
Integer type. Instance variables: min_value -- minimum allowed value max_value -- maximum allowed value
62598fac091ae35668704be2
class HttpError(Exception): <NEW_LINE> <INDENT> def __init__(self, status_code, message): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.status_code = status_code <NEW_LINE> self.message = message <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'Received HTTP status code {self.status_code}: {...
HTTP status code received was not 200 OK Attributes ---------- status_code : int http status code message : str http text corresponding to status code
62598face76e3b2f99fd89fa