code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class AddFileError(ControllerError): <NEW_LINE> <INDENT> pass | Exception raised when an error occurs while adding a file to a document | 62598f8e435de62698e9b9d1 |
class BaseConfig(object): <NEW_LINE> <INDENT> SECRET_KEY = 'my_precious' <NEW_LINE> DEBUG = True <NEW_LINE> BCRYPT_LOG_ROUNDS = 4 <NEW_LINE> WTF_CSRF_ENABLED = False <NEW_LINE> DEBUG_TB_ENABLED = True <NEW_LINE> DEBUG_TB_INTERCEPT_REDIRECTS = False <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False | Define class BaseConfig with attribute(s) and method(s).
Base initial configuration class.
It defines:
attribute:
SECRET_KEY - Development key for session accessing
DEBUG - Enable/Disable debug option
BCRYPT_LOG_ROUNDS - for bcrypt hashing utilities
WTF_CSRF_ENABLED - Secure forms
... | 62598f8e3eb6a72ae038a217 |
class Forward(RelativeCompose): <NEW_LINE> <INDENT> ORDER = ('Composing', 4) <NEW_LINE> TEMPLATE_IDS = ['forward'] + Compose.TEMPLATE_IDS <NEW_LINE> SYNOPSIS = '<[att] m1 ...>' <NEW_LINE> HTTP_CALLABLE = ('GET', ) <NEW_LINE> HTTP_QUERY_VARS = { 'mid': 'metadata-ID', } <NEW_LINE> HTTP_POST_VARS = {} <NEW_LINE> def comma... | Forward messages (and attachments) | 62598f8e1f037a2d8b9e3cbd |
class UnixFilesystem(AbstractFilesystem): <NEW_LINE> <INDENT> def __init__(self, root, cmd_channel): <NEW_LINE> <INDENT> AbstractFilesystem.__init__(self, root, cmd_channel) <NEW_LINE> self.cwd = root <NEW_LINE> <DEDENT> def ftp2fs(self, ftppath): <NEW_LINE> <INDENT> return self.ftpnorm(ftppath) <NEW_LINE> <DEDENT> def... | Represents the real UNIX filesystem.
Differently from AbstractedFS the client will login into
/home/<username> and will be able to escape its home directory
and navigate the real filesystem. | 62598f8e656771135c48925e |
class DPTMagneticFlux(DPT4ByteFloat): <NEW_LINE> <INDENT> dpt_main_number = 14 <NEW_LINE> dpt_sub_number = 45 <NEW_LINE> value_type = "magnetic_flux" <NEW_LINE> unit = "Wb" | DPT 14.045 DPT_Value_Magnetic_Flux. | 62598f8e23849d37ff850ca2 |
class monManEnvironment(JobProperty): <NEW_LINE> <INDENT> statusOn = True <NEW_LINE> allowedTypes = ['str'] <NEW_LINE> StoredValue = 'tier0ESD' | MonManager environment | 62598f8e82261d6c5272fcc6 |
class PreciseBN(HookBase): <NEW_LINE> <INDENT> def __init__(self, period, model, data_loader, num_iter): <NEW_LINE> <INDENT> if len(get_bn_modules(model)) == 0: <NEW_LINE> <INDENT> logger.info( "PreciseBN is disabled because model does not contain BN layers in training mode." ) <NEW_LINE> self._disabled = True <NEW_LIN... | The standard implementation of BatchNorm uses EMA in inference, which is
sometimes suboptimal.
This class computes the true average of statistics rather than the moving average,
and put true averages to every BN layer in the given model.
It is executed every ``period`` iterations and after the last iteration. | 62598f8e596a89723612785a |
class EarlyStopping(Exception): <NEW_LINE> <INDENT> pass | Raised when the algorithm converged. | 62598f8e9b70327d1c57e980 |
class PcpHelp(object): <NEW_LINE> <INDENT> pmns = {} <NEW_LINE> help_text = {} <NEW_LINE> ctx = None <NEW_LINE> def _pmns_callback(self, label): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> newlabel = label.decode("utf-8") <NEW_LINE> <DEDENT> except AttributeError: <NEW_LINE> <INDENT> newlabel = label <NEW_LINE> <DEDEN... | Class to fetch description texts from local pmcd instance
Help texts are not shipped in an archive file. This class is used
to fetch the help texts from the locally running pmcd service. This
presumes that the PMNS tree is the same between the archive and the
local PCP instance. Just a best effort thing. If the local ... | 62598f8edc8b845886d5319c |
class AttributeNotFoundException(Exception): <NEW_LINE> <INDENT> pass | The attribute you requested does not exist. | 62598f8e851cf427c66b7ea3 |
class UserForm(forms.ModelForm): <NEW_LINE> <INDENT> group = forms.ModelMultipleChoiceField(queryset=Group.objects.all(), label=_('Group')) <NEW_LINE> password = forms.CharField(widget=forms.PasswordInput(), label=_('Password')) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ['username', 'p... | Form that can be used to create a user without the requirement of a password confirmation | 62598f8efbf16365ca793c91 |
class ConceptManager(InheritanceManager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> return ConceptQuerySet(self.model) <NEW_LINE> <DEDENT> def get_queryset(self): <NEW_LINE> <INDENT> return ConceptQuerySet(self.model) <NEW_LINE> <DEDENT> def __getattr__(self, attr, *args): <NEW_LINE> <INDENT> if ... | The ``ConceptManager`` is the default object manager for ``concept`` and
``_concept`` items, and extends from the django-model-utils ``InheritanceManager``.
It provides access to the ``ConceptQuerySet`` to allow for easy permissions-based
filtering of ISO 11179 Concept-based items. | 62598f8e76e4537e8c3ef18f |
class MEADOW_OT_FreePhysics(MeadowOperatorBase, Operator): <NEW_LINE> <INDENT> bl_idname = "meadow.free_physics" <NEW_LINE> bl_label = "Free Physics" <NEW_LINE> bl_options = {'REGISTER', 'UNDO'} <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> with OperatorCallContext(): <NEW_LINE> <INDENT> progress_default()... | Free all physics caches | 62598f8e004d5f362081edeb |
class DDTDecoratorChecker(ast.NodeVisitor): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.classes = [] <NEW_LINE> self.errors = {} <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def _get_name(cls, node): <NEW_LINE> <INDENT> if isinstance(node, ast.Name): <NEW_LINE> <INDENT> return node.id <NEW_LINE> <DE... | Visit an AST tree looking for classes lacking the ddt.ddt decorator.
DDT uses decorators on test case functions to supply different
test data, but if the class that those functions are members of is
not decorated with @ddt.ddt, then the data expansion never happens
and the tests are incomplete. This is very easy to mi... | 62598f8e07d97122c421688c |
class TestField(qm.fields.ChoiceField): <NEW_LINE> <INDENT> def GetItems(self): <NEW_LINE> <INDENT> database = qm.test.database.get_database() <NEW_LINE> return database.GetTestIds() | A 'TestField' contains the name of a test.
The exact format of the name depends on the test database in use. | 62598f8e24f1403a926856a0 |
class Usage: <NEW_LINE> <INDENT> def __init__(self, black_red ='+', name = '', money = 0, docstring = '-'): <NEW_LINE> <INDENT> self.__black_red = black_red <NEW_LINE> self.__name = name <NEW_LINE> self.__money = money <NEW_LINE> self.__docstring = docstring <NEW_LINE> <DEDENT> def set_black_red(self, black_red = '+'):... | Class that contains name, quantity of money, and docstring.
used as one line of account book. | 62598f8e596a89723612785b |
class IndexView(CoreView, MethodView): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> return render_template('/index.html') | Главная страница | 62598f8ea79ad16197769c48 |
class genlogistic_gen(rv_continuous): <NEW_LINE> <INDENT> def _pdf(self, x, c): <NEW_LINE> <INDENT> return exp(self._logpdf(x, c)) <NEW_LINE> <DEDENT> def _logpdf(self, x, c): <NEW_LINE> <INDENT> return log(c) - x - (c+1.0)*special.log1p(exp(-x)) <NEW_LINE> <DEDENT> def _cdf(self, x, c): <NEW_LINE> <INDENT> Cx = (1+exp... | A generalized logistic continuous random variable.
%(before_notes)s
Notes
-----
The probability density function for `genlogistic` is::
genlogistic.pdf(x, c) = c * exp(-x) / (1 + exp(-x))**(c+1)
for ``x > 0``, ``c > 0``.
`genlogistic` takes ``c`` as a shape parameter.
%(after_notes)s
%(example)s | 62598f8e63b5f9789fe84d55 |
class TestReleaseConnection(object): <NEW_LINE> <INDENT> def test_not_modified_releases_connection(self, server, url): <NEW_LINE> <INDENT> sess = CacheControl(requests.Session()) <NEW_LINE> etag_url = urljoin(url, '/etag') <NEW_LINE> sess.get(etag_url) <NEW_LINE> resp = Mock(status=304, headers={}) <NEW_LINE> response_... | On 304s we still make a request using our connection pool, yet
we do not call the parent adapter, which releases the connection
back to the pool. This test ensures that when the parent `get`
method is not called we consume the response (which should be
empty according to the HTTP spec) and release the connection. | 62598f8e6e29344779b00238 |
class ArrayStack(Array): <NEW_LINE> <INDENT> def __init__(self, stack): <NEW_LINE> <INDENT> first_array = stack.flat[0] <NEW_LINE> item_shape = first_array.shape <NEW_LINE> dtype = first_array.dtype <NEW_LINE> fill_value = first_array.fill_value <NEW_LINE> if np.issubdtype(dtype, np.floating): <NEW_LINE> <INDENT> def f... | An Array made from a homogeneous array of other Arrays. | 62598f8ec432627299fa2baf |
class FXAttributes(): <NEW_LINE> <INDENT> def __init__(self, axes_attr_path, XYDecision, IM_annotation_path): <NEW_LINE> <INDENT> self.axesDecision = AxesDecisionResults(XYDecision) <NEW_LINE> self.axesAttr(axes_attr_path) <NEW_LINE> self.annotation = Annotations(IM_annotation_path) <NEW_LINE> <DEDENT> def axesAttr(sel... | batch use:
* read in from Axes attribute file
* for every query-entity pair, add attribute whether it's on X or Y axis
* for every query, add attribute the type of its intended message
single query:
* read in Axes attribute matrix
* read in Axes classification result array
* read in Intended ... | 62598f8e4e4d562566372009 |
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): <NEW_LINE> <INDENT> VERSION = 1 <NEW_LINE> CONNECTION_CLASS = config_entries.CONN_CLASS_CLOUD_POLL <NEW_LINE> @staticmethod <NEW_LINE> @core.callback <NEW_LINE> def async_get_options_flow(config_entry): <NEW_LINE> <INDENT> return RiscoOptionsFlowHandler(config... | Handle a config flow for Risco. | 62598f8eb5575c28eb712abc |
class Comment(models.Model): <NEW_LINE> <INDENT> snippet = models.ForeignKey(Snippet, blank=True, null=True, on_delete=models.SET_NULL) <NEW_LINE> user = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL) <NEW_LINE> comment = models.TextField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT... | User comments on code snippets. | 62598f8e07d97122c421688d |
class InternalTiltSensor(Peripheral): <NEW_LINE> <INDENT> _sensor_id = 0x0028 <NEW_LINE> capability = Enum("capability", [('sense_angle', 0), ('sense_tilt', 1), ('sense_orientation', 2), ('sense_impact', 3), ('sense_acceleration_3_axis', 4), ]) <NEW_LINE> datasets = { capability.sense_angle: (2, 1), capability.sense_ti... | Access the internal tilt sensor in the Boost Move Hub.
The various modes are:
- **sense_angle** - X, Y angles. Both are 0 if hub is lying flat with button up
- **sense_tilt** - value from 0-9 if hub is tilted around any of its axis. Seems to be
a rough mesaure of how much the hub is tilted away from lying flat.
... | 62598f8e596a89723612785c |
class BinaryauthorizationProjectsAttestorsDeleteRequest(_messages.Message): <NEW_LINE> <INDENT> name = _messages.StringField(1, required=True) | A BinaryauthorizationProjectsAttestorsDeleteRequest object.
Fields:
name: Required. The name of the attestors to delete, in the format
`projects/*/attestors/*`. | 62598f8e16aa5153ce4000ea |
class TestXlsxImage(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 testXlsxImage(self): <NEW_LINE> <INDENT> pass | XlsxImage unit test stubs | 62598f8e8a43f66fc4bf1d6a |
class CourseQualityViewTest(BaseCourseViewTest): <NEW_LINE> <INDENT> view_name = 'courses_api:course_quality' <NEW_LINE> def test_staff_succeeds(self): <NEW_LINE> <INDENT> self.client.login(username=self.staff.username, password=self.password) <NEW_LINE> resp = self.client.get(self.get_url(self.course_key), {'all': 'tr... | Test course quality view via a RESTful API | 62598f8e8da39b475be02dc2 |
class TddSprintDailyRecord(Base): <NEW_LINE> <INDENT> __tablename__ = 'tdd_sprint_daily_record' <NEW_LINE> id = Column(Integer, primary_key=True, autoincrement=True) <NEW_LINE> added = Column(Integer) <NEW_LINE> date = Column(String(20)) <NEW_LINE> aid = Column(Integer) <NEW_LINE> view = Column(Integer) <NEW_LINE> view... | Tdd Sprint Daily Record | 62598f8ee76e3b2f99fd8616 |
class Incoming: <NEW_LINE> <INDENT> def __call__(self, event): <NEW_LINE> <INDENT> return not event.out | The update must be something the client received from another user,
and not something the current user sent. | 62598f8e26068e7796d4c542 |
class EagerLoadingMixin: <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setup_eager_loading(cls, queryset): <NEW_LINE> <INDENT> if hasattr(cls, "_SELECT_RELATED_FIELDS"): <NEW_LINE> <INDENT> queryset = queryset.select_related(*cls._SELECT_RELATED_FIELDS) <NEW_LINE> <DEDENT> if hasattr(cls, "_PREFETCH_RELATED_FIELDS"):... | Mixin to select_related and prefetch_related queries
From the comments of http://ses4j.github.io/2015/11/23/optimizing-slow-django-rest-framework-performance/ | 62598f8e379a373c97d98bfb |
class FileItem: <NEW_LINE> <INDENT> def __init__(self, editor): <NEW_LINE> <INDENT> self._editor = editor <NEW_LINE> self._pinned = False <NEW_LINE> <DEDENT> @property <NEW_LINE> def editor(self): <NEW_LINE> <INDENT> return self._editor <NEW_LINE> <DEDENT> @property <NEW_LINE> def id(self): <NEW_LINE> <INDENT> if self.... | FileItem(editor)
A file item represents an open file. It is associated with an editing
component and has a filename. | 62598f8e24f1403a926856a1 |
class ECRPublicGetLoginPassword(BasicCommand): <NEW_LINE> <INDENT> NAME = 'get-login-password' <NEW_LINE> DESCRIPTION = BasicCommand.FROM_FILE( 'ecr-public/get-login-password_description.rst') <NEW_LINE> def _run_main(self, parsed_args, parsed_globals): <NEW_LINE> <INDENT> ecr_public_client = create_client_from_parsed_... | Get a password to be used with container clients such as Docker | 62598f8ea4f1c619b294e1cd |
class HasOmnipotenceRights(BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> return ( request.user is not None and has_omnipotence_rights(request.user) ) | Check if the given user has enough privileges for Omnipotence | 62598f8e925a0f43d25e7c1c |
class Family(db.Model): <NEW_LINE> <INDENT> __table_args__ = ( UniqueConstraint('name', 'fk_workspace_id'), CheckConstraint('version IS NOT NULL OR fk_workspace_id IS NOT NULL', name='simul_null_check') ) <NEW_LINE> id = db.Column(db.Integer, primary_key=True, autoincrement=True) <NEW_LINE> name = db.Column(db.String(6... | Quetzal metadata family
In quetzal, metadata are organized in semantic groups that have a name and
a version number. This is the definition of a metadata _family_. This
class represents this definition. It is attached to a workspace, until the
workspace is committed: at this point the family will be disassociated
from... | 62598f8efb3f5b602db47fa4 |
class ParseDateArg(argparse.Action): <NEW_LINE> <INDENT> def __call__(self, parser, namespace, datetime_str, option_string=None): <NEW_LINE> <INDENT> parsed_datetime = date_time_from_str(datetime_str) <NEW_LINE> setattr(namespace, self.dest, parsed_datetime.date()) | Similar to ParseDateTimeArg.
Parses and returns a datetime.date object. | 62598f8e097d151d1a2c0c0d |
class DocumentSummaryOlecfPlugin(interface.OlecfPlugin): <NEW_LINE> <INDENT> NAME = u'olecf_document_summary' <NEW_LINE> DESCRIPTION = u'Parser for a DocumentSummaryInformation OLECF stream.' <NEW_LINE> REQUIRED_ITEMS = frozenset([u'\005DocumentSummaryInformation']) <NEW_LINE> def ParseItems( self, parser_mediator, roo... | Plugin that parses DocumentSummaryInformation item from an OLECF file. | 62598f8e23e79379d538c0e6 |
class hdf5_sink(gr.sync_block): <NEW_LINE> <INDENT> def __init__(self, intype, n_inputs, vec_length, save_toggle, fname='default.h5', pointing = "AZ,EL", freq_start=1419.0, freq_step=0.002, notes = 'default' ): <NEW_LINE> <INDENT> current_time = time.time() <NEW_LINE> if intype == complex: <NEW_LINE> <INDENT> datatype ... | docstring for block hdf5_sink
Writing to the file is controlled by the string variable save_toggle: if save_toggle = "True" (a string, not boolean), the data is written to the file; otherwise writing to the file stops. | 62598f8e6fb2d068a7693c23 |
class UserUnmodifyError(RoapError): <NEW_LINE> <INDENT> pass | A definition is not well defined. | 62598f8e287bf620b627179e |
class StringSetting(Setting): <NEW_LINE> <INDENT> pass | Setting of plain string values | 62598f8e3eb6a72ae038a21b |
class MaterialInventoryView(ListView): <NEW_LINE> <INDENT> template_name = 'inventories/inventory.html' <NEW_LINE> context_object_name = 'inventory_items' <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.primary_key = 0 <NEW_LINE> self.inventory_name = "Inventario ... | Class view that generates the HTTP responses for all material inventories
requests. | 62598f8e0c0af96317c55f68 |
class POSTAccessingHandler(client.ClientHandler): <NEW_LINE> <INDENT> def handle_uncaught_exception(self, request, resolver, exc_info): <NEW_LINE> <INDENT> ret = super(POSTAccessingHandler, self).handle_uncaught_exception(request, resolver, exc_info) <NEW_LINE> p = request.POST <NEW_LINE> return ret | A handler that'll access POST during an exception. | 62598f8eb57a9660fecd1664 |
class Crawl(Module): <NEW_LINE> <INDENT> images = [ "local/sqlmap:1.0.0", ] <NEW_LINE> @classmethod <NEW_LINE> def add_arguments(cls, parser): <NEW_LINE> <INDENT> parser.add_argument("-d", "--depth", type=int, default=5, help="crawl depth") <NEW_LINE> parser.add_argument("-c", "--cookie", type=str, help="use specific c... | Crawl an HTTP resource for SQL injection vulnerabilities. | 62598f8edc8b845886d531a0 |
@crookbook.essence('location type', mutable=False) <NEW_LINE> @crookbook.described(inner="{0.type!r} at {0.location}") <NEW_LINE> class Discovery(object): <NEW_LINE> <INDENT> def __init__(self, headers): <NEW_LINE> <INDENT> self.headers = CaseInsensitiveDict(headers) <NEW_LINE> for attr in ['location', 'type']: <NEW_LI... | This class describes a discovered resource, from either a SSDP search
response or SSDP advertisement.
The headers from the response which describes the discovered resource are
available as the 'headers' attribute.
You can also access any header (in a case insensitive manner) as an
attribute on the object.
You can ac... | 62598f8e6fece00bbaccb572 |
class NotSolution: <NEW_LINE> <INDENT> def word_bfs(self, board: List[List[str]], point: tuple, word: str) -> bool: <NEW_LINE> <INDENT> if len(word) == 1 and word[0] == board[point[0]][point[1]]: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> w = len(board[0]) <NEW_LINE> h = len(board) <NEW_LINE> visited_points = ... | BFS 알고리즘을 통해 접근하려함
-> failed ..
BFS로는 불가능한 지점에 마주쳤을 때, 이전 지점으로 backtracking 하는 방법이 떠오르지 않음 | 62598f8e8da39b475be02dc4 |
class ArticleList(generic.ListView): <NEW_LINE> <INDENT> model = Article <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(ArticleList, self).get_context_data(**kwargs) <NEW_LINE> if can_view_hidden_post(self.request.user): <NEW_LINE> <INDENT> objects = Article.objects.filter(show_in_... | Blog's newsfeed. Shows all visible articles with ``show_in_feed == True``
Base temlate is ``blog/article_list.html``. | 62598f8e498bea3a75a5770c |
class DiffCommand(VcsCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> vcs = get_vcs(self.get_working_dir()) <NEW_LINE> filepath = self.view.file_name() <NEW_LINE> filename = os.path.basename(filepath) <NEW_LINE> max_file_size = self.settings.get('max_file_size', 1024) * 1024 <NEW_LINE> if not os.p... | Here you can define diff commands for your VCS
method name pattern: %(vcs_name)s_diff_command | 62598f8e851cf427c66b7ea7 |
class CentroidExtractorDialogTest(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 test_icon_png(self): <NEW_LINE> <INDENT> path = ':/plugins/CentroidExtractor/icon.png' <NEW_LINE> icon = QIcon(path... | Test rerources work. | 62598f8ecad5886f8bdc4e80 |
class AlwaysReject(AuthProvider): <NEW_LINE> <INDENT> plugin_type = 'alwaysreject' <NEW_LINE> def authenticate(self, login, password, options): <NEW_LINE> <INDENT> return (None, '', '') <NEW_LINE> <DEDENT> def authenticate_user(self, user, password, options): <NEW_LINE> <INDENT> log.debug("User: %s, ALWAYSREJECT: None"... | A simple authenticator that just accepts users (does not care about their
password). | 62598f8e85dfad0860cbf864 |
class RegisteredUserViewset(mixins.ListModelMixin, mixins.RetrieveModelMixin, viewsets.GenericViewSet): <NEW_LINE> <INDENT> queryset = ActivityUserInfo.objects.all().order_by('-addtime') <NEW_LINE> authentication_classes = (authentication.SessionAuthentication, JSONWebTokenAuthentication) <NEW_LINE> permission_classes ... | 获取当前报名的用户信息 | 62598f8e596a89723612785f |
class MotionCreateAmendmentView(MotionCreateView): <NEW_LINE> <INDENT> def dispatch(self, *args, **kwargs): <NEW_LINE> <INDENT> if not config['motion_amendments_enabled']: <NEW_LINE> <INDENT> raise Http404('Amendments are disabled in the config.') <NEW_LINE> <DEDENT> return super().dispatch(*args, **kwargs) <NEW_LINE> ... | Create an amendment. | 62598f8e66656f66f7d59fdf |
class CrossingBelow(Criteria): <NEW_LINE> <INDENT> def __init__(self, param1, param2): <NEW_LINE> <INDENT> Criteria.__init__(self) <NEW_LINE> if isinstance(param1, TechnicalIndicator): <NEW_LINE> <INDENT> param1 = param1.value <NEW_LINE> <DEDENT> if isinstance(param2, TechnicalIndicator): <NEW_LINE> <INDENT> param2 = p... | Criteria used to determine if a technical indicator or symbol OHLCV is
in the process of crossing below another technical indicator, symbol
OHLCV, or value. | 62598f8e94891a1f408b94e2 |
class BaseBigToken(object): <NEW_LINE> <INDENT> def __init__(self, lines, deal_func): <NEW_LINE> <INDENT> self._kids = tuple( token for token in deal_func(lines) if token is not None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def kids(self): <NEW_LINE> <INDENT> if isinstance(self._kids, GeneratorType): <NEW_LINE> <INDEN... | 基础Token
参数:
lines代表多行
deal_func代表处理函数, 一般块处理完就是行内处理
_kids孩子 | 62598f8e60cbc95b06363f29 |
class Main: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.config() <NEW_LINE> sys.exit(self.run()) <NEW_LINE> <DEDENT> except (EOFError, KeyboardInterrupt): <NEW_LINE> <INDENT> sys.exit(114) <NEW_LINE> <DEDENT> except SystemExit as exception: <NEW_LINE> <INDENT> sys.e... | Main class | 62598f8e50485f2cf55dab58 |
class Contacts(db.Model): <NEW_LINE> <INDENT> sno = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(80), unique=False, nullable=False) <NEW_LINE> phone_num = db.Column(db.String(12), unique=True, nullable=False) <NEW_LINE> msg = db.Column(db.String(120), nullable=False) <NEW_LINE> date = d... | sno,name,phone_num,msg,date,email | 62598f8ea8ecb03325870deb |
class ReturnUserStats(APIView): <NEW_LINE> <INDENT> def __getstate__(self): <NEW_LINE> <INDENT> d = dict(self.__dict__) <NEW_LINE> del d['logger'] <NEW_LINE> return d <NEW_LINE> <DEDENT> def __setstate__(self, d): <NEW_LINE> <INDENT> self.__dict__.update(d) <NEW_LINE> <DEDENT> authentication_classes = (SessionAuthentic... | CBV for returning the user's assigned quota and the currently used quota in GB"
/api/userquota
Requires authenticated user | 62598f8e6fb2d068a7693c24 |
class __qiskitGeneralBuilder__(circuitBuilder): <NEW_LINE> <INDENT> def __init__(self, nbqbits, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(nbqbits) <NEW_LINE> self.qr = QuantumRegister(self.nbqbits, 'qr') <NEW_LINE> self.qc = QuantumCircuit(self.qr) <NEW_LINE> <DEDENT> def circuit(self): <NEW_LINE> <INDENT>... | Abstract class for Qiskit-circuits builders.
| 62598f8e435de62698e9b9d7 |
class PushPage5(object): <NEW_LINE> <INDENT> def __init__(self, context, request): <NEW_LINE> <INDENT> self.context, self.request = context, request <NEW_LINE> <DEDENT> def page1(self): <NEW_LINE> <INDENT> return "page1" <NEW_LINE> <DEDENT> @push(show_contents) <NEW_LINE> def page2(self): <NEW_LINE> <INDENT> @push(show... | A PushPage view that uses the @push decorator
1. can this now also be a registered viewlet as well? | 62598f8e8e7ae83300ee8c89 |
class Inputfile(object): <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> self.filename = filename <NEW_LINE> self.read_inputfile() <NEW_LINE> <DEDENT> def read_inputfile(self): <NEW_LINE> <INDENT> in_file = open(self.filename, 'r') <NEW_LINE> self.dico = json.load(in_file) <NEW_LINE> in_file.close... | inputfile infos | 62598f8e8e71fb1e983bb699 |
class SimpleCommand(Command): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> print('OK') | simple command | 62598f8e96565a6dacd2cd6c |
class MessageBox(Qt.QObject): <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> Qt.QObject.__init__(self, parent) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def getText(cls, default, error=None): <NEW_LINE> <INDENT> if error is None: <NEW_LINE> <INDENT> error = sys.exc_info()[1] <NEW_LINE> <DEDENT> t... | error message box | 62598f8e6fece00bbaccb574 |
class SuperAdminScope(BaseScope): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self + AdminScope() | 权限依次累加 | 62598f8ed7e4931a7ef3bc86 |
class Bookmark(models.Model): <NEW_LINE> <INDENT> page_id = models.ManyToManyField(Page) <NEW_LINE> title = models.CharField(max_length=250) | user_id | 62598f8ecb5e8a47e493bf64 |
class GMLParseException(GMLException): <NEW_LINE> <INDENT> pass | Raised when the parser encounters a file format inconsistency. The nature of
the exception is in the message. | 62598f8e851cf427c66b7ea9 |
class Solution(object): <NEW_LINE> <INDENT> def __init__(self, ispace, fspace): <NEW_LINE> <INDENT> self.ncomp = ispace[2] <NEW_LINE> self.mstar = ispace[3] <NEW_LINE> self.nmesh = ispace[0] + 1 <NEW_LINE> self.ispace = ispace[:(7 + self.ncomp)].copy() <NEW_LINE> self.fspace = fspace[:ispace[6]].copy() <NEW_LINE> <DEDE... | A solution to a boundary value problem for an ODE | 62598f8efbf16365ca793c97 |
class Movie(Video): <NEW_LINE> <INDENT> VALID_RATINGS = ["G", "PG", "PG-13", "R"] <NEW_LINE> def __init__(self, video_title, video_storyline, poster_image, trailer_youtube): <NEW_LINE> <INDENT> Video.__init__(self, video_title, video_storyline, poster_image, trailer_youtube) | This class provides a way to store movie related information | 62598f8e15fb5d323ce7e916 |
class GradCam(): <NEW_LINE> <INDENT> def __init__(self, model, target_layer): <NEW_LINE> <INDENT> self.model = model <NEW_LINE> self.model.to("cuda:0").eval() <NEW_LINE> self.extractor = CamExtractor(self.model, target_layer) <NEW_LINE> <DEDENT> def generate_cam(self, input_image, target_class=None): <NEW_LINE> <INDENT... | produces class activation map | 62598f8e8c0ade5d55dc3480 |
class bzr_hr_department_type(osv.osv): <NEW_LINE> <INDENT> _name='bzr.hr.department.type' <NEW_LINE> _description=u'部门类型' <NEW_LINE> _columns={ 'name':fields.char(u'类型',size=50,required=True), } | 部门 bzr.hr.department.type
管理部门
业务部门 | 62598f8e24f1403a926856a3 |
class Customers: <NEW_LINE> <INDENT> def __init__(self, car=None, days=None, price=None, quantity=None): <NEW_LINE> <INDENT> self.quantity = quantity <NEW_LINE> self.days = days <NEW_LINE> self.price = price <NEW_LINE> self.car = car <NEW_LINE> <DEDENT> def all_cars(self): <NEW_LINE> <INDENT> print(shop_instance.rental... | create Customers class include property and behaviour of customer. | 62598f8ef8510a7c17d7df6b |
class Config(object): <NEW_LINE> <INDENT> def __init__(self, section, *fnames): <NEW_LINE> <INDENT> self._fnames = fnames <NEW_LINE> self._modified = {} <NEW_LINE> self._section = section <NEW_LINE> self._cfg = None <NEW_LINE> <DEDENT> def _needs_read(self): <NEW_LINE> <INDENT> for fname in self._fnames: <NEW_LINE> <IN... | caching ConfigParser with dict method | 62598f8ef7d966606f747bc8 |
class QuickDjangoTest(object): <NEW_LINE> <INDENT> DIRNAME = os.path.dirname(__file__) <NEW_LINE> INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.admin', ) <NEW_LINE> WEBMASTER_VERIFICATION = {} <NEW_LINE> def __init__(self, options, *args, **kwargs): ... | A quick way to run the Django test suite without a fully-configured project.
Example usage:
>>> QuickDjangoTest('app1', 'app2')
Based on a script published by Lukasz Dziedzia at:
http://stackoverflow.com/questions/3841725/how-to-launch-tests-for-django-reusable-app | 62598f8ea79ad16197769c4e |
class AtomicSimpleCPU(BaseSimpleCPU): <NEW_LINE> <INDENT> type = 'AtomicSimpleCPU' <NEW_LINE> cxx_header = "cpu/simple/atomic.hh" <NEW_LINE> @classmethod <NEW_LINE> def memory_mode(cls): <NEW_LINE> <INDENT> return 'atomic' <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def support_take_over(cls): <NEW_LINE> <INDENT> retur... | Simple CPU model executing a configurable number of
instructions per cycle. This model uses the simplified 'atomic'
memory mode. | 62598f8e6e29344779b0023e |
class Timing(object): <NEW_LINE> <INDENT> time_format = "%Y%m%d_%H%M%S" <NEW_LINE> @staticmethod <NEW_LINE> def now_localtime(): <NEW_LINE> <INDENT> return time.strftime(Timing.time_format, time.localtime()) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def parse(time_str): <NEW_LINE> <INDENT> return time.strptime(time_... | Timing class. | 62598f8e29b78933be269ed0 |
class Galleries(Enum): <NEW_LINE> <INDENT> URL = "url" <NEW_LINE> COMMENT = "comment" <NEW_LINE> SKIP = "skipped" | Image dict data | 62598f8e0fa83653e46f4acf |
class Verilator(AutotoolsPackage): <NEW_LINE> <INDENT> homepage = "https://www.veripool.org/projects/verilator" <NEW_LINE> url = "https://www.veripool.org/ftp/verilator-3.920.tgz" <NEW_LINE> version('3.920', '71de7b9ddb27a72e96ed2a04e5ccf933') <NEW_LINE> version('3.904', '7d4dc8e61d5e0e564c3016a06f0b9d07') <NEW_LI... | Verilator is the fastest free Verilog HDL simulator.
It compiles synthesizable Verilog (not test-bench code!), plus some PSL,
SystemVerilog and Synthesis assertions into C++ or SystemC code. It is
designed for large projects where fast simulation performance is of primary
concern, and is especially well suited to gene... | 62598f8ebaa26c4b54d4ee9e |
class DataAssign(APIView): <NEW_LINE> <INDENT> permission_classes = (IsAuthenticated,) <NEW_LINE> def get_object(self, request, pk): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return data_api.get_by_id(pk, request.user) <NEW_LINE> <DEDENT> except exceptions.DoesNotExist: <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <... | Assign a Data to a Workspace. | 62598f8e1f037a2d8b9e3cc5 |
class Polygon(Polyline): <NEW_LINE> <INDENT> elementname = 'polygon' | The **polygon** element defines a closed shape consisting of a set of
connected straight line segments.
Same as :class:`~svgwrite.shapes.Polyline` but closed. | 62598f8ebde94217f370745b |
class IPConfiguration(SubResource): <NEW_LINE> <INDENT> _validation = { 'etag': {'readonly': True}, 'provisioning_state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'private_ip_address': {'key': ... | IP configuration.
Variables are only populated by the server, and will be ignored when sending a request.
:param id: Resource ID.
:type id: str
:param name: The name of the resource that is unique within a resource group. This name can be
used to access the resource.
:type name: str
:ivar etag: A unique read-only st... | 62598f8e8e71fb1e983bb69b |
class InvalidActionError(Error): <NEW_LINE> <INDENT> def __init__(self, action): <NEW_LINE> <INDENT> super(InvalidActionError, self).__init__() <NEW_LINE> self.action = action | this error is raised when invalid action are assigned | 62598f8e6aa9bd52df0d4ab7 |
@register(segment=['train', 'val', 'test']) <NEW_LINE> class WikiText2(_WikiText): <NEW_LINE> <INDENT> def __init__(self, segment='train', flatten=True, skip_empty=True, tokenizer=lambda s: s.split(), bos=None, eos=C.EOS_TOKEN, root=os.path.join(get_home_dir(), 'datasets', 'wikitext-2'), **kwargs): <NEW_LINE> <INDENT> ... | WikiText-2 word-level dataset for language modeling, from Salesforce research.
WikiText2 is implemented as CorpusDataset with the default flatten=True.
From
https://blog.einstein.ai/the-wikitext-long-term-dependency-language-modeling-dataset/
License: Creative Commons Attribution-ShareAlike
Parameters
----------
se... | 62598f8e82261d6c5272fcca |
class ElasticsearchNodeType(object): <NEW_LINE> <INDENT> swagger_types = { 'master': 'bool', 'data': 'bool', 'ingest': 'bool' } <NEW_LINE> attribute_map = { 'master': 'master', 'data': 'data', 'ingest': 'ingest' } <NEW_LINE> def __init__(self, master=None, data=None, ingest=None): <NEW_LINE> <INDENT> self._master = Non... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f8ef7d966606f747bc9 |
@attr.s(frozen=True, slots=True) <NEW_LINE> class InstanceOf(TypeValidator): <NEW_LINE> <INDENT> def is_instance(self, v: Any) -> Iterator[bool]: <NEW_LINE> <INDENT> for t in self.whitelist: <NEW_LINE> <INDENT> yield isinstance(v, t) <NEW_LINE> <DEDENT> <DEDENT> def __call__(self, i: Any, a: Attribute, v: Any) -> NoRet... | A validator for an :class:`Attribute` to verify that the passed value is
a instance (in the contravariant sense) of some class in the whitelist. | 62598f8e76e4537e8c3ef197 |
class ShowEnvironmentTemperatureSchema(MetaParser): <NEW_LINE> <INDENT> schema = { Any(): { Any(): { Optional('major_threshold_celsius'): int, Optional('minor_threshold_celsius'): int, Optional('current_temp_celsius'): int, Optional('status'): str } } } | Schema for show environment temperature | 62598f8e379a373c97d98c01 |
class Container: <NEW_LINE> <INDENT> def __init__(self, size, from_file=True): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.puzzle = np.zeros((size[0], size[1])) <NEW_LINE> if from_file: <NEW_LINE> <INDENT> if sys.version_info < (3, 0): <NEW_LINE> <INDENT> self.classifier = pickle.load(classifier.get('digit')) ... | Stores puzzle data. | 62598f8ecad5886f8bdc4e82 |
class RobotsParser: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def get_sitemap_links(url): <NEW_LINE> <INDENT> parsed = parse.urlparse(url) <NEW_LINE> robot_url = '{s.scheme}://{s.netloc}/robots.txt'.format(s=parsed) <NEW_LINE> robots_txt = ReqDownloader.fetch(ReqRequest(robot_url)) <NEW_LINE> if isinstance(robots_tx... | Robots.txt parser | 62598f8e8da39b475be02dc9 |
class BLEUScore(EvalScore, Serializable): <NEW_LINE> <INDENT> yaml_tag = "!BLEUScore" <NEW_LINE> @serializable_init <NEW_LINE> def __init__(self, bleu: numbers.Real, frac_score_list: Sequence[numbers.Real] = None, brevity_penalty_score: numbers.Real = None, hyp_len: numbers.Integral = None, ref_len: numbers.Integral = ... | Class to keep a BLEU score.
Args:
bleu: actual BLEU score between 0 and 1
frac_score_list: list of fractional scores for each n-gram order
brevity_penalty_score: brevity penalty that was multiplied to the precision score.
hyp_len: length of hypothesis
ref_len: length of reference
ngram: match n-grams up to... | 62598f8e24f1403a926856a4 |
class EventPool: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.events = [] <NEW_LINE> <DEDENT> def put(self, event): <NEW_LINE> <INDENT> self.events.append(event) <NEW_LINE> <DEDENT> def next_event(self): <NEW_LINE> <INDENT> assert not self.is_empty, "No event is scheduled" <NEW_LINE> return min(self... | An event pool that store events, and expose then the increasing order of their due time | 62598f8e596a897236127863 |
class ZenAppProcessException(ZenAppException): <NEW_LINE> <INDENT> pass | Describes problems or errors that occur during the **process** phase. | 62598f8e23e79379d538c0eb |
class Headers: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.make_headers() <NEW_LINE> self.print_headers() <NEW_LINE> <DEDENT> def make_headers(self): <NEW_LINE> <INDENT> headers = '' <NEW_LINE> for h in ['ssn', 'cc_num', 'first', 'last', 'gender', 'street', 'city', 'state', 'zip', ... | Store the headers and print to stdout to pipe into csv | 62598f8ea79ad16197769c50 |
class Restore(base.Command): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(_): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def Run(self, unused_args): <NEW_LINE> <INDENT> self.group.update_manager.Restore() | Restore the Cloud SDK installation to its previous state.
This is an undo operation, which restores the Cloud SDK installation on the
local workstation to the state it was in just before the most recent
`[{parent_command}] update` or `[{parent_command}] remove` command. Only the
state before the most recent such state... | 62598f8e8e71fb1e983bb69c |
class InvalidPublicKeySpecifier(Exception): <NEW_LINE> <INDENT> pass | InvalidPublicKeySpecifier error | 62598f8e442bda511e95c049 |
class SPPScheduler(analysis.Scheduler): <NEW_LINE> <INDENT> def __init__(self, priority_cmp=prio_low_wins_equal_fifo): <NEW_LINE> <INDENT> analysis.Scheduler.__init__(self) <NEW_LINE> self.priority_cmp = priority_cmp <NEW_LINE> <DEDENT> def b_plus(self, task, q, details=None): <NEW_LINE> <INDENT> assert(task.scheduling... | Static-Priority-Preemptive Scheduler
Priority is stored in task.scheduling_parameter,
by default numerically lower numbers have a higher priority
Policy for equal priority is FCFS (i.e. max. interference). | 62598f8e3617ad0b5ee05d30 |
class Snippet(models.Model): <NEW_LINE> <INDENT> name = models.CharField( verbose_name=_('Name'), unique=True, max_length=255, ) <NEW_LINE> html = models.TextField( verbose_name=_('HTML'), blank=True, ) <NEW_LINE> template = models.CharField( verbose_name=_('Template'), blank=True, max_length=255, help_text=_('Enter a ... | A snippet of HTML or a Django template | 62598f8e925a0f43d25e7c22 |
class AccountSettings(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def retrieve(): <NEW_LINE> <INDENT> request = naas.requests.AccountSettings.retrieve() <NEW_LINE> if request: <NEW_LINE> <INDENT> response_data = request.json().get('data') <NEW_LINE> return AccountSetting(response_data) <NEW_LINE> <DEDENT> Con... | Account Settings
===============
This returns an instance of the account settings domain model | 62598f8e097d151d1a2c0c13 |
class SelectorTests (VersionTest): <NEW_LINE> <INDENT> def basic_selection_test(self, node): <NEW_LINE> <INDENT> properties = [(1, 'red','dog'), (2, 'black', 'cat'), (3, 'red', 'squirrel'), (4, 'grey', 'squirrel')] <NEW_LINE> msgs = [Message(content="%s.%s" % (colour, creature), properties={'sequence':sequence,'colour'... | Tests for the selector filter registered for AMQP 1.0 under the
apache namespace. | 62598f8e50485f2cf55dab5c |
class AbstractsDownloadAttachmentsMixin(ZipGeneratorMixin): <NEW_LINE> <INDENT> def _prepare_folder_structure(self, item): <NEW_LINE> <INDENT> abstract_title = secure_filename('{}_{}'.format(unicode(item.abstract.friendly_id), item.abstract.title), 'abstract') <NEW_LINE> file_name = secure_filename('{}_{}'.format(unico... | Generate a ZIP file with attachment files for a given list of abstracts | 62598f8efb3f5b602db47fa7 |
class Deck: <NEW_LINE> <INDENT> _counts = { 'guard': 5, 'priest': 2, 'baron': 2, 'handmaid': 2, 'prince': 2, 'king': 1, 'countess': 1, 'princess': 1 } <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> classes = {} <NEW_LINE> self.cards = [] <NEW_LINE> for card_type in self._counts.keys(): <NEW_LINE> <INDENT> module = ... | A representation of a deck of cards.
Construct the full deck based on the count of each card type. | 62598f8e15baa72349461b66 |
class Synthesizer(object): <NEW_LINE> <INDENT> online_dict_url = "http://www.lextutor.ca/freq/lists_download/awl_heads.txt" <NEW_LINE> def __init__(self, path='/usr/share/dict/words', force_dload=False): <NEW_LINE> <INDENT> if os.path.exists(path) and not force_dload: <NEW_LINE> <INDENT> with open(path) as fobj: <NEW_L... | Helper object for synthesizing dataframes from arrays. | 62598f8e16aa5153ce4000f1 |
class ProductModel(db.Model): <NEW_LINE> <INDENT> __tablename__ = "Products" <NEW_LINE> pk_id = db.Column(db.Integer, primary_key=True, unique=True) <NEW_LINE> product_id = db.Column(db.Integer) <NEW_LINE> name = db.Column(db.String(64)) <NEW_LINE> description = db.Column(db.String(1024)) <NEW_LINE> offers = db.relatio... | Data model representing a product. | 62598f8e287bf620b62717a4 |
class ClientOptions(RawUsageOptions): <NEW_LINE> <INDENT> longdesc = __doc__ <NEW_LINE> optParameters = [ ["port", "p", 58846, "Server Port", int], ["host", "H", "localhost", "Server hostname"], ] <NEW_LINE> def opt_port(self, port): <NEW_LINE> <INDENT> self.opts['port'] = int(port) <NEW_LINE> <DEDENT> def executeComma... | Run Client | 62598f8e1f037a2d8b9e3cc7 |
class DescribeTaskLogsResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TotalCount = None <NEW_LINE> self.TaskInstanceLogSet = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TotalCount = params.get("TotalCount") ... | DescribeTaskLogs response structure.
| 62598f8e8e71fb1e983bb69d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.