code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Pca9685Driver(Driver): <NEW_LINE> <INDENT> RESOLUTION = 16 <NEW_LINE> def __init__(self, pins, freq=200, address=0x40): <NEW_LINE> <INDENT> super().__init__(pins, self.RESOLUTION, freq) <NEW_LINE> if not board: <NEW_LINE> <INDENT> if not board_id: <NEW_LINE> <INDENT> raise NotImplementedError('Board is unknown') ... | Represents a pwm driver, which uses the pins of an PCA9685 I2C board. | 62598ef77047854f4633dc78 |
class SelectionSet: <NEW_LINE> <INDENT> def __init__(self, selection, offset=''): <NEW_LINE> <INDENT> self.selections = [selection] <NEW_LINE> self.offset = offset <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> selections_repr = f',\n{self.offset}{INDENT}'.join(i.__repr__() for i in self.selections) <NEW_L... | SelectionSet | 62598ef7f9cc0f698b1c4727 |
class TQueue(Queue.Queue): <NEW_LINE> <INDENT> def __init__(self, initial_list=[], maxsize=0): <NEW_LINE> <INDENT> Queue.Queue.__init__(self, maxsize=maxsize) <NEW_LINE> self.extend(initial_list) <NEW_LINE> <DEDENT> def extend(self, items, block=True, timeout=None): <NEW_LINE> <INDENT> for item in items: <NEW_LINE> <IN... | Simple wrapper about Queue.Queue (FIFO) to add more conventional
methods. | 62598ef799cbb53fe682f75f |
class AMTDevice(wsmanModule.wsmanModule): <NEW_LINE> <INDENT> _RESOURCES = { 'bios': 'CIM_SystemBIOS', } <NEW_LINE> def __init__(self, target = None, is_ssl = True, username = None, password = None, debug = False, showxml = False): <NEW_LINE> <INDENT> self._debug = debug <NEW_LINE> self._showxml = showxml <NEW_LINE> se... | A wrapper class which packages AMT functionality into an accessible, device-centric format. | 62598ef74f6381625f198914 |
class ListHandler(PageHandler): <NEW_LINE> <INDENT> @tornado.web.authenticated <NEW_LINE> def get(self): <NEW_LINE> <INDENT> page_size = self.get_argument("page_size", 30) <NEW_LINE> marker_list = marker_service.get_marker_list(last_id=0, page_size=int(page_size)) <NEW_LINE> current_user_id = self.get_current_user() <N... | 签到列表 | 62598ef797e22403b38397a0 |
class RunMode(object): <NEW_LINE> <INDENT> TRAIN = 1 <NEW_LINE> PREDICT = 2 <NEW_LINE> EVAL = 3 | model_fn will be called in 3 modes | 62598ef721bff66bcd721507 |
class Recipe(yaml.YAMLObject): <NEW_LINE> <INDENT> def __init__(self, recipe_file): <NEW_LINE> <INDENT> self.packages = set() <NEW_LINE> self.order = get_file_data(recipe_file) <NEW_LINE> self.get_packages() <NEW_LINE> <DEDENT> @property <NEW_LINE> def order(self): <NEW_LINE> <INDENT> return self.__order <NEW_LINE> <DE... | Class to store order of building recipe, reads data from
yml file in format:
- ['package1', 'bootstrap 0']
- ['package2']
- ['package1', 'bootstrap 1']
... | 62598ef73539df3088ecab5e |
class ZxWeb3Client(Web3Client): <NEW_LINE> <INDENT> __name__ = "ZxWeb3Client" <NEW_LINE> def __init__( self, network_id, web3_rpc_url, private_key=None, ): <NEW_LINE> <INDENT> super(ZxWeb3Client, self).__init__( network_id=network_id, web3_rpc_url=web3_rpc_url, private_key=private_key, ) <NEW_LINE> self._contract_addre... | Client for interacting with 0x | 62598ef716aa5153ce3fedb3 |
class ButtonElement(InputControlElement, ButtonElementMixin): <NEW_LINE> <INDENT> u <NEW_LINE> class ProxiedInterface(InputControlElement.ProxiedInterface, ButtonElementMixin): <NEW_LINE> <INDENT> is_momentary = const(True) <NEW_LINE> is_pressed = const(False) <NEW_LINE> <DEDENT> def __init__(self, is_momentary, msg_ty... | Class representing a button a the controller | 62598ef75166f23b2e241c8c |
@sdk_decorators.SdkCommand(name="version", target="fantastico", help="Displays fantastico sdk installed version.") <NEW_LINE> class SdkCommandVersion(SdkCommand): <NEW_LINE> <INDENT> def __init__(self, argv, cmd_factory, version_reader=fantastico): <NEW_LINE> <INDENT> super(SdkCommandVersion, self).__init__(argv, cmd_f... | This class provides the command for finding out installed version of Fantastico SDK. The value is defined in fantastico
root module code.
.. code-block:: python
# display help information for version command in sdk context
fsdk version --help
# display the current sdk version
fsdk version | 62598ef791f36d47f22302fc |
class Linear(Layer): <NEW_LINE> <INDENT> def __init__(self, input_size, output_size, with_bias=True, wRegularizer=None, bRegularizer=None, init_weight=None, init_bias=None, init_grad_weight=None, init_grad_bias=None, bigdl_type="float"): <NEW_LINE> <INDENT> super(Linear, self).__init__(None, bigdl_type, input_size, out... | The [[Linear]] module applies a linear transformation to the input data,
i.e. `y = Wx + b`. The input given in `forward(input)` must be either
a vector (1D tensor) or matrix (2D tensor). If the input is a vector, it must
have the size of `inputSize`. If it is a matrix, then each row is assumed to be
an input sample of ... | 62598ef75fdd1c0f98e5c855 |
class TextModOp(object): <NEW_LINE> <INDENT> def __init__(self, orig_sent, word, word_idx, new_word): <NEW_LINE> <INDENT> self.orig_sent = orig_sent <NEW_LINE> self.word = word <NEW_LINE> self.word_idx = word_idx <NEW_LINE> self.word_len = len(word) <NEW_LINE> if word.isupper(): <NEW_LINE> <INDENT> new_word = new_word.... | class representing a modification option to a given sentence | 62598ef7a8370b77170eec94 |
class Upsample(OnnxOpConverter): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _impl_v7(cls, inputs, attr, params): <NEW_LINE> <INDENT> scales = attr.get('scales') <NEW_LINE> assert len(scales) == 4 and scales[0] == 1.0 and scales[1] == 1.0 and scales[2] == scales[3] <NEW_LINE> mode = attr.get('mode') <NEW_LINE> if m... | Operator converter for Upsample (nearest mode).
| 62598ef7a219f33f346c50e0 |
class ExcludedUsersListError(bb.Union): <NEW_LINE> <INDENT> _catch_all = 'other' <NEW_LINE> list_error = None <NEW_LINE> other = None <NEW_LINE> def is_list_error(self): <NEW_LINE> <INDENT> return self._tag == 'list_error' <NEW_LINE> <DEDENT> def is_other(self): <NEW_LINE> <INDENT> return self._tag == 'other' <NEW_LINE... | Excluded users list error.
This class acts as a tagged union. Only one of the ``is_*`` methods will
return true. To get the associated value of a tag (if one exists), use the
corresponding ``get_*`` method.
:ivar team.ExcludedUsersListError.list_error: An error occurred. | 62598ef723849d37ff84f96e |
class BugReporter: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.report = self.get_bug_report() <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_platform_info(): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> system_name = platform.system() <NEW_LINE> release_name = platform.release() <NEW_LINE> <D... | Generates reports on module installation | 62598ef7a8370b77170eec95 |
class ManagerConfig(AppConfig): <NEW_LINE> <INDENT> name = 'apps.manager' <NEW_LINE> verbose_name = _("사이트 관리도구") | 사이트 관리 도구 커스텀 앱 설정. | 62598ef7442bda511e95ad12 |
class AvailableProvidersList(msrest.serialization.Model): <NEW_LINE> <INDENT> _validation = { 'countries': {'required': True}, } <NEW_LINE> _attribute_map = { 'countries': {'key': 'countries', 'type': '[AvailableProvidersListCountry]'}, } <NEW_LINE> def __init__( self, *, countries: List["AvailableProvidersListCountry"... | List of available countries with details.
All required parameters must be populated in order to send to Azure.
:param countries: Required. List of available countries.
:type countries: list[~azure.mgmt.network.v2018_11_01.models.AvailableProvidersListCountry] | 62598ef77c178a314d78bd49 |
class Float(Field): <NEW_LINE> <INDENT> _type = 'float' <NEW_LINE> _sql_type = 'FLOAT' <NEW_LINE> def __init__(self, string='', digits=None, help='', required=False, readonly=False, domain=None, states=None, select=False, on_change=None, on_change_with=None, depends=None, context=None, loading='eager'): <NEW_LINE> <IND... | Define a float field (``float``). | 62598ef7d486a94d0ba2a87a |
class TestLuv_to_LCHuv(unittest.TestCase): <NEW_LINE> <INDENT> def test_Luv_to_LCHuv(self): <NEW_LINE> <INDENT> np.testing.assert_almost_equal( Luv_to_LCHuv(np.array([37.98562910, -28.79229446, -1.35581950])), np.array([37.98562910, 28.82419933, 182.69604747]), decimal=7) <NEW_LINE> np.testing.assert_almost_equal( Luv_... | Defines :func:`colour.models.cie_luv.Luv_to_LCHuv` definition unit tests
methods. | 62598ef7ff9c53063f518f13 |
class CircuitListView(RestrictToUserMixin, ListOrCreateModelView): <NEW_LINE> <INDENT> resource = CircuitResource <NEW_LINE> permissions = (IsAuthenticated, ) | widok listy dla schematow | 62598ef710dbd63aa1c6f42d |
class Characteristic(object): <NEW_LINE> <INDENT> def __init__(self, service, *args, **kwargs): <NEW_LINE> <INDENT> self.service = service <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return self.__str__() <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f"Characteristic(identifier={self... | The Characteristic Base Class | 62598ef7bf627c535bcafd23 |
class FirstTest(TestCase): <NEW_LINE> <INDENT> def test_is_string(self): <NEW_LINE> <INDENT> s = u"coucou" <NEW_LINE> self.assertTrue(isinstance(s, basestring)) | First test | 62598ef7f548e778e5969e3e |
@deconstructible <NEW_LINE> class GoogleDriveFilePermission(object): <NEW_LINE> <INDENT> @property <NEW_LINE> def role(self): <NEW_LINE> <INDENT> return self._role <NEW_LINE> <DEDENT> @property <NEW_LINE> def type(self): <NEW_LINE> <INDENT> return self._type <NEW_LINE> <DEDENT> @property <NEW_LINE> def value(self): <NE... | Describe a permission for Google Drive as described on
`Drive docs <https://developers.google.com/drive/v3/reference/permissions>`_
:param gdstorage.GoogleDrivePermissionRole g_role: Role associated to this permission
:param gdstorage.GoogleDrivePermissionType g_type: Type associated to this permission
:param str g_va... | 62598ef726068e7796d4b20d |
class CloudletsAPIServicer(object): <NEW_LINE> <INDENT> def Add(self, request, context): <NEW_LINE> <INDENT> context.set_code(grpc.StatusCode.UNIMPLEMENTED) <NEW_LINE> context.set_details('Method not implemented!') <NEW_LINE> raise NotImplementedError('Method not implemented!') | Методы Cloudlets Service, которыми пользуется Cloudlet Agent
| 62598ef7fff4ab517ebcc089 |
class ConfirmationProofEvidenceTest(SingleTest): <NEW_LINE> <INDENT> @completness_decorate() <NEW_LINE> def runTest(self,election_data): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> confirmation = self.test_data <NEW_LINE> pi = confirmation['pi'] <NEW_LINE> s,t = pi <NEW_LINE> mpz_pi = (mpz(s),mpz(t)) <NEW_LINE> y_hat ... | docstring for ConfirmationProofEvidenceTest. | 62598ef73d592f4c4edb97a0 |
class ValueManager(Dict): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.manager = TransactionManager(path) <NEW_LINE> def serializer(value): <NEW_LINE> <INDENT> if not issubclass(value, Value): <NEW_LINE> <INDENT> raise ValueError("expected a subclass of Value") <NEW... | A dict-like class that keeps track of other persistent.Values. Assigning a
type creates a value of that type stored at the key assigned to.
Serialization customization of stored types is not yet supported. | 62598ef716aa5153ce3fedb5 |
class TestDarkSky(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.hass = get_test_home_assistant() <NEW_LINE> self.hass.config.units = METRIC_SYSTEM <NEW_LINE> self.lat = self.hass.config.latitude = 37.8267 <NEW_LINE> self.lon = self.hass.config.longitude = -122.423 <NEW_LINE> <DEDENT>... | Test the Dark Sky weather component. | 62598ef7796e427e5384d04c |
class ReroMefSerializer(JSONSerializer): <NEW_LINE> <INDENT> def serialize(self, pid, record, links_factory=None, **kwargs): <NEW_LINE> <INDENT> if request and request.args.get('resolve'): <NEW_LINE> <INDENT> record = record.replace_refs() <NEW_LINE> <DEDENT> return super(ReroMefSerializer, self).serialize( pid, record... | Mixin serializing records as JSON. | 62598ef732920d7e50bc48e1 |
class ServiceResource: <NEW_LINE> <INDENT> meta = None <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.meta = self.meta.copy() <NEW_LINE> if kwargs.get('client') is not None: <NEW_LINE> <INDENT> self.meta.client = kwargs.get('client') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.meta.clie... | A base class for resources.
:type client: botocore.client
:param client: A low-level Botocore client instance | 62598ef74527f215b58e87b4 |
@utils.registerPlexObject <NEW_LINE> class Format(MediaTag): <NEW_LINE> <INDENT> TAG = 'Format' <NEW_LINE> FILTER = 'format' | Represents a single Format media tag.
Attributes:
TAG (str): 'Format'
FILTER (str): 'format' | 62598ef7dc8b845886d51e78 |
class DropPacket(Exception): <NEW_LINE> <INDENT> pass | Raised by Conversion.decode_message when the packet is invalid.
I.e. does not conform to valid syntax, contains malicious
behaviour, etc. | 62598ef7fff4ab517ebcc08a |
class dictParse: <NEW_LINE> <INDENT> def __init__(self, thing, order=[]): <NEW_LINE> <INDENT> if type(thing) == dict: <NEW_LINE> <INDENT> if order: <NEW_LINE> <INDENT> for key in order: <NEW_LINE> <INDENT> func = getattr(self, key, None) <NEW_LINE> if func: <NEW_LINE> <INDENT> func(thing.pop(key)) <NEW_LINE> <DEDENT> <... | Base class for building dict parsers (that can also handle lists).
Methods should be named after the keys in the dict and specify
what to do with the contents. | 62598ef7d486a94d0ba2a87c |
class VIEW3D_MT_materialutilities_specials(bpy.types.Menu): <NEW_LINE> <INDENT> bl_idname = "VIEW3D_MT_materialutilities_specials" <NEW_LINE> bl_label = "Specials" <NEW_LINE> def draw(self, context): <NEW_LINE> <INDENT> mu_prefs = materialutilities_get_preferences(context) <NEW_LINE> layout = self.layout <NEW_LINE> lay... | Spcials menu for Material Utilities | 62598ef7167d2b6e312b584f |
class PartialScorerInterface(ScorerInterface): <NEW_LINE> <INDENT> def score_partial( self, y: torch.Tensor, next_tokens: torch.Tensor, state: Any, x: torch.Tensor ) -> Tuple[torch.Tensor, Any]: <NEW_LINE> <INDENT> raise NotImplementedError | Partial scorer interface for beam search.
The partial scorer performs scoring when non-partial scorer finished scoring,
and recieves pre-pruned next tokens to score because it is too heavy to score
all the tokens.
Examples:
* Prefix search for connectionist-temporal-classification models
* :class:`espne... | 62598ef74527f215b58e87b5 |
class MyTemplateApp: <NEW_LINE> <INDENT> def __init__(self, instancename: str): <NEW_LINE> <INDENT> self.name = instancename <NEW_LINE> self.title = "My App!" <NEW_LINE> self.main_call_count = 0 <NEW_LINE> <DEDENT> def welcome(self): <NEW_LINE> <INDENT> print("Hello from", self.name, "also called", self.title) <NEW_LIN... | I'm the docstring of your class!
MyTemplateApp contains a simple program that can be used
by other applications. | 62598ef7d268445f26638fe9 |
class EchoClient(asynchat.async_chat): <NEW_LINE> <INDENT> ac_in_buffer_size = 64 <NEW_LINE> ac_out_buffer_size = 64 <NEW_LINE> def __init__(self, host, port, message): <NEW_LINE> <INDENT> self.message = message <NEW_LINE> self.received_data = [] <NEW_LINE> self.logger = logging.getLogger('EchoClient') <NEW_LINE> async... | Sends messages to the server and receives responses.
| 62598ef73d592f4c4edb97a1 |
class GushiwenUserAgentMiddleware(object): <NEW_LINE> <INDENT> def __init__(self, user_agent=''): <NEW_LINE> <INDENT> self.user_agent = user_agent <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_crawler(cls, crawler): <NEW_LINE> <INDENT> o = cls(crawler.settings['USER_AGENT']) <NEW_LINE> crawler.signals.connect(o.... | downloadermiddlewares
This middleware allows spiders to override the user_agent | 62598ef72ae34c7f260a9996 |
class Exam(ChoiceQuestion): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.points = 0 <NEW_LINE> self.num_questions = 0 <NEW_LINE> self.POINTS = 1 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.present_exam() <NEW_LINE> <DEDENT> def add_question(self, question, answer): <NEW_LI... | This class encapsulates an exam consisting of one or more instances of Questions and/or one or more instances of ChoiceQuestion. | 62598ef7bf627c535bcafd25 |
class BPol(PolarizabilityBase): <NEW_LINE> <INDENT> since = "1.0.0" <NEW_LINE> __slots__ = () <NEW_LINE> def description(self): <NEW_LINE> <INDENT> return "bond polarizability" <NEW_LINE> <DEDENT> def calculate(self): <NEW_LINE> <INDENT> table = self._get_table() <NEW_LINE> def bond_pol(bond): <NEW_LINE> <INDENT> a = b... | bond polarizability descriptor.
:type use78: bool
:param use78: use old atomic polarizability data | 62598ef757b8e32f5250755d |
class ListPublicFavoritesInputSet(InputSet): <NEW_LINE> <INDENT> def set_APIKey(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'APIKey', value) <NEW_LINE> <DEDENT> def set_Extras(self, value): <NEW_LINE> <INDENT> InputSet._set_input(self, 'Extras', value) <NEW_LINE> <DEDENT> def set_MaxFaveDate(self, value... | An InputSet with methods appropriate for specifying the inputs to the ListPublicFavorites
Choreo. The InputSet object is used to specify input parameters when executing this Choreo. | 62598ef7fff4ab517ebcc08b |
class FullConvLayer(Layer): <NEW_LINE> <INDENT> def __init__(self, filters, kernel_size, lr_multiplier=1, gain=1, modulate=False, demodulate=False, upsample=False, downsample=False, add_noise=False, add_bias=False, apply_act=False, alpha=0.2): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> assert not (upsample and d... | Convolutional layer with the following features: modulation/demodulation, upsampling/downsampling,
noise, bias, leaky relu activation. | 62598ef7be7bc26dc92512bd |
class SubFocus(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=50) <NEW_LINE> focus = models.ForeignKey(Focus) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> ordering = ['name'] | Sub Focus class | 62598ef7aad79263cf42d0c2 |
class LearningAgent(Agent): <NEW_LINE> <INDENT> def __init__(self, env, learning=False, epsilon=1.0, alpha=0.5): <NEW_LINE> <INDENT> super(LearningAgent, self).__init__(env) <NEW_LINE> self.planner = RoutePlanner(self.env, self) <NEW_LINE> self.valid_actions = self.env.valid_actions <NEW_LINE> self.learning = learning ... | An agent that learns to drive in the Smartcab world.
This is the object you will be modifying. | 62598ef760cbc95b06362bea |
class XMLTreeFile(ElementTree.ElementTree, XMLBackup): <NEW_LINE> <INDENT> sourcebackupfile = None <NEW_LINE> def __init__(self, xml): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.sourcebackupfile = file(xml, "rb") <NEW_LINE> self.sourcebackupfile.close() <NEW_LINE> <DEDENT> except (IOError, OSError): <NEW_LINE> <... | Combination of ElementTree root and auto-cleaned XML backup file. | 62598ef7498bea3a75a563e8 |
class Default(protocol.RSEProtocol): <NEW_LINE> <INDENT> def __init__(self, protocol_attr, rse_settings): <NEW_LINE> <INDENT> super(Default, self).__init__(protocol_attr, rse_settings) <NEW_LINE> self.attributes.pop('determinism_type', None) <NEW_LINE> self.files = [] <NEW_LINE> <DEDENT> def path2pfn(self, path): <NEW_... | Implementing access to RSEs using the local filesystem. | 62598ef78a349b6b43684af6 |
class RecipeImageSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Recipe <NEW_LINE> fields = ('id', 'image') <NEW_LINE> read_only_Fields = ('id',) | Serializer for uploading images to recipe | 62598ef732920d7e50bc48e3 |
class HelloSerializer(serializers.Serializer): <NEW_LINE> <INDENT> name = serializers.CharField(max_length=10) | Serializes a name filed for testing our APIView | 62598ef701c39578d7f11657 |
class ArduinoDHT(Arduino): <NEW_LINE> <INDENT> def dhtRead(self, pin=None, model=11): <NEW_LINE> <INDENT> cmd_str = "@{cmd}%{pin}%{model}$!".format(cmd="dht", pin=pin, model=model) <NEW_LINE> try: <NEW_LINE> <INDENT> self.sr.write(cmd_str) <NEW_LINE> self.sr.flush() <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> pass ... | Extend the python-arduino library by addind DHT support. | 62598ef791f36d47f22302fe |
class SoapFault(DynamicObject, Exception): <NEW_LINE> <INDENT> def __init__(self, faultxml=[], client=None): <NEW_LINE> <INDENT> DynamicObject.__init__(self) <NEW_LINE> Exception.__init__(self) <NEW_LINE> self.code = None <NEW_LINE> self.message = None <NEW_LINE> self.detail = None <NEW_LINE> for node in faultxml: <NEW... | SoapFault holds SOAP-ENV:Fault messages as exceptions. | 62598ef732920d7e50bc48e2 |
class AddUserAskView(View): <NEW_LINE> <INDENT> def post(self, request): <NEW_LINE> <INDENT> userAskForm = UserAskForm(request.POST) <NEW_LINE> if userAskForm.is_valid(): <NEW_LINE> <INDENT> user = userAskForm.save(commit=True) <NEW_LINE> suc_dict = {'status': 'success'} <NEW_LINE> return HttpResponse(json.dumps(suc_di... | 用户添加咨询 | 62598ef74a966d76dd5ed78f |
class ProductTest(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> Product.objects.create( idnum=0000, name='SnapBack', colour='red', brand='Gelamo', ) <NEW_LINE> Product.objects.create( idnum=9999, name='BackHat', colour='blue', brand='Gelamo' ) <NEW_LINE> <DEDENT> def test_product_id(self): <NEW_LI... | Test module for Product model | 62598ef7009cb60464cffe05 |
class PKeyTests(TestCase): <NEW_LINE> <INDENT> def test_type(self): <NEW_LINE> <INDENT> self.assertIdentical(PKey, PKeyType) <NEW_LINE> self.assertConsistentType(PKey, 'PKey') <NEW_LINE> <DEDENT> def test_construction(self): <NEW_LINE> <INDENT> self.assertRaises(TypeError, PKey, None) <NEW_LINE> key = PKey() <NEW_LINE>... | Unit tests for L{OpenSSL.crypto.PKey}. | 62598ef75166f23b2e241c90 |
class MyMarkdown(mistune.Markdown): <NEW_LINE> <INDENT> def output_table(self): <NEW_LINE> <INDENT> aligns = self.token['align'] <NEW_LINE> aligns_length = len(aligns) <NEW_LINE> cell = self.renderer.placeholder() <NEW_LINE> header = self.renderer.placeholder() <NEW_LINE> for i, value in enumerate(self.token['header'])... | Fix for uneven tables; can be removed in next version of mistune (0.5+) | 62598ef771ff763f4b5e6016 |
class EliminationAlliance(object): <NEW_LINE> <INDENT> swagger_types = { 'name': 'str', 'backup': 'EliminationAllianceBackup', 'declines': 'list[str]', 'picks': 'list[str]', 'status': 'EliminationAllianceStatus' } <NEW_LINE> attribute_map = { 'name': 'name', 'backup': 'backup', 'declines': 'declines', 'picks': 'picks',... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598ef797e22403b38397a5 |
class WebhookCall(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'webhookcall' <NEW_LINE> timestamp = db.Column(db.Integer, primary_key=True, unique=True) <NEW_LINE> repository = db.Column(db.String(20)) <NEW_LINE> success = db.Column(db.Boolean) <NEW_LINE> results = db.relationship('WebhookCallResult', backref=db.back... | Database stuff for a webhook call, time/repo/success. | 62598ef74527f215b58e87b7 |
class Completer(metaclass=ABCMeta): <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def get_completions( self, document: Document, complete_event: CompleteEvent ) -> Iterable[Completion]: <NEW_LINE> <INDENT> while False: <NEW_LINE> <INDENT> yield <NEW_LINE> <DEDENT> <DEDENT> async def get_completions_async( self, docume... | Base class for completer implementations. | 62598ef72ae34c7f260a9997 |
class G(object): <NEW_LINE> <INDENT> def __init__(self, site_path): <NEW_LINE> <INDENT> self.site_path = site_path <NEW_LINE> self.__clear_site_path() <NEW_LINE> self.__copy_static() <NEW_LINE> self.tem_env = Environment( loader=PackageLoader('app', 'template'), autoescape=select_autoescape(['html', 'xml']) ) <NEW_LINE... | page generater | 62598ef710dbd63aa1c6f432 |
class TargetPixelFile(_datafile): <NEW_LINE> <INDENT> product = "target_pixel_files" <NEW_LINE> suffixes = ["lpd-targ", "spd-targ"] <NEW_LINE> filetype = ".fits.gz" <NEW_LINE> def plot(self, normed=False): <NEW_LINE> <INDENT> super(TargetPixelFile, self).plot() <NEW_LINE> with self.open() as f: <NEW_LINE> <INDENT> data... | A reference to a target pixel dataset on the MAST severs. Like the
:class:`LightCurve` object, this object handles local caching of the file
in a strict directory structure. | 62598ef73346ee7daa336ac2 |
class PolicyQuery(object): <NEW_LINE> <INDENT> def __init__(self, policy, **kwargs): <NEW_LINE> <INDENT> self.log = logging.getLogger(self.__class__.__name__) <NEW_LINE> self.policy = policy <NEW_LINE> for name in sorted(kwargs.keys(), reverse=True): <NEW_LINE> <INDENT> attr = getattr(self, name, None) <NEW_LINE> if ca... | Base class for SELinux policy queries. | 62598ef7f9cc0f698b1c472a |
class Search_Listing(Listing): <NEW_LINE> <INDENT> def __init__(self,terms,generator): <NEW_LINE> <INDENT> self.terms=terms <NEW_LINE> super().__init__( "Search results for: "+terms, "search results>", generator ) | Listing of posts matching a search term | 62598ef7d268445f26638fea |
class MyHook(cgitb.Hook): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.tmpFileName = tempfile.mkstemp(suffix='.html', prefix='bt_', text=True)[1] <NEW_LINE> cgitb.Hook.__init__(self, file=open(self.tmpFileName, 'w')) <NEW_LINE> <DEDENT> def handle(self, info=None): <NEW_LINE> <INDENT> cgitb.Hook.han... | override the standard cgitb hook: invoke the browser | 62598ef77047854f4633dc7e |
class Var(Term): <NEW_LINE> <INDENT> def __init__(self, name, location=None, **kwdargs): <NEW_LINE> <INDENT> Term.__init__(self, name, location=location, **kwdargs) <NEW_LINE> <DEDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self.functor <NEW_LINE> <DEDENT> def compute_value(self, functions=None... | A Term representing a variable.
:param name: name of the variable
:type name: :class:`str` | 62598ef7be383301e0252095 |
class TracingEnvironment: <NEW_LINE> <INDENT> current = None <NEW_LINE> def __init__(self, tracing_mode): <NEW_LINE> <INDENT> self.tracing_mode = tracing_mode <NEW_LINE> self.relay_disable_build_cache = "false" <NEW_LINE> self.wkl_key_to_weight = {} <NEW_LINE> <DEDENT> def __enter__(self): <NEW_LINE> <INDENT> TracingEn... | Global environment for tracing all topi function calls | 62598ef79c8ee8231303f5b6 |
class GaussianNoise(nn.Module): <NEW_LINE> <INDENT> def __init__(self, sigma=0.1, is_relative_detach=True): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.sigma = sigma <NEW_LINE> self.is_relative_detach = is_relative_detach <NEW_LINE> self.register_buffer('noise', torch.tensor(0)) <NEW_LINE> <DEDENT> def forwa... | Gaussian noise regularizer.
source: https://discuss.pytorch.org/t/writing-a-simple-gaussian-noise-layer-in-pytorch/4694/8
Args:
sigma (float, optional): relative standard deviation used to generate the
noise. Relative means that it will be multiplied by the magnitude of
the value your are adding th... | 62598ef721bff66bcd72150d |
class VideoMediaInfo(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'segment_length': {'key': 'segmentLength', 'type': 'str'}, } <NEW_LINE> def __init__( self, **kwargs ): <NEW_LINE> <INDENT> super(VideoMediaInfo, self).__init__(**kwargs) <NEW_LINE> self.segment_length = kwargs.get('segment_length'... | Contains information about the video and audio content.
:param segment_length: Video segment length indicates the length of individual video files
(segments) which are persisted to storage. Smaller segments provide lower archive playback
latency but generate larger volume of storage transactions. Larger segments red... | 62598ef78a349b6b43684af8 |
class MessageVars(TypedDict, total=False): <NEW_LINE> <INDENT> event_type: str <NEW_LINE> is_historical: bool <NEW_LINE> id: str <NEW_LINE> ts: int <NEW_LINE> sender_name: str <NEW_LINE> sender_avatar_url: Optional[str] <NEW_LINE> sender_hash: int <NEW_LINE> msgtype: Optional[str] <NEW_LINE> body_text_html: str <NEW_LI... | Details about a specific message to include in a notification
event_type: the type of the event
is_historical: a boolean, which is `False` if the message is the one
that triggered the notification, `True` otherwise
id: the ID of the event
ts: the time in milliseconds at which the event was sent
sender_name... | 62598ef7a8370b77170eec9a |
class CustomEditor(SimpleEditor): <NEW_LINE> <INDENT> base_style = QtGui.QTextEdit | Custom style of text editor, which displays a multi-line text field.
| 62598ef732920d7e50bc48e5 |
class LinkedList(object): <NEW_LINE> <INDENT> def __init__(self, head=None): <NEW_LINE> <INDENT> self.head = head <NEW_LINE> <DEDENT> def append(self, new_element): <NEW_LINE> <INDENT> current = self.head <NEW_LINE> if self.head: <NEW_LINE> <INDENT> while current.next: <NEW_LINE> <INDENT> current = current.next <NEW_LI... | This class can be used to create a Linked List | 62598ef75fdd1c0f98e5c85b |
class RankingListVisualization(): <NEW_LINE> <INDENT> def __init__(self, viz_dict, number_of_items_in_ranking=10): <NEW_LINE> <INDENT> self.viz_dict = viz_dict <NEW_LINE> self.num_ranks = number_of_items_in_ranking <NEW_LINE> self.ranked_dict = self.rank_items_in_dict() <NEW_LINE> <DEDENT> def rank_items_in_dict(self):... | This class is responsible for building an ordered ranking dict of count of tracks of a given number of items.
To access the output object, it is necessary to call the get_ranked_dict method.
Args:
viz_dict - dictionary containing ranked counts
this dictionary can for example be the count of songs per Art... | 62598ef74a966d76dd5ed791 |
class Cooperator(object): <NEW_LINE> <INDENT> def __init__(self, terminationPredicateFactory=_Timer, scheduler=_defaultScheduler, started=True): <NEW_LINE> <INDENT> self._tasks = [] <NEW_LINE> self._metarator = iter(()) <NEW_LINE> self._terminationPredicateFactory = terminationPredicateFactory <NEW_LINE> self._schedule... | Cooperative task scheduler. | 62598ef77d43ff2487426856 |
class Auth(Http): <NEW_LINE> <INDENT> def authenticate(self): <NEW_LINE> <INDENT> return self.post('/v2/authenticate/api', { 'login_id': self.config.login_id, 'api_key': self.config.api_key }, authenticated=False, retry=False) <NEW_LINE> <DEDENT> def close_session(self): <NEW_LINE> <INDENT> return self.post('/v2/authen... | This class provides an interface to the Authentication endpoints of the CC API | 62598ef7e1aae11d1e7cdc9d |
class PageIterator(object): <NEW_LINE> <INDENT> def __init__(self, api_call, page_descriptor, page_token, request, **kwargs): <NEW_LINE> <INDENT> self.response = None <NEW_LINE> self.page_token = page_token or INITIAL_PAGE <NEW_LINE> self._func = api_call <NEW_LINE> self._page_descriptor = page_descriptor <NEW_LINE> se... | An iterator over the pages of a page streaming API call.
Provides access to the individual pages of the call, as well as the page
token.
Attributes:
response: The full response message for the call most recently made, or
None if a call has not yet been made.
page_token: The page token to be passed in the requ... | 62598ef7283ffb24f3cf2161 |
class Configuration(pyherc.config.Configuration): <NEW_LINE> <INDENT> def __init__(self, model, config_package, controls, surface_manager): <NEW_LINE> <INDENT> super().__init__(model) <NEW_LINE> self.surface_manager = surface_manager <NEW_LINE> self.surface_manager.load_resources() <NEW_LINE> self.context = Configurati... | Configuration for herculeum | 62598ef776e4537e8c3ede70 |
class BooleanParameter(AbstractParameter): <NEW_LINE> <INDENT> def __init__(self, id, name, description = '', **kwargs): <NEW_LINE> <INDENT> self.reverse = False <NEW_LINE> for key, value in kwargs.items(): <NEW_LINE> <INDENT> if key == 'reverse': <NEW_LINE> <INDENT> self.reverse = value <NEW_LINE> <DEDENT> <DEDENT> su... | A parameter that takes a Boolean (True/False) value. | 62598ef766656f66f7d58c9c |
class TransmissionOfDeclineMessagesTestCase(DHCPv6Helper): <NEW_LINE> <INDENT> def run(self): <NEW_LINE> <INDENT> self.do_dhcpv6_handshake_as_server(self.node(1), self.target(1), wait=False) <NEW_LINE> self.logger.info("Waiting for the UUT to perform NS DAD on the assigned address...") <NEW_LINE> r1 = self.node(1).rece... | Transmission of Decline Messages
Verify that a client properly generates a Decline message.
@private
Source: IPv6 Ready DHCPv6 Interoperability Test Suite (Section 1.6) | 62598ef7be7bc26dc92512bf |
class UdpProtocol(DatagramProtocol): <NEW_LINE> <INDENT> def __init__(self, server): <NEW_LINE> <INDENT> self.server = server <NEW_LINE> <DEDENT> def datagramReceived(self, datagram, address): <NEW_LINE> <INDENT> LOGGER.debug('Received %s from %s', datagram, address) <NEW_LINE> self.server.handle_message(datagram) | Protocol to use for receiving messages. | 62598ef7796e427e5384d052 |
class ProbablyPythonBug(error): <NEW_LINE> <INDENT> ExceptionShortDescription = "Bug in python, probably" | Exception raised when pythondialog behaves in a way that seems to indicate a Python bug. | 62598ef730bbd722464684ee |
class NetworkDirectionsShieldsPage(CoClass): <NEW_LINE> <INDENT> _reg_clsid_ = GUID('{D7894778-4843-4141-A988-D74FDB49193D}') <NEW_LINE> _idlflags_ = [] <NEW_LINE> _typelib_path_ = typelib_path <NEW_LINE> _reg_typelib_ = ('{C0FC1503-7E6F-11D2-AABF-00C04FA375F1}', 10, 2) | Esri network directions shields page. | 62598ef7aad79263cf42d0c7 |
class CommentNW(NodeWriter): <NEW_LINE> <INDENT> match = None <NEW_LINE> def start(self, node): <NEW_LINE> <INDENT> match_str = self.writer.defaults['comment'] <NEW_LINE> if match_str != '': <NEW_LINE> <INDENT> self.match = re.match(match_str, node.data) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.match = None <... | Writes `<!-- ... -->`. | 62598ef74527f215b58e87ba |
@ddt.ddt <NEW_LINE> @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') <NEW_LINE> class CertificateDisplayTest(CertificateDisplayTestBase): <NEW_LINE> <INDENT> @ddt.data('verified', 'professional') <NEW_LINE> @patch.dict('django.conf.settings.FEATURES', {'CERTIFICATES_HTML_VIEW': False}... | Tests of certificate display. | 62598ef7956e5f7376df4ad5 |
class AbstractDjangoAppPath(FilePathInterface): <NEW_LINE> <INDENT> def get_approot_path(self, appname): <NEW_LINE> <INDENT> appconfig = apps.get_app_config(appname) <NEW_LINE> return appconfig.path <NEW_LINE> <DEDENT> def get_approot_relative_path(self, appname, *path): <NEW_LINE> <INDENT> return os.path.join(self.get... | Abstract base class for file paths within a Django app. | 62598ef74f88993c371ef947 |
class PortfolioLoader(bulkloader.Loader): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> fields = [ ('title', str), ('slug', str), ('url', str), ('implementation', str), ('accomplishment', str), ('completed', lambda x: datetime.datetime.strptime(x, '%B %Y').date()), ('source', str), ('thumbnail', str), ('i... | Translate each row of data into a Portfolio object | 62598ef7ec188e330fdf7162 |
class StatusModuleTest(ModuleCase): <NEW_LINE> <INDENT> @skipIf(salt.utils.platform.is_windows(), 'minion is windows') <NEW_LINE> @flaky <NEW_LINE> def test_status_pid(self): <NEW_LINE> <INDENT> status_pid = self.run_function('status.pid', ['salt']) <NEW_LINE> grab_pids = status_pid.split()[:10] <NEW_LINE> random_pid =... | Test the status module | 62598ef760cbc95b06362bef |
class UneditableField(Field): <NEW_LINE> <INDENT> template = "%s/layout/uneditable_input.html" <NEW_LINE> def __init__(self, field, *args, **kwargs): <NEW_LINE> <INDENT> self.attrs = {'class': 'uneditable-input'} <NEW_LINE> super(UneditableField, self).__init__(field, *args, **kwargs) | Layout object for rendering fields as uneditable in bootstrap
Example::
UneditableField('field_name', css_class="input-xlarge") | 62598ef7fff4ab517ebcc090 |
class Plot(Component): <NEW_LINE> <INDENT> def __init__(self, filepath, title="", alttxt=""): <NEW_LINE> <INDENT> self.filepath = Path(filepath) <NEW_LINE> self.title = title <NEW_LINE> self.alttxt = alttxt <NEW_LINE> self.content = "|".join([filepath, title, alttxt]) <NEW_LINE> <DEDENT> def set_path(self, filepath): ... | Plot component
| 62598ef75166f23b2e241c94 |
class AlgoliaEngineError(Exception): <NEW_LINE> <INDENT> pass | Something went wrong with Algolia Engine. | 62598ef74c34283577618b9f |
class Solution: <NEW_LINE> <INDENT> def moveZeroes(self, nums): <NEW_LINE> <INDENT> last0 = -1 <NEW_LINE> for index, num in enumerate(nums): <NEW_LINE> <INDENT> if num != 0: <NEW_LINE> <INDENT> last0 += 1 <NEW_LINE> nums[last0] = num <NEW_LINE> <DEDENT> <DEDENT> for i in xrange(last0 + 1, len(nums)): <NEW_LINE> <INDENT... | @param nums: an integer array
@return: nothing | 62598ef7283ffb24f3cf2163 |
class IntegerListParser(flags.ArgumentParser): <NEW_LINE> <INDENT> syntactic_help = ('A comma-separated list of nonnegative integers or integer ' 'ranges. Ex: 1,3,5-7 is read as 1,3,5,6,7.') <NEW_LINE> WARN = 'warn' <NEW_LINE> EXCEPTION = 'exception' <NEW_LINE> def __init__(self, on_nonincreasing=None): <NEW_LINE> <IND... | Parse a string containing a comma-separated list of nonnegative integers.
The list may contain single integers and dash-separated ranges. For
example, "1,3,5-7" parses to [1,3,5,6,7].
Can pass the flag on_nonincreasing to the constructor to tell it
what to do if the list is nonincreasing. Options are
- None: do not... | 62598ef7bf627c535bcafd2b |
class UnknownTSIGKey(dns.exception.DNSException): <NEW_LINE> <INDENT> pass | Raised if we got a TSIG but don't know the key. | 62598ef757b8e32f52507560 |
class Pix2Sky_STG(Zenithal): <NEW_LINE> <INDENT> def _compute_rtheta(self, x, y): <NEW_LINE> <INDENT> return np.sqrt(x ** 2 + y ** 2) <NEW_LINE> <DEDENT> def inverse(self): <NEW_LINE> <INDENT> return Sky2Pix_STG() <NEW_LINE> <DEDENT> def __call__(self, x, y): <NEW_LINE> <INDENT> x = np.asarray(x) + 0. <NEW_LINE> y = np... | STG : Stereographic Projection - pixel to sky. | 62598ef77d847024c075ac88 |
class Location(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=64, verbose_name='Location') <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name | Ubicación de un servidor | 62598ef77b180e01f3e484a3 |
class Baz(models.Model): <NEW_LINE> <INDENT> title = models.CharField(_("Title"), max_length=255) <NEW_LINE> content = HTMLField(verbose_name=_("Content")) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title | New cool products Bazinga | 62598ef7460517430c430d42 |
class FullyQualifiedNameTests(unittest.TestCase): <NEW_LINE> <INDENT> def _checkFullyQualifiedName(self, obj, expected): <NEW_LINE> <INDENT> self.assertEqual( reflect.fullyQualifiedName(obj), expected) <NEW_LINE> <DEDENT> def test_package(self): <NEW_LINE> <INDENT> import twisted <NEW_LINE> self._checkFullyQualifiedNam... | Test for L{reflect.fullyQualifiedName}. | 62598ef7097d151d1a2bf8dd |
class BikeSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> def validate(self, data): <NEW_LINE> <INDENT> if data.get('f_wheel'): <NEW_LINE> <INDENT> f_wheel = data['f_wheel'] <NEW_LINE> if data['f_axle'] != f_wheel.axle: <NEW_LINE> <INDENT> raise serializers.ValidationError( "Axle types must match!" ) <NEW_... | Serializer for bike object. | 62598ef7498bea3a75a563ee |
class PinotDbApiHook(DbApiHook): <NEW_LINE> <INDENT> conn_name_attr = 'pinot_broker_conn_id' <NEW_LINE> default_conn_name = 'pinot_broker_default' <NEW_LINE> supports_autocommit = False <NEW_LINE> def get_conn(self) -> Any: <NEW_LINE> <INDENT> conn = self.get_connection(self.pinot_broker_conn_id) <NEW_LINE> pinot_broke... | Interact with Pinot Broker Query API
This hook uses standard-SQL endpoint since PQL endpoint is soon to be deprecated.
https://docs.pinot.apache.org/users/api/querying-pinot-using-standard-sql | 62598ef74f88993c371ef948 |
class CostMatrix: <NEW_LINE> <INDENT> def __init__(self, group_of_nodes): <NEW_LINE> <INDENT> row = list() <NEW_LINE> col = list() <NEW_LINE> data = list() <NEW_LINE> for i in group_of_nodes.get_indexes(): <NEW_LINE> <INDENT> index_j = group_of_nodes.get_indexes() <NEW_LINE> index_j.remove(i) <NEW_LINE> for j in index_... | Cost of the paths between each couple of a group of nodes. The costs
correspond to the geometrical distance between points. They are indexed
according to the index of each point. Attributes:
row(np.array):
rows of the sparse matrix of the costs.
col(np.array):
col of the sparse matrix of the c... | 62598ef7fff4ab517ebcc092 |
class Output: <NEW_LINE> <INDENT> def __init__(self, summaryFreq=20, outputDirName="evaluation", rewardFileName="rewards", summaryFileName="summary"): <NEW_LINE> <INDENT> self.summaryFreq = summaryFreq <NEW_LINE> if outputDirName != "": <NEW_LINE> <INDENT> if not os.path.exists(outputDirName): <NEW_LINE> <INDENT> os.ma... | export the reward | 62598ef75166f23b2e241c96 |
class Query: <NEW_LINE> <INDENT> def __init__(self, movies, actors): <NEW_LINE> <INDENT> self.movies = movies <NEW_LINE> self.actors = actors <NEW_LINE> <DEDENT> def find_movie_grossing(self,name): <NEW_LINE> <INDENT> for item in self.movies: <NEW_LINE> <INDENT> if item.get_title() ==name: <NEW_LINE> <INDENT> return it... | This class handles queries from user | 62598ef767a9b606de54488a |
class OpModifyNodeStorage(OpCode): <NEW_LINE> <INDENT> OP_ID = "OP_NODE_MODIFY_STORAGE" <NEW_LINE> __slots__ = [ "node_name", "storage_type", "name", "changes", ] | Modifies the properies of a storage unit | 62598ef792d797404e387fd9 |
class BoundaryError(UIException): <NEW_LINE> <INDENT> pass | Abstracted error class for any boundary errors.
| 62598ef7236d856c2adc8876 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.