code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class SessionCog: <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> self.session = aiohttp.ClientSession() <NEW_LINE> <DEDENT> def __unload(self): <NEW_LINE> <INDENT> self.bot.loop.create_task(self.session.close())
Simple class to take care of using a aiohttp session in a cog.
62598ee0379a373c97d975d0
class Animal(object): <NEW_LINE> <INDENT> pass
定义一个动物类
62598ee02ae34c7f260a96be
class PixelwiseClassifier(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_features, n_classes): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.conv = torch.nn.Conv2d( in_channels=n_features, out_channels=n_classes, kernel_size=1, bias=True ) <NEW_LINE> self.act = torch.nn.Sigmoid() <NEW_LINE> <DEDENT...
Basic segmentation model.
62598ee067a9b606de5445a4
class Candidate(DB.Model): <NEW_LINE> <INDENT> __tablename__ = 'candidates' <NEW_LINE> id = DB.Column(DB.Integer(), primary_key=True) <NEW_LINE> first_name = DB.Column(DB.String()) <NEW_LINE> last_name = DB.Column(DB.String()) <NEW_LINE> first_working_day = DB.Column(DB.Date()) <NEW_LINE> __table_args__ = (DB.UniqueCon...
Candidate for vacancy model
62598ee044b2445a339b5c51
class NaayaContentTestCase(NaayaTestCase.NaayaTestCase): <NEW_LINE> <INDENT> def afterSetUp(self): <NEW_LINE> <INDENT> self.doc_name_en = 'mycontent_en' <NEW_LINE> self.doc_name_fr = "mycontent_fr" <NEW_LINE> self.doc_meta_type = NaayaContent.meta_type <NEW_LINE> self.login() <NEW_LINE> <DEDENT> def beforeTearDown(self...
TestCase for NaayaContent object
62598ee066656f66f7d589b7
class ImageSignature(Resource): <NEW_LINE> <INDENT> def get(self, image_file): <NEW_LINE> <INDENT> catalog = ImageCatalog() <NEW_LINE> image = catalog.get_image(image_file) <NEW_LINE> if image is not None: <NEW_LINE> <INDENT> return {"signature": image.signature} <NEW_LINE> <DEDENT> abort(404)
Class to get signatures for a single image.
62598ee07047854f4633d9b7
class UtilityModule(Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> logger.info("Utility module")
Parent class for all the utility modules. This class should not be used explicitly in the code. Use it as a base class for any derived utility module classes.
62598ee099cbb53fe682f488
class HiddenLayer(object): <NEW_LINE> <INDENT> def __init__(self, rng, n_in, n_out, activation, W=None, b=None): <NEW_LINE> <INDENT> self.rng = rng <NEW_LINE> self.activation = activation <NEW_LINE> self.init_param(W, b, n_in, n_out) <NEW_LINE> <DEDENT> def init_param(self, W, b, n_in, n_out): <NEW_LINE> <INDENT> if W...
Class for HiddenLayer
62598ee067a9b606de5445a5
class AccountCashRounding(models.Model): <NEW_LINE> <INDENT> _name = 'account.cash.rounding' <NEW_LINE> _description = 'Account Cash Rounding' <NEW_LINE> name = fields.Char(string='Name', translate=True, required=True) <NEW_LINE> rounding = fields.Float(string='Rounding Precision', required=True, help='Represent the no...
In some countries, we need to be able to make appear on an invoice a rounding line, appearing there only because the smallest coinage has been removed from the circulation. For example, in Switzerland invoices have to be rounded to 0.05 CHF because coins of 0.01 CHF and 0.02 CHF aren't used anymore. see https://en.wiki...
62598ee05166f23b2e2419ac
class SAD(Model): <NEW_LINE> <INDENT> def __init__(self, n): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.n = n <NEW_LINE> self.counts = {} <NEW_LINE> self.sum_counts = 0 <NEW_LINE> <DEDENT> def update(self, symbol, history=None, weight=1.0): <NEW_LINE> <INDENT> rv = self.log_predict(symbol, history) <NEW_LIN...
Sparse Adaptive Dirichlet Process From M. Hutter, "Sparse Adaptive Dirichlet-Multinomial-like Processes" in JMLR 30:1-28 (2013). n : size of alphabet
62598ee0851cf427c66b68a8
class GPGError(Exception): <NEW_LINE> <INDENT> pass
Generic GPG errors
62598ee06aa9bd52df0d3486
class GenericError(Exception): <NEW_LINE> <INDENT> def __init__(self, msg): <NEW_LINE> <INDENT> super(GenericError, self).__init__(msg) <NEW_LINE> self.msg = msg <NEW_LINE> <DEDENT> def log_except_and_exit(self, worker): <NEW_LINE> <INDENT> log_and_exit("Validation worker failed: {}" .format(self.msg), worker, SIMAPP_E...
'This exception is a generic error
62598ee08a43f66fc4bf0749
class FederationExtension(test_sql_upgrade.SqlMigrateBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(FederationExtension, self).setUp() <NEW_LINE> self.identity_provider = 'identity_provider' <NEW_LINE> self.federation_protocol = 'federation_protocol' <NEW_LINE> self.mapping = 'mapping' <NEW_LINE>...
Test class for ensuring the Federation SQL.
62598ee0f7d966606f7465c7
class ContinuousBoW(chainer.Chain): <NEW_LINE> <INDENT> def __init__(self, n_vocab, n_units, loss_func, ori_con_data): <NEW_LINE> <INDENT> super(ContinuousBoW, self).__init__() <NEW_LINE> with self.init_scope(): <NEW_LINE> <INDENT> print('make first embed') <NEW_LINE> self.embed = L.EmbedID(n_vocab, n_units, initialW=I...
Definition of Continuous Bag of Words Model
62598ee016aa5153ce3fead3
class ASCIIDocExporter(TemplateExporter): <NEW_LINE> <INDENT> @default('file_extension') <NEW_LINE> def _file_extension_default(self): <NEW_LINE> <INDENT> return '.asciidoc' <NEW_LINE> <DEDENT> @default('template_file') <NEW_LINE> def _template_file_default(self): <NEW_LINE> <INDENT> return 'asciidoc' <NEW_LINE> <DEDEN...
Exports to an ASCIIDoc document (.asciidoc)
62598ee01f037a2d8b9e26dd
class TestNGSMixin(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.path = join(settings.TEST_DIRECTORY, "PT000") <NEW_LINE> self.ngs = "Ngs.2_5_2" <NEW_LINE> self.ngs_mutect = "Ngs.2_5_2.mutectOnly" <NEW_LINE> self.manual = "ManualSpecial.2013_08_21" <NEW_LINE> class NGSParser(NGSMixin, Project...
Test the get status functions from the NGS pipeline.
62598ee091af0d3eaad383ef
class AuthTokenSerializer(serializers.Serializer): <NEW_LINE> <INDENT> email = serializers.CharField() <NEW_LINE> password = serializers.CharField( style={'input_type': 'password'}, trim_whitespace=False ) <NEW_LINE> def validate(self, attrs): <NEW_LINE> <INDENT> email = attrs.get('email') <NEW_LINE> password = attrs.g...
Serializer for the user authentication object
62598ee0442bda511e95aa3f
class SocksProtocolHandler(BaseTcpServerHandler[SocksClientConnection]): <NEW_LINE> <INDENT> def __init__(self, *args: Any, **kwargs: Any) -> None: <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def create(*args: Any) -> SocksClientConnection: <NEW_LINE> <INDENT> retu...
Reference https://www.openssh.com/txt/socks4.protocol
62598ee056ac1b37e63007c3
@attr.dataclass <NEW_LINE> class ActionFailure(ActionOutcome): <NEW_LINE> <INDENT> return_code: int = attr.ib(default=1) <NEW_LINE> @return_code.validator <NEW_LINE> def _validate_return_code( self, attribute, value, ): <NEW_LINE> <INDENT> if value in NON_FAIL_MODELS: <NEW_LINE> <INDENT> raise ValueError( f'Return code...
GitHub Action failed outcome.
62598ee001c39578d7f1137f
class Solution: <NEW_LINE> <INDENT> def leftRotate(self, n, d): <NEW_LINE> <INDENT> return 0
@param n: a number @param d: digit needed to be rorated @return: a number
62598ee0ac7a0e7691f70aeb
class TimeXVariable(XAxis, TimeVariable): <NEW_LINE> <INDENT> pass
Time Variable on X Axis
62598ee06e29344779afec05
class WorkDir(object): <NEW_LINE> <INDENT> def __init__(self, workspace, name=None, prefix=None): <NEW_LINE> <INDENT> assert name is None or prefix is None <NEW_LINE> if name is None: <NEW_LINE> <INDENT> self.dir_path = tempfile.mkdtemp(prefix=prefix, dir=workspace.base_dir) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT...
A temporary work directory inside a WorkSpace.
62598ee03539df3088eca889
class NewNode: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.right = self.left = None <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'data={self.data} left={self.left} right={self.right}'
A Node containing data , left and right pointers
62598ee0596a897236126238
class VendorPassthru(base.VendorInterface): <NEW_LINE> <INDENT> def _get_deploy_info(self, node, **kwargs): <NEW_LINE> <INDENT> d_info = _parse_driver_info(node) <NEW_LINE> params = {'address': kwargs.get('address'), 'port': kwargs.get('port', '3260'), 'iqn': kwargs.get('iqn'), 'lun': kwargs.get('lun', '1'), 'image_pat...
Interface to mix IPMI and PXE vendor-specific interfaces.
62598ee02eb69b55b15a0675
class CustomException(Exception): <NEW_LINE> <INDENT> pass
自定义异常
62598ee055399d3f05624b08
class Error(Exception): <NEW_LINE> <INDENT> pass
Base class for all errors in the app. We inherit from schematics errors as an easy way to provide feedback by passing in a dict of messages.
62598ee032920d7e50bc4605
class WebStore(Store): <NEW_LINE> <INDENT> def source(self, lid): <NEW_LINE> <INDENT> return UrlSource(lid)
Local ID's are WWW URLs
62598ee07d847024c075a9a6
class LookupRelatedField(serializers.SlugRelatedField): <NEW_LINE> <INDENT> def __init__(self, router, model, **kwargs): <NEW_LINE> <INDENT> self.router = router <NEW_LINE> self.model = model <NEW_LINE> super().__init__(**kwargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def slug_field(self): <NEW_LINE> <INDENT> if not ...
wq/db/rest/serializers
62598ee0090684286d5929cb
class MArgParser(object): <NEW_LINE> <INDENT> def __init__(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def commandArgumentBool(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def commandArgumentDouble(*args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def commandArgumentFlo...
Command argument list parser.
62598ee0f548e778e5969b6d
class CalledMultiFidelOnSingleFidelCaller(Exception): <NEW_LINE> <INDENT> def __init__(self, exp_caller): <NEW_LINE> <INDENT> err_msg = ('ExperimentCaller %s is not a multi-fidelity caller. ' + 'Please use eval_single or eval_multiple.')%(str(exp_caller)) <NEW_LINE> super(CalledMultiFidelOnSingleFidelCall...
An exception to handle calling multi-fidelity experiments on single-fidelity callers.
62598ee0379a373c97d975d3
class Lyrics(APIView): <NEW_LINE> <INDENT> def get(self, request, language, ver, slug, format=None): <NEW_LINE> <INDENT> print(language, type(language)) <NEW_LINE> print(ver, type(ver)) <NEW_LINE> print(slug, type(slug)) <NEW_LINE> keyword_input = slug <NEW_LINE> if language == 'kor' and ver == '02': <NEW_LINE> <INDENT...
generate lyrics
62598ee09c8ee8231303f444
class BaseGeometry: <NEW_LINE> <INDENT> def area(self): <NEW_LINE> <INDENT> raise Exception("area() is not implemented") <NEW_LINE> <DEDENT> def integer_validator(self, name, value): <NEW_LINE> <INDENT> if type(value) != int: <NEW_LINE> <INDENT> raise TypeError(name + " must be an integer") <NEW_LINE> <DEDENT> if value...
A class BaseGeometry.
62598ee085dfad0860cbed55
class ExpressionRuleViolation(RuleViolation): <NEW_LINE> <INDENT> def __init__(self, rule, expression): <NEW_LINE> <INDENT> super(ExpressionRuleViolation, self).__init__(rule) <NEW_LINE> self.expression = expression <NEW_LINE> self.start_line = 0 <NEW_LINE> self.start_column = 0 <NEW_LINE> self.end_line = 0 <NEW_LINE> ...
A class representing a particular rule violation for expressions which contain more specific details of the location of the violation for reporting purposes.
62598ee066656f66f7d589b9
class Algorithm(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=20) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_table = 'algorithms' <NEW_LINE> ordering = ('name',) <NEW_LINE> <DEDENT> def __unicode__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> def list_repr(self): <NEW_LINE>...
A hashing algorithm.
62598ee07047854f4633d9b9
class MonteCarloSensitivity(ModelFreeMonteCarloSensitivity): <NEW_LINE> <INDENT> def __init__(self, model: IModel, input_domain: ParameterSpace)-> None: <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.model_objective = lambda x: self.model.predict(x)[0] <NEW_LINE> super().__init__(self.model_objective, input_dom...
Class to compute the sensitivity coefficients of given model. This class wraps the model and calls the mean predictions that are used to compute the sensitivity inputs using Monte Carlo.
62598ee0e5267d203ee69edc
class _Translator: <NEW_LINE> <INDENT> translators: dict = {} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.load_models() <NEW_LINE> self.en2de = self.translators["en2de"].translate <NEW_LINE> self.de2en = self.translators["de2en"].translate <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def load_models(cls, for...
Wrapper around fairseq language models (arXiv:1904.01038_). On first initialization, the instance loads language models and stores them as attributes on the class. New instances after this do not reload them. Currently implements translation from English to German, and the reverse. Attributes ---------- en2de: callab...
62598ee08e71fb1e983ba049
class TestFunctions(unittest.TestCase): <NEW_LINE> <INDENT> def test_set_weekly_range(self): <NEW_LINE> <INDENT> test = 647740794 <NEW_LINE> thead = '2018_187_193' <NEW_LINE> [start, stop, pref] = set_weekly_range(test) <NEW_LINE> print("Weekly setting: " + str(start) +'<-->' + str(stop) + '<--->' + pref) <NEW_LIN...
testing functions
62598ee0d486a94d0ba2a5af
class BooleanaOsteoClass(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "object.booleana_osteo" <NEW_LINE> bl_label = "Importa fatias de tomografia DICOM" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> BooleanaOsteoDef(self, context) <NEW_LINE> return {'FINISHED'}
Tooltip
62598ee0d7e4931a7ef3a675
class FilterPageHandler(tornado.web.RequestHandler): <NEW_LINE> <INDENT> @tornado.gen.coroutine <NEW_LINE> def post(self, path): <NEW_LINE> <INDENT> new_tag = self.request.arguments['filter'][0] <NEW_LINE> subs = insta_api.list_subscriptions() <NEW_LINE> if len(subs['data']) >= 25: <NEW_LINE> <INDENT> insta_api.delete_...
TO DO
62598ee02c8b7c6e89bd1d98
class ProfileHandler(RestHandler): <NEW_LINE> <INDENT> @route(method='GET', module="test") <NEW_LINE> def get_test(self): <NEW_LINE> <INDENT> self.send_result(E_SUCC)
账户类API处理器
62598ee03617ad0b5ee04707
class GHMCIntegrator(LangevinIntegrator): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> kwargs['splitting'] = "O { V R V } O" <NEW_LINE> super(GHMCIntegrator, self).__init__(*args, **kwargs)
Create a generalized hybrid Monte Carlo (GHMC) integrator.
62598ee063d6d428bbee0dab
class SurgeoCommonEntry(object): <NEW_LINE> <INDENT> def main(self): <NEW_LINE> <INDENT> arg_count = len(sys.argv) <NEW_LINE> if arg_count == 1: <NEW_LINE> <INDENT> gui = SurgeoGUI() <NEW_LINE> gui.main() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> cli = SurgeoCLI() <NEW_LINE> cli.main()
An entry point for both the GUI and CLI Surgeo applications This class simply gets the number of args sent to the entry point. If there is a single argument, the GUI is run. If addtional arguments are supplied, the CLI is run. The CLI will then parse the arguments as nothing it is not necessary to pass the arguments f...
62598ee056b00c62f0fb0ea9
class MyClass: <NEW_LINE> <INDENT> i = 12345 <NEW_LINE> def f(self): <NEW_LINE> <INDENT> return 'hello world {}'.format(self.i)
A simple example class
62598ee04428ac0f6e656b2b
class PageTitleTester (object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def test (self, title): <NEW_LINE> <INDENT> self._testCommonErrors (title) <NEW_LINE> self._testForError (title) <NEW_LINE> self._testCommonWarnings (title) <NEW_LINE> self._testForWarning (title) <NEW_LINE> <DEDENT> @staticmethod <N...
Класс для проверки правильности заголовка страницы
62598ee021a7993f00c64545
class Business(Base): <NEW_LINE> <INDENT> __tablename__ = 'businesses' <NEW_LINE> business_id = Column(String(100), primary_key=True) <NEW_LINE> name = Column( String(100)) <NEW_LINE> neighborhoods = Column(ARRAY(String)) <NEW_LINE> categories = Column(ARRAY(String)) <NEW_LINE> address = Column(String(100)) <NEW_LINE>...
Sqlalchemy businesses model
62598ee099cbb53fe682f48b
class PageNode(Node): <NEW_LINE> <INDENT> def __init__(self, language, slug, asvar): <NEW_LINE> <INDENT> self.language = language <NEW_LINE> self.slug = slug <NEW_LINE> self.asvar = asvar <NEW_LINE> <DEDENT> def render(self, context): <NEW_LINE> <INDENT> language = self.language.resolve(context) <NEW_LINE> slug = self....
Get a single page
62598ee0b7558d5895461c25
class InGroups(object): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> self.groups = set(args) <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> return self.groups <= current_user.in_groups()
Check if current user belongs to provided groups.
62598ee04f6381625f1987a9
class BaseClient(object): <NEW_LINE> <INDENT> api_url = 'https://blockchain.info/' <NEW_LINE> exception_on_error = True <NEW_LINE> def __init__(self, proxydict=None, *args, **kwargs): <NEW_LINE> <INDENT> self.proxydict = proxydict <NEW_LINE> <DEDENT> def _get(self, *args, **kwargs): <NEW_LINE> <INDENT> return self._req...
A base class for the API Client methods that handles interaction with the requests library.
62598ee03539df3088eca88b
class Service(SimpyMixin, object): <NEW_LINE> <INDENT> def __init__(self, name=None, *args, **kwargs): <NEW_LINE> <INDENT> super(Service, self).__init__(*args, **kwargs) <NEW_LINE> self.name = 'Service' if name is None else name
A software service. :param name: name of the service :type name: str
62598ee03c8af77a43b6721f
class Receiver_Thread(Thread): <NEW_LINE> <INDENT> def __init__(self,display_received=Queue(0),received=Queue(0),rcv_socket=socket,lock=Lock()): <NEW_LINE> <INDENT> self.switch="True" <NEW_LINE> self.received=received <NEW_LINE> self.rcv_socket=rcv_socket <NEW_LINE> self.lock=lock <NEW_LINE> self.display_received=displ...
classdocs
62598ee007f4c71912bada30
class ProgressInterface(AdvancedInterface): <NEW_LINE> <INDENT> def get_num_iterations(self): <NEW_LINE> <INDENT> if self._cplex._is_MIP(): <NEW_LINE> <INDENT> return CPX_PROC.getmipitcnt(self._env._e, self._cplex._lp) <NEW_LINE> <DEDENT> siftcnt = CPX_PROC.getsiftitcnt(self._env._e, self._cplex._lp) <NEW_LINE> if sift...
Methods to query the progress of optimization.
62598ee060cbc95b06362915
class OutFile(object): <NEW_LINE> <INDENT> def __init__(self, connection): <NEW_LINE> <INDENT> self._connection = connection <NEW_LINE> <DEDENT> def write(self, value): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self._connection.send('%X\r\n' % len(value)) <NEW_LINE> self._connection.send(value) <NEW_LINE> logging.de...
Chunked HTTP encoding for response output.
62598ee092d797404e387e68
class DataImage(Image): <NEW_LINE> <INDENT> def __init__(self, data, trim=False, pad=False): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> self.blocksize = 4096 <NEW_LINE> assert not (trim and pad) <NEW_LINE> partial = len(self.data) % self.blocksize <NEW_LINE> if partial > 0: <NEW_LINE> <INDENT> if trim: <NEW_LINE> ...
An image wrapped around a single string of data.
62598ee0b7558d5895461c26
class RelatedToTest(LimpydBaseTest): <NEW_LINE> <INDENT> def test_to_as_model_should_be_converted(self): <NEW_LINE> <INDENT> class Foo(TestRedisModel): <NEW_LINE> <INDENT> namespace = 'related-to-model' <NEW_LINE> <DEDENT> class Bar(TestRedisModel): <NEW_LINE> <INDENT> namespace = 'related-to-model' <NEW_LINE> foo = FK...
Test the "to" attribute of related fields
62598ee0498bea3a75a56111
class HentaihereChapterExtractor(ChapterExtractor): <NEW_LINE> <INDENT> category = "hentaihere" <NEW_LINE> archive_fmt = "{chapter_id}_{page}" <NEW_LINE> pattern = [r"(?:https?://)?(?:www\.)?hentaihere\.com/m/S(\d+)/(\d+)"] <NEW_LINE> test = [("https://hentaihere.com/m/S13812/1/1/", { "url": "964b942cf492b3a129d2fe2608...
Extractor for a single manga chapter from hentaihere.com
62598ee02c8b7c6e89bd1d99
class SearchProblem: <NEW_LINE> <INDENT> def getStartState(self): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def isGoalState(self, state): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def getSuccessors(self, state): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def...
This class outlines the structure of a search problem, but doesn't implement any of the methods (in object-oriented terminology: an abstract class). You do not need to change anything in this class, ever.
62598ee097e22403b38394c9
class CustomerController(Controller): <NEW_LINE> <INDENT> def send(self, event, **kwargs): <NEW_LINE> <INDENT> if 'name' not in kwargs: <NEW_LINE> <INDENT> raise ValueError('Name and/or data missing.') <NEW_LINE> <DEDENT> ops = { 'create': self._create_user, 'edit': self._edit_user, 'read': self._read_user, 'delete': s...
MVC Style
62598ee0cad5886f8bdc38da
class UserAuthenticator(UserLoggedInAuthenticator): <NEW_LINE> <INDENT> username_fieldname = 'username' <NEW_LINE> password_fieldname = 'password' <NEW_LINE> def authenticate(self, request=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> username = request.REQUEST.get(self.username_fieldname) <NEW_LINE> password = r...
Authorization by login and password.
62598ee066656f66f7d589bb
class TerminalAdapter(OutputAdapter): <NEW_LINE> <INDENT> def process_response(self, statement, session_id=None): <NEW_LINE> <INDENT> speak.Speak(statement) <NEW_LINE> print(statement.text) <NEW_LINE> return statement.text
A simple adapter that allows mitoo to communicate through the terminal.
62598ee07b25080760ed5a75
class CommentsSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> user = AuthorSerializer(label='作者序列化器', read_only=True) <NEW_LINE> subs = SubsSerializer(label='评论的评论', many=True, read_only=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Comment <NEW_LINE> fields = '__all__'
文章评论序列化器
62598ee0a17c0f6771d5a82f
class ListLayerVersionsResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.LayerVersions = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("LayerVersions") is not None: <NEW_LINE> <INDENT> self.LayerVersion...
ListLayerVersions返回参数结构体
62598ee067a9b606de5445a9
class ErrorCalculationMethod(enum.Enum): <NEW_LINE> <INDENT> View1 = 0 <NEW_LINE> RawData = 1 <NEW_LINE> AllViews = 2
Method to determine the error of a theory calculation. Options are: - View1: Use current view number 1 in the application. - RawData: Use the data table as defined by the application. - AllViews: Use all active views.
62598ee0d486a94d0ba2a5b1
class LinkQuestion(QuestionTemplate): <NEW_LINE> <INDENT> regex = (Lemmas("what be") + Lemma("the") + (Lemma("link") | Lemma("website")) + Pos("IN") + Thing() + Question(Pos("."))) <NEW_LINE> def interpret(self, match): <NEW_LINE> <INDENT> Link = ExternalLinkOf(match.thing) <NEW_LINE> return Link, "enum"
Regex for questions about the website for a thing Ex: "what is the link of Jumeirah Beach Hotel?" "What is the website of InterContinental Hong Kong?" "what is the link of York University?" "what is the website of University of Toronto?" "what is the website of 21 Club?" "what is the link of The Ivy...
62598ee02c8b7c6e89bd1d9a
class TestPaymentModuleListResponse1(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 testPaymentModuleListResponse1(self): <NEW_LINE> <INDENT> model = kinow_client.models.payment_module_list_respon...
PaymentModuleListResponse1 unit test stubs
62598ee03617ad0b5ee04709
class itkNaryAddImageFilterIUC3IUC3(itkNaryAddImageFilterIUC3IUC3_Superclass): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") <NEW_LINE> __repr__ = ...
Proxy of C++ itkNaryAddImageFilterIUC3IUC3 class
62598ee0009cb60464cffb29
class AutoEncoder(NeuralNet): <NEW_LINE> <INDENT> def __init__(self, layer_sizes, active_funcs, through=False): <NEW_LINE> <INDENT> n_layers = len(active_funcs) <NEW_LINE> assert n_layers == len(layer_sizes) - 1 <NEW_LINE> self._blocks, self._params = [], [] <NEW_LINE> self._through = through <NEW_LINE> for i in xrange...
Class for auto-encoder The auto-encoder has symmetric structure. Each layer is fully connected.
62598ee063d6d428bbee0dad
class CIFAR10Policy(object): <NEW_LINE> <INDENT> def __init__(self, fillcolor=(128, 128, 128)): <NEW_LINE> <INDENT> self.policies = [ SubPolicy(0.1, "invert", 7, 0.2, "contrast", 6, fillcolor), SubPolicy(0.7, "rotate", 2, 0.3, "translateX", 9, fillcolor), SubPolicy(0.8, "sharpness", 1, 0.9, "sharpness", 3, fillcolor), ...
Randomly choose one of the best 25 Sub-policies on CIFAR10. Example: policy = CIFAR10Policy() transformed = policy(image) Example as a PyTorch Transform: transform = transforms.Compose([ transforms.Resize(256), CIFAR10Policy(), transforms.ToTensor()])
62598ee038b623060ffa766f
class RadiusOfGyration(CollectiveVariable): <NEW_LINE> <INDENT> @property <NEW_LINE> def function(self): <NEW_LINE> <INDENT> return radius_of_gyration
Collective Variable that calculates the unweighted radius of gyration as CV. Parameters ---------- indices: list[int], list[tuple(int)] Must be a list or tuple of atoms (ints or ranges) or groups of atoms. A group is specified as a nested list or tuple of atoms. group_length: int, optional Specify if a fix...
62598ee0ac7a0e7691f70aef
class FdsDdUploadHistory(models.Model): <NEW_LINE> <INDENT> _name = 'fds.dd.upload.history' <NEW_LINE> fds_account_id = fields.Many2one( comodel_name='fds.postfinance.account', string='FDS account', ondelete='restrict', readonly=True, ) <NEW_LINE> payment_order_id = fields.Many2one( comodel_name='account.payment.order'...
History of direct debit uploads to FDS
62598ee030bbd72246468214
class brocade_license(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self._callback = kwargs.pop('callback') <NEW_LINE> <DEDENT> def dpod_port_id_port_id(self, **kwargs): <NEW_LINE> <INDENT> config = ET.Element("config") <NEW_LINE> dpod = ET.SubElement(config, "dpod", xmlns="urn:brocade....
Auto generated class.
62598ee016aa5153ce3fead7
class Solution: <NEW_LINE> <INDENT> def solveNQueens(self, n): <NEW_LINE> <INDENT> if n == 0: <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> if n == 1: <NEW_LINE> <INDENT> return [["Q"]] <NEW_LINE> <DEDENT> results = [] <NEW_LINE> col = [] <NEW_LINE> visited = [0] * n <NEW_LINE> self.permuation(n, results, col, visi...
@param: n: The number of queens @return: All distinct solutions
62598ee0a8370b77170ee9c0
class Component(CommonClient): <NEW_LINE> <INDENT> def __init__(self,server,port=5347,typ=None,debug=['always', 'nodebuilder'],domains=None,component=0): <NEW_LINE> <INDENT> CommonClient.__init__(self,server,port=port,debug=debug) <NEW_LINE> self.typ=typ <NEW_LINE> self.component=component <NEW_LINE> if domains: <NEW_L...
Component class. The only difference from CommonClient is ability to perform component authentication.
62598ee091af0d3eaad383f3
class LassoSelector(BaseEstimator): <NEW_LINE> <INDENT> def __init__(self, lasso_coefs, feature_col, coef_col, n_features=64): <NEW_LINE> <INDENT> self.n_features = n_features <NEW_LINE> self.feature_col = feature_col <NEW_LINE> self.lasso_coefs = lasso_coefs <NEW_LINE> self.coef_col = coef_col <NEW_LINE> <DEDENT> def ...
This class is made to be used after cat2vec.lasso_gridsearch since it selects the features from a dataframe that have the most weighted coefficients (according to a L1-penalized linear model) It inherits from sklearn.base.BaseEstimator to allow gridsearching the best `n_features` using a pipeline and a basline classif...
62598ee001c39578d7f11383
class MenuItem(pygame.font.Font): <NEW_LINE> <INDENT> def __init__(self, text, font=None, font_size=60, font_color=WHITE, pos_x=0, pos_y=0): <NEW_LINE> <INDENT> pygame.font.Font.__init__(self, font, font_size) <NEW_LINE> self.text = text <NEW_LINE> self.font_size = font_size <NEW_LINE> self.font_color = font_color <NEW...
Classe des items du menu
62598ee0cc0a2c11144795dd
class PublishedExtension(Model): <NEW_LINE> <INDENT> _attribute_map = { 'categories': {'key': 'categories', 'type': '[str]'}, 'deployment_type': {'key': 'deploymentType', 'type': 'object'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'extension_id': {'key': 'extensionId', 'type': 'str'}, 'extension_name': {'...
PublishedExtension. :param categories: :type categories: list of str :param deployment_type: :type deployment_type: object :param display_name: :type display_name: str :param extension_id: :type extension_id: str :param extension_name: :type extension_name: str :param flags: :type flags: object :param installation_tar...
62598ee0eab8aa0e5d30a353
class List(object): <NEW_LINE> <INDENT> def __init__(self, auth): <NEW_LINE> <INDENT> self.auth = auth <NEW_LINE> self.go = None <NEW_LINE> self.action = None <NEW_LINE> <DEDENT> def start(self): <NEW_LINE> <INDENT> def _check_list(list_object): <NEW_LINE> <INDENT> if list_object: <NEW_LINE> <INDENT> return list_object...
Setup and run the list Method.
62598ee023849d37ff84f696
class OptionError(Exception): <NEW_LINE> <INDENT> def __init__(self, invalid_keyword, allowed_keywords, group_name=None, path=None): <NEW_LINE> <INDENT> super().__init__(self.message(invalid_keyword, allowed_keywords, group_name, path)) <NEW_LINE> self.invalid_keyword = invalid_keyword <NEW_LINE> self.allowed_keywords ...
Custom exception raised when there is an attempt to apply invalid options. Stores the necessary information to construct a more readable message for the user if caught and processed appropriately.
62598ee0097d151d1a2bf5fa
class PlayerDBManager(TypedObjectManager, UserManager): <NEW_LINE> <INDENT> def num_total_players(self): <NEW_LINE> <INDENT> return self.count() <NEW_LINE> <DEDENT> @returns_typeclass_list <NEW_LINE> def get_connected_players(self): <NEW_LINE> <INDENT> return self.filter(db_is_connected=True) <NEW_LINE> <DEDENT> @retur...
This PlayerManager implements methods for searching and manipulating Players directly from the database. Evennia-specific search methods (will return Characters if possible or a Typeclass/list of Typeclassed objects, whereas Django-general methods will return Querysets or database objects): dbref (converter) dbref_se...
62598ee0498bea3a75a56113
class Float(Numeric): <NEW_LINE> <INDENT> def __init__(self, limit=0, gte=True): <NEW_LINE> <INDENT> super().__init__(float, "float", limit, gte)
限定大小的float值
62598ee0925a0f43d25e6609
class RelationSelect2Widget(Select2Widget, RelationMultiSelectMixin): <NEW_LINE> <INDENT> def __init__( self, model, id_field='id', label_field='label', default_value=None, order_by=None, **kw): <NEW_LINE> <INDENT> RelationMultiSelectMixin.__init__( self, model, id_field, label_field, default_value, order_by) <NEW_LINE...
Extension of the widget ````deform.widget.Select2Widget`` which loads the values from the database using a SQLAlchemy model. Example usage .. code-block:: python districtId = Column(Integer, ForeignKey('district.id'), info={ 'colanderalchemy': { 'title': 'District', 'widget': defo...
62598ee076e4537e8c3edb93
class ContinuousValidationEvent(proto.Message): <NEW_LINE> <INDENT> class ContinuousValidationPodEvent(proto.Message): <NEW_LINE> <INDENT> class PolicyConformanceVerdict(proto.Enum): <NEW_LINE> <INDENT> POLICY_CONFORMANCE_VERDICT_UNSPECIFIED = 0 <NEW_LINE> VIOLATES_POLICY = 1 <NEW_LINE> <DEDENT> class ImageDetails(prot...
Represents an auditing event from Continuous Validation. This message has `oneof`_ fields (mutually exclusive fields). For each oneof, at most one member field can be set at the same time. Setting any member of the oneof automatically clears all other members. .. _oneof: https://proto-plus-python.readthedocs.io/en/st...
62598ee0379a373c97d975d6
class Meta(Agent): <NEW_LINE> <INDENT> def __init__(self, agent, state=None): <NEW_LINE> <INDENT> self.state = Message("the initial state of an agent") if state is None else state <NEW_LINE> self.agent = agent <NEW_LINE> <DEDENT> def act(self, obs): <NEW_LINE> <INDENT> obsm = encode_str(obs) <NEW_LINE> agent = self.age...
Meta transforms an agent that operates on messages into an agent that operates on text, by using messages to implement an algorithm operating on text. The total bandwidth of Meta() is generally unlimited.
62598ee0460517430c430a65
class Disk(Subsystem, kind="Disk"): <NEW_LINE> <INDENT> @property <NEW_LINE> def current_directory(self): <NEW_LINE> <INDENT> return self._visa.query("CWD?") <NEW_LINE> <DEDENT> def change_directory(self, directory): <NEW_LINE> <INDENT> self._visa.write("*ESE 1") <NEW_LINE> original_timeout = self._visa.timeout <NEW_LI...
Disk subsystem
62598ee044b2445a339b5c54
class LinkedList(object): <NEW_LINE> <INDENT> class _Node(object): <NEW_LINE> <INDENT> def __init__(self, data, after=None): <NEW_LINE> <INDENT> self._data = data <NEW_LINE> self._after= after <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self._data) <NEW_LINE> <DEDENT> @property <NEW_LINE> def ...
A linked list data structure allows dynamic addition of nodes and sequential access to the data. It has the following guarantees insert at beginning/end - O(1) search/find an element in the list - O(N) deletion at beginning/end - O(1)
62598ee0baa26c4b54d4d8ad
class PostForm(Form): <NEW_LINE> <INDENT> body = TextAreaField("Body", validators=[Required(), Length(5, 4000)]) <NEW_LINE> bumped = BooleanField("Bump this topic", default=True)
A :class:`Form` for replying to a topic. The :attr:`body` field should be populated to :class:`Post`.
62598ee07047854f4633d9bd
class Latte(Feature): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Feature.__init__(self, "LattE") <NEW_LINE> <DEDENT> def _is_present(self): <NEW_LINE> <INDENT> test = (Latte_count()._is_present() and Latte_integrate()._is_present()) <NEW_LINE> if not test: <NEW_LINE> <INDENT> return test <NEW_LINE> <DE...
A :class:`sage.features.Feature` describing the presence of the ``LattE`` binaries which comes as a part of ``latte_int``. EXAMPLES:: sage: from sage.features.latte import Latte sage: Latte().is_present() # optional - latte_int FeatureTestResult('LattE', True)
62598ee099cbb53fe682f48e
class Meta: <NEW_LINE> <INDENT> model = Cart <NEW_LINE> fields = ( 'project_name', 'description', 'owner', 'requested_due_date', 'status', 'nb_cart_items', 'total_amount', ) <NEW_LINE> widgets = { 'requested_due_date': SelectDateWidget(), } <NEW_LINE> is_hidden = False
Use this Meta class on any model to specify various model-specific options.
62598ee03cc13d1c6d463d48
class BugOra16217743(tests.MySQLConnectorTests): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> config = self.getMySQLConfig() <NEW_LINE> self.cnx = connection.MySQLConnection(**config) <NEW_LINE> self.cnx.cmd_query("DROP TABLE IF EXISTS bug16217743") <NEW_LINE> self.cnx.cmd_query("DROP PROCEDURE IF EXISTS sp...
BUG#16217743: CALLPROC FUNCTION WITH STRING PARAMETERS
62598ee0d58c6744b42db5a5
class DelugeForm(forms.Form): <NEW_LINE> <INDENT> enabled = forms.BooleanField( label=_('Enable Deluge'), required=False)
Deluge configuration form.
62598ee0fff4ab517ebcbdc1
class MapDistributor(IterableDistributorBaseClass): <NEW_LINE> <INDENT> def __init__( self, disable_progressbar=False, progressbar_title="Feature Extraction" ): <NEW_LINE> <INDENT> self.disable_progressbar = disable_progressbar <NEW_LINE> self.progressbar_title = progressbar_title <NEW_LINE> <DEDENT> def distribute(sel...
Distributor using the python build-in map, which calculates each job sequentially one after the other.
62598ee0a219f33f346c4e15
class DcdOutputFile: <NEW_LINE> <INDENT> _dcd_convang = False <NEW_LINE> def _get_dcd_data(self): <NEW_LINE> <INDENT> if os.path.exists(self.dcdfilename): <NEW_LINE> <INDENT> cryst_const, coords = dcd.read_dcd_data(self.dcdfilename, convang=self._dcd_convang) <NEW_LINE> return {'cryst_const': cryst_const, 'coords': coo...
Base class which implements dcd file reading. Used only for inheritance.
62598ee02c8b7c6e89bd1d9c
class Factory(): <NEW_LINE> <INDENT> def set_celery(self): <NEW_LINE> <INDENT> self.celery = Celery(__name__, backend='rpc://', broker='pyamqp://localhost//') <NEW_LINE> return self.celery <NEW_LINE> <DEDENT> def make_celery(self, app): <NEW_LINE> <INDENT> self.celery = Celery( __name__, backend=app.config['CELERY_RESU...
celery Instance for API.
62598ee0adb09d7d5dc08ba4
class App(_Callback): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._pvs_database = _get_database() <NEW_LINE> self._progmd_users = _MacSched.is_user_shift_programmed( datetime=_datetime.now()) <NEW_LINE> self.ms_handler = _HandleMachShiftFile() <NEW_LINE> try: <NEW_LINE...
Main application for handling machine shift.
62598ee09c8ee8231303f446
class ControlData(tables.IsDescription): <NEW_LINE> <INDENT> uuid = tables.StringCol(UUID_LENGTH) <NEW_LINE> db_version = tables.StringCol(4) <NEW_LINE> control_type = tables.StringCol(12) <NEW_LINE> continuous = tables.BoolCol() <NEW_LINE> strain = tables.StringCol(30) <NEW_LINE> projection = tables.StringCol(30) <NEW...
Other things to record (as attributes or in data structure): * link to TRN (version) * link to GPN (version) * link to metabolic network * sample tables named same as uuid * jackknife analysis named same as uuid
62598ee01b99ca400228e7fb
class Quote( dict ): <NEW_LINE> <INDENT> __getattr__ = dict.__getitem__ <NEW_LINE> __setattr__ = dict.__setitem__ <NEW_LINE> def __init__(self, *args, **kwargs ): <NEW_LINE> <INDENT> super(Quote,self).__init__(*args, **kwargs) <NEW_LINE> self.__dict__ = self <NEW_LINE> self["eventtype"] = QUOTE[0] <NEW_LINE> <DEDENT> o...
Define a Quote class
62598ee0a79ad161977685f4
class Cute(object): <NEW_LINE> <INDENT> def __init__(self, d): <NEW_LINE> <INDENT> self.d = d <NEW_LINE> for k,v in d.items(): <NEW_LINE> <INDENT> if type(v) == type(dict): <NEW_LINE> <INDENT> setattr(self, k, Cute(v)) <NEW_LINE> <DEDENT> elif type(v) == type(list): <NEW_LINE> <INDENT> setattr(self, k, [Cute(x) for x i...
Base class to create objects from request().json
62598ee08c0ade5d55dc2972
class KeywordSearch(Plugin): <NEW_LINE> <INDENT> def __init__(self, app): <NEW_LINE> <INDENT> Plugin.__init__(self, app) <NEW_LINE> self.all_keywords = [] <NEW_LINE> self._criteria = _SearchCriteria() <NEW_LINE> self.dirty = False <NEW_LINE> <DEDENT> def enable(self): <NEW_LINE> <INDENT> action = ActionInfo('Tools', 'S...
A plugin for searching keywords based on name or documentation.
62598ee06e29344779afec0b
class Path(Button): <NEW_LINE> <INDENT> def __init__(self, size_hint_x=1, size_hint_y=1, wall=False, **kwargs): <NEW_LINE> <INDENT> super(Path, self).__init__(**kwargs) <NEW_LINE> self.path_source = 'Images/path.png' <NEW_LINE> self.wall_source = 'Images/wall.png' <NEW_LINE> self.background_disabled_normal = '' <NEW_LI...
- This class sets up a button as either a wall or a path. - Walls and Paths are indicated by just their background image - Remember to disable the button after it is initialized. It does not work when you try to disable it in the constructor
62598ee0b7558d5895461c29
class DevicesRegistry: <NEW_LINE> <INDENT> devices: Dict[str, dict] = {} <NEW_LINE> setups: Dict[str, Callable] = None <NEW_LINE> defaults: Dict[str, dict] = {} <NEW_LINE> def add_setup(self, domain: str, handler): <NEW_LINE> <INDENT> self.setups[domain] = handler <NEW_LINE> <DEDENT> async def add_entity(self, domain: ...
Global registry for all gateway devices. Because BLE devices updates from all gateway simultaniosly. Key - device did, `numb` for wifi and mesh devices, `lumi.ieee` for zigbee devices, `blt.3.alphanum` for ble devices, `group.numb` for mesh groups.
62598ee0236d856c2adc8702
class MessageResult(object): <NEW_LINE> <INDENT> def __init__(self, msg_obj): <NEW_LINE> <INDENT> self.msg_obj = msg_obj <NEW_LINE> self.user = ZombieUserResult(msg_obj.user) <NEW_LINE> <DEDENT> def Write(self, writer, member_index_map): <NEW_LINE> <INDENT> writer.Start("message") <NEW_LINE> writer.Content("sender", st...
Wraps a models.Message
62598ee0eab8aa0e5d30a355