code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class TestHoneywellRound(unittest.TestCase): <NEW_LINE> <INDENT> def setup_method(self, method): <NEW_LINE> <INDENT> def fake_temperatures(force_refresh=None): <NEW_LINE> <INDENT> temps = [ {'id': '1', 'temp': 20, 'setpoint': 21, 'thermostat': 'main', 'name': 'House'}, {'id': '2', 'temp': 21, 'setpoint': 22, 'thermosta...
A test class for Honeywell Round thermostats.
62599072a05bb46b3848bd9d
@content( 'Password Resets', icon='icon-tags' ) <NEW_LINE> @implementer(IPasswordResets) <NEW_LINE> class PasswordResets(Folder): <NEW_LINE> <INDENT> def _gen_random_token(self): <NEW_LINE> <INDENT> length = random.choice(range(10, 16)) <NEW_LINE> chars = string.letters + string.digits <NEW_LINE> return ''.join(random....
Object representing the current set of password reset requests
62599072627d3e7fe0e0876b
class reActiveRas(Handler): <NEW_LINE> <INDENT> def control(self): <NEW_LINE> <INDENT> self.is_valid(self.ras_ip, str) <NEW_LINE> self.is_valid_content(self.ras_ip, self.IP_PATTERN) <NEW_LINE> <DEDENT> def setup(self, ras_ip): <NEW_LINE> <INDENT> self.ras_ip = ras_ip
Reactive ras method class.
625990725166f23b2e244cb7
class WebSocketView(web.View): <NEW_LINE> <INDENT> @asyncio.coroutine <NEW_LINE> def get(self): <NEW_LINE> <INDENT> ws = web.WebSocketResponse() <NEW_LINE> dispatch = dispatcher.Dispatcher(ws) <NEW_LINE> yield from ws.prepare(self.request) <NEW_LINE> dispatch.event(events.create_web_socket()) <NEW_LINE> while True: <NE...
Websocket endpoint.
625990725fcc89381b266dc9
class Bundle(object): <NEW_LINE> <INDENT> def __init__(self, name, path, url, files, type): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.path = path <NEW_LINE> self.url = url <NEW_LINE> if not url.endswith("/"): <NEW_LINE> <INDENT> raise ValueError("Bundle URLs must end with a '/'.") <NEW_LINE> <DEDENT> self.fi...
Base class for a bundle of media files. A bundle is a collection of related static files that can be concatenated together and served as a single file to improve performance.
62599072e1aae11d1e7cf47f
class CompanySerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Company <NEW_LINE> fields = '__all__' <NEW_LINE> read_only_fields = ('id',)
Serializer for LinkedIn comapnies
6259907238b623060ffaa4c6
class Colleague(metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self, mediator): <NEW_LINE> <INDENT> self.__mediator = mediator <NEW_LINE> <DEDENT> @property <NEW_LINE> def mediator(self): <NEW_LINE> <INDENT> return self.__mediator <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def send(self, message): <NEW_LINE> ...
抽象同事类
62599072283ffb24f3cf518d
class ExperimentalData(Data): <NEW_LINE> <INDENT> def __init__(self, values, verrors, coords, cerrors, units): <NEW_LINE> <INDENT> super(ExperimentalData, self).__init__(coords=coords, values=values, verrors=verrors, cerrors=cerrors, units=units) <NEW_LINE> return
ExperimentalData is a form of Data which issues a Warning upon any use if there are not valid values for any or all of the error or units.
625990724428ac0f6e659e18
class EventHandler(FileSystemEventHandler): <NEW_LINE> <INDENT> def __init__(self, working_dir, config_factory): <NEW_LINE> <INDENT> self.working_dir = working_dir <NEW_LINE> self.config_factory = config_factory <NEW_LINE> self.config = self.initial_config_load() <NEW_LINE> self.io_handler = IOHandler(working_dir) <NEW...
Watchcode's main event handler
625990723539df3088ecdb7a
class ButtonGrp(QGroupBox): <NEW_LINE> <INDENT> def __init__(self, game: GameModel): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.game = game <NEW_LINE> def bet_button_func(): <NEW_LINE> <INDENT> if self.bet_line.text().isdigit(): <NEW_LINE> <INDENT> bet = int(self.bet_line.text()) <NEW_LINE> self.bet_line.cl...
A widget that represents buttons in the game. :param game: Game model.
625990728e7ae83300eea975
class User(ResourceMixin, ModelBase): <NEW_LINE> <INDENT> __tablename__ = "user" <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> name = Column(String, unique=True, nullable=False) <NEW_LINE> roles = Column(String, nullable=False, default="") <NEW_LINE> def get_roles(self): <NEW_LINE> <INDENT> return self.r...
User Model
62599072adb09d7d5dc0be4f
class Statement(Statements): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.vartype = None <NEW_LINE> self.identifiers = None
<declaracao> := <tipo> : <identificadores>
6259907244b2445a339b75d0
class Rar5Info(RarInfo): <NEW_LINE> <INDENT> extract_version = 50 <NEW_LINE> header_crc = None <NEW_LINE> header_size = None <NEW_LINE> header_offset = None <NEW_LINE> data_offset = None <NEW_LINE> block_type = None <NEW_LINE> block_flags = None <NEW_LINE> add_size = 0 <NEW_LINE> block_extra_size = 0 <NEW_LINE> volume_...
Shared fields for RAR5 records.
62599072a17c0f6771d5d81d
class BoundCollectionBuilder(CollectionBuilder): <NEW_LINE> <INDENT> def __init__(self, dataset_collection): <NEW_LINE> <INDENT> self.dataset_collection = dataset_collection <NEW_LINE> if dataset_collection.populated: <NEW_LINE> <INDENT> raise Exception("Cannot reset elements of an already populated dataset collection....
More stateful builder that is bound to a particular model object.
6259907256b00c62f0fb41b4
class ResetPassword(APIView): <NEW_LINE> <INDENT> def get(self, request,reset_id, format=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = Usr.objects.get(reset_id=reset_id) <NEW_LINE> serializer = UsrSerializer(user) <NEW_LINE> key=serializer.data.get('reset_id') <NEW_LINE> if user is not None: <NEW_LINE> <IN...
Reset password app
625990724428ac0f6e659e19
class Solution1: <NEW_LINE> <INDENT> def numIslands(self, grid): <NEW_LINE> <INDENT> if not grid or not grid[0]: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> m = len(grid) <NEW_LINE> n = len(grid[0]) <NEW_LINE> numIslands = 0 <NEW_LINE> totalIslands = 0 <NEW_LINE> for i in range(m): <NEW_LINE> <INDENT> for j in ran...
@param grid: a boolean 2D matrix @return: an integer
625990724527f215b58eb612
class Field(object): <NEW_LINE> <INDENT> def __init__(self, name, type='STRING', mode='NULLABLE'): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.type = type <NEW_LINE> self.mode = mode <NEW_LINE> <DEDENT> def to_json(self): <NEW_LINE> <INDENT> return { 'name': self.name, 'type': self.type, 'mode': self.mode, }
A field of a CSV or BigQuery table representation of a CCDA.
62599072a219f33f346c80ef
class MeasureSum(object): <NEW_LINE> <INDENT> __slots__ = ("_measures",) <NEW_LINE> def __init__(self, *measures): <NEW_LINE> <INDENT> self._measures = measures <NEW_LINE> <DEDENT> def __rmul__(self, other): <NEW_LINE> <INDENT> integrals = [other * m for m in self._measures] <NEW_LINE> return sum(integrals) <NEW_LINE> ...
Represents a sum of measures. This is a notational intermediate object to translate the notation f*(ds(1)+ds(3)) into f*ds(1) + f*ds(3)
62599072bf627c535bcb2db1
class Trigger(object): <NEW_LINE> <INDENT> def __init__(self, connection=None, name=None, autoscale_group=None, dimensions=None, measure_name=None, statistic=None, unit=None, period=60, lower_threshold=None, lower_breach_scale_increment=None, upper_threshold=None, upper_breach_scale_increment=None, breach_duration=None...
An auto scaling trigger. @type name: str @param name: The name for this trigger @type autoscale_group: str @param autoscale_group: The name of the AutoScalingGroup that will be associated with the trigger. The AutoScalingGroup that will be affected by the trigger when i...
6259907201c39578d7f143a7
class GameEnviroment(metaclass=ABCMeta): <NEW_LINE> <INDENT> done = False <NEW_LINE> params = None <NEW_LINE> _bestAction = None <NEW_LINE> _bestReward = None <NEW_LINE> _bestAvgReward = 0 <NEW_LINE> def __init__(self, n_bandits): <NEW_LINE> <INDENT> self.params = EnvParams(n_bandits) <NEW_LINE> <DEDENT> def _beforeGet...
Base class for game enviroment Attributes: done - flag for end game params - public enviroment params
625990727d43ff2487428085
class ScanTaskSerializer(NotEmptySerializer): <NEW_LINE> <INDENT> sequence_number = IntegerField(required=False, min_value=0, read_only=True) <NEW_LINE> source = SourceField(queryset=Source.objects.all()) <NEW_LINE> scan_type = ChoiceField( required=False, choices=ScanTask.SCANTASK_TYPE_CHOICES) <NEW_LINE> status = Cho...
Serializer for the ScanTask model.
62599072f548e778e596ce73
class Signer: <NEW_LINE> <INDENT> def __init__(self, signer_key: SignerKey, weight) -> "None": <NEW_LINE> <INDENT> self.signer_key: SignerKey = signer_key <NEW_LINE> self.weight: int = weight <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def ed25519_public_key(cls, account_id: str, weight: int) -> "Signer": <NEW_LINE> <I...
The :class:`Signer` object, which represents an account signer on Stellar's network. :param signer_key: The signer object :param weight: The weight of the key
6259907216aa5153ce401dbe
class HelpdeskEditForm(base.EditForm): <NEW_LINE> <INDENT> form_fields = (form.Fields(IHelpdesk).select('title','description','persistent') + form.Fields(IHelpdesk, for_display=True).select('botJid','botPassword')) <NEW_LINE> label = _(u"Edit jabber Helpdesk") <NEW_LINE> form_name = _(u"Helpdesk settings")
Edit form for projects
62599072aad79263cf43009b
class WinType(Enum): <NEW_LINE> <INDENT> pass
A way in which a match is won (e.g. pin, disqualification).
6259907267a9b606de547716
class cableInsulationDetails(EmbeddedDocument): <NEW_LINE> <INDENT> name = StringField(required=True, choices=cableVar.list_insulationType) <NEW_LINE> conductorTemperature = IntField(required=True) <NEW_LINE> maxTemperature = IntField(required=True) <NEW_LINE> code = StringField(required=True, choices=cableVar.list_ins...
:param name: :param conductorTemperature: :param maxTemperature: # maximum conductor temperature. Assumes degrees C
625990724a966d76dd5f07d0
class WorkersConfig: <NEW_LINE> <INDENT> _rq_workers_str = ['RQ', 'rq'] <NEW_LINE> def __init__(self, use_for_all: bool = False, worker_type: Optional[str] = None, worker_pool_kwargs: Optional[Dict[str, Any]] = None): <NEW_LINE> <INDENT> self.use_for_all = use_for_all <NEW_LINE> self._check_worker_type(worker_type) <NE...
the configuration of Chariots Workerpolls
6259907297e22403b383c7e8
class Class: <NEW_LINE> <INDENT> def __init__(self, code): <NEW_LINE> <INDENT> self.code = code
docstring for Class
625990727047854f46340c9c
class colorconvertEvents(sublime_plugin.EventListener): <NEW_LINE> <INDENT> def on_selection_modified(self, view): <NEW_LINE> <INDENT> sels = view.sel() <NEW_LINE> global _hr <NEW_LINE> global _hg <NEW_LINE> global _hb <NEW_LINE> global _r <NEW_LINE> global _g <NEW_LINE> global _b <NEW_LINE> global _h <NEW_LINE> global...
Event listener for the ColorConvert plugin. Attributes: sublime_plugin.EventListener: Sublime Text class basis.
62599072097d151d1a2c2958
class FakeFile: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.file = '' <NEW_LINE> <DEDENT> def write(self, text): <NEW_LINE> <INDENT> self.file += text <NEW_LINE> <DEDENT> def flush(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def read(self): <NEW_LINE> <INDENT> return self.file
Use to capture the output
62599072be8e80087fbc0976
class OAuthSettingsHelper: <NEW_LINE> <INDENT> _remote_app = None <NEW_LINE> _remote_rest_app = None <NEW_LINE> def __init__( self, title, description, base_url, app_key, icon=None, access_token_url=None, authorize_url=None, access_token_method="POST", request_token_params=None, request_token_url=None, precedence_mask=...
Helper for creating REMOTE_APP configuration dictionaries for OAuth.
6259907221bff66bcd72454e
class LinuxIntelCompiler(Compiler): <NEW_LINE> <INDENT> def __init__(self, cppargs=[], ldargs=[], cpp=False, comm=None): <NEW_LINE> <INDENT> opt_flags = ['-Ofast', '-xHost'] <NEW_LINE> if configuration['debug']: <NEW_LINE> <INDENT> opt_flags = ['-O0', '-g'] <NEW_LINE> <DEDENT> cc = "mpicc" <NEW_LINE> stdargs = ["-std=g...
The intel compiler for building a shared library on linux systems. :arg cppargs: A list of arguments to pass to the C compiler (optional). :arg ldargs: A list of arguments to pass to the linker (optional). :arg cpp: Are we actually using the C++ compiler? :kwarg comm: Optional communicator to compile the code on ...
62599072ac7a0e7691f73dd0
class ArticleDetailSerialazer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Article <NEW_LINE> fields = '__all__'
1 статья
62599072b7558d5895464ba6
class canvas_descr: <NEW_LINE> <INDENT> def __init__(self, x_title=None, y_title=None, x_lim=None, y_lim=None, x_labels=True, y_labels=True): <NEW_LINE> <INDENT> self.x_title = x_title; <NEW_LINE> self.y_title = y_title; <NEW_LINE> self.x_lim = x_lim; <NEW_LINE> self.y_lim = y_lim; <NEW_LINE> self.x_labels = x_...
! @brief Describes plot where dynamic is displayed. @details Used by 'dynamic_visualizer' class.
625990724e4d562566373ced
class DecimalField(CoreDecimalField): <NEW_LINE> <INDENT> def populate_obj(self, obj, name): <NEW_LINE> <INDENT> setattr(obj, name, float(self.data)) <NEW_LINE> <DEDENT> def process_formdata(self, valuelist): <NEW_LINE> <INDENT> if valuelist and valuelist[0]: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if self.use_loc...
Customized decimal field.
6259907256b00c62f0fb41b6
class ResponseInstructions(object): <NEW_LINE> <INDENT> swagger_types = { } <NEW_LINE> attribute_map = { } <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.discriminator = None <NEW_LINE> <DEDENT> def to_dict(self): <NEW_LINE> <INDENT> result = {} <NEW_LINE> for attr, _ in six.iteritems(self.swagger_types): <NEW...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
62599072bf627c535bcb2db3
class BDQN_TS(BDQN): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(mode="ts", **kwargs) <NEW_LINE> self.reset_ts = None <NEW_LINE> <DEDENT> def build(self): <NEW_LINE> <INDENT> super().build() <NEW_LINE> agent_w = [blr.w for blr in self.agent_blr] <NEW_LINE> targe...
Bayesian Double DQN with Thompson Sampling exploration policy
62599072f548e778e596ce74
class ContextFilter(logging.Filter): <NEW_LINE> <INDENT> def filter(self, record): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if hasattr(cherrypy, 'serving'): <NEW_LINE> <INDENT> request = cherrypy.serving.request <NEW_LINE> remote = request.remote <NEW_LINE> record.ip = remote.name or remote.ip <NEW_LINE> if 'X-Forw...
This is a filter which injects contextual information into the log.
625990727d43ff2487428086
class Node: <NEW_LINE> <INDENT> __slots__ = "data", "prev", "next" <NEW_LINE> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.next = None <NEW_LINE> self.prev = None
Implements the nodes in a doubly linked list
625990724e4d562566373cee
class spikegeneratorModel(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name = '' <NEW_LINE> self.codeobject_name = '' <NEW_LINE> self.N = 0
Class that contains all relevant information of a spike generator group.
62599072baa26c4b54d50b93
class TestApiFunc: <NEW_LINE> <INDENT> @patch('pyvesync_v2.helpers.requests.get', autospec=True) <NEW_LINE> def test_api_get(self, get_mock): <NEW_LINE> <INDENT> get_mock.return_value = Mock(ok=True, status_code=200) <NEW_LINE> get_mock.return_value.json.return_value = {'code': 0} <NEW_LINE> mock_return = Helpers.call_...
Test call_api() method.
6259907266673b3332c31ce6
class ImportCompilationTest(_common.TestCase, ImportHelper): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.setup_beets() <NEW_LINE> self._create_import_dir(3) <NEW_LINE> self._setup_import_session() <NEW_LINE> self.matcher = AutotagStub().install() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <IND...
Test ASIS import of a folder containing tracks with different artists.
62599072dd821e528d6da5f5
class HaarLikeFeatureExtractor(FeatureExtractorBase): <NEW_LINE> <INDENT> mFeatureSet = None <NEW_LINE> mDo45 = True <NEW_LINE> def __init__(self, fname=None, do45=True): <NEW_LINE> <INDENT> self.mDo45 = True <NEW_LINE> self.mFeatureset=None; <NEW_LINE> if(fname is not None): <NEW_LINE> <INDENT> self.readWavelets(fname...
This is used generate Haar like features from an image. These Haar like features are used by a the classifiers of machine learning to help identify objects or things in the picture by their features, or in this case haar features. For a more in-depth review of Haar Like features see: http://en.wikipedia.org/wiki/Haar...
625990727047854f46340c9e
class SentenceIndexTeacher(IndexTeacher): <NEW_LINE> <INDENT> def __init__(self, opt, shared=None): <NEW_LINE> <INDENT> super().__init__(opt, shared) <NEW_LINE> try: <NEW_LINE> <INDENT> import nltk <NEW_LINE> <DEDENT> except ImportError: <NEW_LINE> <INDENT> raise ImportError('Please install nltk (e.g. pip install nltk)...
Index teacher where the labels are the sentences the contain the true answer.
62599072097d151d1a2c295a
class StockInvestorRequest(StockInvestorTaskBase): <NEW_LINE> <INDENT> def __init__(self, api_key, stock, start_date, end_date): <NEW_LINE> <INDENT> super(StockInvestorRequest, self).__init__(api_key, stock, start_date, end_date)
StockInvestorRequest Base handler of content for processed Task requests.
62599072627d3e7fe0e0876f
class PyPIJSONLocator(Locator): <NEW_LINE> <INDENT> def __init__(self, url, **kwargs): <NEW_LINE> <INDENT> super(PyPIJSONLocator, self).__init__(**kwargs) <NEW_LINE> self.base_url = ensure_slash(url) <NEW_LINE> <DEDENT> def get_distribution_names(self): <NEW_LINE> <INDENT> raise NotImplementedError('Not available from ...
This locator uses PyPI's JSON interface. It's very limited in functionality and probably not worth using.
62599072e1aae11d1e7cf481
class ESMTPDowngradeTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.clientProtocol = smtp.ESMTPClient( b"testpassword", None, b"testuser") <NEW_LINE> <DEDENT> def test_requireHELOFallbackOperates(self): <NEW_LINE> <INDENT> transport = StringTransport() <NEW_LINE> self.clientPr...
Tests for the ESMTP -> SMTP downgrade functionality in L{smtp.ESMTPClient}.
625990727047854f46340c9f
class McCallModel: <NEW_LINE> <INDENT> def __init__(self, alpha=0.2, beta=0.98, gamma=0.7, c=6.0, sigma=2.0, w_vec=None, p_vec=None): <NEW_LINE> <INDENT> self.alpha, self.beta, self.gamma, self.c = alpha, beta, gamma, c <NEW_LINE> self.sigma = sigma <NEW_LINE> if w_vec is None: <NEW_LINE> <INDENT> n = 60 <NEW_LINE> sel...
Stores the parameters and functions associated with a given model.
62599072283ffb24f3cf5191
class variate_generator: <NEW_LINE> <INDENT> def __init__(self, engine, distribution): <NEW_LINE> <INDENT> self.engine = engine <NEW_LINE> self.distribution = distribution <NEW_LINE> <DEDENT> def seed(self, value): <NEW_LINE> <INDENT> self.engine.seed(value) <NEW_LINE> self.distribution.reset() <NEW_LINE> <DEDENT> def ...
A pure-python version of the boost::variate_generator<> class Keyword parameters: engine An instance of the RNG you would like to use. This has to be an object of the class :py:class:`bob.core.random.mt19937`, already initialized. distribution The distribution to respect when generating scalars using the eng...
62599072cc0a2c111447c745
class TestTaskByDidList(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 testTaskByDidList(self): <NEW_LINE> <INDENT> model = artikcloud.models.task_by_did_list.TaskByDidList()
TaskByDidList unit test stubs
62599072d486a94d0ba2d8a7
class ClickLogger(Logger): <NEW_LINE> <INDENT> def success(self, message: str): <NEW_LINE> <INDENT> self.log(LogTag.SUCCESS, message, LogColor.SUCCESS) <NEW_LINE> <DEDENT> def info(self, message: str): <NEW_LINE> <INDENT> self.log(LogTag.INFO, message, LogColor.INFO) <NEW_LINE> <DEDENT> def warn(self, message: str): <N...
Logger that uses click logging utilities to log to stdout. Format in the form of: [ TAG ] MESSAGE
62599072b7558d5895464ba7
class Product_admin(admin.ModelAdmin): <NEW_LINE> <INDENT> pass
Admin View for Product Model
62599072ac7a0e7691f73dd2
class HTMLFile(XHTMLFile): <NEW_LINE> <INDENT> class_mimetypes = ['text/html'] <NEW_LINE> class_extension = 'html' <NEW_LINE> @classmethod <NEW_LINE> def get_skeleton(cls, title=''): <NEW_LINE> <INDENT> skeleton = ( '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"\n' ' "http://www.w3.org/TR/html4/loose....
HTML files are a lot like XHTML, only the parsing and the output is different, so we inherit from XHTMLFile instead of TextFile, even if the mime type is 'text/html'. The parsing is based on the HTMLParser class, which has a more object oriented approach than the expat parser used for xml, i.e. we inherit from HTMLPar...
6259907256b00c62f0fb41b8
class RemoveExpiredSessions(superdesk.Command): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> self.remove_expired_sessions() <NEW_LINE> <DEDENT> def remove_expired_sessions(self): <NEW_LINE> <INDENT> expiry_minutes = app.settings['SESSION_EXPIRY_MINUTES'] <NEW_LINE> expiration_time = utcnow() - timedelta(minut...
Remove expired sessions from db. Using ``SESSION_EXPIRY_MINUTES`` config. Example: :: $ python manage.py session:gc
62599072f9cc0f698b1c5f3f
class MustContainAtSymbolError(Error): <NEW_LINE> <INDENT> pass
The email does not contain @.
62599072d486a94d0ba2d8a8
class CardCollection(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._cards = [] <NEW_LINE> <DEDENT> def add_card(self, card): <NEW_LINE> <INDENT> if type(card) is not Card: <NEW_LINE> <INDENT> raise InvalidCardException(( 'The first argument to the CardCollection.add_card' 'method must be an ...
The cards in a CardCollection are arranged in any order. A CardCollection can contain any number of cards.
625990721b99ca40022901aa
class ErrorHarCaptureTest(HarCaptureTestBase): <NEW_LINE> <INDENT> @expectedFailure <NEW_LINE> def test_har_is_captured_on_error_in_error_mode(self): <NEW_LINE> <INDENT> self.should_capture = 1 <NEW_LINE> self.visit_pages() <NEW_LINE> raise Exception('Raising generic exception so that this test will error.') <NEW_LINE>...
How the har_mode is set: using environment var `BOK_CHOY_HAR_MODE`. This can be overridden for an individual test class using the @attr decorator from the nose.plugin.attrib module.
625990725166f23b2e244cbd
class Command(BaseCommand): <NEW_LINE> <INDENT> def add_arguments(self, parser): <NEW_LINE> <INDENT> parser.add_argument('filename') <NEW_LINE> parser.add_argument('--log', dest='log') <NEW_LINE> <DEDENT> def handle(self, *args, **options): <NEW_LINE> <INDENT> if options['log']: <NEW_LINE> <INDENT> logging.basicConfig(...
A command for updating whether students are active. Expects a comma separated list, where the username is the first object, and the rest are ignored If the name is not in the list, the student will be made inactive.
6259907263b5f9789fe86a4d
class IterableLoopInterface(TaskInterface): <NEW_LINE> <INDENT> iterable = Str('0.0').tag(pref=True) <NEW_LINE> def check(self, *args, **kwargs): <NEW_LINE> <INDENT> test = True <NEW_LINE> traceback = {} <NEW_LINE> task = self.task <NEW_LINE> err_path = task.task_path + '/' + task.task_name <NEW_LINE> try: <NEW_LINE> <...
Common logic for all loop tasks.
625990722ae34c7f260ac9d4
class WeatherViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> @method_decorator(cache_page(60*2)) <NEW_LINE> def retrieve(self, request, *args, **kwargs): <NEW_LINE> <INDENT> weather_url = 'http://api.openweathermap.org/data/2.5/weather?q='+ kwargs.get('city')+','+kwargs.get('country')+ '&appid=1508...
Allows the users to get the weather
62599072e5267d203ee6d032
class PPO(NPO): <NEW_LINE> <INDENT> def __init__(self, optimizer=None, optimizer_args=None, **kwargs): <NEW_LINE> <INDENT> if optimizer is None: <NEW_LINE> <INDENT> optimizer = FirstOrderOptimizer <NEW_LINE> if optimizer_args is None: <NEW_LINE> <INDENT> optimizer_args = dict() <NEW_LINE> <DEDENT> <DEDENT> super(PPO, s...
Proximal Policy Optimization. See https://arxiv.org/abs/1707.06347.
625990728e7ae83300eea97b
class DatabaseIterator(object): <NEW_LINE> <INDENT> def __init__(self, curs): <NEW_LINE> <INDENT> self.curs = curs <NEW_LINE> self.iter = curs.__iter__() <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> def convert(self, row): <NEW_LINE> <INDENT> return row <NEW_LINE> <DEDENT>...
A DatabaseIterator supplies on-the-fly translation of database- specific column values (such as cx_Oracle's BLOB data types), one row at a time. The database cursor is used as sub-iterator so that data is only read and converted on actual use. Subclasses override the convert() method, which should return a sequence wh...
62599072091ae35668706522
class SQLiTemplate(BaseTemplate): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SQLiTemplate, self).__init__() <NEW_LINE> self.name = self.get_vulnerability_name() <NEW_LINE> <DEDENT> def create_vuln(self): <NEW_LINE> <INDENT> v = self.create_base_vuln() <NEW_LINE> url = self.url <NEW_LINE> if self....
Vulnerability template for SQL injection vulnerability.
62599072ac7a0e7691f73dd4
class Proto(RuleChoice): <NEW_LINE> <INDENT> tcp = 'tcp' <NEW_LINE> udp = 'udp' <NEW_LINE> icmp = 'icmp' <NEW_LINE> @property <NEW_LINE> def rule(self): <NEW_LINE> <INDENT> return 'proto=' + str(self)
Protocol name
62599072a8370b77170f1cb5
class WellSample(object): <NEW_LINE> <INDENT> def __init__(self, node): <NEW_LINE> <INDENT> self.node = node <NEW_LINE> <DEDENT> def get_ID(self): <NEW_LINE> <INDENT> return self.node.get("ID") <NEW_LINE> <DEDENT> def set_ID(self, value): <NEW_LINE> <INDENT> self.node.set("ID", value) <NEW_LINE> <DEDENT> ID = property(...
The WellSample is a location within a well
625990727d847024c075dcc4
class ts_quest_labels(dtable): <NEW_LINE> <INDENT> quest_sn = datt(ts_quest_seqno, doc='题号') <NEW_LINE> type = datt(str, len=1, doc='标签类型: T标签, C分类') <NEW_LINE> labels = datt(array(int), doc='标签') <NEW_LINE> updated_ts = datt(datetime, doc='更新时间') <NEW_LINE> __dobject_key__ = [quest_sn, type]
题目的标签(Tag)
625990727d43ff2487428088
class BernoulliRV(RandomVariable): <NEW_LINE> <INDENT> def __init__(self, p): <NEW_LINE> <INDENT> self.p_ = p <NEW_LINE> <DEDENT> def sample_success(self): <NEW_LINE> <INDENT> return scipy.stats.bernoulli.rvs(self.p_) <NEW_LINE> <DEDENT> def p(self): <NEW_LINE> <INDENT> return self.p_ <NEW_LINE> <DEDENT> def value(self...
Bernoulli RV class for use with Beta-Bernoulli bandit testing
625990721f5feb6acb1644de
class GeneralDeltaTLineAnalyzer(GeneralLineAnalyzer): <NEW_LINE> <INDENT> def __init__(self, doTimelines=True, doFiles=True, singleFile=False, startTime=None, endTime=None): <NEW_LINE> <INDENT> GeneralLineAnalyzer.__init__(self, titles=["deltaT"], doTimelines=doTimelines, doFiles=doFiles, singleFile=singleFile, startTi...
Parses line for continuity information
62599072aad79263cf4300a1
class GetFormNode(template.Node): <NEW_LINE> <INDENT> def __init__(self, form_class, context_var, request): <NEW_LINE> <INDENT> self.context_var = context_var <NEW_LINE> self.request = template.Variable(request) <NEW_LINE> self.form_class = form_class <NEW_LINE> <DEDENT> def render(self, context): <NEW_LINE> <INDENT> r...
Template node to return a queryset in a specified variable in the context
625990724e4d562566373cf2
class SubmitNewRequest(SubmitNewRequest): <NEW_LINE> <INDENT> tool_name = 'slip' <NEW_LINE> task_model_name = 'SlipTask' <NEW_LINE> celery_task_func = run <NEW_LINE> form_list = [DataSelectionForm, AdditionalOptionsForm]
Submit new request REST API Endpoint Extends the SubmitNewRequest abstract class - required attributes are the tool_name, task_model_name, form_list, and celery_task_func Note: celery_task_func should be callable with .delay() and take a single argument of a TaskModel pk. See the dc_algorithm.views docstrings for...
6259907276e4537e8c3f0e6a
class JuliaConsoleLexer(Lexer): <NEW_LINE> <INDENT> name = 'Julia console' <NEW_LINE> aliases = ['jlcon'] <NEW_LINE> def get_tokens_unprocessed(self, text): <NEW_LINE> <INDENT> jllexer = JuliaLexer(**self.options) <NEW_LINE> curcode = '' <NEW_LINE> insertions = [] <NEW_LINE> for match in line_re.finditer(text): <NEW_LI...
For Julia console sessions. Modeled after MatlabSessionLexer. .. versionadded:: 1.6
6259907267a9b606de547719
class StdOutListener(StreamListener): <NEW_LINE> <INDENT> def on_data(self, data): <NEW_LINE> <INDENT> decoded = json.loads(data) <NEW_LINE> if 'media' not in decoded['entities']: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> string = decoded['entities']['media'][0]['media_url'] <NEW_LIN...
A listener handles tweets that are received from the stream. This is a basic listener that just prints received tweets to stdout.
6259907297e22403b383c7ee
class _ModuleManager(_ManageReload): <NEW_LINE> <INDENT> def __init__(self, name, *, reset_name=True): <NEW_LINE> <INDENT> super().__init__(name) <NEW_LINE> self._reset_name = reset_name <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> super().__enter__() <NEW_LINE> self._module = sys.modules.get(self._name...
Context manager which returns the module to be loaded. Does the proper unloading from sys.modules upon failure.
625990728a43f66fc4bf3a80
class TFGauss2D(Gauss2D): <NEW_LINE> <INDENT> name = 'TF + Gauss2D' <NEW_LINE> parameterNames = ['TF Height', 'Gauss Height', 'X Center', 'Y Center', 'TF X Radius', 'TF Y Radius', 'Gauss X Width', 'Gauss Y Width', 'Offset'] <NEW_LINE> def __init__(self, im=None): <NEW_LINE> <INDENT> super(TFGauss2D, self).__init__(im) ...
Fitter class for a 2D Thomas Fermi profile
625990724c3428357761bba0
class DynamicNetwork: <NEW_LINE> <INDENT> def __init__(self, num_ues, num_aps, scale): <NEW_LINE> <INDENT> self.num_ues = num_ues <NEW_LINE> self.num_aps = num_aps <NEW_LINE> self.scale = scale
Simulation of a cellular network where APs are dynamically positioned in every cell of the grid.
625990725166f23b2e244cbf
class Filez(SurrogatePK, Model): <NEW_LINE> <INDENT> __tablename__ = "files" <NEW_LINE> user_id = reference_col("users", nullable=True) <NEW_LINE> user = relationship("User", cascade="all,delete", backref="fileusers") <NEW_LINE> when_uploaded = Column(db.DateTime(), nullable=False, default=datetime.utcnow) <NEW_LINE> i...
Table with uploaded raw GPX files.
625990725fcc89381b266dcd
class MinimumMaximum(Component): <NEW_LINE> <INDENT> def set_data(self, data): <NEW_LINE> <INDENT> pertinent = read_path_dict(data, self.source) <NEW_LINE> if pertinent: <NEW_LINE> <INDENT> self.minimum = pertinent.get('minimum') <NEW_LINE> self.maximum = pertinent.get('maximum') <NEW_LINE> self.value = pertinent.get('...
Abstract class for component with a current / minimum / maximum data model. Components should be able to read in a data dictionary a structure containing "minimum", "maximum" and "current".
62599072097d151d1a2c295e
class WasbPrefixSensor(BaseSensorOperator): <NEW_LINE> <INDENT> template_fields = ('container_name', 'prefix') <NEW_LINE> @apply_defaults <NEW_LINE> def __init__(self, container_name, prefix, wasb_conn_id='wasb_default', check_options=None, *args, **kwargs): <NEW_LINE> <INDENT> super(WasbPrefixSensor, self).__init__(*a...
Waits for blobs matching a prefix to arrive on Azure Blob Storage. :param container_name: Name of the container. :type container_name: str :param prefix: Prefix of the blob. :type prefix: str :param wasb_conn_id: Reference to the wasb connection. :type wasb_conn_id: str :param check_options: Optional keyword arguments...
625990722ae34c7f260ac9d5
@ddt.ddt <NEW_LINE> class RedeemCodeEmbargoTests(UrlResetMixin, ModuleStoreTestCase): <NEW_LINE> <INDENT> USERNAME = 'bob' <NEW_LINE> PASSWORD = 'test' <NEW_LINE> URLCONF_MODULES = ['embargo'] <NEW_LINE> @patch.dict(settings.FEATURES, {'EMBARGO': True}) <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> super(RedeemCodeEm...
Test blocking redeem code redemption based on country access rules.
62599072ec188e330fdfa190
class ICollectionFilterResultListSort(ICollectionFilterBaseSchema): <NEW_LINE> <INDENT> sort_on = schema.Tuple( title=_("label_sort_on", u"Enabled sort indexes"), description=_("help_sort_on", u"Select the indexes which can be sorted on."), value_type=schema.Choice( title=u"Index", vocabulary="collective.collectionfilt...
Schema for the result list sorting.
62599072283ffb24f3cf5195
class Lwm2mBootstrapServer(HelperBase): <NEW_LINE> <INDENT> def __init__(self, arguments="", timeout=3, encoding="utf8"): <NEW_LINE> <INDENT> base_path = str(Path(__file__).parent.absolute()) <NEW_LINE> self.pexpectobj = pexpect.spawn(base_path + "/../../build-wakaama/examples/" "bootstrap_server/bootstrap_server " + a...
Bootstrap-server subclass of HelperBase
625990723539df3088ecdb82
class Dwarf(Race): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(Dwarf, self).__init__() <NEW_LINE> self.name = "Dwarf" <NEW_LINE> self.plural = "Dwarves" <NEW_LINE> self.size = "small" <NEW_LINE> self.desc = ("|gDwarves|n are short, stocky demi-humans with long, " "respectable beards and heavy stou...
Class representing dwarf attributes.
625990724f6381625f19a11f
class TotalLogFile(logfile.LogFile): <NEW_LINE> <INDENT> def __init__(self, name, directory, steal_stdio=False, **kwargs): <NEW_LINE> <INDENT> self._steal_stdio = steal_stdio <NEW_LINE> self._null_fd = os.open("/dev/null", os.O_RDWR) <NEW_LINE> logfile.LogFile.__init__(self, name, directory, **kwargs) <NEW_LINE> <DEDEN...
A log file that can optionally steal stdio
62599072adb09d7d5dc0be57
class ClientsTestCase( unittest.TestCase ): <NEW_LINE> <INDENT> def setUp( self ): <NEW_LINE> <INDENT> self.mockRSS = mock.MagicMock() <NEW_LINE> self.GOCCli = GOCDBClient() <NEW_LINE> self.GGUSCli = GGUSTicketsClient()
Base class for the clients test cases
625990724e4d562566373cf3
class IpconfigError(CommandError): <NEW_LINE> <INDENT> pass
An exception to raise if the command fails.
625990727d847024c075dcc6
class HTTPAuthResource(object): <NEW_LINE> <INDENT> implements(iweb.IResource) <NEW_LINE> def __init__(self, wrappedResource, credentialFactories, portal, interfaces): <NEW_LINE> <INDENT> self.wrappedResource = wrappedResource <NEW_LINE> self.credentialFactories = dict([(factory.scheme, factory) for factory in credenti...
I wrap a resource to prevent it being accessed unless the authentication can be completed using the credential factory, portal, and interfaces specified.
625990727d43ff2487428089
class QwtProject(PyQtProject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.bindings_factories = [QwtBindings] <NEW_LINE> <DEDENT> def update(self, tool): <NEW_LINE> <INDENT> super().update(tool) <NEW_LINE> self.sip_include_dirs.append(join(PyQt5.__path__[0], 'bindings'...
The Qwt Project class.
6259907255399d3f05627e05
class MySplashScreen(wx.SplashScreen): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> aBitmap = wx.Image(name = "/opt/sidesa/png/1.png").ConvertToBitmap() <NEW_LINE> aBitmap1 = wx.Image(name = "/opt/sidesa/png/1.png").ConvertToBitmap() <NEW_LINE> splashStyle = wx.SPLASH_CENTRE_ON_SCREEN | wx.S...
Create a splash screen widget.
62599072baa26c4b54d50b99
class PatchClampStimPulseAnalyzer(GenericStimPulseAnalyzer): <NEW_LINE> <INDENT> def __init__(self, rec): <NEW_LINE> <INDENT> GenericStimPulseAnalyzer.__init__(self, rec) <NEW_LINE> self._evoked_spikes = None <NEW_LINE> <DEDENT> def pulses(self, channel='command'): <NEW_LINE> <INDENT> if self._pulses.get(channel) is No...
Used for analyzing a patch clamp recording with square-pulse stimuli.
625990723317a56b869bf1bb
class Blockchain(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.chain = DB.child('chain').get().val() <NEW_LINE> if self.chain is None: <NEW_LINE> <INDENT> self.chain = [] <NEW_LINE> self.current_transactions = [] <NEW_LINE> self.new_block(previous_hash=1, proof=100) <NEW_LINE> self.nodes = s...
Constructor
625990725166f23b2e244cc1
class TestSuperUserOr403(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.request_factory = RequestFactory() <NEW_LINE> list_name = 'foolist.example.org' <NEW_LINE> list_id = 'foolist.example.org' <NEW_LINE> self.mock_list = create_mock_list(dict( fqdn_listname=list_name, list_id=list_id)) <NEW_...
Tests superuser_required auth decorator
625990721f037a2d8b9e54e1
class FrontEndTestCase(TestCase): <NEW_LINE> <INDENT> fixtures = ['myblog_test_fixture.json', ] <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> self.now = datetime.datetime.utcnow().replace(tzinfo=utc) <NEW_LINE> self.timedelta = datetime.timedelta(15) <NEW_LINE> author = User.objects.get(pk=1) <NEW_LINE> for count in ...
test views provided in the front-end
6259907299cbb53fe68327d7
class GDetectorElement(object): <NEW_LINE> <INDENT> def __init__(self, description): <NEW_LINE> <INDENT> self.desc = description <NEW_LINE> self.circles = [] <NEW_LINE> self.boxes = [] <NEW_LINE> self.circles.append( TEllipse(0., 0., self.desc.volume.outer.rad, self.desc.volume.outer.rad) ) <NEW_LINE> dz = self.desc.vo...
TODO improve design? there could be one detector element per view, and they would all be linked together.
6259907271ff763f4b5e9096
class ACStatus(object): <NEW_LINE> <INDENT> def __init__(self, ac, data): <NEW_LINE> <INDENT> self.ac = ac <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _str_to_num(s): <NEW_LINE> <INDENT> f = float(s) <NEW_LINE> if f == int(f): <NEW_LINE> <INDENT> return int(f) <NEW_LINE> <DEDENT> else: ...
Higher-level information about an AC device's current status.
625990722ae34c7f260ac9d7
class lineTracker(Tracker): <NEW_LINE> <INDENT> def __init__(self,dotted=False,scolor=None,swidth=None,ontop=False): <NEW_LINE> <INDENT> line = coin.SoLineSet() <NEW_LINE> line.numVertices.setValue(2) <NEW_LINE> self.coords = coin.SoCoordinate3() <NEW_LINE> self.coords.point.setValues(0,2,[[0,0,0],[1,0,0]]) <NEW_LINE> ...
A Line tracker, used by the tools that need to draw temporary lines
625990722c8b7c6e89bd50d5
class NgramFilter(Filter): <NEW_LINE> <INDENT> __inittypes__ = dict(minsize=int, maxsize=int) <NEW_LINE> def __init__(self, minsize, maxsize=None, at=None): <NEW_LINE> <INDENT> self.min = minsize <NEW_LINE> self.max = maxsize or minsize <NEW_LINE> self.at = 0 <NEW_LINE> if at == "start": <NEW_LINE> <INDENT> self.at = -...
Splits token text into N-grams. >>> rext = RegexTokenizer() >>> stream = rext("hello there") >>> ngf = NgramFilter(4) >>> [token.text for token in ngf(stream)] ["hell", "ello", "ther", "here"]
62599072a8370b77170f1cb8
class ProductionConfig(BaseConfig): <NEW_LINE> <INDENT> SECRET_KEY = 'prod'
Production configuration
625990728e7ae83300eea97e
class UnionAll(BinaryOperator): <NEW_LINE> <INDENT> def __init__(self, left=None, right=None): <NEW_LINE> <INDENT> BinaryOperator.__init__(self, left, right) <NEW_LINE> <DEDENT> def num_tuples(self): <NEW_LINE> <INDENT> return self.left.num_tuples() + self.right.num_tuples() <NEW_LINE> <DEDENT> def copy(self, other): <...
Bag union.
62599072aad79263cf4300a4
class CallStaticMethod: <NEW_LINE> <INDENT> def __init__(self, classname: str, method: str, api: CLRApi = None): <NEW_LINE> <INDENT> self.classname = classname <NEW_LINE> self.method = method <NEW_LINE> self.api = api if api is not None else CLRApi.get() <NEW_LINE> <DEDENT> def __call__(self, *args): <NEW_LINE> <INDENT...
Static Method Call Stub
6259907232920d7e50bc7935
@Callback.register("gradient-debug") <NEW_LINE> class GradDebug(Callback): <NEW_LINE> <INDENT> def __init__(self, stop_at: Optional[List[int]] = None): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> if stop_at is not None: <NEW_LINE> <INDENT> self.stop_at = stop_at <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self....
Sets `torch.autograd.set_detect_anomaly` to true at the start of training
6259907244b2445a339b75d5
class Config: <NEW_LINE> <INDENT> SQLALCHEMY_TRACK_MODIFICATIONS = False <NEW_LINE> SECRET_KEY = os.environ.get("SECRET_KEY") <NEW_LINE> UPLOADED_PHOTOS_DEST = 'app/static/photos' <NEW_LINE> AIL_SERVER = 'smtp.googlemail.com' <NEW_LINE> MAIL_PORT = 587 <NEW_LINE> MAIL_USE_TLS = False <NEW_LINE> MAIL_USE_SSL = True <NEW...
Main configurations class
62599072a17c0f6771d5d822