code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class Token: <NEW_LINE> <INDENT> _well_formed = re.compile('^[a-z0-9-]+$') <NEW_LINE> def __init__(self, token=None, data=True): <NEW_LINE> <INDENT> if token is None: <NEW_LINE> <INDENT> token = str(uuid.uuid4()) <NEW_LINE> <DEDENT> self.token = token <NEW_LINE> self.data = data <NEW_LINE> <DEDENT> def cache_key(self):...
A simple token stored in the cache.
6259900dbf627c535bcb20bc
class CloserServerRaet(deeding.ParamDeed): <NEW_LINE> <INDENT> Ioinits = odict( connection=odict(ipath='connection', ival=None)) <NEW_LINE> def action(self, connection, **kwa): <NEW_LINE> <INDENT> if connection.value: <NEW_LINE> <INDENT> connection.value.close() <NEW_LINE> <DEDENT> return None
CloserServerRaet closes server socket connection inherited attributes .name is actor name string .store is data store ref .ioinits is dict of io init data for initio ._parametric is flag for initio to not create attributes
6259900d5166f23b2e243fe2
class CreateProbe(ProbeCommand): <NEW_LINE> <INDENT> log = logging.getLogger(__name__ + '.CreateProbe') <NEW_LINE> def get_parser(self, prog_name): <NEW_LINE> <INDENT> parser = super(CreateProbe, self).get_parser(prog_name) <NEW_LINE> parser.add_argument( 'id', metavar='network_id', help=_('ID of network to probe')) <N...
Create probe port and interface, then plug it in.
6259900d507cdc57c63a59b0
class UnicodeMixin(object): <NEW_LINE> <INDENT> if six.PY3: <NEW_LINE> <INDENT> __str__ = lambda x: x.__unicode__() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> __str__ = lambda x: unicode(x).encode('utf-8')
Python 2 and 3 string representation support.
6259900dbf627c535bcb20c2
class LIP(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def nak(message): <NEW_LINE> <INDENT> response = Message("ACK") <NEW_LINE> response.MSH.MSH_9 = "ACK" <NEW_LINE> response.MSA.MSA_1 = "AE" <NEW_LINE> response.MSA.MSA_2 = message.MSH.MSH_10 <NEW_LINE> response.MSA.MSA_3 = "Message type not supported" <NEW_...
Label information provider implementation
6259900d925a0f43d25e8c53
class Gauge(AbstractMetric): <NEW_LINE> <INDENT> def __init__(self, name, value_type, fields=(), docstring=None, units=None): <NEW_LINE> <INDENT> super().__init__( rdf_stats.MetricMetadata( varname=name, metric_type=rdf_stats.MetricMetadata.MetricType.GAUGE, value_type=stats_utils.MetricValueTypeFromPythonType(value_ty...
A Gauge metric that can be set to a value. Refer to default_stats_collector._GaugeMetric and DefaultStatsCollector to see how StatsCollector handles the field definitions and values.
6259900d21a7993f00c66b90
class Article2Tag(models.Model): <NEW_LINE> <INDENT> nid = models.AutoField(primary_key=True) <NEW_LINE> article = models.ForeignKey(verbose_name='文章',to='Article',to_field='nid',on_delete=models.CASCADE) <NEW_LINE> tag = models.ForeignKey(verbose_name='标签',to='Tag',to_field='nid',on_delete=models.CASCADE) <NEW_LINE> c...
文章和标签多对多表
6259900d21a7993f00c66b92
class BatchDeleteVideosRequest(JDCloudRequest): <NEW_LINE> <INDENT> def __init__(self, parameters, header=None, version="v1"): <NEW_LINE> <INDENT> super(BatchDeleteVideosRequest, self).__init__( '/videos:batchDelete', 'POST', header, version) <NEW_LINE> self.parameters = parameters
批量删除视频,调用该接口会同时删除与指定视频相关的所有信息,包括转码任务信息、转码流数据等,同时清除云存储中相关文件资源。
6259900d15fb5d323ce7f959
class Block(Base): <NEW_LINE> <INDENT> def __init__(self, name, *sections, **options): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.sections = AttrList(self) <NEW_LINE> self.options = AttrDict(self) <NEW_LINE> self._set_directives(*sections, **options) <NEW_LINE> <DEDENT> @property <NEW_LINE> def _directives(se...
A block represent a named section of an Nginx config, such as 'http', 'server' or 'location' Using this object is as simple as providing a name and any sections or options, which can be other Block objects or option objects. Example:: >>> from nginx.config.api import Block >>> http = Block('http', option='va...
6259900d507cdc57c63a59ba
class TChannelThriftModule(types.ModuleType): <NEW_LINE> <INDENT> def __init__(self, service, module, hostport=None): <NEW_LINE> <INDENT> self.service = service <NEW_LINE> self.module = module <NEW_LINE> self.hostport = hostport <NEW_LINE> for service_cls in self.module.services: <NEW_LINE> <INDENT> name = service_cls....
Wraps the ``thriftrw``-generated module. Wraps service classes with ``Service`` and exposes everything else from the module as-is.
6259900d21a7993f00c66b96
class DGTiling(BasicTilingBottomLeft): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(DGTiling, self).__init__(-180, -90, 180, 270) <NEW_LINE> self.bounds = CoordsBbox(-180., -90., 180., 90.) <NEW_LINE> <DEDENT> def children(self, *tile): <NEW_LINE> <INDENT> if len(tile) == 1: <NEW_LINE> <INDENT> til...
Tiler for the DG tiling scheme. The DG tiling scheme is a subdivision of the WGS84 ellipsoid. Long/lat coordinates are directly mapped to the rectange [-180, 180] and [-90, 90] in this scheme. In practice, level 0 is a square whose latitude goes from -90 to 270, so half of this square is undefined! Because of this, ...
6259900d925a0f43d25e8c5b
class RegistrationForm(FlaskForm): <NEW_LINE> <INDENT> email = StringField('Email', validators=[DataRequired(), Email()]) <NEW_LINE> username = StringField('Username', validators=[DataRequired()]) <NEW_LINE> first_name = StringField('First Name', validators=[DataRequired()]) <NEW_LINE> last_name = StringField('Last Nam...
Form for users to create new account
6259900d3cc13d1c6d466365
class Vault(): <NEW_LINE> <INDENT> def __init__(self, password): <NEW_LINE> <INDENT> self.password = password <NEW_LINE> pass_bytes = to_bytes(password, encoding='utf-8', errors='strict') <NEW_LINE> secrets = [('password', VaultSecret(_bytes=pass_bytes))] <NEW_LINE> self.vault = VaultLib(secrets=secrets) <NEW_LINE> <DE...
Read and write data using the Ansible vault.
6259900d5166f23b2e243ff0
class Update(LoginRequiredMixin, StaticContextMixin, generic.UpdateView): <NEW_LINE> <INDENT> form_class, model = forms.Company, models.Company <NEW_LINE> template_name = 'inventory/form.html' <NEW_LINE> static_context = { 'page_title': 'Edit company:', } <NEW_LINE> def get_context_data(self, **kwargs): <NEW_LINE> <IND...
Edit a Company.
6259900d507cdc57c63a59c0
class PythonScript(Expression): <NEW_LINE> <INDENT> pass
REPRESENT A Python SCRIPT
6259900d627d3e7fe0e07abc
class AddDomainTypeAssignmentRuleRequest(ModelNormal): <NEW_LINE> <INDENT> allowed_values = { } <NEW_LINE> validations = { } <NEW_LINE> additional_properties_type = None <NEW_LINE> _nullable = False <NEW_LINE> @cached_property <NEW_LINE> def openapi_types(): <NEW_LINE> <INDENT> return { 'domain_type_id': (str,), 'commu...
NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. Attributes: allowed_values (dict): The key is the tuple path to the attribute and the for var_name this is (var_name,). The value is a dict with a capitalized key describing the a...
6259900d21a7993f00c66b9e
class MatchCriteria: <NEW_LINE> <INDENT> def __init__(self, collection, states = [], matchStates = None, objAttrs = [], matchObjAttrs = None, roles = [], matchRoles = None, interfaces = [], matchInterfaces = None, invert = False, applyPredicate = False): <NEW_LINE> <INDENT> self.collection = collection <NEW_LINE> self....
Contains the criteria which will be used to generate a collection matchRule. We don't want to create the rule until we need it and are ready to use it. In addition, the creation of an AT-SPI match rule requires you specify quite a few things (see the __init__), most of which are irrelevant to the search at hand. This...
6259900d462c4b4f79dbc62b
class EsphomeEnumMapper: <NEW_LINE> <INDENT> def __init__(self, func: Callable[[], dict[int, str]]) -> None: <NEW_LINE> <INDENT> self._func = func <NEW_LINE> <DEDENT> def from_esphome(self, value: int) -> str: <NEW_LINE> <INDENT> return self._func()[value] <NEW_LINE> <DEDENT> def from_hass(self, value: str) -> int: <NE...
Helper class to convert between hass and esphome enum values.
6259900d21a7993f00c66ba0
class PingFailed(PingError, AssertionError): <NEW_LINE> <INDENT> message = ("timeout of {timeout} seconds expired after counting only " "{count} out of expected {expected_count} ICMP messages of " "type {message_type!r}")
Raised when ping timeout expires before reaching expected message count
6259900d56b00c62f0fb34e3
class Gradient_Descent(BaseAlgorithm): <NEW_LINE> <INDENT> def __init__(self, space, learning_rate=1., dx_tolerance=1e-7): <NEW_LINE> <INDENT> super(Gradient_Descent, self).__init__(space, learning_rate=learning_rate, dx_tolerance=dx_tolerance) <NEW_LINE> self.has_observed_once = False <NEW_LINE> self.current_point = N...
Implement a gradient descent algorithm.
6259900d15fb5d323ce7f965
class GP17iBack(PrintedForm): <NEW_LINE> <INDENT> NAME = "GP17(1) Back" <NEW_LINE> data = None <NEW_LINE> _bg_pixmap = None <NEW_LINE> def __init__(self, parent=None): <NEW_LINE> <INDENT> PrintedForm.__init__(self, parent) <NEW_LINE> self.rects = RECTS <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def is_active(self): <N...
a class to set up and print a GP17 (tooth specific version)
6259900d5166f23b2e243ff8
class Cronometro: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__tempoInicial = 0 <NEW_LINE> self.__tempoFinal = 0 <NEW_LINE> self.__parado = True <NEW_LINE> <DEDENT> def iniciar(self): <NEW_LINE> <INDENT> time.clock() <NEW_LINE> self.__tempoInicial = time.clock() <NEW_LINE> self.__parado = False <N...
Essa classe inicializa três atributos: tempo inicial, tempo final e status do cronometro. A diferença entre os atributos para o tempo resultam no tempo atual.
6259900d627d3e7fe0e07ac2
@urls.register <NEW_LINE> class ReachabilityTest(generic.View): <NEW_LINE> <INDENT> url_regex = r'neutron/reachabilitytests/(?P<test_id>[^/]+|default)/$' <NEW_LINE> @rest_utils.ajax() <NEW_LINE> def patch(self, request, test_id): <NEW_LINE> <INDENT> result = bsnneutron. reachabilitytest_update(request...
API for BSN Neutron Reachability Tests
6259900d56b00c62f0fb34e7
class SubmodWWUB(SubmodBase): <NEW_LINE> <INDENT> def _evalcmd(self, arg1, s, r, y, d, NT, Tk=None): <NEW_LINE> <INDENT> assert arg1 is None <NEW_LINE> prefix = self._new_prefix() <NEW_LINE> assert isinstance(s, list) and len(s) in (NT, NT+1) <NEW_LINE> assert isinstance(r, list) and len(r) == NT <NEW_LINE> assert isin...
Command for creating WW-U-B extended formulations.
6259900d462c4b4f79dbc631
class Cancer(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> filename = os.path.join(os.path.dirname(os.path.abspath(__file__)), "stata_cancer_glm.csv") <NEW_LINE> data = np.recfromcsv(open(filename, 'rb')) <NEW_LINE> self.endog = data.studytime <NEW_LINE> design = np.column_stack((data.age,data.dr...
The Cancer data can be found here http://www.stata-press.com/data/r10/rmain.html
6259900d0a366e3fb87dd61d
@python_2_unicode_compatible <NEW_LINE> class Purchase(QuickbooksManagedObject, QuickbooksTransactionEntity, LinkedTxnMixin): <NEW_LINE> <INDENT> class_dict = { "AccountRef": Ref, "EntityRef": Ref, "DepartmentRef": Ref, "CurrencyRef": Ref, "PaymentMethodRef": Ref, "RemitToAddr": Address, "TxnTaxDetail": TxnTaxDetail } ...
QBO definition: This entity represents expenses, such as a purchase made from a vendor. There are three types of Purchases: Cash, Check, and Credit Card. - Cash Purchase contains information regarding a payment made in cash. - Check Purchase contains information regarding a payment made by check. - Credit Card Purc...
6259900d56b00c62f0fb34e9
class Admin(commands.Cog): <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> self.bot = bot <NEW_LINE> <DEDENT> async def cog_check(self, ctx): <NEW_LINE> <INDENT> return await utils.discord.is_admin(ctx) <NEW_LINE> <DEDENT> @commands.command(aliases=['die', 'quit']) <NEW_LINE> async def shutdown(self, c...
Admin-only commands.
6259900e15fb5d323ce7f96c
class BespokeOptimizationSchema(BaseOptimizationSchema): <NEW_LINE> <INDENT> type: Literal["bespoke"] = "bespoke" <NEW_LINE> smiles: str = Field( ..., description="The SMILES representation of the molecule to generate bespoke " "parameters for.", ) <NEW_LINE> initial_force_field_hash: str = Field( ..., description="The...
A schema which encodes how a bespoke force field should be created for a specific molecule.
6259900e627d3e7fe0e07ac6
class FieldNotFoundException(Exception): <NEW_LINE> <INDENT> pass
Field not found exception. This class defines an exception to capture the error when an invalid field is used for operation. **DEPRECATED**
6259900e56b00c62f0fb34eb
class Model_Config(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.is_supervised = FLAGS.supervised <NEW_LINE> self.embed_dim = 300 <NEW_LINE> self.lstm_dim = 1000 <NEW_LINE> self.L = 20 <NEW_LINE> self.num_vocab = 72704 <NEW_LINE> self.vis_dim = 4096 <NEW_LINE> self.spa_dim = 5 <NEW_LINE> sel...
Wrapper class for model hyperparameters.
6259900e3cc13d1c6d466375
class Normalize(object): <NEW_LINE> <INDENT> def __init__(self, mean, std): <NEW_LINE> <INDENT> if not isinstance(mean, list): <NEW_LINE> <INDENT> mean = [mean] <NEW_LINE> <DEDENT> if not isinstance(std, list): <NEW_LINE> <INDENT> std = [std] <NEW_LINE> <DEDENT> self.mean = torch.FloatTensor(mean).unsqueeze(1).unsqueez...
Given mean and std, will normalize each channel of the torch.*Tensor, i.e. channel = (channel - mean) / std
6259900e15fb5d323ce7f96e
class NSNitroNserrInternalPiError(NSNitroPolErrors): <NEW_LINE> <INDENT> pass
Nitro error code 2103 Internal policy error
6259900ebf627c535bcb20de
class LogFormatter(logging.Formatter): <NEW_LINE> <INDENT> def format(self, record): <NEW_LINE> <INDENT> time = datetime.fromtimestamp(record.created).strftime("%Y-%m-%d %H:%M:%S") <NEW_LINE> header = "{} [{:s}]::{:s}".format(time, record.module, record.funcName) <NEW_LINE> return "{:60s} - {}".format(header, record.ge...
Custom Log Formatting
6259900e21a7993f00c66baa
class BaseThreadedModule(BaseModule.BaseModule, threading.Thread): <NEW_LINE> <INDENT> def __init__(self, lumbermill): <NEW_LINE> <INDENT> BaseModule.BaseModule.__init__(self, lumbermill) <NEW_LINE> threading.Thread.__init__(self) <NEW_LINE> self.input_queue = False <NEW_LINE> self.alive = True <NEW_LINE> self.daemon =...
Base class for all lumbermill modules. In most cases this is the class to inherit from when implementing a new module. It will only be started as thread when necessary. This depends on the configuration and how the modules are combined. If you happen to override one of the methods defined here, be sure to know what yo...
6259900e15fb5d323ce7f970
class JoinMessage(BaseMessage): <NEW_LINE> <INDENT> __slots__ = "nick", "ident", "channel" <NEW_LINE> def __init__(self, messaged_at, nick, ident, channel): <NEW_LINE> <INDENT> BaseMessage.__init__(self, messaged_at) <NEW_LINE> self.nick = unicode(nick) <NEW_LINE> self.ident = unicode(ident) <NEW_LINE> self.channel = u...
Join message type. :param messaged_at: a :class:`datetime.datetime` logged :type messaged_at: :class:`datetime.datetime` :param nick: a nickname :type nick: :class:`basestring` :param ident: an ident :type ident: :class:`basestring` :param channel: a channel name :type channel: :class:`basestring` .. attribute:: nic...
6259900ed164cc6175821bac
class TestIsProductPage(unittest.TestCase): <NEW_LINE> <INDENT> def test_is_product_page(self): <NEW_LINE> <INDENT> self.assertTrue(crawler.is_product_page( 'http://www.epocacosmeticos.com.br/lady-million-eau-my-gold-eau-de-toilette-paco-rabanne-perfume-feminino/p', 'http://www.epocacosmeticos.com.br/lady-million-eau-m...
Tests for checking if a page is a prodcutd page
6259900e627d3e7fe0e07aca
class IndexTemplate(TemplateView): <NEW_LINE> <INDENT> template_name = "index.html"
! Clase para cargar el index.html @author Rodrigo Boet (rudmanmrrod at gmail.com) @date 19-11-2018 @version 1.0.0
6259900e507cdc57c63a59d0
class TaggedItem(models.Model): <NEW_LINE> <INDENT> tag = models.ForeignKey(Tag, verbose_name=_('tag'), related_name='items') <NEW_LINE> content_type = models.ForeignKey(ContentType, verbose_name=_('content type')) <NEW_LINE> object_id = models.PositiveIntegerField(_('object id'), db_index=True) <NEW_LINE> ...
Holds the relationship between a tag and the item being tagged.
6259900ebf627c535bcb20e0
class Product(object): <NEW_LINE> <INDENT> def __init__(self, title, price): <NEW_LINE> <INDENT> self.title = title <NEW_LINE> self.price = price <NEW_LINE> <DEDENT> def __float__(self): <NEW_LINE> <INDENT> return self.price <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return 'Класс: "{}"\nПродукт "{}" с...
Здесь будет документация к классу!
6259900e925a0f43d25e8c70
class IflaVfMac(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [("vf", ctypes.c_uint32), ("mac", ctypes.c_uint8 * 32)]
struct ifla_vf_mac
6259900e15fb5d323ce7f972
class BubbleWidget(PyGlassWidget): <NEW_LINE> <INDENT> def __init__(self, parent, **kwargs): <NEW_LINE> <INDENT> super(BubbleWidget, self).__init__(parent, **kwargs) <NEW_LINE> self.exampleBtn.clicked.connect(self._handleExampleButton) <NEW_LINE> self.homeBtn.clicked.connect(self._handleReturnHome) <NEW_LINE> <DEDENT> ...
A class for Assignment 1
6259900e5166f23b2e244004
class GUIStatus(QtWidgets.QGroupBox) : <NEW_LINE> <INDENT> def __init__(self, parent=None, msg='No message in GUIStatus...') : <NEW_LINE> <INDENT> QtWidgets.QGroupBox.__init__(self, 'State', parent) <NEW_LINE> self.setGeometry(100, 100, 300, 60) <NEW_LINE> self.setWindowTitle('GUI Status') <NEW_LINE> self.instr_name ...
GUI State
6259900e56b00c62f0fb34f1
class QuestionDetail(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> queryset = Question.objects.all() <NEW_LINE> serializer_class = QuestionSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticated,)
Returns the specific Question object with its corresponding id
6259900e3cc13d1c6d46637f
class DisableMigrations(object): <NEW_LINE> <INDENT> def __contains__(self, item): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> def __getitem__(self, item): <NEW_LINE> <INDENT> return None
Django-cms disables all migrations when they run their tests. It would be better to not do it. Right now we are forced to disable our migrations because we inherit one of our models from django-cms. The error in question is due to an incompability of sqlite3 and with atomic transactions.
6259900ed164cc6175821bb4
class PyLint(ShellCommand): <NEW_LINE> <INDENT> name = "pylint" <NEW_LINE> description = ["running", "pylint"] <NEW_LINE> descriptionDone = ["pylint"] <NEW_LINE> RC_OK = 0 <NEW_LINE> RC_FATAL = 1 <NEW_LINE> RC_ERROR = 2 <NEW_LINE> RC_WARNING = 4 <NEW_LINE> RC_REFACTOR = 8 <NEW_LINE> RC_CONVENTION = 16 <NEW_LINE> RC_USA...
A command that knows about pylint output. It is a good idea to add --output-format=parseable to your command, since it includes the filename in the message.
6259900ebf627c535bcb20ea
class ProcessingInfo(pew.Model): <NEW_LINE> <INDENT> night = pew.IntegerField() <NEW_LINE> runId = pew.SmallIntegerField() <NEW_LINE> extension = pew.CharField(6) <NEW_LINE> status = pew.SmallIntegerField() <NEW_LINE> isdc = pew.BooleanField(default=False) <NEW_LINE> fhgfs = pew.BooleanField(default=False) <NEW_LINE> b...
ProcessingInfo Database Model
6259900e925a0f43d25e8c7c
class Component(VapiInterface): <NEW_LINE> <INDENT> RESOURCE_TYPE = "com.vmware.vapi.component" <NEW_LINE> def __init__(self, config): <NEW_LINE> <INDENT> VapiInterface.__init__(self, config, _ComponentStub) <NEW_LINE> <DEDENT> def list(self): <NEW_LINE> <INDENT> return self._invoke('list', None) <NEW_LINE> <DEDENT> de...
The ``Component`` class provides methods to retrieve authentication information of a component element. A component element is said to contain authentication information if any one of package elements contained in it has authentication information.
6259900ebf627c535bcb20ec
class Algorithm(object): <NEW_LINE> <INDENT> def __init__(self, corpi, config_file): <NEW_LINE> <INDENT> self.corpi = corpi <NEW_LINE> self.config = utilities.get_config(config_file) <NEW_LINE> self.results = None <NEW_LINE> self.doc_ids = [] <NEW_LINE> for corpus in corpi.corpus_list: <NEW_LINE> <INDENT> for item in c...
Reads the algorithm config file to see the selected algorithm(s).
6259900e627d3e7fe0e07ad8
class EmailFileWriter: <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.output_name = name <NEW_LINE> <DEDENT> def write(self, emails, output_file_name): <NEW_LINE> <INDENT> raise NotImplementedError("Each writer must be able to write!")
The "interface" for a writer object
6259900e21a7993f00c66bba
class DBLoader(Loader): <NEW_LINE> <INDENT> def __init__(self, source): <NEW_LINE> <INDENT> Loader.__init__(self, source) <NEW_LINE> self.manager = dbm.DBManager(source) <NEW_LINE> BASE.metadata.create_all(self.manager.engine()) <NEW_LINE> self.session = self.manager.session() <NEW_LINE> <DEDENT> def load(self, number=...
sqlite loader.
6259900e15fb5d323ce7f980
class Operator(object): <NEW_LINE> <INDENT> def apply(self, obj, op): <NEW_LINE> <INDENT> coeffs = self._poly.all_coeffs() <NEW_LINE> coeffs.reverse() <NEW_LINE> diffs = [obj] <NEW_LINE> for c in coeffs[1:]: <NEW_LINE> <INDENT> diffs.append(op(diffs[-1])) <NEW_LINE> <DEDENT> r = coeffs[0]*diffs[0] <NEW_LINE> for c, d i...
Base class for operators to be applied to our functions. These operators are differential operators. They are by convention expressed in the variable D = z*d/dz (although this base class does not actually care). Note that when the operator is applied to an object, we typically do *not* blindly differentiate but instea...
6259900e5166f23b2e244012
class Meta: <NEW_LINE> <INDENT> model = AGSResult
Factory metadata.
6259900ebf627c535bcb20f0
class mrp_operation_consumed(models.Model): <NEW_LINE> <INDENT> _name = 'mrp.operation.consumed' <NEW_LINE> _description = 'Operations consumed' <NEW_LINE> _rec_name = 'routing_id' <NEW_LINE> routing_id = fields.Many2one('mrp.routing', string='Routing', required=False, ondelete='cascade') <NEW_LINE> operation_id = fiel...
Operations consumed
6259900e0a366e3fb87dd634
class VoteForm(forms.Form): <NEW_LINE> <INDENT> object_id = forms.IntegerField(widget=forms.HiddenInput)
User input to vote upon something
6259900e0a366e3fb87dd636
class TestTimeStripperDoNotArchiveUntil(TestTimeStripperCase): <NEW_LINE> <INDENT> family = 'wikisource' <NEW_LINE> code = 'en' <NEW_LINE> username = '[[User:DoNotArchiveUntil]]' <NEW_LINE> date = '06:57 06 June 2015 (UTC)' <NEW_LINE> user_and_date = username + ' ' + date <NEW_LINE> tzone = tzoneFixedOffset(0, 'UTC') <...
Test cases for Do Not Archive Until templates. See https://commons.wikimedia.org/wiki/Template:DNAU and https://en.wikipedia.org/wiki/Template:Do_not_archive_until.
6259900ed164cc6175821bc2
class PayOperation(Enum): <NEW_LINE> <INDENT> PAYMENT = 'payment' <NEW_LINE> ONE_CLICK_PAYMENT = 'oneclickPayment'
Type of payment operation.
6259900e56b00c62f0fb3507
class EnumEvaluationNoteTypes: <NEW_LINE> <INDENT> def __int__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> initial_ctg = 'initial_ctg' <NEW_LINE> level_of_concern = 'concern' <NEW_LINE> intervention = 'intervention' <NEW_LINE> level_ph = 'ph' <NEW_LINE> level_neurology = 'neurology'
Types of evaluations
6259900e3cc13d1c6d466391
class SystemResetTest(BaseHostTest): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SystemResetTest, self).__init__() <NEW_LINE> self.reset = False <NEW_LINE> cycle_s = self.get_config_item('program_cycle_s') <NEW_LINE> self.program_cycle_s = cycle_s if cycle_s is not None else DEFAULT_CYCLE_PERIOD <...
Test for the system_reset API. Given a device running code When the device is restarted using @a system_reset() Then the device is restarted
6259900ed164cc6175821bc6
class Motor(object): <NEW_LINE> <INDENT> pi = pigpio.pi("192.168.200.1") <NEW_LINE> """Constructor""" <NEW_LINE> def __init__(self, pwm_pin=20, dir_pin=26, freq=1000, duty=0, dir=1): <NEW_LINE> <INDENT> self.pwm_pin = pwm_pin <NEW_LINE> self.dir_pin = dir_pin <NEW_LINE> self.pi.set_mode(self.pwm_pin, pigpio.OUTPUT) <NE...
Motor Class
6259900f5166f23b2e24401e
class NTAG203(tt2.Type2Tag): <NEW_LINE> <INDENT> def __init__(self, clf, target): <NEW_LINE> <INDENT> super(NTAG203, self).__init__(clf, target) <NEW_LINE> self._product = "NXP NTAG203" <NEW_LINE> <DEDENT> def dump(self): <NEW_LINE> <INDENT> oprint = lambda o: ' '.join(['??' if x < 0 else '%02x'%x for x in o]) <NEW_LIN...
The NTAG203 is a plain memory Tag with 144 bytes user data memory plus a 16-bit one-way counter. It does not have any security features beyond the standard lock bit mechanism that permanently disables write access.
6259900f925a0f43d25e8c8c
class SetSupportedParameters(TestMixins.UnsupportedSetMixin, ResponderTestFixture): <NEW_LINE> <INDENT> PID = 'SUPPORTED_PARAMETERS'
Attempt to SET supported parameters.
6259900f507cdc57c63a59ed
class DataRoute(object): <NEW_LINE> <INDENT> def db_for_read(self, model, **hints): <NEW_LINE> <INDENT> return 'data' <NEW_LINE> <DEDENT> def db_for_write(self, model, **hints): <NEW_LINE> <INDENT> return 'data' <NEW_LINE> <DEDENT> def allow_relation(self, obj1, obj2, **hints): <NEW_LINE> <INDENT> if obj1._state.db in ...
A router to control all database operations on models in the pghm application.
6259900f56b00c62f0fb350d
class UserProfileManager(BaseUserManager): <NEW_LINE> <INDENT> def create_user(self,email,name,password=None): <NEW_LINE> <INDENT> if not email: <NEW_LINE> <INDENT> raise ValueError('Users must have an email address') <NEW_LINE> <DEDENT> email=self.normalize_email(email) <NEW_LINE> user=self.model(email=email,name=name...
django can create user and superuser from userprofile model
6259900f462c4b4f79dbc657
class PersonIngestor(Ingestor): <NEW_LINE> <INDENT> grok.context(IPersonFolder) <NEW_LINE> def getContainedObjectInterface(self): <NEW_LINE> <INDENT> return IPerson <NEW_LINE> <DEDENT> def getTitles(self, predicates): <NEW_LINE> <INDENT> first = last = None <NEW_LINE> lasts = predicates.get(URIRef(FOAF_SURNAME)) <NEW_L...
RDF ingestor for people.
6259900fbf627c535bcb2100
@dataclass <NEW_LINE> class Input: <NEW_LINE> <INDENT> name: Name <NEW_LINE> email: EmailAddress
Input.
6259900f56b00c62f0fb350f
class Solution: <NEW_LINE> <INDENT> def majorityNumber(self, nums): <NEW_LINE> <INDENT> ele, count = nums[0], 1 <NEW_LINE> for i in range(1, len(nums)): <NEW_LINE> <INDENT> if count == 0: <NEW_LINE> <INDENT> ele = nums[i] <NEW_LINE> count += 1 <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> if nums[i] == ele: <NEW_LINE> ...
@param: nums: a list of integers @return: find a majority number
6259900f3cc13d1c6d466399
class Checkpointer(object): <NEW_LINE> <INDENT> def __init__(self, base_directory, checkpoint_file_prefix='ckpt', sentinel_file_identifier='checkpoint', checkpoint_frequency=1): <NEW_LINE> <INDENT> if not base_directory: <NEW_LINE> <INDENT> raise ValueError('No path provided to Checkpointer.') <NEW_LINE> <DEDENT> self....
Class for managing checkpoints for Dopamine agents.
6259900f0a366e3fb87dd644
class FakeImageResource: <NEW_LINE> <INDENT> def __init__(self, io, arg): <NEW_LINE> <INDENT> self.url = f"$({io}s.resources.{k8s.safe_name(arg)}.url)"
Used in dry-run a Task function, which might call res_param.url
6259900fbf627c535bcb2102
class ResourceConfigurationV1(BaseService): <NEW_LINE> <INDENT> default_url = 'https://config.cloud-object-storage.cloud.ibm.com/v1' <NEW_LINE> def __init__(self, url=default_url, iam_apikey=None, iam_access_token=None, iam_url=None, iam_client_id=None, iam_client_secret=None, ): <NEW_LINE> <INDENT> BaseService.__init_...
The ResourceConfiguration V1 service.
6259900f21a7993f00c66bd0
class FakeEvent: <NEW_LINE> <INDENT> def __init__(self, string): <NEW_LINE> <INDENT> self.data = string
make a holder for passing a string to an event handler
6259900f56b00c62f0fb3513
class Solution2: <NEW_LINE> <INDENT> def isValidBST(self, root: TreeNode) -> bool: <NEW_LINE> <INDENT> if root is None: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return self.onLeft(root.left, root.val) and self.onRight(root.right, root.val) and self.isValidBST(root.left) and ...
仅需验证 BST 的有序性即可,即验证当前节点与其左右子节点的关系
6259900f3cc13d1c6d46639d
class BracketMatcher(QtCore.QObject): <NEW_LINE> <INDENT> _opening_map = { '(':')', '{':'}', '[':']' } <NEW_LINE> _closing_map = { ')':'(', '}':'{', ']':'[' } <NEW_LINE> def __init__(self, text_edit): <NEW_LINE> <INDENT> assert isinstance(text_edit, (QtGui.QTextEdit, QtGui.QPlainTextEdit)) <NEW_LINE> super(BracketMatch...
Matches square brackets, braces, and parentheses based on cursor position.
6259900f462c4b4f79dbc65d
class Wrapper(object): <NEW_LINE> <INDENT> origin = None <NEW_LINE> def __repr__(self): <NEW_LINE> <INDENT> return "<{0.__class__.__name__}(Wrapping {1})>".format(self, repr(self.origin)) <NEW_LINE> <DEDENT> def __hash__(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def __eq__(self, other): <...
Base class for policy object wrappers.
6259900f56b00c62f0fb3515
class Discover: <NEW_LINE> <INDENT> def __init(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def scan(self, stop_on_first=True, base_ip=0): <NEW_LINE> <INDENT> tvs = [] <NEW_LINE> if base_ip == 0: <NEW_LINE> <INDENT> sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) <NEW_LINE> sock.connect(("8.8.8.8", 80)) ...
This class handles discovery and checking of local Xiaomi TVs
6259900f0a366e3fb87dd64a
class CentererB(NodeB): <NEW_LINE> <INDENT> type = QlibsNodeTypes.CENTERER <NEW_LINE> def __init__(self, sep_x, sep_y, child=None, **kwargs): <NEW_LINE> <INDENT> super().__init__(**kwargs) <NEW_LINE> self.sep_x = sep_x <NEW_LINE> self.sep_y = sep_y <NEW_LINE> if child is not None: <NEW_LINE> <INDENT> self.add_child(chi...
Makes it's children smaller by **sep_x** and **sep_y** from each side
6259900fd164cc6175821bd4
class FilesParser(object): <NEW_LINE> <INDENT> def __init__(self, pathes = []): <NEW_LINE> <INDENT> self.pathes = pathes if type(pathes) is list else [pathes] <NEW_LINE> self.__abbrev_to_full = {} <NEW_LINE> self.__full_to_abbrev = {} <NEW_LINE> self.files = None <NEW_LINE> self.files_full = None <NEW_LINE> self.__pars...
FilesParser run 'git ls-files' and parse.
6259900fbf627c535bcb2108
class BlatPslIndexer(SearchIndexer): <NEW_LINE> <INDENT> _parser = BlatPslParser <NEW_LINE> def __init__(self, filename, pslx=False): <NEW_LINE> <INDENT> SearchIndexer.__init__(self, filename, pslx=pslx) <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> handle = self._handle <NEW_LINE> handle.seek(0) <NEW_LIN...
Indexer class for BLAT PSL output.
6259900f56b00c62f0fb3517
class FunctionDefinition(FunctionPrototype): <NEW_LINE> <INDENT> __slots__ = FunctionPrototype.__slots__[:-1] + ('body', 'attrs') <NEW_LINE> @classmethod <NEW_LINE> def _construct_body(cls, itr): <NEW_LINE> <INDENT> if isinstance(itr, CodeBlock): <NEW_LINE> <INDENT> return itr <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE...
Represents a function definition in the code. Parameters ========== return_type : Type name : str parameters: iterable of Variable instances body : CodeBlock or iterable attrs : iterable of Attribute instances Examples ======== >>> from sympy import ccode, symbols >>> from sympy.codegen.ast import real, FunctionPro...
6259900f3cc13d1c6d4663a1
class TimeSensor(object): <NEW_LINE> <INDENT> def plot_Ex(self, logplot=False): <NEW_LINE> <INDENT> self.__plot_field(self.Ex, logplot) <NEW_LINE> <DEDENT> def plot_Ey(self, logplot=False): <NEW_LINE> <INDENT> self.__plot_field(self.Ey, logplot) <NEW_LINE> <DEDENT> def plot_Ez(self, logplot=False): <NEW_LINE> <INDENT> ...
Data structure to handle the time sensor's data.
6259900fd18da76e235b777a
class DeleteVPNTunnelResponseSchema(schema.ResponseSchema): <NEW_LINE> <INDENT> fields = {}
DeleteVPNTunnel - 删除VPN隧道
6259900f56b00c62f0fb3519
class Courier: <NEW_LINE> <INDENT> def __init__(self, models: dict, scaler, alpha: float = 0.5, beta: float = 0.5, batches=[64, 128, 256, 512]): <NEW_LINE> <INDENT> self.batches = np.array(batches).reshape(len(batches), 1) <NEW_LINE> if alpha + beta != 1: <NEW_LINE> <INDENT> raise ValueError('The hyperparameters need t...
Courier has 3 parameters to account for utilization, accuracy and response time, based on which, and their weights, it chooses the optimal batch size for the task labels are in format dict accuracy -> labels time -> labels utilization -> labels
6259900f507cdc57c63a59fa
class MAC(Digest): <NEW_LINE> <INDENT> def __init__(self,algorithm,key,digest=None,**kwargs): <NEW_LINE> <INDENT> if isinstance(algorithm,str): <NEW_LINE> <INDENT> self.algorithm=Oid(algorithm) <NEW_LINE> <DEDENT> elif isinstance(algorithm,Oid): <NEW_LINE> <INDENT> self.algorithm=algorithm <NEW_LINE> <DEDENT> else: <NE...
This object represents MAC context. It is quite simular to digest algorithm. It is simular to hmac objects provided by standard library
6259900fd18da76e235b777b
class ViewComplexDouble(ctypes.Structure): <NEW_LINE> <INDENT> _fields_ = [('height', catamari_int), ('width', catamari_int), ('leading_dim', catamari_int), ('data', POINTER(ComplexDouble))]
An equivalent of CatamariBlasMatrixViewComplexDouble.
6259900f627d3e7fe0e07af6
class VGG3DModel(BaseModel): <NEW_LINE> <INDENT> def __init__(self, sequence_size, img_size=321, batch_size=1, weight_file=None): <NEW_LINE> <INDENT> BaseModel.__init__(self, "C3DModel", batch_size) <NEW_LINE> self.sequence_size = sequence_size <NEW_LINE> self.img_size = img_size <NEW_LINE> self.build_model() <NEW_LINE...
This model is using the first 5 blocks of VGG19 with the Conv2D replaced with Conv3D. This model is our baseline.
6259900f5166f23b2e244030
class TMSettings(dict): <NEW_LINE> <INDENT> def __init__(self, *args, **kwds): <NEW_LINE> <INDENT> dict.__init__(self, *args, **kwds) <NEW_LINE> self.name = "tweenMachineSettings" <NEW_LINE> if mc.optionVar(exists=self.name): <NEW_LINE> <INDENT> data = eval(mc.optionVar(q=self.name)) <NEW_LINE> for key in data: <NEW_LI...
Convenience class to get/set global settings via an option variable
6259900fd164cc6175821bda
class Delete(base.SilentCommand): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Args(parser): <NEW_LINE> <INDENT> _AddDeleteArgs(parser) <NEW_LINE> <DEDENT> def Run(self, args): <NEW_LINE> <INDENT> return operations_util.Delete(operations.OperationsClient(), args.operation)
Delete a Cloud ML Engine operation.
6259900f925a0f43d25e8c9e
class ReconstructedFile(GroupUtils): <NEW_LINE> <INDENT> def __init__(self, filepath: str, parent: object, populate: dict = None, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(None, *args, **kwargs) <NEW_LINE> self.filepath = filepath <NEW_LINE> self.populate = populate <NEW_LINE> self._parent = parent <NEW_LI...
A file to the saved file, as opposed to the file in memory (ReconstructedVolume). When reconstructing and saving to disk, we will generate the file, write to disk and add this leaf type within the tree. If we want to load that into memory, we will simply replace this node type with the type of ReconstructedVolume
6259900f0a366e3fb87dd652
class RebootSingleVM(CookbookBase): <NEW_LINE> <INDENT> def get_runner(self, args): <NEW_LINE> <INDENT> return RebootSingleVMRunner(args, self.spicerack) <NEW_LINE> <DEDENT> def argument_parser(self): <NEW_LINE> <INDENT> parser = argparse.ArgumentParser(description=self.__doc__, formatter_class=argparse.RawDescriptionH...
Downtime a single Ganeti VM and reboot it on the Ganeti level This is different from a normal reboot triggered on the OS level, it can be compared to powercycling a server. This kind of reboot is e.g. needed if KVM/QEMU machine settings have been modified. - Set Icinga/Alertmanager downtime - Reboot with opt...
6259900fd18da76e235b777d
class TestTetriminos(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 test_i(self): <NEW_LINE> <INDENT> t = program.flat_board.TetriminoFactory.make('I') <NEW_LINE> self.assertEqual(t.title, 'I') <N...
Test Tetriminos.
6259900fd164cc6175821bdc
class Bucketlist(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'bucketlist' <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> name = db.Column(db.String(255)) <NEW_LINE> date_created = db.Column(db.DateTime, default=db.func.current_timestamp()) <NEW_LINE> date_modified = db.Column( db.DateTime, defaul...
This class represents a Bucketlist table
6259900fbf627c535bcb2110
class CancelTask(Trigger): <NEW_LINE> <INDENT> def _on_complete_hook(self, my_task): <NEW_LINE> <INDENT> for task_name in self.context: <NEW_LINE> <INDENT> cancel_tasks = my_task.workflow.get_task_spec_from_name(task_name) <NEW_LINE> for cancel_task in my_task._get_root()._find_any(cancel_tasks): <NEW_LINE> <INDENT> ca...
This class implements a trigger that cancels another task (branch). If more than one input is connected, the task performs an implicit multi merge. If more than one output is connected, the task performs an implicit parallel split.
6259900f21a7993f00c66bdc
class maxima_kernel(kernel): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.kernel = asam.maxima_kernel(np.vstack([self.Q_ref, self.Q_ref + .5]), self.rho_D) <NEW_LINE> <DEDENT> def test_init(self): <NEW_LINE> <INDENT> assert self.kernel.TOL == 1e-8 <NEW_LINE> assert self.kernel.increase == 2.0 <NEW_LINE...
Test :class:`bet.sampling.adaptiveSampling.maxima_kernel`
6259900fd18da76e235b777e
class Immediate(_Immediate): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> @classmethod <NEW_LINE> def from_list(cls, l): <NEW_LINE> <INDENT> return cls(l.pop(0),) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def from_string(cls, s): <NEW_LINE> <INDENT> if not s.isdigit(): <NEW_LINE> <INDENT> raise ValueError('%s is not...
An immediate value.
6259900f925a0f43d25e8ca2
class SolveurTest(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.solveur = solveur.Solveur(0, 0) <NEW_LINE> <DEDENT> def test_change_message(self): <NEW_LINE> <INDENT> message = self.solveur.message <NEW_LINE> self.solveur.change_message() <NEW_LINE> self.assertEqual(self.solveur.mess...
Classe permettant de tester les fonctionnement des méthodes de la classe Editeur
6259900f507cdc57c63a5a02
class BusinessCardInfo(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Name = None <NEW_LINE> self.Value = None <NEW_LINE> self.ItemCoord = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Name = params.get("Name") <NEW_LINE> self.Value = params.get("Val...
名片识别结果
6259900f56b00c62f0fb3521
class peek_iter: <NEW_LINE> <INDENT> def __init__(self, *args): <NEW_LINE> <INDENT> self._iterable = iter(*args) <NEW_LINE> self._cache = collections.deque() <NEW_LINE> if len(args) == 2: <NEW_LINE> <INDENT> self.sentinel = args[1] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.sentinel = object() <NEW_LINE> <DEDEN...
An iterator object that supports peeking ahead. Parameters ---------- o : iterable or callable `o` is interpreted very differently depending on the presence of `sentinel`. If `sentinel` is not given, then `o` must be a collection object which supports either the iteration protocol or the sequence prot...
6259900f15fb5d323ce7f9a4
class PyKustoClient(PyKustoClientBase): <NEW_LINE> <INDENT> __client: KustoClient <NEW_LINE> __auth_method: Callable[[str], KustoConnectionStringBuilder] <NEW_LINE> __global_client_cache: Dict[str, KustoClient] = {} <NEW_LINE> __global_cache_lock: Lock = Lock() <NEW_LINE> def __init__( self, client_or_cluster: Union[st...
Handle to a Kusto cluster. Uses :class:`ItemFetcher` to fetch and cache the full cluster schema, including all databases, tables, columns and their types.
6259900f21a7993f00c66be0
class DummyPlugin(FCConditionBasePlugin): <NEW_LINE> <INDENT> def __init__(self, conditions): <NEW_LINE> <INDENT> super(DummyPlugin, self).__init__(conditions) <NEW_LINE> <DEDENT> def eval(self, **kwargs): <NEW_LINE> <INDENT> return eval(self.conditions)
This plugin is to be used to simply return True or False
6259900f3cc13d1c6d4663ad
class HealthDrawer: <NEW_LINE> <INDENT> def __init__(self, actor=None): <NEW_LINE> <INDENT> self._actor = actor <NEW_LINE> self._background = ResourceManager.load_image( ResourceClass.UI, 'health-bar-background.png') <NEW_LINE> self._progress = ProgressBarDrawer(ResourceManager.load_image( ResourceClass.UI, 'health-bar...
Draws health of actor, on top of actor
6259900fd18da76e235b7780
class TestMAMLVPG: <NEW_LINE> <INDENT> def setup_method(self): <NEW_LINE> <INDENT> self.env = MetaRLEnv( normalize(HalfCheetahDirEnv(), expected_action_scale=10.)) <NEW_LINE> self.policy = GaussianMLPPolicy( env_spec=self.env.spec, hidden_sizes=(64, 64), hidden_nonlinearity=torch.tanh, output_nonlinearity=None, ) <NEW_...
Test class for MAML-VPG.
6259900f627d3e7fe0e07b00