code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Problem(ProblemBase): <NEW_LINE> <INDENT> index = 2 <NEW_LINE> name = "Even Fibonacci numbers" <NEW_LINE> def main(self): <NEW_LINE> <INDENT> fib = [0] * 1000 <NEW_LINE> fib[0] = 1 <NEW_LINE> fib[1] = 2 <NEW_LINE> sumc = 2 <NEW_LINE> for i in range(2,1000): <NEW_LINE> <INDENT> fib[i] = fib[i-1] + fib[i-2] <NEW_LI...
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
62598f7f07d97122c42166b9
class FlashServer: <NEW_LINE> <INDENT> def __init__(self, config: Dict) -> None: <NEW_LINE> <INDENT> self.config = config <NEW_LINE> self.router = FlashRouter(config) <NEW_LINE> self.events: Queue = Queue() <NEW_LINE> self.producers = [ClientMonitor(self.events), DisplayHandler(self.events)] <NEW_LINE> self.keep_going ...
Handle focus shifts and client (flash_window) requests. Parameters ---------- config A config dictionary read from the user config file/CLI options Attributes ---------- router: FlashRouter Object used to match window id's to flash parameters from the config file. keep_going: bool Setting this to Fals...
62598f7f0383005118f6d118
class IncomfortWaterHeater(IncomfortEntity, WaterHeaterDevice): <NEW_LINE> <INDENT> def __init__(self, client, heater) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._unique_id = f"{heater.serial_no}" <NEW_LINE> self.entity_id = ENTITY_ID_FORMAT.format(DOMAIN) <NEW_LINE> self._name = "Boiler" <NEW_LINE...
Representation of an InComfort/Intouch water_heater device.
62598f7f6aa9bd52df0d48f0
class GroundspeedSpeedbrakeDuringTakeoffMax(KeyPointValueNode): <NEW_LINE> <INDENT> units = ut.KT <NEW_LINE> def derive(self, gnd_spd=P('Groundspeed'), spdbrk=P('Speedbrake'), takeoff_roll=S('Takeoff Roll')): <NEW_LINE> <INDENT> SPEEDBRAKE_LIMIT = 39 <NEW_LINE> masked_in_range = np.ma.masked_less_equal(spdbrk.array, SP...
Maximum Groundspeed turing takeoff roll when the speedbrake handle is over limit.
62598f7f8c3a8732951f5f5d
class Doubler: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.number = 0 <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> self.number += 1 <NEW_LINE> return self.number * self.number
An infinite iterator
62598f7f38b623060ffa8aad
class UserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> error_messages = { 'password_mismatch': _("The two password fields didn't match."), } <NEW_LINE> password1 = forms.CharField( label=_("Password"), strip=False, widget=forms.PasswordInput, help_text=password_validation.password_validators_help_text_html(), ) <...
A form that creates a user, with no privileges, from the given username and password.
62598f7f23849d37ff850ad4
class EventDecorator(object): <NEW_LINE> <INDENT> event_names = () <NEW_LINE> def __init__(self, **event_kargs): <NEW_LINE> <INDENT> self.attribute = None <NEW_LINE> self.event_kargs = event_kargs <NEW_LINE> <DEDENT> def __call__(self, func): <NEW_LINE> <INDENT> if not hasattr(func, '__events__'): <NEW_LINE> <INDENT> f...
Base class for event decorators that attaches metadata to function object so that :func:`register` can find the event definition.
62598f7f16aa5153ce3fff17
class JavascriptIncluder(Includer): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> Includer.__init__(self, *args, **kwargs) <NEW_LINE> self.tag_string = '<script type="text/javascript" src="{0}"></script>' <NEW_LINE> <DEDENT> def _compress(self): <NEW_LINE> <INDENT> output = [] <NEW_LINE> ...
Psuedo-template tag that handles collecting Javascript and serving appropriate clean or compressed versions.
62598f7f1f037a2d8b9e3b00
class LikeRecordViewSet(BulkModelViewSet): <NEW_LINE> <INDENT> queryset = LikeRecord.objects.all() <NEW_LINE> serializer_class = serializers.LikeRecordSerializer <NEW_LINE> permission_classes = (IsAuthenticated,)
LikeRecord api set, for add,delete,update,list,retrieve resource
62598f7f76d4e153a661c629
class FashionMNIST(MNIST): <NEW_LINE> <INDENT> urls = [ 'http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz', 'http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-labels-idx1-ubyte.gz', 'http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/t10k-images-idx3-ubyte.gz'...
`Fashion-MNIST <https://github.com/zalandoresearch/fashion-mnist>`_ Dataset. Args: root (string): ``processed/training.pt`` 和 ``processed/test.pt`` 存在的主目录. train (bool, optional): 如果 True, 数据来自训练集, 如果 False, 数据来自测试集. download (bool, optional): 如果 true, 就从网上下载数据集并且放到 root 目录下. 如果数据集已经下载,那么不会再次下...
62598f7f91af0d3eaad39822
class GraphicalLasso(EmpiricalCovariance): <NEW_LINE> <INDENT> def __init__(self, alpha=.01, mode='cd', tol=1e-4, enet_tol=1e-4, max_iter=100, verbose=False, assume_centered=False): <NEW_LINE> <INDENT> super(GraphicalLasso, self).__init__(assume_centered=assume_centered) <NEW_LINE> self.alpha = alpha <NEW_LINE> self.mo...
Sparse inverse covariance estimation with an l1-penalized estimator. Read more in the :ref:`User Guide <sparse_inverse_covariance>`. Parameters ---------- alpha : positive float, default 0.01 The regularization parameter: the higher alpha, the more regularization, the sparser the inverse covariance. mode : {...
62598f7fbaa26c4b54d4ecca
class Article(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=255) <NEW_LINE> description = models.TextField(blank=True, null=True) <NEW_LINE> article_type = models.CharField( max_length=255, choices=ARTICLE_TYPE, null=True, blank=True) <NEW_LINE> created_at = models.DateTimeField(auto_now_add=Tr...
Article Base Class
62598f7fb57a9660fecd1494
class CustomClass(Training): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> logger.info("\n\nPlease implement 'CustomClass.run' method :)\n") <NEW_LINE> return False
Write your code
62598f7f0383005118f6d119
class SmsLoginCodeViewSet(viewsets.GenericViewSet, mixins.CreateModelMixin, mixins.ListModelMixin): <NEW_LINE> <INDENT> serializer_class = SmsLoginSerializer <NEW_LINE> queryset = VerifyCode.objects.none().order_by('id') <NEW_LINE> pagination_class = StandardPageNumberPagination <NEW_LINE> def get_serializer_class(self...
发送登录短信验证码
62598f7fb57a9660fecd1495
@base.abstractslots(('choices',)) <NEW_LINE> class HasChoices(base.Validator): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def __init__( self, *, choices: Optional[SpecifiedValueValidator] = None, **kwargs, ) -> None: <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.choices = choices <NEW_LINE> <DEDENT>...
Abstract base class for validators constrained to choices.
62598f7f6e29344779b0007a
class FabricNetworkResult(object): <NEW_LINE> <INDENT> swagger_types = { 'number_of_elements': 'int', 'content': 'list[FabricNetwork]', 'total_elements': 'int' } <NEW_LINE> attribute_map = { 'number_of_elements': 'numberOfElements', 'content': 'content', 'total_elements': 'totalElements' } <NEW_LINE> def __init__(self,...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62598f7fd99f1b3c44d050c4
class CustomObjectMarkers: <NEW_LINE> <INDENT> Circles2 = _CustomObjectMarker("Circles2", _clad_to_engine_cozmo.CustomObjectMarker.Circles2) <NEW_LINE> Circles3 = _CustomObjectMarker("Circles3", _clad_to_engine_cozmo.CustomObjectMarker.Circles3) <NEW_LINE> Circles4 = _CustomObjectMarker("Circles4", _clad_to_engine_cozm...
Defines all available custom object markers. For use with world.define_custom methods such as :meth:`cozmo.world.World.define_custom_box`, :meth:`cozmo.world.World.define_custom_cube`, and :meth:`cozmo.world.World.define_custom_wall`
62598f7f15baa72349461996
class MenuUI(MenuSection): <NEW_LINE> <INDENT> _header = ['<?xml version="1.0" encoding="UTF-8"?>', "<interface>"] <NEW_LINE> _tailer = [" </menu>", "</interface>"] <NEW_LINE> _indent = 4 <NEW_LINE> def do_label(self, res): <NEW_LINE> <INDENT> label = "app-menu" if self.label is None else self.label <NEW_LINE> res.app...
Menu class for Gtk Builder UI interface
62598f7f596a897236127688
class Lazy(object): <NEW_LINE> <INDENT> def __init__(self, f): <NEW_LINE> <INDENT> self.f = f <NEW_LINE> self.cache = {} <NEW_LINE> <DEDENT> def __get__(self, instance, owner): <NEW_LINE> <INDENT> if instance not in self.cache: <NEW_LINE> <INDENT> self.cache[instance] = self.f(instance) <NEW_LINE> <DEDENT> return self....
Lazy attribute evaluation decorator class
62598f7f004d5f362081ed07
class NodeWrapper(ExprNode): <NEW_LINE> <INDENT> is_node_wrapper = True <NEW_LINE> is_constant_scalar = False <NEW_LINE> child_attrs = [] <NEW_LINE> def __init__(self, pos, type, opaque_node, specialize_node_callback, **kwds): <NEW_LINE> <INDENT> super(NodeWrapper, self).__init__(pos, type) <NEW_LINE> self.opaque_node ...
Adapt an opaque node to provide a consistent interface. This has to be handled by the user's specializer. See :py:class:`ASTBuilder.wrap`
62598f7f66673b3332c2fddd
class Solution(object): <NEW_LINE> <INDENT> def numDistinct(self, s, t): <NEW_LINE> <INDENT> dp = [[0 for _ in range(len(t)+1)] for _ in range(len(s)+1)] <NEW_LINE> for i in range(len(s)+1): <NEW_LINE> <INDENT> dp[i][0] = 1 <NEW_LINE> <DEDENT> for i in range(len(s)): <NEW_LINE> <INDENT> for j in range(len(t)): <NEW_LIN...
'' r a b b i t --> t '' 1 0 0 0 0 0 0 r 1 1 0 0 0 0 0 a 1 1 1 0 0 0 0 b 1 1 1 1 0 0 0 b 1 1 1 2 1 0 0 b 1 1 1 3 3 0 0 i 1 1 1 3 3 3 0 t 1 1 1 3 3 3 3 \|/ s
62598f7fc432627299fa29e7
class SecurityGroupPermission(object): <NEW_LINE> <INDENT> def __init__(self, group, ingress): <NEW_LINE> <INDENT> self.group = group <NEW_LINE> self.protocol = ingress["IpProtocol"] <NEW_LINE> if self.protocol == "-1" or self.protocol not in ["tcp", "udp", "icmp", "icmpv6", "58"]: <NEW_LINE> <INDENT> self.fr...
Basic class for security group `IpPermissions`. Encapsulates `IpProtocol`/`FromPort`/`ToPort` and list of `IpRanges`.
62598f7f63f4b57ef0085a7a
class BenchmarkDriver: <NEW_LINE> <INDENT> def __init__(self, producer: machine_producer.MachineProducer, method: types.FunctionType, runs: int = 1, **kwargs): <NEW_LINE> <INDENT> self._producer = producer <NEW_LINE> self._method = method <NEW_LINE> self._kwargs = copy.deepcopy(kwargs) <NEW_LINE> self._threads = [] <NE...
Allocates machines and invokes a benchmark method.
62598f7f07d97122c42166bb
class UserNotification(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, primary_key=True ) <NEW_LINE> disabled_notifications = models.ManyToManyField(Notification)
Add a User Notification record, then add disabled notifications to disable records. On your user Admin, add the field user_notification
62598f7f7c178a314d78cec3
class ThreadMeter(threading.Thread): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.running = False <NEW_LINE> <DEDENT> def run(self) -> None: <NEW_LINE> <INDENT> self.running = True <NEW_LINE> self.show() <NEW_LINE> rate = 1 / self.rate <NEW_LINE> while self.running: <NE...
secondary base class to make a threaded Meter
62598f7f94891a1f408b93fb
class EventTrackingConfig(AppConfig): <NEW_LINE> <INDENT> name = 'eventtracking.django' <NEW_LINE> label = 'eventtracking_django' <NEW_LINE> def ready(self): <NEW_LINE> <INDENT> super().ready() <NEW_LINE> from eventtracking.django.django_tracker import override_default_tracker <NEW_LINE> override_default_tracker()
Django 1.8 requires unique app labels and only uses the characters to the right of the last period in the string. .django was not specific enough.
62598f808c3a8732951f5f5f
class APIClient(object): <NEW_LINE> <INDENT> REQUIRED_AUTH = [None] <NEW_LINE> def __init__(self, auth, retry_count=REST_RETRY_COUNT, retry_delay=REST_RETRY_DELAY, rest_headers=REST_HEADERS, logger=None, internal_retry=REST_INTERNAL_RETRY): <NEW_LINE> <INDENT> self.retry_count = retry_count <NEW_LINE> self.retry_delay ...
FCO API Client.
62598f80a4f1c619b294e006
class TerreImageConstant(object): <NEW_LINE> <INDENT> instance = None <NEW_LINE> def __new__(cls, *args, **kwargs): <NEW_LINE> <INDENT> if not cls.instance: <NEW_LINE> <INDENT> cls.instance = super(TerreImageConstant, cls).__new__(cls, *args, **kwargs) <NEW_LINE> cls.instance.__private_init__() <NEW_LINE> <DEDENT> retu...
This class allow to manage constants of the catalog. It manages: iface -- iface to link the catalog to qgis (adding layers, acces to canvas...) canvas -- mapCanvas of qgis == self.iface.mapCanvas() legendInterface -- acces from qgis to symbols, layers ... ...
62598f80b57a9660fecd1496
class RetriveMemory(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_stream, n_iteration, p_dimension_list, kappa, retrive_it_mask): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.n_stream = n_stream <NEW_LINE> self.n_iteration = n_iteration <NEW_LINE> self.p_dimension_list = p_dimension_list <NEW_LINE> sel...
Rey, reused by both Generative and Inference model. Generator: pt ~ N(.| u = attractor(gt_, Mt-1), sigma = f(u)) Inference: px_t = attractor(x_t, Mt-1)
62598f80287bf620b62715cc
class truncnorm_gen(rv_continuous): <NEW_LINE> <INDENT> def _argcheck(self, a, b): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.b = b <NEW_LINE> self._nb = _norm_cdf(b) <NEW_LINE> self._na = _norm_cdf(a) <NEW_LINE> self._delta = self._nb - self._na <NEW_LINE> self._logdelta = log(self._delta) <NEW_LINE> return (a != ...
A truncated normal continuous random variable. %(before_notes)s Notes ----- The standard form of this distribution is a standard normal truncated to the range [a,b] --- notice that a and b are defined over the domain of the standard normal. To convert clip values for a specific mean and standard deviation, use:: ...
62598f80b830903b9686e17e
class FunctionCollector: <NEW_LINE> <INDENT> functions = {} <NEW_LINE> def __new__(cls): <NEW_LINE> <INDENT> if not hasattr(cls, "instance") or not cls.instance: <NEW_LINE> <INDENT> cls.instance = super().__new__(cls) <NEW_LINE> <DEDENT> return cls.instance <NEW_LINE> <DEDENT> def clear(self): <NEW_LINE> <INDENT> self....
Collect functions for the Jinja renderer
62598f8050485f2cf55da98c
class SKUCapability(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'name': {'readonly': True}, 'value': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'value': {'key': 'value', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT>...
The capability information in the specified SKU, including file encryption, network ACLs, change notification, etc. Variables are only populated by the server, and will be ignored when sending a request. :ivar name: The name of capability, The capability information in the specified SKU, including file encryption, n...
62598f80596a89723612768a
class TestSplitGP(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_init_basic(self): <NEW_LINE> <INDENT> BasicKernel() <NEW_LINE> <DEDENT> def test_init_basic_ep(self): <NEW_LINE> <INDENT> BasicKernelEP() <NEW_LINE> <DEDENT> def test_init_quasiperiodic(self)...
Test the SplitGP class
62598f804e696a045264db0d
class SBMLTestODE(unittest.TestCase): <NEW_LINE> <INDENT> def testRun(self): <NEW_LINE> <INDENT> model = load_odemodel(KINETIC_MODEL) <NEW_LINE> save_sbml_model(model, KINETIC_MODEL_COPY) <NEW_LINE> model_copy = load_odemodel(KINETIC_MODEL_COPY) <NEW_LINE> self.assertEqual(model.id, model_copy.id) <NEW_LINE> self.asser...
Test SBML import and export.
62598f801d351010ab8f3558
class MPIExecEngineSetLauncher(MPIExecLauncher, EngineMixin): <NEW_LINE> <INDENT> @property <NEW_LINE> def program(self): <NEW_LINE> <INDENT> return self.engine_cmd <NEW_LINE> <DEDENT> @property <NEW_LINE> def program_args(self): <NEW_LINE> <INDENT> return self.cluster_args + self.engine_args <NEW_LINE> <DEDENT> def st...
Launch engines using mpiexec
62598f801f5feb6acb16264e
class TestEntitybridgeStatusApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = swagger_client.api.entitybridge_status_api.EntitybridgeStatusApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_entity_bridge_status_by_id_get(self): <...
EntitybridgeStatusApi unit test stubs
62598f8026068e7796d4c376
class BatdongsanCrawlerPipeline(object): <NEW_LINE> <INDENT> def process_item(self, item, spider): <NEW_LINE> <INDENT> print('BatdongsanCrawlerPipeline') <NEW_LINE> return item
Summary
62598f8023e79379d538bf14
class Attributes(object): <NEW_LINE> <INDENT> def __init__(self, dic): <NEW_LINE> <INDENT> self.__dict__.update(dic)
A class to access dict fields like object attributes
62598f80ac7a0e7691f71f34
@loader.tds <NEW_LINE> class PythonMod(loader.Module): <NEW_LINE> <INDENT> strings = {"name": "Python", "evaluated": "<b>Evaluated expression:</b>\n<code>{}</code>\n<b>Return value:</b>\n<code>{}</code>", "evaluate_fail": ("<b>Failed to evaluate expression:</b>\n<code>{}</code>" "\n\n<b>Due to</b>:\n<code>{}</code>"), ...
Python stuff
62598f8063b5f9789fe84b8c
class Wklejka(models.Model): <NEW_LINE> <INDENT> nickname = models.CharField(max_length=30, null=True) <NEW_LINE> user = models.ForeignKey(User, blank=True, null=True) <NEW_LINE> body = models.TextField() <NEW_LINE> pub_date = models.DateTimeField(auto_now_add=True) <NEW_LINE> mod_date = models.DateTimeField(auto_now=T...
This model represents a single paste, both for anonymous and authenticated pasters.
62598f80442bda511e95be76
class Sample(Main): <NEW_LINE> <INDENT> synopsis = 'sample' <NEW_LINE> def postOptions(self): <NEW_LINE> <INDENT> alias = self.parent['alias'] <NEW_LINE> assert alias in DBAlias <NEW_LINE> connect(**DBHost[alias]) <NEW_LINE> for cls in user.User, recipe.Recipe: <NEW_LINE> <INDENT> cls.objects.delete() <NEW_LINE> col = ...
Load the .json sample files
62598f80d53ae8145f917ea9
class ProcessingJobImageSweeps(ispyb.model.DBCache): <NEW_LINE> <INDENT> def __init__(self, jobid, db_area): <NEW_LINE> <INDENT> self._db = db_area <NEW_LINE> self._jobid = int(jobid) <NEW_LINE> <DEDENT> def reload(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._data = [ ProcessingJobImageSweep( p["dataCollec...
An object representing the list of image sweeps for a ProcessingJob database entry. The object lazily accesses the underlying database when necessary and exposes the sweeps as a list.
62598f80a17c0f6771d5bc5f
class ImputerRegression(nn.Module): <NEW_LINE> <INDENT> def __init__(self, input_size, bias=True): <NEW_LINE> <INDENT> super(ImputerRegression, self).__init__() <NEW_LINE> self.bias = bias <NEW_LINE> self.W = Parameter(torch.Tensor(input_size, input_size)) <NEW_LINE> nn.init.xavier_uniform_(self.W) <NEW_LINE> stdv = 1....
Estimate variable from other features
62598f80d10714528d69d8ea
@namespace.route('/challenge/suggestions') <NEW_LINE> class UpdateSuggestions(Resource): <NEW_LINE> <INDENT> @namespace.doc('update_suggestions') <NEW_LINE> def put(self): <NEW_LINE> <INDENT> user = current_user() <NEW_LINE> if not user or not user.is_admin: <NEW_LINE> <INDENT> return '', 403 <NEW_LINE> <DEDENT> challe...
Save the suggestions for a weekly challenge
62598f806e29344779b0007e
class Man(Pet): <NEW_LINE> <INDENT> pass
This is the class for Man
62598f80b830903b9686e17f
class Role(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'roles' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(64), unique=True) <NEW_LINE> users = db.relationship('User', backref='role', lazy='dynamic') <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return '<Role % ...
Roles Models
62598f80711fe17d825e0104
class PyEnum(types.TypeDecorator): <NEW_LINE> <INDENT> impl = types.Enum <NEW_LINE> def __init__(self, python_class, *args, **kw): <NEW_LINE> <INDENT> self.python_class = python_class <NEW_LINE> super(PyEnum, self).__init__(*args, **kw) <NEW_LINE> <DEDENT> def process_bind_param(self, value, dialect): <NEW_LINE> <INDEN...
Augmented Enum class for SQLAlchemy/Python types Python's enum.Enum class cannot be stored directly in a postgres row because it is too complex, and raises: sqlalchemy.exc.ProgrammingError: (ProgrammingError) can't adapt type We could work-around by storing enum.Enum.name, but it looks ugly and who wants to type...
62598f80596a89723612768c
class SNREnergy(): <NEW_LINE> <INDENT> def __init__(self, frequency_band, window): <NEW_LINE> <INDENT> self.frequency_band = frequency_band <NEW_LINE> self.window = window
Station Parameter SNR and Energy parameters
62598f80498bea3a75a57540
class Reparametrization(Layer): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def reparametrize(cls, mean, logarithmic_covariance): <NEW_LINE> <INDENT> shape = tf.shape(mean) <NEW_LINE> standard_deviation = k.exp(0.5 * logarithmic_covariance) <NEW_LINE> epsilon = k.random_normal(shape) <NEW_LINE> reparametrization = mean...
A deterministic layer for performing Kingma and Welling's "reparametrization trick".
62598f80c432627299fa29ea
class Prescription(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.MedicineList = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("MedicineList") is not None: <NEW_LINE> <INDENT> self.MedicineList = [] <NEW_LINE> for item in params.get("Medicin...
处方单
62598f8066673b3332c2fde1
class OAuth(object): <NEW_LINE> <INDENT> def __init__(self, api_endpoint, client_id, client_secret, redirect_uri, grant_type): <NEW_LINE> <INDENT> self.api_endpoint = api_endpoint <NEW_LINE> self.client_id = client_id <NEW_LINE> self.client_secret = client_secret <NEW_LINE> self.redirect_uri = redirect_uri <NEW_LINE> s...
Handles OAuth authentication procedures and helps retrieve tokens
62598f807c178a314d78cec7
class SupervisedPopen(QObject): <NEW_LINE> <INDENT> error = Signal(str, str, str) <NEW_LINE> finished = Signal(str) <NEW_LINE> def __init__(self, args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=subprocess.PIPE, preexec_fn=None, close_fds=False, shell=False, cwd=None, env=None, universal_newlines=False...
The class overrides the subprocess.Popen and waits in a thread for its finish. If an error is printed out, it will be shown in a message dialog.
62598f80dc8b845886d52fd3
class UpdateJobRequest(proto.Message): <NEW_LINE> <INDENT> job = proto.Field( proto.MESSAGE, number=1, message=gct_job.Job, ) <NEW_LINE> update_mask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, )
Update job request. Attributes: job (google.cloud.talent_v4beta1.types.Job): Required. The Job to be updated. update_mask (google.protobuf.field_mask_pb2.FieldMask): Strongly recommended for the best service experience. If [update_mask][google.cloud.talent.v4beta1.UpdateJobRequ...
62598f8026238365f5fac58c
class HTTPSServer (StoppableHTTPServer): <NEW_LINE> <INDENT> def __init__ (self, address, handler): <NEW_LINE> <INDENT> import ssl <NEW_LINE> BaseServer.__init__ (self, address, handler) <NEW_LINE> CERTFILE = os.path.abspath(os.path.join('..', os.getenv('srcdir', '.'), 'certs', 'server-cert.pem')) <NEW_LINE> KEYFILE = ...
The HTTPSServer class extends the StoppableHTTPServer class with additional support for secure connections through SSL.
62598f80be383301e0253216
class Attention_user(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'attention_users' <NEW_LINE> attention_time = db.Column(db.DateTime, default=datetime.datetime.now) <NEW_LINE> follower_id = db.Column(db.Integer, db.ForeignKey('users.id'), primary_key=True) <NEW_LINE> followed_id = db.Column(db.Integer, db.ForeignKey...
为实现用户关注的多对多关系创建的表
62598f80bde94217f3707374
class MembershipForm(colander.Schema): <NEW_LINE> <INDENT> person = PersonalDataCreateEdit( title=_(u"Personal Data"), ) <NEW_LINE> membership_info = MembershipInfo( title=_(u"Membership Requirements") ) <NEW_LINE> shares = Shares( title=_(u"Shares") )
The Form consists of - Personal Data - Membership Information - Shares
62598f80ac7a0e7691f71f36
class Config(Singleton): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Singleton.__init__(self) <NEW_LINE> self.config_file = CONFIG_FILE <NEW_LINE> self.data = {} <NEW_LINE> if os.path.exists(self.config_file): <NEW_LINE> <INDENT> with open(self.config_file) as filehandler: <NEW_LINE> <INDENT> data = fil...
Configuration manager. Uses json as config format.
62598f8021bff66bcd722685
class CompetitionRound(models.Model): <NEW_LINE> <INDENT> competition = models.ForeignKey(Competition, related_name="rounds", on_delete=models.CASCADE) <NEW_LINE> round = models.IntegerField() <NEW_LINE> end_date = models.DateField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return u"%d [%s]" % (self.round,...
A "round" in a competition. This is used only for tournaments
62598f80f8510a7c17d7de86
class LatLon(object): <NEW_LINE> <INDENT> def __init__(self, lat, lon): <NEW_LINE> <INDENT> self.lat = lat <NEW_LINE> self.lon = lon % TWO_PI <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if self.lon >= math.pi: <NEW_LINE> <INDENT> e_w = "W" <NEW_LINE> lonDeg = math.degrees(TWO_PI - self.lon) <NEW_LINE> <...
Represents a latitude+longitude. Exports: LatLon(lat, lon): [ P: latRad is a latitude in radians P: lonRad is a longitude in radians return a new LatLon instance with latitude (latRad) and longitude (lonRad) ] .lat: [ as passed to constructor, read-only ] .__str__(self): ...
62598f8073bcbd0ca4bc9c6e
class Study(Project): <NEW_LINE> <INDENT> def __init__(self, path, name=''): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.path = os.path.normpath(path) <NEW_LINE> self.config = StudyConfig(self) <NEW_LINE> self.load_indexes() <NEW_LINE> self.incoming_DICOM_dir = os.path.join(self.path, self.config.incoming_DICO...
a doc string!
62598f808e71fb1e983bb4d6
class TestLogLevels(TestCase): <NEW_LINE> <INDENT> def test_level_values(self) -> None: <NEW_LINE> <INDENT> self.assertEqual(LogLevels.NOTSET, 0) <NEW_LINE> self.assertEqual(LogLevels.DEBUG, 10) <NEW_LINE> self.assertEqual(LogLevels.VERBOSE, 15) <NEW_LINE> self.assertEqual(LogLevels.INFO, 20) <NEW_LINE> self.assertEqua...
Tests for LogLevels.
62598f80d99f1b3c44d050ca
class Dog(Animal): <NEW_LINE> <INDENT> def __init__(self, name, age): <NEW_LINE> <INDENT> super().__init__(name,age) <NEW_LINE> self.tail = "yellow" <NEW_LINE> <DEDENT> def roll_over(self): <NEW_LINE> <INDENT> print(self.name.title()+" rolled over!") <NEW_LINE> <DEDENT> def get_tail_color(self): <NEW_LINE> <INDENT> ret...
docstring for ClassName
62598f80b830903b9686e180
class LogChecker(object): <NEW_LINE> <INDENT> def __init__(self, model, eventlog): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.path_buffer = [copy.deepcopy(model.initial_marking)] <NEW_LINE> self.eventlog = eventlog <NEW_LINE> self.session_index = 0 <NEW_LINE> <DEDENT> def check_events(self): <NEW_LINE> <IND...
Keeps track of possible paths through a model based on an event log, and the degree to which each path diverges from conformance. Provides methods to replay events on the model.
62598f808e05c05ec3f6eb56
class DateCColumns(CColumns): <NEW_LINE> <INDENT> def __init__(self, widget_list, pane=None, today=None, **kwargs): <NEW_LINE> <INDENT> self.pane = pane <NEW_LINE> self.keys = pane.conf['keybindings'] <NEW_LINE> self.today = today <NEW_LINE> self._old_attr_map = False <NEW_LINE> self._old_pos = 0 <NEW_LINE> super(DateC...
container for one week worth of dates which are horizontally aligned TODO: rename, awful name focus can only move away by pressing 'TAB', calls 'pane.show_date' on every focus change (see below for details)
62598f80004d5f362081ed0a
class LocallyShuffleData(ProxyDataFlow, RNGDataFlow): <NEW_LINE> <INDENT> def __init__(self, ds, buffer_size, num_reuse=1, shuffle_interval=None): <NEW_LINE> <INDENT> ProxyDataFlow.__init__(self, ds) <NEW_LINE> self.q = deque(maxlen=buffer_size) <NEW_LINE> if shuffle_interval is None: <NEW_LINE> <INDENT> shuffle_interv...
Buffer the datapoints from a given dataflow, and shuffle them before producing them. This can be used as an alternative when a complete random shuffle is too expensive or impossible for the data source. This dataflow has the following behavior: 1. It takes datapoints from the given dataflow `ds` to an internal buffer...
62598f801d351010ab8f355c
@dataclass <NEW_LINE> class QuicConfiguration: <NEW_LINE> <INDENT> alpn_protocols: Optional[List[str]] = None <NEW_LINE> connection_id_length: int = 8 <NEW_LINE> idle_timeout: float = 60.0 <NEW_LINE> is_client: bool = True <NEW_LINE> max_data: int = 1048576 <NEW_LINE> max_stream_data: int = 1048576 <NEW_LINE> quic_logg...
A QUIC configuration.
62598f800a366e3fb87dc3ea
@target_factory.reg_resource <NEW_LINE> @attr.s(eq=False) <NEW_LINE> class Flashrom(Resource): <NEW_LINE> <INDENT> programmer = attr.ib(validator=attr.validators.instance_of(str))
Programmer is the programmer parameter described in man(8) of flashrom
62598f80379a373c97d98a2f
class BasicDoc(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get_key(self): <NEW_LINE> <INDENT> return "base" <NEW_LINE> <DEDENT> def to_dict(self, variant=''): <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> def assure_list_of_type(self, list_of, variable_name, cls...
An abstract class, that can spit out the formatted documentation.
62598f80c432627299fa29ed
class Sticker2ImgMiddleware(EFBMiddleware): <NEW_LINE> <INDENT> middleware_id = "catbaron.sticker2img" <NEW_LINE> middleware_name = "Sticker2Image" <NEW_LINE> __version__ = version.__version__ <NEW_LINE> logger: logging.Logger = logging.getLogger("plugins.%s.MessageBlockerMiddleware" % middleware_id) <NEW_LINE> def __i...
EFB Middleware - MessageBlockerMiddleware Add and manage filters to block some messages. Author: Catbaron <https://github.com/catbaron>
62598f809b70327d1c57e7bd
class LatestArticlesAtomFeedTestCase(SimpleTestCase): <NEW_LINE> <INDENT> def test_feed_meta(self): <NEW_LINE> <INDENT> feed = LatestArticlesAtomFeed() <NEW_LINE> self.assertEqual(feed.feed_type, Atom1Feed) <NEW_LINE> self.assertEqual(feed.title, LatestArticlesFeed.title) <NEW_LINE> self.assertEqual(feed.link, LatestAr...
Tests suite for the ``LatestArticlesAtomFeed`` feed class.
62598f8030c21e258be98228
class TimedMediasIterator(MediasIterator): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_times(timeframe): <NEW_LINE> <INDENT> if timeframe is None: <NEW_LINE> <INDENT> timeframe = (None, None) <NEW_LINE> <DEDENT> try: <NEW_LINE> <INDENT> start_time = timeframe[0] or datetime.date.today() <NEW_LINE> end_time = t...
An iterator over the medias within a specific timeframe.
62598f800383005118f6d120
class TargetDensity( NamedTuple('TargetDensity', [ ('unnormalized_log_prob', Callable[[Any], tf.Tensor]), ('event_shape', tf.TensorShape), ('dtype', 'tf.Dtype'), ('constraining_bijectors', Union[tfb.Bijector, Tuple[tfb.Bijector], List[tfb.Bijector]]), ('expectations', 'collections.OrderedDict[Text, Expectation]'), ('di...
Describes a target density. See `logistic_regression.py` for an example. Attributes: unnormalized_log_prob: A Python Callable computing the target density. event_shape: The event shape of the target, as a `tf.TensorShape`. dtype: The dtype in which the target expects to be computed. constraining_bijectors: Bi...
62598f801d351010ab8f355d
class TemporalPattern(object): <NEW_LINE> <INDENT> def __init__(self, pattern_type: str, entities: List[ist.Agent], time_limit, **kwargs): <NEW_LINE> <INDENT> self.pattern_type = pattern_type <NEW_LINE> self.entities = entities <NEW_LINE> self.time_limit = time_limit <NEW_LINE> if self.pattern_type in ('alway...
A temporal pattern
62598f8023e79379d538bf17
class Pycrypto_AES_CFB(Pycrypto_AES_Base): <NEW_LINE> <INDENT> name = 'Pycrypto_AES_CFB' <NEW_LINE> @staticmethod <NEW_LINE> def _encrypt(plaintext, key, iv=None): <NEW_LINE> <INDENT> if plaintext is None: <NEW_LINE> <INDENT> plaintext = '' <NEW_LINE> <DEDENT> if iv is not None and len(iv) != AES.block_size: <NEW_LINE>...
Cipher Feedback Mode with 8-bit segments (pycrypto's default segment length) Wrapper for pycrypto's AES implementation. Keys must be 16, 24, or 32 bytes long. IV is needed, must be random for each new encryption but can be made public
62598f8063f4b57ef0085a7d
class HttpClient(object): <NEW_LINE> <INDENT> def __init__(self,url,method='GET',headers=None,cookies=None): <NEW_LINE> <INDENT> self.url = url <NEW_LINE> self.session = requests.session() <NEW_LINE> self.method =method.upper() <NEW_LINE> if self.method not in METHODS: <NEW_LINE> <INDENT> raise UnSupportMethodExceptio...
http请求的client。初始化时传入url、method等,可以添加headers和cookies,但没有auth、proxy。 >>> HTTPClient('http://www.baidu.com').send() <Response [200]>
62598f808c3a8732951f5f65
class StudentManagerController: <NEW_LINE> <INDENT> init_id = 1000 <NEW_LINE> @classmethod <NEW_LINE> def __generate_id(cls, stu): <NEW_LINE> <INDENT> stu.id = cls.init_id <NEW_LINE> cls.init_id += 1 <NEW_LINE> <DEDENT> def __init__(self): <NEW_LINE> <INDENT> self.__stu_list = [] <NEW_LINE> <DEDENT> @property <NEW_LINE...
学生管理控制器:主要负责业务逻辑处理
62598f80b5575c28eb7129d6
class CommandTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def assertWellFormedRequest(self, data): <NEW_LINE> <INDENT> self.commandClass.makeArguments(data, None) <NEW_LINE> <DEDENT> def assertWellFormedResponse(self, data): <NEW_LINE> <INDENT> self.commandClass.makeResponse(data, None)
Test for a command class.
62598f80442bda511e95be7a
class FDBaseline(DosageBaseline): <NEW_LINE> <INDENT> def __init__(self, dosage): <NEW_LINE> <INDENT> self.dosage = dosage <NEW_LINE> self.target_name = 'Therapeutic_Dose_of_Warfarin_binned' <NEW_LINE> <DEDENT> def get_features(self, data): <NEW_LINE> <INDENT> return data.drop(self.target_name, axis=1) <NEW_LINE> <DEDE...
Implements fixed dosage baseline. Regardless of input, a fixed dosage is returned for each instance in the batch.
62598f801f037a2d8b9e3b08
class JsonFormatter(BaseFormatter): <NEW_LINE> <INDENT> class CustomEncoder(json.JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> if isinstance(o, Match): <NEW_LINE> <INDENT> if o.rule.id[0] == 'W': <NEW_LINE> <INDENT> level = 'Warning' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> level = 'E...
Json Formatter
62598f8021bff66bcd722687
class NewsTopicsListCreate(generics.ListCreateAPIView): <NEW_LINE> <INDENT> queryset = Topics.objects.all() <NEW_LINE> serializer_class = NewsTopicsSerializer <NEW_LINE> permission_classes = (permissions.AllowAny, ) <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> queryset = Topics.objects.all().order_by('-top_ne...
List and create
62598f800383005118f6d121
class IImportSettingsForm(Interface): <NEW_LINE> <INDENT> pass
Adapts a import settings z3c form to an importer and initialize it with the form values.
62598f80a17c0f6771d5bc63
class RBindr(RPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/krlmlr/bindr" <NEW_LINE> url = "https://cran.r-project.org/src/contrib/bindr_0.1.tar.gz" <NEW_LINE> list_url = "https://cran.r-project.org/src/contrib/Archive/bindr" <NEW_LINE> version('0.1', 'f3897a70cbad2d2981272772fa30bb59')
Provides a simple interface for creating active bindings where the bound function accepts additional arguments.
62598f80f8510a7c17d7de87
class IntegerPreferenceComboBox(PreferencesComboBox): <NEW_LINE> <INDENT> def _get_value(self): <NEW_LINE> <INDENT> return str(self.settings[self.key]) <NEW_LINE> <DEDENT> def _set_value(self, value): <NEW_LINE> <INDENT> self.settings[self.key] = int(value)
A combobox tied to a setting that has integer values.
62598f8073bcbd0ca4bc9c70
class GeneralizedMatrixFactorization(Model): <NEW_LINE> <INDENT> def __init__( self, n: int, m: int, factors: int = 32, *args: Any, embedding_regularizer: Optional[Regularizer] = None, **kwargs: Any, ) -> None: <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.user_embedding = InputEmbeddingBlock( n...
A Keras model implementing Generalized Matrix Factorization (GMF) architecture from [1]. References ---------- [1] He et al. https://dl.acm.org/doi/10.1145/3038912.3052569
62598f80b57a9660fecd149d
class IExternalApp(Interface): <NEW_LINE> <INDENT> html_class = schema.TextLine( title=_(u"HTML Wrapper Class"), required=True, description=_(u"It is used on External App object view to bind Diazo xml rules."), )
External Application Entry Point
62598f80507cdc57c63a47ac
class UserCreationForm(forms.ModelForm): <NEW_LINE> <INDENT> password1 = forms.CharField(label='Password', widget=forms.PasswordInput) <NEW_LINE> password2 = forms.CharField(label='Password confirmation', widget=forms.PasswordInput) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ('username'...
A form for creating new users. Includes all the required fields, plus a repeated password.
62598f8030dc7b766599f278
class UnacceptableToken(Exception): <NEW_LINE> <INDENT> def __init__(self, subject, text): <NEW_LINE> <INDENT> super(UnacceptableToken, self).__init__(subject, text) <NEW_LINE> self.subject = subject <NEW_LINE> self.text = text
Raised when a token request can't be accepted.
62598f804e696a045264db10
class RepliesNotSortedError(Exception): <NEW_LINE> <INDENT> pass
sort_replies() was not called after the RiveScript documents were loaded, critical error
62598f8071ff763f4b5e718d
class TestCLIHelp(TestCOTCLI): <NEW_LINE> <INDENT> def test_help_positive(self): <NEW_LINE> <INDENT> self.call_cot(['help']) <NEW_LINE> self.call_cot(['help', 'add-disk']) <NEW_LINE> self.call_cot(['help', 'add-file']) <NEW_LINE> self.call_cot(['help', 'deploy']) <NEW_LINE> self.call_cot(['help', 'edit-hardware']) <NEW...
CLI test cases for "cot help" command.
62598f801d351010ab8f355e
class Model(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def db_path(cls): <NEW_LINE> <INDENT> classname = cls.__name__ <NEW_LINE> path = 'data/{}.txt'.format(classname) <NEW_LINE> return path <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def load(cls, d): <NEW_LINE> <INDENT> m = cls({}) <NEW_LINE> for k, v in d....
Model 是所有 model 的基类 @classmethod 是一个套路用法 例如 user = User() user.db_path() 返回 User.txt
62598f803eb6a72ae038a062
class Scope: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> self.module = None <NEW_LINE> self.classes = [] <NEW_LINE> self.function = None <NEW_LINE> self.ignored = 0 <NEW_LINE> <DEDENT> def current_module_id(self) -> str: <NEW_LINE> <INDENT> assert self.module <NEW_LINE> return self.module <NEW_L...
Track which target we are processing at any given time.
62598f80a79ad16197769a80
class AppSettings(models.Model): <NEW_LINE> <INDENT> name = models.CharField('名称', max_length=20, null=True) <NEW_LINE> value = models.CharField('显示值', max_length=100, null=True) <NEW_LINE> comment = models.CharField('注释', max_length=200, null=True, blank=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return s...
The basic settings of this web site. Include: WebSiteName UploadFilePath
62598f806aa9bd52df0d48fa
class SavedFormDataEntryReference(models.Model): <NEW_LINE> <INDENT> form = models.ForeignKey('fobi_contrib_plugins_form_handlers_db_store.SavedFormDataEntry')
Model which references the `fobi.contrib.plugins.form_handlers.db_store.models.SavedFormDataEntry`.
62598f801f5feb6acb162654
class NHANESDirectSamplePopulation(Population): <NEW_LINE> <INDENT> def __init__( self, n, year, filter=None, generate_new_people=True, model_reposistory_type="cohort", random_seed=None, weights=None, ): <NEW_LINE> <INDENT> nhanes = pd.read_stata("microsim/data/fullyImputedDataset.dta") <NEW_LINE> nhanes = nhanes.loc[n...
Simple base class to sample with replacement from 2015/2016 NHANES
62598f80be383301e025321a
class HTTPClient(ClientWrapper): <NEW_LINE> <INDENT> def GetRefs(self): <NEW_LINE> <INDENT> url = self._transport._get_url(self._path) <NEW_LINE> refs, unused_capabilities = ( self._transport._discover_references(b'git-upload-pack', url)) <NEW_LINE> return refs
Wraps a dulwich.client.TCPGitClient.
62598f808da39b475be02c05
class TestPUTSubscriptionPatchRequestTypeCharges(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 testPUTSubscriptionPatchRequestTypeCharges(self): <NEW_LINE> <INDENT> pass
PUTSubscriptionPatchRequestTypeCharges unit test stubs
62598f8026068e7796d4c37c
class UserSettingsHolder: <NEW_LINE> <INDENT> SETTINGS_MODULE = None <NEW_LINE> def __init__(self, default_settings): <NEW_LINE> <INDENT> self.__dict__['_deleted'] = set() <NEW_LINE> self.default_settings = default_settings <NEW_LINE> <DEDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> if name in self._deleted: <...
用户配置设置的持有者。
62598f808c3a8732951f5f67
class NERCollator: <NEW_LINE> <INDENT> def __init__( self, token_padding_value: int, label_padding_value: int, percentile: Union[int, float] = 100, ): <NEW_LINE> <INDENT> self.token_padding_value = token_padding_value <NEW_LINE> self.label_padding_value = label_padding_value <NEW_LINE> self.percentile = percentile <NEW...
Collator that handles variable-size sentences.
62598f80b5575c28eb7129d7
class FileStorage(): <NEW_LINE> <INDENT> engine_directory = os.path.dirname(os.path.abspath(__file__)) <NEW_LINE> parent_directory = os.getcwd() <NEW_LINE> __file_path = parent_directory + '/file.json' <NEW_LINE> __objects = dict() <NEW_LINE> def all(self): <NEW_LINE> <INDENT> return self.__objects <NEW_LINE> <DEDENT> ...
Handle JSON serialization of objects
62598f80d4950a0f3b110b45
@register_strategy('HR_SYMM') <NEW_LINE> class HashroutingSymmetric(Hashrouting): <NEW_LINE> <INDENT> @inheritdoc(Strategy) <NEW_LINE> def __init__(self, view, controller, **kwargs): <NEW_LINE> <INDENT> super(HashroutingSymmetric, self).__init__(view, controller, 'SYMM', **kwargs)
Hash-routing with symmetric routing (HR SYMM) According to this strategy, each content is routed following the same path of the request. References ---------- .. [1] L. Saino, I. Psaras and G. Pavlou, Hash-routing Schemes for Information-Centric Networking, in Proceedings of ACM SIGCOMM ICN'13 workshop....
62598f80e76e3b2f99fd8455