code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class ConcreteHandlerA(Handler): <NEW_LINE> <INDENT> def handle_request(self, content): <NEW_LINE> <INDENT> if (content > 0) and (content < 10): <NEW_LINE> <INDENT> print('A正在处理:%s' % content) <NEW_LINE> <DEDENT> elif self.successor is not None: <NEW_LINE> <INDENT> self.successor.handle_request(content) | 目体处理者类 | 625990bbc4546d3d9def83c5 |
class SetToDictField(z3c.form.datamanager.AttributeField): <NEW_LINE> <INDENT> key_attr = 'name' <NEW_LINE> def get(self): <NEW_LINE> <INDENT> context = self.context <NEW_LINE> if self.field.interface is not None: <NEW_LINE> <INDENT> context = self.field.interface(context) <NEW_LINE> <DEDENT> return getattr(context, se... | Puts a Set into a Dict field. | 625990bb627d3e7fe0e090c0 |
class Optimizer(EventHandler): <NEW_LINE> <INDENT> __name__ = 'optimizer' <NEW_LINE> def __init__(self, model, optimizer_class_name, accumulate_gradients=False, **kwargs): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.optimizer = s2c(optimizer_class_name)(model.parameters(), **kwargs) <NEW_LINE> self.accumulat... | Optimizer is the main event handler for optimizers. Just pass a PyTorch scheduler together with its arguments in the
configuration file. | 625990bbc4546d3d9def83c8 |
class TestFooBar(TestCase): <NEW_LINE> <INDENT> def test_blah(self): <NEW_LINE> <INDENT> self.assertTrue(1) | Foo Bar test. | 625990bbc4546d3d9def83c9 |
class EquipmentObdEngineState(object): <NEW_LINE> <INDENT> openapi_types = { 'time': 'str', 'value': 'str' } <NEW_LINE> attribute_map = { 'time': 'time', 'value': 'value' } <NEW_LINE> def __init__(self, time=None, value=None, local_vars_configuration=None): <NEW_LINE> <INDENT> if local_vars_configuration is None: <NEW_... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 625990bc187af65679d2ad14 |
class UreyBradley(BondStretch): <NEW_LINE> <INDENT> pass | A urey-bradley term -- functionally identical to a bond-stretch | 625990bcc4546d3d9def83d3 |
class ExDeploymentParams(models.Model): <NEW_LINE> <INDENT> ipAddress = CharField(max_length=16, primary_key=True) <NEW_LINE> fqdn = CharField(max_length=128, null=True) <NEW_LINE> netmask = CharField(max_length=16, default='255.255.255.0') <NEW_LINE> adminPasswd = CharField(max_length=128, null=True) <NEW_LINE> def __... | Parameter model class | 625990bc627d3e7fe0e090da |
class BaseDeserializer(Field): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> empty_values = (None, "") <NEW_LINE> def __init__(self, data=None, **kwargs): <NEW_LINE> <INDENT> super(BaseDeserializer, self).__init__(**kwargs) <NEW_LINE> self._init_data(data) <NEW_LINE> <DEDENT> def _init_data(self, data): <NEW_LINE> <IND... | The main implementation of Deserializers logic. Note that this class is
slightly different from the classic Form. | 625990bc627d3e7fe0e090e6 |
class WxApi(object): <NEW_LINE> <INDENT> WECHAT_CONFIG = settings.WECHAT_CONFIG <NEW_LINE> def __init__(self, ): <NEW_LINE> <INDENT> self.client = WeChatClient( app_id=self.WECHAT_CONFIG["app_id"], secret=self.WECHAT_CONFIG["secret"], ) <NEW_LINE> self.pay = WeChatPay( app_id=self.WECHAT_CONFIG["app_id"], api_key_path=... | 封装接口, 使用直接调用 | 625990bc627d3e7fe0e090e8 |
class FrozenInstanceError(AttributeError): <NEW_LINE> <INDENT> msg = "can't set attribute" <NEW_LINE> args = [msg] | A frozen/immutable instance has been attempted to be modified.
It mirrors the behavior of ``namedtuples`` by using the same error message
and subclassing :exc:`AttributeError`.
.. versionadded:: 16.1.0 | 625990bd187af65679d2ad23 |
class AttributeFilter(Type): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def pyre_harvest(cls, attributes, descriptor): <NEW_LINE> <INDENT> for name, attribute in attributes.items(): <NEW_LINE> <INDENT> if isinstance(attribute, descriptor) and not cls.pyre_isReserved(name): <NEW_LINE> <INDENT> yield name, attribute <NE... | A base metaclass that enables attribute classification.
A common pattern in pyre is to define classes that contain special attributes that collect
declarative metadata. These attributes are processed by special purpose metaclasses and
are converted into appropriate behavior. For example, components have properties, wh... | 625990bd627d3e7fe0e090f6 |
class ConfiguredDoorbird(): <NEW_LINE> <INDENT> def __init__(self, device, name, events=None, custom_url=None): <NEW_LINE> <INDENT> self._name = name <NEW_LINE> self._device = device <NEW_LINE> self._custom_url = custom_url <NEW_LINE> self._monitored_events = events <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(sel... | Attach additional information to pass along with configured device. | 625990bd627d3e7fe0e090fa |
class ValidationError(SigningError): <NEW_LINE> <INDENT> pass | Validation related errors
Usage:
raise ValidationError("error message") | 625990bd627d3e7fe0e090fc |
class ItemNotificationTextExtender(ExtenderBase): <NEW_LINE> <INDENT> layer = IShopExtensionLayer <NEW_LINE> fields = [ XTextField( name='order_text', schemata='Shop', default_content_type="text/plain", allowable_content_types=('text/plain',), default_output_type="text/plain", widget=TextAreaWidget( label=_( u'label_or... | Schema extender for notification text.
| 625990bd627d3e7fe0e09102 |
class CreateGid(Method): <NEW_LINE> <INDENT> interfaces = ['registry'] <NEW_LINE> accepts = [ Mixed(Parameter(str, "Credential string"), Parameter(type([str]), "List of credentials")), Parameter(str, "URN or HRN of certificate owner"), Parameter(str, "Certificate string"), ] <NEW_LINE> returns = Parameter(int, "String ... | Create a signed credential for the s object with the registry. In addition to being stored in the
SFA database, the appropriate records will also be created in the
PLC databases
@param xrn urn or hrn of certificate owner
@param cert caller's certificate
@param cred credential string
@return gid string representation | 625990be187af65679d2ad35 |
class IndexView(View): <NEW_LINE> <INDENT> template_name = 'pages/index.html' <NEW_LINE> context = {} <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> if request.user.is_authenticated: <NEW_LINE> <INDENT> return redirect('/activity-feed/') <NEW_LINE> <DEDENT> return render(request, self.template_... | view to render the index page | 625990be627d3e7fe0e09120 |
class Individual: <NEW_LINE> <INDENT> def __init__(self, bools_array): <NEW_LINE> <INDENT> self.solution = bools_array <NEW_LINE> self.fitness = -1 <NEW_LINE> <DEDENT> def get_fitness(self, problem): <NEW_LINE> <INDENT> fitness = 0 <NEW_LINE> for clause in problem["clauses"]: <NEW_LINE> <INDENT> check = False <NEW_LINE... | Purpose: individual class that includes a get_fitness method to calculate
the fitness of an individual. | 625990bf187af65679d2ad44 |
class Vault(object): <NEW_LINE> <INDENT> def __init__(self, password): <NEW_LINE> <INDENT> self.password = password <NEW_LINE> self.vault = VaultLib(password) <NEW_LINE> <DEDENT> def load(self, stream): <NEW_LINE> <INDENT> return yaml.load(self.vault.decrypt(stream)) [0] | R/W an ansible-vault yaml file | 625990bf187af65679d2ad45 |
class BooleanProperty(ndb.BooleanProperty, _SetFromDictPropertyMixin): <NEW_LINE> <INDENT> def _set_from_dict(self, value): <NEW_LINE> <INDENT> def cast(val): <NEW_LINE> <INDENT> if val in ['false', 'False']: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> return bool(val) <NEW_LINE> <DEDENT> if self._repeated: <N... | BooleanProperty modified. | 625990bf627d3e7fe0e09138 |
class Macro(IPyAutocall): <NEW_LINE> <INDENT> def __init__(self,data): <NEW_LINE> <INDENT> self.value = ''.join(data).rstrip()+'\n' <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.value <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return 'IPython.macro.Macro(%s)' % repr(self.value)... | Simple class to store the value of macros as strings.
Macro is just a callable that executes a string of IPython
input when called.
Args to macro are available in _margv list if you need them. | 625990bf627d3e7fe0e0913e |
class CT_ShapeProperties(Fillable): <NEW_LINE> <INDENT> child_tagnames = ChildTagnames.from_nested_sequence( 'a:xfrm', EG_Geometry.__member_names__, EG_FillProperties.__member_names__, 'a:ln', EG_EffectProperties.__member_names__, 'a:scene3d', 'a:sp3d', 'a:extLst', ) <NEW_LINE> @property <NEW_LINE> def cx(self): <NEW_L... | Custom element class for <p:spPr> element. Shared by ``<p:sp>``,
``<p:pic>``, and ``<p:cxnSp>`` elements as well as a few more obscure
ones. | 625990bf187af65679d2ad4b |
class CFBMode(CipherMode): <NEW_LINE> <INDENT> name = "CFB" <NEW_LINE> def __init__(self, block_cipher, block_size): <NEW_LINE> <INDENT> CipherMode.__init__(self, block_cipher, block_size) <NEW_LINE> <DEDENT> def encrypt_block(self, plaintext): <NEW_LINE> <INDENT> cipher_iv = self._block_cipher.cipher_block(self._iv) <... | Perform CFB operation on a block and retain IV information for next operation | 625990bf187af65679d2ad4c |
class E2ETriples(SparqlQuery): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return 'SELECT DISTINCT ?subject ?object ?predicate' + self.graph + 'WHERE {?subject ?predicate ?object . FILTER isIRI(?object) }' | A class for the sparql query that returns the number of triples | 625990c0627d3e7fe0e09154 |
class DefaultBranchForm(wtf.Form): <NEW_LINE> <INDENT> branches = wtforms.SelectField( 'default_branch', [wtforms.validators.Required()], choices=[(item, item) for item in []] ) <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(DefaultBranchForm, self).__init__(*args, **kwargs) <NEW_LINE> if 'br... | Form to change the default branh for a repository | 625990c0627d3e7fe0e0915c |
class IotHubNameAvailabilityInfo(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'name_available': {'readonly': True}, 'reason': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, 'reason': {'key': 'reason', 'type': 'str'}, 'message': {'key':... | The properties indicating whether a given IoT hub name is available.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name_available: The value which indicates whether the provided name is available.
:vartype name_available: bool
:ivar reason: The reason for unavailability... | 625990c0627d3e7fe0e09164 |
class ApplicationGatewayAvailableSslOptions(Resource): <NEW_LINE> <INDENT> _validation = { 'name': {'readonly': True}, 'type': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'location': {'key': 'loca... | Response for ApplicationGatewayAvailableSslOptions API service call.
Variables are only populated by the server, and will be ignored when sending a request.
:param id: Resource ID.
:type id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:param location: Resource locat... | 625990c0627d3e7fe0e09166 |
class QuickTemplateCommand(sublime_plugin.TextCommand): <NEW_LINE> <INDENT> def run(self, edit): <NEW_LINE> <INDENT> view = self.view <NEW_LINE> command_titles = [ 'QuickTemplate: Apply template', 'QuickTemplate: Create new template file', 'QuickTemplate: Create new data file', 'QuickTemplate: Open template file', 'Qui... | List and execute various commands | 625990c0627d3e7fe0e0916a |
class PrintingDocument(AstNode): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> AstNode.__init__(self) | The printing document class. | 625990c0187af65679d2ad60 |
class ThreadLocalCassandraSession(object): <NEW_LINE> <INDENT> def __init__(self, keyspace): <NEW_LINE> <INDENT> self.keyspace = keyspace <NEW_LINE> self.client = db.get_client(keyspace) <NEW_LINE> self._tl = threading.local() <NEW_LINE> self._tl.column_families = dict() <NEW_LINE> <DEDENT> def in_session(self, name): ... | A per-keyspace cassandra session | 625990c0187af65679d2ad61 |
class TestPredictionResourceRelationshipsAlertsLinks(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 testPredictionResourceRelationshipsAlertsLinks(self): <NEW_LINE> <INDENT> pass | PredictionResourceRelationshipsAlertsLinks unit test stubs | 625990c1187af65679d2ad6c |
class CSAError(Exception): <NEW_LINE> <INDENT> pass | An error occurred when interfacing with CSA | 625990c1187af65679d2ad6d |
class Agent_HI_RDT_IEC_Learned(HI_RCT_Agent): <NEW_LINE> <INDENT> def __init__ (self, training_model, actors, IEC_TOL): <NEW_LINE> <INDENT> HI_RCT_Agent.__init__(self, training_model, actors) <NEW_LINE> self.IEC_TOL = IEC_TOL <NEW_LINE> self.rel_hist = dict() <NEW_LINE> self.last_choices = None <NEW_LINE> <DEDENT> def ... | Agent that maximizes by the intents of those known (a priori) to
be the relevant IECs of actors in the environment | 625990c1187af65679d2ad72 |
class Company(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=80, unique=True) <NEW_LINE> logo = models.ImageField(upload_to='uploads', blank=True, null=True) <NEW_LINE> slug = models.CharField(max_length=80, unique=True, blank=True) <NEW_LINE> visible = models.BooleanField(default=True) <NEW_LINE... | Company model | 625990c1627d3e7fe0e09191 |
class RedisError(ServerException): <NEW_LINE> <INDENT> def __init__(self, e): <NEW_LINE> <INDENT> super(RedisError, self).__init__( code=ResultCode.REDIS_ERROR.value, message=f"{self.__class__.__name__}: {e}" ) | Redis 发生错误时抛出此异常, e 为字符串或某异常, 当为异常实例时
使用 f-string 相当于 str(e) | 625990c2187af65679d2ad75 |
class MultiApp: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.apps = [] <NEW_LINE> <DEDENT> def add_app(self, title, func): <NEW_LINE> <INDENT> self.apps.append({ "title": title, "function": func }) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> image = 'data/logo01.png' <NEW_LINE> st.sidebar... | Framework for combining multiple streamlit applications.
Usage:
def foo():
st.title("Hello Foo")
def bar():
st.title("Hello Bar")
app = MultiApp()
app.add_app("Foo", foo)
app.add_app("Bar", bar)
app.run()
It is also possible keep each application in a separate file.
import fo... | 625990c2187af65679d2ad76 |
@MitsubaNodeTypes.register <NEW_LINE> class MtsNodeBsdf_diffuse(mitsuba_bsdf_node, Node): <NEW_LINE> <INDENT> bl_idname = 'MtsNodeBsdf_diffuse' <NEW_LINE> bl_label = 'Diffuse' <NEW_LINE> plugin_types = {'diffuse', 'roughdiffuse'} <NEW_LINE> def draw_buttons(self, context, layout): <NEW_LINE> <INDENT> layout.prop(self, ... | Diffuse material node | 625990c2627d3e7fe0e0919d |
class PersistenceError(Exception): <NEW_LINE> <INDENT> pass | Raised when an error occurs in a Persist class | 625990c2627d3e7fe0e091a1 |
class LengthHeightUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): <NEW_LINE> <INDENT> IN_ENUM = "IN" <NEW_LINE> CM = "CM" | Unit for the dimensions of length, height and width.
| 625990c2187af65679d2ad7c |
class AnetError(RuntimeError): <NEW_LINE> <INDENT> pass | Passes any errors received after the REST request comes back. | 625990c2627d3e7fe0e091a5 |
class MailAddr(object): <NEW_LINE> <INDENT> def __init__(self, email): <NEW_LINE> <INDENT> self.email_complete = email <NEW_LINE> self.email_address = self.__address_from_email() <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.email_address <NEW_LINE> <DEDENT> def __get_complete(self): <NEW_LINE>... | Mail object wrapper | 625990c2187af65679d2ad7e |
class Identifier(Node): <NEW_LINE> <INDENT> def parse(self, scope): <NEW_LINE> <INDENT> names = [] <NEW_LINE> name = [] <NEW_LINE> self._subp = ( '@media', '@keyframes', '@-moz-keyframes', '@-webkit-keyframes', '@-ms-keyframes' ) <NEW_LINE> if self.tokens and hasattr(self.tokens, 'parse'): <NEW_LINE> <INDENT> self.toke... | Identifier node. Represents block identifier.
| 625990c2187af65679d2ad82 |
class FrankelEtAl1996MwNSHMP2008(FrankelEtAl1996MblgAB1987NSHMP2008): <NEW_LINE> <INDENT> kind = "Mw" | Extend :class:`FrankelEtAl1996MblgAB1987NSHMP2008` but assumes magnitude
to be in Mw scale and therefore no conversion is applied. | 625990c3187af65679d2ad85 |
class Permission(models.Model): <NEW_LINE> <INDENT> url = models.CharField(max_length=255, verbose_name='权限', unique=True) <NEW_LINE> title = models.CharField(max_length=32, verbose_name='标题') <NEW_LINE> name = models.CharField(max_length=32, verbose_name='URL别名', unique=True) <NEW_LINE> menu = models.ForeignKey('Menu'... | 权限表
menu_id
有 表示当前的权限是二级菜单 也是父权限
没有 就是一个普通的权限
parent_id
有 表示当前的权限是一个子权限
没有 父权限 | 625990c3627d3e7fe0e091b7 |
class IndexHandler(BaseHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> self.render("index.html", {'jobs': DEFAULT_JOBS}) | Render the index. | 625990c3627d3e7fe0e091bf |
class CityAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> def response_add(self, request, obj, add_another_url='admin:admin_custom_urls_city_changelist', **kwargs): <NEW_LINE> <INDENT> return super(CityAdmin, self).response_add(request, obj, add_another_url=add_another_url, **kwargs) | A custom ModelAdmin that redirects to the changelist when the user
presses the 'Save and add another' button when adding a model instance. | 625990c3187af65679d2ad8a |
class PostPage(BlogHandler): <NEW_LINE> <INDENT> def get(self, post_id): <NEW_LINE> <INDENT> key = db.Key.from_path('Post', int(post_id), parent=blog_key()) <NEW_LINE> post = db.get(key) <NEW_LINE> comments = Comment.all().order('-created').filter('post_id =', int(post_id)) <NEW_LINE> post_likes = post.likes <NEW_LINE>... | Post Page class used to show the individual post the user
submitted to the blog. Along with comments on the post by other users. | 625990c3627d3e7fe0e091c3 |
class Application(tkinter.Frame): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> logger.print(3, "Application init method was called") <NEW_LINE> tkinter.Frame.__init__(self, padx=10, pady=10) <NEW_LINE> self.grid(sticky=tkinter.W+tkinter.E+tkinter.N+tkinter.S) <NEW_LINE> self.master.title("VSFTPD Log anal... | Application class is user to create the application and to have its own variablepool and methods | 625990c3627d3e7fe0e091c9 |
class ShowDashboard(webapp2.RequestHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> build_status_loader = load_build_status.BuildStatusLoader() <NEW_LINE> build_status_data = build_status_loader.load_build_status_data() <NEW_LINE> last_updated_at = build_status_loader.load_last_modified_at() <NEW_LINE> ... | Shows the dashboard page.
The page is shown by grabbing data we have stored previously
in the App Engine database using the AddCoverageData handler. | 625990c3187af65679d2ad8f |
class AdjacencyList: <NEW_LINE> <INDENT> def __init__(self, size: int): <NEW_LINE> <INDENT> self._graph: List[List[Edge]] = [[] for _ in range(size)] <NEW_LINE> self._size = size <NEW_LINE> <DEDENT> def __getitem__(self, vertex: int) -> Iterator[Edge]: <NEW_LINE> <INDENT> return iter(self._graph[vertex]) <NEW_LINE> <DE... | Graph adjacency list. | 625990c3627d3e7fe0e091cd |
class EnvelopeTwo(Envelope): <NEW_LINE> <INDENT> def __init__(self, height: int, width: int) -> None: <NEW_LINE> <INDENT> self._height = SafeProperty(EnvelopeHeight(height)) <NEW_LINE> self._width = SafeProperty(EnvelopeWidth(width)) <NEW_LINE> <DEDENT> def size(self) -> int: <NEW_LINE> <INDENT> return self._height.val... | Concrete envelope object. | 625990c4187af65679d2ad95 |
class RadioButtonWidget(QWidget): <NEW_LINE> <INDENT> def __init__(self, label, instruction, button_list): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.title_label = QLabel(label) <NEW_LINE> self.radio_group_box = QGroupBox(instruction) <NEW_LINE> self.radio_button_group = QButtonGroup() <NEW_LINE> self.radio... | creates the radio button with options for crops | 625990c4187af65679d2ad97 |
class one_of: <NEW_LINE> <INDENT> def __init__(self, label, *args): <NEW_LINE> <INDENT> self.label = label <NEW_LINE> self.rules = list(args) <NEW_LINE> <DEDENT> def validate(self, dwelling): <NEW_LINE> <INDENT> passed = 0 <NEW_LINE> for r in self.rules: <NEW_LINE> <INDENT> thispassed, newmsgs = r.validate(dwelling) <N... | Only one subrule is allowed to validate | 625990c4627d3e7fe0e091eb |
class FeedbackList(MyBaseHandler): <NEW_LINE> <INDENT> @token_required() <NEW_LINE> @my_async_jsonp <NEW_LINE> @my_async_paginator_list <NEW_LINE> async def get(self): <NEW_LINE> <INDENT> mongo_coon = self.get_async_mongo() <NEW_LINE> res = await mongo_coon['feedback_msg'].find({}) <NEW_LINE> list = [] <NEW_LINE> for i... | 查看列表 | 625990c4627d3e7fe0e091ed |
class BitField(object): <NEW_LINE> <INDENT> def __init__(self, from_bit: int, to_bit: int): <NEW_LINE> <INDENT> assert 0 <= from_bit < WORD_SIZE <NEW_LINE> assert from_bit <= to_bit <= WORD_SIZE <NEW_LINE> self.from_bit = from_bit <NEW_LINE> self.to_bit = to_bit <NEW_LINE> width = (to_bit - from_bit) + 1 <NEW_LINE> sel... | A BitField object extracts specified
bitfields from an integer. | 625990c4627d3e7fe0e091f1 |
class IPlaylistBlock(IBlock): <NEW_LINE> <INDENT> referenced_playlist = zope.schema.Choice( title=_("Playlist"), source=zeit.content.video.interfaces.PlaylistSource()) | A block which contains the link to a video playlist. | 625990c7627d3e7fe0e09238 |
class ContactResource(resources.ModelResource): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Contact <NEW_LINE> fields = ( "title", "full_name", "email", "phone_number", "message", "created_at", ) | ModelResource is Resource subclass for handling Django models. | 625990c7627d3e7fe0e0924a |
class FileChecksum(_BoilerplateClass): <NEW_LINE> <INDENT> algorithm: str <NEW_LINE> bytes: str <NEW_LINE> length: int | :param algorithm: The name of the checksum algorithm.
:type algorithm: str
:param bytes: The byte sequence of the checksum in hexadecimal.
:type bytes: str
:param length: The length of the bytes (not the length of the string).
:type length: int | 625990c8627d3e7fe0e0925e |
class NikolaTaskLoader(TaskLoader): <NEW_LINE> <INDENT> def __init__(self, nikola): <NEW_LINE> <INDENT> self.nikola = nikola <NEW_LINE> <DEDENT> def load_tasks(self, cmd, opt_values, pos_args): <NEW_LINE> <INDENT> DOIT_CONFIG = { 'reporter': ExecutedOnlyReporter, 'default_tasks': ['render_site', 'post_render'], } <NEW_... | custom task loader to get tasks from Nikola instead of dodo.py file | 625990c8627d3e7fe0e0926a |
class ResistanceTemperatureDevice(models.Model): <NEW_LINE> <INDENT> alpha = models.FloatField(default=0.00385) <NEW_LINE> zero_resistance = models.FloatField(default=100.0) | An RTD sensor device itself. Just the electrical properties of the
device.
Attributes:
alpha: The RTD resistance coefficient. Units: Ohms/degC.
zero_resistance: The resistance of the RTD at 0degC. Units: Ohms. | 625990c8627d3e7fe0e0926c |
@api.route('/<int:cid>') <NEW_LINE> @api.response(404, 'Creator not found') <NEW_LINE> @api.param('id', 'The creator identifier') <NEW_LINE> class CreatorResource(Resource): <NEW_LINE> <INDENT> @api.doc('get_creator') <NEW_LINE> @api.marshal_with(creatorModel) <NEW_LINE> def get(self, cid): <NEW_LINE> <INDENT> c = crea... | Show a single creator and lets you delete them | 625990c8627d3e7fe0e09270 |
class UpdateAmphoraDBCertExpiration(BaseDatabaseTask): <NEW_LINE> <INDENT> def execute(self, amphora_id, server_pem): <NEW_LINE> <INDENT> LOG.debug("Update DB cert expiry date of amphora id: %s", amphora_id) <NEW_LINE> key = utils.get_compatible_server_certs_key_passphrase() <NEW_LINE> fer = fernet.Fernet(key) <NEW_LIN... | Update the amphora expiration date with new cert file date. | 625990c9627d3e7fe0e0928c |
class ASTPrimary(NamedTuple): <NEW_LINE> <INDENT> name: str <NEW_LINE> values: List[str] <NEW_LINE> def evaluate(self, path: Path): <NEW_LINE> <INDENT> return PATH_OPERAND_EVALUATORS[self.name](path, *self.values) <NEW_LINE> <DEDENT> def size(self): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> @classmethod <NEW_LIN... | Represents a primary expression (an operand and an optional number of values that evaluate to a boolean value) | 625990c9627d3e7fe0e0928e |
class ReaderModule(BaseModule): <NEW_LINE> <INDENT> async def setup(self, parsed_args, app, output): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> async def run(self, parsed_args: argparse.Namespace, output: Pipe): <NEW_LINE> <INDENT> assert False, "implement in child class" <NEW_LINE> <DEDENT> async def run_as_task(sel... | Inherit from this class and implement a :meth:`run` coroutine to create a Joule reader module.
Other methods documented below may be implemented as desired. | 625990c9627d3e7fe0e09292 |
class UserAskView(View): <NEW_LINE> <INDENT> def post(self, request): <NEW_LINE> <INDENT> userask_form = UserAskForm(request.POST) <NEW_LINE> if userask_form.is_valid(): <NEW_LINE> <INDENT> user_ask = userask_form.save(commit=True) <NEW_LINE> return HttpResponse('{"status":"success"}', content_type='application/json') ... | 用户添加咨询 | 625990c9627d3e7fe0e09294 |
class DynamicLogger(object): <NEW_LINE> <INDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> return getattr(_logger, name) | Dynamic logger. | 625990ca627d3e7fe0e0929c |
class LocalTracking(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _get_voxel_size(affine): <NEW_LINE> <INDENT> lin = affine[:3, :3] <NEW_LINE> dotlin = np.dot(lin.T, lin) <NEW_LINE> if not np.allclose(np.triu(dotlin, 1), 0.): <NEW_LINE> <INDENT> msg = ("The affine provided seems to contain shearing, data mu... | A streamline generator for local tracking methods | 625990ca627d3e7fe0e092a6 |
class CommServerPackager(Packager): <NEW_LINE> <INDENT> def __init__(self, src): <NEW_LINE> <INDENT> Packager.__init__(self, src, "UberStrok.Realtime.Server.Comm") <NEW_LINE> <DEDENT> def pack(self, archive): <NEW_LINE> <INDENT> if not Packager.pack(self, archive): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> f... | represents a packager which
packages the comm server | 625990cb627d3e7fe0e092d0 |
class Float4(object): <NEW_LINE> <INDENT> def __init__(self, x, y, z, val = 0.0): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.z = z <NEW_LINE> self.val = val <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def getZeroVector(): <NEW_LINE> <INDENT> return Float4( 0.0, 0.0, 0.0, 0.0 ) <NEW_LINE> <DED... | For good vectorization on OpenCL device we need to use 4 dimension vectors | 625990cb627d3e7fe0e092d2 |
class ContinuousTableModel(QAbstractTableModel): <NEW_LINE> <INDENT> def __init__(self, banddata, bandNames, stretch, parent): <NEW_LINE> <INDENT> QAbstractTableModel.__init__(self, parent) <NEW_LINE> self.banddata = banddata <NEW_LINE> self.bandNames = bandNames <NEW_LINE> self.stretch = stretch <NEW_LINE> self.colNam... | This class is the 'model' that drives the continuous table.
QTableView asks it for the data etc | 625990cb627d3e7fe0e092d4 |
class MaskingEditException(Exception): <NEW_LINE> <INDENT> pass | Custom exception. | 625990cb627d3e7fe0e092d8 |
@final <NEW_LINE> @dataclass <NEW_LINE> class Ok(Result[E, A]): <NEW_LINE> <INDENT> __slots__ = "success" <NEW_LINE> success: A | The result of a successful computation. | 625990cc627d3e7fe0e092fa |
class GSS_Verifier(BaseObj): <NEW_LINE> <INDENT> flavor = RPCSEC_GSS <NEW_LINE> _itemlist = ("flavor", "size", "gss_token") <NEW_LINE> def __init__(self, unpack): <NEW_LINE> <INDENT> self.gss_token = unpack.unpack_opaque() <NEW_LINE> self.size = len(self.gss_token) | GSS_Verifier object | 625990cd627d3e7fe0e0930f |
class TestDOS(BaseTests.BrainFuckTestBase): <NEW_LINE> <INDENT> exe = "build16/dos/dos_test.com" <NEW_LINE> def run_bf_proc(self, exe, file, input=None): <NEW_LINE> <INDENT> tmp_dir = tempfile.gettempdir() <NEW_LINE> out_file_name = hex(random.getrandbits(64))[2:] + ".out" <NEW_LINE> out_file_path = os.path.join(tmp_di... | Emulated DOS tests | 625990cd627d3e7fe0e09313 |
class MongoDbFinishCommand(CommandProperties): <NEW_LINE> <INDENT> _validation = { 'errors': {'readonly': True}, 'state': {'readonly': True}, 'command_type': {'required': True}, } <NEW_LINE> _attribute_map = { 'errors': {'key': 'errors', 'type': '[ODataError]'}, 'state': {'key': 'state', 'type': 'str'}, 'command_type':... | Properties for the command that finishes a migration in whole or in part.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar errors: Array of errors. This is ignored if submitted.
:vartype errors: list[~az... | 625990cd627d3e7fe0e0931b |
class IDonationPage(form.Schema, IImageScaleTraversable): <NEW_LINE> <INDENT> form.widget(header_text="plone.app.z3cform.wysiwyg.WysiwygFieldWidget") <NEW_LINE> header_text = schema.Text(title=_(u'Header text'), description=_(u'This text will appear above the donation form'), required=False ) <NEW_LINE> form.widget(foo... | Donation page | 625990ce627d3e7fe0e0931d |
class SetPasswordView(APIView): <NEW_LINE> <INDENT> http_method_names = ["post"] <NEW_LINE> def post(self, request, *args, **kwargs): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if user.check_password(request.data["old_password"]): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> validate_password(request.data.get("... | Users can set a new password for themselves. | 625990ce627d3e7fe0e0932d |
class TestCrudServiceBase: <NEW_LINE> <INDENT> @pytest.fixture(autouse=True) <NEW_LINE> def transact(self, request, registry_rest_api_1): <NEW_LINE> <INDENT> transaction = registry_rest_api_1.begin_nested() <NEW_LINE> request.addfinalizer(transaction.rollback) <NEW_LINE> return <NEW_LINE> <DEDENT> def create_example(se... | Test Service from test_bloks/test_1/views.py:example_service
This is the basic case, no validators, no schema. | 625990cf627d3e7fe0e0934b |
class LinkedStack(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.top = None <NEW_LINE> self.size = 0 <NEW_LINE> <DEDENT> def isempty(self): <NEW_LINE> <INDENT> return self.size == 0 <NEW_LINE> <DEDENT> def push(self,val): <NEW_LINE> <INDENT> self.size += 1 <NEW_LINE> if(self.isempty()): <NEW_LINE> ... | Implementation of a stack using linked list. | 625990cf627d3e7fe0e09353 |
class _LayoutShapeTree(BaseShapeTree): <NEW_LINE> <INDENT> def _shape_factory(self, shape_elm): <NEW_LINE> <INDENT> parent = self <NEW_LINE> return _LayoutShapeFactory(shape_elm, parent) | Sequence of shapes appearing on a slide layout. The first shape in the
sequence is the backmost in z-order and the last shape is topmost.
Supports indexed access, len(), index(), and iteration. | 625990cf627d3e7fe0e09355 |
@datatype <NEW_LINE> class Program: <NEW_LINE> <INDENT> files: List[SourceFile] | # Multi-File "Netlist Program"
The name of this type is a bit misleading, but borrowed from more typical compiler-parsers.
Spice-culture generally lacks a term for "the totality of a simulator invocation input",
or even "a pile of source-files to be used together".
So, `Program` it is. | 625990d0627d3e7fe0e09363 |
class MultiDict(_MultiDict[KT, VT], serializable.Serializable): <NEW_LINE> <INDENT> def __init__(self, fields=()): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.fields = tuple( tuple(i) for i in fields ) <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _reduce_values(values): <NEW_LINE> <INDENT> return values[... | A concrete MultiDict, storing its own data. | 625990d0627d3e7fe0e0937b |
class Job(AbstractJob): <NEW_LINE> <INDENT> @property <NEW_LINE> def job_id(self): <NEW_LINE> <INDENT> return self.raw_model["jobId"] <NEW_LINE> <DEDENT> @property <NEW_LINE> def status(self): <NEW_LINE> <INDENT> return self.raw_model["status"] <NEW_LINE> <DEDENT> @property <NEW_LINE> def statistics(self): <NEW_LINE> <... | Job Model. | 625990d1627d3e7fe0e09389 |
class File: <NEW_LINE> <INDENT> name = None <NEW_LINE> priority = None <NEW_LINE> __metaclass__ = _FiletypeMetaclass <NEW_LINE> def __init__(self, app, a_file): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.file = a_file <NEW_LINE> self.conf = app.conf.setdefault('file', dict()).setdefault(self.name, dict()) <NEW_... | Superclass for all actions | 625990d2627d3e7fe0e093a1 |
class RC4Test(unittest.TestCase): <NEW_LINE> <INDENT> def test_rc4_key_plaintext(self): <NEW_LINE> <INDENT> self.assertEqual("\xBB\xF3\x16\xE8\xD9\x40\xAF\x0A\xD3", rc4.crypt(rc4.RC4Key("Key"), "Plaintext"), "RC4 bad crypt") <NEW_LINE> self.assertEqual("Plaintext", rc4.crypt(rc4.RC4Key("Key"), "\xBB\xF3\x16\xE8\xD9\x40... | @summary: unit tests for rc4
@see: http://fr.wikipedia.org/wiki/RC4 | 625990d2627d3e7fe0e093a9 |
class Software(models.Model): <NEW_LINE> <INDENT> SUB_ASSET_TYPE_CHOICE = ( (0, '操作系统'), (1, '办公/开发软件'), (2, '业务软件'), ) <NEW_LINE> sub_asset_type = models.PositiveSmallIntegerField(choices=SUB_ASSET_TYPE_CHOICE, default=0, verbose_name="软件类型") <NEW_LINE> license_num = models.IntegerField(default=1, verbose_name="授权数量")... | 只保存付费购买的软件 | 625990d2627d3e7fe0e093bd |
class cell_type_1: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.symbol = "K" <NEW_LINE> self.divide_rate = 1 <NEW_LINE> self.priority = 1 <NEW_LINE> self.invasive = 0 <NEW_LINE> self.divide_direction = { "left_1": [0.0000, 0.0625], "top-left": [0.0625, 0.1875], "top": [0.1875, 0.3125], "top-right": ... | Define Cell Type 1 Attributes | 625990d3627d3e7fe0e093c6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.