code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class PCA(object): <NEW_LINE> <INDENT> def __init__(self, x, n_components=None): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.dimension = x.shape[1] <NEW_LINE> if n_components and n_components >= self.dimension: <NEW_LINE> <INDENT> raise DimensionValueError("n_components error") <NEW_LINE> <DEDENT> self.n_components ...
定义PCA类
6259904f30c21e258be99c75
@register <NEW_LINE> @serializable <NEW_LINE> class CenterIOULoss(object): <NEW_LINE> <INDENT> def __init__(self, iou_loss_type='iou', with_ciou_term=False): <NEW_LINE> <INDENT> assert iou_loss_type in ['iou', 'linear_iou', 'giou'], "expected 'iou | giou | linear_iou', but got {}".format(iou_loss_type) <NEW_...
Using iou loss for bounding box regression Args: with_ciou_term (bool): whether to add complete iou term (considering the w/h ratio) iou_loss_type: wether to use giou to replace the normal iou
6259904f7cff6e4e811b6eac
class CardPickerElement(CardElement): <NEW_LINE> <INDENT> tag: Literal[CardTag.DATE_PICKER] = CardTag.DATE_PICKER <NEW_LINE> initial_date: Optional[str] = None <NEW_LINE> initial_time: Optional[str] = None <NEW_LINE> initial_datetime: Optional[str] = None <NEW_LINE> placeholder: Optional[str] = None <NEW_LINE> value: O...
datePicker元素 https://open.feishu.cn/document/ukTMukTMukTM/uQzNwUjL0cDM14CN3ATN Args: tag 可以是"date_picker", "picker_time", "picker_datetime" initial_date "YYYY-MM-DD" initial_time "HH:mm" initial_datetime "YYYY-MM-DD HH:mm" placeholder 占位符, 无初始值时必填 { "tag": "date_picker", "placeholder": { ...
6259904f8e71fb1e983bcf35
class Meta: <NEW_LINE> <INDENT> verbose_name = "Object Creator Types" <NEW_LINE> verbose_name_plural = "Object Creator Types"
Define Django meta options
6259904f96565a6dacd2d9c1
class ProjectExperice(Experience): <NEW_LINE> <INDENT> __tablename__ = 'preject_experience' <NEW_LINE> name = db.Column(db.String(32), nullable=False) <NEW_LINE> role = db.Column(db.String(32)) <NEW_LINE> technologys = db.Column(db.String(64)) <NEW_LINE> resume_id = db.Column(db.Integer, db.ForeignKey('resume.id')) <NE...
工作经历
6259904f3539df3088ecd713
class BreedSerializerWithSeparateWritablePK(serializers.ModelSerializer): <NEW_LINE> <INDENT> species = SpeciesSerializer(read_only=True) <NEW_LINE> species_id = serializers.PrimaryKeyRelatedField( queryset=models.Species.objects.all(), write_only=True, required=True, allow_null=False, ) <NEW_LINE> def validate(self, d...
Breed with option 2: write a separate PK field
6259904ff7d966606f7492f0
class ThreeLayerConvNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=(3, 32, 32), num_filters=32, filter_size=7, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0, dtype=np.float32): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> self.dtype = dtype <NEW_LINE> c, h, w = i...
A three-layer convolutional network with the following architecture: conv - relu - 2x2 max pool - affine - relu - affine - softmax The network operates on minibatches of data that have shape (N, C, H, W) consisting of N images, each with height H and width W and with C input channels.
6259904f7d847024c075d844
class CASMiddleware(object): <NEW_LINE> <INDENT> def process_request(self, request): <NEW_LINE> <INDENT> error = ("The Django CAS middleware requires authentication " "middleware to be installed. Edit your MIDDLEWARE_CLASSES " "setting to insert 'django.contrib.auth.middleware." "AuthenticationMiddleware'.") <NEW_LINE>...
Middleware that allows CAS authentication on admin pages
6259904f63d6d428bbee3c3c
class MLP(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_features, n_classes, n_channels=None): <NEW_LINE> <INDENT> super(MLP, self).__init__() <NEW_LINE> self.hidden = nn.Linear(n_features[0], 256) <NEW_LINE> self.fc = nn.Linear(256, n_classes) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> x = F....
Basic MLP architecture.
6259904f55399d3f0562798b
class AbstractFactory(ABC): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def create_product_a(self) -> AbstractProductA: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def create_product_b(self) -> AbstractProductB: <NEW_LINE> <INDENT> pass
La interfaz AbstractFactory declara un conjunto de métodos que devuelven diferentes productos abstractos. Estos se denominan familia y son relacionados por un concepto de alto nivel. Los productos de una familia suelen ser capaces de colaborar entre ellos. Una familia de productos puede tener varias variantes, pero los...
6259904f76e4537e8c3f09f7
class TestCSApiResponseOrganisationGroup(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 testCSApiResponseOrganisationGroup(self): <NEW_LINE> <INDENT> pass
CSApiResponseOrganisationGroup unit test stubs
6259904fd6c5a102081e358f
class SaxLocatorAdapter(object): <NEW_LINE> <INDENT> def __init__(self, locator=None): <NEW_LINE> <INDENT> self.locator= locator <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "{:d}:{:d}".format(self.line, self.column) <NEW_LINE> <DEDENT> @property <NEW_LINE> def line(self): <NEW_LINE> <INDENT> retur...
Adapter for an XML SAX2 Locator object Wraps a SAX2 locator to behave like a :class:`schema.Locator`. About SAX2 Locators: If a SAX parser provides location information to the SAX application, it does so by implementing this interface and then passing an instance to the application using the content handl...
6259904f07d97122c4218115
class dict_with_strkey(dict): <NEW_LINE> <INDENT> def __missing__(self, key): <NEW_LINE> <INDENT> if isinstance(key, str): <NEW_LINE> <INDENT> raise KeyError("%s does not exist in our dictionary" % key) <NEW_LINE> <DEDENT> return self[str(key)] <NEW_LINE> <DEDENT> def get(self, key, default=None): <NEW_LINE> <INDENT> t...
this is a user-defined dict class using string keys if a key lookup fails, the key will be converted to its string type and then do the lookup
6259904f16aa5153ce40195f
class FlowsEndpoint(ListAPIMixin, BaseAPIView): <NEW_LINE> <INDENT> permission = 'flows.flow_api' <NEW_LINE> model = Flow <NEW_LINE> serializer_class = FlowReadSerializer <NEW_LINE> pagination_class = CreatedOnCursorPagination <NEW_LINE> def filter_queryset(self, queryset): <NEW_LINE> <INDENT> params = self.request.que...
This endpoint allows you to list flows in your account. ## Listing Flows A **GET** returns the list of flows for your organization, in the order of last created. * **uuid** - the UUID of the flow (string), filterable as `uuid` * **name** - the name of the flow (string) * **archived** - whether this flow is archiv...
6259904fbaa26c4b54d5071c
class TestTasks(CCTestCase): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> out = self.run_client('--list') <NEW_LINE> self.assertTrue(out.find('sample') > 0) <NEW_LINE> out = self.run_client('--show', 'cc.task.sample') <NEW_LINE> self.assertTrue(out.find('Params') > 0) <NEW_LINE> out = self.send_task('task...
Test logging. task-host.ini:: [ccserver] logfile = TMP/%(job_name)s.log pidfile = TMP/%(job_name)s.pid cc-role = local cc-socket = PORT1 [routes] task = h:taskproxy job = h:jobmgr log = h:locallogger [h:locallogger] handler = cc.handler.locallogger [h:taskproxy] h...
6259904fd486a94d0ba2d436
class PowerDepthLevel(IntEnum): <NEW_LINE> <INDENT> TARGET = -1 <NEW_LINE> SENSOR = 0 <NEW_LINE> SOCKET = 1 <NEW_LINE> CORE = 2
Enumeration that specify which report level use to group by the reports
6259904f4e696a045264e859
class ESStatistics(object): <NEW_LINE> <INDENT> def __init__(self, args): <NEW_LINE> <INDENT> self.best_epoch = 1 <NEW_LINE> self.best_ppl = float("inf") <NEW_LINE> self.best_nll = float("inf") <NEW_LINE> self.best_kl = 0 <NEW_LINE> self.bad_counter = 0 <NEW_LINE> self.ppl_history = [] <NEW_LINE> self.patience = args.p...
Accumulator for early stopping statistics
6259904f3eb6a72ae038bacd
class DeleteHealthMonitor(neutronV20.DeleteCommand): <NEW_LINE> <INDENT> resource = 'health_monitor' <NEW_LINE> allow_names = False
Delete a given health monitor.
6259904f8da39b475be04657
@skip_if_bug_open('bugzilla', 1262037) <NEW_LINE> class SmartProxyMissingAttrTestCase(APITestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(SmartProxyMissingAttrTestCase, cls).setUpClass() <NEW_LINE> smart_proxies = entities.SmartProxy().search() <NEW_LINE> assert len(...
Tests to see if the server returns the attributes it should. Satellite should return a full description of an entity each time an entity is created, read or updated. These tests verify that certain attributes really are returned. The ``one_to_*_names`` functions know what names Satellite may assign to fields.
6259904f009cb60464d029ab
class SendChatScreenshotTakenNotification(Object): <NEW_LINE> <INDENT> ID = "sendChatScreenshotTakenNotification" <NEW_LINE> def __init__(self, chat_id, extra=None, **kwargs): <NEW_LINE> <INDENT> self.extra = extra <NEW_LINE> self.chat_id = chat_id <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def read(q: dict, *args) -...
Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats Attributes: ID (:obj:`str`): ``SendChatScreenshotTakenNotification`` Args: chat_id (:obj:`int`): Chat identifier Returns: Ok Raises: :class:`telegram.Error`
6259904f7cff6e4e811b6eae
class QParallelAnimationGroup(QAnimationGroup): <NEW_LINE> <INDENT> def childEvent(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def connectNotify(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def customEvent(self, *args, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDE...
QParallelAnimationGroup(parent: QObject = None)
6259904f8e71fb1e983bcf38
class ObjectSolver(Solver): <NEW_LINE> <INDENT> solvable_resources = (Object,) <NEW_LINE> def coerce(self, value, resource): <NEW_LINE> <INDENT> return {r.name: self.registry.solve_resource(value, r) for r in resource.resources}
Solver aimed to retrieve many fields from values. This solver can only handle ``dataql.resources.Object`` resources. Example ------- >>> from dataql.solvers.registry import Registry >>> registry = Registry() >>> from datetime import date >>> registry.register(date) # Create an object from which ...
6259904f379a373c97d9a49e
class DiffHolder(): <NEW_LINE> <INDENT> def __init__(self, pygit_diff): <NEW_LINE> <INDENT> self.patches = [PatchHolder(p) for p in pygit_diff] <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter(self.patches)
Hold diff-information.
6259904fec188e330fdf9d11
class EnvCnfViews(Resource): <NEW_LINE> <INDENT> def get(self, env,configKey): <NEW_LINE> <INDENT> app.logger.info(f"EnvCnfViews get(env={env} configKey={configKey})") <NEW_LINE> msg = MsgBuilder() <NEW_LINE> config = EnvCnf.query.filter_by(env=env, key=configKey, active=1).first() <NEW_LINE> envCnfSchema = EnvCnfSchem...
环境配置类单一视图
6259904f462c4b4f79dbce72
class HTTPClient(Client): <NEW_LINE> <INDENT> def open(self, url, verb, data=None): <NEW_LINE> <INDENT> self.check_verb(verb) <NEW_LINE> url = self.url_normalize(url) <NEW_LINE> method = getattr(requests, verb.lower()) <NEW_LINE> response = method(url, data) <NEW_LINE> return HTTPResponse(response)
Client interface that performs real HTTP requests. It uses the requests library to
6259904f004d5f362081fa22
class ListOfFunctionTerms(Qual): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(ListOfFunctionTerms, self).__init__('listOfFunctionTerms') <NEW_LINE> <DEDENT> def create_default_term(self): <NEW_LINE> <INDENT> default = DefaultTerm() <NEW_LINE> return default.create()
contains 1 default terms and any number of function terms
6259904f26068e7796d4ddb7
class DummySubsegment(Subsegment): <NEW_LINE> <INDENT> def __init__(self, segment, name='dummy'): <NEW_LINE> <INDENT> super(DummySubsegment, self).__init__(name, 'dummy', segment) <NEW_LINE> self.sampled = False <NEW_LINE> <DEDENT> def set_aws(self, aws_meta): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def put_http_m...
A dummy subsegment will be created when ``xray_recorder`` tries to create a subsegment under a not sampled segment. Adding data to a dummy subsegment becomes no-op. Dummy subsegment will not be sent to the X-Ray daemon.
6259904f07f4c71912bb08a8
class SafetyGenerator(object): <NEW_LINE> <INDENT> implements(ITerrainGenerator) <NEW_LINE> def populate(self, chunk, seed): <NEW_LINE> <INDENT> for x, z in XZ: <NEW_LINE> <INDENT> chunk.set_block((x, 0, z), blocks["bedrock"].slot) <NEW_LINE> chunk.set_block((x, 126, z), blocks["air"].slot) <NEW_LINE> chunk.set_block((...
Generates terrain features essential for the safety of clients.
6259904fa219f33f346c7c75
class PhoneNumberInstance(InstanceResource): <NEW_LINE> <INDENT> def __init__(self, version, payload, service_sid, sid=None): <NEW_LINE> <INDENT> super(PhoneNumberInstance, self).__init__(version) <NEW_LINE> self._properties = { 'sid': payload.get('sid'), 'account_sid': payload.get('account_sid'), 'service_sid': payloa...
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
6259904f097d151d1a2c24e4
class LongThrower(ThrowerAnt): <NEW_LINE> <INDENT> name = 'Long' <NEW_LINE> food_cost = 2 <NEW_LINE> min_range = 5 <NEW_LINE> max_range = 100 <NEW_LINE> implemented = False
A ThrowerAnt that only throws leaves at Bees at least 5 places away.
6259904fb57a9660fecd2ef0
class PosTagger(object): <NEW_LINE> <INDENT> def __init__(self, tokens): <NEW_LINE> <INDENT> self.tokens = tokens <NEW_LINE> <DEDENT> def execute(self): <NEW_LINE> <INDENT> return nltk.pos_tag(self.tokens)
Given a list of tokens, return a list of tuples of the form: (token, part-of-speech-tag)
6259904f009cb60464d029ad
class AssetHistoryAdmin(SimpleHistoryAdmin): <NEW_LINE> <INDENT> list_display = ['name', 'status', 'owner', 'history']
将simple_history集成到Django Admin
6259904f1f037a2d8b9e52a6
class Interfaces(object): <NEW_LINE> <INDENT> def __init__(self, function): <NEW_LINE> <INDENT> self.api = izi.api.from_object(function) <NEW_LINE> self.spec = getattr(function, 'original', function) <NEW_LINE> self.arguments = introspect.arguments(function) <NEW_LINE> self.name = introspect.name(function) <NEW_LINE> s...
Defines the per-function singleton applied to iziged functions defining common data needed by all interfaces
6259904f7d847024c075d848
class BlockchainInstance(AbstractBlockchainInstanceProvider): <NEW_LINE> <INDENT> _sharedInstance = SharedInstance <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> if kwargs.get("peerplays_instance"): <NEW_LINE> <INDENT> kwargs["blockchain_instance"] = kwargs["peerplays_instance"] <NEW_LINE> <DEDENT>...
This is a class that allows compatibility with previous naming conventions
6259904f96565a6dacd2d9c3
class CompoundBacktracker(Sealed): <NEW_LINE> <INDENT> __plugin__ = 'glue.CompoundBacktracker' <NEW_LINE> name = "CompoundBacktracker" <NEW_LINE> logger = None <NEW_LINE> backtraceIncoming = True <NEW_LINE> backtraceOutgoing = True <NEW_LINE> def __init__(self, parentLogger = None, **kw): <NEW_LINE> <INDENT> self.logge...
Compound Backtracker FU
6259904f55399d3f0562798f
class BaseFormWithSubjectCheck(BaseFormWithUser): <NEW_LINE> <INDENT> def __init__(self, user, *args, **kwargs): <NEW_LINE> <INDENT> super(BaseFormWithSubjectCheck, self).__init__(user, *args, **kwargs) <NEW_LINE> self.fields['subject'].queryset = Subject.objects.filter(school__id=get_school_from_user(user).id) ...
Base form class, which allows to retrieve only the correct subject according to the school of the user logged. Moreover it inherits from BaseFormWithUser
6259904f462c4b4f79dbce74
class EdgeLabelSet(collections.abc.MutableSet, GraphComponent): <NEW_LINE> <INDENT> def __init__(self, eid: EdgeID, graph_store: GraphStore): <NEW_LINE> <INDENT> GraphComponent.__init__(self, graph_store) <NEW_LINE> self._eid = eid <NEW_LINE> <DEDENT> def __contains__(self, label: Label) -> bool: <NEW_LINE> <INDENT> re...
The set of all labels associated with this edge.
6259904f507cdc57c63a6215
class _Site: <NEW_LINE> <INDENT> def __init__(self,obj): <NEW_LINE> <INDENT> self.Type = "Site" <NEW_LINE> obj.Proxy = self <NEW_LINE> self.Object = obj <NEW_LINE> <DEDENT> def execute(self,obj): <NEW_LINE> <INDENT> self.Object = obj <NEW_LINE> <DEDENT> def onChanged(self,obj,prop): <NEW_LINE> <INDENT> pass <NEW_LINE> ...
The Site object
6259904f26068e7796d4ddb9
class EvaluatorBenchmark(Evaluator): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> <DEDENT> def get_info(self): <NEW_LINE> <INDENT> self.problem, range_in, dim_in, dim_out, n_constr = load_problem(settings["data"]["problem"]) <NEW_LINE> self.results = ["F","G"] if n_constr el...
Evaluate a benchmark problem on the given sample. Attributes: problem (): Benchmark problem. results (list): List of values requested from the problem.
6259904fe76e3b2f99fd9e76
class BaseActionRequestHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> person = None <NEW_LINE> def __init__(self, *args): <NEW_LINE> <INDENT> super(BaseActionRequestHandler, self).__init__(*args) <NEW_LINE> user = users.get_current_user() <NEW_LINE> if not user: <NEW_LINE> <INDENT> raise Exception("Missing user!"...
ALL action handlers should inherit from this one.
6259904f6fece00bbaccce30
class ProfitBricksAvailabilityZone(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return (('<ProfitBricksAvailabilityZone: name=%s>') % (self.name))
Extension class which stores information about a ProfitBricks availability zone. :param name: The availability zone name. :type name: ``str`` Note: This class is ProfitBricks specific.
6259904f7b25080760ed8718
class LookupTransform(Transform): <NEW_LINE> <INDENT> _schema = {'$ref': '#/definitions/LookupTransform'} <NEW_LINE> def __init__(self, lookup=Undefined, default=Undefined, **kwds): <NEW_LINE> <INDENT> super(LookupTransform, self).__init__(lookup=lookup, default=default, **kwds)
LookupTransform schema wrapper Mapping(required=[lookup, from]) Attributes ---------- lookup : string Key in primary data source. default : string The default value to use if lookup fails. **Default value:** ``null`` as : anyOf(:class:`FieldName`, List(:class:`FieldName`)) The output fields on which...
6259904f097d151d1a2c24e6
class DashVariables: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.attr = {} <NEW_LINE> <DEDENT> def update_attr(self, value, attr): <NEW_LINE> <INDENT> self.attr[attr] = value
Class to store information useful to callbacks
6259904f07d97122c421811a
class TestVehicleStatsDecorationsFuelPercents(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 make_instance(self, include_optional): <NEW_LINE> <INDENT> if include_optional : <NEW_LINE> <INDENT> re...
VehicleStatsDecorationsFuelPercents unit test stubs
6259904f8e7ae83300eea508
@implementer(IService) <NEW_LINE> class HookableService(Service): <NEW_LINE> <INDENT> def register_hook(self, name, listener): <NEW_LINE> <INDENT> if not hasattr(self, 'event_listeners'): <NEW_LINE> <INDENT> self.event_listeners = defaultdict(list) <NEW_LINE> <DEDENT> log.debug('registering hook %s->%s' % (name, listen...
This service allows for other services in a Twisted Service tree to be notified whenever a certain kind of hook is triggered. During the service composition, one is expected to register a hook name with the name of the service that wants to react to the triggering of the hook. All the services, both hooked and listene...
6259904fa79ad1619776b4f6
class CopyDirectory(WorkerBuildStep): <NEW_LINE> <INDENT> name = 'CopyDirectory' <NEW_LINE> description = ['Copying'] <NEW_LINE> descriptionDone = ['Copied'] <NEW_LINE> renderables = ['src', 'dest'] <NEW_LINE> haltOnFailure = True <NEW_LINE> flunkOnFailure = True <NEW_LINE> def __init__(self, src, dest, timeout=120, ma...
Copy a directory tree on the worker.
6259904f21a7993f00c673df
class Setting(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=50) <NEW_LINE> description = models.CharField(max_length=500, blank=True) <NEW_LINE> value = models.CharField(max_length=100, blank=True) <NEW_LINE> readonly = models.BooleanField(default=False) <NEW_LINE> date_added = mode...
Settings
6259904f94891a1f408ba130
class ExtendedInfo(object): <NEW_LINE> <INDENT> TITLE = (By.CSS_SELECTOR, "#extended-info .main-title") <NEW_LINE> BUTTON_MAP_TO = ( By.CSS_SELECTOR, '[data-test-id="extended_info_button_map"]') <NEW_LINE> ALREADY_MAPPED = ( By.CSS_SELECTOR, '[data-test-id="extended_info_object_already_mapped"]')
Locators for Extended info tooltip in LHN after hovering over member object.
6259904f596a897236128fea
class KeyFrameAnnotation(models.Model): <NEW_LINE> <INDENT> frame_nr = models.PositiveIntegerField() <NEW_LINE> image_annotation = models.ForeignKey(ImageAnnotation, on_delete=models.CASCADE) <NEW_LINE> frame_metadata = models.CharField(default='', max_length=512, help_text='A text field for storing arbitrary metadata ...
Represents an annotation of a frame of an image_sequence
6259904fd53ae8145f9198d9
class HighlightDelegate(QtWidgets.QStyledItemDelegate): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> QtWidgets.QStyledItemDelegate.__init__(self, parent) <NEW_LINE> self.highlight_text = '' <NEW_LINE> self.case_sensitive = False <NEW_LINE> self.doc = QtGui.QTextDocument() <NEW_LINE> try: <NE...
A delegate used for auto-completion to give formatted completion
6259904fd53ae8145f9198da
class NoStimulus(Stimulus): <NEW_LINE> <INDENT> def prepare(self, conditions=False): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def init_trial(self, cond=False): <NEW_LINE> <INDENT> self.isrunning = True
This class does not present any stimulus and water is delivered upon a lick
6259904f379a373c97d9a4a2
class JuMEG_Epocher_OutputMode(object): <NEW_LINE> <INDENT> __slots__ =["events","epochs","evoked","stage","annotations","use_condition_in_path","path"] <NEW_LINE> def __init__(self,**kwargs): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._init(**kwargs) <NEW_LINE> <DEDENT> def get_parameter(self,key=None): <N...
6259904f24f1403a92686309
class GamessUK70SPunTest(GenericSPunTest): <NEW_LINE> <INDENT> def testdimmocoeffs(self): <NEW_LINE> <INDENT> self.assertEqual(type(self.data.mocoeffs), type([])) <NEW_LINE> self.assertEqual(len(self.data.mocoeffs), 2) <NEW_LINE> shape_alpha = (self.data.homos[0]+6, self.data.nbasis) <NEW_LINE> shape_beta = (self.data....
Customized unrestricted single point unittest
6259904f3c8af77a43b68979
class Or_l (Operation2) : <NEW_LINE> <INDENT> def __init__ ( self , a , b ) : <NEW_LINE> <INDENT> super(Or_l,self).__init__ ( a , b , _For () , ' or ' )
OR (logical) -operation >>> op = Or_l ( fun1 , fun2 )
6259904f26068e7796d4ddbb
class Entry: <NEW_LINE> <INDENT> def __init__(self, name, module_name, ext, options): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.module_name = module_name <NEW_LINE> self.options = options <NEW_LINE> self.ext = ext <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'case {}, options: {}, ext: {...
A file used as a test.
6259904fe64d504609df9e0a
class NoMatchingReleasesError(VcsRepoMgrError): <NEW_LINE> <INDENT> pass
Exception raised when no matching releases are found. Raised by :func:`~vcs_repo_mgr.Repository.select_release()` when no matching releases are found in the repository.
6259904f07f4c71912bb08ac
class SpiderState: <NEW_LINE> <INDENT> def __init__(self, jobdir=None): <NEW_LINE> <INDENT> self.jobdir = jobdir <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_crawler(cls, crawler): <NEW_LINE> <INDENT> jobdir = job_dir(crawler.settings) <NEW_LINE> if not jobdir: <NEW_LINE> <INDENT> raise NotConfigured <NEW_LINE>...
Store and load spider state during a scraping job
6259904f29b78933be26aafe
class Shards(FlipTile): <NEW_LINE> <INDENT> def __init__(self, width): <NEW_LINE> <INDENT> FlipTile.__init__(self, 1) <NEW_LINE> self.__shards = [ OneShard(self.getFrame(), width, 0, 5), OneShard(self.getFrame(), width, 1, 6), OneShard(self.getFrame(), width, 2, 7), OneShard(self.getFrame(), width, 3, 8), OneShard(self...
Animated shards which bounce from left to right; width is parameterised.
6259904f0c0af96317c5779c
class Tag(object): <NEW_LINE> <INDENT> def __init__(self, tag_name, attribs=None, **kwattribs): <NEW_LINE> <INDENT> self.contents = [] <NEW_LINE> self.tag_name = tag_name <NEW_LINE> if attribs is None: <NEW_LINE> <INDENT> attribs = {} <NEW_LINE> <DEDENT> self.attribs = attribs <NEW_LINE> for kwattrib_name in ['class', ...
Holds a tag with a name, attributes and content. content is a list of either tags or strings.
6259904fcb5e8a47e493cbc2
class SignalLogHandler(logging.handlers.BufferingHandler): <NEW_LINE> <INDENT> def __init__(self, signal: QtCore.SignalInstance) -> None: <NEW_LINE> <INDENT> super().__init__(capacity=10) <NEW_LINE> self._signal = signal <NEW_LINE> <DEDENT> def emit(self, record: LogRecord) -> None: <NEW_LINE> <INDENT> result = logging...
Qt Signal based log handler. Emits the log as a signal. Warnings: This is problematic, the signal could be GC and cause a segfault
6259904fb57a9660fecd2ef4
class Square: <NEW_LINE> <INDENT> def __init__(self, size=0, position=(0, 0)): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.position = position <NEW_LINE> <DEDENT> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> return (self.__size) <NEW_LINE> <DEDENT> @size.setter <NEW_LINE> def size(self, value): <NE...
Square class for square objects. Square square square. Square is one of those words that looks stranger the more you type it.
6259904fd99f1b3c44d06b12
class Solution: <NEW_LINE> <INDENT> def myAtoi(self, str): <NEW_LINE> <INDENT> str = str.strip() <NEW_LINE> if not str: <NEW_LINE> <INDENT> return 0 <NEW_LINE> <DEDENT> ans = [] <NEW_LINE> ch = str[0] <NEW_LINE> if ch == "-": <NEW_LINE> <INDENT> c = -1 <NEW_LINE> <DEDENT> elif ch == "+": <NEW_LINE> <INDENT> c = 1 <NEW_...
Implement atoi which converts a string to an integer. The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting from this character, takes an optional initial plus or minus sign followed by as many numerical as possible, and interprets the...
6259904f30dc7b76659a0cad
class SecretGenerateSupportedPluginNotFound(exception.BarbicanHTTPException): <NEW_LINE> <INDENT> client_message = u._("Secret generate supported plugin not found.") <NEW_LINE> status_code = 400 <NEW_LINE> def __init__(self, key_spec): <NEW_LINE> <INDENT> message = u._("Could not find a secret store plugin for generati...
Raised when no secret generate supported plugin is found.
6259904f3cc13d1c6d466bb1
class Solution: <NEW_LINE> <INDENT> def maxSubArrayLen(self, nums, k): <NEW_LINE> <INDENT> prefix_sum_arr = [0] <NEW_LINE> prefix_sum = 0 <NEW_LINE> prefixSum_plus_k_to_index = {} <NEW_LINE> prefixSum_plus_k_to_index[k] = 0 <NEW_LINE> max_length = 0 <NEW_LINE> for i in range(0, len(nums)): <NEW_LINE> <INDENT> prefix_su...
@param nums: an array @param k: a target value @return: the maximum length of a subarray that sums to k
6259904fdc8b845886d54a36
class LoginSerializer(serializers.Serializer): <NEW_LINE> <INDENT> email = serializers.EmailField(max_length=256, required=True) <NEW_LINE> password = serializers.CharField(required=True, min_length=5) <NEW_LINE> username = serializers.SerializerMethodField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW...
This is the serializer used for logging in user
6259904f7d847024c075d84c
class PoemTypescriptConvolute(ArchiveElement, Convolute): <NEW_LINE> <INDENT> def __init__(self, containsEarlierStagesOfPublication=None, convoluteHasContentRepresentation=None, containsLaterStagesOfManuscriptConvolute=None, hasArchiveSignature=None, convoluteHasOriginDescription=None, hasCarrierCollectionDescription=N...
Poem typescript convolute with poems authored by Kuno Raeber. Labels: Gedicht-Typoskriptenonvolut (de) / poem typescript convolute (en)
6259904f3539df3088ecd71b
class NSNitroNserrGslbNoqualifier(NSNitroGslbErrors): <NEW_LINE> <INDENT> pass
Nitro error code 1828 At least one qualifier should be given for the location
6259904ff7d966606f7492f4
class PrivateIngredientsApiTests(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.client = APIClient() <NEW_LINE> self.user = get_user_model().objects.create_user( 'test@gmail.com', 'testpass' ) <NEW_LINE> self.client.force_authenticate(self.user) <NEW_LINE> <DEDENT> def test_retrieve_ingredient...
Test the private ingredient api
6259904f0a50d4780f7067f9
class GenericModelChoiceField(FieldBase, forms.Field): <NEW_LINE> <INDENT> widget = ChoiceWidget <NEW_LINE> def prepare_value(self, value): <NEW_LINE> <INDENT> from django.contrib.contenttypes.models import ContentType <NEW_LINE> if isinstance(value, six.string_types): <NEW_LINE> <INDENT> return value <NEW_LINE> <DEDEN...
Simple form field that converts strings to models.
6259904fd7e4931a7ef3d4f1
class StatusCodeType_(SamlBase): <NEW_LINE> <INDENT> c_tag = 'StatusCodeType' <NEW_LINE> c_namespace = NAMESPACE <NEW_LINE> c_children = SamlBase.c_children.copy() <NEW_LINE> c_attributes = SamlBase.c_attributes.copy() <NEW_LINE> c_child_order = SamlBase.c_child_order[:] <NEW_LINE> c_cardinality = SamlBase.c_cardinalit...
The urn:oasis:names:tc:SAML:2.0:protocol:StatusCodeType element
6259904f45492302aabfd94c
class Car: <NEW_LINE> <INDENT> def __init__(self, engine): <NEW_LINE> <INDENT> self.engine = engine <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.engine
Example car.
6259904f76d4e153a661dcb5
class InvalidPositionError(ValueError): <NEW_LINE> <INDENT> pass
Exception for bad coordinates
6259904f7b25080760ed871a
class TaskForm(FlaskForm): <NEW_LINE> <INDENT> name = StringField('任务名', validators=[DataRequired(message='不能为空'), Length(3, 64, message='长度不正确')]) <NEW_LINE> url = StringField('监控URL', default=TaskMonitor.gen_uuid) <NEW_LINE> period = StringField('循环周期', validators=[InputRequired(), validate_crontab, Regexp('^ *(\S+ +...
任务表单
6259904f07f4c71912bb08af
class AssertOutputCommand(Assertion): <NEW_LINE> <INDENT> NAME = "assert-output" <NEW_LINE> def __init__(self, spec): <NEW_LINE> <INDENT> assert isinstance(spec, str) <NEW_LINE> self.template = spec <NEW_LINE> <DEDENT> def run(self, state, case): <NEW_LINE> <INDENT> expected = substitute_env_vars(self.template) <NEW_LI...
Test condition command. Asserts that the output of the last command matches a given string:: --- # A very simple test! - !run > echo Hello world! - !assert-output > Hello world!
6259904f3eb6a72ae038bad5
class AuthenticationFormTests(TestCaseBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.active_user = user(save=True, username='activeuser', is_active=True) <NEW_LINE> self.inactive_user = user(save=True, username='inactiveuser', is_active=False) <NEW_LINE> <DEDENT> def test_only_active(self): <NEW_L...
AuthenticationForm tests.
6259904f23849d37ff852538
class File(object): <NEW_LINE> <INDENT> def __init__(self, short_path): <NEW_LINE> <INDENT> self.short_path = short_path
Mock Skylark File class for testing.
6259904f21a7993f00c673e3
class InputHookManager(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> if ctypes is None: <NEW_LINE> <INDENT> warn( "IPython GUI event loop requires ctypes, %gui will not be available") <NEW_LINE> return <NEW_LINE> <DEDENT> self.PYFUNC = ctypes.PYFUNCTYPE(ctypes.c_int) <NEW_LINE> self.guihooks = {}...
Manage PyOS_InputHook for different GUI toolkits. This class installs various hooks under ``PyOSInputHook`` to handle GUI event loop integration.
6259904fcad5886f8bdc5abb
class MultiHeadAtten(nn.Module): <NEW_LINE> <INDENT> def __init__(self, atten_unit, encode_size, num_heads=8, dropout=0.1): <NEW_LINE> <INDENT> super(MultiHeadAtten, self).__init__() <NEW_LINE> model_dim = encode_size * 2 <NEW_LINE> self.attention = atten_unit <NEW_LINE> self.num_heads = num_heads <NEW_LINE> self.dim_p...
Multi head attetnion
6259904ff7d966606f7492f5
class line2(): <NEW_LINE> <INDENT> def __init__(self, a, b): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.b = b <NEW_LINE> <DEDENT> def __contains__(self, other): <NEW_LINE> <INDENT> if isinstance(other, point2): <NEW_LINE> <INDENT> return other.y == self.a * other.x + self.b <NEW_LINE> <DEDENT> elif isinstance(other...
defined by a and b of the y = ax + b equation where a is the slope and b the y_intercept
6259904fdd821e528d6da356
class PingTestsMixin(object): <NEW_LINE> <INDENT> def test_periodic_noops(self): <NEW_LINE> <INDENT> expected_pings = 3 <NEW_LINE> reactor = Clock() <NEW_LINE> locator = _NoOpCounter() <NEW_LINE> peer = AMP(locator=locator) <NEW_LINE> protocol = self.build_protocol(reactor) <NEW_LINE> pump = connectedServerAndClient(la...
Mixin for ``TestCase`` defining tests for an ``AMP`` protocol that periodically sends no-op ping messages.
6259904f91af0d3eaad3b29f
class ExistingFile(str): <NEW_LINE> <INDENT> __metaclass__ = ValueMeta <NEW_LINE> @classmethod <NEW_LINE> def __instancecheck__(cls, instance): <NEW_LINE> <INDENT> if isinstance(instance, str): <NEW_LINE> <INDENT> if os.path.isfile(instance): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> <DEDENT> return False
Non-instanced type-checking class (a VOG).
6259904f55399d3f05627995
class ClusterNodeSensors(object): <NEW_LINE> <INDENT> swagger_types = { 'sensors': 'list[ClusterNodeSensor]' } <NEW_LINE> attribute_map = { 'sensors': 'sensors' } <NEW_LINE> def __init__(self, sensors=None): <NEW_LINE> <INDENT> self._sensors = None <NEW_LINE> self.discriminator = None <NEW_LINE> if sensors is not None:...
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
6259904fd53ae8145f9198dd
class Signal(object): <NEW_LINE> <INDENT> assert_named_signals = False <NEW_LINE> def __init__(self, value, name=None, base=None, readonly=False): <NEW_LINE> <INDENT> self._value = np.asarray(value).view() <NEW_LINE> self._value.setflags(write=False) <NEW_LINE> if base is not None: <NEW_LINE> <INDENT> assert not base.i...
Represents data or views onto data within Nengo
6259904f287bf620b6273065
class BaseTrainer(abc.ABC): <NEW_LINE> <INDENT> def __init__(self, opt, model, optimizer, criterion, train_loader, val_loader): <NEW_LINE> <INDENT> self.opt = opt <NEW_LINE> self.use_cuda = opt.use_cuda <NEW_LINE> self.model = model <NEW_LINE> self.optim = optimizer <NEW_LINE> self.criterion = criterion <NEW_LINE> self...
base trainer class. contains methods for training, validation, and writing output.
6259904f23e79379d538d977
class App_pyside(App_qt): <NEW_LINE> <INDENT> def importCoreAndGui(self): <NEW_LINE> <INDENT> import PySide <NEW_LINE> from PySide import QtGui, QtCore <NEW_LINE> return QtGui, QtCore
Hijack the PySide mainloop.
6259904f76e4537e8c3f0a01
class UserModelAdmin(ModelAdmin): <NEW_LINE> <INDENT> save_on_top = True <NEW_LINE> readonly_fields = ('created_by', 'updated_by') <NEW_LINE> def save_model(self, request, obj, form, change): <NEW_LINE> <INDENT> instance = form.save(commit=False) <NEW_LINE> self._update_instance(instance, request.user) <NEW_LINE> insta...
ModelAdmin subclass that will automatically update created_by and updated_by fields
6259904fd53ae8145f9198de
class AxisAlignedMargins(object): <NEW_LINE> <INDENT> def ToString(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def __new__(self, geometry, x1, y1, z1, x2, y2, z2): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> Geometry = None <NEW_LINE> X1 = None <NEW_LINE> X2 = None <NEW_LINE> Y1 = None...
AxisAlignedMargins(geometry: StructureMarginGeometry, x1: float, y1: float, z1: float, x2: float, y2: float, z2: float)
6259904f3c8af77a43b6897b
class NVBTEXTURE_BOX_OPS(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "nvb.texture_info_box_ops" <NEW_LINE> bl_label = "Box Controls" <NEW_LINE> bl_description = "Show/hide this property list" <NEW_LINE> boxname = bpy.props.StringProperty(default='') <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> if...
Hide/show Texture Info sub-groups
6259904f004d5f362081fa26
class emuiaDialogTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.dialog = emuiaDialog(None) <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> self.dialog = None <NEW_LINE> <DEDENT> def test_dialog_ok(self): <NEW_LINE> <INDENT> button = self.dialog.button_box.button(QDial...
Test dialog works.
6259904fbe383301e0254c96
class Hover(): <NEW_LINE> <INDENT> def __init__(self, init_pose=None, init_velocities=None, init_angle_velocities=None, runtime=5., target_pos=None,position_noise=None): <NEW_LINE> <INDENT> print(":::::::::: Task to hover :::::::::: ") <NEW_LINE> self.sim = PhysicsSim(init_pose, init_velocities, init_angle_velocities,...
Task (environment) that defines the goal and provides feedback to the agent.
6259904f26068e7796d4ddbf
class Block(collections.namedtuple('Block', ['scope', 'unit_fn', 'args'])): <NEW_LINE> <INDENT> pass
A named tuple describing a ResNet block.
6259904f1f037a2d8b9e52a9
class EmoticonCache(Cache.Cache): <NEW_LINE> <INDENT> def __init__(self, config_path, user): <NEW_LINE> <INDENT> Cache.Cache.__init__(self, os.path.join(config_path, user.strip()), 'emoticons', True) <NEW_LINE> <DEDENT> def parse(self): <NEW_LINE> <INDENT> emotes = {} <NEW_LINE> with file(self.info_path) as handle: <NE...
a class to maintain a cache of an user emoticons
6259904f07f4c71912bb08b1
class Mapping(Element): <NEW_LINE> <INDENT> def __init__(self, name: str): <NEW_LINE> <INDENT> super(Mapping, self).__init__(name) <NEW_LINE> self._category = None <NEW_LINE> <DEDENT> def add_category(self, category: str) -> 'Mapping': <NEW_LINE> <INDENT> self._category = category <NEW_LINE> if category not in self.att...
The `Mapping` class is a subclass of :class:`Element`, each instance of which matches a key to a corresponding set of named values.
6259904f6fece00bbaccce36
class BaseClassesTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_base_object(self): <NEW_LINE> <INDENT> bo = base._BaseObject(id="id0") <NEW_LINE> self.assertEqual(bo.id, "id0") <NEW_LINE> self.assertEqual(bo.ns, config.KMLNS) <NEW_LINE> self.assertEqual(bo.targetId, None) <NEW_LINE> self.assertEqual(bo.__nam...
BaseClasses must raise a NotImplementedError on etree_element and a TypeError on from_element
6259904fb57a9660fecd2ef8
class LoadsideBankVersion(NumericValue): <NEW_LINE> <INDENT> bank = BANK_204 <NEW_LINE> locations = MemoryLocation(address=0x03, default=0x01, type_=MemoryType.ROM)
Version of the loadside energy and power memory bank
6259904f3cc13d1c6d466bb5
class Tersoff(PotentialAbstract): <NEW_LINE> <INDENT> potential_fname = "potential.pot" <NEW_LINE> def validate_data(self, data): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get_external_content(self): <NEW_LINE> <INDENT> potential_file = ( "# Potential file generated by aiida plugin " "(please check citation in t...
Class for creation of Tersoff potential inputs.
6259904f8e71fb1e983bcf41
class OpenStackGlance(Plugin): <NEW_LINE> <INDENT> plugin_name = "openstack_glance" <NEW_LINE> profiles = ('openstack', 'openstack_controller') <NEW_LINE> option_list = [] <NEW_LINE> var_puppet_gen = "/var/lib/config-data/puppet-generated/glance_api" <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> if self.get_option("a...
OpenStack Glance
6259904f8da39b475be04662
class harmonicosci: <NEW_LINE> <INDENT> def __init__(self, elO, ecO,nelem0): <NEW_LINE> <INDENT> self.el = elO <NEW_LINE> self.ec = ecO <NEW_LINE> self.ej = 0 <NEW_LINE> self.nelem = nelem0 <NEW_LINE> self.phi_AO = math.pow(8*ecO/elO,0.25) <NEW_LINE> <DEDENT> def mmatele(self,n,m): <NEW...
harmonic osci this construc the relevan matrix for the armonic oscilator H, X and H. those are express in the diagoanl basis for the H. - in the class i have also to define some internal variable. - to make a harmonic osci you do harmonicosci(EL,EC,EJ,number of element the space is trocated) - .matriform the form of t...
6259904f004d5f362081fa27
class GeneralizedTimeZone(datetime.tzinfo): <NEW_LINE> <INDENT> def __init__(self,offsetstr="Z"): <NEW_LINE> <INDENT> super(GeneralizedTimeZone, self).__init__() <NEW_LINE> self.name = offsetstr <NEW_LINE> self.houroffset = 0 <NEW_LINE> self.minoffset = 0 <NEW_LINE> if offsetstr == "Z": <NEW_LINE> <INDENT> self.houroff...
This class is a basic timezone wrapper for the offset specified in a Generalized Time. It is dst-ignorant.
6259904fac7a0e7691f73958
class TestSequence(unittest.TestCase): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> rptable = RPTable() <NEW_LINE> self.assertEqual(not (oh_add_resource(rptable, rptentries[0], None, 0)), True)
runTest : Starting with an empty RPTable, adds 1 resource to it with a null table. Passes the test if the interface returns an error, else it fails. Return value: 0 on success, 1 on failure
6259904f82261d6c52730905