code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LeastSquaresOracle(BaseSmoothOracle): <NEW_LINE> <INDENT> def __init__(self, matvec_Ax, matvec_ATx, b): <NEW_LINE> <INDENT> self.matvec_Ax = matvec_Ax <NEW_LINE> self.matvec_ATx = matvec_ATx <NEW_LINE> self.b = b <NEW_LINE> <DEDENT> def func(self, x): <NEW_LINE> <INDENT> Ax_b = self.matvec_Ax(x) - self.b <NEW_LIN... | Oracle for least-squares regression.
f(x) = 0.5 ||Ax - b||_2^2 | 62598fb43d592f4c4edbaf75 |
class BinaryExpression(ColumnElement): <NEW_LINE> <INDENT> __visit_name__ = 'binary' <NEW_LINE> def __init__(self, left, right, operator, type_=None, negate=None, modifiers=None): <NEW_LINE> <INDENT> if isinstance(operator, str): <NEW_LINE> <INDENT> operator = operators.custom_op(operator) <NEW_LINE> <DEDENT> self._ori... | Represent an expression that is ``LEFT <operator> RIGHT``.
A :class:`.BinaryExpression` is generated automatically
whenever two column expressions are used in a Python binary expresion::
>>> from sqlalchemy.sql import column
>>> column('a') + column('b')
<sqlalchemy.sql.expression.BinaryExpression object ... | 62598fb4851cf427c66b836a |
class vn44_vn45(rose.upgrade.MacroUpgrade): <NEW_LINE> <INDENT> BEFORE_TAG = "vn4.4" <NEW_LINE> AFTER_TAG = "vn4.5" <NEW_LINE> def upgrade(self, config, meta_config=None): <NEW_LINE> <INDENT> return config, self.reports | Version bump macro | 62598fb45fdd1c0f98e5e043 |
class StringWidget(Widget): <NEW_LINE> <INDENT> meta_type = "Naaya Schema String Widget" <NEW_LINE> meta_label = "Single line text" <NEW_LINE> meta_description = "Free text input box" <NEW_LINE> meta_sortorder = 150 <NEW_LINE> _properties = Widget._properties + ( { 'id': 'width', 'label': 'Display width', 'type': 'int'... | String Widget | 62598fb467a9b606de546084 |
class Action15(Action): <NEW_LINE> <INDENT> def execute(self, instance): <NEW_LINE> <INDENT> value = self.evaluate_index(0) <NEW_LINE> self.player.window.set_caption(value) | Set Title
Parameters:
0: Set Title (EXPSTRING, ExpressionParameter) | 62598fb44e4d5625663724dc |
class AuthMiddleware(BaseMiddleware): <NEW_LINE> <INDENT> def before(self, environ: dict, start_response: Callable) -> WSGIRequest: <NEW_LINE> <INDENT> environ['session'] = None <NEW_LINE> environ['token'] = None <NEW_LINE> token = environ.get('HTTP_AUTHORIZATION') <NEW_LINE> if token is None: <NEW_LINE> <INDENT> logge... | Middleware to handle auth information on requests.
Before the request is handled by the application, the ``Authorization``
header is parsed for an encrypted JWT. If successfully decrypted,
information about the user and their authorization scope is attached
to the request.
This can be accessed in the application via
... | 62598fb491f36d47f2230f03 |
class Standard(models.Model): <NEW_LINE> <INDENT> standard = models.CharField(max_length=200) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.standard | And again, to store the choices that will be listed for the user to choose between
when selecting their approximate standard on each instrument they play. | 62598fb421bff66bcd722d1d |
class _ThreadThroughputInformation(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.total_bytes_transferred = 0 <NEW_LINE> self.total_elapsed_time = 0 <NEW_LINE> self.task_start_time = None <NEW_LINE> self.task_size = None <NEW_LINE> <DEDENT> def LogTaskStart(self, start_time, bytes_to_transfer... | A class to keep track of throughput information for a single thread. | 62598fb47047854f4633f490 |
class TutorForm(forms.ModelForm): <NEW_LINE> <INDENT> rate = forms.DecimalField(widget=forms.NumberInput(attrs={'placeholder': '24.00', })) <NEW_LINE> bio = forms.CharField(widget=forms.Textarea( attrs={'placeholder': 'This is your resume. Be very descriptive and describe yourself to prospective pupils.', 'class': 'md-... | Main elements of the Tutor Form | 62598fb4ff9c53063f51a703 |
class DatasetSchema(SchemaObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.schema = 'Dataset' | Schema Mixin for Dataset
Usage: place after django model in class definition, schema will return the schema.org url for the object
A body of structured information describing some topic(s) of interest. | 62598fb4be383301e02538b1 |
class ARCommand: <NEW_LINE> <INDENT> def __init__(self, cmdName): <NEW_LINE> <INDENT> self.name = cmdName <NEW_LINE> self.comments = [] <NEW_LINE> self.args = [] <NEW_LINE> self.buf = ARCommandBuffer.ACK <NEW_LINE> self.timeout = ARCommandTimeoutPolicy.POP <NEW_LINE> self.listtype = ARCommandListType.NONE... | Represent a command | 62598fb47047854f4633f491 |
class RemoteFxTestCase(optional_feature._OptionalFeatureMixin, test_base.TestBase): <NEW_LINE> <INDENT> _MIN_HYPERV_VERSION = 6003 <NEW_LINE> _FEATURE_FLAVOR = {'extra_specs': {'os_resolution': '1920x1200', 'os_monitors': '1', 'os_vram': '1024'}} <NEW_LINE> @classmethod <NEW_LINE> def skip_checks(cls): <NEW_LINE> <INDE... | RemoteFX test suite.
This test suit will spawn instances with RemoteFX enabled. | 62598fb4379a373c97d990cb |
class SystemHealthStory(page.Page): <NEW_LINE> <INDENT> __metaclass__ = _MetaSystemHealthStory <NEW_LINE> NAME = NotImplemented <NEW_LINE> URL = NotImplemented <NEW_LINE> ABSTRACT_STORY = True <NEW_LINE> SUPPORTED_PLATFORMS = platforms.ALL_PLATFORMS <NEW_LINE> def __init__(self, story_set, take_memory_measurement): <NE... | Abstract base class for System Health user stories. | 62598fb4f548e778e596b659 |
class TpsError(TpsException): <NEW_LINE> <INDENT> pass | error, continue remaining tests in test suite | 62598fb492d797404e388bbe |
class PanValidationSnippet(PanosSnippet): <NEW_LINE> <INDENT> required_metadata = {'name'} <NEW_LINE> optional_metadata = {'documentation_link': ''} <NEW_LINE> template_metadata = {'label', 'test', 'meta'} <NEW_LINE> conditional_template_metadata = {'test'} <NEW_LINE> def execute(self, context: dict) -> Tuple[str, str]... | Pan validation Snippet | 62598fb43d592f4c4edbaf76 |
@attr.s <NEW_LINE> class MutationContext(object): <NEW_LINE> <INDENT> mutations = attr.ib(factory=dict, converter=mutations_list_to_dict) <NEW_LINE> message_path = attr.ib(factory=list) <NEW_LINE> protocol_session = attr.ib(type=ProtocolSession, default=None) | Context for current mutation(s).
MutationContext objects are created by Session (the fuzz session manager) and passed to various Fuzzable functions
as needed.
For complex Fuzzable types that refer to other elements' rendered values, the implementation will typically pass
the MutationContext along to child/referenced ... | 62598fb430dc7b766599f902 |
class TestCollector(base.AutomatedTest): <NEW_LINE> <INDENT> platforms = ["Windows"] <NEW_LINE> flow = "ArtifactCollectorFlow" <NEW_LINE> args = {"artifact_list": ["WindowsRunKeys"], "store_results_in_aff4": False} <NEW_LINE> def CheckFlow(self): <NEW_LINE> <INDENT> statentry_list = self.CheckCollectionNotEmptyWithRetr... | Test ArtifactCollectorFlow. | 62598fb4fff4ab517ebcd89b |
class Template: <NEW_LINE> <INDENT> def __init__(self, template=None, description=None): <NEW_LINE> <INDENT> self.template = template <NEW_LINE> self.description = description <NEW_LINE> <DEDENT> def save(self, output_path): <NEW_LINE> <INDENT> with open(output_path, 'w') as f: <NEW_LINE> <INDENT> f.write(to_json(self.... | A couple of files describing a dicom template. Makes is easy to save a
human readable description together with the template | 62598fb47d847024c075c473 |
class ImageType(object): <NEW_LINE> <INDENT> BASE = 'base' <NEW_LINE> IMPORT = 'import' <NEW_LINE> SNAPSHOT = 'snapshot' | @summary: Types denoting an Image's type | 62598fb4be7bc26dc9251eb7 |
class StoreLoggerFilter(Filter): <NEW_LINE> <INDENT> def __init__(self, storage_url): <NEW_LINE> <INDENT> self.store = storage.create_store(storage_url, storage.REQUEST_LOG_STORE) <NEW_LINE> <DEDENT> def do_filter(self, query): <NEW_LINE> <INDENT> _LOG.debug("Logging query for %s", query) <NEW_LINE> record = { "query":... | A filter that will record all hostnames it receives into a store. | 62598fb460cbc95b063643fb |
class Solution: <NEW_LINE> <INDENT> def count(self,s): <NEW_LINE> <INDENT> t=''; count=0; curr='#' <NEW_LINE> for i in s: <NEW_LINE> <INDENT> if i!=curr: <NEW_LINE> <INDENT> if curr!='#': <NEW_LINE> <INDENT> t+=str(count)+curr <NEW_LINE> <DEDENT> curr=i <NEW_LINE> count=1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> c... | @param: n: the nth
@return: the nth sequence | 62598fb423849d37ff85116a |
class ConfigFileParser(object): <NEW_LINE> <INDENT> def get_syntax_description(self): <NEW_LINE> <INDENT> raise NotImplementedError("get_syntax_description(..) not implemented") <NEW_LINE> <DEDENT> def parse(self, stream): <NEW_LINE> <INDENT> raise NotImplementedError("parse(..) not implemented") <NEW_LINE> <DEDENT> de... | This abstract class can be extended to add support for new config file
formats | 62598fb4ec188e330fdf8945 |
@dataclass <NEW_LINE> class Assets(ComplexProperty): <NEW_LINE> <INDENT> alias: type = list <NEW_LINE> properties: dict = field( default_factory=lambda: { "id": { "property": StringProperty, "description": ("Id (Cod. ref.) do ativo (Somente leitura)."), "readOnly": True, }, "name": { "property": StringProperty, "descri... | Tickets » Ativos
Classe que representa o campo assets. | 62598fb4a219f33f346c68bb |
@attr.s <NEW_LINE> class DeviceValue(DeviceEvent): <NEW_LINE> <INDENT> attribute = attr.ib() <NEW_LINE> value = attr.ib() | The device poll has read a value. | 62598fb430bbd722464699d4 |
class Face(FrozenClass): <NEW_LINE> <INDENT> def __init__(self, initial_indices=np.array([-1, -1, -1], dtype=int)): <NEW_LINE> <INDENT> self.vertex_indices = np.array(initial_indices, dtype=int) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return str(self.vertex_indices) | NOT TO CONFUSE WITH A REAL TRIANGLE (A FACE SAVES ONLY VERTEX INDICES, NO 3D INFORMATION) | 62598fb45fcc89381b2661a7 |
class OpenCompressedTestCase(TestCase): <NEW_LINE> <INDENT> net = False <NEW_LINE> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> super(OpenCompressedTestCase, cls).setUpClass() <NEW_LINE> cls.base_file = os.path.join(_xml_data_dir, 'article-pyrus.xml') <NEW_LINE> with open(cls.base_file, 'rb') as f: ... | Unit test class for tools.
The tests for open_compressed requires that article-pyrus.xml* contain all
the same content after extraction. The content itself is not important.
The file article-pyrus.xml_invalid.7z is not a valid 7z file and
open_compressed will fail extracting it using 7za. | 62598fb4aad79263cf42e889 |
class BaseMiddleware(object): <NEW_LINE> <INDENT> def __init__(self, name, config, worker): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.config = config <NEW_LINE> self.worker = worker <NEW_LINE> <DEDENT> def setup_middleware(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def teardown_middleware(self): <NE... | Common middleware base class.
This is a convenient definition of and set of common functionality
for middleware classes. You need not subclass this and should not
instantiate this directly.
The :meth:`__init__` method should take exactly the following
options so that your class can be instantiated from configuration
... | 62598fb43d592f4c4edbaf77 |
class EmailAddTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.user = User.objects.create_user('add', 'add@example.com', '1pass') <NEW_LINE> <DEDENT> def test_email_add(self): <NEW_LINE> <INDENT> retval = self.client.login(username='add', password='1pass') <NEW_LINE> self.assertTrue(ret... | Tests for Django emailmgr -- Add Email | 62598fb432920d7e50bc610b |
class HiddenLayer: <NEW_LINE> <INDENT> def __init__( self, inp, n_inp, n_out, activation_f=tensor.tanh, w_init_f="xavier_tanh", reg="l2", rand_state=42): <NEW_LINE> <INDENT> if isinstance(w_init_f, str): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> w_init_f = _W_INIT_METHODS[w_init_f] <NEW_LINE> <DEDENT> except KeyErro... | Hidden Layer for Multi Layer Perceptron. | 62598fb463d6d428bbee2864 |
class KeyBase(object): <NEW_LINE> <INDENT> def __init__(self, options): <NEW_LINE> <INDENT> self.options = options <NEW_LINE> <DEDENT> def get_key(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def initialize(self, ve): <NEW_LINE> <INDENT> raise NotImplementedError | Base class for representing a specific distinguishible kind of
a virtual environment. | 62598fb47cff6e4e811b5ad6 |
class CLI: <NEW_LINE> <INDENT> def run(): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description="Simple one domain web crawler by Jonathan Harden") <NEW_LINE> parser.add_argument( "domain", help="Domain to crawl (will not leave the subdomain specified and will ignore any path part)", ) <NEW_LINE> parser.add_... | Coordinating class to run the CLI
| 62598fb460cbc95b063643fc |
class MockCreationError(ValueError): <NEW_LINE> <INDENT> pass | Exception raised when a mock value cannot be generated. | 62598fb4091ae35668704cd6 |
class MultiBoxCoder(): <NEW_LINE> <INDENT> def __init__(self, grids, aspect_ratios, steps, sizes, variance=(0.1, 0.2)): <NEW_LINE> <INDENT> if not len(aspect_ratios) == len(grids): <NEW_LINE> <INDENT> raise ValueError('The length of aspect_ratios is wrong.') <NEW_LINE> <DEDENT> if not len(steps) == len(grids): <NEW_LIN... | partially taken from src/detector/model/multibox_decoder | 62598fb438b623060ffa9154 |
class InvalidValueError(Exception): <NEW_LINE> <INDENT> pass | An invalid value for a given parameter was used | 62598fb44f6381625f19951c |
class BaseDirective(Directive): <NEW_LINE> <INDENT> has_content = True <NEW_LINE> final_argument_whitespace = True <NEW_LINE> def _make_header(self, name, title=False): <NEW_LINE> <INDENT> line = "\n" + "-" * len(name) + "\n" <NEW_LINE> if title: <NEW_LINE> <INDENT> return line + name + line <NEW_LINE> <DEDENT> else: <... | Contains shared functionality for Mantid custom directives. | 62598fb467a9b606de546086 |
class DidaticosDetailForm(ModelForm): <NEW_LINE> <INDENT> _model_class = Didaticos <NEW_LINE> _include = [Didaticos.creation, Didaticos.Autor, Didaticos.preco, Didaticos.titulo, Didaticos.edicao, Didaticos.descricao, Didaticos.editora] | Form used to show entity details on app's admin page | 62598fb4498bea3a75a57bd7 |
class LikeThisShizzleView(BrowserView): <NEW_LINE> <INDENT> def __call__(self, REQUEST, RESPONSE): <NEW_LINE> <INDENT> registry = getUtility(IRegistry) <NEW_LINE> anonuid = None <NEW_LINE> anonymous_voting = registry.get('cioppino.twothumbs.anonymousvoting', False) <NEW_LINE> portal_state = getMultiAdapter((self.contex... | Update the like/unlike status of a product via AJAX | 62598fb4ff9c53063f51a705 |
class WeConnectApiTestBase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.app = app <NEW_LINE> self.client = self.app.test_client() <NEW_LINE> self.prefix = '/api/v2/' <NEW_LINE> self.users = { 'one': {"first_name": "jack", "last_name": "dan", "username": "jackdan", "password": "password"}, 't... | Test user api logic | 62598fb43d592f4c4edbaf78 |
class EnvironmentWrapper(Environment): <NEW_LINE> <INDENT> def __init__(self, base_environment): <NEW_LINE> <INDENT> self._base = base_environment <NEW_LINE> self._orig_env = base_environment._orig_env <NEW_LINE> <DEDENT> @property <NEW_LINE> def dt(self): <NEW_LINE> <INDENT> return self._base.dt <NEW_LINE> <DEDENT> @p... | A base class for environment wrappers which can alter the behavior of a given
base environment. The base implementation maintains the behavior of
the base environment. | 62598fb45fdd1c0f98e5e046 |
class ModelGridRow(BaseNotifier): <NEW_LINE> <INDENT> def __init__(self, model): <NEW_LINE> <INDENT> super(ModelGridRow, self).__init__() <NEW_LINE> self.model = model <NEW_LINE> self.value = self.model.get_value() <NEW_LINE> self.short_value = self.value[0:100] <NEW_LINE> self.doc = '' <NEW_LINE> self._row_selected = ... | base subview item for the datagrid
holds the value and doc given by model
and binds the model datas | 62598fb457b8e32f52508178 |
class SRComp: <NEW_LINE> <INDENT> def __init__(self, root: Union[str, Path]) -> None: <NEW_LINE> <INDENT> self.root = Path(root) <NEW_LINE> self.state = check_output( ('git', 'rev-parse', 'HEAD'), universal_newlines=True, cwd=str(self.root), ).strip() <NEW_LINE> self.teams = teams.load_teams(self.root / 'teams.yaml') <... | A class containing all the various parts of a competition.
:param Path root: The root path of the ``compstate`` repo. | 62598fb4adb09d7d5dc0a644 |
class QueryWrapper(object): <NEW_LINE> <INDENT> def __init__(self, sql, params): <NEW_LINE> <INDENT> self.data = sql, list(params) <NEW_LINE> <DEDENT> def asSql(self, qn=None, connection=None): <NEW_LINE> <INDENT> return self.data | A type that indicates the contents are an SQL fragment and the associate
parameters. Can be used to pass opaque data to a where-clause, for example. | 62598fb48a43f66fc4bf2232 |
class AsyncUpcomingLaunch(UpcomingLaunch, BaseAsync): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> async def next(cls, network: Network, num: int): <NEW_LINE> <INDENT> return await cls.fetch(network) | A class representing an upcoming launch object. | 62598fb4236d856c2adc949b |
class SpotifyPlaylist(Resource): <NEW_LINE> <INDENT> __tablename__ = 'spotify_Playlists' <NEW_LINE> owner_uri = Column('owner_uri', String) <NEW_LINE> raw_uri = Column('raw_uri', String) <NEW_LINE> snapshot_id = Column('snapshot_id', String) <NEW_LINE> total_tracks = Column('total_tracks', Integer) <NEW_LINE> followers... | [ Playlist resources in Spotify ]
| 62598fb4ec188e330fdf8947 |
class UserGrantedAssetsApi(RootOrgViewMixin, ListAPIView): <NEW_LINE> <INDENT> permission_classes = (IsOrgAdminOrAppUser,) <NEW_LINE> serializer_class = AssetGrantedSerializer <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> user_id = self.kwargs.get('pk', '') <NEW_LINE> queryset = [] <NEW_LINE> if user_id: <NEW_... | 用户授权的所有资产 | 62598fb432920d7e50bc610c |
class NUSimEnterprise(NUSimResource): <NEW_LINE> <INDENT> __vspk_class__ = vsdk.NUEnterprise <NEW_LINE> __unique_fields__ = ['externalID'] <NEW_LINE> __mandatory_fields__ = ['name'] <NEW_LINE> __default_fields__ = { 'VNFManagementEnabled': False, 'dictionaryVersion': 2, 'virtualFirewallRulesEnabled': False, 'flowCollec... | Represents a Enterprise
Notes:
Definition of the enterprise object. This is the top level object that represents an enterprise. | 62598fb4a219f33f346c68bd |
class PosteriorMean(Mean): <NEW_LINE> <INDENT> def __init__(self, m_i, m_z, k_zi, z, K_z, y): <NEW_LINE> <INDENT> self.m_i = m_i <NEW_LINE> self.m_z = m_z <NEW_LINE> self.k_zi = k_zi <NEW_LINE> self.z = z <NEW_LINE> self.K_z = convert(K_z, AbstractMatrix) <NEW_LINE> self.y = B.uprank(y) <NEW_LINE> <DEDENT> @_dispatch <... | Posterior mean.
Args:
m_i (:class:`.mean.Mean`): Mean of process corresponding to the input.
m_z (:class:`.mean.Mean`): Mean of process corresponding to the data.
k_zi (:class:`.kernel.Kernel`): Kernel between processes corresponding to the
data and the input respectively.
z (input): Locations ... | 62598fb430bbd722464699d5 |
class FallaAutenticacion(Falla): <NEW_LINE> <INDENT> def __init__(self, resultado, prompt): <NEW_LINE> <INDENT> self.resultado = resultado <NEW_LINE> self.prompt = prompt <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> err = "La contraseña enviada para solicitar {!r} fue rechazada." <NEW_LINE> return err.for... | Una falla de autenticación, p. Ej. debido a contraseña ``sudo`` incorrecta.
.. note::
Los objetos `.Resultado` adjuntos a estas excepciones generalmente
carecen de información de código de salida, ya que el comando nunca
se ejecutó por completo; en su lugar, se generó la excepción.
.. versionadded:: 1.0 | 62598fb43539df3088ecc36b |
class LuvColor(IlluminantMixin, ColorBase): <NEW_LINE> <INDENT> VALUES = ['luv_l', 'luv_u', 'luv_v'] <NEW_LINE> def __init__(self, luv_l, luv_u, luv_v, observer='2', illuminant='d50'): <NEW_LINE> <INDENT> super(LuvColor, self).__init__() <NEW_LINE> self.luv_l = float(luv_l) <NEW_LINE> self.luv_u = float(luv_u) <NEW_LIN... | Represents an Luv color. | 62598fb4be8e80087fbbf11f |
class TestingReport(View): <NEW_LINE> <INDENT> testing_report_views = { None: TestingReportByCaseRunTester, 'per_build_report': TestingReportByCaseRunTester, 'per_priority_report': TestingReportByCasePriority, 'runs_with_rates_per_plan_tag': TestingReportByPlanTags, 'per_plan_tag_report': TestingReportByPlanTagsDetail,... | Dispatch testing report according to report type | 62598fb44a966d76dd5eef90 |
class MetaCycle(Cycle): <NEW_LINE> <INDENT> def __init__(self, *class_argument_pair: tuple): <NEW_LINE> <INDENT> super().__init__(class_argument_pair) <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LINE> <INDENT> return "Meta{}".format(super().__repr__()) <NEW_LINE> <DEDENT> def __next__(self) -> InfIt: <NEW_LINE>... | Infinite cycle that dynamically builds new InfIt objects when it get called. | 62598fb4851cf427c66b836f |
class TestCase(unittest.TestCase): <NEW_LINE> <INDENT> def _test_expected_links(self, graph, expected_links): <NEW_LINE> <INDENT> found = 0 <NEW_LINE> for link in graph['links']: <NEW_LINE> <INDENT> tuple_link = (link['source'], link['target']) <NEW_LINE> for expected_link in expected_links: <NEW_LINE> <INDENT> if set(... | netdiff TestCase | 62598fb401c39578d7f12e32 |
class SmartMeterTexasSensor(CoordinatorEntity, RestoreEntity, SensorEntity): <NEW_LINE> <INDENT> _attr_unit_of_measurement = ENERGY_KILO_WATT_HOUR <NEW_LINE> def __init__(self, meter: Meter, coordinator: DataUpdateCoordinator) -> None: <NEW_LINE> <INDENT> super().__init__(coordinator) <NEW_LINE> self.meter = meter <NEW... | Representation of an Smart Meter Texas sensor. | 62598fb44c3428357761a373 |
class Interface(_Item): <NEW_LINE> <INDENT> def __init__(self, name=None): <NEW_LINE> <INDENT> super(Interface, self).__init__(name) <NEW_LINE> self.addresses = [] | A network interface | 62598fb45166f23b2e243494 |
class AdditiveGaussNoise(object): <NEW_LINE> <INDENT> def __init__(self, mean, std): <NEW_LINE> <INDENT> self.mean = mean <NEW_LINE> self.std = std <NEW_LINE> <DEDENT> def corrupt(self, data): <NEW_LINE> <INDENT> return data + self.mean + numx.random.standard_normal(data.shape) * self.std | An object that corrupts data by adding Gauss noise.
| 62598fb463d6d428bbee2866 |
class Think(System): <NEW_LINE> <INDENT> entity_filters = { 'constant': and_filter([ CharacterController, ConstantCharacterAI, ]), 'brownian_walker': and_filter([ CharacterController, BrownianWalkerAI, ]), } <NEW_LINE> def update(self, entities_by_filter): <NEW_LINE> <INDENT> for entity in entities_by_filter['constant'... | A System updating AI components. | 62598fb467a9b606de546089 |
class Student: <NEW_LINE> <INDENT> def __init__(self, first_name, second_name, age): <NEW_LINE> <INDENT> self.first_name = first_name <NEW_LINE> self.second_name = second_name <NEW_LINE> self.age = age <NEW_LINE> <DEDENT> def to_json(self, attrs=None): <NEW_LINE> <INDENT> return self.__dict__ | Student class
| 62598fb4498bea3a75a57bd9 |
class NetInfo(Monitor): <NEW_LINE> <INDENT> _module = "NET" <NEW_LINE> _purpose = "INFO" <NEW_LINE> _option = ";-l;-k" <NEW_LINE> def __init__(self, user=None): <NEW_LINE> <INDENT> Monitor.__init__(self, user) <NEW_LINE> self.__cmd = "ethtool" <NEW_LINE> <DEDENT> def _get(self, para): <NEW_LINE> <INDENT> opts = self._g... | To collect the nic config info | 62598fb426068e7796d4ca10 |
class common_cleanup(aetest.CommonCleanup): <NEW_LINE> <INDENT> @aetest.subsection <NEW_LINE> def disconnect(self, steps, dist1): <NEW_LINE> <INDENT> with steps.start('Disconnecting from dist1'): <NEW_LINE> <INDENT> dist1.disconnect() | disconnect from ios routers | 62598fb444b2445a339b69cf |
class ApplicationGatewayProbe(SubResource): <NEW_LINE> <INDENT> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'etag': {'key': 'etag', 'type': 'str'}, 'protocol': {'key': 'properties.protocol', 'type': 'str'}, 'host': {'key': 'properties.host', 'type': 'str'}, 'path': {'k... | Probe of the application gateway.
:param id: Resource ID.
:type id: str
:param name: Name of the resource that is unique within a resource group. This name can be used
to access the resource.
:type name: str
:param etag: A unique read-only string that changes whenever the resource is updated.
:type etag: str
:param p... | 62598fb4adb09d7d5dc0a646 |
class TestGatewayAppConfig(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.environ = dict(os.environ) <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> os.environ = self.environ <NEW_LINE> <DEDENT> def test_config_env_vars(self): <NEW_LINE> <INDENT> os.environ['KG_PORT'] = '1... | Tests configuration of the gateway app. | 62598fb4009cb60464d015db |
class SyncGit: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.repo = Repo(settings.GITHUB_PAGE_DIR) <NEW_LINE> <DEDENT> def sync(self, add_all=True, commit='add post', name='origin'): <NEW_LINE> <INDENT> if not settings.GITHUB_PAGE: <NEW_LINE> <INDENT> return False, 'Do not enable GITHUB_PAGE' <NEW_LI... | Git上传, 需要有对应setting里的项目目录, 且可以经过ssh上传github | 62598fb4be7bc26dc9251eb9 |
@widgets.register <NEW_LINE> class ImageGL(bqplot.Mark): <NEW_LINE> <INDENT> _view_name = Unicode('ImageGLView').tag(sync=True) <NEW_LINE> _model_name = Unicode('ImageGLModel').tag(sync=True) <NEW_LINE> _view_module = Unicode('bqplot-image-gl').tag(sync=True) <NEW_LINE> _model_module = Unicode('bqplot-image-gl').tag(sy... | An example widget. | 62598fb40fa83653e46f4f99 |
class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): <NEW_LINE> <INDENT> VERSION = 1 <NEW_LINE> async def async_step_system(self, user_input=None): <NEW_LINE> <INDENT> await self.async_set_unique_id(DOMAIN) <NEW_LINE> self._abort_if_unique_id_configured() <NEW_LINE> return self.async_create_entry(title="Supervis... | Handle a config flow for Home Assistant Supervisor. | 62598fb4cc40096d6161a236 |
class NaiveBayes(Classifier): <NEW_LINE> <INDENT> def __init__(self, getfeatures, filename=None): <NEW_LINE> <INDENT> return super(NaiveBayes, self).__init__(getfeatures, filename) <NEW_LINE> <DEDENT> def docprob(self, item, cat): <NEW_LINE> <INDENT> features = self.getfeatures(item) <NEW_LINE> p = 1 <NEW_LINE> for f i... | Subclass of Classifier for calculating the entire document probability.
| 62598fb4851cf427c66b8370 |
@unique <NEW_LINE> class Mp4VideoMetrics(Enum): <NEW_LINE> <INDENT> LAP_COUNTER = 'lap_counter' <NEW_LINE> COMPLETION_PERCENTAGE = 'completion_percentage' <NEW_LINE> RESET_COUNTER = 'reset_counter' <NEW_LINE> CRASH_COUNTER = 'crash_counter' <NEW_LINE> THROTTLE = 'throttle' <NEW_LINE> STEERING = 'steering' <NEW_LINE> BE... | This enum is used for gathering the video metrics displayed on the mp4 | 62598fb4a79ad1619776a125 |
class CustomerFollowUp(models.Model): <NEW_LINE> <INDENT> customer = models.ForeignKey(to='Customer', verbose_name='客户名') <NEW_LINE> content = models.TextField(verbose_name='跟进内容') <NEW_LINE> consultant = models.ForeignKey(to='UserProfile', verbose_name='咨询顾问') <NEW_LINE> date = models.DateTimeField(auto_now_add=True, ... | 客户跟进表 | 62598fb4dc8b845886d53671 |
class Yokoshi(TimeStampedModel): <NEW_LINE> <INDENT> OMITAMA_LEVEL = Choices(('none', _('none_omitama_level')), ('basic', _('basic_omitama_level')), ('intermediate', _('intermediate_omitama_level')), ('advanced', _('advanced_omitama_level'))) <NEW_LINE> user = models.OneToOneField(settings.AUTH_USER_MODEL, null=True, b... | A yokoshi registry. Contains basic information for person identification,
search, localization and contact. Can be linked with a django User too. | 62598fb44a966d76dd5eef92 |
class dummy_context_mgr(): <NEW_LINE> <INDENT> def __enter__(self): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> def __exit__(self, one, two, three): <NEW_LINE> <INDENT> return False | a fake context for plotting without style
perhaps made obsolete by 'classic' style in new mpl | 62598fb456ac1b37e63022a5 |
class TooManyConnectionsError(DatabaseError): <NEW_LINE> <INDENT> pass | Превышение ограничения количества соединений с MySQL | 62598fb432920d7e50bc610e |
class MCP3204(MCP32xx): <NEW_LINE> <INDENT> def __init__(self, channel=0, differential=False, **spi_args): <NEW_LINE> <INDENT> if not 0 <= channel < 4: <NEW_LINE> <INDENT> raise SPIBadChannel('channel must be between 0 and 3') <NEW_LINE> <DEDENT> super(MCP3204, self).__init__(channel, differential, **spi_args) | The `MCP3204`_ is a 12-bit analog to digital converter with 4 channels
(0-3).
.. _MCP3204: http://www.farnell.com/datasheets/808967.pdf | 62598fb423849d37ff85116e |
class UpdateEntityType(BaseScript): <NEW_LINE> <INDENT> def __init__(self, argv: Sequence[str], description: str): <NEW_LINE> <INDENT> super().__init__(argv, description) <NEW_LINE> self.parser.add_argument( "--name", required=True, type=str, help="The resource name of the entity type, for example 'entityTypes/ns.brand... | Update an entity type. | 62598fb4442bda511e95c513 |
class Kill(ChaosMonkeyBase): <NEW_LINE> <INDENT> jujud_cmd = 'kill-jujud' <NEW_LINE> mongod_cmd = 'kill-mongod' <NEW_LINE> restart_cmd = 'restart-unit' <NEW_LINE> group = 'kill' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super(Kill, self).__init__() <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def factory(cls): ... | Kill processes including shutting down a machine and restarting. | 62598fb456ac1b37e63022a6 |
class EvaluationError(Exception): <NEW_LINE> <INDENT> pass | Exception raised when there's a problem evaluating the expression. | 62598fb499cbb53fe6830f90 |
class PyPycrypto(PythonPackage): <NEW_LINE> <INDENT> homepage = "https://www.dlitz.net/software/pycrypto/" <NEW_LINE> url = "https://pypi.io/packages/source/p/pycrypto/pycrypto-2.6.1.tar.gz" <NEW_LINE> version('2.6.1', '55a61a054aa66812daf5161a0d5d7eda') <NEW_LINE> depends_on('gmp') | The Python Cryptography Toolkit | 62598fb4498bea3a75a57bdc |
class WinkDevice(Entity): <NEW_LINE> <INDENT> def __init__(self, wink, hass): <NEW_LINE> <INDENT> self.wink = wink <NEW_LINE> self._battery = self.wink.battery_level <NEW_LINE> hass.data[DOMAIN]['pubnub'].add_subscription( self.wink.pubnub_channel, self._pubnub_update) <NEW_LINE> hass.data[DOMAIN]['entities'].append(se... | Representation a base Wink device. | 62598fb467a9b606de54608a |
class Rectangle: <NEW_LINE> <INDENT> def __init__(self, width=0, height=0): <NEW_LINE> <INDENT> if type(width) != int: <NEW_LINE> <INDENT> raise TypeError("width must be an integer") <NEW_LINE> <DEDENT> if type(height) != int: <NEW_LINE> <INDENT> raise TypeError("height must be an integer") <NEW_LINE> <DEDENT> if width... | Class Rectangle
Creates a new Rectangle
Attributes:
__width: width size of the rectangle
__height: height size of the rectangle | 62598fb460cbc95b06364400 |
class Netscan(common.AbstractScanCommand): <NEW_LINE> <INDENT> scanners = [PoolScanUdpEndpoint, PoolScanTcpListener, PoolScanTcpEndpoint] <NEW_LINE> @staticmethod <NEW_LINE> def is_valid_profile(profile): <NEW_LINE> <INDENT> return (profile.metadata.get('os', 'unknown') == 'windows' and profile.metadata.get('major', 0)... | Scan a Vista (or later) image for connections and sockets | 62598fb4f548e778e596b65f |
class SentimentNet(Block): <NEW_LINE> <INDENT> def __init__(self, dropout, use_mean_pool=False, prefix=None, params=None): <NEW_LINE> <INDENT> super(SentimentNet, self).__init__(prefix=prefix, params=params) <NEW_LINE> self._use_mean_pool = use_mean_pool <NEW_LINE> with self.name_scope(): <NEW_LINE> <INDENT> self.embed... | Network for sentiment analysis. | 62598fb4e1aae11d1e7ce882 |
class CertificateList(client_extension.List, CertificateExtension): <NEW_LINE> <INDENT> shell_command = 'a10-certificate-list' <NEW_LINE> list_columns = ['id', 'name', 'description'] | List A10 SSL Certificates | 62598fb430dc7b766599f908 |
class KNearestNeighbor(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def train(self, X, y): <NEW_LINE> <INDENT> self.X_train = X <NEW_LINE> self.y_train = y <NEW_LINE> <DEDENT> def predict(self, X, k=1, num_loops=0): <NEW_LINE> <INDENT> if num_loops == 0: <NEW_LINE> <INDE... | a kNN classifier with L2 distance | 62598fb4167d2b6e312b702e |
class CountSamples(NumpyBasedTraceStep): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def GetInterfaceRevision(): <NEW_LINE> <INDENT> return 1 <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def GetDescription(cls): <NEW_LINE> <INDENT> return 'Counts samples of the given signal and checks, whether the count lies between mi... | This is an implementation of NumpyBasedTraceStep.
Use the interface as reference of available methods. Abstract methods have to be implemented.
Other methods like GetDescription() are optionally overwritten. There are utility functions
like CalculateRanges(), FitToAxis() that can be used in your code. | 62598fb499fddb7c1ca62e48 |
class ConfidenceIntervalHalfVT(FloatValue): <NEW_LINE> <INDENT> role = ROLE.ERROR <NEW_LINE> vt_code = 'ci' <NEW_LINE> def __init__(self,v): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @property <NEW_LINE> def se(self): <NEW_LINE> <INDENT> pass | An upper or lower half of a confidence interval | 62598fb43539df3088ecc36e |
class GeneralizedSigmoidScientific(equations_data.GeneralizedSigmoidData, EquationScientific): <NEW_LINE> <INDENT> pass | This class exists to add scientific methods to GeneralizedSigmoidData | 62598fb43317a56b869be5aa |
class Math: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def abs(x: Union[int, float]) -> Union[int, float]: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def exp(x: Union[int, float]) -> Union[int, float]: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def sign(x: Union[i... | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math | 62598fb416aa5153ce4005bf |
@total_ordering <NEW_LINE> class Point: <NEW_LINE> <INDENT> def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> <DEDENT> def __add__(self, other): <NEW_LINE> <INDENT> return Point(self.x + other.x, self.y + other.y) <NEW_LINE> <DEDENT> def __sub__(self, other): <NEW_LINE> <INDENT> ... | Simple 2-dimensional point. | 62598fb47047854f4633f497 |
class Softmax: <NEW_LINE> <INDENT> def regularization_loss(self, W): <NEW_LINE> <INDENT> return np.sum(np.square(W)) <NEW_LINE> <DEDENT> def compute_loss(self, scores, correct_class, W=[]): <NEW_LINE> <INDENT> shifted_scores = scores - np.max(scores) <NEW_LINE> num = np.exp(shifted_scores[correct_class]) <NEW_LINE> den... | Class computes softmax loss and gradient | 62598fb4be8e80087fbbf123 |
class StorageValidationTasksTestCase(unittest.TestCase): <NEW_LINE> <INDENT> @patch('pyanaconda.modules.storage.partitioning.validate.storage_checker') <NEW_LINE> def test_validation(self, storage_checker): <NEW_LINE> <INDENT> storage = Mock() <NEW_LINE> report = StorageCheckerReport() <NEW_LINE> storage_checker.check.... | Test the storage validation tasks. | 62598fb410dbd63aa1c70c72 |
class Terrain(object): <NEW_LINE> <INDENT> MAX_X = 128 <NEW_LINE> MAX_Y = 128 <NEW_LINE> MAX_Z = 128 <NEW_LINE> points = {} <NEW_LINE> noise = {} <NEW_LINE> def generateTerrain(self): <NEW_LINE> <INDENT> self.generateNoise() <NEW_LINE> <DEDENT> def generateNoise(self): <NEW_LINE> <INDENT> indX = 0 <NEW_LINE> while (ind... | The terrain object automatically generates terrain using fractals | 62598fb401c39578d7f12e36 |
class DescribeInstanceVncUrlRequest(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.InstanceId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.InstanceId = params.get("InstanceId") | DescribeInstanceVncUrl请求参数结构体
| 62598fb45fc7496912d482da |
class Solution: <NEW_LINE> <INDENT> def maxCount(self, m, n, ops): <NEW_LINE> <INDENT> for op in ops: <NEW_LINE> <INDENT> m = min(m, op[0]) <NEW_LINE> n = min(n, op[1]) <NEW_LINE> <DEDENT> return m * n | @param m: an integer
@param n: an integer
@param ops: List[List[int]]
@return: return an integer | 62598fb4851cf427c66b8373 |
class HBaseRegionServerInfo(ComponentInfo): <NEW_LINE> <INDENT> implements(IHBaseRegionServerInfo) <NEW_LINE> adapts(HBaseRegionServer) <NEW_LINE> start_code = ProxyProperty('start_code') <NEW_LINE> is_alive = ProxyProperty('is_alive') <NEW_LINE> region_name = ProxyProperty('region_name') <NEW_LINE> handler_count = Pro... | API Info adapter factory for HBaseRegionServer | 62598fb42ae34c7f260ab198 |
class Session(): <NEW_LINE> <INDENT> def __init__(self, addr, peer_addr, secret): <NEW_LINE> <INDENT> self.addr = addr <NEW_LINE> self.peer_addr = peer_addr <NEW_LINE> self.secret = secret <NEW_LINE> self._phash = None <NEW_LINE> self.valid = False <NEW_LINE> self.nonce = rand_str(40) <NEW_LINE> <DEDENT> def get_hash(s... | Session for single client
- recv nonce, send hash = get_hash(peer_nonce)
- send nonce, recv hash = authenticate(_hash)
- enc/dec secret + peer_addr + my_nonce | 62598fb423849d37ff851170 |
class axisDesc : <NEW_LINE> <INDENT> def __init__(self, axis) : <NEW_LINE> <INDENT> self.axis = axis <NEW_LINE> self.value = None <NEW_LINE> <DEDENT> def __set__(self, instance, value) : <NEW_LINE> <INDENT> if value in self.axis.values : <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> elif isinstance(value,... | Read/write model of axis for cursor | 62598fb43d592f4c4edbaf7d |
@dataclass_json(letter_case=LetterCase.CAMEL) <NEW_LINE> @dataclass <NEW_LINE> class ClusterSpec: <NEW_LINE> <INDENT> settings: Settings <NEW_LINE> topology: Topology = Topology() <NEW_LINE> distribution: Distribution = Distribution() | Represents the cluster spec.
If dictionaries are passed as arguments, the constructor auto-converts
them into the expected class instances. | 62598fb463b5f9789fe85228 |
class IPv6Offset(types.TypeDecorator): <NEW_LINE> <INDENT> impl = types.Numeric(39, 0) <NEW_LINE> MIN_VALUE = 0 <NEW_LINE> MAX_VALUE = 340282366920938463463374607431768211456 <NEW_LINE> def load_dialect_impl(self, dialect): <NEW_LINE> <INDENT> if _is_mysql(dialect): <NEW_LINE> <INDENT> return mysql.DECIMAL(precision=39... | IPv6 address offset. | 62598fb4a8370b77170f049a |
class QDateTime(): <NEW_LINE> <INDENT> def addDays(self, p_int): <NEW_LINE> <INDENT> return QDateTime <NEW_LINE> <DEDENT> def addMonths(self, p_int): <NEW_LINE> <INDENT> return QDateTime <NEW_LINE> <DEDENT> def addMSecs(self, p_int): <NEW_LINE> <INDENT> return QDateTime <NEW_LINE> <DEDENT> def addSecs(self, p_int): <NE... | QDateTime()
QDateTime(QDateTime)
QDateTime(QDate)
QDateTime(QDate, QTime, Qt.TimeSpec timeSpec=Qt.LocalTime)
QDateTime(int, int, int, int, int, int s=0, int msec=0, int timeSpec=0) | 62598fb456ac1b37e63022a8 |
class ClientAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ("full_name", "is_vip", "sex", "birth_date") <NEW_LINE> list_filter = ("is_vip", "sex") <NEW_LINE> fieldsets = ( ("ФИО", { "fields": (("second_name", "first_name", "middle_name"),) }), ("Статус/Пол/ДР", { "fields": (("is_vip", "sex", "birth_date"),... | Клиенты | 62598fb4f548e778e596b661 |
class ParamsError(BaseError): <NEW_LINE> <INDENT> def __init__(self, error_text): <NEW_LINE> <INDENT> super(ParamsError, self).__init__(error_text) | Parameters Error class | 62598fb4d486a94d0ba2c08f |
class ExceptionCategory(Category): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ExceptionCategory, self).__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def categorize(self, lineitem): <NEW_LINE> <INDENT> for desc in self.descriptions: <NEW_LINE> <INDENT> if desc in lineitem.descript... | ExceptionCategory will not apply fn to the lineitem if any of its
descriptions match the lineitem description. | 62598fb49c8ee823130401d1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.