code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class RequestBodySizeLimiter(wsgi.Middleware): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(RequestBodySizeLimiter, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> @webob.dec.wsgify(RequestClass=wsgi.Request) <NEW_LINE> def __call__(self, req): <NEW_LINE> <INDENT> if req.conten... | Add a 'raksha.context' to WSGI environ. | 62598f9b925a0f43d25e7dcb |
@meta.apply <NEW_LINE> class WildGroup(GObject): <NEW_LINE> <INDENT> __attributes__ = ('family', 'population') <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('population', 2) <NEW_LINE> super().__init__(**kwargs) | Group of wild beasts (beasts are not instanciated until battle)
groups can reproduct, move to other zones, etc. | 62598f9b94891a1f408b95b8 |
class CategoryUpdateView(AdminRequiredMixin, UpdateView): <NEW_LINE> <INDENT> model = Category <NEW_LINE> template_name = 'admin/category_update.html' <NEW_LINE> fields = ['name', 'description'] <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <INDENT> context = super(CategoryUpdateView, self).get_context_da... | docstring for CategoryUpdateView | 62598f9ba8ecb03325870f9a |
@Metric.register("hit_at_k_cpu") <NEW_LINE> class HitAtKCPU(Metric): <NEW_LINE> <INDENT> def __init__(self, k=5) -> None: <NEW_LINE> <INDENT> self._k = k <NEW_LINE> self._hit_at_5 = 0.0 <NEW_LINE> self._ttl_size = 0 <NEW_LINE> <DEDENT> def __call__(self, predictions: torch.Tensor, gold_labels: torch.Tensor, mask: Optio... | Just checks batch-equality of two tensors and computes an accuracy metric based on that. This
is similar to :class:`CategoricalAccuracy`, if you've already done a ``.max()`` on your
predictions. If you have categorical output, though, you should typically just use
:class:`CategoricalAccuracy`. The reason you might w... | 62598f9b379a373c97d98da3 |
class ScrappyException(Exception): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.value | Represents a service failure. | 62598f9bbaa26c4b54d4f042 |
class ActionError(ValueError): <NEW_LINE> <INDENT> pass | Error raised for invalid state changes for a :py:class:`Request`. | 62598f9b23849d37ff850e56 |
class GKS(rks.KohnShamDFT, ghf.GHF): <NEW_LINE> <INDENT> def __init__(self, mol, xc='LDA,VWN'): <NEW_LINE> <INDENT> ghf.GHF.__init__(self, mol) <NEW_LINE> rks.KohnShamDFT.__init__(self, xc) <NEW_LINE> <DEDENT> def dump_flags(self, verbose=None): <NEW_LINE> <INDENT> ghf.GHF.dump_flags(self, verbose) <NEW_LINE> rks.KohnS... | Generalized Kohn-Sham | 62598f9ba79ad16197769df3 |
class DAGContainer(GraphContainer): <NEW_LINE> <INDENT> graph = Instance(networkx.DiGraph) | Enable Container for Directed Acyclic Graphs
| 62598f9bb5575c28eb712b95 |
class DatabaseException(Exception): <NEW_LINE> <INDENT> pass | Base class for exceptions in db module | 62598f9b63d6d428bbee2543 |
class PuppetClassTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.puppet_class = entities.PuppetClass( config.ServerConfig('http://example.com'), id=gen_integer(min_value=1), ) <NEW_LINE> <DEDENT> def test_search_normalize(self): <NEW_LINE> <INDENT> with mock.patch.object(EntitySearchMi... | Tests for :class:`nailgun.entities.PuppetClass`. | 62598f9ba05bb46b3848a60f |
class SpeechRecognitionModel(nn.Module): <NEW_LINE> <INDENT> def __init__(self, n_cnn_layers, n_rnn_layers, rnn_dim, n_class, n_feats, stride: int = 2, dropout: float = 0.1): <NEW_LINE> <INDENT> super(SpeechRecognitionModel, self).__init__() <NEW_LINE> n_feats = n_feats // 2 <NEW_LINE> self.cnn = nn.Conv2d(1, 32, 3, st... | Speech Recognition Model Inspired by DeepSpeech 2 | 62598f9b0fa83653e46f4c7a |
class FieldStateMt: <NEW_LINE> <INDENT> size: int <NEW_LINE> shape: typing.Tuple[int, int] <NEW_LINE> state: np.array <NEW_LINE> lib = None <NEW_LINE> cpu: int = 1 <NEW_LINE> def __init__(self, size: int): <NEW_LINE> <INDENT> self.size = size <NEW_LINE> self.shape = (size + 2, size + 2) <NEW_LINE> self.state = np.zeros... | State api class.
| 62598f9b60cbc95b063640db |
class TextFeaturizer(object): <NEW_LINE> <INDENT> def __init__(self, vocab_file): <NEW_LINE> <INDENT> lines = [] <NEW_LINE> with codecs.open(vocab_file, "r", "utf-8") as fin: <NEW_LINE> <INDENT> lines.extend(fin.readlines()) <NEW_LINE> <DEDENT> self.token_to_index = {} <NEW_LINE> self.index_to_token = {} <NEW_LINE> sel... | Extract text feature based on char-level granularity.
By looking up the vocabulary table, each input string (one line of transcript)
will be converted to a sequence of integer indexes. | 62598f9bbe383301e0253587 |
class POSTDataProducer(object): <NEW_LINE> <INDENT> implements(IBodyProducer) <NEW_LINE> def __init__(self, data_dict): <NEW_LINE> <INDENT> self.body = urllib.urlencode(data_dict) <NEW_LINE> self.length = len(self.body) <NEW_LINE> <DEDENT> def startProducing(self, consumer): <NEW_LINE> <INDENT> consumer.write(self.body... | This class is used for posting data by the requests made during the tests. | 62598f9b090684286d5935a1 |
class OrchestratorError(Exception): <NEW_LINE> <INDENT> pass | General orchestrator specific error.
Used for deployment, configuration or user errors.
It's not intended for programming errors or orchestrator internal errors. | 62598f9b4a966d76dd5eec70 |
class AutoPropGObjectMixin(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(AutoPropGObjectMixin, self).__init__() <NEW_LINE> self._gproperties = {} <NEW_LINE> <DEDENT> def do_get_property(self, pspec): <NEW_LINE> <INDENT> getter = "do_get_property_" + pspec.name.replace("-", "_") <NEW_LINE> i... | Mixin for automagic property support in GObjects.
Make sure this is the first entry on your parent list, so super().__init__
will work right. | 62598f9b21bff66bcd7229f4 |
class LinkUpdateEvent(WorldEvent): <NEW_LINE> <INDENT> def __init__(self, u: AgentId, v: AgentId, **kwargs): <NEW_LINE> <INDENT> super().__init__(u=u, v=v, **kwargs) | A link between nodes has appeared or disappeared | 62598f9b656771135c489411 |
class TestReportExportApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = esp_sdk.apis.report_export_api.ReportExportApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_request_file(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT... | ReportExportApi unit test stubs | 62598f9bdd821e528d6d8cc4 |
class Expression2(Expression): <NEW_LINE> <INDENT> def get(self, instance): <NEW_LINE> <INDENT> raise NotImplementedError('%s not implemented' % ( str(self))) | Hotspot->Get Hotspot X
Return type: Int | 62598f9b7047854f4633f172 |
class Logic(object): <NEW_LINE> <INDENT> def __init__(self, name, description, quantifier_free = False, theory=None, arrays=False, bit_vectors=False, floating_point=False, integer_arithmetic=False, real_arithmetic=False, integer_difference=False, real_difference=False, linear=True, uninterpreted=False): <NEW_LINE> <IND... | Describes a Logic similarly to the way they are defined in the SMTLIB 2.0
Note: We define more Logics than the ones defined in the SMTLib
2.0. See LOGICS for a list of all the logics and SMTLIB2_LOGICS
for the restriction to the ones defined in SMTLIB2.0 | 62598f9b442bda511e95c1f7 |
class ExtendedSelectWidget(SelectWidget): <NEW_LINE> <INDENT> def __call__(self, field, **kwargs): <NEW_LINE> <INDENT> kwargs.setdefault('id', field.id) <NEW_LINE> if self.multiple: <NEW_LINE> <INDENT> kwargs['multiple'] = True <NEW_LINE> <DEDENT> html = ['<select %s>' % html_params(name=field.name, **kwargs)] <NEW_LIN... | Add support of choices with ``optgroup`` to the ``Select`` widget. | 62598f9bd99f1b3c44d05441 |
class ObjectType(object): <NEW_LINE> <INDENT> DOC = 'doc' <NEW_LINE> VIDEO = 'video' <NEW_LINE> QUIZ = 'quiz' <NEW_LINE> RICH_TEXT = 'rich_text' <NEW_LINE> PY_SHELL = 'py_shell' <NEW_LINE> TRUNK = 'trunk' <NEW_LINE> DOC_LINK = 'doc_link' <NEW_LINE> WIDGET = 'widget' <NEW_LINE> NOTEPAD = 'notepad' | Stores constant string defining type of different data models. | 62598f9b435de62698e9bb85 |
class Question(models.Model): <NEW_LINE> <INDENT> DIFFICULTY_EASY = 1 <NEW_LINE> DIFFICULTY_MEDIUM = 2 <NEW_LINE> DIFFICULTY_HARD = 3 <NEW_LINE> DIFFICULTIES = ( (DIFFICULTY_EASY, u'easy'), (DIFFICULTY_MEDIUM, u'normal'), (DIFFICULTY_HARD, u'hard'), ) <NEW_LINE> title = models.CharField(u'Title', max_length=255) <NEW_L... | A model describing a coobook recipe. | 62598f9b10dbd63aa1c70946 |
class Fusion1(nn.Module): <NEW_LINE> <INDENT> def __init__(self, model_list): <NEW_LINE> <INDENT> super(Fusion1, self).__init__() <NEW_LINE> self.model_list = model_list <NEW_LINE> self.num_input = int(len(self.model_list)*2) <NEW_LINE> self.fc = nn.Linear(self.num_input, 2) <NEW_LINE> <DEDENT> def forward(self, x): <N... | Take list of models, fuse their output into 2 classes | 62598f9b8a43f66fc4bf1f0c |
class RecordList(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def hydrate(cls, data, graph): <NEW_LINE> <INDENT> columns = data["columns"] <NEW_LINE> rows = data["data"] <NEW_LINE> producer = RecordProducer(columns) <NEW_LINE> return cls(columns, [producer.produce(graph.hydrate(row)) for row in rows]) <NEW_LINE... | A list of records returned from the execution of a Cypher statement.
| 62598f9bc432627299fa2d68 |
@parser(Specs.ls_var_opt_mssql) <NEW_LINE> class LsDVarOptMSSql(CommandParser, FileListing): <NEW_LINE> <INDENT> pass | Parses output of ``ls -ld /var/opt/mssql`` command.
The ``ls -ld /var/opt/mssql`` command provides information for the listing
of the ``/var/opt/mssql`` directory. See ``FileListing`` class for addtional
information.
Sample ``ls -ld /var/opt/mssql`` output::
drwxrwx---. 5 root root 58 Apr 16 07:20 /var/opt/mssq... | 62598f9bd268445f26639a4c |
class IterPlus: <NEW_LINE> <INDENT> def __init__(self, lst): <NEW_LINE> <INDENT> self._lst = lst <NEW_LINE> self._i = -1 <NEW_LINE> <DEDENT> def __next__(self): <NEW_LINE> <INDENT> self._i += 1 <NEW_LINE> try: <NEW_LINE> <INDENT> return self._lst[self._i] <NEW_LINE> <DEDENT> except IndexError: <NEW_LINE> <INDENT> self.... | List iterator with insert, set and delete functionality. | 62598f9b3cc13d1c6d4654fd |
class BaseObject: <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return f"<slack_sdk.{self.__class__.__name__}>" | The base class for all model objects in this module | 62598f9b1f037a2d8b9e3e77 |
class LoginForm(FlaskForm): <NEW_LINE> <INDENT> username = StringField('Gebruikersnaam', validators=[DataRequired()], render_kw={'autofocus': 'true'}) <NEW_LINE> password = PasswordField('Paswoord', validators=[DataRequired()]) <NEW_LINE> submit_button = SubmitField('Login') | For users who want to log in | 62598f9b004d5f362081eec5 |
class V6MController(V6M): <NEW_LINE> <INDENT> def __init__(self, host, port): <NEW_LINE> <INDENT> V6M.__init__(self, host, port, self.relay_callback, self.sensor_callback) <NEW_LINE> self._relay_subs = {} <NEW_LINE> self._sensor_subs = {} <NEW_LINE> <DEDENT> def register_relay(self, device): <NEW_LINE> <INDENT> self._r... | Interface between HASS and V6M controller. | 62598f9b925a0f43d25e7dcd |
@pulumi.output_type <NEW_LINE> class GetAppSecRatePolicyActionsResult: <NEW_LINE> <INDENT> def __init__(__self__, config_id=None, id=None, output_text=None, rate_policy_id=None, security_policy_id=None): <NEW_LINE> <INDENT> if config_id and not isinstance(config_id, int): <NEW_LINE> <INDENT> raise TypeError("Expected a... | A collection of values returned by getAppSecRatePolicyActions. | 62598f9ba219f33f346c65ab |
class GetListMetricsResponse(object): <NEW_LINE> <INDENT> swagger_types = { 'request_id': 'str', 'return_code': 'str', 'return_message': 'str', 'metrics': 'list[Metric]' } <NEW_LINE> attribute_map = { 'request_id': 'requestId', 'return_code': 'returnCode', 'return_message': 'returnMessage', 'metrics': 'metrics' } <NEW_... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9b2ae34c7f260aae72 |
class CrossOut(SGRFunction): <NEW_LINE> <INDENT> sgr_param = "9" | the 'crossed out' SGR function | 62598f9b462c4b4f79dbb79c |
class RazerBladeMid2019Mercury(_RippleKeyboard): <NEW_LINE> <INDENT> EVENT_FILE_REGEX = re.compile(r'.*Razer_Blade(-if01)?-event-kbd') <NEW_LINE> USB_VID = 0x1532 <NEW_LINE> USB_PID = 0x0245 <NEW_LINE> HAS_MATRIX = True <NEW_LINE> MATRIX_DIMS = [6, 16] <NEW_LINE> METHODS = ['get_device_type_keyboard', 'set_wave_effect'... | Class for the Razer Blade 15 (Mid 2019) Mercury | 62598f9ba79ad16197769df5 |
class ResourceBaseForm(TranslationModelForm): <NEW_LINE> <INDENT> _date_widget_options = { "icon_attrs": {"class": "fa fa-calendar"}, "attrs": {"class": "form-control input-sm"}, "format": "%Y-%m-%d %H:%M", "options": False, } <NEW_LINE> date = forms.DateTimeField( localize=True, widget=DateTimePicker(**_date_widget_op... | Base form for metadata, should be inherited by childres classes of ResourceBase | 62598f9b090684286d5935a2 |
class WarmElectronColdIon(WarmDielectric): <NEW_LINE> <INDENT> def __init__(self, plasma, ion_species=None, gamma=3): <NEW_LINE> <INDENT> self._name = 'Warm Electron + Cold Ion Plasma Dielectric Tensor' <NEW_LINE> self._description = 'Warm electrons and optional cold ions.' <NEW_LINE> self._plasma = plasma <NEW_LINE> s... | Concrete Class evaluating warm electron + cold ion plasma dielectric
tensor
Warm electron susceptibility tensor depends on *k_para*, we need to use
*k_para* information
Initialization
==============
:param plasma: plasma profile containing at least ne and B data
:type plasma: :py:class:`PlasmaProfile` object
:ion_... | 62598f9b009cb60464d012b6 |
class TwoLayerNet(object): <NEW_LINE> <INDENT> def __init__(self, input_dim=3*32*32, hidden_dim=100, num_classes=10, weight_scale=1e-3, reg=0.0): <NEW_LINE> <INDENT> self.params = {} <NEW_LINE> self.reg = reg <NEW_LINE> W1 = np.random.randn(input_dim, hidden_dim)*weight_scale <NEW_LINE> self.params['W1'] = W1 <NEW_LINE... | A two-layer fully-connected neural network with ReLU nonlinearity and
softmax loss that uses a modular layer design. We assume an input dimension
of D, a hidden dimension of H, and perform classification over C classes.
The architecure should be affine - relu - affine - softmax.
Note that this class does not implemen... | 62598f9ba17c0f6771d5bfcc |
class TestingConfig(Config): <NEW_LINE> <INDENT> TESTING = True <NEW_LINE> SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' <NEW_LINE> DEBUG = True <NEW_LINE> logging.basicConfig() <NEW_LINE> logging.getLogger('sqlalchemy.engine').setLevel(logging.WARN) <NEW_LINE> SERVER_NAME ='localhost' | Configurations for Testing, with a separate test database. | 62598f9b01c39578d7f12b0f |
class Level: <NEW_LINE> <INDENT> def __init__(self, current_level=1, current_xp=0, level_up_base=200, level_up_factor=150): <NEW_LINE> <INDENT> self.current_level = current_level <NEW_LINE> self.current_xp = current_xp <NEW_LINE> self.level_up_base = level_up_base <NEW_LINE> self.level_up_factor = level_up_factor <NEW_... | Component that tracks level and xp | 62598f9bd6c5a102081e1ed7 |
class spec(collections.namedtuple("spec", "target, keyspace, weight, latching")): <NEW_LINE> <INDENT> def __new__(cls, target, keyspace=None, weight=0, latching=False): <NEW_LINE> <INDENT> return super(spec, cls).__new__(cls, target, keyspace, weight, latching) | Specification of a signal which can be returned by either a source or
sink getter.
Attributes
----------
target : :py:class:`ObjectPort`
Source or sink of a signal.
The other attributes and arguments are as for :py:class:`~.Signal`. | 62598f9b1f5feb6acb1629b4 |
class CatalogForm(CrispyFormMixin, forms.ModelForm): <NEW_LINE> <INDENT> crispy_form_helper_path = 'po_projects.forms.crispies.inline_catalog_helper' <NEW_LINE> def __init__(self, author=None, project_version=None, *args, **kwargs): <NEW_LINE> <INDENT> self.author = author <NEW_LINE> self.project_version = project_vers... | Catalog base Form | 62598f9b8e71fb1e983bb847 |
class Locator(amp.CommandLocator): <NEW_LINE> <INDENT> def __init__(self, store): <NEW_LINE> <INDENT> self.store = store | A command locator that takes a store.
This is intended to be persisted by ``maxims.named.remember``. | 62598f9be64d504609df9281 |
@implementer(quoteproto.IQuoter) <NEW_LINE> class FortuneQuoter: <NEW_LINE> <INDENT> def __init__(self, filenames): <NEW_LINE> <INDENT> self.filenames = filenames <NEW_LINE> <DEDENT> def getQuote(self): <NEW_LINE> <INDENT> quoteFile = open(choice(self.filenames)) <NEW_LINE> quotes = quoteFile.read().split('\n%\n') <NEW... | Load quotes from a fortune-format file. | 62598f9b32920d7e50bc5de9 |
class RelationshipOppositeFromModelTestCase(TestCaseWithFixture): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(RelationshipOppositeFromModelTestCase, self).setUp() <NEW_LINE> self.some_time_str = datetime.now().strftime('%Y-%m-%d %H:%M') <NEW_LINE> job = Job.objects.create(name='SomeJob') <NEW_LINE> p... | On the model, the Job relationship is defined on the Payment.
On the resource, the PaymentResource is defined on the JobResource as well | 62598f9b85dfad0860cbf93d |
class DetailProfilePage(DetailView): <NEW_LINE> <INDENT> model = Person <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return self.model.objects.all() <NEW_LINE> <DEDENT> def get(self, request, *args, **kwargs): <NEW_LINE> <INDENT> person_id = kwargs['pk'] <NEW_LINE> if not self.get_queryset().filter(id=person_... | Страница профиля
:param request:
:return: | 62598f9b24f1403a9268577b |
class BaseSteadyStatePGInteractive(): <NEW_LINE> <INDENT> kLeaf = "PM-ss-self-org-ipg" <NEW_LINE> @staticmethod <NEW_LINE> def kernel(perf_i: float, n_robots_i: int, perf_0: float, normalize: bool, normalize_method: str) -> tp.Optional[float]: <NEW_LINE> <INDENT> theta = perf_i - n_robots_i * perf_0 <NEW_LINE> if norma... | Calculates the self organization due to inter-robot interaction for a swarm configuration of
size :math:`N`, given the performance achieved with a single robot with the same configuration.
.. math::
E_T(N,\kappa) = \sum_{t\in{T}} \theta_{E_T}(t)
or
.. math::
E_T(N,\kappa) = \sum_{t\in{T}} \frac{1}{1 + e^{-\the... | 62598f9b8da39b475be02f76 |
class Point2D(Point): <NEW_LINE> <INDENT> dim = 2 | Homogeneous point in 2D, represented as an array with [x, y, 1] | 62598f9b6aa9bd52df0d4c5f |
class Foo: <NEW_LINE> <INDENT> pass | A global meta-class declaration makes all classes at least new-style
classes, even when not subclassing subclasses::
>>> Foo.__class__
<class 'plumber.plumber.plumber'>
>>> issubclass(Foo, object)
True | 62598f9b4428ac0f6e6582be |
class GroupBase(forms.SelfHandlingForm): <NEW_LINE> <INDENT> name = forms.CharField(label=_("Name"), max_length=255) <NEW_LINE> description = forms.CharField(label=_("Description"), required=False, widget=forms.Textarea(attrs={'rows': 4})) <NEW_LINE> def __init__(self, request, *args, **kwargs): <NEW_LINE> <INDENT> sup... | Base class to handle creation and update of security groups.
Children classes must define two attributes:
.. attribute:: success_message
A success message containing the placeholder %s,
which will be replaced by the group name.
.. attribute:: error_message
An error message containing the placeholder %s... | 62598f9bdd821e528d6d8cc7 |
class ListFieldSet(FieldSet, ListMixin): <NEW_LINE> <INDENT> template = "tw.forms.templates.list_fieldset" | A fieldset that renders it's fields as an unordered list | 62598f9b8da39b475be02f77 |
class WindowsCommandRunner(BaseWindowsRunner): <NEW_LINE> <INDENT> def __init__(self, runner_id, timeout=WINDOWS_RUNNER_DEFAULT_ACTION_TIMEOUT): <NEW_LINE> <INDENT> super(WindowsCommandRunner, self).__init__(runner_id=runner_id) <NEW_LINE> self._timeout = timeout <NEW_LINE> <DEDENT> def pre_run(self): <NEW_LINE> <INDEN... | Runner which executes commands on a remote Windows machine. | 62598f9b3cc13d1c6d4654ff |
class TableNameError(Exception): <NEW_LINE> <INDENT> pass | expression referencing unk table | 62598f9bbd1bec0571e14f8d |
class IPSJBehavior(Schema): <NEW_LINE> <INDENT> pass | A behavior supporting PSJ content types.
| 62598f9b91af0d3eaad39b9c |
class PyshieldImporter(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.mod_info = None <NEW_LINE> self.imp_loader = None <NEW_LINE> <DEDENT> def find_module(self, name, path=None): <NEW_LINE> <INDENT> path = None if path is None else list(path) <NEW_LINE> try: <NEW_LINE> <INDENT> self.mod_info... | Import encrypted module or package, package in multi-pathes is not supported. | 62598f9b3539df3088ecc048 |
class AirPurifierStatus(DeviceStatus): <NEW_LINE> <INDENT> def _get_operation(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return AirPurifierOp( self.lookup_enum(AIR_PURIFIER_STATE_OPERATION, True) ) <NEW_LINE> <DEDENT> except ValueError: <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> <DEDENT> @property <NE... | Higher-level information about a Air Purifier's current status. | 62598f9b851cf427c66b805a |
class ClientManager(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._clients = {} <NEW_LINE> self.log = get_logger(self.__class__.__name__) <NEW_LINE> self.log.debug("Initialising") <NEW_LINE> self.heartbeat_thread = threading.Thread(target=self.heartbeat) <NEW_LINE> self.heartbeat_thread.daem... | Manage RainbowAlga clients.
| 62598f9b2ae34c7f260aae74 |
class CaraKerjaPage(BasePage): <NEW_LINE> <INDENT> def __init__(self, driver): <NEW_LINE> <INDENT> super().__init__(driver) <NEW_LINE> <DEDENT> def redirect_cara_kerja_page_success(self): <NEW_LINE> <INDENT> self.click(Locators.CARA_KERJA_NAVBAR) <NEW_LINE> self.is_visible(Locators.CARA_KERJA_PAGE_TITLE) | Kelas ini untuk halaman cara kerja | 62598f9b44b2445a339b6836 |
class TestHelp(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 testHelp(self): <NEW_LINE> <INDENT> pass | Help unit test stubs | 62598f9b462c4b4f79dbb79e |
class EvalAddOp(Evaluator): <NEW_LINE> <INDENT> __slots__ = ["operator_eval", "value", "_eval", "eval"] <NEW_LINE> ops = {"+": operator.add, "-": operator.sub} <NEW_LINE> def build(self, tokens): <NEW_LINE> <INDENT> self.value = tokens[0] <NEW_LINE> _eval = self._eval = self.value[0].eval <NEW_LINE> ops = self.ops <NEW... | Class to evaluate addition and subtraction expressions | 62598f9b9c8ee82313040039 |
class MPLSLinuxDataplaneDriver(dp_drivers.DataplaneDriver): <NEW_LINE> <INDENT> required_kernel = "4.4" <NEW_LINE> dataplane_instance_class = MPLSLinuxVRFDataplane <NEW_LINE> type = consts.IPVPN <NEW_LINE> ecmp_support = True <NEW_LINE> driver_opts = [ cfg.StrOpt("mpls_interface", help=("Interface used to send/receive ... | Dataplane driver relying on the MPLS stack in the Linux kernel
This dataplane driver relies on the MPLS stack in the Linux kernel,
and on linux vrf interfaces. | 62598f9b0fa83653e46f4c7e |
class SubscriptionRenewalView(APIView): <NEW_LINE> <INDENT> permission_classes = (permissions.IsAuthenticated,) <NEW_LINE> def post(self, request, format='json'): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> braintree_user = SubscriptionManager.fetch_braintree_user(request.user) <NEW_LINE> <DEDENT> except BraintreeErro... | View for renewing a subscription. Fails if:
- The user is already subscribed
- There isnt a valid payment method for the user | 62598f9b55399d3f056262b5 |
class Command(BaseDeletionCommand): <NEW_LINE> <INDENT> help = 'Deletes all historical CreditRequest and CreditRequirementStatus rows (in chunks).' <NEW_LINE> def handle(self, *args, **options): <NEW_LINE> <INDENT> chunk_size, sleep_between = super(Command, self).handle(*args, **options) <NEW_LINE> delete_rows( CreditR... | Example usage: ./manage.py lms --settings=devstack delete_historical_credit_data | 62598f9b097d151d1a2c0db9 |
class ShipmentVoid(BaseAPIClient): <NEW_LINE> <INDENT> RequestAction = E.RequestAction('Void') <NEW_LINE> RequestOption = E.RequestOption('') <NEW_LINE> TransactionReference = E.TransactionReference( E.CustomerContext('unspecified') ) <NEW_LINE> @classmethod <NEW_LINE> def void_shipment_request_type(cls, shipment_id, t... | Implements the VoidShipmentRequest | 62598f9bf8510a7c17d7e041 |
class AboutWindow(QtGui.QMainWindow): <NEW_LINE> <INDENT> def __init__(self, parent=None): <NEW_LINE> <INDENT> QtGui.QWidget.__init__(self, parent) <NEW_LINE> self.setObjectName("aboutWindow") <NEW_LINE> self.setWindowTitle("About") <NEW_LINE> self.setWindowIcon(QtGui.QIcon("data/images/about.png")) <NEW_LINE> self.res... | The about window | 62598f9ba17c0f6771d5bfce |
class TimedSizeHandler(TimedRotatingFileHandler): <NEW_LINE> <INDENT> def __init__(self, filename, interval=1, maxMBytes=10, minDays=0, backupCount=5): <NEW_LINE> <INDENT> if not os.path.exists(os.path.dirname(filename)): <NEW_LINE> <INDENT> os.makedirs(os.path.dirname(filename)) <NEW_LINE> <DEDENT> when = 'D' <NEW_LIN... | Custom logging handler class that combines the decision tree for log
rotation from the TimedRotatingFileHandler with the decision tree from the
RotatingFileHandler. This allows us to specify a lifetime AND file size to
determine when to rotate the file.
This class assumes that the lifetime specified is in days. (24... | 62598f9bbaa26c4b54d4f046 |
class TypeValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> EXPERIMENTAL_CREATE_JOB = 0 <NEW_LINE> EXPORT_READSETS = 1 <NEW_LINE> EXPORT_VARIANTS = 2 <NEW_LINE> IMPORT_READSETS = 3 <NEW_LINE> IMPORT_VARIANTS = 4 <NEW_LINE> UNKNOWN_TYPE = 5 | The original request type.
Values:
EXPERIMENTAL_CREATE_JOB: <no description>
EXPORT_READSETS: <no description>
EXPORT_VARIANTS: <no description>
IMPORT_READSETS: <no description>
IMPORT_VARIANTS: <no description>
UNKNOWN_TYPE: <no description> | 62598f9b7047854f4633f176 |
class ChildTransfer(models.Model): <NEW_LINE> <INDENT> IN = 'in' <NEW_LINE> OUT = 'out' <NEW_LINE> TRANSFER_TYPES = [ (IN, 'sign in'), (OUT, 'sign out'), ] <NEW_LINE> child = models.ForeignKey(Child, related_name='transfers') <NEW_LINE> in_out = models.CharField(max_length=10, choices=TRANSFER_TYPES) <NEW_LINE> initial... | Child sign in/out event. | 62598f9b1f5feb6acb1629b6 |
class UniformTimeClustering(AbstractClustering): <NEW_LINE> <INDENT> def __init__(self, k=2, metric='euclidean'): <NEW_LINE> <INDENT> super(UniformTimeClustering, self).__init__(metric=metric) <NEW_LINE> self.n_clusters = k <NEW_LINE> <DEDENT> def describe(self): <NEW_LINE> <INDENT> return "[Uniform time clustering, k ... | Uniform time clustering | 62598f9b76e4537e8c3ef349 |
class SquareLinearOperatorFullMatrixTest( linear_operator_test_util.SquareLinearOperatorDerivedClassTest): <NEW_LINE> <INDENT> def _operator_and_matrix(self, build_info, dtype, use_placeholder): <NEW_LINE> <INDENT> shape = list(build_info.shape) <NEW_LINE> matrix = linear_operator_test_util.random_positive_definite_mat... | Most tests done in the base class LinearOperatorDerivedClassTest. | 62598f9b4e4d5625663721b7 |
class IndexingException(Exception): <NEW_LINE> <INDENT> pass | Exception to raise for error during SQS to DC indexing/archiving | 62598f9b8e71fb1e983bb849 |
class UpdatePaymentsPasswordPageConfigs(object): <NEW_LINE> <INDENT> assert_view_timeout = 10 <NEW_LINE> assert_invalid_view_time = 3 <NEW_LINE> click_on_button_timeout = 10 <NEW_LINE> resource_id_update_payments_password_title = "com.wanda.app.wanhui:id/common_title_view_layout_title" <NEW_LINE> def __init__(self): <N... | This is a configuration class for UpdatePaymentsPasswordPage class. | 62598f9bd7e4931a7ef3be2c |
class Response: <NEW_LINE> <INDENT> def __init__(self, conn): <NEW_LINE> <INDENT> self.conn = conn <NEW_LINE> self.code = None <NEW_LINE> self.headers = {} <NEW_LINE> self.body = None <NEW_LINE> <DEDENT> def add_header(self, key, value): <NEW_LINE> <INDENT> self.headers[key] = value <NEW_LINE> <DEDENT> def set_content_... | http response data | 62598f9b5f7d997b871f92a8 |
class StatusValueValuesEnum(_messages.Enum): <NEW_LINE> <INDENT> STATUS_UNSPECIFIED = 0 <NEW_LINE> DONE = 1 <NEW_LINE> NOT_STARTED = 2 <NEW_LINE> IN_PROGRESS = 3 <NEW_LINE> FAILED = 4 <NEW_LINE> CANCELLED = 5 | The status code.
Values:
STATUS_UNSPECIFIED: Unspecifed code.
DONE: The step has completed without errors.
NOT_STARTED: The step has not started yet.
IN_PROGRESS: The step is in progress.
FAILED: The step has completed with errors.
CANCELLED: The step has completed with cancellation. | 62598f9b0a50d4780f70516d |
class ReportNewAccountTest(test_util.ConfigTestCase): <NEW_LINE> <INDENT> def _call(self): <NEW_LINE> <INDENT> from certbot._internal.account import report_new_account <NEW_LINE> report_new_account(self.config) <NEW_LINE> <DEDENT> @mock.patch("certbot._internal.account.zope.component.queryUtility") <NEW_LINE> def test_... | Tests for certbot._internal.account.report_new_account. | 62598f9b01c39578d7f12b12 |
class URLCleanerTestCase(TestCase): <NEW_LINE> <INDENT> def test_clean_simple_url(self): <NEW_LINE> <INDENT> simple_url = '/test' <NEW_LINE> assert clean_url(simple_url) == simple_url <NEW_LINE> <DEDENT> def test_clean_deep_url(self): <NEW_LINE> <INDENT> deep_url = '/test/two/three/yo' <NEW_LINE> assert clean_url(deep_... | Contains various tests for the url cleaner. | 62598f9bd99f1b3c44d05445 |
class EventBasedBCRRiskCalculatorTestCase( general_test.BaseRiskCalculatorTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.job, _ = helpers.get_risk_job( 'event_based_bcr/job.ini', 'event_based_hazard/job.ini', output_type="gmf") <NEW_LINE> self.calculator = core.EventBasedBCRRiskCalculator(self... | Integration test for the event based bcr risk calculator | 62598f9bbe8e80087fbbedf4 |
class RunSQL(Operation): <NEW_LINE> <INDENT> def __init__(self, sql, reverse_sql=None, state_operations=None): <NEW_LINE> <INDENT> self.sql = sql <NEW_LINE> self.reverse_sql = reverse_sql <NEW_LINE> self.state_operations = state_operations or [] <NEW_LINE> <DEDENT> @property <NEW_LINE> def reversible(self): <NEW_LINE> ... | Runs some raw SQL. A reverse SQL statement may be provided.
Also accepts a list of operations that represent the state change effected
by this SQL change, in case it's custom column/table creation/deletion. | 62598f9b4428ac0f6e6582c0 |
class UserBadge(db.Model): <NEW_LINE> <INDENT> user = db.UserProperty() <NEW_LINE> date = db.DateTimeProperty(auto_now_add=True) <NEW_LINE> badge_name = db.StringProperty() <NEW_LINE> target_context = db.ReferenceProperty() <NEW_LINE> target_context_name = db.StringProperty() <NEW_LINE> points_earned = db.IntegerProper... | Represents a single instance of a badge that a user has earned.
Note that for any given badge type (e.g. a "streak" badge"), a user may
earn multiple of them, and each instance will create an entity in the db. | 62598f9bbaa26c4b54d4f047 |
class fail( job_submit ): <NEW_LINE> <INDENT> COMMAND_TEMPLATE = "sleep 1; /bin/false" <NEW_LINE> def construct_jobfile_submission_command( self ): <NEW_LINE> <INDENT> command_template = self.job_submit_command_template <NEW_LINE> if not command_template: <NEW_LINE> <INDENT> command_template = self.__class__.COMMAND_TE... | This is a fake job submission that deliberately fails, used for cylc
development purposes.
| 62598f9b45492302aabfc26d |
class YieldFunctionGenerator(FunctionGenerator): <NEW_LINE> <INDENT> def __init__(self, module, stats, opts, rng): <NEW_LINE> <INDENT> self.opts = opts <NEW_LINE> self.module = module <NEW_LINE> self.rng = rng <NEW_LINE> self.stats = stats <NEW_LINE> <DEDENT> def generate_child(self, func, literals): <NEW_LINE> <INDENT... | Returns a generator which uses yield. | 62598f9b3539df3088ecc04a |
class DataError(ValueError): <NEW_LINE> <INDENT> __slots__ = ['error', 'name', 'value', 'trafaret'] <NEW_LINE> def __init__(self, error=None, name=None, value=_empty, trafaret=None): <NEW_LINE> <INDENT> self.error = error <NEW_LINE> self.name = name <NEW_LINE> self.value = value <NEW_LINE> self.trafaret = trafaret <NEW... | Error with data preserve
error can be a message or None if error raised in childs
data can be anything | 62598f9b67a9b606de545d5f |
class pathhelper(object): <NEW_LINE> <INDENT> def __init__(self, repo, path, opts=defaultopts): <NEW_LINE> <INDENT> self._vfspath = os.path.join("fastannotate", opts.shortstr, encodedir(path)) <NEW_LINE> self._repo = repo <NEW_LINE> <DEDENT> @property <NEW_LINE> def dirname(self): <NEW_LINE> <INDENT> return os.path.dir... | helper for getting paths for lockfile, linelog and revmap | 62598f9b3617ad0b5ee05ee4 |
class ADMSUrbanSource: <NEW_LINE> <INDENT> def __init__(self, srcname, srctyp, srcpol, srcemi, geom): <NEW_LINE> <INDENT> self.srcname = srcname <NEW_LINE> self.srctyp = srctyp <NEW_LINE> self.srcpol = srcpol <NEW_LINE> self.srcemi = srcemi <NEW_LINE> self.geom = geom <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> ... | ADMS-Urban source. | 62598f9b0c0af96317c56117 |
class TaskUpdate(LoginRequiredMixin, TemplateView): <NEW_LINE> <INDENT> template_name = 'task_update.html' <NEW_LINE> login_url = '/login/' <NEW_LINE> def get(self, request, task_id=None): <NEW_LINE> <INDENT> categories = DiaryCategory.objects.all().filter(author_id=request.user.id) <NEW_LINE> categories = [i for i in ... | View for diary task update. | 62598f9b7d847024c075c168 |
class Dendrogram(Clustering): <NEW_LINE> <INDENT> output_file = Param((str, io.IOBase), mandatory=True) <NEW_LINE> metric = Param(str, 'euclidean') <NEW_LINE> linkage = Param(str, 'ward') <NEW_LINE> def function(self, data): <NEW_LINE> <INDENT> if isinstance(self.output_file, (str, bytes, os.PathLike)): <NEW_LINE> <IND... | Dendrogram.
Parameters
----------
output_path: str
Path to where the dendrogram is saved,
metric: str
Options: "euclidean", "l1", "l2", "manhattan", "cosine", or 'precomputed'. Default: "euclidean"
linkage: str
Options: "ward", "complete", "average", "single". Default: "ward" | 62598f9be76e3b2f99fd87cc |
class DisjointSet(dict): <NEW_LINE> <INDENT> def __init__(self, dict): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def add(self, item): <NEW_LINE> <INDENT> self[item] = item <NEW_LINE> <DEDENT> def find(self, item): <NEW_LINE> <INDENT> if self[item] != item: <NEW_LINE> <INDENT> self[item] = self.find(self[item]) <NEW_... | 不相交集 | 62598f9b3cc13d1c6d465501 |
class OrderInfo(models.Model): <NEW_LINE> <INDENT> ORDER_STATUS = ( ("PAYING", "待支付"), ("TRADE_SUCCESS", "支付成功"), ("TRADE_CLOSE", "支付关闭"), ("TRADE_FAIL", "支付失败"), ("TRADE_FINSHED", "交易结束"), ) <NEW_LINE> user = models.ForeignKey(User, verbose_name=u"用户") <NEW_LINE> order_sn = models.CharField(max_length=30, unique=True,... | 订单 | 62598f9b4e4d5625663721b9 |
class Euclidean(Manifold): <NEW_LINE> <INDENT> def __init__(self, *shape): <NEW_LINE> <INDENT> self._shape = shape <NEW_LINE> if len(shape) == 0: <NEW_LINE> <INDENT> raise TypeError("Need shape parameters.") <NEW_LINE> <DEDENT> elif len(shape) == 1: <NEW_LINE> <INDENT> self._name = "Euclidean manifold of {}-vectors".fo... | Euclidean manifold of shape n1 x n2 x ... x nk tensors. Useful for
unconstrained optimization problems or for unconstrained hyperparameters,
as part of a product manifold.
Examples:
Create a manifold of vectors of length n:
manifold = Euclidean(n)
Create a manifold of m x n matrices:
manifold = Euclidean(m, n) | 62598f9bbaa26c4b54d4f048 |
class MethodNotAllowed(HttpException): <NEW_LINE> <INDENT> status = 405 | An :class:`HttpException` with default ``405`` status code. | 62598f9b01c39578d7f12b13 |
class Article(BaseModel): <NEW_LINE> <INDENT> STATUS_CHOICES = ( ('d', '草稿'), ('p', '发表'), ) <NEW_LINE> COMMENT_STATUS = ( ('o', '打开'), ('c', '关闭'), ) <NEW_LINE> TYPE = ( ('a', '文章'), ('p', '页面'), ) <NEW_LINE> title = models.CharField('标题', max_length=200, unique=True) <NEW_LINE> body = MDTextField('正文') <NEW_LINE> pub... | 文章 | 62598f9b99cbb53fe6830c68 |
class ValueTooSmallError(Error): <NEW_LINE> <INDENT> pass | Raise when the input value is too small | 62598f9bcc0a2c111447ada2 |
class Variable: <NEW_LINE> <INDENT> def __init__(self, nombre, tipo, valor=None): <NEW_LINE> <INDENT> self. nombre = nombre <NEW_LINE> self.tipo = tipo <NEW_LINE> self.valor = valor <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if self.valor: <NEW_LINE> <INDENT> return self.valor.nombre <NEW_LINE> <DEDENT>... | Variable tipada. | 62598f9b7b25080760ed723b |
class Arg: <NEW_LINE> <INDENT> def __init__( self, *, name: str, help_: str, command: Optional[str] = None, positional: bool = False, type_: typing.Type = str, enum: Optional[List] = None, default: Optional = None, ): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.help = help_ <NEW_LINE> self.command = command <N... | Schema arg. | 62598f9bbe383301e025358d |
class ComputeaccountsGlobalAccountsOperationsDeleteResponse(_messages.Message): <NEW_LINE> <INDENT> pass | An empty ComputeaccountsGlobalAccountsOperationsDelete response. | 62598f9b07f4c71912baf1e0 |
class NGramSuggester(object): <NEW_LINE> <INDENT> def __init__(self, ngram_size: int=2) -> None: <NEW_LINE> <INDENT> self.data: Dict[str, List[str]] = {} <NEW_LINE> self.ngram_size = ngram_size <NEW_LINE> <DEDENT> def index(self, suggestions: Sequence[str]) -> None: <NEW_LINE> <INDENT> for s in suggestions: <NEW_LINE> ... | A typo-tolerant suggester powered by an n-gram index. | 62598f9b8c0ade5d55dc355a |
class RegistryOfTests(object): <NEW_LINE> <INDENT> def __init__(self, mapping_or_seq): <NEW_LINE> <INDENT> self._test_to_target = dict(mapping_or_seq) <NEW_LINE> <DEDENT> @property <NEW_LINE> def empty(self): <NEW_LINE> <INDENT> return len(self._test_to_target) == 0 <NEW_LINE> <DEDENT> def get_owning_target(self, test)... | A registry of tests and the targets that own them. | 62598f9b1b99ca400228f3f8 |
class AsyncioClient: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__lock = asyncio.Lock() <NEW_LINE> self.__reader = None <NEW_LINE> self.__writer = None <NEW_LINE> self.__target_names = None <NEW_LINE> self.__description = None <NEW_LINE> <DEDENT> async def connect_rpc(self, host, port, target_name... | This class is similar to :class:`artiq.protocols.pc_rpc.Client`, but
uses ``asyncio`` instead of blocking calls.
All RPC methods are coroutines.
Concurrent access from different asyncio tasks is supported; all calls
use a single lock. | 62598f9b6e29344779b003f1 |
class EventLoop(object): <NEW_LINE> <INDENT> def __init__(self, *tasks): <NEW_LINE> <INDENT> self._running = False <NEW_LINE> self._selector = selectors.DefaultSelector() <NEW_LINE> self._tasks = deque(tasks) <NEW_LINE> self._tasks_waiting_on_stdin = [] <NEW_LINE> self._timers = [] <NEW_LINE> self._selector.register(sy... | Implements a simplified coroutine-based event loop as a demonstration.
Very similar to the "Trampoline" example in PEP 342, with exception
handling taken out for simplicity, and selectors added to handle file IO | 62598f9bd486a94d0ba2bd6c |
class ComboBoxNoWheel(QtWidgets.QComboBox): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ComboBoxNoWheel, self).__init__() <NEW_LINE> <DEDENT> def wheelEvent(self, event): <NEW_LINE> <INDENT> event.ignore() | A combobox with the wheel removed. | 62598f9b379a373c97d98daa |
class BaseGeometryWidget(Widget): <NEW_LINE> <INDENT> geom_type = 'GEOMETRY' <NEW_LINE> map_srid = 4326 <NEW_LINE> map_width = 600 <NEW_LINE> map_height = 400 <NEW_LINE> display_raw = False <NEW_LINE> supports_3d = False <NEW_LINE> template_name = '' <NEW_LINE> def __init__(self, attrs=None): <NEW_LINE> <INDENT> self.a... | The base class for rich geometry widgets.
Render a map using the WKT of the geometry. | 62598f9b30dc7b766599f5e3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.