code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class User(UserMixin, db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> username = db.Column(db.String(64), index=True, unique=True) <NEW_LINE> password_hash = db.Column(db.String(128)) <NEW_LINE> email = db.Column(db.String(64), index=True, unique...
Users table scheme.
62598eeb4428ac0f6e656c8d
class returns_sequence(returns_result_type): <NEW_LINE> <INDENT> def process(self, sequence): <NEW_LINE> <INDENT> super_process = super(returns_sequence, self).process <NEW_LINE> for obj in sequence: <NEW_LINE> <INDENT> for pair in super_process(obj): <NEW_LINE> <INDENT> yield pair
Declaration that indicates a callable's returns a sequence of values that should be used as a resources based on the type of the object returned. Any ``None`` values in the sequence are ignored.
62598eeb2eb69b55b15a0727
class TagCreate(generics.CreateAPIView): <NEW_LINE> <INDENT> queryset = Tag.objects.all() <NEW_LINE> serializer_class = TagSerializer
POST Добавить тэг к объявлениям JSON { "title": "", "advert": [advert_id, advert_id, ] }
62598eebd7e4931a7ef3a7d8
class TornadoScheduler(BaseScheduler): <NEW_LINE> <INDENT> _ioloop = None <NEW_LINE> _timeout = None <NEW_LINE> @run_in_ioloop <NEW_LINE> def shutdown(self, wait=True): <NEW_LINE> <INDENT> super().shutdown(wait) <NEW_LINE> self._stop_timer() <NEW_LINE> <DEDENT> def _configure(self, config): <NEW_LINE> <INDENT> self._io...
A scheduler that runs on a Tornado IOLoop. The default executor can run jobs based on native coroutines (``async def``). =========== =============================================================== ``io_loop`` Tornado IOLoop instance to use (defaults to the global IO loop) =========== =================================...
62598eeb498bea3a75a5626b
class PublicPasswordBackend(object): <NEW_LINE> <INDENT> def authenticate(self, request=None): <NEW_LINE> <INDENT> if request is None: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> form = PublicPasswordGrantForm(request.POST) <NEW_LINE> if form.is_valid(): <NEW_LINE> <INDENT> return form.cleaned_data.get('client'...
Simple client authentication wrapper backends that delegates to `oauth2_provider.forms.PublicPasswordGrantForm`
62598eebf9cc0f698b1c466b
class EAT_XML_Reader: <NEW_LINE> <INDENT> def __init__(self, xml_loc): <NEW_LINE> <INDENT> self.root = ET.parse(xml_loc).getroot() <NEW_LINE> <DEDENT> def get_all_associations(self): <NEW_LINE> <INDENT> associations=[] <NEW_LINE> for stimulus_element in self.root: <NEW_LINE> <INDENT> stimuli = stimulus_element.attrib["...
This class contians functions for reading and using Edinburgh Associative Thesaurus in its XML format, as found at http://rali.iro.umontreal.ca/rali/?q=en/Textual%20Resources/EAT
62598eebbe8e80087fbbd78a
class RommonC9400(RommonGen3): <NEW_LINE> <INDENT> def __init__(self, mode_mgr, ud, **kwargs): <NEW_LINE> <INDENT> super(RommonC9400, self).__init__(mode_mgr, ud, **kwargs) <NEW_LINE> return <NEW_LINE> <DEDENT> def upgrade(self, image, **kwargs): <NEW_LINE> <INDENT> if image == 'LINUX_BATCH': <NEW_LINE> <INDENT> log.in...
C9400 Rommon Driver This class is product family specific. Families included: Macallen
62598eeb097d151d1a2bf757
class Activity(GenericContent): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> activity_type = models.SmallIntegerField(choices=TYPE_ACTIVITY) <NEW_LINE> active_at = models.DateTimeField(default=datetime.datetime.now) <NEW_LINE> is_auditted = models.BooleanField(default=False) <NEW_LINE> class Meta: <...
We keep some history data for user activities
62598eeb2c8b7c6e89bd1efc
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_settings, screen): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = screen <NEW_LINE> self.ai_settings = ai_settings <NEW_LINE> self.image = pygame.image.load('images/alien.bmp') <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.re...
A class to represent a single align in the fleet.
62598eeb66673b3332c2eae3
class TestInstrument(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 testInstrument(self): <NEW_LINE> <INDENT> pass
Instrument unit test stubs
62598eeb4e4d562566370b54
class DungeonList(DungeonBase): <NEW_LINE> <INDENT> def __init__(self, controller): <NEW_LINE> <INDENT> self._controller = controller <NEW_LINE> <DEDENT> def on_get(self, req, resp): <NEW_LINE> <INDENT> dungeons = self._controller.list_dungeons() <NEW_LINE> resource = { 'dungeons': [self._entity_to_resource(d) for d in...
Resource class for the dungeon list concept.
62598eeb32920d7e50bc4766
class LogarithmicMapping(KeyMapping): <NEW_LINE> <INDENT> def __init__(self, relative_accuracy, offset=0.0): <NEW_LINE> <INDENT> super(LogarithmicMapping, self).__init__(relative_accuracy, offset=offset) <NEW_LINE> self._multiplier *= math.log(2) <NEW_LINE> <DEDENT> def _log_gamma(self, value): <NEW_LINE> <INDENT> retu...
A memory-optimal KeyMapping, i.e., given a targeted relative accuracy, it requires the least number of keys to cover a given range of values. This is done by logarithmically mapping floating-point values to integers.
62598eeb627d3e7fe0e055c5
class NamesTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_first_last_name(self): <NEW_LINE> <INDENT> formatted_name = get_formatted_name('janis', 'joplin') <NEW_LINE> self.assertEqual(formatted_name, 'Janis Joplin') <NEW_LINE> <DEDENT> def test_first_middle_last(self): <NEW_LINE> <INDENT> formatted_name = ge...
Tests for 'name_function.py'.
62598eebbd1bec0571e14467
class ForumSource(MessageSource): <NEW_LINE> <INDENT> source_id = models.IntegerField() <NEW_LINE> forumsource_type = models.CharField( max_length=2, choices=FORUMSOURCE_TYPE_CHOICES, default=FORUMSOURCE_TYPE_FORUM_TOPICS, ) <NEW_LINE> polling_interval = models.IntegerField( default=10, help_text="Polling interval in m...
A forum post from a specific JudgeApps forum.
62598eebbe7bc26dc9251200
class RetrievePeopleSchemaTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> from ..schema import RetrievePeopleSchema <NEW_LINE> self.schema = RetrievePeopleSchema() <NEW_LINE> self.seq_fields = [ 'cast_credit',] <NEW_LINE> <DEDENT> @attr('onhold') <NEW_LINE> def test_credits_cast_string_list_wi...
Unit tests for :class:`RetrievePeopleSchema`.
62598eeb5fdd1c0f98e5c6dd
class MoveAntiCaptureExecutor(MoveExecutor): <NEW_LINE> <INDENT> def exec(self, move, movepiece, addpiece, removepiece): <NEW_LINE> <INDENT> movepiece(move.fromsq, move.tosq) <NEW_LINE> addpiece(move.addpiece, move.addpos)
Desfaz movimentos em que há captura, mas não há promoção
62598eeb01c39578d7f114e5
class Experiment(ConfigExperiment): <NEW_LINE> <INDENT> def _postprocess_model_for_stage(self, stage: str, model: nn.Module): <NEW_LINE> <INDENT> model = ( model.module if isinstance(model, torch.nn.DataParallel) else model ) <NEW_LINE> if stage in ["debug", "stage1"]: <NEW_LINE> <INDENT> for param in model.encoder.par...
Segmentation experiment.
62598eeb7047854f4633db0e
class history(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._stack = [] <NEW_LINE> self._pointer = 0 <NEW_LINE> self._pending = None <NEW_LINE> <DEDENT> def remember(self, pending): <NEW_LINE> <INDENT> self._stack.append(copy.deepcopy(pending)) <NEW_LINE> self._pointer = len(self._stack) <NE...
Remembers the commands which were executed and allows navigate in that list. :author: Alexander Berezhnoy (alexander.berezhnoy |at| gmail.com)
62598eeb6e29344779afed70
class Command(BaseCommand): <NEW_LINE> <INDENT> help = 'Add development datas in your database.' <NEW_LINE> def handle(self, *args, **options): <NEW_LINE> <INDENT> self.create_superuser() <NEW_LINE> <DEDENT> def create_superuser(self): <NEW_LINE> <INDENT> logger = logging.getLogger('base') <NEW_LINE> admin_context = ('...
Command class.
62598eeb32920d7e50bc4767
class FactorKLoss(BaseLoss): <NEW_LINE> <INDENT> def __init__(self, device, gamma=10., disc_kwargs={}, optim_kwargs=dict(lr=5e-5, betas=(0.5, 0.9)), **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.gamma = gamma <NEW_LINE> self.device = device <NEW_LINE> self.discriminator = Discriminator(**dis...
Compute the Factor-VAE loss as per Algorithm 2 of [1] Parameters ---------- device : torch.device gamma : float, optional Weight of the TC loss term. `gamma` in the paper. discriminator : disvae.discriminator.Discriminator optimizer_d : torch.optim kwargs: Additional arguments for `BaseLoss`, e.g. rec_dist...
62598eebfff4ab517ebcbf13
class URIValue(Value): <NEW_LINE> <INDENT> _type = Value.URI <NEW_LINE> _uri = Value._value <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return "<cssutils.css.%s object type=%s value=%r uri=%r cssText=%r at 0x%x>" % (self.__class__.__name__, self.type, self.value, self.uri, self.cssText, id(self)) <N...
An URI value like ``url(example.png)``.
62598eebd6c5a102081e086c
class GeneralizedRCNNAssembler(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def post_processing(self, batched_inputs, results, image_sizes): <NEW_LINE> <INDENT> processed_results = [] <NEW_LINE> for results_per_image, input_per_image, image_size in zip( results, batched_...
A class whose instance can assemble caffe2 model's outputs
62598eeba8ecb0332586f925
class RedditListingWrapper: <NEW_LINE> <INDENT> def __init__(self, path, api_url): <NEW_LINE> <INDENT> self.path = Collect(path) <NEW_LINE> self.url = api_url <NEW_LINE> self.listing = _reddit.get(api_url) <NEW_LINE> self.posts = _randomized(list(self.listing)) <NEW_LINE> self.existing_paths = {} <NEW_LINE> <DEDENT> de...
Wrapper for Reddit listing generators to facilitate image downloading and handling certain behaviors.
62598eeb4f88993c371ef885
class NoPluginNameDefined(SimplugException): <NEW_LINE> <INDENT> pass
When the name of the plugin cannot be found
62598eeba79ad16197768759
class Division(ML_ArithmeticOperation): <NEW_LINE> <INDENT> arity = 2 <NEW_LINE> def bare_range_function(self, ops): <NEW_LINE> <INDENT> return safe(operator.__truediv__)(ops[0], ops[1])
abstract addition
62598eeb7d847024c075ab09
class Log(): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> datadir = os.path.join(get_user_data_dir(), "vimiv") <NEW_LINE> os.makedirs(datadir, exist_ok=True) <NEW_LINE> self._filename = os.path.join(datadir, "vimiv.log") <NEW_LINE> self._terminal = sys.stderr <NEW_LINE> if app.debug: <NEW_LINE> <IND...
Log file handler. Attributes: _filename: Name of the log file. _terminal: sys.stderr to interact with
62598eeb4c34283577618a20
class GooglePrivacyDlpV2beta1KMapEstimationHistogramBucket(_messages.Message): <NEW_LINE> <INDENT> bucketSize = _messages.IntegerField(1) <NEW_LINE> bucketValues = _messages.MessageField('GooglePrivacyDlpV2beta1KMapEstimationQuasiIdValues', 2, repeated=True) <NEW_LINE> maxAnonymity = _messages.IntegerField(3) <NEW_LINE...
A KMapEstimationHistogramBucket message with the following values: min_anonymity: 3 max_anonymity: 5 frequency: 42 means that there are 42 records whose quasi-identifier values correspond to 3, 4 or 5 people in the overlying population. An important particular case is when min_anonymity = max_anonymity = 1: the fre...
62598eeb56ac1b37e630092a
class PppdError(Error): <NEW_LINE> <INDENT> pass
PPPD fork-exec exception.
62598eeb67a9b606de54470b
class InputLayer(Layer): <NEW_LINE> <INDENT> def __init__(self, shape, input_var=None, name=None, **kwargs): <NEW_LINE> <INDENT> self.shape = shape <NEW_LINE> ndim = len(shape) <NEW_LINE> if input_var is None: <NEW_LINE> <INDENT> input_var_type = T.TensorType(theano.config.floatX, [False] * ndim) <NEW_LINE> var_name = ...
This layer holds a symbolic variable that represents a network input. A variable can be specified when the layer is instantiated, else it is created. :parameters: - shape : tuple of int The shape of the input - input_var : Theano symbolic variable or None (default: None) A variable representin...
62598eebcc40096d61619576
class AiAnalysisTaskFrameTagResult(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Status = None <NEW_LINE> self.ErrCodeExt = None <NEW_LINE> self.ErrCode = None <NEW_LINE> self.Message = None <NEW_LINE> self.Input = None <NEW_LINE> self.Output = None <NEW_LINE> <DEDENT> def _deserializ...
智能按帧标签结果类型
62598eeb32920d7e50bc4768
class ShellySleepingSensor(ShellySleepingBlockAttributeEntity, SensorEntity): <NEW_LINE> <INDENT> @property <NEW_LINE> def native_value(self) -> StateType: <NEW_LINE> <INDENT> if self.block is not None: <NEW_LINE> <INDENT> return self.attribute_value <NEW_LINE> <DEDENT> return self.last_state <NEW_LINE> <DEDENT> @prope...
Represent a shelly sleeping sensor.
62598eeb57b8e32f525074a3
class Engine(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, zc): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.zc = zc <NEW_LINE> self.readers = {} <NEW_LINE> self.timeout = 5 <NEW_LINE> self.condition = threading.Condition() <NEW_LINE> self.start() <NEW_LINE> <DEDENT> def run(self): <N...
An engine wraps read access to sockets, allowing objects that need to receive data from sockets to be called back when the sockets are ready. A reader needs a handle_read() method, which is called when the socket it is interested in is ready for reading. Writers are not implemented here, because we only send short pa...
62598eeb66656f66f7d58b1e
class SquadsTournament(Object): <NEW_LINE> <INDENT> _type: str = "SquadsTournament" <NEW_LINE> def __init__(self, client, data: dict): <NEW_LINE> <INDENT> super().__init__(client) <NEW_LINE> self.id: int = data.pop("id") <NEW_LINE> self.name: Optional[str] = data.pop("name") <NEW_LINE> self.description: Optional[str] =...
Represents a Call of Duty Squads Tournament object. Parameters ----------
62598eeb2ae34c7f260a9824
class MissingKing(NotAValidPosition): <NEW_LINE> <INDENT> pass
raised when some King is missing on board
62598eeb01c39578d7f114e7
class ReComment(models.Model): <NEW_LINE> <INDENT> name = models.CharField('名前', max_length=255, default='名無し') <NEW_LINE> text = models.TextField('コメント') <NEW_LINE> icon = models.ImageField( 'サムネイル', upload_to='com_icon/', blank=True, null=True) <NEW_LINE> target = models.ForeignKey( Comment, on_delete=models.CASCADE,...
返信コメント.
62598eebd486a94d0ba2a70a
class BaseRequestHandler(webapp.RequestHandler): <NEW_LINE> <INDENT> def send_form(self, title, action, contactId, handle, content_obj): <NEW_LINE> <INDENT> if (contactId >= 0): <NEW_LINE> <INDENT> idInfo = '<input type="hidden" name="_id" value="%s">' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> idInfo = '' <NEW_LINE...
Base class for our page-based request handlers that contains some helper functions we use in most pages.
62598eebadb09d7d5dc08d05
class CachedRateLimit(TweepError): <NEW_LINE> <INDENT> def __init__(self, reason): <NEW_LINE> <INDENT> super(CachedRateLimit, self).__init__(reason)
Still in rate limit exception
62598eebbe7bc26dc9251201
class NSNitroNserrGslbIpv4Backupip(NSNitroGslbErrors): <NEW_LINE> <INDENT> pass
Nitro error code 1957 IPv6 service binding is not allowed along with IPv4 backup IP.
62598eeb167d2b6e312b56d6
class AjaxMultiFormMixin(MessageMixin, AjaxDataMixin): <NEW_LINE> <INDENT> def form_valid(self, form): <NEW_LINE> <INDENT> response = super(AjaxMultiFormMixin, self).form_valid(form) <NEW_LINE> object_dict = self.object <NEW_LINE> objects = {} <NEW_LINE> if self.request.is_ajax(): <NEW_LINE> <INDENT> for name, obj in o...
Ajax mixin for MultiModelForm from django-betterforms
62598eeb30bbd72246468371
class Commit(models.Model): <NEW_LINE> <INDENT> repository = models.ForeignKey(Repository) <NEW_LINE> hash = models.CharField(max_length=40) <NEW_LINE> previous_commit_left = models.ForeignKey("Commit", null=True, blank=True, related_name="_next_left_set") <NEW_LINE> previous_commit_right = models.ForeignKey("Commit", ...
Represents a single commit. previous_commit_left is the last commit in this branch, previous_commit_right is the merged commit from a merge commit, if it exists.
62598eebd6c5a102081e086e
class PRISMExperiment(PRISMParams, PModelCheckerExperiment): <NEW_LINE> <INDENT> def __handler_default(self): <NEW_LINE> <INDENT> return PRISMExperimentHandler(model=self) <NEW_LINE> <DEDENT> _current_property = Str <NEW_LINE> _max_properties = Int(1) <NEW_LINE> _property_index = Int(0) <NEW_LINE> _stdout_pattern_list ...
TODO
62598eeb5fc7496912d47611
class name_Word: <NEW_LINE> <INDENT> def __init__(self,word, cnt): <NEW_LINE> <INDENT> self.lpt = None <NEW_LINE> self.ept = None <NEW_LINE> self.gpt = None <NEW_LINE> self.clpt=None <NEW_LINE> self.cgpt=None <NEW_LINE> self.word = word <NEW_LINE> self.count = cnt <NEW_LINE> self.sum=0
Contains the information for a phrase starting with a word
62598eeb4527f215b58e863c
class RegenerationProposer(LOTProposer): <NEW_LINE> <INDENT> def propose_tree(self, t, resampleProbability=lambdaOne): <NEW_LINE> <INDENT> newt = copy(t) <NEW_LINE> try: <NEW_LINE> <INDENT> n, lp = newt.sample_subnode(resampleProbability=resampleProbability) <NEW_LINE> <DEDENT> except NodeSamplingException: <NEW_LINE> ...
Propose to a tree by sampling a node at random and regenerating
62598eeb8da39b475be018ea
class tm_get_ingress_port_drop_limit_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.I32, 'success', None, None, ), (1, TType.STRUCT, 'ouch', (InvalidTmOperation, InvalidTmOperation.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, ouch=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LI...
Attributes: - success - ouch
62598eeb442bda511e95aba0
class CsoundScoreLexer(CsoundLexer): <NEW_LINE> <INDENT> name = 'Csound Score' <NEW_LINE> aliases = ['csound-score', 'csound-sco'] <NEW_LINE> filenames = ['*.sco'] <NEW_LINE> tokens = { 'root': [ (r'\n', Whitespace), include('whitespace and macro uses'), include('preprocessor directives'), (r'[aBbCdefiqstvxy]', Keyword...
For `Csound <https://csound.com>`_ scores. .. versionadded:: 2.1
62598eeb71ff763f4b5e5e9b
class DslNameError(DslSyntaxError): <NEW_LINE> <INDENT> pass
Exception class for undefined names.
62598eeb2c8b7c6e89bd1eff
class PythonzEmailMessage(EmailHtmlMessage): <NEW_LINE> <INDENT> alias = 'simple' <NEW_LINE> priority = 1 <NEW_LINE> send_retry_limit = 4 <NEW_LINE> def __init__(self, subject, html_or_dict, template_path=None): <NEW_LINE> <INDENT> if not isinstance(html_or_dict, dict): <NEW_LINE> <INDENT> html_or_dict = {'text': html_...
Базовый класс для сообщений, рассылаемых pythonz по электронной почте. Этот же класс используется для рассылки писем от sitegate,
62598eeb009cb60464cffc8c
class se2_from_SE2_seq(Block): <NEW_LINE> <INDENT> Block.alias('se2_from_SE2_seq') <NEW_LINE> Block.input('pose', 'Pose as an element of SE2', dtype=SE2) <NEW_LINE> Block.output('velocity', 'Velocity as an element of se(2).', dtype=np.dtype(('float', (3, 3)))) <NEW_LINE> def init(self): <NEW_LINE> <INDENT> self.state.p...
Computes velocity in se2 given poses in SE2.
62598eeb38b623060ffa77d9
class While(Instruction): <NEW_LINE> <INDENT> def __init__(self, b, c): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.b = b <NEW_LINE> self.c = c
While : while b do c b is a boolean expression c is an instruction
62598eebe5267d203ee6a045
class TestPluginRetrievalManually(unittest.TestCase): <NEW_LINE> <INDENT> def test_empty_type(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> list(NoPluginsPluginBase.getderived()) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> self.fail() <NEW_LINE> <DEDENT> <DEDENT> def test_empty_elements(self): <NEW_...
Manual tests for ``sortableclasses.getderived()``.
62598eebe1aae11d1e7cdbde
class Pipe: <NEW_LINE> <INDENT> def __init__(self, throughput: float): <NEW_LINE> <INDENT> assert throughput > 0, 'throughput must be positive' <NEW_LINE> self.throughput = throughput <NEW_LINE> self._congested = Notification() <NEW_LINE> self._throughput_scale = 1.0 <NEW_LINE> self._subscriptions: Dict[object, float] ...
Shared transport for resources with a limited total throughput :param throughput: limit of total throughput The throughput limit of a pipe is defined when a :py:class:`Pipe` is created. Afterwards, :term:`activities <activity>` may temporarily request transfers through the :py:class:`Pipe` with a maximum throughput. ...
62598eebd268445f26638f2d
class MetaException(Exception): <NEW_LINE> <INDENT> pass
Base class for all exceptions thrown by the xtuml.meta module.
62598eeb66673b3332c2eae7
class MetaSignals(type): <NEW_LINE> <INDENT> def __init__(cls, name, bases, d): <NEW_LINE> <INDENT> signals = d.get("signals", []) <NEW_LINE> for superclass in cls.__bases__: <NEW_LINE> <INDENT> signals.extend(getattr(superclass, 'signals', [])) <NEW_LINE> <DEDENT> signals = dict([(x,None) for x in signals]).keys() <NE...
register the list of signals in the class varable signals, including signals in superclasses.
62598eeb8a43f66fc4bf08b2
class TestNDEnumerate(MpiTestCase): <NEW_LINE> <INDENT> def test_ndenumerate(self): <NEW_LINE> <INDENT> d = Distribution.from_shape((16, 16, 2), dist=('c', 'b', 'n'), comm=self.comm) <NEW_LINE> a = LocalArray(d) <NEW_LINE> for global_inds, value in ndenumerate(a): <NEW_LINE> <INDENT> a.global_index[global_inds] = 0.0
Make sure we generate indices compatible with __getitem__.
62598eeb097d151d1a2bf75b
class ExternalProgramTask(luigi.Task): <NEW_LINE> <INDENT> def program_args(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def program_environment(self): <NEW_LINE> <INDENT> env = os.environ.copy() <NEW_LINE> return env <NEW_LINE> <DEDENT> @property <NEW_LINE> def always_log_stderr(self): <NEW...
Template task for running an external program in a subprocess The program is run using :py:class:`subprocess.Popen`, with ``args`` passed as a list, generated by :py:meth:`program_args` (where the first element should be the executable). See :py:class:`subprocess.Popen` for details. Your must override :py:meth:`progr...
62598eeb4a966d76dd5ed620
class ValueIterationAgent(ValueEstimationAgent): <NEW_LINE> <INDENT> def __init__(self, mdp, discount = 0.9, iterations = 100): <NEW_LINE> <INDENT> self.mdp = mdp <NEW_LINE> self.discount = discount <NEW_LINE> self.iterations = iterations <NEW_LINE> self.values = util.Counter() <NEW_LINE> self.runValueIteration() <NEW_...
* Please read learningAgents.py before reading this.* A ValueIterationAgent takes a Markov decision process (see mdp.py) on initialization and runs value iteration for a given number of iterations using the supplied discount factor.
62598eeb627d3e7fe0e055c9
class Resize(object): <NEW_LINE> <INDENT> def __init__(self, output_size): <NEW_LINE> <INDENT> assert isinstance(output_size, (int, tuple)) <NEW_LINE> self.output_size = output_size <NEW_LINE> <DEDENT> def __call__(self, sample): <NEW_LINE> <INDENT> image, label = sample['image'], sample['label'] <NEW_LINE> h, w = imag...
Resize the image in a sample to a given size. Args: output_size (tuple or int): Desired output size. If tuple, output is matched to output_size. If int, smaller of image edges is matched to output_size keeping aspect ratio the same.
62598eebbd1bec0571e14469
class TestRenderReadPixels(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.sf = SDL_CreateRGBSurface(0, 32, 32, 32, 0, 0, 0, 0) <NEW_LINE> self.rdr = SDL_CreateSoftwareRenderer(self.sf) <NEW_LINE> self.fm = SDL_PIXELFORMAT_RGB332 <NEW_LINE> self.rect = SDL_Rect(0, 0, 32, 32) <NEW_LINE>...
Tests SDL_RenderReadPixels()
62598eebbe8e80087fbbd78e
class ApiError(HtbException): <NEW_LINE> <INDENT> pass
The API responded in an unexpected way
62598eebdd821e528d6d7683
class DysonNotLoggedException(DysonException): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(DysonNotLoggedException, self).__init__()
Not logged to Dyson Web Services Exception.
62598eebd486a94d0ba2a70c
class ModelSchema(with_metaclass(ModelSchemaMeta, ma.Schema)): <NEW_LINE> <INDENT> OPTIONS_CLASS = ModelSchemaOpts <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> session = kwargs.pop('session', None) <NEW_LINE> self.instance = kwargs.pop('instance', None) <NEW_LINE> super(ModelSchema, self).__init_...
Base class for SQLAlchemy model-based Schemas. Example: :: from marshmallow_sqlalchemy import ModelSchema from mymodels import User, session class UserSchema(ModelSchema): class Meta: model = User schema = UserSchema() user = schema.load({'name': 'Bill'}, session=session) ...
62598eeb3d592f4c4edb9636
class CopyPipe(object): <NEW_LINE> <INDENT> def __init__(self, dstcurs, tablename = None, limit = 512*1024, cancel_func=None, sql_from = None): <NEW_LINE> <INDENT> self.tablename = tablename <NEW_LINE> self.sql_from = sql_from <NEW_LINE> self.dstcurs = dstcurs <NEW_LINE> self.buf = StringIO() <NEW_LINE> self.limit = li...
Splits one big COPY to chunks.
62598eebdd821e528d6d7684
class Dog(): <NEW_LINE> <INDENT> def __init__(self,name,age): <NEW_LINE> <INDENT> self.name=name <NEW_LINE> self.age=age <NEW_LINE> <DEDENT> def update_age(self,age1): <NEW_LINE> <INDENT> self.age=age1 <NEW_LINE> <DEDENT> def sit(self): <NEW_LINE> <INDENT> print(self.name.title()+' is now sitting!') <NEW_LINE> <DEDENT>...
一次模拟小狗的简单尝试
62598eeb32920d7e50bc476b
class ScenarioMixin(object): <NEW_LINE> <INDENT> DATASET_ID = uuid4() <NEW_LINE> NODE = u"192.0.2.1" <NEW_LINE> NODE_UUID = uuid4() <NEW_LINE> MANIFESTATION = Manifestation( dataset=Dataset( dataset_id=unicode(DATASET_ID), maximum_size=REALISTIC_BLOCKDEVICE_SIZE, ), primary=True, ) <NEW_LINE> ONE_DATASET_STATE = NodeSt...
A mixin for tests which defines some basic Flocker cluster state.
62598eebcad5886f8bdc3a41
class ConstraintViolation(ValueError): <NEW_LINE> <INDENT> pass
Raised on an attempt to merge a unique path onto a non-unique path.
62598eeb4e4d562566370b59
class RunProcessing(object): <NEW_LINE> <INDENT> def __init__(self, task, results): <NEW_LINE> <INDENT> self.task = task <NEW_LINE> self.analysis_path = os.path.join(CUCKOO_ROOT, "storage", "analyses", str(task["id"])) <NEW_LINE> self.cfg = Config("processing") <NEW_LINE> self.results = results <NEW_LINE> <DEDENT> def ...
Analysis Results Processing Engine. This class handles the loading and execution of the processing modules. It executes the enabled ones sequentially and generates a dictionary which is then passed over the reporting engine.
62598eebcc0a2c1114479743
class UL(DIV): <NEW_LINE> <INDENT> tag = 'ul' <NEW_LINE> def _fixup(self): <NEW_LINE> <INDENT> self._wrap_components(LI, LI)
UL Component. If subcomponents are not LI-components they will be wrapped in a LI
62598eeb63b5f9789fe8389c
class CondaPackage(CondaObjectDescription): <NEW_LINE> <INDENT> typename = "package" <NEW_LINE> doc_field_types = [ RequiredByField('requirements', names=('requirements',), label=u'Required\u00a0By', has_arg=False), RequirementsField('depends', names=('depends', 'dependencies', 'deps'), label="Depends", rolename='depen...
Directive ``.. conda:package::`` describing a Package This directive takes two specialized field types, ``requirements`` and ``depends``: .. code:: rst .. conda:package:: mypkg1 :depends mypkg2: 2.0 :depends mypkg3: :requirements: ``:depends pkgname: [version]`` Adds a dependency to the...
62598eeb30bbd72246468373
class AbstractGetRunner(FormattedOutputRunner): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> super(AbstractGetRunner, self).__init__(args) <NEW_LINE> self._id = args.id <NEW_LINE> self._httpClient = client.HttpClient( args.baseUrl, verbosityToLogLevel(args.verbose), self._key) <NEW_LINE> <DEDENT> d...
Abstract base class for get runner classes
62598eeb5fcc89381b2654c6
class Ball: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.x = 0 <NEW_LINE> self.y = 0 <NEW_LINE> self.dx = 0 <NEW_LINE> self.dy = 0
Class to keep track of a ball's location and velocity vector.
62598eeb2eb69b55b15a072a
class Viewdraw(object): <NEW_LINE> <INDENT> def write(self, design, filename): <NEW_LINE> <INDENT> with open(filename, "w") as f: <NEW_LINE> <INDENT> f.write('Viewdraw export is currently unsupported')
The Viewdraw Format Writer
62598eeb4527f215b58e863d
class ProxiedProtocol(floo_proto.FlooProtocol): <NEW_LINE> <INDENT> def _handle(self, data): <NEW_LINE> <INDENT> self.proxy(data)
Speaks floo proto, but is given the conn and we don't want to reconnect
62598eeb4428ac0f6e656c93
class Worker: <NEW_LINE> <INDENT> def __init__(self, worker_id, last_active=None): <NEW_LINE> <INDENT> self.id = worker_id <NEW_LINE> self.reference = None <NEW_LINE> self.last_active = last_active or time.time() <NEW_LINE> self.last_get_work = None <NEW_LINE> self.started = time.time() <NEW_LINE> self.tasks = set() <N...
Structure for tracking worker activity and keeping their references.
62598eeb851cf427c66b6a07
class MuscleError(Exception): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> self.message = message
Exception raised when Muscle fails
62598eeb9c8ee8231303f4f9
class RecordingSetupFace(LoginRequiredMixin, generic.View): <NEW_LINE> <INDENT> login_url = settings.LOGIN_URL <NEW_LINE> setup_view = 'recording/setup_face.html' <NEW_LINE> def get(self, request, interview_id, camera_id): <NEW_LINE> <INDENT> return render( request, self.setup_view, { 'interview': interview_id, 'camera...
Generic view to display the recording setup (face), this will be shown after login success
62598eeb0a50d4780f703ae7
class StringNodeVectorizer(object): <NEW_LINE> <INDENT> def __init__(self, dbConn): <NEW_LINE> <INDENT> self.dbConn = dbConn <NEW_LINE> self.stringStore = StringStore(dbConn) <NEW_LINE> <DEDENT> def vectorizeString(self, stringNode): <NEW_LINE> <INDENT> vector = () <NEW_LINE> if None != stringNode and stringNode.has_ke...
classdocs
62598eeb16aa5153ce3fec40
class EpisodeActionChanges(object): <NEW_LINE> <INDENT> def __init__(self, actions, since): <NEW_LINE> <INDENT> self.actions = actions <NEW_LINE> self.since = since
Container for added episode actions Attributes: actions - A list of EpisodeAction objects since - A timestamp value for use in future requests
62598eebfff4ab517ebcbf18
class UseAfterParameters(Parameters): <NEW_LINE> <INDENT> selector = UseAfterSelector
Parameters for UseAfterSelector
62598eeb097d151d1a2bf75d
class NewLog: <NEW_LINE> <INDENT> description = "Create a new log entry for today" <NEW_LINE> args = [] <NEW_LINE> def run(self): <NEW_LINE> <INDENT> log = LogFile(datetime.now(), create=True) <NEW_LINE> previous = log.previous <NEW_LINE> logs = [previous] if previous else [] <NEW_LINE> logs.append(log) <NEW_LINE> Edit...
Command to create a new log entry
62598eebaad79263cf42cf4c
class AbstractDataSource(models.Model): <NEW_LINE> <INDENT> id = models.CharField(max_length=100, primary_key=True) <NEW_LINE> name = models.CharField(max_length=255) <NEW_LINE> user_editable_organizations = models.BooleanField(default=False, verbose_name=_('Organizations may be edited by users')) <NEW_LINE> class Meta...
Abstract data source model. Abstract data source model that provides required fields for custom data source model.
62598eeb7c178a314d78bbd4
class ChecklistCreateView(CreateView): <NEW_LINE> <INDENT> template_name = os.path.join("checklists","checklist_createview.html") <NEW_LINE> form_class = CheckListCreateForm <NEW_LINE> success_url = reverse_lazy("maintenance:inbox") <NEW_LINE> def post(self, *args, **kwargs): <NEW_LINE> <INDENT> resp = super(ChecklistC...
Form for creating new checklists by admin staff.
62598eeb460517430c430bc9
class ItopcliConfig(object): <NEW_LINE> <INDENT> file = None <NEW_LINE> classes = [] <NEW_LINE> find_instance = None <NEW_LINE> delete_instances = None <NEW_LINE> save = None
ItopcliConfig represent configuration for itop-cli
62598eeb26068e7796d4b09d
class Environment: <NEW_LINE> <INDENT> def score(): <NEW_LINE> <INDENT> raise NotImplementedError()
For these purposes, the target of the agent
62598eeb2ae34c7f260a9828
class Logger(logging.Logger): <NEW_LINE> <INDENT> _log_map = set() <NEW_LINE> def __init__(self, name, level=logging.DEBUG): <NEW_LINE> <INDENT> logging.Logger.__init__(self, name, level) <NEW_LINE> Logger._log_map.add(name)
Maintains a list of loggers for this package
62598eeb8e71fb1e983ba1ae
class VHDIResolverHelperTest(test_lib.ResolverHelperTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(VHDIResolverHelperTest, self).setUp() <NEW_LINE> test_path = self._GetTestFilePath(['ext2.vhd']) <NEW_LINE> self._SkipIfPathNotExists(test_path) <NEW_LINE> test_os_path_spec = path_spec_factory....
Tests for the Virtual Hard Disk image resolver helper implementation.
62598eeb4527f215b58e863f
class LinearOperatorCirculant2DTestHermitianSpectrum( LinearOperatorCirculant2DBaseTest, linear_operator_test_util.SquareLinearOperatorDerivedClassTest): <NEW_LINE> <INDENT> def _operator_and_matrix( self, build_info, dtype, use_placeholder, ensure_self_adjoint_and_pd=False): <NEW_LINE> <INDENT> shape = build_info.shap...
Test of LinearOperatorCirculant2D when the spectrum is Hermitian. Hermitian spectrum <==> Real valued operator. We test both real and complex dtypes here though. So in some cases the matrix will be complex but with zero imaginary part.
62598eeb21bff66bcd721395
class _ExternalComponentFactory(object): <NEW_LINE> <INDENT> pass
_ExternalComponentFactory will contain all created external component types
62598eeb3346ee7daa336a09
class RecordSet: <NEW_LINE> <INDENT> def __init__(self, tableData, columnNames): <NEW_LINE> <INDENT> self.data = tableData <NEW_LINE> self.columns = columnNames <NEW_LINE> self.columnMap = {} <NEW_LINE> for name,n in zip(columnNames, xrange(10000)): <NEW_LINE> <INDENT> self.columnMap[name] = n <NEW_LINE> <DEDENT> <DEDE...
Wrapper for tabular data.
62598eeb7047854f4633db15
class DNNClassifier(dnn_linear_combined.DNNLinearCombinedClassifier): <NEW_LINE> <INDENT> def __init__(self, hidden_units, feature_columns=None, model_dir=None, n_classes=2, weight_column_name=None, optimizer=None, activation_fn=nn.relu, dropout=None): <NEW_LINE> <INDENT> super(DNNClassifier, self).__init__(n_classes=n...
A classifier for TensorFlow DNN models. Example: ``` installed_app_id = sparse_column_with_hash_bucket("installed_id", 1e6) impression_app_id = sparse_column_with_hash_bucket("impression_id", 1e6) installed_emb = embedding_column(installed_app_id, dimension=16, c...
62598eeb091ae35668703359
class User(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(30)) <NEW_LINE> api_id = db.Column(db.String(36), unique=True) <NEW_LINE> dossiers = db.relationship('Dossier', backref='user', lazy='dynamic') <NEW_LINE> def _...
User model for our Dossier name: The name as retrieved from the owner api api_id: ID of the user who has installed the app, this will be the same across all leagues for this user dossiers: Child table that has one dossier for each league that this user is a part of.
62598eeb236d856c2adc87b6
class RollingHash: <NEW_LINE> <INDENT> def __init__(self, s): <NEW_LINE> <INDENT> self.HASH_BASE = 7 <NEW_LINE> self.seqlen = len(s) <NEW_LINE> n = self.seqlen - 1 <NEW_LINE> h = 0 <NEW_LINE> for c in s: <NEW_LINE> <INDENT> h += ord(c) * (self.HASH_BASE ** n) <NEW_LINE> n -= 1 <NEW_LINE> <DEDENT> self.curhash = h <NEW_...
Utility class
62598eeb5fdd1c0f98e5c6e2
class MFKMode(MemObject): <NEW_LINE> <INDENT> def __init__(self, name,pklist = []): <NEW_LINE> <INDENT> MemObject.__init__(self, name, mclient) <NEW_LINE> self.pklist = pklist
外键内存数据模型
62598eeb97e22403b3839631
class FCFS(SchedulerDES): <NEW_LINE> <INDENT> def scheduler_func(self, cur_event): <NEW_LINE> <INDENT> return self.processes[cur_event.process_id] <NEW_LINE> <DEDENT> def dispatcher_func(self, cur_proc): <NEW_LINE> <INDENT> cur_proc.process_state = ProcessStates.RUNNING <NEW_LINE> cur_proc.run_for(cur_proc.service_time...
Implementation of FCFS/FIFO scheduling algorithms using OOP techniques
62598eeb498bea3a75a56273
class SetAbstraction(DeepCLRModule): <NEW_LINE> <INDENT> def __init__(self, input_dim: int, point_dim: int, mlps: List[List[List[int]]], npoint: List[int], radii: List[List[float]], nsamples: List[List[int]], batch_norm: bool = False, **_kwargs: Any): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> assert point_dim =...
Set abstraction layer for preprocessing the individual point cloud.
62598eeb4f6381625f19885c
class _BeCalmFetcher(DocIterator): <NEW_LINE> <INDENT> domain = None <NEW_LINE> url = None <NEW_LINE> textfield = None <NEW_LINE> def iter_documents(self, source): <NEW_LINE> <INDENT> return self._iter_documents(source) <NEW_LINE> <DEDENT> def _iter_documents(self, docids): <NEW_LINE> <INDENT> if not isinstance(docids,...
Fetch documents from BeCalm's servers.
62598eebdc8b845886d51d05
class ForgotCredentialReset(Form): <NEW_LINE> <INDENT> university_email = StringField( 'Email', validators=[ DataRequired(), Email(), university_email_does_not_exits ] )
Form to send reset email with verification.
62598eeb379a373c97d97737
class StorageArea(ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__ = 'storage.area' <NEW_LINE> name = fields.Char('Name', required=True, select=True) <NEW_LINE> sequence = fields.Integer('Sequence', required=True, select=True) <NEW_LINE> description = fields.Text('Description', select=True) <NEW_LINE> @classmethod <N...
Storage Area
62598eeb2c8b7c6e89bd1f03
class UserNotInGroupSource(SpecializedSource): <NEW_LINE> <INDENT> def construct_query(self, ctx): <NEW_LINE> <INDENT> if IAlchemistContainer.providedBy(ctx): <NEW_LINE> <INDENT> assert IGroupMember.implementedBy(ctx.domain_model), ctx <NEW_LINE> assert IGroup.providedBy(ctx.__parent__), ctx <NEW_LINE> group = ctx.__pa...
All active users who are not, in some way or another, already member of the context group.
62598eeb56ac1b37e630092f
class NodeVisitor(ast.NodeVisitor): <NEW_LINE> <INDENT> def __init__(self, dispatcher, *args, **kwargs): <NEW_LINE> <INDENT> self.dispatcher = dispatcher <NEW_LINE> self.args = args <NEW_LINE> self.kwargs = kwargs <NEW_LINE> <DEDENT> def visit(self, node): <NEW_LINE> <INDENT> rv = self.dispatcher(node, *self.args, **se...
AST node visitor which wraps a single-dispatch function.
62598eeb009cb60464cffc90
class Url(namedtuple('Url', url_attrs)): <NEW_LINE> <INDENT> slots = () <NEW_LINE> def __new__(cls, scheme=None, auth=None, host=None, port=None, path=None, query=None, fragment=None): <NEW_LINE> <INDENT> return super(Url, cls).__new__(cls, scheme, auth, host, port, path, query, fragment) <NEW_LINE> <DEDENT> @property ...
Datastructure for representing an HTTP URL. Used as a return value for :func:`parse_url`.
62598eeb4527f215b58e8640