code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class BobSomUserFactory(SomUserFactory): <NEW_LINE> <INDENT> username = 'Bob' <NEW_LINE> www_soci = 999 | Bob acts as already virtual assembly register member | 62598f5dac7a0e7691f71ad6 |
class Message(models.Model): <NEW_LINE> <INDENT> created = models.DateTimeField(default=timezone.now, editable=False) <NEW_LINE> content_plain = models.TextField(verbose_name='Message') <NEW_LINE> author = models.ForeignKey( ForumUser, related_name='pvt_messages', on_delete=models.CASCADE) <NEW_LINE> conversation = mod... | A message. | 62598f5d91af0d3eaad393ce |
class Event: <NEW_LINE> <INDENT> def get_id(self) -> Tuple[type, int]: <NEW_LINE> <INDENT> pass | Base abstract class that represents an input event, regardless of device | 62598f5d0383005118f6cccc |
class Executor: <NEW_LINE> <INDENT> def __init__(self, namespace, instance): <NEW_LINE> <INDENT> self.namespace = namespace <NEW_LINE> self.instance = instance <NEW_LINE> <DEDENT> async def subscribe_call(self, publisher: Publisher): <NEW_LINE> <INDENT> for i in range(0, 20): <NEW_LINE> <INDENT> if publisher.is_active:... | Default executor implementation, override if necessary | 62598f5dbe8e80087fbbe620 |
class MissingConfigError(pywikibot.Error): <NEW_LINE> <INDENT> pass | The config is missing in the header.
It's in one of the threads or transcluded from another page. | 62598f5d925a0f43d25e75fb |
class XBuiltin(SchemaObject): <NEW_LINE> <INDENT> def __init__(self, schema, name): <NEW_LINE> <INDENT> root = Element(name) <NEW_LINE> SchemaObject.__init__(self, schema, root) <NEW_LINE> self.name = name <NEW_LINE> self.nillable = True <NEW_LINE> <DEDENT> def namespace(self, prefix=None): <NEW_LINE> <INDENT> return N... | Represents an (XSD) schema <xs:*/> node. | 62598f5d167d2b6e312b6543 |
class StudentT(ShiftScaleDistribution): <NEW_LINE> <INDENT> def __init__(self, df=1, mu=0, sigma=1): <NEW_LINE> <INDENT> super(StudentT, self).__init__( dist=student_t(df), scale=sigma, shift=mu, ) <NEW_LINE> self._repr_args = [df] <NEW_LINE> self._repr_args += chaospy.format_repr_kwargs(mu=(mu, 0)) <NEW_LINE> self._re... | (Non-central) Student-t distribution.
Args:
df (float, Distribution):
Degrees of freedom.
loc (float, Distribution):
Location parameter.
scale (float, Distribution):
Scale parameter.
Examples:
>>> distribution = chaospy.StudentT(10)
>>> distribution
StudentT(10)
>>>... | 62598f5da8ecb033258707c9 |
class MacTableEntry(object): <NEW_LINE> <INDENT> swagger_types = { 'vtep_mac_address': 'str', 'vtep_ip': 'str', 'mac_address': 'str' } <NEW_LINE> attribute_map = { 'vtep_mac_address': 'vtep_mac_address', 'vtep_ip': 'vtep_ip', 'mac_address': 'mac_address' } <NEW_LINE> def __init__(self, vtep_mac_address=None, vtep_ip=No... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f5d507cdc57c63a4364 |
class RepositoryNotFoundException(ThothGlyphException): <NEW_LINE> <INDENT> pass | An exception raised when Git repository cannot be found. | 62598f5d66673b3332c2f980 |
class EX1_258: <NEW_LINE> <INDENT> events = Play(CONTROLLER, OVERLOAD).on(Buff(SELF, "EX1_258e")) | Unbound Elemental | 62598f5d9b70327d1c57e36e |
class TestRunner: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.failures = [] <NEW_LINE> <DEDENT> def clean(self): <NEW_LINE> <INDENT> if os.path.isdir("build"): <NEW_LINE> <INDENT> self.clean() <NEW_LINE> <DEDENT> <DEDENT> def run_file(self, executable_path: str) -> int: <NEW_LINE> <INDENT> raise No... | Deals with running tests and storing results,
and presenting those results to the user | 62598f5d91af0d3eaad393d0 |
class AdditionalFlagNeeded(Exception): <NEW_LINE> <INDENT> pass | Raised to indicate that for this specific case of migration the user is obliged
to specify a flag which could otherwise have been omitted. | 62598f5d462c4b4f79dbafcd |
class SockFamily(ParsingClass): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> if "sa_family=" not in value: <NEW_LINE> <INDENT> raise Exception("Unexpected argument when parsing SockFamily object: " + value) <NEW_LINE> <DEDENT> value = value[value.find("sa_family=")+10:] <NEW_LINE> if not value.sta... | A SockFamily object can only appear as part of the Sockaddr object. | 62598f5d711fe17d825dfcbe |
class SR11025(AudioSampleRate): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SR11025, self).__init__(11025, 512, 256) | A :class:`SampleRate` representing the common audio sampling rate 11.025kHz
Examples:
>>> from zounds import SR11025
>>> sr = SR11025()
>>> sr.samples_per_second
11025
>>> int(sr)
11025
>>> sr.nyquist
5512 | 62598f5dd164cc6175820540 |
class AAssociationMining (object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._minimumSupport = 0.2; <NEW_LINE> self._minimumConfidence = 0.8; <NEW_LINE> self._testQueue = deque(); <NEW_LINE> self._searchStart = []; <NEW_LINE> <DEDENT> def setVectors(self,vectors): <NEW_LINE> <INDENT> log.debug("v... | AssociationMining is the class that
enable you to mine in data, the data must be supplied in binary vectors of
the same size.
It is possible to denote the starting position, but if it is not set the
search for associations will continue through the entire tree.
To minimize the search | 62598f5dd18da76e235b6c1a |
class Handle(object): <NEW_LINE> <INDENT> def __init__(self, argv): <NEW_LINE> <INDENT> self.argv = argv <NEW_LINE> <DEDENT> def __call__(self, path='/'): <NEW_LINE> <INDENT> website = Website(self.argv) <NEW_LINE> request = StubRequest(path) <NEW_LINE> request.website = website <NEW_LINE> response = website.handle(req... | Stub out website.handle with set configuration.
| 62598f5d287bf620b6271181 |
class LikeSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Like <NEW_LINE> fields = ('id', 'post_id', 'user_id',) <NEW_LINE> validators = [ CustomUniqueTogetherValidator( queryset=Like.objects.all(), fields=('post_id', 'user_id') ) ] | like create / delete | 62598f5d462c4b4f79dbafcf |
class c_jtag_apb_time_test_time_slow(c_jtag_apb_time_test_base): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> self.jtag_reset() <NEW_LINE> self.jtag_write_irs(ir_bits = bits_of_n(5,0x10)) <NEW_LINE> self.jtag_write_drs(dr_bits = bits_of_n(32,0)) <NEW_LINE> timer_readings = [] <NEW_LINE> for i in range(5): <NE... | Test the TAP controller, APB master, and APB reads work to timer, by reading timer and expecting it to provide repeatable timer reads | 62598f5d56b00c62f0fb1e80 |
class RecipeImageUploadTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.user = get_user_model().objects.create_user( 'user@apparanto.com', 'test12345' ) <NEW_LINE> self.client.force_authenticate(self.user) <NEW_LINE> self.recipe = test_recipe(user=self.... | Tests for the recipe image upload feature | 62598f5d167d2b6e312b6547 |
class ToggleSwitch(Switch): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Switch.__init__(self) | An interface/base for toggle switch device abstractions. | 62598f5d287bf620b6271183 |
class alpha_l(Variable): <NEW_LINE> <INDENT> unit = watt / watt | Leaf albedo, fraction of shortwave radiation reflected by the leaf | 62598f5d5e10d32532ce33cd |
class _SectionBuilds(_Section): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(_SectionBuilds, self).__init__('builds') <NEW_LINE> self.timeout = self._Add( 'timeout', validator=_BuildTimeoutValidator, help_text='Timeout, in seconds, to wait for builds to complete.') <NEW_LINE> self.check_tag = self.... | Contains the properties for the 'builds' section. | 62598f5dac7a0e7691f71adc |
class LinkedList: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.head = None <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> nodes = [] <NEW_LINE> current = self.head <NEW_LINE> while current: <NEW_LINE> <INDENT> nodes.append(repr(current)) <NEW_LINE> current = current.next <NEW_LINE> <DED... | Create new singly linked list. | 62598f5d8c3a8732951f5b1f |
class Ch07TestSuite(unittest.TestCase): <NEW_LINE> <INDENT> def test_make_changes(self): <NEW_LINE> <INDENT> denom = [10000, 5000, 2000, 1000, 500, 200, 100, 50, 25, 10, 5, 1] <NEW_LINE> owed = 5632 <NEW_LINE> payed = [] <NEW_LINE> result = [5000, 500, 100, 25, 5, 1, 1] <NEW_LINE> for d in denom: <NEW_LINE> <INDENT> wh... | Basic test cases. | 62598f5dff9c53063f519c1d |
class Person: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name = "" <NEW_LINE> self.age = 0 <NEW_LINE> print("父亲") <NEW_LINE> <DEDENT> def study(self): <NEW_LINE> <INDENT> print("人学习") | 构造函数有参数的情况
子类必须给父亲构造函数赋值 | 62598f5d1d351010ab8f311d |
class IgniteLibsMixin(IgniteMixin): <NEW_LINE> <INDENT> DEFAULT_MODULES = [ 'ignite-spring', 'ignite-zookeeper', 'ignite-indexing', 'ignite-log4j2', 'gridgain-ultimate', ] <NEW_LINE> modules = [] <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> self.module... | Provides classpath generation for Ignite start methods | 62598f5d8c3a8732951f5b20 |
class testcases: <NEW_LINE> <INDENT> uic_testcases = ( '000-000-0', '182 002-6', '220 071-5', '21 80 155 9 084-5', '21-81-2471217-3', '31 RIV 81 ÖBB 665 0 286-0', '33 RIV 70 BR 7899 047-6', '37 TEN RIV 84 N̲L̲-GERS 4667 019-2 Sfhimmns', '37.84.4667.019-2', '51-80-0843001-0', '01 RIV\n83 FS\n575 0 421-8', '60 80 99 26 1... | Examples of valid rolling stock numbers for
testing and experimentation.
uic_testcases (list): European UIC rolling stock examples | 62598f5d5e10d32532ce33ce |
class IPythonProcessor(JupyterProcessor): <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> super(IPythonProcessor, self).__init__(*args) <NEW_LINE> if config.rcParams["usematplotlib"]: <NEW_LINE> <INDENT> self.init_matplotlib() <NEW_LINE> <DEDENT> <DEDENT> def init_matplotlib(self): <NEW_LINE> <INDENT... | Contains IPython specific functions | 62598f5ea8ecb033258707d1 |
class LateralConnection(Connection): <NEW_LINE> <INDENT> def __init__(self, pre_layer, post_layer=None, weight=None, learning=True, learning_type=LearningType.NONE, learning_rate=1e-7): <NEW_LINE> <INDENT> if post_layer is None: <NEW_LINE> <INDENT> post_layer = pre_layer <NEW_LINE> <DEDENT> if weight is None: <NEW_LINE... | Define a connection between neurons of the same layer for lateral inhibition. | 62598f5e21a7993f00c65545 |
class TimeRecord(models.Model): <NEW_LINE> <INDENT> TIME_OF_SHIFT_CHOICES = ( ('6AM - 5PM', '6AM - 5PM'), ('8AM - 7PM', '8AM - 7PM'), ('7PM - 6AM', '7PM - 6AM'), ('9PM - 8AM', '9PM - 8AM'), ) <NEW_LINE> employee = models.ForeignKey( Employee, on_delete=models.CASCADE, related_name='time_record_employee') <NEW_LINE> emp... | Time record model | 62598f5ebf627c535bcb0a4d |
class TBPlugin(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> @abstractmethod <NEW_LINE> def get_plugin_apps(self, multiplexer, logdir): <NEW_LINE> <INDENT> raise NotImplementedError() | TensorBoard plugin interface. Every plugin must extend from this class. | 62598f5e76d4e153a661c1e0 |
class TestLasso_equivalence_complex(TestLasso_equivalence): <NEW_LINE> <INDENT> def randn(self, *shape): <NEW_LINE> <INDENT> return xp.array(self.rng.randn(*shape) + self.rng.randn(*shape) * 1.0j) | All the methods should get the global minimum. | 62598f5e0383005118f6ccd6 |
class DataQualityOperator(BaseOperator): <NEW_LINE> <INDENT> ui_color = '#89DA59' <NEW_LINE> @apply_defaults <NEW_LINE> def __init__(self, redshift_conn_id='redshift', sql_check_queries=[], expected_results=[], *args, **kwargs): <NEW_LINE> <INDENT> super(DataQualityOperator, self).__init__(*args, **kwargs) <NEW_LINE> s... | :param redshift_conn_id: Connection id of the Redshift connection to use
:type redshift_conn_id: str
:param sql_check_queries: List of SQL queries for data quality checks
:type sql_check_queries: list
:param expected_results: List of lambda expressions for predicates to validate data quality query results
i.e. [l... | 62598f5e91af0d3eaad393d8 |
class wizard_priority_wo(models.TransientModel): <NEW_LINE> <INDENT> _name = 'wizard.priority.wo' <NEW_LINE> _description = 'Wizard priority wo' <NEW_LINE> _rec_name = 'planning_priority' <NEW_LINE> @api.model <NEW_LINE> def default_get(self, fields_list): <NEW_LINE> <INDENT> res = super(wizard_priority_wo, self).defau... | Wizard priority wo | 62598f5e462c4b4f79dbafd5 |
class Square(Shape): <NEW_LINE> <INDENT> def __init__(self, length, breadth): <NEW_LINE> <INDENT> self.length = length <NEW_LINE> self.breadth = breadth | This class also inherit shape class. | 62598f5e711fe17d825dfcc6 |
class QQAPIException(Exception): <NEW_LINE> <INDENT> pass | QQAPI调用异常类 | 62598f5ea8ecb033258707d3 |
class Meta: <NEW_LINE> <INDENT> resource_name = 'Test api' <NEW_LINE> resp_template = 'baseapp/api-test.html' <NEW_LINE> resp_message = 'good' <NEW_LINE> resp_success = True <NEW_LINE> data = dict() <NEW_LINE> data['test'] = 'All good!!!' <NEW_LINE> resp_render_data = render_to_string(resp_template, data) | через метакласс можно задавать параметры для всего api
но их так же можно задать\переопределить и в обработчиках | 62598f5e8c3a8732951f5b23 |
class RemoteProjectDeployError(RemoteProjectException): <NEW_LINE> <INDENT> pass | . | 62598f5e76d4e153a661c1e2 |
class PresenceActivity: <NEW_LINE> <INDENT> UNKNOWN = 0 <NEW_LINE> AWAY = 1 <NEW_LINE> BUSY = 2 | Presence activities constants.
Member documentation:
UNKNOWN -- the person activity is unknown
AWAY -- the person is currently away
BUSY -- the person is currently engaging in other activity | 62598f5e8c3a8732951f5b24 |
class BatchNNSet(BruteForceNNSet): <NEW_LINE> <INDENT> def add(self, x, y=None, uuid=None): <NEW_LINE> <INDENT> if not self._check_uuid(uuid): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> self._size += 1 <NEW_LINE> obs = [x] if y is None else [x, y] <NEW_LINE> if self.shape is None: <NEW_LINE> <INDENT> self.shape ... | Hold observations an provide nearest neighbors facilities | 62598f5ebe8e80087fbbe62a |
class Repeatable(Base): <NEW_LINE> <INDENT> def __init__(self, name, parent, wsdl_type, update_parent=True): <NEW_LINE> <INDENT> super().__init__(name, parent, wsdl_type, update_parent) <NEW_LINE> self.__repeatable = True <NEW_LINE> self.__elements = list() <NEW_LINE> self.append() <NEW_LINE> <DEDENT> def __getitem__(s... | Repeatable Elements are like normal elements, except their values are left as iterables, not scalars | 62598f5e5166f23b2e2429ad |
class Lexer(object): <NEW_LINE> <INDENT> def __init__(self, text): <NEW_LINE> <INDENT> self.text = text <NEW_LINE> self.pos = 0 <NEW_LINE> self.current_char = self.text[self.pos] <NEW_LINE> <DEDENT> def error(self): <NEW_LINE> <INDENT> raise LexerException('Invalid character') <NEW_LINE> <DEDENT> def next_char(self): <... | Лексер для лексического разбора команды | 62598f5e711fe17d825dfcc8 |
class RegistrationOption(models.Model): <NEW_LINE> <INDENT> ADMIN_ONLY_HELP = "If checked, this option will only be available "+ "when registering through the admin interface." <NEW_LINE> meeting = models.ForeignKey(Meeting, related_name="regoptions") <NEW_LINE> option_name = models.CharField(max_l... | Model for storing the options and prices for people registering | 62598f5e6fece00bbaccaf65 |
class Gene(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.effects = {} | Contains phenotype and genotype for a specific gene. | 62598f5e287bf620b627118b |
class BarOcculter(AnalyticImagePlaneElement): <NEW_LINE> <INDENT> @utils.quantity_input(width=u.arcsec, height=u.arcsec) <NEW_LINE> def __init__(self, name="bar occulter", width=1.0*u.arcsec, height=10.0*u.arcsec, **kwargs): <NEW_LINE> <INDENT> AnalyticImagePlaneElement.__init__(self, **kwargs) <NEW_LINE> self.name = n... | Defines an ideal bar occulter (like in MIRI's Lyot coronagraph)
Parameters
----------
name : string
Descriptive name
width : float
width of the bar stop, in arcseconds. Default is 1.0
height: float
heightof the bar stop, in arcseconds. Default is 10.0 | 62598f5ebe8e80087fbbe62c |
class HMMTrainer(object): <NEW_LINE> <INDENT> def __init__(self, model_name='GaussianHMM', n_components=4, cov_type='diag', n_iter=1000): <NEW_LINE> <INDENT> self.model_name = model_name <NEW_LINE> self.n_components = n_components <NEW_LINE> self.cov_type = cov_type <NEW_LINE> self.n_iter = n_iter <NEW_LINE> self.model... | 用到高斯隐马尔科夫模型
n_components:定义了隐藏状态的个数
cov_type:定义了转移矩阵的协方差类型
n_iter:定义了训练的迭代次数 | 62598f5e56b00c62f0fb1e8a |
class WrenchFromCsvROS(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.component_data_ = wrench_from_csv_impl.WrenchFromCsvData() <NEW_LINE> self.component_config_ = wrench_from_csv_impl.WrenchFromCsvConfig() <NEW_LINE> self.component_implementation_ = wrench_from_csv_impl.WrenchFromCsvImpleme... | ROS interface class, handling all communication with ROS | 62598f5ea8ecb033258707d7 |
class CheetahCompilationException(Exception): <NEW_LINE> <INDENT> pass | Cheetah template compilation exception. | 62598f5e6fece00bbaccaf67 |
class BOWGroupExtractor(FeatureGroupExtractor): <NEW_LINE> <INDENT> def __init__(self, instances: List[ShortAnswerInstance]): <NEW_LINE> <INDENT> self.bag = self.train_bag(" ".join([x.answer for x in instances])) <NEW_LINE> <DEDENT> def extract(self, instances: List[ShortAnswerInstance]) -> DataFrame: <NEW_LINE> <INDEN... | A subclass of GroupFeatureExtractor which extracts bag of words features from
a list of ShortAnswerInstances and stores them as features in a pandas DataFrame.
For identification purposes, "learnerId" of each ShortAnswerInstance will be stored
as a separate column ('ID').
*** IMPORTANT ***: when instantiating the class... | 62598f5e507cdc57c63a4372 |
class ToIOBES(object): <NEW_LINE> <INDENT> def __init__(self, iterable, tagField): <NEW_LINE> <INDENT> self.iterable = iterable <NEW_LINE> self.tagField = tagField <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> for sent in self.iterable: <NEW_LINE> <INDENT> l = len(sent) <NEW_LINE> for i, tok in enumerate(... | Convert from IOB to IOBES notation:
Begin
Inside
Outside
Single
End | 62598f5e8c3a8732951f5b28 |
class CONBorg(CONObject): <NEW_LINE> <INDENT> _attribute_definitions = (()) <NEW_LINE> _signal_list = (()) <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> if self.__class__ not in CONObject._class_registry: <NEW_LINE> <INDENT> CONObject._register_class(self.__class__) <NEW_LINE> <DEDENT> if '_callbacks' not in self.... | This class provides a borg pattern for CONObjects.
The borg pattern is similar to the singleton pattern in that it provides access
to a single data set. unlike a singleton where there is only one object instance,
in the borg pattern each object shares the same data. | 62598f5ed164cc617582054d |
class TestPlotImage(unittest.TestCase): <NEW_LINE> <INDENT> def test_plot_image(self): <NEW_LINE> <INDENT> path = os.path.join( colour.__path__[0], "..", "docs", "_static", "Logo_Medium_001.png" ) <NEW_LINE> if not os.path.exists(path): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> figure, axes = plot_image(read_image... | Define :func:`colour.plotting.common.plot_image` definition unit tests
methods. | 62598f5e167d2b6e312b6553 |
class Bay(EquipmentContainer): <NEW_LINE> <INDENT> def __init__(self, busBarConfiguration="mainWithTransfer", breakerConfiguration="breakerAndAHalf", bayPowerMeasFlag=False, bayEnergyMeasFlag=False, Substation=None, VoltageLevel=None, *args, **kw_args): <NEW_LINE> <INDENT> self.busBarConfiguration = busBarConfiguration... | A collection of power system resources (within a given substation) including conducting equipment, protection relays, measurements, and telemetry.
| 62598f5ea8ecb033258707d9 |
@six.add_metaclass(abc.ABCMeta) <NEW_LINE> class Parameterized(object): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def _params(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> @abc.abstractmethod <NEW_LINE> def get_hyper(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DE... | Interface for objects that are parameterized by some set of
hyperparameters. | 62598f5ebf627c535bcb0a55 |
class DraftContentChecker(object): <NEW_LINE> <INDENT> def __init__(self, content, default=None): <NEW_LINE> <INDENT> self.draft = False <NEW_LINE> if IContent.providedBy(content): <NEW_LINE> <INDENT> while content is not None: <NEW_LINE> <INDENT> if IDraftContent.providedBy(content): <NEW_LINE> <INDENT> self.draft = T... | >>> from zojax.content.type.item import Item
>>> class Content(Item):
... interface.implements(IContent)
>>> content = Content()
>>> DraftContentChecker(content).draft
False
>>> from zojax.content.draft.draft import DraftContent
>>> draft = DraftContent(content)
>>> DraftContentChecker(content).draft
True | 62598f5e76d4e153a661c1e8 |
class TransformPen(Pen): <NEW_LINE> <INDENT> ALLOWED_TRANSFORMS = ['crop', 'resize'] <NEW_LINE> transforms = PenParameter('transforms', validator=transform_validator) <NEW_LINE> def draw(self, canvas): <NEW_LINE> <INDENT> for t in self.transforms: <NEW_LINE> <INDENT> canvas.image.transform(**t) | For cropping or resizing image | 62598f5e56b00c62f0fb1e8e |
class Movie(): <NEW_LINE> <INDENT> valid_ratings = ["G", "PG", "R"] <NEW_LINE> def __init__(self,movie_name,movie_storyline,movie_poster,movie_trailer): <NEW_LINE> <INDENT> self.title = movie_name <NEW_LINE> self.storyline = movie_storyline <NEW_LINE> self.poster_url = movie_poster <NEW_LINE> self.trailer_url = movie_t... | this class stores movie related information | 62598f5e925a0f43d25e760d |
class Voxel: <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.volume = float(data.split(' ')[0]) <NEW_LINE> self.row = float(data.split(' ')[1]) <NEW_LINE> self.column = float(data.split(' ')[2]) <NEW_LINE> self.bucket = float(data.split(' ')[3]) <NEW_LINE> self.ADC = float(data.split(' ')[4]) <NE... | A class to store the parameters of each voxel | 62598f5e66673b3332c2f992 |
class Tax(object): <NEW_LINE> <INDENT> openapi_types = { 'display_name': 'str', 'name': 'str', 'tax_amount': 'float', 'tax_rate': 'float' } <NEW_LINE> attribute_map = { 'display_name': 'displayName', 'name': 'name', 'tax_amount': 'taxAmount', 'tax_rate': 'taxRate' } <NEW_LINE> def __init__(self, display_name=None, name... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 62598f5e5e10d32532ce33d4 |
class InvalidYamlDataError(DescriptionError): <NEW_LINE> <INDENT> pass | Error raised when some data in the YAML file is not properly configured. | 62598f5e9b70327d1c57e380 |
class Message(models.Model): <NEW_LINE> <INDENT> text = models.TextField() <NEW_LINE> updated = models.DateTimeField(default=timezone.now) <NEW_LINE> timestamp = models.DateTimeField(auto_now_add=True) <NEW_LINE> room = models.ForeignKey(Room, related_name="messages", on_delete=models.CASCADE,) | ... | 62598f5e63f4b57ef008585c |
class EmailAuthBackend(ModelBackend): <NEW_LINE> <INDENT> def authenticate(self, username=None, password=None, **kwargs): <NEW_LINE> <INDENT> user = User.objects.filter(email__iexact=username, is_active=True).first() <NEW_LINE> if user and user.check_password(password): <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDEN... | Login by email and password | 62598f5eac7a0e7691f71aea |
class RSS(grok.View): <NEW_LINE> <INDENT> grok.context(IStoryline) <NEW_LINE> grok.layer(IGiesingLayer) <NEW_LINE> grok.template('storyline_rss') <NEW_LINE> def update(self): <NEW_LINE> <INDENT> catalog = getToolByName(self.context, 'portal_catalog') <NEW_LINE> self.object_list = catalog(path='/'.join(self.context.getP... | A storyline specific RSS view | 62598f5e56b00c62f0fb1e90 |
class SortableMixin: <NEW_LINE> <INDENT> sort_field_paremeter_name = "sort" <NEW_LINE> sort_direction_paremeter_name = "sort_dir" <NEW_LINE> sort_pass_silently = False <NEW_LINE> default_sort_direction = "asc" <NEW_LINE> sort_model_class = None <NEW_LINE> def _get_order_field(self, **kwargs): <NEW_LINE> <INDENT> try: <... | Enables custom sorting by a field specified by the user
See the example of :ref:`pagination-and-sorting-recipe` to learn
how is it used.
Works for both workspaced and non-workspaced views. | 62598f5e4d74a7450cd589c5 |
class _Tree: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.headerList = [] <NEW_LINE> self.mapItemNodes = {} <NEW_LINE> self.mapItemLastNodes = {} <NEW_LINE> self.root = _Node() <NEW_LINE> <DEDENT> def addTransaction(self, transaction): <NEW_LINE> <INDENT> current = self.root <NEW_LINE> for i in tran... | A class used to represent the frequentPatternGrowth tree structure
Attributes:
----------
headerList : list
storing the list of items in tree sorted in ascending of their supports
mapItemNodes : dictionary
storing the nodes with same item name
mapItemLastNodes : dictionary
repre... | 62598f5e711fe17d825dfcd0 |
class PolynomialKernel(AbstractKernel): <NEW_LINE> <INDENT> def __init__(self, train_features, degree=2, gamma=1.0, coef0=0, bias=0.0, bvectors=None): <NEW_LINE> <INDENT> if bvectors != None: <NEW_LINE> <INDENT> train_features = train_features[bvectors] <NEW_LINE> <DEDENT> X = train_features <NEW_LINE> self.train_X = X... | Polynomial kernel.
k(xi,xj) = (gamma * <xi, xj> + coef0)**degree + bias
Parameters
----------
train_features: {array-like, sparse matrix}, shape = [n_samples, n_features]
Data matrix
gamma : float, optional (default 1.0)
Kernel parameter
coef0 : float, optional (default 0.)
Kernel parameter
degree : float... | 62598f5e91af0d3eaad393e2 |
class ForwardChar(QtmacsMacro): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.qteSetAppletSignature('*') <NEW_LINE> self.qteSetWidgetSignature('QtmacsScintilla') <NEW_LINE> <DEDENT> def qteRun(self): <NEW_LINE> <INDENT> self.qteWidget.SendScintilla(self.qteWidget.SCI_CHA... | Move cursor one character to the right.
|Signature|
* *applet*: '*'
* *widget*: ``QtmacsScintilla`` | 62598f5e66673b3332c2f994 |
class City(CommonModel): <NEW_LINE> <INDENT> code = models.CharField(u"城市编码", max_length=32) <NEW_LINE> name = models.CharField(u"城市名称", max_length=32) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = u'城市' <NEW_LINE> verbose_name_plural = verbose_name | 城市 | 62598f5e507cdc57c63a4378 |
class CompressionConfig(object): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> self._program = kwargs.get('program', COMPRESSION_MODIFIERS.keys()[0]) <NEW_LINE> if self.program not in COMPRESSION_MODIFIERS: <NEW_LINE> <INDENT> raise ConfigurationError( 'Unsupported compression tool %s' % self.pr... | Compression configuration
:param program: compression program
:type program: str
:param threads: number of threads
:type threads: int
:param level: compression level
:type level: int | 62598f5ebe8e80087fbbe635 |
class ExpressRouteCircuitsRoutesTableSummaryListResult(Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[ExpressRouteCircuitRoutesTableSummary]'}, 'next_link': {'key': 'nextLink', 'type': 'str'}, } <NEW_LINE> def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: <NEW... | Response for ListRoutesTable associated with the Express Route Circuits
API.
:param value: A list of the routes table.
:type value:
list[~azure.mgmt.network.v2017_10_01.models.ExpressRouteCircuitRoutesTableSummary]
:param next_link: The URL to get the next set of results.
:type next_link: str | 62598f5e30c21e258be97de3 |
class PropertiesWindow(QtWidgets.QWidget): <NEW_LINE> <INDENT> def __init__(self, node): <NEW_LINE> <INDENT> QtWidgets.QWidget.__init__(self) <NEW_LINE> self._node = node <NEW_LINE> self.setWindowTitle(node.getName()) <NEW_LINE> self.setLayout(QtWidgets.QVBoxLayout()) <NEW_LINE> self._layout = self.layout() <NEW_LINE> ... | This defines node properties window. Input ports that are not
connected and are of some primitive type (like float, int, str, etc.) will
be editable. When connected, editing will be disabled as values are then
defined by connecting node. | 62598f5e56b00c62f0fb1e92 |
class FitnessFunc(object): <NEW_LINE> <INDENT> def __init__(self, p0=0.05, gamma=None): <NEW_LINE> <INDENT> self.p0 = p0 <NEW_LINE> self.gamma = gamma <NEW_LINE> <DEDENT> def validate_input(self, t, x, sigma): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def fitness(**kwargs): <NEW_LINE> <INDENT> raise NotImplementedEr... | Base class for fitness functions
Each fitness function class has the following:
- fitness(...) : compute fitness function.
Arguments accepted by fitness must be among [T_k, N_k, a_k, b_k, c_k]
- prior(N, Ntot) : compute prior on N given a total number of points Ntot | 62598f5e167d2b6e312b6559 |
class SnowflakeTo(): <NEW_LINE> <INDENT> def __init__(self, snowflake): <NEW_LINE> <INDENT> tt = snowflake_time(snowflake).timestamp() <NEW_LINE> d_timestamp = f"<t:{int(tt)}" <NEW_LINE> self.relative = d_timestamp + ":R>" <NEW_LINE> self.very_long = d_timestamp + ":F>" <NEW_LINE> self.longdate = d_timestamp + ":f>" <N... | Converting Discord Snowflakes to Discord timestamps. | 62598f5eff9c53063f519c2d |
class BitbucketOAuth(AuthBase): <NEW_LINE> <INDENT> def __init__(self, access_token): <NEW_LINE> <INDENT> self.access_token = access_token <NEW_LINE> <DEDENT> def __call__(self, r): <NEW_LINE> <INDENT> r.headers['Authorization'] = "Bearer {}".format(self.access_token) <NEW_LINE> return r | Adds the correct auth token for OAuth access to bitbucket.com | 62598f5e76d4e153a661c1ee |
class GraphConvolution(Layer): <NEW_LINE> <INDENT> def __init__(self, output_dim, support=1, init='glorot_uniform', activation='linear', weights=None, W_regularizer=None, b_regularizer=None, bias=False, **kwargs): <NEW_LINE> <INDENT> self.init = initializations.get(init) <NEW_LINE> self.activation = activations.get(act... | TODO: Docstring | 62598f5e8c3a8732951f5b30 |
class NewsDownloader(object): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(NewsDownloader, self).__init__() <NEW_LINE> self.headers = { 'Referer': 'http://www.businesswire.com/portal/site/home/news/', 'User-Agent': ( 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36' ' (KHTML, li... | docstring for NewsDownloader | 62598f5e6fece00bbaccaf71 |
class O365ConnectorCardOpenUriTarget(Model): <NEW_LINE> <INDENT> _attribute_map = { "os": {"key": "os", "type": "str"}, "uri": {"key": "uri", "type": "str"}, } <NEW_LINE> def __init__(self, *, os=None, uri: str = None, **kwargs) -> None: <NEW_LINE> <INDENT> super(O365ConnectorCardOpenUriTarget, self).__init__(**kwargs)... | O365 connector card OpenUri target.
:param os: Target operating system. Possible values include: 'default',
'iOS', 'android', 'windows'
:type os: str
:param uri: Target url
:type uri: str | 62598f5e76d4e153a661c1f0 |
class InheritanceDiagram(SphinxDirective): <NEW_LINE> <INDENT> has_content = False <NEW_LINE> required_arguments = 1 <NEW_LINE> optional_arguments = 0 <NEW_LINE> final_argument_whitespace = True <NEW_LINE> option_spec = { 'parts': int, 'private-bases': directives.flag, 'caption': directives.unchanged, 'top-classes': di... | Run when the inheritance_diagram directive is first encountered. | 62598f5eff9c53063f519c2f |
class IPv4Address(Decimal): <NEW_LINE> <INDENT> item_type = ItemClass.IPAddress <NEW_LINE> def __init__(self, byte_order='auto'): <NEW_LINE> <INDENT> super().__init__(bit_size=32, byte_order=byte_order) <NEW_LINE> <DEDENT> @property <NEW_LINE> def value(self): <NEW_LINE> <INDENT> return str(ipaddress.IPv4Address(self._... | An `IPv4Address` field is an unsigned :class:`Decimal` field with a fix
*size* of four bytes and returns its field :attr:`value` as an IPv4 address
formatted string.
:param byte_order: byte order used to unpack and pack the :attr:`value`
of the `IPv4Address` field.
:type byte_order: :class:`Byteorder`, :class:`str... | 62598f5e8c3a8732951f5b31 |
class BeliefState(object): <NEW_LINE> <INDENT> MY_ID = 'BeliefState' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.config = get_config() <NEW_LINE> self.logger = getLogger(self.MY_ID) <NEW_LINE> <DEDENT> def new_dialogue(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def update(self, user_da, last_sys_da... | Abstract BeliefState Class | 62598f5e8c3a8732951f5b32 |
class BaseMatcher: <NEW_LINE> <INDENT> def __init__(self, threshold: float = 0.5, thresholds=None): <NEW_LINE> <INDENT> self.threshold: float = threshold <NEW_LINE> self.thresholds: dict = thresholds or {} <NEW_LINE> <DEDENT> def fit(self, texts, labels): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDE... | A base class for text classification with confidence | 62598f5ed164cc6175820557 |
class StylusPlugin(CLTransformer): <NEW_LINE> <INDENT> def __init__(self, site): <NEW_LINE> <INDENT> super(StylusPlugin, self).__init__(site) <NEW_LINE> <DEDENT> def begin_site(self): <NEW_LINE> <INDENT> for resource in self.site.content.walk_resources(): <NEW_LINE> <INDENT> if resource.source_file.kind == 'styl': <NEW... | The plugin class for less css | 62598f5e56b00c62f0fb1e96 |
class DurationConverter(models.AbstractModel): <NEW_LINE> <INDENT> _name = 'ir.qweb.field.duration' <NEW_LINE> _description = 'Qweb Field Duration' <NEW_LINE> _inherit = 'ir.qweb.field' <NEW_LINE> @api.model <NEW_LINE> def get_available_options(self): <NEW_LINE> <INDENT> options = super(DurationConverter, self).get_ava... | ``duration`` converter, to display integral or fractional values as
human-readable time spans (e.g. 1.5 as "1 hour 30 minutes").
Can be used on any numerical field.
Has an option ``unit`` which can be one of ``second``, ``minute``,
``hour``, ``day``, ``week`` or ``year``, used to interpret the numerical
field value b... | 62598f5e4d74a7450cd589c8 |
class RsLibrary2(object): <NEW_LINE> <INDENT> swagger_types = { 'code': 'object' } <NEW_LINE> attribute_map = { 'code': 'code' } <NEW_LINE> def __init__(self, code=None): <NEW_LINE> <INDENT> self._code = None <NEW_LINE> self.discriminator = None <NEW_LINE> if code is not None: <NEW_LINE> <INDENT> self.code = code <NEW_... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f5e167d2b6e312b655d |
class DatasetRandomSampler(SubsetRandomSampler): <NEW_LINE> <INDENT> def __init__(self, *datasets): <NEW_LINE> <INDENT> super().__init__(torch.arange(sum(map(len, datasets)))) | Standard Random Sampler but return indices from all datasets.
Example:
--------
For datasets of length [10000, 10000, 20000] will return sampler
yielding indices [0, 40000] (e.g. summed).
Yields
------
int
Index into one of datasets. | 62598f5e287bf620b6271199 |
class TestTinyPages(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setup_class(cls): <NEW_LINE> <INDENT> cls.page_build = tempfile.mkdtemp() <NEW_LINE> try: <NEW_LINE> <INDENT> cls.html_dir = pjoin(cls.page_build, 'html') <NEW_LINE> cls.doctree_dir = pjoin(cls.page_build, 'doctrees') <NEW_LINE> cmd = ['sphinx... | Test build and output of tinypages project | 62598f5e8c3a8732951f5b33 |
class AuthenticationToken(HyperwalletModel): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> super(AuthenticationToken, self).__init__(data) <NEW_LINE> self.defaults = { 'value': None, } <NEW_LINE> for (param, default) in self.defaults.items(): <NEW_LINE> <INDENT> setattr(self, param, data.get(param, ... | The AuthenticationToken Model.
:param data:
A dictionary containing the attributes for the Authentication Token. | 62598f5e167d2b6e312b655f |
class GameState(): <NEW_LINE> <INDENT> NORMAL = 0 <NEW_LINE> WON = 1 <NEW_LINE> LOST = 2 | Används för att veta spelets status efter varje drag. | 62598f5e167d2b6e312b6561 |
class LoginRequired(AuthError): <NEW_LINE> <INDENT> pass | Login is required to perform specified action. | 62598f5e925a0f43d25e7619 |
class AGIException(Exception): <NEW_LINE> <INDENT> items = None <NEW_LINE> def __init__(self, message, items=None): <NEW_LINE> <INDENT> Exception.__init__(self, message) <NEW_LINE> self.items = items if items else {} | The base exception from which all exceptions native to this module inherit. | 62598f5e6fece00bbaccaf76 |
class Tgjf(models.Model): <NEW_LINE> <INDENT> cfgsf = models.ForeignKey( "users.User", on_delete=models.CASCADE, related_name="tgjf_cfgsf", ) <NEW_LINE> sdasf = models.BigIntegerField(null=True, blank=True,) <NEW_LINE> safasdf = models.BigIntegerField(null=True, blank=True,) <NEW_LINE> erett = models.BigIntegerField(nu... | Generated Model | 62598f5ed164cc617582055c |
class ConflictTimeline: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def create(instance: Instance, solution, matrix): <NEW_LINE> <INDENT> timeline = timeline = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for t in range(instance.get_latest_time() + 1)] <NEW_LINE> for bf_id, converter_id in enumerate(solution): <NEW_LINE> <INDENT> ... | Maintains and mutates a conflict timeline. | 62598f5e66673b3332c2f99e |
class BlacklistGenerator(object): <NEW_LINE> <INDENT> def __init__(self, minimum_failures, success_to_failure_ratio, symbol_data_path): <NEW_LINE> <INDENT> self._minimum_failures = int(minimum_failures) <NEW_LINE> self._success_to_failure_ratio = float(success_to_failure_ratio) <NEW_LINE> self._symbol_data_path = symbo... | Module for generating and updating blacklisted stock symbols.
Methods:
GetBlacklist: Generates a blacklist using historical stock data.
UpdateBlacklist: Updates blacklist using success and failure symbol lists. | 62598f5e287bf620b627119d |
class Update(LoginRequiredMixin, generic.UpdateView): <NEW_LINE> <INDENT> form_class, model = forms.Comment, models.Comment <NEW_LINE> template_name = 'ticket/form.html' <NEW_LINE> def get_success_url(self): <NEW_LINE> <INDENT> return '{0}#{1}'.format(self.object.ticket.get_absolute_url(), self.object.id) | Edit a comment. | 62598f5e8c3a8732951f5b38 |
class Config: <NEW_LINE> <INDENT> def __init__(self, cfg): <NEW_LINE> <INDENT> config = ConfigParser.ConfigParser() <NEW_LINE> config.read(cfg) <NEW_LINE> for section in config.sections(): <NEW_LINE> <INDENT> setattr(self, section, Dictionary()) <NEW_LINE> for name, raw_value in config.items(section): <NEW_LINE> <INDEN... | Configuration file parser. | 62598f5e8c3a8732951f5b37 |
class ForumTestCase(CourseTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.course = CourseFactory.create(org='testX', number='727', display_name='Forum Course') <NEW_LINE> <DEDENT> def set_blackout_dates(self, blackout_dates): <NEW_LINE> <INDENT> self.course.discussion... | Tests class to verify course to forum operations | 62598f5eac7a0e7691f71af6 |
class DataSource(object): <NEW_LINE> <INDENT> def __init__(self, server_instance, request): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def GetRefreshPaths(self): <NEW_LINE> <INDENT> return [''] <NEW_LINE> <DEDENT> def Refresh(self, path=None): <NEW_LINE> <INDENT> raise NotImplementedError(self.__class__) <NEW_LINE> <... | Defines an abstraction for all DataSources.
DataSources must have two public methods, get and Refresh. A DataSource is
initialized with a ServerInstance and a Request (defined in servlet.py).
Anything in the ServerInstance can be used by the DataSource. Request is None
when DataSources are created for Refresh.
DataSo... | 62598f5e63f4b57ef0085862 |
class PrivateLinkResourceListResult(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, } <NEW_LINE> def __init__( self, *, value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): <NEW_LINE> <INDENT> super(PrivateLinkResourceListResult... | A list of private link resources.
:ivar value: Array of private link resources.
:vartype value: list[~api_management_client.models.PrivateLinkResource] | 62598f5e4d74a7450cd589cb |
class SciComb(object): <NEW_LINE> <INDENT> def __init__(self, sfile): <NEW_LINE> <INDENT> self.sfile = sfile <NEW_LINE> self.date = sfile[0].header['DATE-OBS'][0:10] <NEW_LINE> self.cube = np.nan_to_num(sfile[1].data) <NEW_LINE> self.bx, self.by = brighest_pix(self.cube) <NEW_LINE> self.bspec = self.cube[:, self.bx, se... | Class for combined science cube | 62598f5e91af0d3eaad393ee |
class Stride(object): <NEW_LINE> <INDENT> def __init__(self, api_key, endpoint=DEFAULT_API_ENDPOINT, timeout=30): <NEW_LINE> <INDENT> self.api_key = api_key <NEW_LINE> self._timeout = timeout <NEW_LINE> self._endpoint = endpoint <NEW_LINE> <DEDENT> def _get_request_kwargs(self): <NEW_LINE> <INDENT> return { 'auth': HTT... | Stride is the wrapper for the Stride API | 62598f5e21a7993f00c6555e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.