code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class LogModel(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def create(cls): <NEW_LINE> <INDENT> return None <NEW_LINE> <DEDENT> def put(self): <NEW_LINE> <INDENT> return app.log_mongo.insert(self) <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def find(cls, query): <NEW_LINE> <INDENT> return app.log_mongo.find(cl... | 存储log数据 写一次后基本不修改 有查询需求 | 62598f9f3c8af77a43b67e42 |
class BOARD: <NEW_LINE> <INDENT> DIO0 = 5 <NEW_LINE> DIO1 = 23 <NEW_LINE> DIO2 = 24 <NEW_LINE> DIO3 = 25 <NEW_LINE> LED = 18 <NEW_LINE> SWITCH = 4 <NEW_LINE> spi = None <NEW_LINE> low_band = True <NEW_LINE> @staticmethod <NEW_LINE> def setup(): <NEW_LINE> <INDENT> GPIO.setmode(GPIO.BCM) <NEW_LINE> GPIO.setup(BOARD.LED... | Board initialisation/teardown and pin configuration is kept here.
Also, information about the RF module is kept here.
This is the Raspberry Pi board with one LED and a modtronix inAir9B. | 62598f9fb7558d5895463433 |
class Tweet(models.Model): <NEW_LINE> <INDENT> user = models.ForeignKey(User) <NEW_LINE> text = models.CharField(max_length=160) <NEW_LINE> created_date = models.DateTimeField(auto_now_add=True) <NEW_LINE> country = models.CharField(max_length=30) <NEW_LINE> is_active = models.BooleanField(default=True) <NEW_LINE> def ... | Tweet model | 62598f9fd6c5a102081e1f4b |
class NameStartsWithDollar(Exception): <NEW_LINE> <INDENT> pass | this exception is raised when a routine which name starts with a dollar sign ($) is ade | 62598f9f7d43ff2487427305 |
class HubDescription(ComponentData): <NEW_LINE> <INDENT> def __init__(self, num, numeric_prefix=False, is_icetop=False, hub_type=HubType.ALL): <NEW_LINE> <INDENT> super(HubDescription, self).__init__("stringHub", num, numeric_prefix=numeric_prefix) <NEW_LINE> connlist = [] <NEW_LINE> if hub_type in (HubType.ALL, HubTyp... | StringHub data | 62598f9f2ae34c7f260aaee7 |
class CNMLRadio(object): <NEW_LINE> <INDENT> def __init__(self, rid, protocol, snmp_name, snmp_index, ssid, mode, gain, angle, channel, clients, parent): <NEW_LINE> <INDENT> self.id = rid <NEW_LINE> self.protocol = protocol <NEW_LINE> self.snmp_name = snmp_name <NEW_LINE> self.snmp_index = snmp_index <NEW_LINE> self.ss... | This CNMLRadio class represents a radio of a device in the network | 62598f9f66656f66f7d5a1f7 |
class Singleton(ManagedProperties): <NEW_LINE> <INDENT> _instances = {} <NEW_LINE> def __new__(cls, *args, **kwargs): <NEW_LINE> <INDENT> result = super().__new__(cls, *args, **kwargs) <NEW_LINE> S.register(result) <NEW_LINE> return result <NEW_LINE> <DEDENT> def __call__(self, *args, **kwargs): <NEW_LINE> <INDENT> if ... | Metaclass for singleton classes.
A singleton class has only one instance which is returned every time the
class is instantiated. Additionally, this instance can be accessed through
the global registry object ``S`` as ``S.<class_name>``.
Examples
========
>>> from sympy import S, Basic
>>> from sympy.core.sin... | 62598f9f55399d3f05626328 |
class TestNotifyGroup(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.hass = get_test_home_assistant() <NEW_LINE> self.events = [] <NEW_LINE> self.assertTrue(setup_component(self.hass, notify.DOMAIN, { 'notify': [{ 'name': 'demo1', 'platform': 'demo' }, { 'name': 'demo2', 'platform': '... | Test the notify.group platform. | 62598f9f4f6381625f1993bf |
class Message(Base): <NEW_LINE> <INDENT> __tablename__ = 'message' <NEW_LINE> message_id = Column(Integer, primary_key=True, index=True) <NEW_LINE> chat_user_id = Column(Integer, ForeignKey('chat_user.chat_user_id'), nullable=False) <NEW_LINE> account_id = Column(Integer, ForeignKey('account.account_id'), nullable=Fals... | The actual message from a channel and from a user | 62598f9f460517430c431f5e |
class Cupcake: <NEW_LINE> <INDENT> cache = {} <NEW_LINE> class_name = 'Cupcake' <NEW_LINE> @staticmethod <NEW_LINE> def scale_recipe(ingredients, amount): <NEW_LINE> <INDENT> return [(name, qty * amount) for name, qty in ingredients] <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get(cls, name): <NEW_LINE> <INDENT> if... | A cupcake. | 62598f9fa219f33f346c6620 |
class Follower(PyoObject): <NEW_LINE> <INDENT> def __init__(self, input, freq=20, mul=1, add=0): <NEW_LINE> <INDENT> PyoObject.__init__(self, mul, add) <NEW_LINE> self._input = input <NEW_LINE> self._freq = freq <NEW_LINE> self._in_fader = InputFader(input) <NEW_LINE> in_fader, freq, mul, add, lmax = convertArgsToLists... | Envelope follower.
Output signal is the continuous mean amplitude of an input signal.
:Parent: :py:class:`PyoObject`
:Args:
input : PyoObject
Input signal to process.
freq : float or PyoObject, optional
Cutoff frequency of the filter in hertz. Default to 20.
.. note::
The out() method ... | 62598f9f442bda511e95c262 |
class HttpExchange(models.Model): <NEW_LINE> <INDENT> id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) <NEW_LINE> content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE) <NEW_LINE> object_id = models.PositiveIntegerField() <NEW_LINE> related_object = GenericForeignKey('content... | HTTP request/response exchange. | 62598f9f07f4c71912baf252 |
class StatsHuntCronFlow(cronjobs.SystemCronFlow): <NEW_LINE> <INDENT> frequency = rdfvalue.Duration("1d") <NEW_LINE> lifetime = rdfvalue.Duration("30m") <NEW_LINE> def GetOutputPlugins(self): <NEW_LINE> <INDENT> return [] <NEW_LINE> <DEDENT> @flow.StateHandler() <NEW_LINE> def Start(self): <NEW_LINE> <INDENT> with hunt... | A cron job which runs a continuous stats hunt on all clients.
This hunt is designed to collect lightweight information from all clients with
very high resolution (similar to poll period). We roll over to a new hunt to
move to a new collection, and pick up any clients that might have fallen out
of the collection loop d... | 62598f9f85dfad0860cbf978 |
class FSGlobalEventHandler(FSLocalEventHandler): <NEW_LINE> <INDENT> NODE_PREFIX = True <NEW_LINE> DEFAULT_LEVEL = 'verbose' <NEW_LINE> def __init__(self, command): <NEW_LINE> <INDENT> FSLocalEventHandler.__init__(self, command) <NEW_LINE> self._timer = None <NEW_LINE> self.status_changed = False <NEW_LINE> <DEDENT> de... | Command event handler used when Shine is called for a global (admin)
processing.
This means local and distant commands could be executed. | 62598f9f3539df3088ecc0bc |
class Talkey(object): <NEW_LINE> <INDENT> def __init__(self, preferred_languages=None, preferred_factor=80.0, engine_preference=None, **config): <NEW_LINE> <INDENT> self.preferred_languages = preferred_languages or [] <NEW_LINE> self.preferred_factor = preferred_factor <NEW_LINE> engine_preference = engine_preference o... | Manages engines and allows multi-lingual say()
``preferred_languages``
A list of languages that are weighted in preference. This is a weighting to assist the detection of language by classify().
``preferred_factor``
The weighting factor to prefer the ``preferred_languages`` list. Higher number skews towards pr... | 62598f9f3d592f4c4edbacd5 |
class Unit: <NEW_LINE> <INDENT> def __init__(self, name, symbol, symbol_latex): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.symbol = symbol <NEW_LINE> self.symbol_latex = symbol_latex <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "Unit({})".format(self.name) <NEW_LINE> <DEDENT> def __str__... | Unit of quantity.
.. note:: Perhaps inherit from tuple or :class:`collections.namedTuple`? | 62598f9f4527f215b58e9ceb |
@register(names=('F[]', 'Float_t[]'), builtin=True) <NEW_LINE> class FloatArray(BaseArray): <NEW_LINE> <INDENT> type = 'F' <NEW_LINE> typename = 'Float_t' <NEW_LINE> convert = Float.convert <NEW_LINE> def __new__(cls, length, default=0., **kwargs): <NEW_LINE> <INDENT> return BaseArray.__new__( cls, 'f', [Float.convert(... | This is an array of floats | 62598f9f56ac1b37e6301ff2 |
class SpamScores(models.Model): <NEW_LINE> <INDENT> score = models.FloatField() <NEW_LINE> count = models.IntegerField() <NEW_LINE> objects = SpamScoresManager() <NEW_LINE> def obj_to_dict(self): <NEW_LINE> <INDENT> vals = [(field.name, getattr(self, field.name)) for field in self._meta.fields] <NEW_LINE> return dict(v... | spam scores | 62598f9ff7d966606f747def |
class Tsig(object): <NEW_LINE> <INDENT> algs = { "hmac-md5": 16, "hmac-sha1": 20, "hmac-sha224": 28, "hmac-sha256": 32, "hmac-sha384": 48, "hmac-sha512": 64 } <NEW_LINE> vocabulary = string.ascii_uppercase + string.ascii_lowercase + string.digits <NEW_LINE> def __init__(self, name=None, alg=None, k... | TSIG key generator | 62598f9f16aa5153ce400307 |
class PrimitivePoint: <NEW_LINE> <INDENT> def __init__(self, x, y): <NEW_LINE> <INDENT> self.x = x <NEW_LINE> self.y = y <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return type(self) == type(other) and self.x == other.x and self.y == other.y <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT... | Test class for adding additional primitive | 62598f9f6fb2d068a7693d38 |
class OrderEditVoucherForm(forms.ModelForm): <NEW_LINE> <INDENT> voucher = AjaxSelect2ChoiceField( queryset=Voucher.objects.all(), fetch_data_url=reverse_lazy('dashboard:ajax-vouchers'), min_input=0) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = Order <NEW_LINE> fields = ['voucher'] <NEW_LINE> labels = { 'voucher'... | Edit discount amount in an order. | 62598f9f3eb6a72ae038a449 |
class WorkQueueManagerCleaner(BaseWorkerThread): <NEW_LINE> <INDENT> def __init__(self, queue, config): <NEW_LINE> <INDENT> BaseWorkerThread.__init__(self) <NEW_LINE> self.forbiddenStatus = ["aborted", "aborted-completed", "force-complete", "completed"] <NEW_LINE> self.queue = queue <NEW_LINE> self.config = config <NEW... | Cleans expired items, updates element status. | 62598f9fa17c0f6771d5c042 |
class StochasticGradientDescent(TradingFactory): <NEW_LINE> <INDENT> def initialize(self, properties): <NEW_LINE> <INDENT> for middleware in common_middlewares(properties, self.identity): <NEW_LINE> <INDENT> self.use(middleware) <NEW_LINE> <DEDENT> self.rebalance_period = properties.get('rebalance_period', 5) <NEW_LINE... | doc: Randomly chooses training data, gradually decrease the learning rate,
and penalize data points which deviate significantly from what's
predicted.
Here I used an average SGD method that is tested to outperform if
I simply pick the last predictor value trained after certain iterations.
parameters:
rebalanc... | 62598f9f4e4d56256637222c |
class GitRelease(github.GithubObject.CompletableGithubObject): <NEW_LINE> <INDENT> @property <NEW_LINE> def body(self): <NEW_LINE> <INDENT> self._completeIfNotSet(self._body) <NEW_LINE> return self._body.value <NEW_LINE> <DEDENT> @property <NEW_LINE> def title(self): <NEW_LINE> <INDENT> self._completeIfNotSet(self._tit... | This class represents GitRelease as returned for example by https://developer.github.com/v3/repos/releases | 62598f9f92d797404e388a6a |
class NavierStokesScalar(PDESubSystem): <NEW_LINE> <INDENT> def form(self, u, v_u, p, v_p, u_, nu, dt, u_1, u_2, f, c, v_c, c_, c_1, c_2, Pr, **kwargs): <NEW_LINE> <INDENT> if not self.prm['iteration_type'] == 'Newton': <NEW_LINE> <INDENT> info_red('Scheme is not linearized and requires Newton iteration type') <NEW_LIN... | Fully coupled transient Navier-Stokes solver plus one passive scalar
| 62598f9fa17c0f6771d5c043 |
class ShtatToExcel: <NEW_LINE> <INDENT> def __init__(self, file: str): <NEW_LINE> <INDENT> self.file = file <NEW_LINE> self.db = SqliteDB() <NEW_LINE> with self.db as cur: <NEW_LINE> <INDENT> cur.execute("SELECT * from salaries WHERE fio NOT LIKE '%Вакансия%' ORDER BY department_code;") <NEW_LINE> <DEDENT> self.work_da... | Класс, выгружающий штатное расписание в файл Excel для заполнения отклонений | 62598f9f57b8e32f52508020 |
class WeakOrderedSet(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._items = {} <NEW_LINE> self._order = [] <NEW_LINE> <DEDENT> def add(self, item): <NEW_LINE> <INDENT> oid = id(item) <NEW_LINE> if oid in self._items: <NEW_LINE> <INDENT> self._order.remove(oid) <NEW_LINE> self._order.append(o... | Maintain a set of items.
Each item is stored as a weakref to avoid extending their lifetime.
The values may be iterated over or the last item added may be
accessed via the ``last`` property.
If items are added more than once, the most recent addition will
be remembered in the order:
order = WeakOrderedSet()
... | 62598f9f07f4c71912baf253 |
class AsyncContextManager: <NEW_LINE> <INDENT> async def __aenter__(self): <NEW_LINE> <INDENT> print('__aenter__') <NEW_LINE> await gen_cor() <NEW_LINE> <DEDENT> async def __aexit__(self, exec_type, exec_val, traceback): <NEW_LINE> <INDENT> print('__aexit__') <NEW_LINE> await Future('FUTURE') | a new protocol for asynchronous context managers
__aenter__ and __aexit__ both must return an awaitable . | 62598f9f442bda511e95c263 |
class ClassDetailsGoogleClassroom(object): <NEW_LINE> <INDENT> openapi_types = { 'name': 'str', 'alternate_link': 'str', 'section': 'str', 'id': 'str' } <NEW_LINE> attribute_map = { 'name': 'name', 'alternate_link': 'alternateLink', 'section': 'section', 'id': 'id' } <NEW_LINE> def __init__(self, name=None, alternate_l... | NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually. | 62598f9f379a373c97d98e1e |
class Trust(Enum): <NEW_LINE> <INDENT> NOTHING = auto() <NEW_LINE> INDEX = auto() <NEW_LINE> DISK = auto() | Which side do we trust in a sync? The disk, or the index?
'None' means don't do anything when there's an unknown dataset (they'll have to be indexed elsewhere) | 62598f9f2ae34c7f260aaee9 |
class Section_6( Section ): <NEW_LINE> <INDENT> variables= [ ('B', 'Width of top & bottom flanges' ), ('D', 'Height of section' ), ('S', 'Thickness of top & bottom flanges' ), ('T', 'Thickness of vertical web' ), ] <NEW_LINE> solver= beamsect.Beam_6() | I-Section Built-Up Beam | 62598f9f24f1403a926857b6 |
class C_A(object): <NEW_LINE> <INDENT> def __init__(self, years=[2020]): <NEW_LINE> <INDENT> self.years = years <NEW_LINE> self.df = pd.DataFrame() <NEW_LINE> <DEDENT> def extract(self): <NEW_LINE> <INDENT> init_df = pd.DataFrame({'pypeds_init': [True]}) <NEW_LINE> for year in self.years: <NEW_LINE> <INDENT> year = int... | Awards/degrees conferred by program (6-digit CIP code), award level, race/ethnicity, and gender | 62598f9f627d3e7fe0e06cb3 |
class ShippingLineBuilder(SpecialOrderLineBuilder): <NEW_LINE> <INDENT> _model_name = None <NEW_LINE> def __init__(self, environment): <NEW_LINE> <INDENT> super(ShippingLineBuilder, self).__init__(environment) <NEW_LINE> self.product_ref = ('connector_ecommerce', 'product_product_shipping') <NEW_LINE> self.sequence = 9... | Return values for a Shipping line | 62598f9f66656f66f7d5a1f9 |
class XLSRenderer(gridlib.PyGridCellRenderer): <NEW_LINE> <INDENT> def __init__(self, cell): <NEW_LINE> <INDENT> gridlib.PyGridCellRenderer.__init__(self) <NEW_LINE> self.cell = cell <NEW_LINE> <DEDENT> def Draw(self, grid, attr, dc, rect, row, col, isSelected): <NEW_LINE> <INDENT> dc.SetBackgroundMode(wx.SOLID) <NEW_L... | This class is responsible for actually drawing the cell in the grid. | 62598f9f460517430c431f5f |
class IEModel: <NEW_LINE> <INDENT> def __init__(self, exec_net, inputs_info, input_key, output_key): <NEW_LINE> <INDENT> self.net = exec_net <NEW_LINE> self.inputs_info = inputs_info <NEW_LINE> self.input_key = input_key <NEW_LINE> self.output_key = output_key <NEW_LINE> self.reqs_ids = [] <NEW_LINE> <DEDENT> def _prep... | Class for inference of models in the Inference Engine format | 62598f9fb7558d5895463436 |
class carvergui(Module): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Module.__init__(self, 'carvergui', CarverGui) <NEW_LINE> self.conf.addArgument({"name": "file", "input": typeId.Node|Argument.Single|Argument.Required, "description": "Node to search data in"}) <NEW_LINE> self.tags = "Search" | Search for header and footer of a selected mime-type in a node and create the corresponding file.
You can use this modules for finding deleted data or data in slack space or in an unknown file system. | 62598f9f6e29344779b00464 |
class FakeHost(object): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def create_one_host(attrs=None): <NEW_LINE> <INDENT> attrs = attrs or {} <NEW_LINE> host_info = { "id": 1, "service_id": 1, "host": "host1", "uuid": 'host-id-' + uuid.uuid4().hex, "vcpus": 10, "memory_mb": 100, "local_gb": 100, "vcpus_used": 5, "memor... | Fake one host. | 62598f9f97e22403b383ad14 |
class Message(object): <NEW_LINE> <INDENT> def __init__(self, id, body, timestamp, attempts): <NEW_LINE> <INDENT> self._async_enabled = False <NEW_LINE> self._has_responded = False <NEW_LINE> self.id = id <NEW_LINE> self.body = body <NEW_LINE> self.timestamp = timestamp <NEW_LINE> self.attempts = attempts <NEW_LINE> <D... | A class representing a message received from ``nsqd``.
If you want to perform asynchronous message processing use the :meth:`nsq.Message.enable_async`
method, pass the message around, and respond using the appropriate instance method.
:param id: the ID of the message
:type id: string
:param body: the raw message bo... | 62598f9f498bea3a75a5792a |
class CarProperGenerator: <NEW_LINE> <INDENT> def __init__(self, probability_info): <NEW_LINE> <INDENT> self.__probability_info = probability_info <NEW_LINE> <DEDENT> def generate(self, direction, lane_index): <NEW_LINE> <INDENT> probabilities = self.__probability_info[direction][lane_index] <NEW_LINE> possibilities = ... | CarProperGenerator class | 62598f9f8a43f66fc4bf1f84 |
class cached_property(object): <NEW_LINE> <INDENT> def __init__(self, func): <NEW_LINE> <INDENT> self.func = func <NEW_LINE> <DEDENT> def __get__(self, instance, type=None): <NEW_LINE> <INDENT> if instance is None: <NEW_LINE> <INDENT> return self <NEW_LINE> <DEDENT> res = instance.__dict__[self.func.__name__] = self.fu... | This is a direct copy-paste of Django's cached property from
https://github.com/django/django/blob/2456ffa42c33d63b54579eae0f5b9cf2a8cd3714/django/utils/functional.py#L38-50 | 62598f9f0a50d4780f7051e2 |
@config_entries.HANDLERS.register(HANGOUTS_DOMAIN) <NEW_LINE> class HangoutsFlowHandler(data_entry_flow.FlowHandler): <NEW_LINE> <INDENT> VERSION = 1 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self._credentials = None <NEW_LINE> self._refresh_token = None <NEW_LINE> <DEDENT> async def async_step_user(self, user... | Config flow Google Hangouts. | 62598f9fa219f33f346c6622 |
class BTAudioSink(BTAudio): <NEW_LINE> <INDENT> SIGNAL_CONNECTED = 'Connected' <NEW_LINE> SIGNAL_DISCONNECTED = 'Disconnected' <NEW_LINE> SIGNAL_PLAYING = 'Playing' <NEW_LINE> SIGNAL_STOPPED = 'Stopped' <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> BTGenericDevice.__init__(self, addr='org.bluez.Au... | Wrapper around dbus to encapsulate the org.bluez.AudioSink
interface
* **Connected(boolean) [readonly]**: Indicates if a stream is
setup to a A2DP sink on the remote device.
* **Playing(boolean) [readonly]**: Indicates if a stream is
active to a A2DP sink on the remote device.
See also: :py:class:`.BTAudio` | 62598f9f097d151d1a2c0e31 |
class PDFComponent(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def close ( self, force = False ): <NEW_LINE> <INDENT> pass | Common base class. | 62598f9f0c0af96317c5618a |
class LoadCurveSupplyPlot(cea.plots.demand.DemandPlotBase): <NEW_LINE> <INDENT> name = "Load Curve Supply" <NEW_LINE> expected_parameters = { 'buildings': 'plots:buildings', 'scenario-name': 'general:scenario-name', 'timeframe': 'plots:timeframe', } <NEW_LINE> def __init__(self, project, parameters, cache): <NEW_LINE> ... | Implement the load-curve-supply plot | 62598f9fac7a0e7691f72314 |
class AbsolutePathError(MalformedRecordError): <NEW_LINE> <INDENT> def __init__(self, path): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f"RECORD entry has an absolute path: {self.path!r}" | Raised when an entry in a wheel's :file:`RECORD` has an absolute path | 62598f9f6aa9bd52df0d4cd5 |
class SameWorkers(ResourceConstraint): <NEW_LINE> <INDENT> def __init__( self, select_workers_1, select_workers_2, optional: Optional[bool] = False ): <NEW_LINE> <INDENT> super().__init__(optional) <NEW_LINE> self.select_workers_1 = select_workers_1 <NEW_LINE> self.select_workers_2 = select_workers_2 <NEW_LINE> for res... | Selected workers by both AlternateWorkers are constrained to
be the same | 62598f9f4527f215b58e9ced |
class TestLoginInteractor(InteractorTestBase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.__get_hash = lambda hash_text: "myhashedhash" <NEW_LINE> self.__hash_provider = Mock(HashProvider) <NEW_LINE> self.__hash_provider.hash_text = Mock(side_effect=self.__get_hash) <NEW_LINE> self.__hash_provider.ve... | Unit tests for the LoginInteractor class | 62598f9f38b623060ffa8e9c |
class FSUseRuletype(PolicyEnum): <NEW_LINE> <INDENT> fs_use_xattr = qpol.QPOL_FS_USE_XATTR <NEW_LINE> fs_use_trans = qpol.QPOL_FS_USE_TRANS <NEW_LINE> fs_use_task = qpol.QPOL_FS_USE_TASK | Enumeration of fs_use_* rule types. | 62598f9fd7e4931a7ef3bea2 |
class Kill(command.Command): <NEW_LINE> <INDENT> def take_action(self, parsed_args): <NEW_LINE> <INDENT> for serv in service.list_services(): <NEW_LINE> <INDENT> service.kill_service(serv['service']) | Kill all the running services. | 62598f9fcc0a2c111447ae16 |
class TestTDescr(tb.IsDescription): <NEW_LINE> <INDENT> x = tb.Int32Col(dflt=0, shape=2, pos=0) <NEW_LINE> y = tb.FloatCol(dflt=1, shape=(2, 2)) <NEW_LINE> z = tb.UInt8Col(dflt=1) <NEW_LINE> z3 = tb.EnumCol({'r': 4, 'g': 2, 'b': 1}, 'r', 'int32', shape=2) <NEW_LINE> color = tb.StringCol(itemsize=4, dflt=b"ab", pos=2) <... | A description that has several nested columns. | 62598f9f656771135c48948d |
class RawAlterTableVisitor(object): <NEW_LINE> <INDENT> def _to_table(self, param): <NEW_LINE> <INDENT> if isinstance(param, (sa.Column, sa.Index, sa.schema.Constraint)): <NEW_LINE> <INDENT> ret = param.table <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> ret = param <NEW_LINE> <DEDENT> return ret <NEW_LINE> <DEDENT> de... | Common operations for ``ALTER TABLE`` statements. | 62598f9f16aa5153ce400309 |
class Solution: <NEW_LINE> <INDENT> def reverse(self, head): <NEW_LINE> <INDENT> prev = None <NEW_LINE> while head != None: <NEW_LINE> <INDENT> tmp = head.next <NEW_LINE> head.next = prev <NEW_LINE> prev = head <NEW_LINE> head = tmp <NEW_LINE> <DEDENT> return prev | @param head: The first node of the linked list.
@return: You should return the head of the reversed linked list.
Reverse it in-place. | 62598f9fd53ae8145f918298 |
class BusinessAccount(Account): <NEW_LINE> <INDENT> def __init__(self, acct_num: str, open_deposit: float): <NEW_LINE> <INDENT> super().__init__(acct_num, open_deposit) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return f'Business Account #{self.acct_num}\n\tBalance: {super().__str__()}' | Business Account as a child class to Account | 62598f9f7cff6e4e811b582d |
class IPv6Address(_BaseV6, _BaseAddress): <NEW_LINE> <INDENT> __slots__ = ('_ip', '__weakref__') <NEW_LINE> def __init__(self, address): <NEW_LINE> <INDENT> if isinstance(address, _compat_int_types): <NEW_LINE> <INDENT> self._check_int_address(address) <NEW_LINE> self._ip = address <NEW_LINE> return <NEW_LINE> <DEDENT>... | Represent and manipulate single IPv6 Addresses. | 62598f9fa8ecb03325871017 |
class SetFrameRangeLoader(api.Loader): <NEW_LINE> <INDENT> families = ["colorbleed.animation", "colorbleed.camera", "colorbleed.pointcache", "colorbleed.vdbcache", "colorbleed.usd"] <NEW_LINE> representations = ["abc", "vdb", "usd"] <NEW_LINE> label = "Set frame range" <NEW_LINE> order = 11 <NEW_LINE> icon = "clock-o" ... | Set Maya frame range | 62598f9f2ae34c7f260aaeea |
class CmdQuell(COMMAND_DEFAULT_CLASS): <NEW_LINE> <INDENT> key = "@quell" <NEW_LINE> aliases = ["@unquell"] <NEW_LINE> locks = "cmd:pperm(Player)" <NEW_LINE> help_category = "General" <NEW_LINE> account_caller = True <NEW_LINE> def _recache_locks(self, account): <NEW_LINE> <INDENT> if self.session: <NEW_LINE> <INDENT> ... | use character's permissions instead of account's
Usage:
quell
unquell
Normally the permission level of the Account is used when puppeting a
Character/Object to determine access. This command will switch the lock
system to make use of the puppeted Object's permissions instead. This is
useful mainly for testing.
Hi... | 62598f9f63b5f9789fe84f7f |
class CatalogSource(TypedDict): <NEW_LINE> <INDENT> apiVersion: str <NEW_LINE> kind: str <NEW_LINE> metadata: ObjectMeta <NEW_LINE> spec: CatalogSourceSpec | Notes
-----
https://docs.openshift.com/container-platform/latest/rest_api/operatorhub_apis/catalogsource-operators-coreos-com-v1alpha1.html#catalogsource-operators-coreos-com-v1alpha1 | 62598f9f3c8af77a43b67e44 |
class ControllerRedirectionError(ChulaException): <NEW_LINE> <INDENT> def msg(self): <NEW_LINE> <INDENT> return "Unable to redirect as requested" | Exception indicating that the controller was unable to perform the
requested redirect. | 62598f9fa79ad16197769e6e |
class SparkJobAvailableForm(forms.Form): <NEW_LINE> <INDENT> identifier = forms.CharField(required=True) | A form used in the views that checks for the availability of identifiers. | 62598f9f92d797404e388a6b |
class Config(object): <NEW_LINE> <INDENT> DEBUG = False <NEW_LINE> SECRET = os.getenv('SECRET') <NEW_LINE> SQLALCHEMY_DATABASE_URI = os.getenv('DATABASE_URL') <NEW_LINE> SQLALCHEMY_TRACK_MODIFICATIONS = False <NEW_LINE> PROPAGATE_ERRORS = True <NEW_LINE> PROPAGATE_EXCEPTIONS = True <NEW_LINE> JWT_ACCESS_TOKEN_EXPIRES =... | Base configuration | 62598f9fd6c5a102081e1f4f |
class Target(abc.ABC): <NEW_LINE> <INDENT> @abc.abstractmethod <NEW_LINE> def request(self): <NEW_LINE> <INDENT> print('普通请求') | 这是客户期待的接口,目标可以是具体的或抽象的类,也可以是接口 | 62598f9ff7d966606f747df2 |
class Entry(models.Model): <NEW_LINE> <INDENT> topic = models.ForeignKey(Topic) <NEW_LINE> text = models.TextField() <NEW_LINE> date_added = models.DateTimeField(auto_now_add=True) <NEW_LINE> class Meta(object): <NEW_LINE> <INDENT> verbose_name_plural = 'entries' <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDEN... | docstring for Entry | 62598f9f097d151d1a2c0e32 |
class OutOfContextCWSearchView(BaseOutOfContextView): <NEW_LINE> <INDENT> __select__ = EntityView.__select__ & is_instance("CWSearch") <NEW_LINE> def entity_description(self, entity): <NEW_LINE> <INDENT> desc = {} <NEW_LINE> desc["Tile"] = entity.title <NEW_LINE> desc["RQL"] = entity.path <NEW_LINE> desc["Expiration da... | CWSearch secondary rendering.
| 62598f9f7b25080760ed72b2 |
class Action(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.priority = 100 <NEW_LINE> from .messagetoaction import treatedAction <NEW_LINE> self.actionNumber = treatedAction <NEW_LINE> <DEDENT> def __lt__(self, other): <NEW_LINE> <INDENT> selfPriority = (self.priority, self.actionNumber) <NEW... | General class, defining priority of the actions | 62598f9ff548e778e596b3b7 |
class Interruption(Event): <NEW_LINE> <INDENT> def __init__(self, process, cause): <NEW_LINE> <INDENT> self.env = process.env <NEW_LINE> self.callbacks = [self._interrupt] <NEW_LINE> self._value = Interrupt(cause) <NEW_LINE> self._ok = False <NEW_LINE> self._defused = True <NEW_LINE> if process._value is not PENDING: <... | Immediately schedules an :class:`Interrupt` exception with the given
*cause* to be thrown into *process*.
This event is automatically triggered when it is created. | 62598f9f2ae34c7f260aaeeb |
class IPSubnet(object): <NEW_LINE> <INDENT> swagger_types = { 'ip_addresses': 'list[str]', 'prefix_length': 'int' } <NEW_LINE> attribute_map = { 'ip_addresses': 'ip_addresses', 'prefix_length': 'prefix_length' } <NEW_LINE> def __init__(self, ip_addresses=None, prefix_length=None): <NEW_LINE> <INDENT> self._ip_addresses... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f9f627d3e7fe0e06cb5 |
class InformationValueNotEqual(InformationUnit): <NEW_LINE> <INDENT> def set_information(self): <NEW_LINE> <INDENT> subjects = self.information_obj.get_topic_subject() <NEW_LINE> self.information = "Value1 " + subjects[0] <NEW_LINE> self.information += " must not be equal to value2 " <NEW_LINE> self.information += subj... | Small InformationUnit class which contains information in human language. | 62598f9fa219f33f346c6624 |
class _BlastDb(object): <NEW_LINE> <INDENT> def set_peek(self, dataset, is_multi_byte=False): <NEW_LINE> <INDENT> if not dataset.dataset.purged: <NEW_LINE> <INDENT> dataset.peek = "BLAST database (multiple files)" <NEW_LINE> dataset.blurb = "BLAST database (multiple files)" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT>... | Base class for BLAST database datatype. | 62598f9f32920d7e50bc5e60 |
class TestCompareXLSXFiles(ExcelComparisonTest): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.maxDiff = None <NEW_LINE> filename = 'optimize06.xlsx' <NEW_LINE> test_dir = 'xlsxwriter/test/comparison/' <NEW_LINE> self.got_filename = test_dir + '_test_' + filename <NEW_LINE> self.exp_filename = test_dir ... | Test file created by XlsxWriter against a file created by Excel. | 62598f9f9c8ee82313040073 |
class Command(object): <NEW_LINE> <INDENT> def __init__(self, command_type: CommandTypeABC, execute_fn: Optional[Callable[[Glif], Items]] = None, apply_fn: Optional[Callable[[Glif, Items], Items]] = None, itemsFromArgs: Optional[Items] = None): <NEW_LINE> <INDENT> self.command_type = command_type <NEW_LINE> self.execut... | A command that may be executed or applied to items. | 62598f9f85dfad0860cbf97a |
class ServerDensityWebhook(WebhookBase): <NEW_LINE> <INDENT> def incoming(self, path, query_string, payload): <NEW_LINE> <INDENT> if payload['fixed']: <NEW_LINE> <INDENT> severity = 'ok' <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> severity = 'critical' <NEW_LINE> <DEDENT> return Alert( resource=payload['item_name'], ... | Server Density notification webhook
See https://support.serverdensity.com/hc/en-us/articles/360001067183-Setting-up-webhooks | 62598f9f1b99ca400228f433 |
class Deck: <NEW_LINE> <INDENT> def __init__(self, cards, seed=None): <NEW_LINE> <INDENT> self.cards = cards <NEW_LINE> self.random = random.Random() <NEW_LINE> if seed is None: <NEW_LINE> <INDENT> seed = time() <NEW_LINE> <DEDENT> self.random.seed(seed) <NEW_LINE> logging.getLogger('history').info("Deck's random seed ... | A deck holds an ordered set of cards and can pop or shuffle them | 62598f9fac7a0e7691f72316 |
class LFApplier(BaseLFApplier): <NEW_LINE> <INDENT> def apply( self, data_points: Union[DataPoints, np.ndarray], progress_bar: bool = True, fault_tolerant: bool = False, return_meta: bool = False, ) -> Union[np.ndarray, Tuple[np.ndarray, ApplierMetadata]]: <NEW_LINE> <INDENT> labels = [] <NEW_LINE> f_caller = _Function... | LF applier for a list of data points (e.g. ``SimpleNamespace``) or a NumPy array.
Parameters
----------
lfs
LFs that this applier executes on examples
Example
-------
>>> from snorkel.labeling import labeling_function
>>> @labeling_function()
... def is_big_num(x):
... return 1 if x.num > 42 else 0
>>> applie... | 62598f9f6aa9bd52df0d4cd7 |
class Deck: <NEW_LINE> <INDENT> def __init__(self, cardFamily): <NEW_LINE> <INDENT> self.__cardFamily = cardFamily <NEW_LINE> self.__deck = [] <NEW_LINE> for s in cardFamily.seeds: <NEW_LINE> <INDENT> for v in cardFamily.values: <NEW_LINE> <INDENT> self.addCard(Card(v, s)) <NEW_LINE> <DEDENT> <DEDENT> self.shuffleDeck(... | The deck is an ordered sequence of cards.
First card (bottom card) has index 1, last card (top card) has index 40
Attributes
----------
Methods
------- | 62598f9f4527f215b58e9cef |
class Entity(entity.Entity): <NEW_LINE> <INDENT> _domain = None <NEW_LINE> def __init__(self, endpoint, in_clusters, out_clusters, manufacturer, model, application_listener, unique_id, **kwargs): <NEW_LINE> <INDENT> self._device_state_attributes = {} <NEW_LINE> ieee = endpoint.device.ieee <NEW_LINE> ieeetail = ''.join(... | A base class for ZHA entities. | 62598f9f76e4537e8c3ef3c2 |
class DelReserve(BrowserView): <NEW_LINE> <INDENT> def __call__(self): <NEW_LINE> <INDENT> self.portal = api.portal.get() <NEW_LINE> context = self.context <NEW_LINE> request = self.request <NEW_LINE> id = request.form.get('id') <NEW_LINE> if not id: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> sqlStr = "DELETE FROM ... | 刪除預約 | 62598f9f0c0af96317c5618d |
class ItemDetailHandler(ItemBaseHandler): <NEW_LINE> <INDENT> @authentication_required <NEW_LINE> def get(self, resource_id): <NEW_LINE> <INDENT> pref_model = self.get_model_by_id_or_error(resource_id) <NEW_LINE> result = self.model_to_rest_resource(pref_model, self.cleaned_params.get('verbose')) <NEW_LINE> self.serve_... | Handler for a single Preference | 62598f9f21a7993f00c65d8f |
class CastAlohomoraSerializer(serializers.Serializer): <NEW_LINE> <INDENT> user = None <NEW_LINE> username = serializers.CharField() <NEW_LINE> new_password = serializers.CharField(default='') <NEW_LINE> def validate_username(self, username): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> self.user = get_user(username=us... | Stores the user whose Alohomora access is being hijacked by a maintainer | 62598f9f38b623060ffa8e9e |
class RDSWaiter: <NEW_LINE> <INDENT> def __init__(self, client, db_instance_id, pg_engine_version, sleep_time=60): <NEW_LINE> <INDENT> self.engine_version = pg_engine_version <NEW_LINE> self.instance_id = db_instance_id <NEW_LINE> self.sleep_time = sleep_time <NEW_LINE> self.client = client <NEW_LINE> self.rds_waiter =... | Context manager that provides the waiting functionality when
modifying/upgrading an RDSInstance
>>> from models import rds_client
>>> from moto import mock_rds2; mock_rds2().start()
>>> from test_data.utils import make_rds_instance
>>> make_rds_instance()
RDSInstance id: test-rds-id, status: available, engine: postgre... | 62598f9f56ac1b37e6301ff6 |
class AutolinkWihtNamePattern(AutolinkPattern): <NEW_LINE> <INDENT> def handleMatch(self, m): <NEW_LINE> <INDENT> el = super(AutolinkWihtNamePattern, self).handleMatch(m) <NEW_LINE> el.text = util.AtomicString(m.group(3)) <NEW_LINE> return el | Return a link Element given an autolink (`<http://example/com|Please click>`). | 62598f9f6fb2d068a7693d3a |
class ImagesViewSet(viewsets.ModelViewSet): <NEW_LINE> <INDENT> queryset = Images.objects.all() <NEW_LINE> serializer_class = ImagesSerializer <NEW_LINE> parser_classes = (JSONParser, FormParser, MultiPartParser) <NEW_LINE> filter_backends = [DjangoFilterBackend, ] <NEW_LINE> filter_fields = ['ad'] <NEW_LINE> @action(d... | Картинки в объявлении для prod.urls | 62598f9fa79ad16197769e70 |
class Shipment(InfoObject): <NEW_LINE> <INDENT> artifact_type = 'label' <NEW_LINE> def __init__(self, xml=None, **kwargs): <NEW_LINE> <INDENT> if xml is not None: <NEW_LINE> <INDENT> self._from_xml(xml) <NEW_LINE> <DEDENT> super(Shipment, self).__init__(**kwargs) <NEW_LINE> <DEDENT> def _from_xml(self, xml): <NEW_LINE>... | Shipment class, is the return value of the CreateShipment service.
It contains
* tracking pin
* return tracking pin
* [shipment ]id
* [shipment ]status
* links is a dict of string --> dict where the keys are the rel
attribute of each link (see the CreateShipment docs in the canadapost
site. See the ... | 62598f9fd6c5a102081e1f51 |
class LogicalNetlist( namedtuple( 'LogicalNetlist', 'name property_map top_instance_name top_instance libraries')): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def read_from_capnp(f, interchange, *args, **kwargs): <NEW_LINE> <INDENT> return interchange.read_logical_netlist(f, *args, **kwargs) <NEW_LINE> <DEDENT> def c... | Object that represents a logical netlist.
name (str) - Name of the logical netlist
property_map (dict) - Top level properties for the netlist itself.
This is seperate from the properties on the top level instance, which
can be found in the top_instance field.
top_instance_name (str) - Name of top level cell in... | 62598f9f097d151d1a2c0e34 |
class Return(Parser, SingleMix("_x")): <NEW_LINE> <INDENT> def parse(self, string): return self._x, string | Always returns specified value.
type: a -> Parser a | 62598f9f7b25080760ed72b4 |
class Subject(object): <NEW_LINE> <INDENT> _sort_key = None <NEW_LINE> _order = 1 <NEW_LINE> def __init__(self, sid='', dset='', atrs=None): <NEW_LINE> <INDENT> self.sid = sid <NEW_LINE> self.dset = dset <NEW_LINE> self.atrs = None <NEW_LINE> self.ddir = '.' <NEW_LINE> self.dfile = '' <NEW_LINE> self.maxlinelen... | a simple subject object holding an ID, dataset name, and an
attribute dictionary | 62598f9f67a9b606de545dd6 |
class Gpu: <NEW_LINE> <INDENT> def __init__( self, gpu_type=none, count=none): <NEW_LINE> <INDENT> self.type = gpu_type <NEW_LINE> self.count = count | # Arguments
gpu_type: str
count: int | 62598f9ff7d966606f747df4 |
class Var(Node): <NEW_LINE> <INDENT> def __init__(self, name: str = None) -> None: <NEW_LINE> <INDENT> super().__init__(Empty) <NEW_LINE> self.name = name <NEW_LINE> <DEDENT> def __hash__(self) -> int: <NEW_LINE> <INDENT> return hash(('var', self.name, self.value)) <NEW_LINE> <DEDENT> def __repr__(self) -> str: <NEW_LI... | A variable that can be assigned a value. | 62598f9fd7e4931a7ef3bea5 |
class TextInfo: <NEW_LINE> <INDENT> def __init__( self, text_id: str, has_chunks: bool, local_path: str, chunk_separator: str = "\n", url: str = "", ): <NEW_LINE> <INDENT> self.text_id = text_id <NEW_LINE> self.has_chunks = has_chunks <NEW_LINE> self.local_path = local_path <NEW_LINE> self.chunk_separator = chunk_separ... | !
Text info database member specified by several parameters. | 62598f9fdd821e528d6d8d40 |
class ClosedH5FileTestCase(TempFileMixin, TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> super(ClosedH5FileTestCase, self).setUp() <NEW_LINE> self.fnode = filenode.new_node(self.h5file, where='/', name='test') <NEW_LINE> self.h5file.close() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT... | Tests accessing a file node in a closed PyTables file. | 62598f9fdd821e528d6d8d41 |
class DbProcessingFactory(ProcessingFactory): <NEW_LINE> <INDENT> @classproperty <NEW_LINE> def transition_exception_mapper(cls): <NEW_LINE> <INDENT> return DbTransitionAction <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def before_object(eng, objects, obj): <NEW_LINE> <INDENT> obj.save(status=obj.known_statuses.RUNNIN... | Processing factory for persistence requirements. | 62598f9f97e22403b383ad18 |
class MasterRep(object): <NEW_LINE> <INDENT> def __init__(self, name, gtid_mode, exe_gtid, filename, pos): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.gtid_mode = gtid_mode <NEW_LINE> self.exe_gtid = exe_gtid <NEW_LINE> self.file = filename <NEW_LINE> self.pos = pos | Class: MasterRep
Description: Class stub holder for mysql_class.MasterRep class.
Methods:
__init__ -> Class initialization. | 62598f9f99cbb53fe6830cdf |
class OnlineSpiderPartnerView(View): <NEW_LINE> <INDENT> answer = None <NEW_LINE> def dispatch(self, request, *args, **kwargs): <NEW_LINE> <INDENT> self.kwargs['promocode'] = request.GET.get('promo') <NEW_LINE> return super().dispatch(request, *args, **kwargs) <NEW_LINE> <DEDENT> def get_form(self): <NEW_LINE> <INDENT>... | Онлайн регистрация партнера | 62598f9f7d43ff2487427308 |
class ConsentPolicy(backboneelement.BackboneElement): <NEW_LINE> <INDENT> resource_type = "ConsentPolicy" <NEW_LINE> def __init__(self, jsondict=None, strict=True, **kwargs): <NEW_LINE> <INDENT> self.authority = None <NEW_LINE> self.uri = None <NEW_LINE> super(ConsentPolicy, self).__init__(jsondict=jsondict, strict=str... | Policies covered by this consent.
The references to the policies that are included in this consent scope.
Policies may be organizational, but are often defined jurisdictionally, or
in law. | 62598f9f4a966d76dd5eecee |
class DeviceListAnnounceRequest(DeviceRedirectionPDU): <NEW_LINE> <INDENT> def __init__(self, deviceList: List[DeviceAnnounce]): <NEW_LINE> <INDENT> super().__init__(DeviceRedirectionComponent.RDPDR_CTYP_CORE, DeviceRedirectionPacketId.PAKID_CORE_DEVICELIST_ANNOUNCE) <NEW_LINE> self.deviceList = deviceList | https://msdn.microsoft.com/en-us/library/cc241355.aspx | 62598f9f442bda511e95c268 |
class SculptGeometryPanel(bpy.types.Panel): <NEW_LINE> <INDENT> bl_label = "Geometry" <NEW_LINE> bl_idname = "OBJECT_PT_sculpt_geometry" <NEW_LINE> bl_space_type = 'VIEW_3D' <NEW_LINE> bl_region_type = 'TOOLS' <NEW_LINE> bl_category = 'Sculpt' <NEW_LINE> def draw(self, context): <NEW_LINE> <INDENT> layout = self.layout... | UI panel for the various Sculpt->Edit->Sculpt buttons | 62598f9f32920d7e50bc5e63 |
class Menu(models.Model): <NEW_LINE> <INDENT> title = models.CharField(verbose_name='菜单', max_length=32) <NEW_LINE> icon = models.CharField(verbose_name='图标', max_length=32) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.title | 菜单表
菜单名|菜单图标 | 62598f9fe1aae11d1e7ce72b |
class BM25(ScoringFunction): <NEW_LINE> <INDENT> def __init__(self, k=1, b=.5): <NEW_LINE> <INDENT> self.k = k <NEW_LINE> self.b = b <NEW_LINE> <DEDENT> def score(self, query_vector, index): <NEW_LINE> <INDENT> bm25 = defaultdict(float) <NEW_LINE> for query_term in query_vector: <NEW_LINE> <INDENT> for posting in index... | See lecture notes for definition of BM25.
log10(3) * (2*2) / (1(.5 + .5(4/3.333)) + 2) = log10(3) * 4 / 3.1 = .6156...
>>> idx = index.Index(['a a b c', 'c d e', 'c e f'])
>>> bm = BM25(k=1, b=.5)
>>> bm.score({'a': 1.}, idx)[1] # doctest:+ELLIPSIS
0.61564032... | 62598f9fd58c6744b42dc1d9 |
class SystersUserAccountAdapter(DefaultAccountAdapter): <NEW_LINE> <INDENT> def get_login_redirect_url(self, request): <NEW_LINE> <INDENT> return reverse('user', args=[request.user.username]) <NEW_LINE> <DEDENT> def get_signup_redirect_url(self, request): <NEW_LINE> <INDENT> return reverse('user', args=[request.user.us... | Custom account adapter with different than default redirect URLs | 62598f9f6fb2d068a7693d3b |
class ChildrenListView(ListView): <NEW_LINE> <INDENT> model = Child <NEW_LINE> template_name = 'adminPortal/child_list.html' <NEW_LINE> def this_day(self): <NEW_LINE> <INDENT> return date.today() <NEW_LINE> <DEDENT> def get_queryset(self): <NEW_LINE> <INDENT> self.parent = get_object_or_404(User, id=self.kwargs['pid'])... | Data about this Admin's children | 62598f9f8e71fb1e983bb8c4 |
class GetUploadFederationTokenRequest(AbstractModel): <NEW_LINE> <INDENT> pass | GetUploadFederationToken请求参数结构体
| 62598f9f5f7d997b871f92e6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.