code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class _ABEHelpers: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def updatebyte(byte, bit, value): <NEW_LINE> <INDENT> if value == 0: <NEW_LINE> <INDENT> return byte & ~(1 << bit) <NEW_LINE> <DEDENT> elif value == 1: <NEW_LINE> <INDENT> return byte | (1 << bit) <NEW_LINE> <DEDENT> <DEDENT> @staticmethod <NEW_LINE> def g... | Local Functions used across all Expander Pi classes | 62598f81442bda511e95be94 |
class DeepNeuralNetwork: <NEW_LINE> <INDENT> def __init__(self, nx, layers): <NEW_LINE> <INDENT> if type(nx) is not int: <NEW_LINE> <INDENT> raise TypeError("nx must be an integer") <NEW_LINE> <DEDENT> if nx < 1: <NEW_LINE> <INDENT> raise ValueError("nx must be a positive integer") <NEW_LINE> <DEDENT> if type(layers) i... | Class definition for DeepNeuralNetwork | 62598f81c432627299fa2a08 |
class AdmissionListView(generics.ListAPIView): <NEW_LINE> <INDENT> queryset = Admission.objects.all() <NEW_LINE> serializer_class = AdmissionSerializer <NEW_LINE> filter_backends = (DjangoFilterBackend,) <NEW_LINE> filterset_class = AdmissionFilter | вывод поступлений | 62598f816e29344779b0009c |
@attr.s <NEW_LINE> @implementer(service.IService) <NEW_LINE> class UploaderService(service.Service): <NEW_LINE> <INDENT> _config = attr.ib(validator=attr.validators.instance_of(MagicFolderConfig)) <NEW_LINE> _status = attr.ib(validator=attr.validators.instance_of(FolderStatus)) <NEW_LINE> _tahoe_client = attr.ib() <NEW... | Writes LocalSnapshots to Tahoe | 62598f816fece00bbaccb3c1 |
class NegativeBinomial(Distribution): <NEW_LINE> <INDENT> arg_constraints = {'total_count': constraints.greater_than_eq(0), 'probs': constraints.half_open_interval(0., 1.)} <NEW_LINE> support = constraints.nonnegative_integer <NEW_LINE> def __init__(self, total_count, probs=None, logits=None, validate_args=None): <NEW_... | Creates a Negative Binomial distribution, i.e. distribution
of the number of independent identical Bernoulli trials
needed before :attr:`total_count` failures are achieved. The probability
of success of each Bernoulli trial is :attr:`probs`.
Args:
total_count (float or Tensor): non-negative number of negative Bern... | 62598f8115baa723494619b8 |
class IPythonHandler(AuthenticatedHandler): <NEW_LINE> <INDENT> @property <NEW_LINE> def config(self): <NEW_LINE> <INDENT> return self.settings.get('config', None) <NEW_LINE> <DEDENT> @property <NEW_LINE> def log(self): <NEW_LINE> <INDENT> if Application.initialized(): <NEW_LINE> <INDENT> return Application.instance().... | IPython-specific extensions to authenticated handling
Mostly property shortcuts to IPython-specific settings. | 62598f813c8af77a43b67c50 |
class PolicyV1beta1PodSecurityPolicyList(object): <NEW_LINE> <INDENT> swagger_types = { 'api_version': 'str', 'items': 'list[PolicyV1beta1PodSecurityPolicy]', 'kind': 'str', 'metadata': 'V1ListMeta' } <NEW_LINE> attribute_map = { 'api_version': 'apiVersion', 'items': 'items', 'kind': 'kind', 'metadata': 'metadata' } <N... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f81f7d966606f747a21 |
class OnSaveListener(sublime_plugin.EventListener): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.command_name = 'indent_sexp_file' <NEW_LINE> <DEDENT> def on_pre_save(self, view): <NEW_LINE> <INDENT> view.window().run_command(self.command_name) | Before save event listener | 62598f8176d4e153a661c64d |
class Solution: <NEW_LINE> <INDENT> def search(self, nums: List[int], target: int) -> int: <NEW_LINE> <INDENT> if not nums: <NEW_LINE> <INDENT> return -1 <NEW_LINE> <DEDENT> l,r =0,len(nums)-1 <NEW_LINE> while l<=r: <NEW_LINE> <INDENT> mid = (l + r)//2 <NEW_LINE> if nums[mid] == target: <NEW_LINE> <INDENT> return mid <... | 时间复杂度O(logN) | 62598f81379a373c97d98a4c |
class CallMixin(LazyMixin): <NEW_LINE> <INDENT> def __call__(self: Lazy, *args: Any, **kwargs: Any) -> Lazy: <NEW_LINE> <INDENT> return self.__class__(action=Call(self, args, kwargs), origin=self) | Call support
Function call is read only expression | 62598f8110dbd63aa1c705ec |
class DecoderLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, size, self_attn, src_attn, feed_forward, dropout_rate, normalize_before=True, concat_after=False): <NEW_LINE> <INDENT> super(DecoderLayer, self).__init__() <NEW_LINE> self.size = size <NEW_LINE> self.self_attn = self_attn <NEW_LINE> self.src_attn = s... | Single decoder layer module
:param int size: input dim
:param espnet.nets.pytorch_backend.transformer.attention.MultiHeadedAttention self_attn: self attention module
:param espnet.nets.pytorch_backend.transformer.attention.MultiHeadedAttention src_attn: source attention module
:param espnet.nets.pytorch_backend.transf... | 62598f813eb6a72ae038a07c |
class Controller(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def start_filling(self, buffer, videogroup, channel, timeout): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def stop_filling(self): <NEW_LINE> <INDENT> pass | Base class that all controller classes should derive from. | 62598f81baa26c4b54d4eced |
class JSONReadExtender(object): <NEW_LINE> <INDENT> implements(IJSONReadExtender) <NEW_LINE> adapts(IAnalysisRequest) <NEW_LINE> def __init__(self, context): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> <DEDENT> def ar_analysis_values(self): <NEW_LINE> <INDENT> ret = [] <NEW_LINE> analyses = self.context.getAn... | - Adds the full details of all analyses to the AR.Analyses field
| 62598f81bde94217f3707383 |
class FirmList(Callout): <NEW_LINE> <INDENT> selectors = { 'self': '.leaflet-popup', 'header': '.dg-popup__header-title', 'X': '.leaflet-popup-close-button', 'list': '.dg-building-callout__list' } <NEW_LINE> def list_present(self): <NEW_LINE> <INDENT> return self.driver.find_element_by_css_selector(self.selectors['list... | Firm list callout | 62598f81009cb60464d00f68 |
class MessageToReplyNotFound(MessageError): <NEW_LINE> <INDENT> match = 'Reply message not found' | Will be raised when you try to reply to very old or deleted or unknown message. | 62598f8130c21e258be98244 |
class FeedForwardNetwork(tf.layers.Layer): <NEW_LINE> <INDENT> def __init__(self, hidden_size, filter_size, relu_dropout, train, allow_pad): <NEW_LINE> <INDENT> super(FeedForwardNetwork, self).__init__() <NEW_LINE> self.hidden_size = hidden_size <NEW_LINE> self.filter_size = filter_size <NEW_LINE> self.relu_dropout = r... | Fully connected feedforward network. | 62598f81596a8972361276ab |
class InprocClient(ZMQClient): <NEW_LINE> <INDENT> def __init__(self, context, endpoint): <NEW_LINE> <INDENT> connection = 'inproc://{}'.format(endpoint) <NEW_LINE> super(InprocClient, self).__init__(context, connection) | Inter-process communication client. | 62598f818a43f66fc4bf1bbb |
class GetAllFirmwareVersionResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Version = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Version = params.get("Version") <NEW_LINE> self.RequestId = params.get("Reques... | GetAllFirmwareVersion返回参数结构体
| 62598f817b25080760ed6ee0 |
class Variable(DenseTensor, AbstractVariable): <NEW_LINE> <INDENT> def __init__(self, initial_backing) -> None: <NEW_LINE> <INDENT> self.variables = [tf.Variable(val, dtype=INT_TYPE, trainable=False) for val in initial_backing] <NEW_LINE> self.initializer = tf.group(*[var.initializer for var in self.variables]) <NEW_LI... | CRT Variable class. | 62598f81287bf620b62715ee |
class TestingConfig(BaseConfig): <NEW_LINE> <INDENT> DEBUG = True <NEW_LINE> TESTING = True <NEW_LINE> BCRYPT_HASH_PREFIX = 4 <NEW_LINE> AUTH_TOKEN_EXPIRY_DAYS = 0 <NEW_LINE> AUTH_TOKEN_EXPIRY_SECONDS = 3 <NEW_LINE> AUTH_TOKEN_EXPIRATION_TIME_DURING_TESTS = 5 | Testing application configuration | 62598f8116aa5153ce3fff3c |
class SCCPRegisterAvailableLines(SCCPMessage): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> SCCPMessage.__init__(self, SCCPMessageType.RegisterAvailableLinesMessage) <NEW_LINE> self.nboflines=1 <NEW_LINE> <DEDENT> def pack(self): <NEW_LINE> <INDENT> strPack = SCCPMessage.pack(self) <NEW_LINE> strPack = s... | sccp register message | 62598f81a17c0f6771d5bc7f |
class MissingArgumentError(CommandsError): <NEW_LINE> <INDENT> def __init__(self, ctx, arg): <NEW_LINE> <INDENT> self.ctx = ctx <NEW_LINE> self.arg = arg <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return f"Missing required argument `{self.arg}` in `{self.ctx.command_name}`." <NEW_LINE> <DEDENT> ... | Raised when a command is missing an argument. | 62598f81cad5886f8bdc4d61 |
class ReconstructionLoss(_Loss): <NEW_LINE> <INDENT> def __init__(self, balance_factor=0.0005): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.balance_factor = balance_factor <NEW_LINE> <DEDENT> def forward(self, image, reconstruction): <NEW_LINE> <INDENT> image_2d = image.view(image.size(0), -1) <NEW_LINE> dis... | Calculate the loss between the target image and the output of the
decoder sub-network. This is just the per-pixel euclidean distance. | 62598f8126238365f5fac5aa |
class GameEngine: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._game_on = True <NEW_LINE> self._map = Map() <NEW_LINE> <DEDENT> def _get_game_on(self): <NEW_LINE> <INDENT> return self._game_on <NEW_LINE> <DEDENT> gameOn = property(_get_game_on) <NEW_LINE> def loadMap(self, mapname, filepath, ... | Cette classe contient le moteur du jeu.
Cela inclut la gestion de la map et du joueur. | 62598f81dc8b845886d52ff1 |
class EmailManager(utils.IdentifierMixin, object): <NEW_LINE> <INDENT> def __init__(self, client): <NEW_LINE> <INDENT> self.client = client <NEW_LINE> <DEDENT> def get_account_overview(self, identifier): <NEW_LINE> <INDENT> return self.client.call('SoftLayer_Network_Message_Delivery_Email_Sendgrid', 'getAccountOverview... | Common functions for getting information from the email service
:param SoftLayer.API.BaseClient client: the client instance | 62598f816aa9bd52df0d4917 |
class PyPyminuit2(Package): <NEW_LINE> <INDENT> homepage = "http://www.example.com" <NEW_LINE> url = "http://service-spi.web.cern.ch/service-spi/external/tarFiles/pyminuit2-0.0.1.tar.gz" <NEW_LINE> version('0.0.1', '9035b9ab03cba2b31ce6f75f37585112') <NEW_LINE> depends_on("root") <NEW_LINE> depends_on("py-setuptoo... | FIXME: put a proper description of your package here. | 62598f81e76e3b2f99fd8471 |
class WeightedSoftmaxClassificationLoss(Loss): <NEW_LINE> <INDENT> def __init__(self, anchorwise_output=False): <NEW_LINE> <INDENT> self._anchorwise_output = anchorwise_output <NEW_LINE> <DEDENT> def _compute_loss(self, prediction_tensor, target_tensor, weights): <NEW_LINE> <INDENT> num_classes = prediction_tensor.get_... | Softmax loss function. | 62598f81be383301e0253236 |
class AtLeastOnePropertyError(PropertyPresenceError): <NEW_LINE> <INDENT> def __init__(self, cls, properties): <NEW_LINE> <INDENT> self.properties = sorted(properties) <NEW_LINE> msg = "At least one of the ({1}) properties for {0} must be " "populated.".format( cls.__name__, ", ".join(x for x in self.prope... | Violating a constraint of a STIX object type that at least one of the given properties must be populated. | 62598f818da39b475be02c22 |
class DanishAnalyzerLucene( SparklingJavaTransformer, HasInputCol, HasOutputCol, HasStopwords, HasStopwordCase): <NEW_LINE> <INDENT> package_name = "com.sparklingpandas.sparklingml.feature" <NEW_LINE> class_name = "DanishAnalyzerLucene" <NEW_LINE> transformer_name = package_name + "." + class_name <NEW_LINE> @keyword_o... | >>> from pyspark.sql import SparkSession
>>> spark = SparkSession.builder.master("local[2]").getOrCreate()
>>> df = spark.createDataFrame([("hi boo",), ("bye boo",)], ["vals"])
>>> transformer = DanishAnalyzerLucene()
>>> transformer.setParams(inputCol="vals", outputCol="out")
DanishAnalyzerLucene_...
>>> result = tran... | 62598f81596a8972361276ae |
class TwitchDirectLink(Track): <NEW_LINE> <INDENT> _int_thumbnail: str <NEW_LINE> source: Literal["twitch"] = "twitch" <NEW_LINE> def __init__(self, id: str, info: dict): <NEW_LINE> <INDENT> super().__init__(id, info) <NEW_LINE> self.source = "twitch" <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> async def search( cls: T... | A track that implements a direct link fetch of Twitch.tv stream | 62598f81287bf620b62715f0 |
class ThermalBlockProblem(EllipticProblem): <NEW_LINE> <INDENT> def __init__(self, num_blocks=(3, 3), parameter_range=(0.1, 1), rhs=ConstantFunction(dim_domain=2)): <NEW_LINE> <INDENT> domain = RectDomain() <NEW_LINE> parameter_space = CubicParameterSpace({'diffusion': (num_blocks[1], num_blocks[0])}, *parameter_range)... | Analytical description of a 2D 'thermal block' diffusion problem.
This problem is to solve the elliptic equation ::
- ∇ ⋅ [ d(x, μ) ∇ u(x, μ) ] = f(x, μ)
on the domain [0,1]^2 with Dirichlet zero boundary values. The domain is
partitioned into nx x ny blocks and the diffusion function d(x, μ) is
constant on each s... | 62598f810383005118f6d13f |
class MakefilePackage(PackageBase): <NEW_LINE> <INDENT> phases = ['edit', 'build', 'install'] <NEW_LINE> build_system_class = 'MakefilePackage' <NEW_LINE> build_targets = [] <NEW_LINE> install_targets = ['install'] <NEW_LINE> build_time_test_callbacks = ['check'] <NEW_LINE> install_time_test_callbacks = ['installcheck'... | Specialized class for packages that are built using editable Makefiles
This class provides three phases that can be overridden:
1. :py:meth:`~.MakefilePackage.edit`
2. :py:meth:`~.MakefilePackage.build`
3. :py:meth:`~.MakefilePackage.install`
It is usually necessary to override the :py:meth:`~.MakefilePa... | 62598f816fb2d068a7693b4c |
class PixelShuffle2D(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, factor): <NEW_LINE> <INDENT> super(PixelShuffle2D, self).__init__() <NEW_LINE> try: <NEW_LINE> <INDENT> self._factors = (int(factor),) * 2 <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> self._factors = tuple(int(fac) for fac in factor)... | Pixel-shuffle layer for upsampling in 2 dimensions.
Pixel-shuffling is the operation of taking groups of values along
the *channel* dimension and regrouping them into blocks of pixels
along the ``H`` and ``W`` dimensions, thereby effectively multiplying
those dimensions by a constant factor in size.
For example, a fe... | 62598f81d6c5a102081e1b85 |
class BaseSprite(ppb.gomlib.GameObject): <NEW_LINE> <INDENT> position: Vector = Vector(0, 0) <NEW_LINE> layer: int = 0 <NEW_LINE> def __init__(self, **props): <NEW_LINE> <INDENT> super().__init__(**props) <NEW_LINE> self.position = Vector(self.position) | The base Sprite class. All sprites should inherit from this (directly or
indirectly).
The things that define a BaseSprite:
* A position vector
* A layer
BaseSprite provides an :py:meth:`__init__()` method that sets attributes
based on kwargs to make rapid prototyping easier. | 62598f8116aa5153ce3fff3e |
class ConfigClass(object): <NEW_LINE> <INDENT> SECRET_KEY = 'This is an INSECURE secret!! DO NOT use this in production!!' <NEW_LINE> SQLALCHEMY_DATABASE_URI = 'sqlite:///masticlab.sqlite' <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False <NEW_LINE> USER_APP_NAME = "MasticLab" <NEW_LINE> USER_ENABLE_EMAIL = False <NEW_... | Flask application config | 62598f8196565a6dacd2cc97 |
class FolderContent: <NEW_LINE> <INDENT> def __init__(self, abs_path): <NEW_LINE> <INDENT> if os.path.isdir(abs_path): <NEW_LINE> <INDENT> self.path = abs_path <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise ValueError('%s is not a dir' % abs_path) <NEW_LINE> <DEDENT> self.files, self.folders = get_content(self.pat... | abstraction for folder object. | 62598f8194891a1f408b940d |
class GroupListSearchPage(BasePage): <NEW_LINE> <INDENT> ACTIVITY = 'com.cmcc.cmrcs.android.ui.activities.GroupChatSearchActivity' <NEW_LINE> __locators = { '返回': (MobileBy.ID, 'com.chinasofti.rcs:id/iv_back'), '输入关键字搜索': (MobileBy.ID, 'com.chinasofti.rcs:id/edit_query'), '删除关键字': (MobileBy.ID, 'com.chinasofti.rcs:id/i... | 搜索群组 | 62598f81ec188e330fdf82dc |
class PyBoto3(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://github.com/boto/boto3" <NEW_LINE> pypi = "boto3/boto3-1.10.44.tar.gz" <NEW_LINE> version('1.18.12', sha256='596fb9df00a816780db8620d9f62982eb783b3eb63a75947e172101d0785e6aa') <NEW_LINE> version('1.17.27', sha256='fa41987f9f71368013767306d9522b627946a... | The AWS SDK for Python. | 62598f810fa83653e46f492e |
class singleargmaxfunction(function, convex, increasing): <NEW_LINE> <INDENT> name = 'max' <NEW_LINE> def __init__(self, arg): <NEW_LINE> <INDENT> self.arg = arg <NEW_LINE> self.rows = 1 <NEW_LINE> self.cols = 1 <NEW_LINE> <DEDENT> def getparams(self): <NEW_LINE> <INDENT> return getparams(self.arg) <NEW_LINE> <DEDENT> ... | The maximum element of a single argument. | 62598f81d53ae8145f917ecb |
class LogoutView(View): <NEW_LINE> <INDENT> url = '/auth/login/' <NEW_LINE> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> logout(request) <NEW_LINE> return HttpResponseRedirect( reverse( 'users_app:login' ) ) | cerrar sesion | 62598f81d164cc61758209b5 |
class HelloViewSet(viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def list(self, request): <NEW_LINE> <INDENT> a_viewset = [ "USes action such as ('list','create','retrieve','update','partial_update')", 'automatically maps to URLs using Routers', 'Provides more function... | TEst API viewSets | 62598f8107f4c71912baee82 |
class HostState(object): <NEW_LINE> <INDENT> def __init__(self, session, host_name): <NEW_LINE> <INDENT> super(HostState, self).__init__() <NEW_LINE> self._session = session <NEW_LINE> self._host_name = host_name <NEW_LINE> self._stats = {} <NEW_LINE> self.update_status() <NEW_LINE> <DEDENT> def get_host_stats(self, re... | Manages information about the ESX host this compute
node is running on. | 62598f81379a373c97d98a4f |
class ShortPullRequest(_PullRequest): <NEW_LINE> <INDENT> pass | Object for the shortened representation of a PullRequest
GitHub's API returns different amounts of information about prs based
upon how that information is retrieved. Often times, when iterating over
several prs, GitHub will return less information. To provide a clear
distinction between the types of prs, github3.py u... | 62598f816aa9bd52df0d4919 |
class FormataData(object): <NEW_LINE> <INDENT> def __init__(self, data=None): <NEW_LINE> <INDENT> self._data = data <NEW_LINE> <DEDENT> def normaliza_data(self): <NEW_LINE> <INDENT> if self._data is not None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data_mask = re.compile(r'^(\d{2})\D*(\d{2})\D*(\d{4})$') <NEW_LINE... | FormataData é uma classe auxiliar à classe FinDt e que forncede métodos para transformar datas no formato 'string'
para o formato 'date' do Python e vice-versa. Quando fornecida uma data no formato 'string', transforma o separador
de data de diversos formatos (/, :, - ou espaço em branco) no separador padrao "/", antes... | 62598f81fbf16365ca793ae7 |
class FilenameParser: <NEW_LINE> <INDENT> def __init__(self, dirname, basename=None): <NEW_LINE> <INDENT> self.dirname = os.path.normpath(dirname) <NEW_LINE> self.basename = basename <NEW_LINE> if not os.path.isdir(self.dirname): <NEW_LINE> <INDENT> raise ValueError("filename must be a directory") <NEW_LINE> <DEDENT> <... | Simple class to interpret user's requests into KlustaKwik filenames | 62598f81bde94217f3707385 |
class Solution: <NEW_LINE> <INDENT> def continuousSubarraySum(self, A): <NEW_LINE> <INDENT> n = len(A) <NEW_LINE> minSum = [0, -1] <NEW_LINE> ret = None <NEW_LINE> maxInterval = None <NEW_LINE> accSum = 0 <NEW_LINE> for i in range(0, n): <NEW_LINE> <INDENT> accSum += A[i] <NEW_LINE> if not ret or maxInterval < accSum -... | @param: A: An integer array
@return: A list of integers includes the index of the first number and the index of the last number | 62598f8130c21e258be98248 |
class NoMatchForFlagsError(Exception): <NEW_LINE> <INDENT> pass | Error raised when trying to access a variable that exists, but has no matching value for the
current flags | 62598f81596a8972361276af |
class User(db.Model): <NEW_LINE> <INDENT> name = db.StringProperty(required=True) <NEW_LINE> pw_hash = db.StringProperty(required=True) <NEW_LINE> email = db.StringProperty() <NEW_LINE> @classmethod <NEW_LINE> def by_id(cls, uid): <NEW_LINE> <INDENT> return User.get_by_id(uid, parent=users_key()) <NEW_LINE> <DEDENT> @c... | User table. Name and pw_hash are required properties. | 62598f8150485f2cf55da9b0 |
class birnbaumsaunders(Distribution): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def random(aa,bb): <NEW_LINE> <INDENT> n=normal.random(0,1) <NEW_LINE> return bb*(aa*n/2+math.sqrt((aa*n/2)**2+1))**2 <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def pdf(aa,bb,x): <NEW_LINE> <INDENT> return (math.sqrt(x/bb)+math.sqrt(bb... | Birnbaum-Saunders | 62598f818da39b475be02c24 |
@admin.register(models.ModelValidationLog) <NEW_LINE> class ModelValidationLogAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> fields = ( "app", "model", "object_validator", "error_level", "validation_check", "error_message", ) <NEW_LINE> list_display = ( "__str__", "app", "model", "object_validator", "level", "validation_... | Model admin for the ModelValidationLog model. | 62598f813eb6a72ae038a07e |
class Discoverable(BaseDiscoverable): <NEW_LINE> <INDENT> def __init__(self, nd): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def get_entries(self): <NEW_LINE> <INDENT> return([discover.discover_address()]) | Adds support for discovering Radio Thermostat Wifi platform. | 62598f817b25080760ed6ee4 |
class TestMyReview(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.new = Review() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> del self.new <NEW_LINE> <DEDENT> def test_is_instance(self): <NEW_LINE> <INDENT> self.assertIsInstance(self.new, Review) <NEW_LINE> <DEDENT> def... | New class to test class Review | 62598f8166673b3332c2fe04 |
class IGrant(Interface): <NEW_LINE> <INDENT> pass | Grant Type
| 62598f8182261d6c5272fbf3 |
class ExpressRouteCircuitConnection(SubResource): <NEW_LINE> <INDENT> _validation = { 'circuit_connection_status': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'etag': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'express_route_circuit_peering': {'key': 'prope... | Express Route Circuit Connection in an ExpressRouteCircuitPeering resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:param id: Resource ID.
:type id: str
:param express_route_circuit_peering: Reference to Express Route Circuit
Private Peering Resource of the circuit in... | 62598f81a17c0f6771d5bc83 |
class InvalidJSON(object): <NEW_LINE> <INDENT> def __init__(self, original, error): <NEW_LINE> <INDENT> self.original = original <NEW_LINE> self.error = error | Object representing the original unparsed JSON string and the JSON error
| 62598f816e29344779b000a2 |
@skipIf(NO_MOCK, NO_MOCK_REASON) <NEW_LINE> class ServiceTestCase(TestCase): <NEW_LINE> <INDENT> def test_start(self): <NEW_LINE> <INDENT> with patch.object(os.path, 'join', return_value='A'): <NEW_LINE> <INDENT> with patch.dict(service.__salt__, {'cmd.retcode': MagicMock(return_value=False)}): <NEW_LINE> <INDENT> self... | Test cases for salt.modules.service | 62598f813c8af77a43b67c53 |
class RPCError(Exception): <NEW_LINE> <INDENT> def __init__(self, status, why): <NEW_LINE> <INDENT> self.status = status <NEW_LINE> self.why = why <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'standard_kaldi: error %d: %s' % (self.status, self.why) | Error thrown when standard_kaldi returns an error (in-band) | 62598f81b830903b9686e191 |
class CodeTracer(object): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def load_attr(self, obj, attr): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def call_function(self, func, argtuple, argspec): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def binary_subscr(self, obj, idx): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDE... | A base class for implementing code tracers.
This class defines the interface for a code tracer object, which is
an object which can be passed as the first argument to a code object
which has been transformed to enable tracing. Methods on the tracer
are called with relevant arguments from the Python stack when that
par... | 62598f8145492302aabfbf1d |
class UnsupportedVobjectError(Error, ValueError): <NEW_LINE> <INDENT> pass | The server rejected the vobject because of its type | 62598f8176d4e153a661c653 |
class Animator(GObject.GObject): <NEW_LINE> <INDENT> __gsignals__ = { 'completed': (GObject.SignalFlags.RUN_FIRST, None, ([])), } <NEW_LINE> def __init__(self, duration, fps=20, easing=EASE_OUT_EXPO, widget=None): <NEW_LINE> <INDENT> GObject.GObject.__init__(self) <NEW_LINE> self._animations = [] <NEW_LINE> self._durat... | The animator class manages the timing for calling the
animations. The animations can be added using the `add` function
and then started with the `start` function. If multiple animations
are added, then they will be played back at the same time and rate
as each other.
The `completed` signal is emitted upon the comple... | 62598f815f7d997b871f90f8 |
class MeasuredAnonRateThrottle(AnonRateThrottle): <NEW_LINE> <INDENT> def throttle_failure(self): <NEW_LINE> <INDENT> statsd.incr('api.throttle.failure') | On throttle failure, does a statsd call | 62598f81e76e3b2f99fd8475 |
class IsAddressOwner(permissions.BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> if request.user and request.user.is_authenticated(): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return False <NEW_LINE> <DEDENT> def has_object_permission(self, request, view, obj)... | Is this address being edited by user or admin | 62598f818a349b6b43685c85 |
class Comment(models.Model): <NEW_LINE> <INDENT> author = models.CharField(max_length=20) <NEW_LINE> email = models.EmailField() <NEW_LINE> text = models.TextField() <NEW_LINE> created_date = models.DateTimeField(default=timezone.now) <NEW_LINE> post = models.ForeignKey(Post) <NEW_LINE> def __str__(self): <NEW_LINE> <I... | 评论 | 62598f818a43f66fc4bf1bc1 |
class Parameters: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.result_dir = 'results/' <NEW_LINE> self.scene_file = None <NEW_LINE> self.log_file = 'logs' <NEW_LINE> self.dt = 0.1 <NEW_LINE> self.scene_size_x = 100 <NEW_LINE> self.scene_size_y = 100 <NEW_LINE> self.max_speed_av = 0.7 <NEW_LINE> self... | Contains all parameters. | 62598f817b25080760ed6ee6 |
class WT(AbstractOperator): <NEW_LINE> <INDENT> def __init__(self, shape, wavelet = 'db6', level = 3, amplify = None): <NEW_LINE> <INDENT> self.shape = shape <NEW_LINE> self.wavelet = wavelet <NEW_LINE> self.level = level <NEW_LINE> self.cMat_shapes = [] <NEW_LINE> if amplify is None: <NEW_LINE> <INDENT> self.amplify =... | wavelet transform:
call input: matrix
inv input: vector of length fitting WT.shape | 62598f81b5575c28eb7129e7 |
class MorseSensorClass(morse.core.object.MorseObjectClass): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__ (self, obj, parent=None): <NEW_LINE> <INDENT> super(MorseSensorClass, self).__init__(obj, parent) <NEW_LINE> self.output_functions = [] <NEW_LINE> self.output_modifiers = [] <NEW_LINE> <DEDENT... | Basic Class for all sensors
Inherits from the base object class. | 62598f810a366e3fb87dc40d |
class CommandRetrieveViewSet(generics.RetrieveAPIView): <NEW_LINE> <INDENT> serializer_class = serializers.NodeSerializer <NEW_LINE> def retrieve(request, *args, **kwargs): <NEW_LINE> <INDENT> queryset = models.Node.objects.all() <NEW_LINE> node = get_object_or_404(queryset, pk=kwargs['pk']) <NEW_LINE> retrieve = s... | API endpoint for setting and getting a specific command | 62598f81b57a9660fecd14be |
class InvalidBlockNumException(Exception): <NEW_LINE> <INDENT> pass | block num does not have related block | 62598f8107f4c71912baee85 |
class ModuleActions(object): <NEW_LINE> <INDENT> module_name: str <NEW_LINE> path: str <NEW_LINE> mod: "module.Module" <NEW_LINE> project: "projectmodule.Project" <NEW_LINE> def __init__(self, module_: "module.Module", path: str, modulename: str) -> None: <NEW_LINE> <INDENT> self.project = ( module_ if TYPE_CHECKING el... | Generate tree with actions from modules. | 62598f8130dc7b766599f29a |
class Solution(object): <NEW_LINE> <INDENT> def wordPattern(self, pattern, str): <NEW_LINE> <INDENT> s = str.split() <NEW_LINE> p = pattern <NEW_LINE> return len(set(zip(s,p))) == len(set(s)) == len(set(p)) and len(s) == len(p) | set(zip(s,t)) 来比较算是最常见的解法之一了
Runtime: 20 ms, faster than 73.90% of Python online submissions for Word Pattern.
Memory Usage: 11.8 MB, less than 5.15% of Python online submissions for Word Pattern. | 62598f8173bcbd0ca4bc9c92 |
class AbstractConcPersistence(object): <NEW_LINE> <INDENT> def is_valid_id(self, data_id): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def get_conc_ttl_days(self, user_id): <NEW_LINE> <INDENT> raise NotImplemented() <NEW_LINE> <DEDENT> def open(self, data_id): <NEW_LINE> <INDENT> raise NotImplem... | Custom conc_persistence plug-in implementations should inherit from this class.
Concordance persistence plug-in is expected to store current query and provide
access to it via a string identifier.
Please note that by 'query' we actually mean two representations:
1) data entered by user via query form (query, addition... | 62598f811f037a2d8b9e3b2a |
class GlobalNumber: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def from_local(local_number: LocalNumber, camera_location): <NEW_LINE> <INDENT> global_location = misc.convert_image_point_to_global_coordinates(local_number.dot_location_yx_pixels, camera_location) <NEW_LINE> return GlobalNumber(local_number.numeric_valu... | Represents a number in the global dot-to-dot context. | 62598f81d164cc61758209b9 |
class MelNpcData(MelLists): <NEW_LINE> <INDENT> _attr_indexes = OrderedDict([ (u'npc_level', 0), (u'attributes', slice(1, 9)), (u'skills', slice(9, 36)), (u'unknown2', 36), (u'npc_health', 38), (u'npc_spell_points', 39), (u'npc_fatigue', 40), (u'npc_disposition', 41), (u'npc_reputation', 42), (u'npc_rank', 43), (u'unkn... | Converts attributes and skills into lists. | 62598f81379a373c97d98a53 |
class Message(models.Model): <NEW_LINE> <INDENT> title = models.CharField(max_length=50) <NEW_LINE> content = models.TextField(max_length=255) <NEW_LINE> sender = models.CharField(max_length=50) <NEW_LINE> url = models.URLField() | Model for a message, the structure and attributes of the message model
{
title : title of the message
content : Body oir content of the message
sender : the sender of the message
url = a valid url
} | 62598f81e64d504609df90d1 |
class VersionFileStorageWrapper(object): <NEW_LINE> <INDENT> def __init__(self, storage): <NEW_LINE> <INDENT> self._storage = storage <NEW_LINE> <DEDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> return getattr(self._storage, name) <NEW_LINE> <DEDENT> def delete(self, name): <NEW_LINE> <INDENT> pass | Wrapper for file storage implementations that blocks file deletions. | 62598f817c178a314d78ceed |
class Criar_Vaga(SuccessMessageMixin,CreateView): <NEW_LINE> <INDENT> model = Vaga <NEW_LINE> template_name_suffix = '_create' <NEW_LINE> fields = ['titulo','remuneracao','local','prazo_de_aplicacao','tipo'] <NEW_LINE> context_object_name = "lista_vagas_professor" <NEW_LINE> success_url = reverse_lazy('professor-logado... | Cria uma vaga com professor_responsavel = professor logado. Mixin para
mostrar messagems de erro o sucesso | 62598f81bde94217f3707387 |
class TestTicketInformation(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 testTicketInformation(self): <NEW_LINE> <INDENT> pass | TicketInformation unit test stubs | 62598f8121a7993f00c659b4 |
class MockedDagDomain(NamedTuple): <NEW_LINE> <INDENT> filepath: str | Mocked DagDomain. | 62598f814e696a045264db22 |
class GameInfo: <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> <DEDENT> @commands.command() <NEW_LINE> async def gameinfo(self, *, gamename): <NEW_LINE> <INDENT> message = await self.bot.say("Contacting API") <NEW_LINE> appid = await Utils.gametoid(gamename) <NEW_LINE> if not... | My custom cog that does stuff! | 62598f81b5575c28eb7129e8 |
class MTLField(Field): <NEW_LINE> <INDENT> def __init__( self, **kwargs): <NEW_LINE> <INDENT> super(MTLField, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def build_vocab(self, dataset_list, **kwargs): <NEW_LINE> <INDENT> counter = Counter() <NEW_LINE> sources = [] <NEW_LINE> for arg in dataset_list: <NEW_LINE> <INDENT... | Defines a datatype together with instructions for converting to Tensor.
Every dataset consists of one or more types of data. For instance, a text
classification dataset contains sentences and their classes, while a
machine translation dataset contains paired examples of text in two
languages. Each of these types of da... | 62598f8191af0d3eaad39845 |
class getRowsWithColumns_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.LIST, 'success', (TType.STRUCT,(TRowResult, TRowResult.thrift_spec)), None, ), (1, TType.STRUCT, 'io', (IOError, IOError.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, io=None,): <NEW_LINE> <INDENT> self.success = succe... | Attributes:
- success
- io | 62598f81287bf620b62715f6 |
class RefPattern(object): <NEW_LINE> <INDENT> pattern = r'(?<!\\)\[([^:\]\s]+:[^:\]]+)(?<!\\)\]' <NEW_LINE> def __init__(self, refinder): <NEW_LINE> <INDENT> self.refinder = refinder <NEW_LINE> <DEDENT> def repl(self, mastr): <NEW_LINE> <INDENT> reftype, refname = mastr.split(':') <NEW_LINE> return self.refinder(reftyp... | similar to ReplacePattern, almost have the same interface
you should not set pattern and repl(default one is good enough)
you should pass a function that get text from tuple(reftype, refname) | 62598f8116aa5153ce3fff44 |
class UnitCell(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.name = '' <NEW_LINE> self.a = 0. <NEW_LINE> self.b = 0. <NEW_LINE> self.c = 0. <NEW_LINE> self.alpha = 0. <NEW_LINE> self.beta = 0. <NEW_LINE> self.gamma = 0. <NEW_LINE> self.v = 0. <NEW_LINE> self.DiffLines = [] <NEW_LINE> self.sy... | Class that defines a unit cell properties | 62598f810383005118f6d145 |
class TestMonodomainSolver: <NEW_LINE> <INDENT> def setUp(self) -> None: <NEW_LINE> <INDENT> N = 5 <NEW_LINE> self.mesh = df.UnitCubeMesh(N, N, N) <NEW_LINE> self.time = df.Constant(0.0) <NEW_LINE> self.stimulus = df.Expression("2.0", degree=1) <NEW_LINE> self.M_i = 1.0 <NEW_LINE> self.t0 = 0.0 <NEW_LINE> self.dt = 0.1... | Test functionality for the optimsed monodomain solver. | 62598f81d6c5a102081e1b8b |
class XFRMixin(object): <NEW_LINE> <INDENT> def domain_sync(self, context, domain, servers=None): <NEW_LINE> <INDENT> servers = servers or domain.masters <NEW_LINE> servers = dnsutils.expand_servers(servers) <NEW_LINE> timeout = cfg.CONF["service:mdns"].xfr_timeout <NEW_LINE> try: <NEW_LINE> <INDENT> dnspython_zone = d... | Utility mixin that holds common methods for XFR functionality. | 62598f81711fe17d825e012b |
class GammaFlopLossWithDepthwiseConvTest( tf.test.TestCase, GammaFlopLossWithDepthwiseConvTestBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self._depthwise_use_batchnorm = True <NEW_LINE> super(GammaFlopLossWithDepthwiseConvTest, self).setUp() <NEW_LINE> self.BuildWithBatchNorm() <NEW_LINE> with self.... | Test flop_regularizer for a network with depthwise convolutions. | 62598f8138b623060ffa8ad9 |
class TestAlumnosController(BaseTestCase): <NEW_LINE> <INDENT> def test_borra_alumno(self): <NEW_LINE> <INDENT> response = self.client.open('/profesores/delete-alumno/{dni}'.format(dni=56), method='DELETE') <NEW_LINE> self.assert200(response, "Response body is : " + response.data.decode('utf-8')) <NEW_LINE> <DEDENT> de... | AlumnosController integration test stubs | 62598f81b57a9660fecd14c0 |
class AuthorizationFailed(MPMException): <NEW_LINE> <INDENT> pass | Exception to indicate when authorization via PolicyKit has failed. | 62598f816e29344779b000a6 |
class ProjectsLocationsService(base_api.BaseApiService): <NEW_LINE> <INDENT> _NAME = u'projects_locations' <NEW_LINE> def __init__(self, client): <NEW_LINE> <INDENT> super(CloudfunctionsV1.ProjectsLocationsService, self).__init__(client) <NEW_LINE> self._upload_configs = { } <NEW_LINE> <DEDENT> def List(self, request, ... | Service class for the projects_locations resource. | 62598f8130dc7b766599f29c |
class Grp70No110 (base_tests.SimpleDataPlane): <NEW_LINE> <INDENT> @wireshark_capture <NEW_LINE> def runTest(self): <NEW_LINE> <INDENT> logging=get_logger() <NEW_LINE> logging.info("Running Grp70No110 forward Enqueue test") <NEW_LINE> of_ports=config["port_map"].keys() <NEW_LINE> of_ports.sort() <NEW_LINE> self.assertT... | Cannot test the correctness of the testcase without vendor specs | 62598f81ec188e330fdf82e2 |
class Action: <NEW_LINE> <INDENT> def __init__(self, row): <NEW_LINE> <INDENT> self.user = User.get(row['User_id']) <NEW_LINE> self.merchant = Merchant.get(row['Merchant_id']) <NEW_LINE> self.Date_received = row['Date_received'] <NEW_LINE> self.Date_buy = row['Date'] <NEW_LINE> if row['Date'] is np.nan: <NEW_LINE> <IND... | type 1:无券消费 2:领券消费 3:领券未消费 | 62598f811f037a2d8b9e3b2c |
class ExtendedModelSet(BaseModelSet): <NEW_LINE> <INDENT> def _prepare_filter_attribute(self, attribute): <NEW_LINE> <INDENT> if not hasattr(self, '_attrs'): <NEW_LINE> <INDENT> self._attrs = self._model_class.get_all_attributes() <NEW_LINE> <DEDENT> if not hasattr(self, '_joined_attrs'): <NEW_LINE> <INDENT> self._join... | Base class for extended model set | 62598f81dc8b845886d52ff9 |
class TestInstallApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = xepmts.api.install_api.InstallApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_delete_install_item(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_... | InstallApi unit test stubs | 62598f8126068e7796d4c39f |
class PostType(Enumeration): <NEW_LINE> <INDENT> Question, Answer = range(2) | Denotes the type of a post: a question or an answer. | 62598f811d351010ab8f3581 |
class _KGDTENTRY(obj.CType): <NEW_LINE> <INDENT> @property <NEW_LINE> def Type(self): <NEW_LINE> <INDENT> flag = self.HighWord.Bits.Type.v() & 1 << 4 <NEW_LINE> typeval = self.HighWord.Bits.Type.v() & ~(1 << 4) <NEW_LINE> if flag == 0: <NEW_LINE> <INDENT> typeval += 16 <NEW_LINE> <DEDENT> return GDT_DESCRIPTORS.get(typ... | A class for GDT entries | 62598f81498bea3a75a57567 |
class AudioCodec(Handler): <NEW_LINE> <INDENT> audio_codecs = { 'AC3': 'AC3', 'AC3/BSID9': 'AC3', 'AC3/BSID10': 'AC3', 'BSID9': 'AC3', 'BSID10': 'AC3', '2000': 'AC3', 'EAC3': 'EAC3', 'AC3+': 'EAC3', 'TRUEHD': 'TrueHD', 'ATMOS': 'DolbyAtmos', 'DTS': 'DTS', 'DTS-HD': 'DTS-HD', 'AAC': 'AAC', 'AAC MAIN': 'AAC', 'AAC LC': '... | Audio codec handler. | 62598f81d99f1b3c44d050f1 |
class MAVLink_log_request_list_message(MAVLink_message): <NEW_LINE> <INDENT> def __init__(self, target_system, target_component, start, end): <NEW_LINE> <INDENT> MAVLink_message.__init__(self, MAVLINK_MSG_ID_LOG_REQUEST_LIST, 'LOG_REQUEST_LIST') <NEW_LINE> self._fieldnames = ['target_system', 'target_component', 'start... | Request a list of available logs. On some systems calling this
may stop on-board logging until LOG_REQUEST_END is called. | 62598f81507cdc57c63a47d0 |
class AudioClip(Clip): <NEW_LINE> <INDENT> def __init__(self, make_frame = None, duration=None): <NEW_LINE> <INDENT> Clip.__init__(self) <NEW_LINE> if make_frame is not None: <NEW_LINE> <INDENT> self.make_frame = make_frame <NEW_LINE> frame0 = self.get_frame(0) <NEW_LINE> if hasattr(frame0, '__iter__'): <NEW_LINE> <IND... | Base class for audio clips.
See ``SoundClip`` and ``CompositeSoundClip`` for usable classes.
An AudioClip is a Clip with a ``make_frame`` attribute of
the form `` t -> [ f_t ]`` for mono sound and
``t-> [ f1_t, f2_t ]`` for stereo sound (the arrays are Numpy arrays).
The `f_t` are floats between -1 and 1. These boun... | 62598f81d10714528d69d914 |
class Del(Stmt): <NEW_LINE> <INDENT> targets: ListOf[Expr] <NEW_LINE> def __init__(self, targets, **kwargs): <NEW_LINE> <INDENT> targets = list(targets) <NEW_LINE> super().__init__(targets, **kwargs) <NEW_LINE> if not self.targets: <NEW_LINE> <INDENT> raise ValueError("empty target") <NEW_LINE> <DEDENT> <DEDENT> def to... | Del statement (e.g., del value). | 62598f81b5575c28eb7129e9 |
@ui.register_ui(form_settings=FormSettings(By.ID, 'user_settings_modal')) <NEW_LINE> class PageSettings(PageBase): <NEW_LINE> <INDENT> url = "/settings/" | Settings page. | 62598f81c432627299fa2a13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.