code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
@dataclass <NEW_LINE> class ResponseData: <NEW_LINE> <INDENT> resp: ClientResponse <NEW_LINE> loaded: Any <NEW_LINE> decoded: Any | Holds information about handled response. | 62598f63507cdc57c63a441e |
class MagicGoal: <NEW_LINE> <INDENT> def move(self, ball, value): <NEW_LINE> <INDENT> self.controller.propose_magic(self, ("move", ball, value)) <NEW_LINE> <DEDENT> def power(self, ball, value): <NEW_LINE> <INDENT> self.controller.propose_magic(self, ("power", ball, value)) | Container for the magic-related methods | 62598f639b70327d1c57e429 |
class slash_to_backCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, editObj): <NEW_LINE> <INDENT> for region in self.view.sel(): <NEW_LINE> <INDENT> if not region.empty(): <NEW_LINE> <INDENT> selection = self.view.substr(region) <NEW_LINE> self.view.replace(editObj, region, to_back_slash(selection... | All slashes in selection are replaced by back slashes | 62598f63a8ecb03325870887 |
class TextTestResult(unittest3_backport.TextTestResult): <NEW_LINE> <INDENT> def __init__(self, stream, descriptions, verbosity): <NEW_LINE> <INDENT> super(TextTestResult, self).__init__(stream, descriptions, 0) <NEW_LINE> self._per_test_output = verbosity > 0 <NEW_LINE> <DEDENT> def _print_status(self, tag, test): <NE... | TestResult class that provides the default text result formatting. | 62598f63d164cc61758205fc |
class DrawEllipseTest(DrawEllipseMixin, DrawTestCase): <NEW_LINE> <INDENT> pass | Test draw module function ellipse.
This class inherits the general tests from DrawEllipseMixin. It is also
the class to add any draw.ellipse specific tests to. | 62598f631d351010ab8f31c6 |
class Meta(object): <NEW_LINE> <INDENT> model = QueryOntology <NEW_LINE> fields = ["id", "title", "content", "template", "status", "last_modification_date"] <NEW_LINE> read_only_fields = ('id', 'status', 'last_modification_date',) | Meta
| 62598f635e10d32532ce342a |
class FiberEditingExtension(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.enabled = True <NEW_LINE> <DEDENT> def beforeCloseDocument(self): <NEW_LINE> <INDENT> global editor, hasEdits <NEW_LINE> if hasEdits: <NEW_LINE> <INDENT> if pythonaddins.MessageBox('Do you want to save your edits?', 'H... | Implementation for fiberediting_fiberediting.extension (Extension) | 62598f63d10714528d69d552 |
class RobotMediator(Mediator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(RobotMediator, self).__init__() <NEW_LINE> self._robots = [] <NEW_LINE> <DEDENT> def _pollForHelp(self, sender): <NEW_LINE> <INDENT> for robot in self._robots: <NEW_LINE> <INDENT> if robot is not sender: <NEW_LINE> <INDENT>... | RobotMediator: Implements the Mediator interface.
Acts as a man in the middle that allows multiple
robots to communicate with each other without
knowing any details about each other. | 62598f6373bcbd0ca4bc98d7 |
class VisualFeature(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> ADULT = "adult" <NEW_LINE> BRANDS = "brands" <NEW_LINE> CATEGORIES = "categories" <NEW_LINE> DESCRIPTION = "description" <NEW_LINE> FACES = "faces" <NEW_LINE> OBJECTS = "objects" <NEW_LINE> TAGS = "tags" | The strings indicating what visual feature types to return.
| 62598f631f037a2d8b9e3775 |
class ProfileMiddleware(object): <NEW_LINE> <INDENT> def __init__(self, get_response): <NEW_LINE> <INDENT> self.get_response = get_response <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> if 'prof' in request.GET: <NEW_LINE> <INDENT> self.tmpfile = tempfile.NamedTemporaryFile() <NEW_LINE> self.prof... | Displays hotshot profiling for any view.
http://yoursite.com/yourview/?prof
Add the "prof" key to query string by appending ?prof (or &prof=)
and you'll see the profiling results in your browser.
It's set up to only be available in django's debug mode,
but you really shouldn't add this middleware to any production con... | 62598f63d18da76e235b6c78 |
class Event: <NEW_LINE> <INDENT> def __init__(self, event_class): <NEW_LINE> <INDENT> if not isinstance(event_class, EventClass): <NEW_LINE> <INDENT> raise TypeError("Invalid event_class argument.") <NEW_LINE> <DEDENT> self._e = nbt._bt_ctf_event_create(event_class._ec) <NEW_LINE> if self._e is None: <NEW_LINE> <INDENT... | Events are specific instances of event classes
(:class:`EventClass`), which means they may contain actual,
concrete field values. | 62598f6376d4e153a661c299 |
class Response(object): <NEW_LINE> <INDENT> def __init__(self, contents, renderer, status, heading, note, is_kwic_view): <NEW_LINE> <INDENT> self.contents = contents <NEW_LINE> self.renderer = renderer <NEW_LINE> self.status = status <NEW_LINE> self.heading = heading <NEW_LINE> self.note = note <NEW_LINE> self.is_kwic_... | A response as returned by server-side frontend (where server-side
frontend receives data from backend). | 62598f630383005118f6cd8e |
class TaskImporter(object): <NEW_LINE> <INDENT> def __init__(self, path, loader_class): <NEW_LINE> <INDENT> self.file_cacher = FileCacher() <NEW_LINE> self.loader = loader_class(os.path.realpath(path), self.file_cacher) <NEW_LINE> <DEDENT> def do_import(self): <NEW_LINE> <INDENT> task = self.loader.get_task() <NEW_LINE... | This script creates a task
| 62598f6321a7993f00c655fe |
class Sockaddrll(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [ ("sll_family", ctypes.c_ushort), ("sll_protocol", ctypes.c_ushort), ("sll_ifindex", ctypes.c_byte * 4), ("sll_hatype", ctypes.c_ushort), ("sll_pkttype", ctypes.c_ubyte), ("sll_halen", ctypes.c_ubyte), ("sll_addr", ctypes.c_ubyte * 8), ] | The sockaddr_ll struct. | 62598f635e10d32532ce342b |
class ChildDepth(ServerMessage): <NEW_LINE> <INDENT> def __init__(self, value=None): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def make_network_message(self): <NEW_LINE> <INDENT> return self.pack_object(self.value) | Server code: 129 | 62598f63d99f1b3c44d04d39 |
class UnaryOp(NoOperandsOp): <NEW_LINE> <INDENT> arity, verb = 1, "operate on" | A math or logic operator that pops one value and pushes one
back. | 62598f63be8e80087fbbe6df |
class AwardMixIn: <NEW_LINE> <INDENT> AWARD_TYPE_DOUBLE_FIRE = 0 <NEW_LINE> AWARD_TYPE_LIFE = 1 <NEW_LINE> AWARD_TYPE_TREBLE_FIRE = 2 <NEW_LINE> AWARD_TYPE_FOURFOLD_FIRE = 3 <NEW_LINE> AWARD_TYPE_NINEFOLD_FIRE = 4 <NEW_LINE> def get_type(self): <NEW_LINE> <INDENT> return AwardMixIn.AWARD_TYPE_DOUBLE_FIRE | 奖励
| 62598f638c3a8732951f5bd6 |
class WritingStreamManager(models.Manager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> from unbracketed.apps.content.models import ProTip, Article <NEW_LINE> cta = ContentType.objects.get_for_model(Article) <NEW_LINE> ctp = ContentType.objects.get_for_model(ProTip) <NEW_LINE> return super(WritingS... | Model manager for the content stream
| 62598f63507cdc57c63a4422 |
class TagValue(Model): <NEW_LINE> <INDENT> __core__ = False <NEW_LINE> project = FlexibleForeignKey('sentry.Project', null=True) <NEW_LINE> key = models.CharField(max_length=MAX_TAG_KEY_LENGTH) <NEW_LINE> value = models.CharField(max_length=MAX_TAG_VALUE_LENGTH) <NEW_LINE> data = GzippedDictField(blank=True, null=True)... | Stores references to available filters. | 62598f6356b00c62f0fb1f3c |
class VertexViewer(object): <NEW_LINE> <INDENT> HEIGHT = 3 <NEW_LINE> def __init__(self, name): <NEW_LINE> <INDENT> self._h = self.HEIGHT <NEW_LINE> self._w = len(name) + 2 <NEW_LINE> <DEDENT> @property <NEW_LINE> def h(self): <NEW_LINE> <INDENT> return self._h <NEW_LINE> <DEDENT> @property <NEW_LINE> def w(self): <NEW... | Class to define vertex box boundaries that will be accounted for during
graph building by grandalf.
Args:
name (str): name of the vertex. | 62598f63d10714528d69d553 |
class HavingClause(object): <NEW_LINE> <INDENT> def __init__(self, boolean_expr): <NEW_LINE> <INDENT> self.boolean_expr = boolean_expr <NEW_LINE> <DEDENT> def __deepcopy__(self, memo): <NEW_LINE> <INDENT> return HavingClause(deepcopy(self.boolean_expr, memo)) | The member variable boolean_expr will be an instance of a boolean func
defined below. | 62598f6330c21e258be97e83 |
class UseKind(str, Enum): <NEW_LINE> <INDENT> PAYMENT = "支払" <NEW_LINE> PAYMENT_CANCEL = "支払取消" <NEW_LINE> CHARGE = "チャージ" <NEW_LINE> AUTO_CHARGE = "オートチャージ" <NEW_LINE> DOWNLOAD_POINT = "ポイントダウンロード" <NEW_LINE> TRANSFER_WAON_UPLOAD = "WAON移行(アップロード)" <NEW_LINE> TRANSFER_WAON_DOWNLOAD = "WAON移行(ダウンロード)" | This class implements constant of user kind in WAON CSV. | 62598f6376d4e153a661c29b |
class ClassInitMeta(type): <NEW_LINE> <INDENT> def __init__(cls, class_name, bases, new_attrs): <NEW_LINE> <INDENT> super(ClassInitMeta, cls).__init__(class_name, bases, new_attrs) <NEW_LINE> cls.__classinit__() | Meta class triggering __classinit__ on class intialization. | 62598f63a8ecb0332587088b |
class IntegerValidator(Validator): <NEW_LINE> <INDENT> def validate(self, document): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> int(document.text) <NEW_LINE> if int(document.text) <= 0: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> <DEDENT> except ValueError: <NEW_LINE> <INDENT> raise ValidationError( mess... | Simple integer validation | 62598f631d351010ab8f31cb |
class SubscriptableType(type): <NEW_LINE> <INDENT> def __init_subclass__(mcs, **kwargs): <NEW_LINE> <INDENT> mcs._hash = None <NEW_LINE> mcs.__args__ = None <NEW_LINE> mcs.__origin__ = None <NEW_LINE> <DEDENT> def __getitem__(self, item) -> _SubscribedType: <NEW_LINE> <INDENT> body = { **self.__dict__, '__args__': item... | This metaclass will allow a type to become subscriptable.
>>> class SomeType(metaclass=SubscriptableType):
... pass
>>> SomeTypeSub = SomeType['some args']
>>> SomeTypeSub.__args__
'some args'
>>> SomeTypeSub.__origin__.__name__
'SomeType' | 62598f63ac7a0e7691f71b99 |
class file_handler: <NEW_LINE> <INDENT> def __init__(self, filename, mode="r", encoding="utf-8"): <NEW_LINE> <INDENT> self.__filename = filename <NEW_LINE> self.__mode = mode <NEW_LINE> self.__encoding = encoding <NEW_LINE> self.__file_handler = codecs.open(self.__filename, self.__mode, self.__encoding) <NEW_LINE> <DED... | General file handler | 62598f6330c21e258be97e85 |
class UserProfile(AbstractUser): <NEW_LINE> <INDENT> GENDER_CHOICES = ( ('male', '男'), ('female', '女') ) <NEW_LINE> name = models.CharField("姓名", max_length=30, null=True, blank=True) <NEW_LINE> birthday = models.DateField("出生年月", null=True, blank=True) <NEW_LINE> gender = models.CharField("性别", max_length=6, choices=G... | User Info | 62598f63d18da76e235b6c7a |
class MultidigitMultiplyNonGradualData(MultidigitMultiplyDataBase): <NEW_LINE> <INDENT> def __init__(self, actions, train_size): <NEW_LINE> <INDENT> timesteps = 178 <NEW_LINE> super().__init__(timesteps, actions, train_size) <NEW_LINE> <DEDENT> def generate_selections(self, pairs, timesteps, actions): <NEW_LINE> <INDEN... | Data and algorithm for double-digit non-gradual multiplication | 62598f6376d4e153a661c29d |
class Stop(ManageCommand): <NEW_LINE> <INDENT> def signal(self, component_name, signal_name, signal_code, pidfile=None, component_dir=None, ignore_missing=False, needs_logging=True): <NEW_LINE> <INDENT> import os <NEW_LINE> import sys <NEW_LINE> component_dir = component_dir or self.component_dir <NEW_LINE> pidfile = p... | Stops a Zato component
| 62598f6330c21e258be97e86 |
class TestRepeatValidator(TableValidatorMixin): <NEW_LINE> <INDENT> TEMPLATE = [ ['', 'C_A', 'C_B', 'C_C'], ['{REPEAT_ROW}R', '{INT(REQUIRED=TRUE)}', '{INT(REQUIRED=TRUE)}', '{INT(REQUIRED=TRUE)}'], ['R_X', '{INT:REQUIRED}', '{INT:REQUIRED}', '{INT:REQUIRED}'], ] <NEW_LINE> def test_no_repeat(self): <NEW_LINE> <INDENT>... | Tests for ``table_validator``. | 62598f635e10d32532ce342d |
class sfp_yahoosearch(SpiderFootPlugin): <NEW_LINE> <INDENT> opts = { 'pages': 20 } <NEW_LINE> optdescs = { 'pages': "Number of Yahoo results pages to iterate through." } <NEW_LINE> results = list() <NEW_LINE> def setup(self, sfc, userOpts=dict()): <NEW_LINE> <INDENT> self.sf = sfc <NEW_LINE> self.results = list() <NEW... | Yahoo:Footprint,Investigate,Passive:Search Engines:errorprone:Some light Yahoo scraping to identify sub-domains and links. | 62598f63be8e80087fbbe6e3 |
class InconsistentActionAttributeError(ConflictingActionError): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> actions = self._data <NEW_LINE> keyattr = actions[0][0].attrs[actions[0][0].key_attr] <NEW_LINE> actname = actions[0][0].name <NEW_LINE> def ou(action): <NEW_LINE> <INDENT> ua = dict( (k, v) for k,... | Multiple actions of the same type representing the same object have
have been delivered, but with conflicting attributes, such as two
directories at /usr with groups 'root' and 'sys', or two 'root' users
with uids '0' and '7'. | 62598f638c3a8732951f5bdb |
class PPM: <NEW_LINE> <INDENT> def frame_1090es_ppm_modulate(self, even, odd): <NEW_LINE> <INDENT> ppm = [ ] <NEW_LINE> encoder = Encoder() <NEW_LINE> for i in range(48): <NEW_LINE> <INDENT> ppm.append( 0 ) <NEW_LINE> <DEDENT> ppm.append( 0xA1 ) <NEW_LINE> ppm.append( 0x40 ) <NEW_LINE> for i in range(len(even)): <NEW_L... | The PPM class contains functions about PPM manipulation
| 62598f63796e427e5384de1d |
class Repository(NodeObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> NodeObject.__init__(self) <NEW_LINE> self.type = "" <NEW_LINE> self.rname = "" <NEW_LINE> self.medium = "" <NEW_LINE> self.notes = [] <NEW_LINE> self.sources = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f... | Repository / Arkisto.
Properties:
uniq_id int db native key or None
handle str Gramps handle
change int timestamp
id str esim. "R0001"
rname str arkiston nimi
type str arkiston tyyppi
medium str from S... | 62598f6363f4b57ef00858b4 |
class UnsafeFeaturesNotEnabled(Exception): <NEW_LINE> <INDENT> pass | Unstable. | 62598f63711fe17d825dfd81 |
class RegisterView(View): <NEW_LINE> <INDENT> def get(self,request): <NEW_LINE> <INDENT> return render(request,"register.html") <NEW_LINE> <DEDENT> def post(self,request): <NEW_LINE> <INDENT> username = request.POST.get("user_name") <NEW_LINE> password = request.POST.get("pwd") <NEW_LINE> cpwd = request.POST.get("cpwd"... | 注册视图 | 62598f63925a0f43d25e76c3 |
class SpecialMixin(InlineMixin): <NEW_LINE> <INDENT> pass | Specials are just another type of inline element.
Strict DTD::
<!ENTITY % special "A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB |
SUP | SPAN | BDO">
Loose DTD::
<!ENTITY % special "A | IMG | APPLET | OBJECT | FONT | BASEFONT | BR |
SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO | IFRAME"> | 62598f63d99f1b3c44d04d3f |
class TenantModel(Base): <NEW_LINE> <INDENT> __tablename__ = 'tenant' <NEW_LINE> attributes = ['id', 'name', 'description'] <NEW_LINE> id = Column(VARCHAR(64), primary_key=True) <NEW_LINE> name = Column(VARCHAR(64)) <NEW_LINE> description = Column(VARCHAR(128)) | Maps the database table tenant | 62598f638c3a8732951f5bdd |
class DependencyResolver(six.with_metaclass(abc.ABCMeta)): <NEW_LINE> <INDENT> PATH_PARTS = tuple() <NEW_LINE> def __init__(self, dependency_path): <NEW_LINE> <INDENT> path_parts = (settings.EREGS_INDEX_ROOT,) + self.PATH_PARTS <NEW_LINE> regex = re.compile(re.escape(os.sep).join(path_parts)) <NEW_LINE> self.match = re... | Base class for objects which know how to "fix" missing dependencies. | 62598f6363f4b57ef00858b5 |
class AzureSqlDWTableDataset(Dataset): <NEW_LINE> <INDENT> _validation = { 'linked_service_name': {'required': True}, 'type': {'required': True}, 'table_name': {'required': True}, } <NEW_LINE> _attribute_map = { 'additional_properties': {'key': '', 'type': '{object}'}, 'description': {'key': 'description', 'type': 'str... | The Azure SQL Data Warehouse dataset.
:param additional_properties: Unmatched properties from the message are
deserialized this collection
:type additional_properties: dict[str, object]
:param description: Dataset description.
:type description: str
:param structure: Columns that define the structure of the dataset. ... | 62598f63507cdc57c63a4428 |
class TwMiddleware(object): <NEW_LINE> <INDENT> def __init__(self, app, controllers=None, **config): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.config = Config(**config) <NEW_LINE> self.engines = template.EngineManager() <NEW_LINE> self.resources = resources.ResourcesApp(self.config) <NEW_LINE> self.controllers... | ToscaWidgets middleware
This performs three tasks:
* Clear request-local storage before and after each request. At the start
of a request, a reference to the middleware instance is stored in
request-local storage.
* Proxy resource requests to ResourcesApp
* Inject resources | 62598f6373bcbd0ca4bc98df |
class GaussianPolicy(Approximation): <NEW_LINE> <INDENT> def __init__( self, model, optimizer=None, space=None, name='policy', **kwargs ): <NEW_LINE> <INDENT> super().__init__( GaussianPolicyNetwork(model, space), optimizer, name=name, **kwargs ) | A Gaussian stochastic policy.
This policy will choose actions from a distribution represented by a spherical Gaussian.
The first n outputs of the model are the mean of the distribution and the last n outputs are the log variance.
The output will be centered and scaled to the size of the given space, but the output wil... | 62598f63d164cc6175820605 |
class _IntegrationBase(LDAPGroupAuthTestBase): <NEW_LINE> <INDENT> def get_client(self, username=None, password='password'): <NEW_LINE> <INDENT> client = self.client <NEW_LINE> if username: <NEW_LINE> <INDENT> self.assertTrue( client.login(username=username, password=password)) <NEW_LINE> <DEDENT> return client <NEW_LI... | Make actual Django requests to make sure everything functions.
We can't use the RequestFactory because the access control is at the
URL level, and the RF doesn't go through that. | 62598f637c178a314d78cb2c |
class TestCsvParsing(unittest.TestCase): <NEW_LINE> <INDENT> def test_01(self): <NEW_LINE> <INDENT> filename = os.path.join(TESTSCRIPT_DIR, "parse_ok.csv") <NEW_LINE> parsed = gnucash_import.get_parsed_csv_file(filename) <NEW_LINE> expected = [ {"date": datetime.datetime(2017, 1, 1), "accountname": "abcd:efg", "descrip... | test parsing CSV files | 62598f6330c21e258be97e8a |
class InsightWeather(): <NEW_LINE> <INDENT> def __init__(self, sol, data): <NEW_LINE> <INDENT> self.sol = sol <NEW_LINE> self.data = data <NEW_LINE> if 'AT' in data: <NEW_LINE> <INDENT> self.temperature = InsightMeasurement(data['AT'], 'Temperature') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.temperature = None... | Weather Object. | 62598f636e29344779affce6 |
class Formula(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def acc_return_yield(data): <NEW_LINE> <INDENT> y = data.iloc[-1] / data.iloc[0] - 1 <NEW_LINE> y = round(y, 4) <NEW_LINE> return y <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def annualized_return_yield(data): <NEW_LINE> <INDENT> y = Formula.acc_retu... | 计算DataFrame对象,要求index必须为date类型
nav_adj close
date
2008-06-19 1.000000 2773.0760
2008-06-19 1.000000 2773.0760
2008-06-19 1.000000 2773.0760 | 62598f6330c21e258be97e8b |
class Content(Node): <NEW_LINE> <INDENT> implements(IContent) <NEW_LINE> @classproperty <NEW_LINE> def __mapper_args__(cls): <NEW_LINE> <INDENT> return dict(polymorphic_identity=camel_case_to_name(cls.__name__)) <NEW_LINE> <DEDENT> id = Column(Integer, ForeignKey('nodes.id'), primary_key=True) <NEW_LINE> default_view =... | Content adds some attributes to :class:`Node` that are useful for
content objects in a CMS. | 62598f63287bf620b6271249 |
class ArithmaticProgression(Progression): <NEW_LINE> <INDENT> def __init__(self, start=0, increment=1): <NEW_LINE> <INDENT> super().__init__(start) <NEW_LINE> self._increment = increment <NEW_LINE> <DEDENT> def _advance(self): <NEW_LINE> <INDENT> self._current += self._increment | Iterator producing an arithmatic progression | 62598f637c178a314d78cb2e |
class sparsity_csr(sdcsr): <NEW_LINE> <INDENT> def __init__(self, mshape, s=None, diag=None, M=None): <NEW_LINE> <INDENT> if M is not None: <NEW_LINE> <INDENT> if not isinstance(M, scipy_sparse.csr_matrix): <NEW_LINE> <INDENT> M = csr_matrix(M) <NEW_LINE> <DEDENT> M.sort_indices() <NEW_LINE> M.data.fill(1) <NEW_LINE> <... | This is a variant of matrix only propagating sparsity information | 62598f631f5feb6acb1622ca |
class Profile(config_models.TimeStampedModel): <NEW_LINE> <INDENT> GENDERS = ( ('M', 'Masculine'), ('F', 'Feminine') ) <NEW_LINE> user = models.OneToOneField( User, on_delete=models.CASCADE) <NEW_LINE> bio = models.TextField(default='', blank=True, null=True) <NEW_LINE> website = models.URLField(blank=True, null=True) ... | Profile Model | 62598f6330c21e258be97e8c |
class StatementNode(TreeNode): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(StatementNode, self).__init__(NodeType.STATEMENT) <NEW_LINE> self.funnode = None <NEW_LINE> self.argtree = None <NEW_LINE> self.cmdspec = None <NEW_LINE> <DEDENT> def get_funname(self): <NEW_LINE> <INDENT> return self.funno... | Parent node of a statement subtree. | 62598f63ff9c53063f519ce2 |
class DataLabelConfig(ComposerItemConfig): <NEW_LINE> <INDENT> def __init__(self,composerWrapper): <NEW_LINE> <INDENT> ComposerItemConfig.__init__(self, composerWrapper) <NEW_LINE> self._itemFormatter = DataLabelFormatter() <NEW_LINE> <DEDENT> def action(self): <NEW_LINE> <INDENT> dataLabelAct = QAction(QIcon(":/plugin... | Enables users to define values for QgsComposerLabels from database sources. | 62598f636e29344779affce8 |
class TestLiuCosSlipFn(unittest.TestCase): <NEW_LINE> <INDENT> def test_constructor(self): <NEW_LINE> <INDENT> slipFn = LiuCosSlipFn() <NEW_LINE> return <NEW_LINE> <DEDENT> def test_configure(self): <NEW_LINE> <INDENT> slipFn = LiuCosSlipFn() <NEW_LINE> slipFn._configure() <NEW_LINE> return <NEW_LINE> <DEDENT> def test... | Unit testing of LiuCosSlipFn object. | 62598f63d99f1b3c44d04d43 |
class GraphAttention(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_features, out_features, dropout, alpha, concat=True): <NEW_LINE> <INDENT> super(GraphAttention, self).__init__() <NEW_LINE> self.dropout = dropout <NEW_LINE> self.in_features = in_features <NEW_LINE> self.out_features = out_features <NEW_LINE> s... | Simple GAT layer, similar to https://arxiv.org/abs/1710.10903 | 62598f639b70327d1c57e436 |
class TornadoContext(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> configs = kwargs <NEW_LINE> self.run_mode = configs.get('run_mode', 'console') <NEW_LINE> self.log_level = configs.get('log_level', 'DEBUG') <NEW_LINE> self.log_path = configs.get('log_path', '/tmp/logs') <NEW_LINE> self... | 初始化日志、uri路由、数据库连接,启动服务器心跳
| 62598f63bf627c535bcb0b10 |
class TextClassificationDataset(torch.utils.data.Dataset): <NEW_LINE> <INDENT> def __init__(self, vocab, data, labels): <NEW_LINE> <INDENT> super(TextClassificationDataset, self).__init__() <NEW_LINE> self._data = data <NEW_LINE> self._labels = labels <NEW_LINE> self._vocab = vocab <NEW_LINE> <DEDENT> def __getitem__(s... | Defines an abstract text classification datasets.
Currently, we only support the following datasets:
- AG_NEWS
- SogouNews
- DBpedia
- YelpReviewPolarity
- YelpReviewFull
- YahooAnswers
- AmazonReviewPolarity
- AmazonReviewFull | 62598f6326238365f5fac207 |
class RequestFailure(Exception): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> Exception.__init__(self) <NEW_LINE> self.kwargs = kwargs | An exception to indicate a request failure
Raising this exception is equivalent of aborting the current (synchronous)
request processing and calling Driver.fail(). All arguments are the same as
when using Driver.fail(). | 62598f6421a7993f00c6560a |
class JsonField(fields.Raw): <NEW_LINE> <INDENT> def format(self, value): <NEW_LINE> <INDENT> return json.loads(value) | Decodes json | 62598f64711fe17d825dfd87 |
class Beer(_Endpoint): <NEW_LINE> <INDENT> endpoint_base = 'beer' <NEW_LINE> get_endpoints = ('info', 'checkins') | Beer endpoint class | 62598f641d351010ab8f31d5 |
class Effect(EffectObject): <NEW_LINE> <INDENT> _immutable_ = True <NEW_LINE> pass | Base class for any effects | 62598f64d10714528d69d55e |
class TestJobStatisticsJobNodeCpu(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 testJobStatisticsJobNodeCpu(self): <NEW_LINE> <INDENT> pass | JobStatisticsJobNodeCpu unit test stubs | 62598f64ac7a0e7691f71ba3 |
class CommandListener(BaseProtocol): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__buffer = ReadBuffer() <NEW_LINE> <DEDENT> def connectionMade(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __handle_new_connection(self, properties): <NEW_LINE> <INDENT> assigned_session_id = properties.ass... | The relay server will emit messages to us over a separate command
channel. The messages are referred to as commands, but are also referred-to
as "announcements". | 62598f6473bcbd0ca4bc98e5 |
class Stack(object): <NEW_LINE> <INDENT> def __init__(self, potential_iterable=None): <NEW_LINE> <INDENT> self.top: Node = None <NEW_LINE> self._length: int = 0 <NEW_LINE> if potential_iterable is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> for i in potential_iterable: <NEW_LINE> <INDENT> self.pop(i) <NEW_LI... | This creates a stack class with methods below
| 62598f644d74a7450cd58a21 |
class TestCase(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(TestCase, self).setUp() <NEW_LINE> self.stubs = stubout.StubOutForTesting() <NEW_LINE> self.addCleanup(self.stubs.UnsetAll) <NEW_LINE> self.addCleanup(self.stubs.SmartUnsetAll) | Base test case for all unit tests | 62598f647c178a314d78cb31 |
class Meta: <NEW_LINE> <INDENT> parellel_indexing = True | Meta options. | 62598f64d164cc617582060c |
class RWDatasetTmp3(torch.utils.data.Dataset): <NEW_LINE> <INDENT> def __init__(self, RWs, prms, kwargs, nb_process=16, func_feat_y=get_y_binary('RW_FBM')): <NEW_LINE> <INDENT> self.ns = RWs.n.unique() <NEW_LINE> self.RWsgroup = RWs.groupby('n') <NEW_LINE> self.prms = prms <NEW_LINE> self.kwargs = kwargs <NEW_LINE> sel... | torch Dataset subclass.
| 62598f6430c21e258be97e90 |
class ChoiceListPrompt(ChoicePrompt): <NEW_LINE> <INDENT> def __init__( self, text, choices, delimiter = ' ', default = '' ): <NEW_LINE> <INDENT> ChoicePrompt.__init__( self, text, choices, default ) <NEW_LINE> self.delimiter = delimiter <NEW_LINE> readline.set_completer_delims( delimiter ) <NEW_LINE> <DEDENT> def vali... | Prompts a user to choose one or more of a list of options. | 62598f64be8e80087fbbe6ed |
class StoppableThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> threading.Thread.__init__(self) <NEW_LINE> self.stop_event = threading.Event() <NEW_LINE> <DEDENT> def stop(self): <NEW_LINE> <INDENT> if self.isAlive() is True: <NEW_LINE> <INDENT> self.stop_event.set() <NEW_LINE> self... | Init super class StoppableThread | 62598f64a4f1c619b294dc87 |
class Switch(Input): <NEW_LINE> <INDENT> def __init__(self, name, off=None, on=None): <NEW_LINE> <INDENT> if not off and not on: <NEW_LINE> <INDENT> raise RuntimeError( "A value must be provided for at least one of 'off' or 'on'") <NEW_LINE> <DEDENT> options = [] <NEW_LINE> if off: <NEW_LINE> <INDENT> options.append(of... | This class allows the user to specify two options where only one is
valid at a time. It could be considered to be a special case of
Choice, but it is so common that a separate class makes sense. | 62598f649b70327d1c57e43a |
class OrderEvent(AbstractEvent): <NEW_LINE> <INDENT> def __init__(self, ticker, action, quantity): <NEW_LINE> <INDENT> self.ticker = ticker <NEW_LINE> self.action = action <NEW_LINE> self.quantity = quantity <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> format_str = "<%14s Ticker: '%s', Action: '%s', Quant... | Handles the event of sending an Order to an execution system.
The order contains a ticker (e.g. GOOG), action (BOT or SLD)
and quantity. | 62598f64d10714528d69d560 |
class BooleanConverter(BaseConverter): <NEW_LINE> <INDENT> false_values = {None, False, 'false', 'False', 0, '0'} <NEW_LINE> @staticmethod <NEW_LINE> def convert(key, string): <NEW_LINE> <INDENT> return string not in BooleanConverter.false_values <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> name = ('boolean', 'b... | Convert the value to a boolean value. | 62598f6463f4b57ef00858b9 |
class RawField(object): <NEW_LINE> <INDENT> def __init__(self, preprocessing=None, postprocessing=None): <NEW_LINE> <INDENT> self.preprocessing = preprocessing <NEW_LINE> self.postprocessing = postprocessing <NEW_LINE> <DEDENT> def preprocess(self, x): <NEW_LINE> <INDENT> if self.preprocessing is not None: <NEW_LINE> <... | Defines a general datatype.
Every dataset consists of one or more types of data. For instance, a text
classification dataset contains sentences and their classes, while a
machine translation dataset contains paired examples of text in two
languages. Each of these types of data is represented by an RawField object.
An ... | 62598f64ac7a0e7691f71ba5 |
class FakeInstance: <NEW_LINE> <INDENT> pass | A Fake model instance to ensure an instance is not modified | 62598f6491af0d3eaad3949d |
class PacketCaptureFilter(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'protocol': {'key': 'protocol', 'type': 'str'}, 'local_ip_address': {'key': 'localIPAddress', 'type': 'str'}, 'remote_ip_address': {'key': 'remoteIPAddress', 'type': 'str'}, 'local_port': {'key': 'localPort', 'type': 'str'}, '... | Filter that is applied to packet capture request. Multiple filters can be applied.
:param protocol: Protocol to be filtered on. Possible values include: "TCP", "UDP", "Any".
Default value: "Any".
:type protocol: str or ~azure.mgmt.network.v2019_12_01.models.PcProtocol
:param local_ip_address: Local IP Address to be f... | 62598f6456b00c62f0fb1f49 |
class Node(object): <NEW_LINE> <INDENT> def __init__(self, dataPrefix, sessionNo, sequenceNo): <NEW_LINE> <INDENT> self._dataPrefix = dataPrefix <NEW_LINE> self._sessionNo = sessionNo <NEW_LINE> self._sequenceNo = sequenceNo <NEW_LINE> self._digest = None <NEW_LINE> self._recomputeDigest() <NEW_LINE> <DEDENT> def getDa... | Create a new DigestTree.Node with the given fields and compute the
digest.
:param str dataPrefix: The data prefix. In Python3, this is encoded
as UTF-8 to digest.
:param int sessionNo: The session number.
:param int sequenceNo: The sequence number. | 62598f6430c21e258be97e91 |
class BumperReact(PotentialFieldBrain.PotentialFieldBehavior): <NEW_LINE> <INDENT> def update(self): <NEW_LINE> <INDENT> bumperCode = self.robot.getBumperStatus() <NEW_LINE> if bumperCode == 2: <NEW_LINE> <INDENT> self.setVector(0.4, 220) <NEW_LINE> <DEDENT> elif bumperCode == 1: <NEW_LINE> <INDENT> self.setVector(0.4,... | Reacts to the bumper being pressed by backing up and trying to turn away from the obstacle. It reports no
vector if the bumper is not pressed. | 62598f646e29344779affcee |
class GameMiniForm(messages.Message): <NEW_LINE> <INDENT> name = messages.StringField(1) | inbound form message for creating and participating game | 62598f64925a0f43d25e76cd |
class Real(BasicPDE): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> name = kwargs.pop('name') <NEW_LINE> atom = sym_Constant(name, real=True) <NEW_LINE> insert_namespace(name, atom) <NEW_LINE> self.name = name <NEW_LINE> BasicPDE.__init__(self, **kwargs) | Class representing a Real number. | 62598f64d10714528d69d562 |
class complexobj(regexobj, pyobj, numobj): <NEW_LINE> <INDENT> _regex = r'\b((\d+)?\.(?(2)\d*|\d+)[iIjJ])\b' <NEW_LINE> _pyobj = complex <NEW_LINE> _pyobj_default_rank = 3 | A complex object | 62598f64ac7a0e7691f71ba7 |
class Connect(Middleware): <NEW_LINE> <INDENT> async def run(self, *_, ctx: Context, next: Callable, **kw): <NEW_LINE> <INDENT> state: State = MiddlewareState.get_state(ctx, State) <NEW_LINE> if not state.initialized: <NEW_LINE> <INDENT> state.initialized = True <NEW_LINE> state.first_connect_time = pendulum.now(tz=pen... | Middleware for handling bot connections. | 62598f6491af0d3eaad3949f |
class OffsetPaginator(BasePaginator): <NEW_LINE> <INDENT> page_type = pages.OffsetPage <NEW_LINE> def get_page(self, page, eager=True): <NEW_LINE> <INDENT> offset, limit = self.per_page * (page - 1), self.per_page <NEW_LINE> return self.page_type(self, page, self._fetch(offset, limit, eager=eager)) <NEW_LINE> <DEDENT> ... | Paginator based on offsets and limits. Not performant for large result sets.
| 62598f6421a7993f00c65610 |
class ApplicationGatewaySslCertificate(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'type': {'readonly': True}, 'public_cert_data': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', '... | SSL certificates of an application gateway.
Variables are only populated by the server, and will be ignored when sending a request.
:param id: Resource ID.
:type id: str
:param name: Name of the SSL certificate that is unique within an Application Gateway.
:type name: str
:ivar etag: A unique read-only string that ch... | 62598f64be8e80087fbbe6f1 |
class Concept(object): <NEW_LINE> <INDENT> name = None <NEW_LINE> def __init__(self, name, **relations): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self._ratings = {} <NEW_LINE> self._relations = [] <NEW_LINE> self._referrers = [] <NEW_LINE> for relation_type, target in relations.iteritems(): <NEW_LINE> <INDENT> i... | A class representing any concept that can be promoted and rated on the
website.
Concepts have the following traits:
- Their `name` property gives a human readable label.
- They can be rated by users. See the `ratings` property and the
`Rating` class.
- They can be related to other concepts, forming ... | 62598f64c432627299fa266a |
class HiveCatalog(Catalog): <NEW_LINE> <INDENT> def __init__(self, catalog_name=None, default_database="default", hive_conf_dir=None, j_hive_catalog=None): <NEW_LINE> <INDENT> gateway = get_gateway() <NEW_LINE> if j_hive_catalog is None: <NEW_LINE> <INDENT> j_hive_catalog = gateway.jvm.org.apache.flink.table.catalog.hi... | A catalog implementation for Hive. | 62598f6473bcbd0ca4bc98eb |
class Quote(): <NEW_LINE> <INDENT> def __init__(self,author,quote): <NEW_LINE> <INDENT> self.author=author <NEW_LINE> self.quote=quote | Quote class to define quote objects | 62598f641f037a2d8b9e3789 |
@base.ReleaseTracks(base.ReleaseTrack.GA, base.ReleaseTrack.BETA) <NEW_LINE> class List(base.ListCommand): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> _AddCommonFlags(parser) <NEW_LINE> parser.add_argument( '--database-version', required=False, choices=['MYSQL_5_5', 'MYSQL_5_6', '... | List customizable flags for Google Cloud SQL instances. | 62598f6476d4e153a661c2ad |
class OperatingPoint: <NEW_LINE> <INDENT> def __init__(self, CondTempInF=float('inf'), EvapTempInF=float('-inf')): <NEW_LINE> <INDENT> self._condtempinF = CondTempInF <NEW_LINE> self._evaptempinF = EvapTempInF <NEW_LINE> <DEDENT> def get_CondTempInF(self): <NEW_LINE> <INDENT> return self._condtempinF <NEW_LINE> <DEDENT... | This class is a class to store a compressor operating point
defined by the condensing temperature and evaporating
temperature | 62598f64d164cc6175820612 |
class ServiceStatus(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def _execute_service_command(self, argument): <NEW_LINE> <INDENT> service_cmd = "systemctl " <NEW_LINE> service_cmd += " ".join(argument) if isinstance( argument, tuple) else argument <NEW... | systemd services provider. | 62598f6421a7993f00c65612 |
class StreamHandlerNoNewline( logging.StreamHandler ): <NEW_LINE> <INDENT> def emit( self, record ): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> msg = self.format( record ) <NEW_LINE> fs = '%s' <NEW_LINE> if not hasattr( types, 'UnicodeType' ): <NEW_LINE> <INDENT> self.stream.write( fs % msg ) <NEW_LINE> <DEDENT> else... | StreamHandler that doesn't print newlines by default.
Since StreamHandler automatically adds newlines, define a mod to more
easily support interactive mode when we want it, or errors-only logging
for running unit tests. | 62598f64be8e80087fbbe6f3 |
class TableModel: <NEW_LINE> <INDENT> tableName = "" <NEW_LINE> def __del__(self): <NEW_LINE> <INDENT> Database.closeDb() <NEW_LINE> <DEDENT> def getTableName(self): <NEW_LINE> <INDENT> return self.tableName <NEW_LINE> <DEDENT> def getOne(self, filters=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return self._ge... | This class is the common ancestor of the table objects.
Each table object represents database tables | 62598f64d10714528d69d566 |
class ConvMeanPool(nn.Module): <NEW_LINE> <INDENT> def apply(self, inputs, output_dim, kernel_size=3, biases=True): <NEW_LINE> <INDENT> output = nn.Conv( inputs, features=output_dim, kernel_size=(kernel_size, kernel_size), strides=(1, 1), padding='SAME', bias=biases) <NEW_LINE> output = sum([ output[:, ::2, ::2, :], ou... | ConvMeanPool for building the ResNet backbone. | 62598f6491af0d3eaad394a3 |
class ErrorCodes(Enum): <NEW_LINE> <INDENT> COMMANDE_NOT_SUPPORTED = 405 <NEW_LINE> TV_UNREACHEABLE = 408 | List of error status
| 62598f64a8ecb0332587089f |
class GlobalAvgPooling2D(BaseModule): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(GlobalAvgPooling2D, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> self.in_features = x <NEW_LINE> output = global_avg_pooling_forward(x) <NEW_LINE> return output <NE... | 全局平均池化 | 62598f64d18da76e235b6c83 |
class Window(SurfaceTypeBase): <NEW_LINE> <INDENT> typeId = 5 <NEW_LINE> radiance_material = Glass.by_single_trans_value("generic_glass", 0.60) | Window surfaces. | 62598f646e29344779affcf4 |
class EB_ifort(EB_icc, IntelBase): <NEW_LINE> <INDENT> def sanity_check_step(self): <NEW_LINE> <INDENT> binprefix = "bin/intel64" <NEW_LINE> libprefix = "lib/intel64/lib" <NEW_LINE> if LooseVersion(self.version) >= LooseVersion("2011"): <NEW_LINE> <INDENT> if LooseVersion(self.version) <= LooseVersion("2011.3.174"): <N... | Class that can be used to install ifort
- tested with 11.1.046
-- will fail for all older versions (due to newer silent installer) | 62598f6421a7993f00c65614 |
class _Shape(object): <NEW_LINE> <INDENT> def __init__(self, method_for_drawing): <NEW_LINE> <INDENT> self._method_for_drawing = method_for_drawing <NEW_LINE> <DEDENT> def attach_to(self, rose_canvas): <NEW_LINE> <INDENT> rose_canvas._draw(self) | A Shape is a thing that can be drawn on a RoseCanvas
(which itself draws on a tkinter Canvas).
Its constructor provides the tkinter method to be used to
draw this Shape.
This abstract type has concrete subclasses that include:
Arc, Bitmap, Circle, Ellipse, Image, Line, Path, Polygon,
Rectangle, RoundedRectangle, ... | 62598f64711fe17d825dfd8e |
class RunInformationFlowcellLayout(object): <NEW_LINE> <INDENT> def __init__(self, lane_count=0, surface_count=0, swath_count=0, tile_count=0): <NEW_LINE> <INDENT> self.lane_count = lane_count <NEW_LINE> self.surface_count = surface_count <NEW_LINE> self.swath_count = swath_count <NEW_LINE> self.tile_count = tile_count | The C{RunInformationFlowcellLayout} class models
one <FlowcellLayout> XML element in an Illumina Run Information (RunInfo.xml) document. | 62598f64be8e80087fbbe6f5 |
class AtagConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): <NEW_LINE> <INDENT> VERSION = 1 <NEW_LINE> CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL <NEW_LINE> async def async_step_user(self, user_input=None): <NEW_LINE> <INDENT> if not user_input: <NEW_LINE> <INDENT> return await self._show_form() <NEW_L... | Config flow for Atag. | 62598f64925a0f43d25e76d3 |
class ExceptionHandlingThread(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(ExceptionHandlingThread, self).__init__(**kwargs) <NEW_LINE> self.daemon = True <NEW_LINE> self.kwargs = kwargs <NEW_LINE> self.exc_info = None <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDE... | Thread handler making it easier for parent to handle thread exceptions.
Based in part on Fabric 1's ThreadHandler. See also Fabric GH issue #204. | 62598f6466673b3332c2fa57 |
class TestHealthCheckVlanRange(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 testHealthCheckVlanRange(self): <NEW_LINE> <INDENT> pass | HealthCheckVlanRange unit test stubs | 62598f649b70327d1c57e442 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.