code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MyCacheHookWrapper(MyHookWrapper): <NEW_LINE> <INDENT> def __init__(self, pipe, processor): <NEW_LINE> <INDENT> super(MyCacheHookWrapper, self).__init__(pipe, processor) <NEW_LINE> self.cache = dict() <NEW_LINE> <DEDENT> def initialize(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def prepare(self): <NEW_LI... | 每个处理器使用自己钩子来维护自己的状态,不讲这个任务交给app,
尽量少用宏观变量或者使用过于细节的东西来管理多数宏观的东西,
即尽量保持代码的局部性,减少宏观的代码,这样是为了将各代码
管控范围缩小,方便维护,如修改和找 bug 等。
给拦截器添加不同的功能,hooker将核心逻辑与边角功能分开。 | 62598f078a349b6b43684d14 |
class ProfileM3(ProfileM3A8): <NEW_LINE> <INDENT> arch = 'm3' | A Profile measure class for M3. | 62598f0731939e2706ed0fca |
@dataclass <NEW_LINE> class InlineQueryResultContact(Base): <NEW_LINE> <INDENT> type: str <NEW_LINE> id: str <NEW_LINE> phone_number: str <NEW_LINE> first_name: str <NEW_LINE> last_name: Optional[str] = None <NEW_LINE> vcard: Optional[str] = None <NEW_LINE> reply_markup: Optional[InlineKeyboardMarkup] = None <NEW_LINE>... | Represents a contact with a phone number. By default, this contact
will be sent by the user. Alternatively, you can use
input_message_content to send a message with the specified content
instead of the contact. | 62598f07a05bb46b38489349 |
class multiple_declarations_found_t(RuntimeError): <NEW_LINE> <INDENT> def __init__(self, decl_matcher): <NEW_LINE> <INDENT> RuntimeError.__init__(self) <NEW_LINE> self._decl_matcher = decl_matcher <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return ( "Multiple declarations have been found. Matcher: [%s]"... | Exception raised when more than one declaration was found | 62598f070fa83653e46f39b5 |
class TestEmailBuilder: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.email_build = email_builder.EmailBuilder() <NEW_LINE> <DEDENT> def test_get_email_content(self): <NEW_LINE> <INDENT> email_cont = self.email_build.get_email_content("test@email.com", "Boston,MA", 25, 20, "warm") <NEW_LINE> assert e... | Test class for email agent.
run with
nosetests -v --nocapture test_email_builder.py
or
nosetests -v test_email_builder.py | 62598f07ad47b63b2c5a62ea |
class LastView(models.Model): <NEW_LINE> <INDENT> date = models.DateTimeField(auto_now=True) <NEW_LINE> post = models.ForeignKey(Post) <NEW_LINE> user = models.ForeignKey(User) <NEW_LINE> def update(self): <NEW_LINE> <INDENT> self.date = datetime.datetime.now() <NEW_LINE> self.save() | Post last view time, for checking new comments | 62598f07ec188e330fdf7382 |
class FnmatchMatcher: <NEW_LINE> <INDENT> def __init__(self, pats): <NEW_LINE> <INDENT> self.pats = list(pats) <NEW_LINE> self.re = fnmatches_to_regex(self.pats, case_insensitive=False) <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return f"<FnmatchMatcher {self.pats}>" <NEW_LINE> <DEDENT> def info(self):... | A matcher for files by file name pattern. | 62598f074a966d76dd5ed9a5 |
class DetailsView_Zgloszenie(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> queryset = Zgloszenie.objects.all() <NEW_LINE> serializer_class = ZgloszeniaSerializer | This class handles the http GET, PUT and DELETE requests. | 62598f08091ae356687036ed |
class IfDraft(Generator): <NEW_LINE> <INDENT> def __init__(self, then_, else_): <NEW_LINE> <INDENT> self.then_ = then_ <NEW_LINE> self.else_ = else_ <NEW_LINE> <DEDENT> def _generators(self, record): <NEW_LINE> <INDENT> return self.then_ if isinstance(record, RDMDraft) else self.else_ <NEW_LINE> <DEDENT> def needs(self... | Generator that depends on whether the record is a draft or not.
IfDraft(
then_=[...],
else_=[...],
)
This might be a temporary hack or the way to go. | 62598f087047854f4633de99 |
class LassoIC(ElasticNetIC): <NEW_LINE> <INDENT> def __init__(self, lambdas=None, n_lambdas=1, standardize=True, criterion='aic'): <NEW_LINE> <INDENT> self.criterion = criterion <NEW_LINE> super(LassoIC, self).__init__( lambdas=lambdas, n_lambdas=n_lambdas, standardize=standardize) | Lasso based on GLMNET with lambda selected by information criterion
Fit a Lasso model. Multiple ``lambdas`` may be fit in a given run, but
this class has no useful method of cross-validating or assessing
the best fit. If multiple ``lambdas`` are provided, model
predictions or parameters will be based off of the ``lamb... | 62598f089f288636728172c8 |
class UnexpectedDataError(Error): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> self.msg = msg | Exception raised for unexpected data returned from the API.
Attributes:
msg -- error message | 62598f08aad79263cf42d2e2 |
class ForkingServer(socketserver.ForkingMixIn, Server): <NEW_LINE> <INDENT> pass | An asynchronous server which forks a new process to handle incoming
requests. | 62598f08fff4ab517ebcc2a6 |
class LogoutHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self, *args, **kwargs): <NEW_LINE> <INDENT> if self.session is not None: <NEW_LINE> <INDENT> self.redirect('/user') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.redirect('/login') <NEW_LINE> <DEDENT> <DEDENT> def post(self, *args, **kwargs): <NEW_LINE>... | Log user out of current session | 62598f080fa83653e46f39b7 |
class UnwantedVPPMessage(IgnoreMessage): <NEW_LINE> <INDENT> pass | This is a message that we don't want | 62598f08283ffb24f3cf237f |
class NetAtmoData(object): <NEW_LINE> <INDENT> def __init__(self, auth, station): <NEW_LINE> <INDENT> self.auth = auth <NEW_LINE> self.data = None <NEW_LINE> self.station = station <NEW_LINE> <DEDENT> def get_module_names(self): <NEW_LINE> <INDENT> self.update() <NEW_LINE> return self.data.keys() <NEW_LINE> <DEDENT> @T... | Get the latest data from NetAtmo. | 62598f08851cf427c66b6d9d |
class Mutation(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def mutate( self, graph: Graph, individual: Individual, parameters: Dict[str, Any] = None ) -> Tuple[Individual, List[int]]: <NEW_LINE> <INDENT> pass | A class that represents a mutation. | 62598f085fdd1c0f98e5ca74 |
class RequestError(BalenaException): <NEW_LINE> <INDENT> def __init__(self, body): <NEW_LINE> <INDENT> super(RequestError, self).__init__() <NEW_LINE> self.message = Message.REQUEST_ERROR.format(body=body) | Exception type for request error.
Args:
body (str): response body.
Attributes:
message (str): error message. | 62598f08fbf16365ca792b70 |
class OrgmodeParseException(Exception): <NEW_LINE> <INDENT> def __init__(self, value) -> None: <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return repr(self.value) | General exception when parsing fails. | 62598f08091ae356687036ef |
class AdminDeliveryConfigSerializer(serializers.Serializer): <NEW_LINE> <INDENT> home_on = serializers.BooleanField(label="配送模式是否开启") <NEW_LINE> home_minimum_order_amount = FuncField(lambda value: round(float(value), 2), label="配送模式起送金额") <NEW_LINE> home_delivery_amount = FuncField(lambda value: round(float(value), 2),... | 后台配送配置序列化器类 | 62598f08aad79263cf42d2e4 |
class KaHrPayrollRecapReportWizard(models.TransientModel): <NEW_LINE> <INDENT> _name = 'ka_hr_payroll.recap.report.wizard' <NEW_LINE> year_period = fields.Selection(YEAR_LIST, string="Tahun Periode", required=True, default=datetime.now().year) <NEW_LINE> month_period = fields.Selection(MONTH_LIST, string="Bulan Periode... | Wizard used to create payroll recap report.
_name = 'ka_hr_payroll.recap.report.wizard' | 62598f08a05bb46b3848934d |
class UUID(TypeDecorator): <NEW_LINE> <INDENT> impl = CHAR <NEW_LINE> def load_dialect_impl(self, dialect): <NEW_LINE> <INDENT> if dialect.name == 'postgresql': <NEW_LINE> <INDENT> return dialect.type_descriptor(UUId()) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return dialect.type_descriptor(CHAR(32)) <NEW_LINE> <D... | Platform-independent UUID type.
Uses PostgreSQL's UUID type, otherwise uses CHAR(32), storing as stringified
hex values.
:hint: adapted from sqlalchemy docs on 'Backend-agnostic GUID Type' | 62598f08bf627c535bcaff4a |
class FreshserviceCallback(object): <NEW_LINE> <INDENT> swagger_types = { 'username': 'str', 'password': 'str', 'subdomain': 'str' } <NEW_LINE> attribute_map = { 'username': 'username', 'password': 'password', 'subdomain': 'subdomain' } <NEW_LINE> def __init__(self, username=None, password=None, subdomain=None): <NEW_L... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f087c178a314d78bf73 |
class Tile: <NEW_LINE> <INDENT> def __init__(self, blocked, x, y, block_sight=None): <NEW_LINE> <INDENT> self.blocked = blocked <NEW_LINE> if block_sight is None: block_sight = blocked <NEW_LINE> self.block_sight = block_sight <NEW_LINE> if self.blocked: self.disp = "#" <NEW_LINE> else: self.disp = "." <NEW_LINE> self.... | The Tile Class defines a square on the map. | 62598f0860cbc95b06362e07 |
class RetTag(DocTag): <NEW_LINE> <INDENT> pass | Tag for type and description of return value | 62598f08091ae356687036f1 |
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> username = db.Column(db.String, nullable=False, unique=True, primary_key=True) <NEW_LINE> password = db.Column(db.Text, nullable=False) <NEW_LINE> email = db.Column(db.Text, nullable=False) <NEW_LINE> first_name = db.Column(db.Text, nullable=F... | User model. A user can login and logout. A user can update their own info, but not another user's | 62598f089f288636728172cd |
class Abs(lasagne.layers.Layer): <NEW_LINE> <INDENT> isdense, isconv, isdropout, ismaxpool, isactivation, issvm = (False,) * 6 <NEW_LINE> isbatchnorm = False <NEW_LINE> def __init__(self, incoming_layer, **kwargs): <NEW_LINE> <INDENT> super(Abs, self).__init__(incoming_layer, **kwargs) <NEW_LINE> self.num_units = self.... | This layer returns the absolute values of a dense layer | 62598f088a349b6b43684d1a |
class PrivateLinkResource(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'group_id': {'key': 'properties.groupId', 'type': 'str'}, 'display_name': {'key': 'properties.displayName', 't... | Information of the private link resource.
:ivar id: Fully qualified identifier of the resource.
:vartype id: str
:ivar name: Name of the resource.
:vartype name: str
:ivar type: Type of the resource.
:vartype type: str
:ivar group_id:
:vartype group_id: str
:ivar display_name:
:vartype display_name: str
:ivar required... | 62598f0826068e7796d4b42e |
class Choices(object): <NEW_LINE> <INDENT> def __init__(self, *choices): <NEW_LINE> <INDENT> self._full = [] <NEW_LINE> self._choices = [] <NEW_LINE> self._choice_dict = {} <NEW_LINE> for choice in self.equalize(choices): <NEW_LINE> <INDENT> self._full.append(choice) <NEW_LINE> self._choices.append((choice[0], choice[2... | A class to encapsulate handy functionality for lists of choices
for a Django model field.
Each argument to ``Choices`` is a choice, represented as either a
string, a two-tuple, or a three-tuple.
If a single string is provided, that string is used as the
database representation of the choice as well as the
human-reada... | 62598f085fcc89381b265697 |
class ControllerV11(Controller): <NEW_LINE> <INDENT> def get_builder(self, req): <NEW_LINE> <INDENT> base_url = req.application_url <NEW_LINE> project_id = getattr(req.environ['nova.context'], 'project_id', '') <NEW_LINE> return images_view.ViewBuilderV11(base_url, project_id) <NEW_LINE> <DEDENT> def index(self, req): ... | Version 1.1 specific controller logic. | 62598f08aad79263cf42d2e7 |
class Assembler(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.clear() <NEW_LINE> <DEDENT> def add(self, data): <NEW_LINE> <INDENT> self.value += data <NEW_LINE> <DEDENT> def clear(self): <NEW_LINE> <INDENT> self.value = '' <NEW_LINE> <DEDENT> def is_done(self): <NEW_LINE> <INDENT> return sel... | Reassemble fragmented OTR messages.
This does not deal with OTR fragmentation, which is handled by potr, but
fragmentation of received OTR messages that are too large for IRC. | 62598f083346ee7daa336bcf |
class CnnBetaClassifier(AbstractBetaDetector): <NEW_LINE> <INDENT> __mapper_args__ = dict(polymorphic_identity='cnn_beta_classifier') <NEW_LINE> def judge_video(self, video_path=None, imagedir=None): <NEW_LINE> <INDENT> from affine.detection.vision.cnn_classifier import detection as cnn_detection <NEW_LINE> ... | Cnn feature based BETA classifier | 62598f08d486a94d0ba2aa9e |
class ReplayBuffer: <NEW_LINE> <INDENT> def __init__(self, buffer_size, batch_size, seed): <NEW_LINE> <INDENT> self.memory = deque(maxlen=buffer_size) <NEW_LINE> self.batch_size = batch_size <NEW_LINE> self.experience = namedtuple("Experience", field_names=["state", "action", "reward", "next_state", "done"]) <NEW_LINE>... | Fixed-size buffer to store experience tuples. | 62598f08283ffb24f3cf2384 |
class Array(object): <NEW_LINE> <INDENT> def __init__(self, capacity, fillValue = None): <NEW_LINE> <INDENT> self._items = list() <NEW_LINE> for count in range(capacity): <NEW_LINE> <INDENT> self._items.append(fillValue) <NEW_LINE> <DEDENT> self._logicalsize = 0 <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT... | Represents an array. | 62598f087cff6e4e811b44bf |
class MyGame(arcade.Window): <NEW_LINE> <INDENT> def __init__(self, width, height, title): <NEW_LINE> <INDENT> super().__init__(width, height, title) <NEW_LINE> file_path = os.path.dirname(os.path.abspath(__file__)) <NEW_LINE> os.chdir(file_path) <NEW_LINE> self.coin_list = None <NEW_LINE> self.wall_list = None <NEW_LI... | Main application class. | 62598f0897e22403b38399b9 |
class ReturnsGeometryFunction(BaseFunction): <NEW_LINE> <INDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> return getattr(functions, name)(self) <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return functions.equals(self, other) | Represents a database function which returns a new geometry.
This class adds support for "function chaining", so that a new function
can called on a function that returns a geometry, for example::
session.scalar(r.road_geom.point_n(5).wkt)
Note that only database generic functions (in package 'functions') can be... | 62598f0826068e7796d4b430 |
class Illustrator(InnerDoc): <NEW_LINE> <INDENT> name = Text() <NEW_LINE> birthdate = Date() <NEW_LINE> nationality = Keyword() | Inner object to be nested in Book, details on an illustrator
| 62598f08656771135c488164 |
class CondElseClause(ASTNode): <NEW_LINE> <INDENT> def __init__(self, then_body): <NEW_LINE> <INDENT> super(ASTNode, self).__init__() <NEW_LINE> self.then_body = then_body <NEW_LINE> <DEDENT> def accept(self, visitor, environment): <NEW_LINE> <INDENT> return visitor.visit_cond_else_clause(self, environment) <NEW_LINE> ... | 'Cond' else clause | 62598f08cc40096d61619746 |
class PairPotentialTabulator(PotentialTabulator): <NEW_LINE> <INDENT> def __init__(self, rmax, num, neighbor_buffer, potentials=None, fmax=None): <NEW_LINE> <INDENT> super().__init__(0,rmax,num,potentials) <NEW_LINE> self.neighbor_buffer = neighbor_buffer <NEW_LINE> self.fmax = fmax <NEW_LINE> <DEDENT> @property <NEW_L... | Tabulates one or more pair potentials.
Enables evaluation of energy, force, and derivative at different
positional values (i.e. ``r``).
Parameters
----------
rmax : float
The maximum value of ``r`` at which to tabulate.
num : int
The number of points (value of ``r``) at which to tabulate and evaluate the pote... | 62598f087cff6e4e811b44c1 |
class FNVTest(TestCase): <NEW_LINE> <INDENT> def test_fnv0_32(self): <NEW_LINE> <INDENT> for string, expected_hval in vector.fnv0_32_vector.items(): <NEW_LINE> <INDENT> result = fnvhash.fnv0_32(string) <NEW_LINE> self.assertEqual(result, expected_hval) <NEW_LINE> <DEDENT> <DEDENT> def test_fnv1_32(self): <NEW_LINE> <IN... | FNV hash test suite. | 62598f08ad47b63b2c5a62f4 |
class ConfigError(Exception): <NEW_LINE> <INDENT> status_code = 400 | An error that's thrown when something is wrong with the config file. | 62598f08cc40096d61619747 |
class NoteForm(FlaskForm): <NEW_LINE> <INDENT> note = TextAreaField(validators=[DataRequired()]) <NEW_LINE> user = IntegerField(validators=[DataRequired(), NumberRange(min=0)]) <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(NoteForm, self).__init__(*args, **kwargs) | Form to allow users to write notes about contracts
Attributes:
note: Body of note
user: ID of the :py:class:`~purchasing.users.models.User`
who wrote the note | 62598f08ec188e330fdf738c |
class Test(unittest.TestCase): <NEW_LINE> <INDENT> for module in MODULES: <NEW_LINE> <INDENT> suite = unittest.TestLoader().loadTestsFromModule(module) <NEW_LINE> unittest.TextTestRunner(verbosity=2).run(suite) | Run all tests | 62598f08283ffb24f3cf2387 |
class Game(): <NEW_LINE> <INDENT> def __init__(self, numOfGames, muteOutput, randomAI, AIforHuman): <NEW_LINE> <INDENT> self.numOfGames = numOfGames <NEW_LINE> self.muteOutput = muteOutput <NEW_LINE> self.maxTimeOut = 10000 <NEW_LINE> self.AIforHuman = AIforHuman <NEW_LINE> self.gameRules = GameRules() <NEW_LINE>... | The Game class manages the control flow of the 3-Board Misere Tic-Tac-Toe | 62598f08aad79263cf42d2ea |
class YAMLPropertyFile(Bcfg2.Server.Plugin.FileBacked, PropertyFile): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> Bcfg2.Server.Plugin.FileBacked.__init__(self, name) <NEW_LINE> PropertyFile.__init__(self, name) <NEW_LINE> self.yaml = None <NEW_LINE> <DEDENT> __init__.__doc__ = Bcfg2.Server.Plugin.... | Handle YAML Properties files. | 62598f08d486a94d0ba2aaa2 |
class intSet(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.vals = [] <NEW_LINE> <DEDENT> def insert(self, e): <NEW_LINE> <INDENT> if not e in self.vals: <NEW_LINE> <INDENT> self.vals.append(e) <NEW_LINE> <DEDENT> <DEDENT> def member(self, e): <NEW_LINE> <INDENT> return e in self.vals <NEW_LI... | An intSet is a set of integers
The value is represented by a list of ints, self.vales.
Each int in the set occurs in self.vals exactly once. | 62598f087b180e01f3e485b6 |
class BlueairVOCSensor(BlueairEntity, SensorEntity): <NEW_LINE> <INDENT> _attr_device_class = DEVICE_CLASS_VOLATILE_ORGANIC_COMPOUNDS <NEW_LINE> _attr_native_unit_of_measurement = "ppb" <NEW_LINE> def __init__(self, name, device): <NEW_LINE> <INDENT> super().__init__("voc", name, device) <NEW_LINE> self._state: float =... | Monitors the VOC. | 62598f0826068e7796d4b434 |
class RegionTableEntry(object): <NEW_LINE> <INDENT> layout = { 0x00: ('sGuid', '16s'), 0x10: ('u64FileOffset', '<Q'), 0x18: ('dwLength', '<I'), 0x1C: ('dwRequired', '<I'), } <NEW_LINE> def __init__ (self, s=None, offset=0, stream=None): <NEW_LINE> <INDENT> self._i = 0 <NEW_LINE> self._pos = offset <NEW_LINE> self._buf ... | Region Table Entry | 62598f08656771135c488168 |
class TestCpuCoreConfigForEnhancedNetworkingStackSwitch(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testCpuCoreConfigForEnhancedNetworkingStackSwitch(self): <NEW_LINE> <INDENT> pass | CpuCoreConfigForEnhancedNetworkingStackSwitch unit test stubs | 62598f088a349b6b43684d20 |
class V1DateTimeSchedule(BaseConfig, polyaxon_sdk.V1DateTimeSchedule): <NEW_LINE> <INDENT> SCHEMA = DateTimeScheduleSchema <NEW_LINE> IDENTIFIER = V1ScheduleKind.DATETIME <NEW_LINE> @property <NEW_LINE> def max_runs(self): <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> @property <NEW_LINE> def end_at(self): <NEW_LINE... | Date schedule is an interface to kick a component execution at a specific time.
Args:
kind: str, should be equal to `datetime`
start_at: datetime, required
## YAML usage
```yaml
>>> schedule:
>>> kind:
>>> startAt:
```
## Python usage
```python
>>> from datetime import datetime
>>> from polyaxon.polyfl... | 62598f08fff4ab517ebcc2b1 |
class SpreadingPanner(object): <NEW_LINE> <INDENT> def __init__(self, panning_func, n_rows): <NEW_LINE> <INDENT> self.panning_func = panning_func <NEW_LINE> self.n_rows = n_rows <NEW_LINE> self.panning_positions = self.generate_panning_positions_even(n_rows) <NEW_LINE> self.panning_positions_results = np.apply_along_ax... | A wrapper around another panner that pans using a uniform spread of
points around the sphere given a weighting function. | 62598f0850812a4eaa62015a |
class RNN(chainer.Chain): <NEW_LINE> <INDENT> def __init__(self, idim, elayers, cdim, hdim, dropout, typ="lstm"): <NEW_LINE> <INDENT> super(RNN, self).__init__() <NEW_LINE> bidir = typ[0] == "b" <NEW_LINE> if bidir: <NEW_LINE> <INDENT> rnn = L.NStepBiLSTM if "lstm" in typ else L.NStepBiGRU <NEW_LINE> <DEDENT> else: <NE... | RNN Module.
Args:
idim (int): Dimension of the imput.
elayers (int): Number of encoder layers.
cdim (int): Number of rnn units.
hdim (int): Number of projection units.
dropout (float): Dropout rate.
typ (str): Rnn type. | 62598f08f9cc0f698b1c483d |
class Action35(Action): <NEW_LINE> <INDENT> def execute(self, instance): <NEW_LINE> <INDENT> raise NotImplementedError('%s not implemented' % ( str(self))) | Send->Stack->To client
Parameters:
0: Subchannel (0-255) (EXPRESSION, ExpressionParameter) | 62598f08956e5f7376df4beb |
class PetUpdateView(LoginRequiredMixin, UpdateView): <NEW_LINE> <INDENT> form_class = PetRegistrationForm <NEW_LINE> template_name = 'pets/pet_form.html' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return Pet.objects.filter(owner=self.request.user) <NEW_LINE> <DEDENT> def get_form_kwargs(self): <NEW_LINE> <I... | Update specific pet
POST /finder/pets/{slug-field}/edit/ | 62598f0897e22403b38399bf |
class HasEvaluableFields(HasPrefAtom): <NEW_LINE> <INDENT> def eval_entries(self, global_vars, local_vars, missings, errors): <NEW_LINE> <INDENT> res = True <NEW_LINE> cache = self._cache <NEW_LINE> for member, m in tagged_members(self, 'fmt').items(): <NEW_LINE> <INDENT> if member in cache: <NEW_LINE> <INDENT> continu... | Object handling the formatting or evaluation of formulas based on tags.
Members should be tagged as fmt for formatting and feval for evaluation.
In the first case the value can be False or True depending on whether the
result should be stored as a global variables. In the second case, the
value should be a Feval insta... | 62598f089f288636728172d4 |
class MinimalAmount(Amount): <NEW_LINE> <INDENT> def __init__(self, nickels, pennies): <NEW_LINE> <INDENT> if pennies > 4: <NEW_LINE> <INDENT> nickels += pennies // 5 <NEW_LINE> pennies -= 5 * (pennies // 5) <NEW_LINE> <DEDENT> Amount.__init__(self, nickels, pennies) | An amount of nickels and pennies that is initialized with no more than
four pennies, by converting excess pennies to nickels.
>>> a = MinimalAmount(3, 7)
>>> a.nickels
4
>>> a.pennies
2
>>> a.value
22 | 62598f0871ff763f4b5e6241 |
class Action25(Action): <NEW_LINE> <INDENT> def execute(self, instance): <NEW_LINE> <INDENT> n = self.evaluate_index(1) <NEW_LINE> for instance in self.get_instances(self.get_parameter(0).objectInfo): <NEW_LINE> <INDENT> layer = instance.layer <NEW_LINE> layer.set_level(instance, n) | Select by Object Picker->Move To Level N
Parameters:
0: Select Object A (TIME, Time)
1: Enter Level Number (OBJECT, Object) | 62598f08167d2b6e312b5a79 |
class MerchantItem(EntityItem): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def represent(base: fl.entities.BaseSolar): <NEW_LINE> <INDENT> return f'{base.system().name()}: {base.name()} ({base.owner().short_name()})' | Origin/destination item used in Merchant. | 62598f089f288636728172d5 |
class Meta(object): <NEW_LINE> <INDENT> unique_together = [ ['connection_id', 'session'], ] | Connection model meta. | 62598f0831939e2706ed0fd1 |
class Hover(Aerodynamic): <NEW_LINE> <INDENT> def __defaults__(self): <NEW_LINE> <INDENT> self.altitude = None <NEW_LINE> self.time = 1.0 * Units.seconds <NEW_LINE> self.state.conditions.update( Conditions.Aerodynamics() ) <NEW_LINE> ones_row = self.state.ones_row <NEW_LINE> self.state.unknowns.throttle = ones_ro... | A stationary hover for VTOL aircraft. No aerodynamic drag and lift are used, since there is no velocity.
Assumptions:
None
Source:
None | 62598f08ad47b63b2c5a62f8 |
class SendMsgBot(sleekxmpp.ClientXMPP): <NEW_LINE> <INDENT> def __init__(self, jid, password,recipient, message): <NEW_LINE> <INDENT> super(SendMsgBot, self).__init__(jid, password) <NEW_LINE> self.recipient = recipient <NEW_LINE> self.msg = message <NEW_LINE> self.add_event_handler("session_start", self.start) <NEW_LI... | A basic SleekXMPP bot that will log in, send a message,
and then log out. | 62598f08cc40096d61619749 |
class LockedDropout(nn.Module): <NEW_LINE> <INDENT> def __init__(self, dropprob, batch_first=True): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.dropprob = dropprob <NEW_LINE> self.batch_first = batch_first <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> if not self.training or self.dropprob == ... | A variant of dropout layer that consistently drops out the same parameters over time. Also known as the variational dropout.
This implentation was modified from the LockedDropout implementation in the flair library (https://github.com/zalandoresearch/flair). | 62598f08aad79263cf42d2ed |
class UUTSendsRAFromLinkLocalWithRSAOptionTestCase(SendHelper): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> self.ui.ask("Please configure the router to send Router Advertisements. Press Y to continue") <NEW_LINE> cga_packets = self.node(1).received(src=self.target(1).link_local_ip(), dst="FF02::1", type=ICMP... | SEND RSA Option - Router Advertisement from link local
Verify the UUT adds the RSA option to Router Advertisement
@private
source rfc 3971 5.2.1 | 62598f083346ee7daa336bd3 |
class CGRestart(Exception): <NEW_LINE> <INDENT> pass | Slope error. Non-descent direction. | 62598f089f288636728172d6 |
class CSCMeasurement: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.wheel_revolution_data_present = False <NEW_LINE> self.crank_revolution_data_present = False <NEW_LINE> self.wheel_revs = 0 <NEW_LINE> self.wheel_event_time = 0 <NEW_LINE> self.crank_revs = 0 <NEW_LINE> self.crank_event_time = 0 <NEW_... | Defines the fields of a CSC measurement | 62598f085fc7496912d477e3 |
class SoftDotAttention(nn.Module): <NEW_LINE> <INDENT> def __init__(self, dim): <NEW_LINE> <INDENT> super(SoftDotAttention, self).__init__() <NEW_LINE> self.linear_in = nn.Linear(dim, dim, bias=False) <NEW_LINE> self.sm = nn.Softmax(dim=1) <NEW_LINE> self.linear_out = nn.Linear(dim * 2, dim, bias=False) <NEW_LINE> self... | Soft Dot Attention.
Ref: http://www.aclweb.org/anthology/D15-1166
Adapted from PyTorch OPEN NMT. | 62598f0826068e7796d4b438 |
class MongoDbV2LinkedService(LinkedService): <NEW_LINE> <INDENT> _validation = { 'type': {'required': True}, 'connection_string': {'required': True}, 'database': {'required': True}, } <NEW_LINE> _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'type': {'key': 'type', 'type': 'str'}, 'connect... | Linked service for MongoDB data source.
All required parameters must be populated in order to send to Azure.
:param additional_properties: Unmatched properties from the message are deserialized to this
collection.
:type additional_properties: dict[str, object]
:param type: Required. Type of linked service.Constant f... | 62598f08f9cc0f698b1c483f |
class DocumentAttributeValue(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "DateValue": (str, False), "LongValue": (integer, False), "StringListValue": ([str], False), "StringValue": (str, False), } | `DocumentAttributeValue <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-kendra-datasource-documentattributevalue.html>`__ | 62598f0860cbc95b06362e13 |
class CartTotals(SequenceSchema): <NEW_LINE> <INDENT> carts = CartTotal() | [
{'id': <cart_id>, 'total': <cart_total>},
] | 62598f08ab23a570cc2d42dd |
class Fraction: <NEW_LINE> <INDENT> def __init__(self, numerator, denominator): <NEW_LINE> <INDENT> if not isinstance(numerator, int) or not isinstance(denominator, int): <NEW_LINE> <INDENT> raise TypeError <NEW_LINE> <DEDENT> elif denominator == 0: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> self.__numera... | This class represents one single fraction that consists of
numerator and denominator | 62598f085fc7496912d477e4 |
class AiNameMatchParsedRequest(AiNameParsedRequest): <NEW_LINE> <INDENT> swagger_types = { 'cultural_context': 'AiNameCulturalContext', 'format': 'str', 'parsed_name': 'list[AiNameComponent]', 'other_parsed_name': 'list[AiNameComponent]' } <NEW_LINE> attribute_map = { 'cultural_context': 'culturalContext', 'format': 'f... | Two parsed names to match request
| 62598f08283ffb24f3cf238f |
class MockVideoSrc(object): <NEW_LINE> <INDENT> def __init__(self, port, width=300, height=200, pattern=None, timeoverlay=False, clockoverlay=False): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> pass | A mock video source | 62598f088a349b6b43684d26 |
@register <NEW_LINE> class CameraStream(MediaStream): <NEW_LINE> <INDENT> _model_name = Unicode('CameraStreamModel').tag(sync=True) <NEW_LINE> constraints = Dict( {'audio': True, 'video': True}, help='Constraints for the camera, see https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia for details.... | Represents a media source by a camera/webcam/microphone using
getUserMedia. See
https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
for more detail.
The constraints trait can be set to specify constraints for the camera or
microphone, which is described in the documentation of getUserMedia, such
... | 62598f08dc8b845886d520aa |
class itkMinimumImageFilterIF3IF3IF3(itkMinimumImageFilterIF3IF3IF3_Superclass): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") <NEW_LINE> __repr__ ... | Proxy of C++ itkMinimumImageFilterIF3IF3IF3 class | 62598f083617ad0b5ee04c10 |
class Bid(_OfferBid): <NEW_LINE> <INDENT> def __init__(self, vLoad, qty, prc, reactive=False): <NEW_LINE> <INDENT> super(Bid, self).__init__(vLoad, qty, prc, reactive) <NEW_LINE> <DEDENT> @property <NEW_LINE> def vLoad(self): <NEW_LINE> <INDENT> return self.generator | Defines a bid to buy a quantity of power at a specified price.
| 62598f087047854f4633deab |
@ray.remote <NEW_LINE> class Filter(OperatorInstance): <NEW_LINE> <INDENT> def __init__(self, instance_id, operator_metadata, input_gate, output_gate): <NEW_LINE> <INDENT> OperatorInstance.__init__(self, instance_id, input_gate, output_gate) <NEW_LINE> self.filter_fn = operator_metadata.logic <NEW_LINE> <DEDENT> def st... | A filter operator instance that applies a user-defined filter to
each record of the stream.
Output records are those that pass the filter, i.e. those for which
the filter function returns True.
Attributes:
filter_fn (function): The user-defined boolean function. | 62598f08099cdd3c63674949 |
class RolePaged(Paged): <NEW_LINE> <INDENT> _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, 'current_page': {'key': 'value', 'type': '[Role]'} } <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(RolePaged, self).__init__(*args, **kwargs) | A paging container for iterating over a list of :class:`Role <azure.mgmt.edgegateway.models.Role>` object | 62598f08167d2b6e312b5a7f |
class ApplyRegex(object): <NEW_LINE> <INDENT> def __init__(self, rules): <NEW_LINE> <INDENT> self.rules = rules <NEW_LINE> <DEDENT> def genRules(self): <NEW_LINE> <INDENT> for search, replace, flag in self.rules: <NEW_LINE> <INDENT> if flag: <NEW_LINE> <INDENT> yield lambda word: re.sub(search, replace, word, flags=re.... | Application d'une suite de regex issu du fichier de rules passé au constructeur | 62598f08d8ef3951e32c73c5 |
class KRTableauxSpinElement(KirillovReshetikhinTableauxElement): <NEW_LINE> <INDENT> def e(self, i): <NEW_LINE> <INDENT> half = TensorProductOfRegularCrystalsElement.e(self, i) <NEW_LINE> if half is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> return TensorProductOfRegularCrystalsElement.e(half, i) <NEW_LI... | Kirillov-Reshetikhin tableau for spinors.
Here we are in the embedding `B(\Lambda_n) \to B(2 \Lambda_n)`, so `e_i`
and `f_i` act by `e_i^2` and `f_i^2` respectively. | 62598f085fc7496912d477e5 |
class Break(Event): <NEW_LINE> <INDENT> def __init__(self, name, change_energy, change_knowledge, change_charisma, change_time): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.change_energy = change_energy <NEW_LINE> self.change_knowledge = change_knowledge <NEW_LINE> self.change_charisma = change_charisma <NEW_L... | This class is for breaks. | 62598f08adb09d7d5dc09093 |
class SavingsAccount(Account): <NEW_LINE> <INDENT> def __init__(self, owner_init: object, interest_rate_init: float, balance_init: float=0): <NEW_LINE> <INDENT> super().__init__(owner_init, balance_init) <NEW_LINE> self._annual_interest_rate = interest_rate_init <NEW_LINE> <DEDENT> @property <NEW_LINE> def balance(self... | CheckingAccount class | 62598f08a05bb46b3848935d |
class SampleInput(unittest.TestCase): <NEW_LINE> <INDENT> def test_sample_input_1(self): <NEW_LINE> <INDENT> inputs = [] <NEW_LINE> inputs.append('5 3 1') <NEW_LINE> inputs.append('1 6') <NEW_LINE> inputs.append('3 5') <NEW_LINE> inputs.append('2 8') <NEW_LINE> inputs = '\n'.join(inputs) + '\n' <NEW_LINE> outputs = '33... | Problem statement sample inputs and outputs | 62598f08f9cc0f698b1c4841 |
class SectionTest(TestCase): <NEW_LINE> <INDENT> def test_str(self): <NEW_LINE> <INDENT> section = Section.objects.create(name='ieGah3cheepo1kaeSuo8') <NEW_LINE> self.assertEqual(str(section), 'ieGah3cheepo1kaeSuo8') | Tests Section model. | 62598f083346ee7daa336bd6 |
class CommodityViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Commodity.objects.all() <NEW_LINE> serializer_class = CommoditySerializer | API endpoint that allows Commodity to be viewed or edited. | 62598f085fdd1c0f98e5ca86 |
class Completions_ClassWith__getitem__(CompletionsBase): <NEW_LINE> <INDENT> prep_script = [ 'import sys' ] <NEW_LINE> cmd = 'sys.version_info[0]' <NEW_LINE> cmd_tab_index = 17 <NEW_LINE> result = '3' <NEW_LINE> comp = re.compile(r'0\s+1\s+2\s+3\s+4') <NEW_LINE> comp_idx = 0 <NEW_LINE> comp_len = 2 | sys.version_info is a class which implements __getitem__ | 62598f089f288636728172dc |
class Import(ImportBase): <NEW_LINE> <INDENT> ids = None <NEW_LINE> def __init__(self, ids: List[Tuple[str, str]]) -> None: <NEW_LINE> <INDENT> self.ids = ids <NEW_LINE> <DEDENT> def accept(self, visitor: NodeVisitor[T]) -> T: <NEW_LINE> <INDENT> return visitor.visit_import(self) | import m [as n] | 62598f089f288636728172dd |
class _DiffContainer(_Diffable): <NEW_LINE> <INDENT> def __init__(self, diffs): <NEW_LINE> <INDENT> self._diffs = diffs <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> total = 0 <NEW_LINE> for d in self._diffs: <NEW_LINE> <INDENT> total += len(d) <NEW_LINE> <DEDENT> return total <NEW_LINE> <DEDENT> def num_a... | A Diff containing object stores a list of Diffables.
Implements all inherited functions by recursively calling
them on the contained elements and accumulating the results. | 62598f08f548e778e596a06e |
class TestNSGroupInfo(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testNSGroupInfo(self): <NEW_LINE> <INDENT> pass | NSGroupInfo unit test stubs | 62598f08656771135c488172 |
class BaseConfig(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def load_config(cls, config): <NEW_LINE> <INDENT> config = config.copy() <NEW_LINE> for k, v in cls.__dict__.iteritems(): <NEW_LINE> <INDENT> if k.startswith('_') or k == 'load_config': <NEW_LINE> <INDENT> continue <NEW_LINE> <DEDENT> value = config.... | Global application *read-only* configuration.
Examples:
See test() below. | 62598f08bf627c535bcaff5c |
class BaseOperations(MetaOperations): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def operation_dispatch(cls, op, key=None, data=None): <NEW_LINE> <INDENT> operation_name = op.replace("-", "_") <NEW_LINE> if operation_name == "meta": <NEW_LINE> <INDENT> operation_name = "meta_list" <NEW_LINE> <DEDENT> try: <NEW_LINE> <... | A proxy for base resource operations.
This brings together operations that cut across all FHIR resources | 62598f084a966d76dd5ed9bb |
class CmdParser(Parser): <NEW_LINE> <INDENT> def __init__(self, cmd: List[str], cmdkargs: Dict[str, Any]) -> None: <NEW_LINE> <INDENT> cmdkargs["stdout"] = subprocess.PIPE <NEW_LINE> self.proc = subprocess.Popen(cmd, **cmdkargs) <NEW_LINE> assert self.proc.stdout is not None <NEW_LINE> self.fdesc = cast(BinaryIO, self.... | Parent class for file parsers with commands | 62598f08283ffb24f3cf2394 |
class LengthError(IdError): <NEW_LINE> <INDENT> pass | Invalid length input for identifer. | 62598f084527f215b58e89e3 |
class Registry(object): <NEW_LINE> <INDENT> def __init__(self, registrar): <NEW_LINE> <INDENT> self.registrar = registrar <NEW_LINE> <DEDENT> def get(self, key): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> layers = key.split('.') <NEW_LINE> value = self.registrar <NEW_LINE> for key in layers: <NEW_LINE> <INDENT> value... | This class is basically a dictionary supercharged with
useful functions.
Attributes
----------
registrar (dict): A registrar to hold a generic
configuration of a class.
Usage
-----
config = {
'a' : 'b',
'c' : {
'd' : 'e'
}
}
reg = Registry(config)
reg.get('a') # returns b
reg.get('... | 62598f08d486a94d0ba2aaae |
class ViewField(object): <NEW_LINE> <INDENT> def __init__(self, design, map_fun, reduce_fun=None, name=None, language='javascript', wrapper=DEFAULT, raw_path='', **defaults): <NEW_LINE> <INDENT> self.design = design <NEW_LINE> self.name = name <NEW_LINE> self.map_fun = map_fun <NEW_LINE> self.reduce_fun = reduce_fun <N... | Descriptor that can be used to bind a view definition to a property of
a `Document` class.
>>> class Person(Document):
... name = TextField()
... age = IntegerField()
... by_name = ViewField('people', '''\
... function(doc) {
... emit(doc.name, doc);
... }''')
>>> Person.by_name... | 62598f0850812a4eaa62015f |
class BaseNotificationService(object): <NEW_LINE> <INDENT> def send_message(self, message, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError | Provides an ABC for notification services. | 62598f08167d2b6e312b5a83 |
class TestConfig(BaseTestCase): <NEW_LINE> <INDENT> def test_disabled_metatypes(self): <NEW_LINE> <INDENT> blacklist = self.pp.navtree_properties.metaTypesNotToList <NEW_LINE> for mt in CONTENTTYPES: <NEW_LINE> <INDENT> self.failUnless(mt in blacklist, '%s still appearing in listings' % mt) <NEW_LINE> <DEDENT> <DEDENT>... | Ensure we have configured this portal | 62598f085fc7496912d477e7 |
class HelloViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def list(self,request): <NEW_LINE> <INDENT> a_viewset = [ 'Uses actions (list,create,update,partial-update,retrieve)', 'Automatically maps URLs using Routers', 'Provides more functionality with less code'... | Test API Viewset | 62598f08f548e778e596a070 |
class hasher: <NEW_LINE> <INDENT> def __init__(self, gpio, callback, timeout=5): <NEW_LINE> <INDENT> self.gpio = gpio <NEW_LINE> self.code_timeout = timeout <NEW_LINE> self.callback = callback <NEW_LINE> self.in_code = False <NEW_LINE> pigpio.set_mode(gpio, pigpio.INPUT) <NEW_LINE> self.cb = pigpio.callback(gpio, pigpi... | This class forms a hash over the IR pulses generated by an
IR remote.
The remote key press is not converted into a code in the manner of
the lirc module. No attempt is made to decode the type of protocol
used by the remote. The hash is likely to be unique for different
keys and different remotes but this is not guar... | 62598f08d8ef3951e32c73c7 |
class TermTypeItem(object): <NEW_LINE> <INDENT> swagger_types = { 'term_type_id': 'int', 'description': 'str', 'comments': 'str', 'date_modified': 'str' } <NEW_LINE> attribute_map = { 'term_type_id': 'TermTypeID', 'description': 'Description', 'comments': 'Comments', 'date_modified': 'DateModified' } <NEW_LINE> def __i... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f087b180e01f3e485bc |
class IPConfigurationProfile(SubResource): <NEW_LINE> <INDENT> _validation = { 'type': {'readonly': True}, 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'st... | IP configuration profile child 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. This name can be used to access the resource.
:type name: str
:ivar type: Sub Resource type.
:vartype type: str
... | 62598f0826068e7796d4b43f |
class Game(): <NEW_LINE> <INDENT> def __init__(self,raw_scores): <NEW_LINE> <INDENT> self._scores = [] <NEW_LINE> self._scored = False <NEW_LINE> self.set_raw_scores(raw_scores) <NEW_LINE> <DEDENT> def set_raw_scores(self,raw_scores): <NEW_LINE> <INDENT> if not raw_scores or len(raw_scores) > 21: <NEW_LINE> <INDENT> ra... | Stores integer list of bowling pins knocked down per
roll and calculates game score.
Atributes: list _scores, int _total_score, bool _scored | 62598f084c34283577618dd2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.