code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class TestBinary(unittest.TestCase): <NEW_LINE> <INDENT> def test_formats(self): <NEW_LINE> <INDENT> self.assertEqual(_PY_BYTES_TYPE, type(Binary.bytes("data"))) <NEW_LINE> self.assertEqual(str, type(Binary.raw_str("data"))) <NEW_LINE> self.assertEqual(str, type(Binary.str("data"))) <NEW_LINE> self.assertEqual(_PY_UNIC... | UnitTest for Binary
:since: v1.0.0
| 62598f690383005118f6ce4a |
class Material(): <NEW_LINE> <INDENT> pass | A list of materials that can be ordered.
This should cover raw materials and machine consumables | 62598f69796e427e5384ded3 |
class TimelineSerializer(serializers.HyperlinkedModelSerializer): <NEW_LINE> <INDENT> candidate_tag = serializers.StringRelatedField(many=True, read_only=True) <NEW_LINE> timestamp = serializers.SerializerMethodField() <NEW_LINE> def get_timestamp(self, obj): <NEW_LINE> <INDENT> return unicode(obj.timestamp) <NEW_LINE>... | Timeline deserializer | 62598f691d351010ab8f3281 |
class WrongAuthorError(BaseException): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> self.message = message | Raised when attribute is added to wrong author | 62598f69711fe17d825dfe29 |
class IOLoopKernelRestarter(KernelRestarter): <NEW_LINE> <INDENT> loop = Instance("tornado.ioloop.IOLoop") <NEW_LINE> def _loop_default(self): <NEW_LINE> <INDENT> warnings.warn( "IOLoopKernelRestarter.loop is deprecated in jupyter-client 5.2", DeprecationWarning, stacklevel=4, ) <NEW_LINE> return ioloop.IOLoop.current(... | Monitor and autorestart a kernel. | 62598f696fece00bbaccb0d1 |
class Tail(base.Command): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> job_utils.ArgsForJobRef(parser) <NEW_LINE> parser.add_argument( '--changed-after', type=time_util.ParseTimeArg, help='Only display metrics that have changed after the given time') <NEW_LINE> parser.add_argument(... | Retrieves the metrics from a specific job.
| 62598f699b70327d1c57e4e9 |
class SurveyAdmin(TranslatableAdmin): <NEW_LINE> <INDENT> list_display = ['get_title', 'slug'] <NEW_LINE> def get_title(self, obj): <NEW_LINE> <INDENT> return obj.__unicode__() <NEW_LINE> <DEDENT> get_title.short_description = _('Title') | Custom admin for the ``Survey`` model. | 62598f696aa9bd52df0d4611 |
class LoginCreate(graphene.relay.ClientIDMutation): <NEW_LINE> <INDENT> user = graphene.Field(UserNode) <NEW_LINE> class Input: <NEW_LINE> <INDENT> username = graphene.String( description='Login name', required=True, ) <NEW_LINE> email = graphene.String( description='Email', required=True, ) <NEW_LINE> password = graph... | Cria um login. | 62598f6950485f2cf55da6ae |
class TestSet(object): <NEW_LINE> <INDENT> def __init__(self, min_score=1.0): <NEW_LINE> <INDENT> self.min_score = min_score <NEW_LINE> self.test_cases = [] <NEW_LINE> self.__closed_tests = [] <NEW_LINE> <DEDENT> def __getitem__(self, item): <NEW_LINE> <INDENT> return self.test_cases[item] <NEW_LINE> <DEDENT> def __ite... | TestSet. | 62598f6973bcbd0ca4bc9994 |
class EmailSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = ['id', 'email'] <NEW_LINE> extra_kwargs = { 'email': { 'required': True } } <NEW_LINE> <DEDENT> def update(self, instance, validated_data): <NEW_LINE> <INDENT> instance.email = valida... | 更新邮箱序列化器 | 62598f6938b623060ffa87dc |
class CreateVirtualMFADeviceResultSet(ResultSet): <NEW_LINE> <INDENT> def getJSONFromString(self, str): <NEW_LINE> <INDENT> return json.loads(str) <NEW_LINE> <DEDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | A ResultSet with methods tailored to the values returned by the CreateVirtualMFADevice Choreo.
The ResultSet object is used to retrieve the results of a Choreo execution. | 62598f698c3a8732951f5c90 |
class NewListFormTest(unittest.TestCase): <NEW_LINE> <INDENT> @patch('lists.forms.List.create_new') <NEW_LINE> def test_save_creates_new_list_from_post_data_if_user_not_authenticated( self, mock_List_create_new ): <NEW_LINE> <INDENT> user = Mock(is_authenticated=False) <NEW_LINE> form = NewListForm(data={'text': 'new i... | test new list form | 62598f690383005118f6ce4c |
class myclass: <NEW_LINE> <INDENT> def __init__(self, pa): <NEW_LINE> <INDENT> self.pa = pa <NEW_LINE> <DEDENT> def get_value(self, mul): <NEW_LINE> <INDENT> return self.pa * mul | This is the documentation for this class.
@example(an example of use)
Just for documentation purpose.
@code
m = myclass(0)
@endcode
@endexample
@FAQ(How to add a question ?)
Just look a this section.
@endFAQ
An accent, é, to check it is working. | 62598f691f037a2d8b9e3830 |
class Z_TransformerDecoderLayer(nn.Module): <NEW_LINE> <INDENT> def __init__(self, d_model, heads, d_ff, dropout): <NEW_LINE> <INDENT> super(Z_TransformerDecoderLayer, self).__init__() <NEW_LINE> self.self_attn = MultiHeadedAttention( heads, d_model, dropout=dropout) <NEW_LINE> self.z_context_attn = MultiHeadedAttentio... | Args:
d_model (int): the dimension of keys/values/queries in
MultiHeadedAttention, also the input size of
the first-layer of the PositionwiseFeedForward.
heads (int): the number of heads for MultiHeadedAttention.
d_ff (int): the second-layer of the PositionwiseFeedForward.
... | 62598f69d18da76e235b6cd6 |
class FiniteGroups(CategoryWithAxiom): <NEW_LINE> <INDENT> def example(self): <NEW_LINE> <INDENT> from sage.groups.matrix_gps.linear import GL <NEW_LINE> return GL(2,3) <NEW_LINE> <DEDENT> class ParentMethods: <NEW_LINE> <INDENT> def semigroup_generators(self): <NEW_LINE> <INDENT> return self.group_generators() <NEW_LI... | The category of finite (multiplicative) groups.
EXAMPLES::
sage: C = FiniteGroups(); C
Category of finite groups
sage: C.super_categories()
[Category of finite monoids, Category of groups]
sage: C.example()
General Linear Group of degree 2 over Finite Field of size 3
TESTS::
sage: TestSu... | 62598f69d99f1b3c44d04df4 |
class Profile(DatedModel, ActiveModel, MessageModel): <NEW_LINE> <INDENT> user = models.OneToOneField(User, related_name="forum_profile", primary_key=True) <NEW_LINE> nickname = models.SlugField(max_length=50, unique=True, null=False) <NEW_LINE> gender = models.CharField(max_length=1, choices=GENDER_CHOICES, default=GE... | Forum user profile | 62598f695166f23b2e242b1c |
class AddRequireAndIgnoreWords(ConvertIndexerToInteger): <NEW_LINE> <INDENT> def test(self): <NEW_LINE> <INDENT> return self.checkDBVersion() >= 29 <NEW_LINE> <DEDENT> def execute(self, **kwargs): <NEW_LINE> <INDENT> self.backup(29) <NEW_LINE> sickrage.LOGGER.info("Adding column rls_require_words to tvshows") <NEW_LINE... | Adding column rls_require_words and rls_ignore_words to tv_shows | 62598f698e05c05ec3f6e9e6 |
@attr.s <NEW_LINE> class Route(object): <NEW_LINE> <INDENT> url = attr.ib(type=str) <NEW_LINE> resource = attr.ib(type=str) <NEW_LINE> route_params = attr.ib(type=str) <NEW_LINE> actions = attr.ib(type=List[int]) <NEW_LINE> _res_cls = attr.ib(type=type, default=None) <NEW_LINE> @classmethod <NEW_LINE> def load(cls, url... | Represents a single API route.
A route is just a mapping of URL to resource that handles it. Each route
will generate multiple URLs handled as each resource can handle generic and
detail REST operation as well as all actions defined on the resource. | 62598f69d6c5a102081e1885 |
class UnsupportedField(Exception): <NEW_LINE> <INDENT> pass | Exception thrown when trying to process an unsupported field in
subject or issuer DN. | 62598f69a4f1c619b294dd37 |
class AccountSettingsView(LoginRequiredMixin, FormView): <NEW_LINE> <INDENT> template_name = 'gardenhub/account_settings.html' <NEW_LINE> form_class = AccountSettingsForm <NEW_LINE> success_url = reverse_lazy('account-settings') <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> user = self.request.user <NEW_LI... | Account settings screen for the logged-in user. | 62598f6950485f2cf55da6b0 |
class Hand(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.cards = [] <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if(self.cards): <NEW_LINE> <INDENT> rep = "" <NEW_LINE> for card in self.cards: <NEW_LINE> <INDENT> rep += str(card) + "\t" <NEW_LINE> <DEDENT> <DEDENT> else: <NEW_LINE> <... | A playing card. | 62598f690383005118f6ce4e |
class Span: <NEW_LINE> <INDENT> def __init__(self, over, start=None, end=None): <NEW_LINE> <INDENT> offset = 0 <NEW_LINE> self.__over = over <NEW_LINE> if isinstance(over, Span): <NEW_LINE> <INDENT> self.__over = over.__over <NEW_LINE> offset = over.__slice.start <NEW_LINE> <DEDENT> over_ln = len(self.__over) <NEW_LINE... | Provides access over a list via reference rather than re-allocation.
This object will act like a standard list that has been spliced (meaning functions
like 'len' will work correctly), however it will not cause any re-allocations beyond
the Span object itself (the list doesn't actually change, just the referencing of
i... | 62598f69a8ecb03325870948 |
class BPL(HCS08_Simple_Branch): <NEW_LINE> <INDENT> mnemonics = ['bpl'] <NEW_LINE> machine_codes = { 'rel': [0x2A] } <NEW_LINE> @classmethod <NEW_LINE> def predicate(cls, cpu): <NEW_LINE> <INDENT> return not cpu.N | BPL (Branch of IRQ Pin Low) | 62598f6926238365f5fac2b8 |
class Component3DCavity(ComponentCavity, Sea.model.components.Component3DCavity.Component3DCavity): <NEW_LINE> <INDENT> name = "Cavity 3D" <NEW_LINE> description = "A component describing a three-dimensional cavity." <NEW_LINE> def __init__(self, obj, system, material, position): <NEW_LINE> <INDENT> ComponentCavity.__i... | 3D cavity component. | 62598f69711fe17d825dfe2d |
class Pin(BasicPin): <NEW_LINE> <INDENT> def __init__(self, gpio, direction, pud=_GPIO.PUD_OFF): <NEW_LINE> <INDENT> super(Pin, self).__init__(gpio, direction) <NEW_LINE> if self.direction.lower() == 'in': <NEW_LINE> <INDENT> direction = _GPIO.IN <NEW_LINE> <DEDENT> elif self.direction.lower() == 'out': <NEW_LINE> <IND... | Docstring for Pin. | 62598f691d351010ab8f3286 |
class BarcodeMap(dict): <NEW_LINE> <INDENT> def __init__(self, mapfile): <NEW_LINE> <INDENT> self.name = "mapfile_%s" % mapfile <NEW_LINE> try: <NEW_LINE> <INDENT> handle = open(mapfile, "U") <NEW_LINE> <DEDENT> except IOError: <NEW_LINE> <INDENT> raise EnrichError("Could not open barcode map file '%s'" ... | Dictionary-derived class for storing the relationship between barcodes
and variants. Requires the path to a *mapfile*, containing lines in the
format ``'barcode<tab>variant'`` for each barcode expected in the library.
Also creates a second dictionary, ``BarcodeMap.variants``, storing a list
of barcodes assigned to ... | 62598f696e29344779affd9e |
class CT_Hyperlink(BaseOxmlElement): <NEW_LINE> <INDENT> rId = OptionalAttribute("r:id", XsdString) <NEW_LINE> action = OptionalAttribute("action", XsdString) <NEW_LINE> @property <NEW_LINE> def action_fields(self): <NEW_LINE> <INDENT> url = self.action <NEW_LINE> if url is None: <NEW_LINE> <INDENT> return {} <NEW_LINE... | Custom element class for <a:hlinkClick> elements. | 62598f69d164cc61758206be |
class UserList(APIView): <NEW_LINE> <INDENT> def get(self, request, format=None): <NEW_LINE> <INDENT> users = Campaign.objects.all() <NEW_LINE> serializer = CampaignSerializer(users, many=True) <NEW_LINE> return Response(serializer.data) <NEW_LINE> <DEDENT> def post(self, request, format=None): <NEW_LINE> <INDENT> seri... | List all campaign, or create a new campaign.
# | 62598f69711fe17d825dfe2e |
class ModuleDependency(object): <NEW_LINE> <INDENT> def __init__(self, othermodule): <NEW_LINE> <INDENT> self._othermodule = othermodule <NEW_LINE> self._includedfiles = [] <NEW_LINE> self._cyclesuppression = None <NEW_LINE> self._is_test_only_dependency = True <NEW_LINE> self.suppression_used = True <NEW_LINE> <DEDENT... | Dependency between modules. | 62598f6976d4e153a661c35c |
class PulpCookbookPluginAppConfig(PulpPluginAppConfig): <NEW_LINE> <INDENT> name = "pulp_cookbook.app" <NEW_LINE> label = "cookbook" | Entry point for pulp_cookbook plugin. | 62598f69d10714528d69d610 |
class AuthorDetailView(generic.DetailView): <NEW_LINE> <INDENT> model = Author | Used for showing an author detail | 62598f6938b623060ffa87df |
class Heap: <NEW_LINE> <INDENT> def __init__(self, parent=None, initialState=None, reserved=[], removeAction=None): <NEW_LINE> <INDENT> self.parent = parent <NEW_LINE> self.initialState = initialState if initialState != None else {} <NEW_LINE> self.reserved = list(reserved) <NEW_LINE> self.heap = copy(self.initialState... | The heap is the used by the calculator for long term storage. It contains a
set of named values. | 62598f69287bf620b6271302 |
class Sender(BaseSender): <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> BaseSender.__init__(self, url) <NEW_LINE> self.connection = Connection(url) <NEW_LINE> <DEDENT> def is_open(self): <NEW_LINE> <INDENT> return self.connection.is_open() <NEW_LINE> <DEDENT> @reliable <NEW_LINE> def open(self): <NEW... | An AMQP message sender.
:ivar connection: A proton connection.
:type connection: Connection | 62598f6930c21e258be97f44 |
class HelpInterfacePage(ConfigurationPageBase, Ui_HelpInterfacePage): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(HelpInterfacePage, self).__init__() <NEW_LINE> self.setupUi(self) <NEW_LINE> self.setObjectName("InterfacePage") <NEW_LINE> self.styleSheetButton.setIcon(UI.PixmapCache.getIcon("open.p... | Class implementing the Interface configuration page (variant for web
browser). | 62598f6926238365f5fac2ba |
class CoinType(DjangoObjectType): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Coin | The coin GraphQL type | 62598f693eb6a72ae0389d87 |
class cidict(dict): <NEW_LINE> <INDENT> def __init__(self, mapping=None, **kwargs): <NEW_LINE> <INDENT> super(cidict, self).__init__() <NEW_LINE> if mapping: <NEW_LINE> <INDENT> self.update(mapping) <NEW_LINE> <DEDENT> if kwargs: <NEW_LINE> <INDENT> self.update(kwargs) <NEW_LINE> <DEDENT> <DEDENT> def __delitem__(self,... | Case insensitive dictionary.
| 62598f6915fb5d323ce7e46a |
class MetaPacket(type): <NEW_LINE> <INDENT> cmds = dict() <NEW_LINE> @classmethod <NEW_LINE> def __prepare__(cls, name, bases): <NEW_LINE> <INDENT> return OrderedDict() <NEW_LINE> <DEDENT> def __init__(cls, name, bases, dct): <NEW_LINE> <INDENT> if cls.__name__ != 'Packet': <NEW_LINE> <INDENT> type.__init__(cls, name, ... | Register commands.
Checks for compliance with the order of the fields and
the lack of a required field. | 62598f6956b00c62f0fb1ffb |
class HieroGetExtraPublishData(Hook): <NEW_LINE> <INDENT> def execute(self, task, **kwargs): <NEW_LINE> <INDENT> return None | Get a data dictionary for a PublishedFile to be updated in Shotgun. | 62598f69ac7a0e7691f71c59 |
class PathTiler: <NEW_LINE> <INDENT> def __init__(self, drawing): <NEW_LINE> <INDENT> self.drawing = drawing <NEW_LINE> self.pc = PathCanvas() <NEW_LINE> <DEDENT> @property <NEW_LINE> def paths(self): <NEW_LINE> <INDENT> return self.pc.paths <NEW_LINE> <DEDENT> def p1_points(self, vcol, vrow): <NEW_LINE> <INDENT> s2par... | Apply kaleidoscopic symmetries to drawing functions. | 62598f6921bff66bcd7223a4 |
class Coffee(NameModel): <NEW_LINE> <INDENT> project = models.ForeignKey(Project, blank=True, null=True) <NEW_LINE> user = models.ForeignKey(User) <NEW_LINE> cups = models.IntegerField(default=1) | A single Coffee Entry by a user in a project.
Author: Aly Yakan | 62598f69be8e80087fbbe7a3 |
class Constraint(NamedObject): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self, name=None): <NEW_LINE> <INDENT> NamedObject.__init__(self, name) <NEW_LINE> self._is_enabled = True <NEW_LINE> self._force = zeros(0) <NEW_LINE> self._child_obj_to_reg = [] <NEW_LINE> <DEDENT> def is_enabled(self): ... | A generic class for kinematic constraint.
As a joint, it represents a kinematic restriction of the allowed relative
twist of two frames. But here, this restriction is not directly taken into
account in the model, but it is defined through a force. It generally
represents kinematic closure that are not modeled by tree-... | 62598f698c3a8732951f5c96 |
class LeNet(nn.Layer): <NEW_LINE> <INDENT> def __init__(self, num_classes=10): <NEW_LINE> <INDENT> super(LeNet, self).__init__() <NEW_LINE> self.num_classes = num_classes <NEW_LINE> self.features = nn.Sequential( nn.Conv2D( 1, 6, 3, stride=1, padding=1), nn.ReLU(), nn.MaxPool2D(2, 2), nn.Conv2D( 6, 16, 5, stride=1, pad... | LeNet model from
`"LeCun Y, Bottou L, Bengio Y, et al. Gradient-based learning applied to document recognition[J]. Proceedings of the IEEE, 1998, 86(11): 2278-2324.`_
Args:
num_classes (int): output dim of last fc layer. If num_classes <=0, last fc layer
will not be defined. Default: 10.
... | 62598f69796e427e5384dedb |
class PushButtonWrapper(ParamWrapper): <NEW_LINE> <INDENT> def __init__(self, param): <NEW_LINE> <INDENT> ParamWrapper.__init__(self, param) <NEW_LINE> <DEDENT> def getName(self): <NEW_LINE> <INDENT> return self._param.getName() <NEW_LINE> <DEDENT> def getEnabled(self): <NEW_LINE> <INDENT> return self._param.getEnabled... | GUI class, which maps a ParamPushButton. | 62598f69d18da76e235b6cd9 |
class Conv(torch.nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, padding=0, dilation=1, bias=True, w_init='linear'): <NEW_LINE> <INDENT> super(Conv, self).__init__() <NEW_LINE> self.conv = torch.nn.Conv1d(in_channels, out_channels, kernel_size=kernel_size, stride=s... | Convolution Module | 62598f69d164cc61758206c1 |
class LineItemView(TemplateView): <NEW_LINE> <INDENT> def get(self, request): <NEW_LINE> <INDENT> self.current_customer = Customer.objects.get(user=request.user.pk) <NEW_LINE> self.current_order = CustomerOrder.objects.get(customer=self.current_customer.pk) <NEW_LINE> all_line_items = self.current_order.line_items.all(... | Purpose: Return the line item in the customer's order, Post a line item
Methods: get - returns a dictionary containing lists
post - creates a new line order, if the order does not exsist, create the order first.
Authors: Abby, Sam | 62598f696fece00bbaccb0d6 |
class Window(): <NEW_LINE> <INDENT> def __init__(self, class_title=None, window_title=None, application=None): <NEW_LINE> <INDENT> self.searching_class_title = class_title <NEW_LINE> self.searching_window_title = window_title <NEW_LINE> self.searching_application = application <NEW_LINE> self.prop = {} <NEW_LINE> self.... | this is Window class. A window object has its name,its hwnd,its class name. | 62598f69a4f1c619b294dd3c |
class OrAndOp(NaryOp, _Clause, _DNF, _CNF): <NEW_LINE> <INDENT> @cached_property <NEW_LINE> def _lits(self): <NEW_LINE> <INDENT> return frozenset(self.xs) <NEW_LINE> <DEDENT> def _encode_clause(self, litmap): <NEW_LINE> <INDENT> return frozenset(litmap[x] for x in self.xs) | Either an OR or AND operator (a lattice op) | 62598f69711fe17d825dfe32 |
class Scorer(QtCore.QObject): <NEW_LINE> <INDENT> def __init__(self, simulation): <NEW_LINE> <INDENT> super().__init__(simulation) <NEW_LINE> self.simulation = simulation <NEW_LINE> self._score = 0 <NEW_LINE> <DEDENT> scoreChanged = QtCore.pyqtSignal(int) <NEW_LINE> @property <NEW_LINE> def score(self): <NEW_LINE> <IND... | A scorer calculates the score of the player during the simulation. | 62598f6915baa723494616cf |
class ShadowSelector(CoClass): <NEW_LINE> <INDENT> _reg_clsid_ = GUID('{00205997-7B00-4D5C-9330-B795CD5BD8BD}') <NEW_LINE> _idlflags_ = [] <NEW_LINE> _typelib_path_ = typelib_path <NEW_LINE> _reg_typelib_ = ('{D92377DC-FAB1-4DFB-A4C1-61BD8C40DBEB}', 10, 2) | Shadow style selector. | 62598f6930c21e258be97f48 |
class CancelOrStopIntentHandler(AbstractRequestHandler): <NEW_LINE> <INDENT> def can_handle(self, handler_input): <NEW_LINE> <INDENT> return (ask_utils.is_intent_name("AMAZON.CancelIntent")(handler_input) or ask_utils.is_intent_name("AMAZON.StopIntent")(handler_input)) <NEW_LINE> <DEDENT> def handle(self, handler_input... | Single handler for Cancel and Stop Intent. | 62598f691f037a2d8b9e3838 |
class Adafruit_STMPE610_SPI(Adafruit_STMPE610): <NEW_LINE> <INDENT> def __init__(self, spi, cs, baudrate=1000000): <NEW_LINE> <INDENT> import adafruit_bus_device.spi_device as spidev <NEW_LINE> self._spi = spidev.SPIDevice(spi, cs, baudrate=baudrate) <NEW_LINE> version = self.get_version <NEW_LINE> if _STMPE_VERSION !=... | SPI driver for the STMPE610 Resistive Touch sensor. | 62598f69d164cc61758206c3 |
class Route(object): <NEW_LINE> <INDENT> handlers=[]; <NEW_LINE> @classmethod <NEW_LINE> def distribute_request(self,http_req_handler): <NEW_LINE> <INDENT> path = urlparse(http_req_handler.path).path <NEW_LINE> handled = False <NEW_LINE> if C('enable_proxy') and utils.isDict(C('proxy')): <NEW_LINE> <INDENT> for reg,tar... | 路由器 | 62598f693eb6a72ae0389d8b |
class PixelShuffle(Module): <NEW_LINE> <INDENT> def __init__(self, upscale_factor): <NEW_LINE> <INDENT> super(PixelShuffle, self).__init__() <NEW_LINE> self.upscale_factor = upscale_factor <NEW_LINE> <DEDENT> def forward(self, input): <NEW_LINE> <INDENT> return F.pixel_shuffle(input, self.upscale_factor) <NEW_LINE> <DE... | Rearranges elements in a Tensor of shape :math:`(*, r^2C, H, W)` to a
tensor of shape :math:`(C, rH, rW)`.
This is useful for implementing efficient sub-pixel convolution
with a stride of :math:`1/r`.
Look at the paper:
`Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neur... | 62598f6956b00c62f0fb1fff |
class Directory(BackupTarget): <NEW_LINE> <INDENT> backup_dir = None <NEW_LINE> remove_old_files = True <NEW_LINE> def __init__(self, backup_dir): <NEW_LINE> <INDENT> self.backup_dir = backup_dir <NEW_LINE> return super(Directory, self).__init__() <NEW_LINE> <DEDENT> def snapshot(self): <NEW_LINE> <INDENT> logging.info... | File directory backup target | 62598f697b25080760ed6be4 |
class ProfileSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Profile <NEW_LINE> fields = ['location', 'phone'] | profile serilizers. | 62598f696aa9bd52df0d461b |
class WickelFeatureTransformer(WickelTransformer): <NEW_LINE> <INDENT> def __init__(self, n, num_units, field=None, use_padding=True, proportion=.38): <NEW_LINE> <INDENT> super().__init__(n, field, use_padding) <NEW_LINE> self.num_units = num_units <NEW_LINE> assert .0 < proportion < 1.0 <NEW_LINE> self.proportion = pr... | A transformer for WickelFeatures.
This transformer behaves more or less the same as the WickelTransformer,
above, but has 2 advantages: first, it assigns a higher similarity to
ngrams which have more overlap. Second, it usually leads to spaces with
smaller dimensionalities.
Parameters
----------
n : int
The value... | 62598f69c432627299fa271e |
class InteractivityExercise(models.Model): <NEW_LINE> <INDENT> interactivity = models.ForeignKey(Interactivity, related_name="exercises"); <NEW_LINE> name = models.CharField(max_length=255, unique=True) <NEW_LINE> content = models.TextField() <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return s... | Specifies any initial information needed to start the superactivity, e.g., the instructions. | 62598f6915baa723494616d1 |
class Perfil(ModeloDenunciable, ModeloCongelable, models.Model): <NEW_LINE> <INDENT> usuario = models.OneToOneField(settings.AUTH_USER_MODEL, related_name='perfil') <NEW_LINE> nombre = models.CharField(max_length=100, unique=True) <NEW_LINE> objects = InheritanceManager() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_t... | Perfil genérico de un usuario (asegura que solo pueda tener un perfil -Estudiante, Profesor, etc.) | 62598f6950485f2cf55da6b9 |
class EntryContainer(list): <NEW_LINE> <INDENT> def __init__(self, iterable: list = None): <NEW_LINE> <INDENT> list.__init__(self, iterable or []) <NEW_LINE> self._entries = EntryIterator(self, [EntryState.UNDECIDED, EntryState.ACCEPTED]) <NEW_LINE> self._accepted = EntryIterator( self, EntryState.ACCEPTED ) <NEW_LINE>... | Container for a list of entries, also contains accepted, rejected failed iterators over them. | 62598f6921bff66bcd7223aa |
class CallbackModule(CallbackBase): <NEW_LINE> <INDENT> CALLBACK_VERSION = 2.0 <NEW_LINE> CALLBACK_TYPE = 'notification' <NEW_LINE> CALLBACK_NAME = 'log_plays' <NEW_LINE> CALLBACK_NEEDS_WHITELIST = True <NEW_LINE> TIME_FORMAT = "%b %d %Y %H:%M:%S" <NEW_LINE> MSG_FORMAT = "%(now)s - %(category)s - %(data)s\n\n" <NEW_LIN... | logs playbook results, per host, in /var/log/ansible/hosts | 62598f6950485f2cf55da6ba |
class BackendMethodExport(object): <NEW_LINE> <INDENT> swagger_types = { 'api_id': 'str', 'api_method_id': 'str', 'op': 'str' } <NEW_LINE> attribute_map = { 'api_id': 'apiId', 'api_method_id': 'apiMethodId', 'op': 'op' } <NEW_LINE> def __init__(self, api_id=None, api_method_id=None, op=None): <NEW_LINE> <INDENT> self._... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f6915baa723494616d3 |
class SocketServerPostProcessor(PostProcessorBase): <NEW_LINE> <INDENT> port = int() <NEW_LINE> sock = None <NEW_LINE> async def setup(self, component_config_root: ElementTree.Element): <NEW_LINE> <INDENT> self.port = int(component_config_root.find("Port").text) <NEW_LINE> self.sock = socket.socket(socket.AF_INET, sock... | Outputs data to clients as a TCP server.
Configuration info:
- `Port`: The port number of the TCP server. This must follow the port usage rules specified by the FRC Game
Manual. A port number in the range 5800-5810 is recommended. | 62598f69d18da76e235b6cdc |
class ServiceWrapper(VariadicRecordWrapper): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ServiceWrapper, self).__init__(*args, **kwargs) <NEW_LINE> T = ServiceType <NEW_LINE> self._type_cls = T <NEW_LINE> _dc = {T.parse("compose", parsed_result_is_data=True): DockerComposeService}... | Service :: Wrapper | 62598f6926238365f5fac2c2 |
class RSAUser(): <NEW_LINE> <INDENT> keylen = 2048 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> global PYCRYPTO_INSTALLED <NEW_LINE> if not PYCRYPTO_INSTALLED: <NEW_LINE> <INDENT> raise ImportError('Module Pycrypto not installed.') <NEW_LINE> <DEDENT> self.__pubkey = None <NEW_LINE> self.__privkey = None <NEW_LIN... | Create an RSA user. | 62598f691d351010ab8f328f |
class TestUser(BaseCase): <NEW_LINE> <INDENT> def test_create_user(self): <NEW_LINE> <INDENT> response = self.client.post( '/api/v1/users/signup', data=self.user_data_1) <NEW_LINE> self.assertEqual(201, response.status_code) <NEW_LINE> expected = {'message': 'User registration successful'} <NEW_LINE> self.assertEqual(e... | User resource tests. | 62598f690a366e3fb87dc111 |
class Form(Element): <NEW_LINE> <INDENT> def __init__(self, form: str, form_id: int = 0) -> None: <NEW_LINE> <INDENT> Element.__init__(self, form, attrib={"form_id": str(form_id)}) <NEW_LINE> <DEDENT> def __truediv__(self, pos_tag: str) -> "Form": <NEW_LINE> <INDENT> self.set("pos", pos_tag) <NEW_LINE> return self <NEW... | For the word (ie, node) of a dependency tree and its attributes. Inherits
from the ``Element`` class of Python's ``xml.etree`` library.
>>> desc_form = Form('described')
>>> desc_form
described_0
>>> desc_form.set('Tense', 'Past')
>>> desc_form
described_0
>>> desc_form / 'VBN'
described_0/VBN
>>> desc_form.full_str()... | 62598f69d99f1b3c44d04e00 |
class ExceptionInfo: <NEW_LINE> <INDENT> value: Exception <NEW_LINE> type: type <NEW_LINE> freezeyt_task: object | Mimics pytest's ExceptionInfo class | 62598f69a4f1c619b294dd42 |
class Directory: <NEW_LINE> <INDENT> SHARED_SCRATCH = _DirectoryType.SHARED_SCRATCH <NEW_LINE> SHARED_STORAGE = _DirectoryType.SHARED_STORAGE <NEW_LINE> LOCAL_SCRATCH = _DirectoryType.LOCAL_SCRATCH <NEW_LINE> LOCAL_STORAGE = _DirectoryType.LOCAL_STORAGE <NEW_LINE> def __init__( self, directory_type: _DirectoryType, pat... | Information about filesystems Pegasus can use for storing temporary and long-term
files. | 62598f69d164cc61758206c8 |
class GridWorldState(): <NEW_LINE> <INDENT> def __init__(self, x, y, data): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def peek(self, action, boundary_result="nothing"): <NEW_LINE> <INDENT> x, y = self.x, self.y <NEW_LINE> if action == "N": <NEW_LINE> <INDENT> y... | Container class for a grid world state | 62598f697b25080760ed6be7 |
class IfteststatusEnum(Enum): <NEW_LINE> <INDENT> notInUse = 1 <NEW_LINE> inUse = 2 <NEW_LINE> @staticmethod <NEW_LINE> def _meta_info(): <NEW_LINE> <INDENT> from ydk.models.cisco_ios_xe._meta import _IF_MIB as meta <NEW_LINE> return meta._meta_table['IfMib.Iftable.Ifentry.IfteststatusEnum'] | IfteststatusEnum
This object indicates whether or not some manager currently
has the necessary 'ownership' required to invoke a test on
this interface. A write to this object is only successful
when it changes its value from 'notInUse(1)' to 'inUse(2)'.
After completion of a test, the agent resets the value back
... | 62598f69ac7a0e7691f71c61 |
class AsyncFIFOBuffered(Module, _FIFOInterface): <NEW_LINE> <INDENT> def __init__(self, width, depth): <NEW_LINE> <INDENT> _FIFOInterface.__init__(self, width, depth) <NEW_LINE> self.submodules.fifo = fifo = AsyncFIFO(width, depth) <NEW_LINE> self.writable = fifo.writable <NEW_LINE> self.din = fifo.din <NEW_LINE> self.... | Improves timing when it breaks due to sluggish clock-to-output
delay in e.g. Xilinx block RAMs. Increases latency by one cycle. | 62598f69be8e80087fbbe7ab |
class AuthenticationBackend(backends.ModelBackend): <NEW_LINE> <INDENT> def authenticate(self, request, email=None, username=None, password=None, **kwargs): <NEW_LINE> <INDENT> usermodel = get_user_model() <NEW_LINE> try: <NEW_LINE> <INDENT> user = usermodel.objects.get( Q(username__iexact=email) | Q(email__iexact=emai... | Custom authentication Backend for login using email as user_id field. | 62598f6915baa723494616d5 |
class Alien(Sprite): <NEW_LINE> <INDENT> def __init__(self, ai_game): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.screen = ai_game.screen <NEW_LINE> self.settings = ai_game.settings <NEW_LINE> self.image = pygame.image.load('images/alien.jpg') <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect... | Klasa przedstawiajaca pojedynczego obcego we flocie. | 62598f69bf627c535bcb0bce |
class PodcastCreate(AudioBase): <NEW_LINE> <INDENT> host: str <NEW_LINE> participants: Optional[List[str]] = None <NEW_LINE> @validator('participants') <NEW_LINE> def participants_validator(cls, participants): <NEW_LINE> <INDENT> if participants: <NEW_LINE> <INDENT> if len(participants) > 20: <NEW_LINE> <INDENT> raise ... | Base pydantic schema class for PodcastCreate | 62598f6926238365f5fac2c4 |
class SimpleReadingConverterAdaptor(object): <NEW_LINE> <INDENT> def __init__(self, converterInst, fromReading, toReading): <NEW_LINE> <INDENT> self.converterInst = converterInst <NEW_LINE> self.fromReading = fromReading <NEW_LINE> self.toReading = toReading <NEW_LINE> self.CONVERSION_DIRECTIONS = [(fromReading, toRead... | Defines a simple converter between two *character readings* that keeps
the real converter doing the work in the background.
The basic method is
:meth:`~cjklib.reading.ReadingFactory.SimpleReadingConverterAdaptor.convert`
which converts one input string from
one reading to another. In contrast to a
:class:`~cjklib.read... | 62598f69711fe17d825dfe39 |
class Greeting(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> phone = db.Column(db.String, unique=True) <NEW_LINE> track_id = db.Column(db.Integer, db.ForeignKey('track.id')) <NEW_LINE> track = db.relationship( 'Track', backref=db.backref('greetings', lazy='dynamic') ) <NEW_LINE>... | Greeting model. | 62598f698e05c05ec3f6e9ed |
class ClassResourceInfo(ResourceInfo): <NEW_LINE> <INDENT> description = 'Plugin' <NEW_LINE> __slots__ = tuple() <NEW_LINE> def get_class(self, files=None): <NEW_LINE> <INDENT> return self.value | Store the mapping of resource name to python class implementation. | 62598f69ff9c53063f519da5 |
class LogLevel(_Enum): <NEW_LINE> <INDENT> _enum_names_ = { 0: 'DEBUG', 2: 'NOTICE', 3: 'WARNING', 4: 'ERROR', } | Logging messages level.
ote future libvlc versions may define new levels.
| 62598f69ac7a0e7691f71c63 |
class DirectoryPluginManager(BasePluginManager): <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.main_module = 'foo' <NEW_LINE> <DEDENT> def initialize(self, plugin_root: str) -> None: <NEW_LINE> <INDENT> super().initialize(plugin_root) <NEW_LINE> self.main_module ... | A simple plugin manager where plugins are `directories` found in a root plugin directory. | 62598f6950485f2cf55da6be |
class Serial(object): <NEW_LINE> <INDENT> def __init__(self, opts): <NEW_LINE> <INDENT> if isinstance(opts, dict): <NEW_LINE> <INDENT> self.serial = opts.get('serial', 'msgpack') <NEW_LINE> <DEDENT> elif isinstance(opts, str): <NEW_LINE> <INDENT> self.serial = opts <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.ser... | Create a serialization object, this object manages all message
serialization in Salt | 62598f6976d4e153a661c368 |
class NullHandler(logging.Handler): <NEW_LINE> <INDENT> def emit(self, record): <NEW_LINE> <INDENT> pass | for when there is no logging | 62598f69bf627c535bcb0bd1 |
class UnitTest_OpenSSL(unittest.TestCase, _Mixin_filedata): <NEW_LINE> <INDENT> def test_modulus_PrivateKey(self): <NEW_LINE> <INDENT> for pkey_set_id, set_data in sorted(TEST_FILES["PrivateKey"].items()): <NEW_LINE> <INDENT> key_pem_filepath = self._filepath_testfile(set_data["file"]) <NEW_LINE> key_pem = self._fileda... | python -m unittest tests.test_unit.UnitTest_OpenSSL | 62598f690a366e3fb87dc115 |
class BlockDevice(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> for k, v in data.items(): <NEW_LINE> <INDENT> k = re.sub(r'[-:\.]', "_", k) <NEW_LINE> setattr(self, k, v) <NEW_LINE> setattr(self, k.lower(), v) <NEW_LINE> <DEDENT> <DEDENT> def __contains__(self, i... | Class to contain one line of ``lsblk`` command information.
Contains all of the fields for a single line of ``lsblk`` output.
Computed values are the column names except where the column
name is an invalid variable name in Python such as `MAJ:MIN`.
The ``get`` method is provided to access any value, including
those th... | 62598f691d351010ab8f3294 |
class EventoReport(reportengine.ModelReport): <NEW_LINE> <INDENT> verbose_name = "Todos os Eventos" <NEW_LINE> slug = "relatorio-eventos" <NEW_LINE> namespace = "evento" <NEW_LINE> description = "Lista todos os eventos presentes no sistema" <NEW_LINE> labels = ('is_active', 'nome', 'descricao', 'data', 'local', 'preco'... | Relatório de eventos | 62598f6966673b3332c2fb0d |
class RevealAccess(object): <NEW_LINE> <INDENT> def __init__(self, init=None, name='var'): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.val = init <NEW_LINE> <DEDENT> def __get__(self, obj, type=None): <NEW_LINE> <INDENT> print('Retrieving', self.name) <NEW_LINE> return self.val <NEW_LINE> <DEDENT> def __set__(... | A data descriptor that sets and returns values
normally and prints a message logging their access. | 62598f6921bff66bcd7223ae |
class EnergyCommodity(Commodity): <NEW_LINE> <INDENT> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) | Generic energy commodity, to be used in (national) energy balances (when the type of energy is not important) | 62598f6950485f2cf55da6bf |
class PostgresQuery(rdbms.Query): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> connection = self.output().connect() <NEW_LINE> cursor = connection.cursor() <NEW_LINE> sql = self.query() <NEW_LINE> logger.info('Executing query from task: {name}'.format(name=self.__class__)) <NEW_LINE> cursor.execute(sql) <NEW_... | Template task for querying a Postgres compatible database
Usage:
Subclass and override the required `host`, `database`, `user`, `password`, `table`, and `query` attributes.
Override the `run` method if your use case requires some action with the query result.
Task instances require a dynamic `update_id`, e.g. via pa... | 62598f69507cdc57c63a44ed |
class MetadataContentTest(unittest.TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> with open('metadata.txt', 'r') as md_fd: <NEW_LINE> <INDENT> cls.meta = json.loads(md_fd.read()) <NEW_LINE> <DEDENT> <DEDENT> def test_query_results(self): <NEW_LINE> <INDENT> for query_obj... | Test the metadata content. | 62598f69c432627299fa2726 |
class PyPlanar(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://bitbucket.org/caseman/planar/src/default/" <NEW_LINE> pypi = "planar/planar-0.4.zip" <NEW_LINE> version('0.4', sha256='cbfb9cbae8b0e296e6e7e3552b7d685c7ed5cae295b7a61f2b2b096b231dad76') | 2D planar geometry library for Python. | 62598f6976d4e153a661c36a |
class RandomTransforms(object): <NEW_LINE> <INDENT> def __init__(self, transforms): <NEW_LINE> <INDENT> assert isinstance(transforms, (list, tuple)) <NEW_LINE> self.transforms = transforms <NEW_LINE> <DEDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def __... | Base class for a list of transformations with randomness
Args:
transforms (list or tuple): list of transformations | 62598f69796e427e5384dee7 |
class TestIpAddrTypeHostForInternIp(TestIpAddrType): <NEW_LINE> <INDENT> def test_server_without_value(self): <NEW_LINE> <INDENT> server = self._get_server('host') <NEW_LINE> with self.assertRaises(ValidationError): <NEW_LINE> <INDENT> server.commit(user=User.objects.first()) <NEW_LINE> <DEDENT> <DEDENT> def test_serve... | Most important tests for ip_addr_type host and intern_ip | 62598f69d164cc61758206cd |
@implementer(IDeleteAction, IRuleElementData) <NEW_LINE> class DeleteAction(SimpleItem): <NEW_LINE> <INDENT> element = 'plone.actions.Delete' <NEW_LINE> summary = _(u'Delete object') | The actual persistent implementation of the action element.
| 62598f698c3a8732951f5ca2 |
class exceededFeedbackLimitError(Error): <NEW_LINE> <INDENT> pass | Rasied when attempted to give more than two feedbacks per account | 62598f6a8a349b6b43685993 |
class PatchTestInput(PatchTestArgs, PatchTestStdIn): <NEW_LINE> <INDENT> pass | PatchTest wrapper input class | 62598f6a6e29344779affdaf |
@register_plugin <NEW_LINE> class PluginTemplate3(Plugin, CpuPlugin): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(PluginTemplate3, self).__init__('PluginTemplate3') <NEW_LINE> <DEDENT> def nInput_datasets(self): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> def nOutput_datasets(self): <NEW_LINE... | A plugin template that reduces the data dimensions, e.g. azimuthal integration.
:param num_bins: Length of the new dimension. Default: 10. | 62598f6ad6c5a102081e1897 |
class RegionBoundariesTest(BaseTestCase): <NEW_LINE> <INDENT> def test_region_boundaries(self): <NEW_LINE> <INDENT> cortex = surfaces.Cortex.from_file() <NEW_LINE> white_matter = connectivity.Connectivity(load_default=True) <NEW_LINE> white_matter.configure() <NEW_LINE> rb = region_boundaries.RegionBoundaries(cortex) <... | This test is checking correspondence between cortical surface and connectivity. | 62598f6a9b70327d1c57e4fd |
class RouterConfigError(Error): <NEW_LINE> <INDENT> pass | Raised if a configuration command was not able to run.
Carries a tuple of integer exit status and stderr text. | 62598f6ad99f1b3c44d04e07 |
class PNASetRFFrequencyInterface(InstrTaskInterface): <NEW_LINE> <INDENT> channel = Int(1).tag(pref=True) <NEW_LINE> channel_driver = Value() <NEW_LINE> driver_list = ['AgilentPNA'] <NEW_LINE> has_view = True <NEW_LINE> def perform(self, frequency=None): <NEW_LINE> <INDENT> task = self.task <NEW_LINE> if not task.drive... | Set the central frequecny to be used for the specified channel.
| 62598f6a0a366e3fb87dc117 |
class PhishTank(): <NEW_LINE> <INDENT> __apikey = '' <NEW_LINE> _requests_available = 200 <NEW_LINE> _requests_made = 0 <NEW_LINE> _time_to_next_request = datetime.utcnow() <NEW_LINE> _request_interval = 60 <NEW_LINE> def __init__(self, api_url='http://checkurl.phishtank.com/checkurl/', apikey=None): <NEW_LINE> <INDENT... | PhishTank abstraction class. | 62598f6ad10714528d69d620 |
class PymdownxDeprecationWarning(UserWarning): <NEW_LINE> <INDENT> pass | Deprecation warning for Pymdownx that is not hidden. | 62598f6a56b00c62f0fb2009 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.