code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class XMLGenerator(object): <NEW_LINE> <INDENT> def __init__(self, file, root, attrs={}, **kwargs): <NEW_LINE> <INDENT> self.file = codecs.getwriter('utf-8')(file) <NEW_LINE> self.file.write(u'<?xml version="1.0" encoding="utf-8"?>') <NEW_LINE> self.stack = [] <NEW_LINE> self.container(root, attrs, **kwargs) <NEW_LINE>... | Basic generator without support for namespaces or pretty-printing.
Constructor accepts:
- file: an object receiving XML output, anything with .write()
- root: name of the root element
- attrs: attributes dict
Constructor will implicitly open a root container element, you don't need
to call .container() for it | 62598efaec188e330fdf71d4 |
class TestGetLowResMinMaxGridIndices(unittest.TestCase): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def test_get_low_res_min_max_grid_indices(): <NEW_LINE> <INDENT> lon = numpy.array([-179, -79, 0, 45.1]) <NEW_LINE> lat = numpy.array([-67, -9, 0.4, 31]) <NEW_LINE> lon_index, lat_index = qctests.minmax.get_low_res_min... | Test that latitudes and longitudes are categorised into the correct
low resolution grid box. | 62598efa442bda511e95ad8a |
class ReplayBuffer(object): <NEW_LINE> <INDENT> def __init__(self, action_size, buffer_size, batch_size, seed, device="cpu"): <NEW_LINE> <INDENT> self.device = device <NEW_LINE> self.action_size = action_size <NEW_LINE> self.buffer_size = buffer_size <NEW_LINE> self.memory = [] <NEW_LINE> self.batch_size = batch_size <... | Fixed-size buffer to store experience tuples. | 62598efa97e22403b383981a |
class HumanViewSetBaseTests(BaseTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.list_url = vn.HUMAN_VIEW_LIST <NEW_LINE> self.detail_url = vn.HUMAN_VIEW_DETAIL <NEW_LINE> self.home = HomeFactory.create() <NEW_LINE> self.data = factory.build( dict, FACTORY_CLASS=HumanFactory, home=self.home) <NE... | Test Case Code Format: #TPV-X00
Where
=====
X: A - Add (POST)
M - Modify (PUT)
P - Partial Modify (PATCH)
D - Delete (DELETE)
R - Retrieve (GET) | 62598efa01c39578d7f116cb |
class NetworkRuleSet(ProxyResource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'readonly': True}, 'system_data': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type'... | Description of topic resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource ID for the resource. Ex -
/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.
:... | 62598efb099cdd3c6367486b |
class OnFetchedItemMethodTestCase(ItemsServiceTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super().setUp() <NEW_LINE> self.app = Flask('test_app') <NEW_LINE> self.app.config['PUBLICAPI_URL'] = 'http://api.com' <NEW_LINE> self.app.config['URLS'] = {'items': 'items_endpoint'} <NEW_LINE> self.app_co... | Tests for the on_fetched_item() method. | 62598efbe1aae11d1e7cdcd7 |
class Directions(ModelSQL, ModelView): <NEW_LINE> <INDENT> __name__ = 'gnuhealth.directions' <NEW_LINE> name = fields.Many2One( 'gnuhealth.patient.evaluation', 'Evaluation', readonly=True) <NEW_LINE> procedure = fields.Many2One( 'gnuhealth.procedure', 'Procedure', required=True) <NEW_LINE> comments = fields.Char('Comme... | Patient Directions | 62598efb4c34283577618c10 |
class ArrayStack: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._data=[] <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(self._data) <NEW_LINE> <DEDENT> def is_empty(self): <NEW_LINE> <INDENT> return len(self._data)==0 <NEW_LINE> <DEDENT> def push(self,e): <NEW_LINE> <INDENT> se... | LIFO Stack implemented by a list as underlying storage | 62598efb956e5f7376df4b0f |
class ArrowType(Type): <NEW_LINE> <INDENT> def __init__(self, l_type, r_type): <NEW_LINE> <INDENT> if not isinstance(l_type, Type) or not isinstance(r_type, Type): <NEW_LINE> <INDENT> raise ValueError("Expected instances of Type as arguments.") <NEW_LINE> <DEDENT> self.l_type = l_type <NEW_LINE> self.r_type = r_type <N... | Represents the type of a transformation from one type to another. | 62598efb9c8ee8231303f5f1 |
class ModelStrTestMixin: <NEW_LINE> <INDENT> def assertTypicalStrOutput(self, instance, exclude_field_names=None): <NEW_LINE> <INDENT> if exclude_field_names is None: <NEW_LINE> <INDENT> exclude_field_names = () <NEW_LINE> <DEDENT> output = str(instance) <NEW_LINE> self.assertEqual(output, repr(instance)) <NEW_LINE> se... | Mixin for test classes to add common assertion for str correctness. | 62598efb60cbc95b06362c5a |
class Return(Stmt): <NEW_LINE> <INDENT> is_terminator = True <NEW_LINE> is_exit = True <NEW_LINE> def __init__(self, value, loc): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.loc = loc <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'return %s' % self.value | Return to caller. | 62598efb283ffb24f3cf21d5 |
class Telegram: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._bytes = [] <NEW_LINE> self._checksum = [] <NEW_LINE> self.checksum_ok = False <NEW_LINE> <DEDENT> def _calc_checksum(self): <NEW_LINE> <INDENT> cs = 0 <NEW_LINE> for b in self._bytes: <NEW_LINE> <INDENT> cs += b <NEW_LINE> <DEDENT> cs_hig... | Base class of a PS2000B telegram - basically allows accessing the raw bytes and does checksum calculation | 62598efb3617ad0b5ee04a54 |
class ColorFormatter(FormatterPlugin): <NEW_LINE> <INDENT> group_name = 'colors' <NEW_LINE> metadata_lexer = MetadataLexer() <NEW_LINE> def __init__( self, env: Environment, explicit_json=False, color_scheme=DEFAULT_STYLE, **kwargs ): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> if not env.colors: <NEW_LIN... | Colorize using Pygments
This processor that applies syntax highlighting to the headers,
and also to the body if its content type is recognized. | 62598efb5fc7496912d47707 |
class IZorionagurra(Interface): <NEW_LINE> <INDENT> pass | Interface for birthday greetings | 62598efb5fcc89381b2655be |
class S3Manager(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.s3=boto3.resource('s3') <NEW_LINE> self.bucket=self.s3.Bucket('ituedupatrickxujingya') <NEW_LINE> <DEDENT> def createBucket(self): <NEW_LINE> <INDENT> self.s3.create_bucket(Bucket='ituedupatrickxujingya') <NEW_LINE> print("create ... | docstring for user | 62598efb7047854f4633dcf2 |
class Field(LayoutObject): <NEW_LINE> <INDENT> template = "%s/field.html" <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.fields = list(args) <NEW_LINE> if not hasattr(self, 'attrs'): <NEW_LINE> <INDENT> self.attrs = {} <NEW_LINE> <DEDENT> if 'css_class' in kwargs: <NEW_LINE> <INDENT> if 'class... | Layout object, It contains one field name, and you can add attributes to it easily.
For setting class attributes, you need to use `css_class`, as `class` is a Python keyword.
Example::
Field('field_name', style="color: #333;", css_class="whatever", id="field_name") | 62598efbf548e778e5969eb7 |
class JsonValuePrinter: <NEW_LINE> <INDENT> def __init__(self, val): <NEW_LINE> <INDENT> self.val = val <NEW_LINE> <DEDENT> def to_string(self): <NEW_LINE> <INDENT> if self.val.type.strip_typedefs().code == gdb.TYPE_CODE_FLT: <NEW_LINE> <INDENT> return ("%.6f" % float(self.val)).rstrip("0") <NEW_LINE> <DEDENT> return s... | Print a json-value | 62598efba219f33f346c5159 |
class DictCollisionListHash: <NEW_LINE> <INDENT> def __init__(self, size, singleHashFunction): <NEW_LINE> <INDENT> if type(size) is not int: <NEW_LINE> <INDENT> raise ValueError <NEW_LINE> <DEDENT> self.lists = size * [None] <NEW_LINE> self.size = size <NEW_LINE> for i in range(size): <NEW_LINE> <INDENT> self.lists[i] ... | Implementa una tabella hash con liste di collisione.
Supporta le classiche operazioni di insert, search and delete key. | 62598efb4428ac0f6e656e78 |
class ImportTools(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def check_moudle_imported(moudle_name): <NEW_LINE> <INDENT> return moudle_name in sys.modules.keys() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def import_module(module_name, as_name=None, extend_path=None, import_member=None, is_force=False): <N... | @class 库导入工具
@className ImportTools
@classGroup
@classVersion 1.0.0
@classDescription 提供库导入相关功能,包括动态导入库的支持 | 62598efb7d847024c075acf4 |
class CertifyingOrganisationDetailView( CertifyingOrganisationMixin, DetailView): <NEW_LINE> <INDENT> context_object_name = 'certifyingorganisation' <NEW_LINE> template_name = 'certifying_organisation/detail.html' <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super( CertifyingOrganisati... | Detail view for Certifying Organisation. | 62598efb377c676e912f61f9 |
class PriceBase(PricedItemBase): <NEW_LINE> <INDENT> class Meta(PricedItemBase.Meta): <NEW_LINE> <INDENT> abstract = True <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def _get_minimal_price(qs): <NEW_LINE> <INDENT> assert qs.count(), 'FIXME: No prices found. This will raise an exception that should be called... | Abstract base class for price models, exposing a method to get the
cheapest price under given conditions.
Be sure to add the proper `unique_together` contraints to subclasses
implementing an actual price model. | 62598efb57b8e32f52507598 |
class MobileAppEntity(DeviceTrackerEntity, RestoreEntity): <NEW_LINE> <INDENT> def __init__(self, entry, data=None): <NEW_LINE> <INDENT> self._entry = entry <NEW_LINE> self._data = data <NEW_LINE> self._dispatch_unsub = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def unique_id(self): <NEW_LINE> <INDENT> return self._... | Represent a tracked device. | 62598efb009cb60464cffe7b |
class SwaggerUIRenderer(_UIRenderer): <NEW_LINE> <INDENT> template = 'drf-yasg/swagger-ui.html' <NEW_LINE> format = 'swagger' | Renders a swagger-ui web interface for schema browisng.
Also requires :class:`.OpenAPIRenderer` as an available renderer on the same view. | 62598efb851cf427c66b6bf3 |
class VectorRectify: <NEW_LINE> <INDENT> def __init__(self, iface): <NEW_LINE> <INDENT> self.iface = iface <NEW_LINE> self.plugin_dir = os.path.dirname(__file__) <NEW_LINE> locale = QSettings().value('locale/userLocale')[0:2] <NEW_LINE> self.dlg = VectorRectifyDialog(self.iface) <NEW_LINE> self.actions = [] <NEW_LINE> ... | QGIS Plugin Implementation. | 62598efba05bb46b384891a1 |
class TestERFATestCases(): <NEW_LINE> <INDENT> time_ut1 = Time(2400000.5, 53736.0, scale='ut1', format='jd') <NEW_LINE> time_tt = Time(2400000.5, 53736.0, scale='tt', format='jd') <NEW_LINE> time_ut1.delta_ut1_utc = 0. <NEW_LINE> time_ut1.delta_ut1_utc = 24*3600*(time_ut1.tt.jd2-time_tt.jd2) <NEW_LINE> assert np.allclo... | Test that we reproduce the test cases given in erfa/src/t_erfa_c.c | 62598efb76e4537e8c3edee7 |
class itkThresholdLabelerImageFilterIUC2IUC2(itkThresholdLabelerImageFilterIUC2IUC2_Superclass): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") <NEW... | Proxy of C++ itkThresholdLabelerImageFilterIUC2IUC2 class | 62598efb3617ad0b5ee04a56 |
class CanvasCellContentType(Enum): <NEW_LINE> <INDENT> Empty = 1 <NEW_LINE> Line = 2 | The represent the possible content types of a canvas cell | 62598efb3d592f4c4edb981a |
class GCEFirewall(UuidMixin): <NEW_LINE> <INDENT> def __init__(self, id, name, allowed, network, source_ranges, source_tags, driver, extra=None): <NEW_LINE> <INDENT> self.id = str(id) <NEW_LINE> self.name = name <NEW_LINE> self.network = network <NEW_LINE> self.allowed = allowed <NEW_LINE> self.source_ranges = source_r... | A GCE Firewall rule class. | 62598efb5fcc89381b2655bf |
class Heart(object): <NEW_LINE> <INDENT> device=None <NEW_LINE> id=None <NEW_LINE> def __init__(self, in_addr, out_addr, in_type=zmq.SUB, out_type=zmq.DEALER, heart_id=None): <NEW_LINE> <INDENT> self.device = ThreadDevice(zmq.FORWARDER, in_type, out_type) <NEW_LINE> self.device.context_factory = zmq.Context <NEW_LINE> ... | A basic heart object for responding to a HeartMonitor.
This is a simple wrapper with defaults for the most common
Device model for responding to heartbeats.
It simply builds a threadsafe zmq.FORWARDER Device, defaulting to using
SUB/XREQ for in/out.
You can specify the XREQ's IDENTITY via the optional heart_id argume... | 62598efb56ac1b37e6300b19 |
class StreamingClientMock(AbstractStreamingClient): <NEW_LINE> <INDENT> def __init__(self, config: dict = None): <NEW_LINE> <INDENT> self.sent = False <NEW_LINE> self.receiving = False <NEW_LINE> self.last_message = None <NEW_LINE> self.should_fail_to_send = False <NEW_LINE> pass <NEW_LINE> <DEDENT> def send(self, msg)... | A class to mock functionality at the streaming client level. | 62598efb656771135c487fb7 |
class Movie(models.Model): <NEW_LINE> <INDENT> title = models.CharField("Название", max_length=100) <NEW_LINE> tagline = models.CharField("Слоган", max_length=100, default='') <NEW_LINE> description = models.TextField("Описание") <NEW_LINE> poster = models.ImageField("Постер", upload_to="posters/") <NEW_LINE> year = mo... | Movies | 62598efbff9c53063f518f8f |
class ColorCell: <NEW_LINE> <INDENT> def __init__(self, name, red, green, blue): <NEW_LINE> <INDENT> self.update(name, red, green, blue) <NEW_LINE> <DEDENT> def update(self, name, red, green, blue): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.red = red <NEW_LINE> self.green = green <NEW_LINE> self.blue = blue ... | ColorCell acts as a container object for the RGB/HEX color codes.
Public Methods: update
Interface Variables:
* name - Holds the name of the color being held.
* red - Indicates the decimal red value of the RGB value.
* green - Indicates the decimal green value ofthe RGB value.
* blue - Indicates the decimal blue valu... | 62598efbf548e778e5969eb9 |
class DBStorage: <NEW_LINE> <INDENT> __engine = None <NEW_LINE> __session = None <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> HBNB_MYSQL_USER = getenv('HBNB_MYSQL_USER') <NEW_LINE> HBNB_MYSQL_PWD = getenv('HBNB_MYSQL_PWD') <NEW_LINE> HBNB_MYSQL_HOST = getenv('HBNB_MYSQL_HOST') <NEW_LINE> HBNB_MYSQL_DB = getenv('H... | interaacts with the MySQL database | 62598efb5166f23b2e241d09 |
class Card(object): <NEW_LINE> <INDENT> def __init__(self, value, suit): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> self.suit = suit | A single card in a deck. | 62598efbd486a94d0ba2a8f6 |
@books.route('/') <NEW_LINE> class BookHandleWithoutId(Resource): <NEW_LINE> <INDENT> @books.expect(book_create_parser) <NEW_LINE> @error_wrapper <NEW_LINE> def post(self): <NEW_LINE> <INDENT> book = Book(title=request.values['title'], author=request.values['author'], isbn=request.values['isbn'], date_of_publication=re... | Object for handling requests to '/books/' route without an id attatched. | 62598efb956e5f7376df4b11 |
class IsObjReadUser(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> user = request.user <NEW_LINE> if checkUserHasReadPermission(obj,user): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False | Check if the user is in the Read User Permissions | 62598efb5fdd1c0f98e5c8d3 |
class Application(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def factory(cls, global_config, **local_config): <NEW_LINE> <INDENT> return cls(**local_config) <NEW_LINE> <DEDENT> def __call__(self, environ, start_response): <NEW_LINE> <INDENT> raise NotImplementedError(_('You must implement __call__')) | Base WSGI application wrapper. Subclasses need to implement __call__. | 62598efb3d592f4c4edb981c |
class SimpleValue(UnicodeMixin, EDMValue): <NEW_LINE> <INDENT> def __init__(self, p_def=None): <NEW_LINE> <INDENT> EDMValue.__init__(self, p_def) <NEW_LINE> if p_def: <NEW_LINE> <INDENT> self.type_code = p_def.simpleTypeCode <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.type_code = None <NEW_LINE> <DEDENT> self.mt... | An abstract class that represents a value of a simple type in the EDMModel.
This class is not designed to be instantiated directly, use one of
the factory methods in :py:class:`EDMValue` to construct one of the
specific child classes. | 62598efb3d592f4c4edb981d |
class Node(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> label = db.Column(db.String, nullable=False) <NEW_LINE> project_id = db.Column(db.ForeignKey('project.id')) <NEW_LINE> project = db.relationship("Project", backref=db.backref('nodes')) <NEW_LINE> obm_id = db.Column(db.Inte... | a (physical) machine | 62598efb1f5feb6acb161584 |
class Meta(object): <NEW_LINE> <INDENT> model = models.Organization | Model meta class. | 62598efb55399d3f05624e55 |
class In2Out1Proc(Proc): <NEW_LINE> <INDENT> input = "in1:var, in2:var" <NEW_LINE> output = "out:var:{{in.in1}}_{{in.in2}}" <NEW_LINE> script = "echo {{in.in1}} {{in.in2}}" | Process with 2 input vars and 1 output var | 62598efb3539df3088ecabdb |
class IRCBot(Bot): <NEW_LINE> <INDENT> def start(self, ev_channel=None, irc_botname=None, irc_channel=None, irc_network=None, irc_port=None, irc_ssl=None): <NEW_LINE> <INDENT> global _SESSIONS <NEW_LINE> if not _SESSIONS: <NEW_LINE> <INDENT> from evennia.server.sessionhandler import SESSIONS as _SESSIONS <NEW_LINE> <DE... | Bot for handling IRC connections. | 62598efbf9cc0f698b1c4766 |
class STARt(SCPINode, SCPISet): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _cmd = "STARt" <NEW_LINE> args = ["1"] | SWEep:LFGL:STARt
Arguments: 1 | 62598efb56ac1b37e6300b1c |
class Subscription(Model): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'subscription_id': {'readonly': True}, 'display_name': {'readonly': True}, 'state': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}... | Subscription information.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The fully qualified ID for the subscription. For example,
/subscriptions/00000000-0000-0000-0000-000000000000.
:vartype id: str
:ivar subscription_id: The subscription ID.
:vartype subscription... | 62598efba8370b77170eed14 |
class VQVAE(BetaVAE): <NEW_LINE> <INDENT> def __init__(self, n_codes: int = 64, commitment_weight: float = 0.25, distance_metric: str = 'euclidean', trainable_prior: bool = False, ema_decay: float = 0.99, ema_update=False, beta=1.0, **kwargs): <NEW_LINE> <INDENT> latents = kwargs.pop('latents', None) <NEW_LINE> if late... | Arguments:
commitment_loss : float (default=0.25),
or `beta`, weight for the commitment loss
Reference:
Aaron van den Oord, Oriol Vinyals, Koray Kavukcuoglu. "Neural Discrete
Representation Learning". In _Conference on Neural Information Processing
Systems_, 2017. https://arxiv.org/abs/1711.00937 | 62598efb63b5f9789fe83a8e |
class MemberDetail(DetailView): <NEW_LINE> <INDENT> context_object_name = 'usr' <NEW_LINE> model = User <NEW_LINE> template_name = 'member/profile.html' <NEW_LINE> def get_object(self, queryset=None): <NEW_LINE> <INDENT> return get_object_or_404(User, username=urlunquote(self.kwargs['user_name'])) <NEW_LINE> <DEDENT> d... | Displays details about a profile. | 62598efb099cdd3c6367486e |
class PollQuestion(models.Model): <NEW_LINE> <INDENT> question_text = models.CharField(max_length=200) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.question_text | A question model for asking students questions. | 62598efb7d847024c075acf8 |
class PostPictureList(generics.ListCreateAPIView): <NEW_LINE> <INDENT> queryset = PostPicture.objects.all() <NEW_LINE> serializer_class = PostPictureSerializer <NEW_LINE> permission_classes = (IsWeblogAuthor, ) | API endpoint that presents a list of post-picture relations
and allows new post-picture relations to be created. | 62598efb8a349b6b43684b72 |
class VideoInfo: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> info=None <NEW_LINE> if not info: <NEW_LINE> <INDENT> raise _pygame_base.error('Could not retrieve video info') <NEW_LINE> <DEDENT> self.hw = info.hw_available <NEW_LINE> self.wm = info.wm_available <NEW_LINE> self.blit_hw = info.blit_hw <NEW_... | Video display information.
:Ivariables:
`hw` : bool
True if the display is hardware accelerated.
`wm` : bool
True if windowed display modes can be used.
`video_mem` : int
The amount of video memory on the displaoy, in megabytes. 0 if
unknown.
`bitsize` : int
Num... | 62598efbe5267d203ee6a236 |
class BuildTask(models.Model): <NEW_LINE> <INDENT> specification = models.ForeignKey(Specification) <NEW_LINE> architecture = models.ForeignKey(Architecture) <NEW_LINE> task_id = models.CharField(max_length=255, unique=True) <NEW_LINE> builder = models.ForeignKey(Builder, null=True, default=None) <NEW_LINE> assigned = ... | List of tasks assigned to package builders | 62598efb3d592f4c4edb981f |
class TaskRunnerAPI(object): <NEW_LINE> <INDENT> def __init__(self, process, runner): <NEW_LINE> <INDENT> self.process = process <NEW_LINE> self.runner = runner <NEW_LINE> <DEDENT> @api.register <NEW_LINE> def submit(self, task): <NEW_LINE> <INDENT> task = Task.deserialize(data=task) <NEW_LINE> run_id = self.runner.add... | Container API using bottle | 62598efb2ae34c7f260a9a13 |
class UserAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> fieldsets = [ (None, {'fields': ['user_code', 'user_name']}), ] <NEW_LINE> list_display = ('user_code', 'user_name') <NEW_LINE> inlines = [AccountInline] | docstring for UserAdmin | 62598efb167d2b6e312b58cd |
class Tag(Base): <NEW_LINE> <INDENT> __tablename__ = 'tags' <NEW_LINE> file_path = Column(String, ForeignKey('files.path'), primary_key=True) <NEW_LINE> entity_name = Column(String, ForeignKey('entities.name'), primary_key=True) <NEW_LINE> _value = Column(String, nullable=False) <NEW_LINE> _dtype = Column(String, defau... | Represents an association between a File and an Entity.
Parameters
----------
file : BIDSFile
The associated BIDSFile.
entity : Entity
The associated Entity.
value : json-serializable type
The value to store for this file/entity pair. Must be of type
str, int, float, bool, or any json-serializable stru... | 62598efbd268445f26639028 |
class PredictionResults(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.prediction_results = {} <NEW_LINE> <DEDENT> def save_symbol_prediction_data(self, symbol_result_helper): <NEW_LINE> <INDENT> self.prediction_results[symbol_result_helper.symbol] = symbol_result_helper.prediction_results | Helper stores all prediction data for next save in the database. | 62598efb26068e7796d4b28b |
class Config(object): <NEW_LINE> <INDENT> DEBUG = True <NEW_LINE> TESTING = False <NEW_LINE> SECRET_KEY = "\xb5\xb3}#\xb7A\xcac\x9d0\xb6\x0f\x80z\x97\x00\x1e\xc0\xb8+\xe9)\xf0}" <NEW_LINE> PERMANENT_SESSION_LIFETIME = 3600 * 1 <NEW_LINE> SESSION_COOKIE_NAME = 'dhwy_session' <NEW_LINE> PROJECT_PATH = os.path.abspath(os.... | 配置基类 | 62598efb379a373c97d9792a |
class TestETL(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.etl = ETL() <NEW_LINE> <DEDENT> def test_data(self): <NEW_LINE> <INDENT> self.assertIsInstance(self.etl.data, pd.DataFrame) | Simple test example. | 62598efb7b180e01f3e484df |
class ReservationCancelledSchema(SchemaObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.schema = 'ReservationCancelled' | Schema Mixin for ReservationCancelled
Usage: place after django model in class definition, schema will return the schema.org url for the object
The status for a previously confirmed reservation that is now cancelled. | 62598efb7cff6e4e811b4314 |
class CreateUpdateDestroyViewSet( GenericViewSet, CreateModelMixin, UpdateModelMixin, DestroyModelMixin ): <NEW_LINE> <INDENT> pass | Переопределение методов сериализатора и прав доступа | 62598efb3317a56b869bd9fd |
class MicroExitPolicyRule(ExitPolicyRule): <NEW_LINE> <INDENT> def __init__(self, is_accept, min_port, max_port): <NEW_LINE> <INDENT> self.is_accept = is_accept <NEW_LINE> self.address = None <NEW_LINE> self.min_port = min_port <NEW_LINE> self.max_port = max_port <NEW_LINE> self._skip_rule = False <NEW_LINE> <DEDENT> d... | Lighter weight ExitPolicyRule derivative for microdescriptors. | 62598efb009cb60464cffe81 |
class LinearRegression(d2l.Module): <NEW_LINE> <INDENT> def __init__(self, lr): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.save_hyperparameters() <NEW_LINE> self.net = tf.keras.layers.Dense(1) <NEW_LINE> <DEDENT> def forward(self, X): <NEW_LINE> <INDENT> return self.net(X) <NEW_LINE> <DEDENT> def loss(self,... | Defined in :numref:`sec_linear_concise` | 62598efb63b5f9789fe83a90 |
class BaseQueue(object): <NEW_LINE> <INDENT> def add(self, item): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def remove(self): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> raise NotImplementedError() | Base queue interface. | 62598efb99cbb53fe682f7e1 |
@add_slots <NEW_LINE> @dataclass(frozen=True) <NEW_LINE> class BitInvert(BaseUnaryOp): <NEW_LINE> <INDENT> whitespace_after: BaseParenthesizableWhitespace = SimpleWhitespace.field("") <NEW_LINE> def _get_token(self) -> str: <NEW_LINE> <INDENT> return "~" | A unary operator that can be used in a :class:`UnaryOperation`
expression. | 62598efb91f36d47f223033c |
class TagError(Exception): <NEW_LINE> <INDENT> pass | This is raised when the system fails to locate a required vital
html tag | 62598efb8a349b6b43684b74 |
class IPPEntity(Entity): <NEW_LINE> <INDENT> def __init__( self, *, entry_id: str, coordinator: IPPDataUpdateCoordinator, name: str, icon: str, enabled_default: bool = True, ) -> None: <NEW_LINE> <INDENT> self._enabled_default = enabled_default <NEW_LINE> self._entry_id = entry_id <NEW_LINE> self._icon = icon <NEW_LINE... | Defines a base IPP entity. | 62598efb091ae3566870354c |
class VirtualGatewayAccessLog(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "File": (VirtualGatewayFileAccessLog, False), } | `VirtualGatewayAccessLog <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-virtualgateway-virtualgatewayaccesslog.html>`__ | 62598efb3617ad0b5ee04a5c |
class ShowNodeCapabilities(lister.Lister): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + ".ShowNodeProfile") <NEW_LINE> def take_action(self, parsed_args): <NEW_LINE> <INDENT> bm_client = self.app.client_manager.rdomanager_oscplugin.baremetal() <NEW_LINE> rows = [] <NEW_LINE> for node in bm_client.node.list():... | List the capabilities for all Nodes | 62598efb5fc7496912d4770b |
class FilteringStepPostprocessor(object): <NEW_LINE> <INDENT> __metaclass__ = abc.ABCMeta <NEW_LINE> @abc.abstractmethod <NEW_LINE> def process_filtering_step(self, current_times, current_values, predicted_state, filtered_state, outputs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abc.abstractproperty <NEW_LINE> def... | Base class for processors that are applied after each filter step. | 62598efb2c8b7c6e89bd20f5 |
class ListSuplierListener: <NEW_LINE> <INDENT> def on_post(self, req, res): <NEW_LINE> <INDENT> suplier = SuplierHelper.parse_from_body_request(req) <NEW_LINE> inserted_id = SuplierHelper.save(suplier) <NEW_LINE> req.context["result"] = {"status": {"code": 200, "message": "success"}} <NEW_LINE> res.status = falcon.HTTP... | ListSuplierListener | 62598efb0fa83653e46f3814 |
class SeriesMixin(HasDriversMixin): <NEW_LINE> <INDENT> implements(ISeriesMixin) <NEW_LINE> summary = StringCol(notNull=True) <NEW_LINE> @property <NEW_LINE> def active(self): <NEW_LINE> <INDENT> return self.status in ACTIVE_STATUSES <NEW_LINE> <DEDENT> @property <NEW_LINE> def bug_supervisor(self): <NEW_LINE> <INDENT>... | See `ISeriesMixin`. | 62598efb2ae34c7f260a9a15 |
class ComponentTag(DTTag): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> DTTag.__init__ ( self, 'component', isempty = 1, modules = [Component] ) <NEW_LINE> <DEDENT> def genCode(self, indent, codeout, tagreg, tag): <NEW_LINE> <INDENT> DTCompilerUtil.tagDebug(indent, codeout, tag) <NEW_LINE> args=DTUtil.ta... | The component tag is used to render non-cacheable components which
inherit the namespace of their parent | 62598efb56ac1b37e6300b1f |
class StockSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta(object): <NEW_LINE> <INDENT> model = Stock <NEW_LINE> fields = "__all__" | docstring for Tax | 62598efb7047854f4633dcfa |
class AdaptiveGenerator(searchtoy.ConsistentGenerator): <NEW_LINE> <INDENT> graph = True <NEW_LINE> requires = crossState <NEW_LINE> @classmethod <NEW_LINE> def operations(cls, state): <NEW_LINE> <INDENT> if state.flashlight == 'back': <NEW_LINE> <INDENT> for one, another in combinations(state.on_side(state.flashlight)... | Generates all possible operations applicable to a particular state.
| 62598efbf9cc0f698b1c4768 |
@python_2_unicode_compatible <NEW_LINE> class HTMLElement(HTMLInterval): <NEW_LINE> <INDENT> def __init__( self, open_tag, close_tag=None, children=None, drop_tag=False, scope=None, **kwargs): <NEW_LINE> <INDENT> super(HTMLElement, self).__init__(**kwargs) <NEW_LINE> self.open_tag = open_tag <NEW_LINE> self.close_tag =... | An HTML element that may contain child elements. | 62598efbf548e778e5969ebc |
class Message(object): <NEW_LINE> <INDENT> def __init__(self, text=None, username=None, channel=None, attachments=None): <NEW_LINE> <INDENT> self.text = text <NEW_LINE> self.username = username <NEW_LINE> self.channel = channel <NEW_LINE> self.attachments = attachments <NEW_LINE> <DEDENT> def document(self): <NEW_LINE>... | Slack WebHook message | 62598efbaad79263cf42d142 |
class simple_softmax(nn.Module): <NEW_LINE> <INDENT> def __init__(self, ): <NEW_LINE> <INDENT> super(simple_softmax, self).__init__() <NEW_LINE> self.main = nn.Sequential(*self.__design_model()) <NEW_LINE> <DEDENT> def forward(self, x): <NEW_LINE> <INDENT> x = self.main(x) <NEW_LINE> return x <NEW_LINE> <DEDENT> def __... | Design a 3 layer Feed-Forward model by default with size 36x10x6 | 62598efb379a373c97d9792c |
class Cov(PairRolling): <NEW_LINE> <INDENT> def __init__(self, feature_left, feature_right, N): <NEW_LINE> <INDENT> super(Cov, self).__init__(feature_left, feature_right, N, "cov") | Rolling Covariance
Parameters
----------
feature_left : Expression
feature instance
feature_right : Expression
feature instance
N : int
rolling window size
Returns
----------
Expression
a feature instance with rolling max of two input features | 62598efb7cff6e4e811b4316 |
class ValueFunctionWrapper(nn.Module): <NEW_LINE> <INDENT> def __init__(self, model, lr): <NEW_LINE> <INDENT> super(ValueFunctionWrapper, self).__init__() <NEW_LINE> self.model = model <NEW_LINE> self.loss_fn = nn.MSELoss() <NEW_LINE> self.lr = lr <NEW_LINE> <DEDENT> def forward(self, data): <NEW_LINE> <INDENT> return ... | Wrapper around any value function model to add fit and predict functions | 62598efb92d797404e388014 |
class InitLineage(BaseOperator): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _simuPOP_ba.InitLineage_swiginit(self, _simuPOP_ba.new_InitLin... | Details:
This operator assigns lineages at all or part of loci with given
values. This operator initializes all chromosomes, including
unused lineage locations and customized chromosomes. | 62598efbadb09d7d5dc08eea |
class FeatureExtractorBase(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def extract(self, em1, em2): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> pass | This is the base class of feature extractors
You need to implement your own feature extractors,
e.g. Class Features (CF), WordNet Features (WF)
Semantic Features (SF). | 62598efb009cb60464cffe83 |
class PageColumn(column.GetAttrColumn): <NEW_LINE> <INDENT> zope.interface.implements(ISortingColumn) <NEW_LINE> header = IQuotation['page'].title <NEW_LINE> weight = 5 <NEW_LINE> attrName = 'page' <NEW_LINE> def getSortKey(self, item): <NEW_LINE> <INDENT> s = unicode(getattr(item, 'page', u"")) <NEW_LINE> try: <NEW_LI... | The position of the quotation in the reference. | 62598efb377c676e912f61fd |
class IDLTypeDef(IDLNode): <NEW_LINE> <INDENT> def __init__(self, ast): <NEW_LINE> <INDENT> IDLNode.__init__(self, ast) <NEW_LINE> self._convert_annotations(ast) <NEW_LINE> self.type = self._convert_first(ast, 'Type', IDLType) | IDLNode for 'typedef [type] [id]' declarations. | 62598efb091ae3566870354e |
class CsvMailingView (BrowserView): <NEW_LINE> <INDENT> def writeLine(self, writor, obj): <NEW_LINE> <INDENT> fields = [] <NEW_LINE> fields.append(getattr(obj, 'civility_title', '')) <NEW_LINE> fields.append(getattr(obj, 'firstname', '')) <NEW_LINE> fields.append(getattr(obj, 'lastname', '')) <NEW_LINE> if obj.portal_t... | Csv mailing view of a contact directory
| 62598efb2c8b7c6e89bd20f7 |
class DFA_State(object): <NEW_LINE> <INDENT> def __init__(self, parent, name): <NEW_LINE> <INDENT> self.__parent = parent <NEW_LINE> self.__following = {} <NEW_LINE> self.__name = name <NEW_LINE> self.__accepting = False <NEW_LINE> <DEDENT> def __call__(self, transition): <NEW_LINE> <INDENT> return self.__following[tra... | State of a finite state machine | 62598efbad47b63b2c5a614d |
class AttributeB(base.GenericStruct): <NEW_LINE> <INDENT> c = AttributeC() | Example class. | 62598efb442bda511e95ad96 |
class _Nothing(object): <NEW_LINE> <INDENT> pass | Used to identify an unset attribute that we could nullify. | 62598efbe5267d203ee6a23a |
class CheckSuite(models.GitHubCore): <NEW_LINE> <INDENT> class_name = "CheckSuite" <NEW_LINE> CUSTOM_HEADERS = {"Accept": "application/vnd.github.antiope-preview+json"} <NEW_LINE> def _update_attributes(self, suite): <NEW_LINE> <INDENT> from . import repos <NEW_LINE> self._api = suite["url"] <NEW_LINE> self.status = su... | The :class:`CheckSuite <CheckSuite>` object.
.. versionadded:: 1.3.0
Please see GitHub's `CheckSuite Documentation`_ for more information.
.. attribute:: status
The status of the Check Suite
.. attribute:: conclusion
The highest priority check run conclusion. If it has not completed this
will be None
... | 62598efb56ac1b37e6300b21 |
@view_defaults( renderer='simplejson', context=IRootPool, name='activate_account', ) <NEW_LINE> class ActivateAccountView(RESTView): <NEW_LINE> <INDENT> validation_POST = (POSTActivateAccountViewRequestSchema, [validate_activation_path]) <NEW_LINE> @view_config(request_method='OPTIONS') <NEW_LINE> def options(self) -> ... | Log in a user via their name. | 62598efb9f28863672817128 |
@python_2_unicode_compatible <NEW_LINE> class User(AbstractUser): <NEW_LINE> <INDENT> GENDER_CHOICES = ( ('male', 'Male'), ('female', 'Female'), ('not-specified', 'Not specified') ) <NEW_LINE> profile_image = models.ImageField(null=True, blank=True) <NEW_LINE> name = models.CharField(_("Name of User"), blank=True, max_... | User Model | 62598efb26068e7796d4b28f |
class ApplicationStateAPIView(TradeRemediesApiView): <NEW_LINE> <INDENT> def get(self, request, organisation_id=None, case_id=None, submission_id=None, *args, **kwargs): <NEW_LINE> <INDENT> case = None <NEW_LINE> if case_id: <NEW_LINE> <INDENT> case = get_case(str(case_id)) <NEW_LINE> <DEDENT> submission_type = get_sub... | Return a data structure representing the current state of an application | 62598efbdc8b845886d51efc |
class TaskController(object): <NEW_LINE> <INDENT> def __init__(self, tasks): <NEW_LINE> <INDENT> self.tasks = tasks <NEW_LINE> self.tasks['idle'] = IdleTask <NEW_LINE> self.switch_task('idle') <NEW_LINE> <DEDENT> def switch_task(self, task_name, callback=None, **params): <NEW_LINE> <INDENT> self.current = self.tasks[ta... | A class that represents a sort of state machine that can
switch between classes and update the currently running
task via a single interface. | 62598efb851cf427c66b6bfd |
class BinaryTree: <NEW_LINE> <INDENT> def __init__(self, value_list=[]): <NEW_LINE> <INDENT> self.root = None <NEW_LINE> self.traverse_list = [] <NEW_LINE> for n in value_list: <NEW_LINE> <INDENT> self.insert(n) <NEW_LINE> <DEDENT> <DEDENT> def insert(self, value): <NEW_LINE> <INDENT> if self.root is None: <NEW_LINE> <... | how to use the node to create a binary tree | 62598efbcc0a2c1114479937 |
class RegionList(_messages.Message): <NEW_LINE> <INDENT> id = _messages.StringField(1) <NEW_LINE> items = _messages.MessageField('Region', 2, repeated=True) <NEW_LINE> kind = _messages.StringField(3, default=u'compute#regionList') <NEW_LINE> nextPageToken = _messages.StringField(4) <NEW_LINE> selfLink = _messages.Strin... | Contains a list of region resources.
Fields:
id: [Output Only] Unique identifier for the resource; defined by the
server.
items: A list of Region resources.
kind: [Output Only] Type of resource. Always compute#regionList for lists
of regions.
nextPageToken: [Output Only] This token allows you to get th... | 62598efb63d6d428bbee1105 |
class Setting(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.screen_width = 1200 <NEW_LINE> self.screen_height = 800 <NEW_LINE> self.bg_color = (255,255,255) <NEW_LINE> self.ship_speed_factor = 0.5 <NEW_LINE> self.bullet_speed_factor = 1 <NEW_LINE> self.bullet_width = 3 <NEW_LINE> self.bullet_heigh... | 存储外星人游戏的所有设置 | 62598efb4a966d76dd5ed80a |
class SonicMIB( rfc1213.InterfacesMIB, rfc1213.IpMib, rfc1213.SysNameMIB, rfc2737.PhysicalTableMIB, rfc3433.PhysicalSensorTableMIB, rfc2863.InterfaceMIBObjects, rfc4363.QBridgeMIBObjects, rfc4292.IpCidrRouteTable, ieee802_1ab.LLDPLocalSystemData, ieee802_1ab.LLDPLocalSystemData.LLDPLocPortTable, ieee802_1ab.LLDPLocalSy... | If SONiC was to create custom MIBEntries, they may be specified here. | 62598efb66656f66f7d58d1c |
class SslProperties(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "DisableSsl": (boolean, False), } | `SslProperties <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-quicksight-datasource-sslproperties.html>`__ | 62598efbcc40096d61619674 |
class CompressionEnum(Enum): <NEW_LINE> <INDENT> ZIP = "zip" <NEW_LINE> GZIP = "gzip" | **For an archive-type resource,** the format of the compressed archive:
* `zip` for a **.zip** file
* `gzip` for a **.tar.gz** file
Omitted for an audio-type resource. | 62598efb5fcc89381b2655c4 |
class retry_unless_exception_type(retry_if_exception): <NEW_LINE> <INDENT> def __init__(self, exception_types=Exception): <NEW_LINE> <INDENT> self.exception_types = exception_types <NEW_LINE> super(retry_unless_exception_type, self).__init__( lambda e: not isinstance(e, exception_types) ) <NEW_LINE> <DEDENT> def __call... | Retries until an exception is raised of one or more types. | 62598efb3d592f4c4edb9825 |
class VertDataCollectorCoord3fNormal3f(VertDataCollectorVAO): <NEW_LINE> <INDENT> def __init__(self, enttype): <NEW_LINE> <INDENT> super().__init__(enttype) <NEW_LINE> <DEDENT> def appendlistdata_f3xyzf3n(self, x, y, z, nx, ny, nz): <NEW_LINE> <INDENT> self._appendlistdata_f3("vertex", x, y, z) <NEW_LINE> self._appendl... | !
VertDataCollectorCoord3fColor4ub class
Data collector class collects all vertex data necessary for drawing a group of entities that share the same type.
Three floats are used for the position (xyz), while four ubyte are used for color (r,g,b,a)
Possible primitive types are defined by the enum (pyD3VOGLModel.GLEntity... | 62598efb55399d3f05624e5d |
class Stopable(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self, settings=None): <NEW_LINE> <INDENT> if settings is None: <NEW_LINE> <INDENT> settings = {} <NEW_LINE> <DEDENT> super(Stopable, self).__init__() <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def stop(self): <NEW_LINE> <IND... | Abstract interface to add a stop method | 62598efb67a9b606de544907 |
class WeightedSampler(object): <NEW_LINE> <INDENT> thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') <NEW_LINE> __repr__ = _swig_repr <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> _simuPOP_baop.WeightedSampler_swiginit(self, _simuPOP_baop.new_W... | Details:
A random number generator that returns 0, 1, ..., k-1 with
probabilites that are proportional to their weights. For example,
a weighted sampler with weights 4, 3, 2 and 1 will return numbers
0, 1, 2 and 3 with probabilities 0.4, 0.3, 0.2 and 0.1,
respectively. If an additional parameter N ... | 62598efb26068e7796d4b291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.