code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class UserProfile(models.Model): <NEW_LINE> <INDENT> user = models.OneToOneField(User, on_delete=models.CASCADE) <NEW_LINE> copy_tags = models.BooleanField( default=True, verbose_name="Copy tags when adding someone else's recipe") <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.user.username
mostly for preferences
62598fc57b180e01f3e491c0
class ArgumentUndefine(ArgumentError): <NEW_LINE> <INDENT> pass
参数未定义错误
62598fc5167d2b6e312b7258
class RouterTestIdFailCtrlChar(TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(RouterTestIdFailCtrlChar, cls).setUpClass() <NEW_LINE> cls.name = "test-router-ctrl-char" <NEW_LINE> <DEDENT> def __init__(self, test_method): <NEW_LINE> <INDENT> TestCase.__init__(self, ...
This test case sets up a router using a configuration router id that is illegal (control character). The router should not start.
62598fc5f9cc0f698b1c5442
class NotEnoughSamplesError(Exception): <NEW_LINE> <INDENT> pass
Not Enough Samples
62598fc53617ad0b5ee06428
class RegistrationForm(forms.Form): <NEW_LINE> <INDENT> username = forms.RegexField(regex=r'^[\w.@+-]+$', max_length=30, widget=forms.TextInput(attrs=attrs_dict), label=_("Username"), error_messages={ 'invalid': _("This value must contain " "only letters, numbers and " "underscores.") }) <NEW_LINE> email1 = forms.Email...
Form for registration a user account. Validates that the requested username is not already in use, and requires the email to be entered twice to catch typos. Subclasses should feel free to add any additional validation they need, but should avoid defining a ``save()`` method -- the actual saving of collected user da...
62598fc560cbc95b0636461f
class ConnectionViewSet(ListModelMixin, GenericViewSet): <NEW_LINE> <INDENT> permission_classes = (IsAuthenticated,) <NEW_LINE> serializer_class = UserSerializer <NEW_LINE> def get_serializer_context(self): <NEW_LINE> <INDENT> return {'auth_user': self.request.user} <NEW_LINE> <DEDENT> def get_queryset(self): <NEW_LINE...
Retrieves the connections of the authenticated user, or a specified user. - Filter by: `user`, `status` Valid options when filtering by `status` are: - `pending`: awaiting the user's acceptance. - `requested`: awaiting another user's acceptance. - `accepted`: both users have accepted the connection. - `blocked`: use...
62598fc54c3428357761a59e
class Identity: <NEW_LINE> <INDENT> def __call__(self, x): <NEW_LINE> <INDENT> g = np.maximum(0, x) <NEW_LINE> g = np.minimum(g, 1) <NEW_LINE> return g <NEW_LINE> <DEDENT> def d(self, g): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> def inv(self, g): <NEW_LINE> <INDENT> return g
Activation function to be used with MatrixModels. Clip the evaluation output to interval [0, 1].
62598fc5ec188e330fdf8b76
class BoardfarmTestConfig(): <NEW_LINE> <INDENT> def __init__(self, name='results'): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.output_dir = os.path.join( os.path.abspath(os.path.join(os.getcwd(), name, '')), '') <NEW_LINE> self.EXTRA_TESTS = [] <NEW_LINE> self.BOARD_NAMES = [] <NEW_LINE> self.boardfarm_confi...
This class defines the location or values of high-level objects used to run tests. Such as: url of the inventory server, environment files, etc...
62598fc5956e5f7376df57ef
class BadMigrationCommand(MigrationCommand): <NEW_LINE> <INDENT> def run(self): raise RuntimeError("Something went wrong.")
Created for demonstrative purposes only (to test a failure).
62598fc55fcc89381b2662be
class ChannelAdmin(FhAdmin): <NEW_LINE> <INDENT> list_display = ('title', 'category', 'is_enabled', 'is_favorite', 'created_at') <NEW_LINE> list_display_links = ('title',) <NEW_LINE> list_filter = ('category', 'is_enabled', 'created_at') <NEW_LINE> fieldsets = ( ('General', { 'fields': ('title', 'category', 'code'), })...
Task admin class
62598fc5a8370b77170f06bd
class Router(object): <NEW_LINE> <INDENT> def get_db(self, model, **hints): <NEW_LINE> <INDENT> if hasattr(model, 'owner_name'): <NEW_LINE> <INDENT> return model.owner_name <NEW_LINE> <DEDENT> elif hints.get('instance') and hasattr(hints['instance'], 'owner_name'): <NEW_LINE> <INDENT> return hints['instance'].owner_nam...
A router to control all database operations on models
62598fc55fdd1c0f98e5e275
class CustomRequiredModelForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> required = {} <NEW_LINE> disabled = {} <NEW_LINE> <DEDENT> def set_field_required(self, field, is_required): <NEW_LINE> <INDENT> self.fields[field].required = is_required <NEW_LINE> <DEDENT> def set_field_disabled(self, ...
This class allows us to create form fields corresponding to models but with the optional overriding of the required attribute of fields. Other implementations would allow NULL values in the database tables due to the way Django handles optional fields, i.e. Django requires null=True, blank=True Django models which impl...
62598fc55fdd1c0f98e5e276
class FastqSolexaWriter(SequenceWriter): <NEW_LINE> <INDENT> def write_record(self, record): <NEW_LINE> <INDENT> assert self._header_written <NEW_LINE> assert not self._footer_written <NEW_LINE> self._record_written = True <NEW_LINE> if record.seq is None: <NEW_LINE> <INDENT> raise ValueError("No sequence for record %s...
Write old style Solexa/Illumina FASTQ format files (with Solexa qualities) (OBSOLETE). This outputs FASTQ files like those from the early Solexa/Illumina pipeline, using Solexa scores and an ASCII offset of 64. These are NOT compatible with the standard Sanger style PHRED FASTQ files. If your records contain a "solex...
62598fc5ff9c53063f51a92f
class State(object): <NEW_LINE> <INDENT> def __init__(self, grid, mustShuffle=True): <NEW_LINE> <INDENT> self.grid = grid <NEW_LINE> self.next_component = 0 <NEW_LINE> self.components = {} <NEW_LINE> self.cells = {} <NEW_LINE> self.initialize() <NEW_LINE> self.configure() <NEW_LINE> self.queue = list(self.components.ke...
state matrix for the high-card-wins algorithm
62598fc592d797404e388cd3
class UnicodeReader: <NEW_LINE> <INDENT> def __init__(self, f, delimiter=',', quotechar='\"', encoding="utf-8", **kwds): <NEW_LINE> <INDENT> f = UTF8Recoder(f, encoding) <NEW_LINE> self.reader = csv.reader(f, delimiter=delimiter, quotechar=quotechar, **kwds) <NEW_LINE> <DEDENT> def next(self): <NEW_LINE> <INDENT> row =...
A CSV reader which will iterate over lines in the CSV file "f", which is encoded in the given encoding.
62598fc5a219f33f346c6aea
class PointCollection(FeatureCollection): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(PointCollection,self).__init__(**kwargs) <NEW_LINE> <DEDENT> def filter_by_time(self, starting, ending): <NEW_LINE> <INDENT> if not isinstance(starting, datetime) or not isinstance(ending, datetime): <N...
A collection of Points
62598fc5fff4ab517ebcdaca
class IYLPublication(Interface): <NEW_LINE> <INDENT> pass
Marker interface that defines a Zope 3 browser layer.
62598fc5099cdd3c63675553
class Combinator(Enum): <NEW_LINE> <INDENT> DESCENDANT = 1 <NEW_LINE> CHILD = 2 <NEW_LINE> NEXT_SIBLING = 3 <NEW_LINE> SUBSEQUENT_SIBLING = 4
Combinator types. Members correspond to the following combinators: - :attr:`DESCENDANT`: ``A B``; - :attr:`CHILD`: ``A > B``; - :attr:`NEXT_SIBLING`: ``A + B``; - :attr:`SUBSEQUENT_SIBLING`: ``A ~ B``.
62598fc5f548e778e596b881
class TimeLagsFeatureProducer(FeatureProducerOHLC): <NEW_LINE> <INDENT> def __init__(self, lags=5, feature='close', feature_label='tlag'): <NEW_LINE> <INDENT> FeatureProducerOHLC.__init__(self, feature_label) <NEW_LINE> self.lags = lags <NEW_LINE> self.feature = feature <NEW_LINE> <DEDENT> def produce(self, df): <NEW_L...
Produce time lags feature. Time lag of feature X traces the previous value of X several time points ago. e.g. If a stock has close prices of [1, 2, 3, 4, 5, 6, 7], then the 3 time lag of it will be: [NaN, NaN, NaN, 1, 2, 3, 4]
62598fc54a966d76dd5ef1b9
class AddRankInput(graphene.InputObjectType, RankAttribute): <NEW_LINE> <INDENT> pass
Arguments to create Rank.
62598fc560cbc95b06364621
class RosOdomSubscriber(object): <NEW_LINE> <INDENT> def __init__(self, node_name, channel_name, stream_type=Odometry, anonymous=True): <NEW_LINE> <INDENT> self.data = Point() <NEW_LINE> rospy.init_node(node_name, anonymous=anonymous) <NEW_LINE> self.sub = rospy.Subscriber(channel_name, stream_type, self.on_data_recv) ...
A ROS node to subscribe to a data stream
62598fc5ec188e330fdf8b78
class ConnectionStateSnapshot(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'hops': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'connection_state': {'key': 'connectionState', 'type': 'str'}, 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, 'end_time': {'key': 'endTime', 'type': 'iso-86...
Connection state snapshot. Variables are only populated by the server, and will be ignored when sending a request. :param connection_state: The connection state. Possible values include: "Reachable", "Unreachable", "Unknown". :type connection_state: str or ~azure.mgmt.network.v2020_05_01.models.ConnectionState :para...
62598fc563b5f9789fe85458
class ECProvinceSelect(Select): <NEW_LINE> <INDENT> def __init__(self, attrs=None): <NEW_LINE> <INDENT> super().__init__(attrs, choices=PROVINCE_CHOICES)
A Select widget that uses a list of Ecuador provinces as its choices.
62598fc50fa83653e46f51cb
class SchemaRpcHandler(mano_dts.AbstractRpcHandler): <NEW_LINE> <INDENT> def __init__(self, log, dts, loop, proxy): <NEW_LINE> <INDENT> super().__init__(log, dts, loop) <NEW_LINE> self.proxy = proxy <NEW_LINE> <DEDENT> @property <NEW_LINE> def xpath(self): <NEW_LINE> <INDENT> return "/rw-pkg-mgmt:get-package-schema" <N...
RPC handler to generate the schema for the packages.
62598fc55fcc89381b2662bf
class LEP_LeoTextEdit(QtWidgets.QTextEdit): <NEW_LINE> <INDENT> lep_type = "EDITOR" <NEW_LINE> lep_name = "Leo Text Edit" <NEW_LINE> def __init__(self, c=None, lep=None, *args, **kwargs): <NEW_LINE> <INDENT> super(LEP_LeoTextEdit, self).__init__(*args, **kwargs) <NEW_LINE> self.c = c <NEW_LINE> self.lep = lep <NEW_LINE...
LEP_LeoTextEdit - Leo LeoEditorPane editor
62598fc5a8370b77170f06bf
class SponsorDetail(APIView): <NEW_LINE> <INDENT> def get_object(self, pk): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return Sponsor.objects.get(pk=pk) <NEW_LINE> <DEDENT> except Sponsor.DoesNotExist: <NEW_LINE> <INDENT> raise Http404 <NEW_LINE> <DEDENT> <DEDENT> def get(self, request, pk, format=None): <NEW_LINE> <...
Retrieve, update or delete a snippet instance.
62598fc55fdd1c0f98e5e278
class ForwardVoucherExpenses(models.Model): <NEW_LINE> <INDENT> forward_voucher = models.ForeignKey(ForwardVoucher, on_delete=models.CASCADE,) <NEW_LINE> additional_service = models.ForeignKey(AdditionalService, on_delete=models.CASCADE, ) <NEW_LINE> price = models.DecimalField(max_digits=16, decimal_places=9) <NEW_LIN...
Forward expenses / Дополнительные затраты
62598fc57c178a314d78d784
class TestMultiLinesWithBlock: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def method(): <NEW_LINE> <INDENT> return RPCMethod(multiline_doc_with_block) <NEW_LINE> <DEDENT> def test_raw_doc(self): <NEW_LINE> <INDENT> method = self.method() <NEW_LINE> assert method.raw_docstring == ( "This method has *multi-lines* **doc...
Standard multi-line docstring with an indented block
62598fc55fc7496912d483ed
@implements_specification('3.2.4', 'tosca-simple-1.0') <NEW_LINE> class List(list): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def _create(context, presentation, entry_schema, constraints, value, aspect): <NEW_LINE> <INDENT> if not isinstance(value, list): <NEW_LINE> <INDENT> raise ValueError('"list" data type value ...
The list type allows for specifying multiple values for a parameter of property. For example, if an application allows for being configured to listen on multiple ports, a list of ports could be configured using the list data type. See the `TOSCA Simple Profile v1.0 cos01 specification <http://docs.oasis-open.org/tosca...
62598fc5be7bc26dc9251fce
class OutlierSolver(Enum): <NEW_LINE> <INDENT> kSigma = "k-sigma" <NEW_LINE> TukeyTest = "tukey-test" <NEW_LINE> MAD = "mad" <NEW_LINE> SMA = "sma" <NEW_LINE> GMM = "gmm" <NEW_LINE> KMeans = "kmeans" <NEW_LINE> DBSCAN = "dbscan" <NEW_LINE> LOF = "lof" <NEW_LINE> IForest = "iforest" <NEW_LINE> PCA = "pca" <NEW_LINE> Aut...
All the models supplied by our system. 1. K-Sigma rule is the general form of 3-sigma rule, which means values lie within a band around the mean in a normal distribution with a width of k stand deviations. 2. Tukey test utilizes quantiles and IQR(interquartile range) which equals to the difference between 75th and ...
62598fc5aad79263cf42eabb
class Ping(web.View): <NEW_LINE> <INDENT> async def get(self) -> web.Response: <NEW_LINE> <INDENT> return web.Response(text='OK')
ping
62598fc5ec188e330fdf8b7a
class BaseMathMutation(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def mutation(cls, data): <NEW_LINE> <INDENT> raise NotImplementedError
Базовый класс для преобразования данных
62598fc59f288636728189ef
class GenericSPEC(NormalizedCut): <NEW_LINE> <INDENT> def _calc_spec_scores(self, degree, laplacian, normalised_features, normaliser): <NEW_LINE> <INDENT> normalised_cut = super()._calc_spec_scores( degree, laplacian, normalised_features, normaliser ) <NEW_LINE> trivial_eugenvector = normaliser.dot(np.ones([normalised_...
Feature selection algorithm that represents samples as vertices of graph. Weights of edges of this graph are equal to RBF-distances between points. Algorithm uses Spectral Graph Theory to find features with the best separability. To do this, algorithm finds the trivial eugenvector of the Laplacian of the graph and us...
62598fc5091ae35668704f0f
class VoteOnThreadInputSet(InputSet): <NEW_LINE> <INDENT> def set_Forum(self, value): <NEW_LINE> <INDENT> super(VoteOnThreadInputSet, self)._set_input('Forum', value) <NEW_LINE> <DEDENT> def set_PublicKey(self, value): <NEW_LINE> <INDENT> super(VoteOnThreadInputSet, self)._set_input('PublicKey', value) <NEW_LINE> <DEDE...
An InputSet with methods appropriate for specifying the inputs to the VoteOnThread Choreo. The InputSet object is used to specify input parameters when executing this Choreo.
62598fc5dc8b845886d538a2
class UniformProbDist(ProbDistI): <NEW_LINE> <INDENT> def __init__(self, samples): <NEW_LINE> <INDENT> if len(samples) == 0: <NEW_LINE> <INDENT> raise ValueError('A Uniform probability distribution must '+ 'have at least one sample.') <NEW_LINE> <DEDENT> self._sampleset = set(samples) <NEW_LINE> self._prob = 1.0/len(se...
A probability distribution that assigns equal probability to each sample in a given set; and a zero probability to all other samples.
62598fc55fcc89381b2662c0
class HashErrors(InstallationError): <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> self.errors: List["HashError"] = [] <NEW_LINE> <DEDENT> def append(self, error: "HashError") -> None: <NEW_LINE> <INDENT> self.errors.append(error) <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> l...
Multiple HashError instances rolled into one for reporting
62598fc5f548e778e596b884
class GUID(object): <NEW_LINE> <INDENT> def __init__(self, keys=None, use_C_lib=False): <NEW_LINE> <INDENT> if keys is None: <NEW_LINE> <INDENT> if use_C_lib: <NEW_LINE> <INDENT> self.privkey = None <NEW_LINE> self.signing_key = nacl.signing.SigningKey(self.privkey) <NEW_LINE> self.verify_key = verify_key = self.signin...
Class for generating the guid. It can be generated using C code for a modest speed boost but it is currently disabled to make it easier to compile the app.
62598fc5e1aae11d1e7ce998
class Interactions(enum.Enum): <NEW_LINE> <INDENT> Up = 1 <NEW_LINE> Down = 2 <NEW_LINE> Delete = 3 <NEW_LINE> Edit = 4 <NEW_LINE> Add = 5 <NEW_LINE> Count = 6
Enumeration of possible interactions.
62598fc5851cf427c66b859c
class PyramidROIAlign(): <NEW_LINE> <INDENT> def __init__(self, pool_shape, image_shape): <NEW_LINE> <INDENT> self.pool_shape = tuple(pool_shape) <NEW_LINE> self.image_shape = tuple(image_shape) <NEW_LINE> <DEDENT> def run(self, inputs): <NEW_LINE> <INDENT> boxes = inputs[0] <NEW_LINE> feature_maps = inputs[1:] <NEW_LI...
Implements ROI Pooling on multiple levels of the feature pyramid. Params: - pool_shape: [height, width] of the output pooled regions. Usually [7, 7] - image_shape: [height, width, channels]. Shape of input image in pixels Inputs: - boxes: [batch, num_boxes, (y1, x1, y2, x2)] in normalized coordinates. Possib...
62598fc5a05bb46b3848ab52
class GlobalMenuModifier(Modifier): <NEW_LINE> <INDENT> def modify(self, request, nodes, namespace, root_id, post_cut, breadcrumb): <NEW_LINE> <INDENT> if breadcrumb or not post_cut or not request.user.is_authenticated(): <NEW_LINE> <INDENT> return nodes <NEW_LINE> <DEDENT> trim_nodes = ['/login/', '/register/'] <NEW_L...
If the user is logged in, remove certain menu options. Django cms provides a way to hide an option from a non logged in user, but no way to hide something from someone who is logged in. This menu modifier adds this capability.
62598fc57b180e01f3e491c3
class Bot99(player.Bot): <NEW_LINE> <INDENT> def ask(self, prompt): <NEW_LINE> <INDENT> possibles = self.get_possibles() <NEW_LINE> if possibles: <NEW_LINE> <INDENT> possibles.sort() <NEW_LINE> return '{1} {0}'.format(*possibles[-1]) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return 'pass' <NEW_LINE> <DEDENT> <DEDEN...
A bot for Ninety-Nine. (player.Bot) Methods: get_possibles: Get the possible plays. (list of tuple) Overridden Methods: ask tell
62598fc5f9cc0f698b1c5445
class Cell(object): <NEW_LINE> <INDENT> all_possibilities = set(range(1, 10)) <NEW_LINE> def __init__(self, pos, solution=None): <NEW_LINE> <INDENT> assert len(pos) == 2 <NEW_LINE> self.pos = pos <NEW_LINE> self.possibilities = self.all_possibilities.copy() <NEW_LINE> if solution is not None: <NEW_LINE> <INDENT> assert...
represents a Sudoku cell
62598fc560cbc95b06364625
class BashDriver(AbstractMqWorker): <NEW_LINE> <INDENT> def __init__(self, process_name): <NEW_LINE> <INDENT> super(BashDriver, self).__init__(process_name) <NEW_LINE> self.is_alive = False <NEW_LINE> self.initial_thread_count = threading.active_count() <NEW_LINE> <DEDENT> def _mq_callback(self, message): <NEW_LINE> <I...
Process facilitates threads running local or remote bash scripts
62598fc5ec188e330fdf8b7c
class RemoteDigiPointDevice(RemoteXBeeDevice): <NEW_LINE> <INDENT> def __init__(self, local_xbee_device, x64bit_addr=None, node_id=None): <NEW_LINE> <INDENT> if local_xbee_device.get_protocol() != XBeeProtocol.DIGI_POINT: <NEW_LINE> <INDENT> raise XBeeException("Invalid protocol.") <NEW_LINE> <DEDENT> super().__init__(...
This class represents a remote DigiPoint XBee device.
62598fc5a219f33f346c6af0
class GammaFramework(equations_data.GammaData, EquationFramework): <NEW_LINE> <INDENT> pass
This class exists to add framework methods to GammaData
62598fc57b180e01f3e491c4
class StaticClass(_StaticClass): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _cascade_method(cls, method, *args, **kwargs): <NEW_LINE> <INDENT> bases=[cls] <NEW_LINE> while bases: <NEW_LINE> <INDENT> cls2=bases.pop(0) <NEW_LINE> bases.extend(cls2.__bases__) <NEW_LINE> if hasattr(cls2, method): <NEW_LINE> <INDENT> r...
Static class: a class not intended to have instances. Methods are automatically bound as class methods. _StaticClassMetaclass is the metaclass, and is not accessible directly, whereas StaticClass is an instance of that metaclass (and therefore a class) and should be inherited from.
62598fc5d486a94d0ba2c2ba
class ColumnMismatchInPatchError(PatchError): <NEW_LINE> <INDENT> pass
Thrown when creating a patch with a list of dictionaries where the dictionary keys don't match with the column names provided For example, this code will throw this error because the "col1" column is being specified in the row data of a patch but not the columns: .. code-block:: python pgmock.patch(pgmock.table(...
62598fc5f9cc0f698b1c5446
class ComplexJsonEncoder(JSONEncoder): <NEW_LINE> <INDENT> def default(self, o): <NEW_LINE> <INDENT> if hasattr(o, 'toJson'): <NEW_LINE> <INDENT> return o.toJson() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return JSONEncoder.default(self, o)
Basic JSON encoder for 'complex (nested)' Python objects.
62598fc53617ad0b5ee06430
class RPMDistributorTestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_update_checksum_type(self): <NEW_LINE> <INDENT> cfg = config.get_config() <NEW_LINE> if cfg.pulp_version < version.Version('2.9'): <NEW_LINE> <INDENT> raise unittest.SkipTest('This test requires Pulp 2.9 or above.') <NEW_LINE> <DEDENT> client...
RPM distributor tests.
62598fc55fc7496912d483ef
class ObserverAttr(object): <NEW_LINE> <INDENT> def __init__(self, name, *args, **kwargs): <NEW_LINE> <INDENT> self.name, self.args, self.kwargs = name, args, kwargs <NEW_LINE> <DEDENT> def __get__(self, owner, ownertype): <NEW_LINE> <INDENT> if not owner: return self <NEW_LINE> _debug("got request for observer", self....
Wrapper for Observers within Models. Will auto-vivify an Observer within a Model instance the first time it's called.
62598fc54a966d76dd5ef1bf
class Event(object): <NEW_LINE> <INDENT> def __init__(self, message, refs, started_at=None): <NEW_LINE> <INDENT> self._message = message <NEW_LINE> self._refs = refs <NEW_LINE> self.started_at = started_at if started_at else time.time() <NEW_LINE> self.id = None <NEW_LINE> self.update_duration_event() <NEW_LINE> self._...
A generic "event" that has a start time, completion percentage, and a list of "refs" that are (type, id) tuples describing which objects (osds, pools) this relates to.
62598fc57047854f4633f6bc
class MyMemoryTranslation(MachineTranslation): <NEW_LINE> <INDENT> name = 'MyMemory' <NEW_LINE> def convert_language(self, language): <NEW_LINE> <INDENT> return language.replace('_', '-').lower() <NEW_LINE> <DEDENT> def is_supported(self, source, language): <NEW_LINE> <INDENT> return self.lang_supported(source) and sel...
MyMemory machine translation support.
62598fc5be7bc26dc9251fd0
class FamilyPictures(models.Model): <NEW_LINE> <INDENT> from product.models import Product <NEW_LINE> name = models.CharField(_("Nome da imagem"), max_length=255, blank=False) <NEW_LINE> image = models.ImageField(_("Imagem"), upload_to="family/pictures/%y/%m", blank=False) <NEW_LINE> product = models.ForeignKey(Product...
4.2 Familia: item.10 linha: familia.fotos
62598fc55fdd1c0f98e5e27d
class SelfAttention(nn.Cell): <NEW_LINE> <INDENT> def __init__(self, batch_size, hidden_size, num_attention_heads=16, attention_probs_dropout_prob=0.1, use_one_hot_embeddings=False, initializer_range=0.02, hidden_dropout_prob=0.1, has_attention_mask=True, is_encdec_att=False, compute_type=mstype.float32): <NEW_LINE> <I...
Apply self-attention. Args: batch_size (int): Batch size of input dataset. from_seq_length (int): Length of query sequence. to_seq_length (int): Length of memory sequence. hidden_size (int): Size of attention layers. num_attention_heads (int): Number of attention heads. Default: 16. attention_p...
62598fc55166f23b2e2436cc
class IAM(object): <NEW_LINE> <INDENT> def __init__(self, stack_name): <NEW_LINE> <INDENT> self.client = boto3.client('iam', region_name="us-east-1") <NEW_LINE> self.role_name = '{}-lambda-execution-role'.format(stack_name) <NEW_LINE> self.policy_name = '{}-api-lambda-permissions'.format(stack_name) <NEW_LINE> <DEDENT>...
Class to manage IAM roles for a stack
62598fc54527f215b58ea1ba
class OpenSCADWorkbench ( Workbench ): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__class__.Icon = FreeCAD.getResourceDir() + "Mod/OpenSCAD/Resources/icons/OpenSCADWorkbench.svg" <NEW_LINE> self.__class__.MenuText = "OpenSCAD" <NEW_LINE> self.__class__.ToolTip = ( "OpenSCAD is an application for c...
OpenSCAD workbench object
62598fc571ff763f4b5e7a69
class Solution: <NEW_LINE> <INDENT> def isSameTree(self, p: TreeNode, q: TreeNode) -> bool: <NEW_LINE> <INDENT> return self.dfs(p, q) <NEW_LINE> <DEDENT> def dfs(self, node1, node2): <NEW_LINE> <INDENT> if not node1 and not node2: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if not node1 or not node2: <NEW_LINE>...
方法1:dfs递归
62598fc55fcc89381b2662c2
class ConstantDeclaration(FieldDeclaration): <NEW_LINE> <INDENT> attrs = ()
only in interface
62598fc57c178a314d78d78a
class PublicSubmission(Submission): <NEW_LINE> <INDENT> __tablename__ = 'submission_public' <NEW_LINE> id = util.pk() <NEW_LINE> enumerator_user_id = sa.Column(pg.UUID, util.fk('auth_user.id')) <NEW_LINE> enumerator = relationship('User') <NEW_LINE> survey_type = sa.Column(survey_type_enum, nullable=False) <NEW_LINE> _...
A PublicSubmission might have an enumerator. Use a PublicSubmission for a Survey.
62598fc57d847024c075c6a8
class Cave(object): <NEW_LINE> <INDENT> number = None <NEW_LINE> def __init__(self, number): <NEW_LINE> <INDENT> self.number = number
A Cave. A cave has a number:: >>> hasattr(Cave, 'number') True
62598fc53317a56b869be6c6
class DataplaneChecker(object): <NEW_LINE> <INDENT> def __init__(self, event_dag, slop_buffer=10): <NEW_LINE> <INDENT> self.events = list(event_dag.events) <NEW_LINE> self.stats = DataplaneCheckerStats(self.events) <NEW_LINE> self.current_dp_fingerprints = [] <NEW_LINE> self.fingerprint_2_event_idx = {} <NEW_LINE> self...
Dataplane permits are the default, *unless* they were explicitly dropped in the initial run. This class keeps track of whether pending dataplane events should be dropped or forwarded during replay. Note that whenever DataplaneChecker is in use, it should always be the case that DataplanePermit and DataplaneDrop events...
62598fc5d486a94d0ba2c2bc
class Betais_silaServicer(object): <NEW_LINE> <INDENT> def device_identification(self, request, context): <NEW_LINE> <INDENT> context.code(beta_interfaces.StatusCode.UNIMPLEMENTED) <NEW_LINE> <DEDENT> def supported_features(self, request, context): <NEW_LINE> <INDENT> context.code(beta_interfaces.StatusCode.UNIMPLEMENT...
Feature "is_sila" Version: 3 In this version the description of features is simplified
62598fc5656771135c48995a
class PostManager(models.Manager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> log.debug('Creating query set for Posts...') <NEW_LINE> ret = super(PostManager, self).get_query_set() <NEW_LINE> now = datetime.datetime.now() <NEW_LINE> log.debug('Will filter out by date: %s' % now) <NEW_LINE> ret = r...
Returns published posts via their date
62598fc5d8ef3951e32c7fd1
class PyKeyboardMeta(object): <NEW_LINE> <INDENT> def press_key(self, character=''): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def release_key(self, character=''): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def tap_key(self, character='', n=1, interval=0): <NEW_LINE> <INDE...
The base class for PyKeyboard. Represents basic operational model.
62598fc5aad79263cf42eac0
class AuthorizationError(Exception): <NEW_LINE> <INDENT> def __init__(self, annotations): <NEW_LINE> <INDENT> self.annotations = annotations <NEW_LINE> super(AuthorizationError, self).__init__(', '.join(annotations))
Authorization error.
62598fc53d592f4c4edbb19d
class OrderGoods(BaseModel): <NEW_LINE> <INDENT> order = models.ForeignKey(OrderInfo, verbose_name='订单', on_delete=models.CASCADE) <NEW_LINE> count = models.IntegerField(default=1, verbose_name='商品数目') <NEW_LINE> price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name='商品价格') <NEW_LINE> comment = mode...
订单商品模型类
62598fc5aad79263cf42eac1
class MessageReaderWriter(object): <NEW_LINE> <INDENT> def __init__(self, socket_stream): <NEW_LINE> <INDENT> self._stream = socket_stream <NEW_LINE> self._msg = None <NEW_LINE> <DEDENT> def _read_message(self): <NEW_LINE> <INDENT> hdr = self._stream.read(5) <NEW_LINE> msg_len, msg_type = struct.unpack("<LB", hdr) <NEW...
Implements a Message Reader/Writer. Args: socket_stream (mysqlx.connection.SocketStream): `SocketStream` object.
62598fc526068e7796d4cc48
class TurtlePT(object): <NEW_LINE> <INDENT> def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.angle = 0 <NEW_LINE> self._stack = [] <NEW_LINE> <DEDENT> def push(self): <NEW_LINE> <INDENT> self._stack.append( (self.x, self.y, self.angle) ) <NEW_LINE> <DEDENT> def pop(self): ...
Overview: Turtle graphics object that can be moved, turned left and right and moved forward. This is the basis of an LSystem drawing so this object is provided for use with various drawing systems. public parameters: x: current x coordinate (dimensionless) y: current y coordinate (dimensionless) angle: curr...
62598fc5cc40096d6161a34e
class Fabu(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'T_Fabu_Data' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> goodsid = db.Column(db.String(50)) <NEW_LINE> premium=db.Column(db.String(50)) <NEW_LINE> invalidTime=db.Column(db.String(50)) <NEW_LINE> issueTime=db.Column(db.String(50)) <NEW_LIN...
发布模型
62598fc5a219f33f346c6af4
class CellTest(GspreadTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(CellTest, self).setUp() <NEW_LINE> title = self.config.get('Spreadsheet', 'title') <NEW_LINE> self.sheet = self.gc.open(title).sheet1 <NEW_LINE> <DEDENT> def test_properties(self): <NEW_LINE> <INDENT> update_value = gen_value() ...
Test for gspread.Cell.
62598fc57c178a314d78d78c
class StdOutListener(streaming.StreamListener): <NEW_LINE> <INDENT> def on_data(self, data): <NEW_LINE> <INDENT> data = json.loads(data) <NEW_LINE> if 'retweeted_status' not in data and data['lang'] == 'en': <NEW_LINE> <INDENT> nouns = [word for (word, pos) in nltk.pos_tag(nltk.word_tokenize(data['text'])) if pos[0] ==...
A listener handles tweets that are received from the stream. This is a basic listener that just prints received tweets to stdout.
62598fc5f9cc0f698b1c5448
class DomainNetworkFeature(ManagedObject): <NEW_LINE> <INDENT> consts = DomainNetworkFeatureConsts() <NEW_LINE> naming_props = set([u'name']) <NEW_LINE> mo_meta = MoMeta("DomainNetworkFeature", "domainNetworkFeature", "network-feature-[name]", VersionMeta.Version112a, "InputOutput", 0x3f, [], ["admin"], [u'computeSyste...
This is DomainNetworkFeature class.
62598fc5ad47b63b2c5a7b45
class Management(base.ManagerWithFind): <NEW_LINE> <INDENT> resource_class = Instance <NEW_LINE> def list(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _list(self, url, response_key, limit=None, marker=None): <NEW_LINE> <INDENT> resp, body = self.api.client.get(limit_url(url, limit, marker)) <NEW_LINE> if not...
Manage :class:`Instances` resources.
62598fc5f548e778e596b88a
class CustomLocationOperationsList(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'value': {'required': True}, } <NEW_LINE> _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, 'value': {'key': 'value', 'type': '[CustomLocationOperation]'}, } <NEW_LINE> def __init__( self, **kwargs ): <...
Lists of Custom Locations operations. All required parameters must be populated in order to send to Azure. :param next_link: Next page of operations. :type next_link: str :param value: Required. Array of customLocationOperation. :type value: list[~azure.mgmt.extendedlocation.v2021_08_15.models.CustomLocationOperation...
62598fc5956e5f7376df57f4
class FeatureViewSet(ListFeaturesMixin, mixins.ListModelMixin, GenericViewSet): <NEW_LINE> <INDENT> serializer_class = FeatureSerializer <NEW_LINE> filter_fields = ('ftype', 'build', 'chr', 'start', 'end')
Given a feature type (e.g. gene, marker, region), build and genomic range return the location(s) & basic details or all features in the region. --- list: response_serializer: FeatureSerializer parameters: - name: ftype description: gene, marker or region. required: true typ...
62598fc550812a4eaa620d5b
class FieldViewDialog(): <NEW_LINE> <INDENT> def __init__(self, parent, window_caption, fields_dict, status_enable, status_inactivate): <NEW_LINE> <INDENT> self.toplevel = parent <NEW_LINE> self.fields_dict = copy.deepcopy(fields_dict) <NEW_LINE> self.fieldviews = [] <NEW_LINE> self.notebook = None <NEW_LINE> self.dial...
Creates a dialog box for entry of custom data fields Arguments: parent: Parent Window fields: Field values to display
62598fc5d8ef3951e32c7fd2
class TemporaryBuildDirectory: <NEW_LINE> <INDENT> def __init__(self, output_file_name): <NEW_LINE> <INDENT> self.orig_cwd = os.getcwd() <NEW_LINE> self.tmpdir = None <NEW_LINE> self.output_file_name = output_file_name <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> self.tmpdir = self.get_temp_directory() ...
Context handler to guard the build process. Upon entering the context, the source is copied to a temporary directory and the program changes to this directory. After all build actions have been done, the output file is copied back to the original directory, the program resets the current working directory and deletes t...
62598fc55fdd1c0f98e5e280
class DummySkipOperator(DummyOperator): <NEW_LINE> <INDENT> ui_color = '#e8b7e4' <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> raise AirflowSkipException
Dummy operator which always skips the task.
62598fc555399d3f05626805
class RedshiftVPCConfig(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.clusters = {}
Redshift configuration for a single VPC :ivar clusters: Dictionary of clusters [name]
62598fc55fc7496912d483f1
class LocationDetailAPIView(DetailViewUpdateDelete): <NEW_LINE> <INDENT> queryset = Location.objects.all() <NEW_LINE> serializer_class = location_serializers['LocationDetailSerializer'] <NEW_LINE> permission_classes = [IsAuthenticated, IsAdminUser] <NEW_LINE> lookup_field = 'slug'
Updates a record.
62598fc53d592f4c4edbb19f
class CheckSyscall(common.LinuxPlugin): <NEW_LINE> <INDENT> __name = "check_syscall" <NEW_LINE> def Find_sys_call_table_size(self): <NEW_LINE> <INDENT> for func_name, rewind in [("system_call_fastpath", 0), ("ret_from_sys_call", 40)]: <NEW_LINE> <INDENT> func = self.profile.get_constant_object( func_name, target="Funct...
Checks if the system call table has been altered.
62598fc54428ac0f6e658813
class DownloadedUser(db.DynamicDocument): <NEW_LINE> <INDENT> meta = { 'indexes': ['email'] } <NEW_LINE> downloaded_on = db.DateTimeField(required=False, default=datetime.utcnow()) <NEW_LINE> email = db.StringField(required=True, max_length=255) <NEW_LINE> phone = db.StringField(required=True, max_length=255) <NEW_LINE...
When a user downloads Pallet and we take their number and email
62598fc5099cdd3c63675559
class PubsubProjectsSubscriptionsModifyPushConfigRequest(_messages.Message): <NEW_LINE> <INDENT> modifyPushConfigRequest = _messages.MessageField('ModifyPushConfigRequest', 1) <NEW_LINE> subscription = _messages.StringField(2, required=True)
A PubsubProjectsSubscriptionsModifyPushConfigRequest object. Fields: modifyPushConfigRequest: A ModifyPushConfigRequest resource to be passed as the request body. subscription: The name of the subscription. Format is `projects/{project}/subscriptions/{sub}`.
62598fc53617ad0b5ee06436
class MainTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = main.app.test_client() <NEW_LINE> <DEDENT> def test_hello_world(self): <NEW_LINE> <INDENT> rv = self.app.get('/') <NEW_LINE> print(rv.data) <NEW_LINE> assert("smartgrid1" in rv.data.lower())
This class uses the Flask tests app to run an integration test against a local instance of the server.
62598fc57c178a314d78d78e
class AutoLoader(object): <NEW_LINE> <INDENT> pass
Base class for automatic loaders (e.g. Git)
62598fc5851cf427c66b85a4
class TestMongoengineFix(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> app = Eve(settings=SETTINGS) <NEW_LINE> app.debug = True <NEW_LINE> ext = EveMongoengine(app) <NEW_LINE> ext.add_model(TwoFaceDoc) <NEW_LINE> cls.app = app <NEW_LINE> cls.client = app.test_c...
Test if non-standard querysets defined in datalayer work as expected.
62598fc55fdd1c0f98e5e282
class EventHandler(logging.Handler): <NEW_LINE> <INDENT> def emit(self, record: Type[logging.LogRecord]) -> None: <NEW_LINE> <INDENT> print('EVENT EMITTER', record.getMessage())
A custom handler class that emits each log entry as event
62598fc5aad79263cf42eac4
class TanhLayer(Layer): <NEW_LINE> <INDENT> def fprop(self, inputs): <NEW_LINE> <INDENT> return np.tanh(inputs) <NEW_LINE> <DEDENT> def bprop(self, inputs, outputs, grads_wrt_outputs): <NEW_LINE> <INDENT> return (1. - outputs ** 2) * grads_wrt_outputs <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return '...
Layer implementing an element-wise hyperbolic tangent transformation.
62598fc5283ffb24f3cf3b74
class LocationEFS(AWSObject): <NEW_LINE> <INDENT> resource_type = "AWS::DataSync::LocationEFS" <NEW_LINE> props: PropsDictType = { "Ec2Config": (Ec2Config, True), "EfsFilesystemArn": (str, True), "Subdirectory": (str, False), "Tags": (Tags, False), }
`LocationEFS <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-datasync-locationefs.html>`__
62598fc53346ee7daa3377c0
class UserForm(forms.Form): <NEW_LINE> <INDENT> email = forms.EmailField(label=_("Email Address")) <NEW_LINE> password = forms.CharField(label=_("Password"), widget=forms.PasswordInput(render_value=False)) <NEW_LINE> def __init__(self, request, *args, **kwargs): <NEW_LINE> <INDENT> initial = {} <NEW_LINE> for value in ...
Fields for signup & login.
62598fc5ec188e330fdf8b84
class ChangePasswordView(generics.UpdateAPIView): <NEW_LINE> <INDENT> serializer_class = ChangePasswordSerializer <NEW_LINE> permission_classes = (PrivateTokenAccessPermission, ) <NEW_LINE> def get_object(self): <NEW_LINE> <INDENT> obj = self.request.user <NEW_LINE> return obj <NEW_LINE> <DEDENT> def update(self, reque...
An endpoint for changing password.
62598fc526068e7796d4cc4c
class MRVBCodeGenerator(TD2CodeGenerator): <NEW_LINE> <INDENT> def __init__(self, document_type: str, country_code: str, surname: str, given_names: str, document_number: str, nationality: str, birth_date: str, sex: str, expiry_date: str, optional_data="", transliteration=dictionary.latin_based(), force=False): <NEW_LIN...
Calculate the string code for machine readable zone visas of type B (MRVB) Params: document_type (str): The First letter must be 'V' country_code (str): 3 letters code (ISO 3166-1) or country name (in English) surname (str): Primary identifier(s) given_names (str): Secondary id...
62598fc599fddb7c1ca62f65
class SnsIdUserStatus(object): <NEW_LINE> <INDENT> def __init__(self, userExisting=None, phoneNumberRegistered=None, sameDevice=None, accountMigrationCheckType=None,): <NEW_LINE> <INDENT> self.userExisting = userExisting <NEW_LINE> self.phoneNumberRegistered = phoneNumberRegistered <NEW_LINE> self.sameDevice = sameDevi...
Attributes: - userExisting - phoneNumberRegistered - sameDevice - accountMigrationCheckType
62598fc54527f215b58ea1c0
class TestSequence(unittest.TestCase): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> rptable = RPTable() <NEW_LINE> oh_init_rpt(rptable) <NEW_LINE> error, update_count, update_timestamp = oh_get_rpt_info(rptable) <NEW_LINE> self.assertEqual(error, SA_OK) <NEW_LINE> self.assertEqual(oh_add_resource(rptable,...
runTest : Starting with an empty RPTable, adds 1 resource to it. Checks rpt info to see if update count was updated, but it passes NULL for a table. If oh_get_rpt_info returns error, the test passes, otherwise it failed. Return value: 0 on success, 1 on failure
62598fc5f548e778e596b88e
class Msg: <NEW_LINE> <INDENT> def __init__(self, code_rate=None, sample_rate=None): <NEW_LINE> <INDENT> self.code_rate = 1023000 if code_rate is None else code_rate <NEW_LINE> self.sample_rate = self.code_rate * 10 if sample_rate is None else sample_rate <NEW_LINE> self.initial_time = fractions.Fraction(0) <NEW_LINE> ...
Msg generate msg randomly
62598fc5956e5f7376df57f6
class MyQueue(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.input_stack = [] <NEW_LINE> self.output_stack = [] <NEW_LINE> <DEDENT> def push(self, x): <NEW_LINE> <INDENT> self.input_stack.append(x) <NEW_LINE> <DEDENT> def pop(self): <NEW_LINE> <INDENT> if self.output_stack == []: <NEW_LINE> <...
双栈法 input_stack 用来处理push的数据 output_stack 专门用来处理弹出和返回队列头的操作
62598fc54a966d76dd5ef1c6
class TTFontMaker: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.tables = {} <NEW_LINE> <DEDENT> def add(self, tag, data): <NEW_LINE> <INDENT> if tag == 'head': <NEW_LINE> <INDENT> data = splice(data, 8, b'\0\0\0\0') <NEW_LINE> <DEDENT> self.tables[tag] = data <NEW_LINE> <DEDENT> def makeStream(self)...
Basic TTF file generator
62598fc5aad79263cf42eac6
class QuantityError(AttribDict): <NEW_LINE> <INDENT> defaults = {"uncertainty": None, "lower_uncertainty": None, "upper_uncertainty": None, "confidence_level": None} <NEW_LINE> warn_on_non_default_key = True <NEW_LINE> def __init__(self, uncertainty=None, lower_uncertainty=None, upper_uncertainty=None, confidence_level...
Uncertainty information for a physical quantity. :type uncertainty: float :param uncertainty: Uncertainty as the absolute value of symmetric deviation from the main value. :type lower_uncertainty: float :param lower_uncertainty: Uncertainty as the absolute value of deviation from the main value towards smaller...
62598fc5adb09d7d5dc0a86d
class Repository(object): <NEW_LINE> <INDENT> def __init__(self, **query): <NEW_LINE> <INDENT> self.query = query <NEW_LINE> <DEDENT> def all(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def find(self, id): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def where(self, **q...
Repository. Base contract for repository classes.
62598fc526068e7796d4cc4e
class PurchaseRequestEditableListTestCase(ModuleTestCase): <NEW_LINE> <INDENT> module = 'purchase_request_editable_list'
Test Purchase Request Editable List module
62598fc5fff4ab517ebcdada