code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class Query(object): <NEW_LINE> <INDENT> Selectors = namedtuple('Selectors', ['date_search', 'number', 'filters', 'return_object']) <NEW_LINE> DateSearch = namedtuple('DateSearch', ['type', 'values']) <NEW_LINE> ReturnObjects = {'NEO': NearEarthObject, 'Path': OrbitPath} <NEW_LINE> def __init__(self, **kwargs): <NEW_LI... | Object representing the desired search query operation to build. The Query uses the Selectors
to structure the query information into a format the NEOSearcher can use for date search. | 62598fac92d797404e388b39 |
class ProjectSupportEditAnswerView(ProjectDiscussionEditAnswerView): <NEW_LINE> <INDENT> def get_success_url(self): <NEW_LINE> <INDENT> return reverse('project_support_view', args=[self.project_translation.slug, self.current_question.id]) | Edit a given project sheet support answer | 62598fac4428ac0f6e6584ce |
class Corpus: <NEW_LINE> <INDENT> def __init__(self, path, index=True, trie=True): <NEW_LINE> <INDENT> self._index = Index() if index else None <NEW_LINE> self._trie = Trie() if trie else None <NEW_LINE> path = pathlib.Path(path) <NEW_LINE> for i, doc in enumerate(sorted(path.rglob("*.txt"))): <NEW_LINE> <INDENT> if i ... | A corpus of documents that supports:
- search: given a query, return a list of contained documents ranked by
relevance
- compelte: given a query, return prefix-matched words from the corpus | 62598fac5166f23b2e243383 |
class Relay_Logic(QThread): <NEW_LINE> <INDENT> relay02_setmaxtemp = 25.50 <NEW_LINE> relay02_setmintemp = 18.50 <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> QThread.__init__(self) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> self.relay01_logic() <NEW_LINE> <DEDENT> def relay01_deactivate(self): <NEW_LI... | Logic that is used for automatic relay control | 62598facf548e778e596b54e |
@override_settings( LANGUAGES=[('en', 'English')], LANGUAGE_CODE='en', TEMPLATES=AUTH_TEMPLATES, ROOT_URLCONF='auth_tests.urls', ) <NEW_LINE> class AuthViewsTestCase(TestCase): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def setUpTestData(cls): <NEW_LINE> <INDENT> cls.u1 = User.objects.create_user(username='testclient'... | Helper base class for all the follow test cases. | 62598fac3cc13d1c6d465716 |
class GCIOrgAppEditPageTest(test_utils.GCIDjangoTestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.init() <NEW_LINE> self.url = '/gci/org/application/edit/%s' % self.gci.key().name() <NEW_LINE> self.post_params = { 'title': 'Test Title', 'short_name': 'Test Short Name', 'content': 'Test Content', ... | Tests for organization applications edit page.
| 62598facd486a94d0ba2bf79 |
class TextAreaListField(TextAreaField): <NEW_LINE> <INDENT> def _value(self): <NEW_LINE> <INDENT> return '\n'.join(self.data) if self.data else '' <NEW_LINE> <DEDENT> def process_formdata(self, valuelist): <NEW_LINE> <INDENT> self.data = valuelist[0].splitlines() if valuelist else [] | textarea transparently handling list of items | 62598fac23849d37ff85105f |
class OTPSlot(): <NEW_LINE> <INDENT> def __init__(self, name, key, base32_encoded, salt, digits): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.key = key <NEW_LINE> self.base32_encoded = base32_encoded <NEW_LINE> self.salt = salt <NEW_LINE> self.digits = digits | Base OTP slot representation | 62598faca8370b77170f0386 |
class User(Model): <NEW_LINE> <INDENT> def __init__(self, form): <NEW_LINE> <INDENT> self.id = form.get('id', None) <NEW_LINE> self.username = form.get('username', '') <NEW_LINE> self.password = form.get('password', '') <NEW_LINE> <DEDENT> def salted_password(self, password, salt='$!@><?>HUI&DWQa`'): <NEW_LINE> <INDENT... | User 是一个保存用户数据的 model
现在只有两个属性 username 和 password | 62598faccb5e8a47e493c14e |
class Sprite(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self, entity, view): <NEW_LINE> <INDENT> pygame.sprite.Sprite.__init__(self) <NEW_LINE> self.entity = entity <NEW_LINE> self.view = view <NEW_LINE> self.color = self.get_color() <NEW_LINE> self.store_image() <NEW_LINE> <DEDENT> def store_image(self): ... | Class to represent world entities as sprites. | 62598fac38b623060ffa9044 |
class Monitor(TimestampedModelMixin, UUIDPrimaryKeyMixin): <NEW_LINE> <INDENT> name = models.CharField(verbose_name=_("name"), max_length=80) <NEW_LINE> user = models.OneToOneField( settings.AUTH_USER_MODEL, on_delete=models.PROTECT, verbose_name=_("user") ) <NEW_LINE> domain = models.ForeignKey( EnforcementDomain, on_... | A person who monitors through the Monitoring API. | 62598fac3346ee7daa33761e |
class GuessRacetrackGame(GuessingGame): <NEW_LINE> <INDENT> def __init__(self, bot): <NEW_LINE> <INDENT> excel_dict = pd.read_excel("data/Racetracks.xlsx").to_dict() <NEW_LINE> data = self._convert_pandas_dict(excel_dict) <NEW_LINE> data = [{**x, "name": x["Name"]} for x in data] <NEW_LINE> super().__init__( command="!... | Play the Guess The Minion Game.
One Minion is randomly chosen from the list and the users
have to guess which on it is. Give points to the winner. | 62598fac851cf427c66b8267 |
class testemptypotion: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def reset(): pass <NEW_LINE> type=0 <NEW_LINE> subtype=1 <NEW_LINE> name="empty" <NEW_LINE> hpr=0 <NEW_LINE> mpr=0 | Empty potion | 62598fac01c39578d7f12d2a |
class MostraOcultaPontos(bpy.types.Operator): <NEW_LINE> <INDENT> bl_idname = "object.rhin_mostra_oculta_pontos" <NEW_LINE> bl_label = "Nose dists" <NEW_LINE> def execute(self, context): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if bpy.data.collections['Anatomical Points - Soft Tissue'].hide_viewport == False: <NEW_... | Tooltip | 62598fac97e22403b383aeb8 |
class PolicyViolationException(RuntimeError): <NEW_LINE> <INDENT> pass | Запускается при обнаружении нарушения политики обработки набора правил
Появляется, например, когда используется политика обработки `error`, а для какого-то входного файла не находится
ни одного соответствующего ему действия. | 62598fac379a373c97d98fbe |
class MyManager(models.Manager): <NEW_LINE> <INDENT> def get_query_set(self): <NEW_LINE> <INDENT> return self.model.QuerySet(self.model) | Custom query manager that allows for overriding the default __repr__.
The purpose is to make a more user friendly output for event queries.
http://stackoverflow.com/questions/2163151/custom-queryset-and-manager-without-breaking-dry
https://docs.djangoproject.com/en/1.5/topics/db/managers/#custom-managers | 62598fac442bda511e95c402 |
class IndicatorRelationship(db.Model): <NEW_LINE> <INDENT> __tablename__ = "indicatorRelationships" <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> source_id = Column(String(255), ForeignKey("indicators.id")) <NEW_LINE> source = relationship("Indicator", foreign_keys=source_id) <NEW_LINE> target_id = Colum... | classdocs | 62598fac16aa5153ce4004ad |
class custom_jvp(Generic[R]): <NEW_LINE> <INDENT> def __init__(self, fun: Callable[..., R], static_argnums: Tuple[int, ...] = ()): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> static_argnums = tuple(sorted(static_argnums)) <NEW_LINE> self.jvp = jax.custom_jvp(fun, nondiff_argnums=static_argnums) <NEW_LINE> <DEDENT... | This is a shim class over jax.custom_jvp to:
- allow custom_vjp to be used on methods, and
- rename nondiff_argnums to static_argnums. | 62598fac8da39b475be0318f |
class Test_reformat(unittest.TestCase): <NEW_LINE> <INDENT> def test_abbreviate_firstname(self): <NEW_LINE> <INDENT> self.assertEqual( bib.reformat.abbreviate_firstname("de Geus, Thomas Willem Jan"), "de Geus, T. W. J.", ) <NEW_LINE> self.assertEqual( bib.reformat.abbreviate_firstname("de Geus, Thomas Willem Jan", sep=... | GooseBib.reformat | 62598fac91f36d47f2230e7b |
class ExportedLinuxSyscallTableEntryConverter(RekallResponseConverter): <NEW_LINE> <INDENT> input_rdf_type = "RekallResponse" <NEW_LINE> @staticmethod <NEW_LINE> def HandleTableRow(metadata, message): <NEW_LINE> <INDENT> row = message[1] <NEW_LINE> symbols = row.get("symbol", None) <NEW_LINE> if not isinstance(symbols,... | Converts suitable RekallResponses to ExportedLinuxSyscallTableEntrys. | 62598faca8370b77170f0387 |
class CreateTransfer(FormView): <NEW_LINE> <INDENT> form_class = TransferForm <NEW_LINE> template_name = 'transfer_form.html' <NEW_LINE> success_url = '/transfer/success' <NEW_LINE> @atomic <NEW_LINE> def form_valid(self, form): <NEW_LINE> <INDENT> user = form.cleaned_data['user'] <NEW_LINE> inn = form.cleaned_data['in... | Представление создания денежного перевода. | 62598fac4a966d76dd5eee8c |
class Encoder(nn.Module): <NEW_LINE> <INDENT> def __init__( self, num_types, d_model, d_inner, n_layers, n_head, d_k, d_v, dropout): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.d_model = d_model <NEW_LINE> self.position_vec = torch.tensor( [math.pow(10000.0, 2.0 * (i // 2) / d_model) for i in range(d_model)]... | A encoder model with self attention mechanism. | 62598faccc0a2c111447afbc |
class click_button_by_index_args: <NEW_LINE> <INDENT> thrift_spec = ( None, (1, TType.I32, 'index', None, None, ), ) <NEW_LINE> def __init__(self, index=None,): <NEW_LINE> <INDENT> self.index = index <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAcce... | Attributes:
- index | 62598fac32920d7e50bc6000 |
class IAttributeIndex(zope.interface.Interface): <NEW_LINE> <INDENT> interface = zope.schema.Choice( title=_(u"Interface"), description=_(u"Objects will be adapted to this interface"), vocabulary="Interfaces", required=False, ) <NEW_LINE> field_name = zope.schema.NativeStringLine( title=_(u"Field Name"), description=_(... | I index objects by first adapting them to an interface, then
retrieving a field on the adapted object. | 62598fac097d151d1a2c0fd4 |
class BranchDirection: <NEW_LINE> <INDENT> default = _constants.CPX_BRANCH_GLOBAL <NEW_LINE> down = _constants.CPX_BRANCH_DOWN <NEW_LINE> up = _constants.CPX_BRANCH_UP <NEW_LINE> def __getitem__(self, item): <NEW_LINE> <INDENT> if item == _constants.CPX_BRANCH_GLOBAL: <NEW_LINE> <INDENT> return 'default' <NEW_L... | Constants defining branch directions | 62598facbe8e80087fbbf00f |
class WrongConnectionState(ConnectionError): <NEW_LINE> <INDENT> pass | Not connected to the destination when has to be, disconnected when hasn't. | 62598fac8e7ae83300ee904e |
class TestHandleGetRpm: <NEW_LINE> <INDENT> @mock.patch('fand.communication.send') <NEW_LINE> def test_sanity(self, send, mock_shelf, mock_socket): <NEW_LINE> <INDENT> mock_shelf.rpm = 3000 <NEW_LINE> server._handle_get_rpm(mock_socket, mock_shelf.identifier) <NEW_LINE> send.assert_called_once_with(mock_socket, com.Req... | _handle_get_rpm() tests | 62598fac236d856c2adc9413 |
class Record(list): <NEW_LINE> <INDENT> def __str__(self): <NEW_LINE> <INDENT> return "\n".join(str(motif) for motif in self) | Class to store the information in a position frequency matrix table.
The record inherits from a list containing the individual motifs. | 62598fac6aa9bd52df0d4e74 |
class TxInput(object): <NEW_LINE> <INDENT> def __init__(self, prev_txid, out_idx, signature, pubkey): <NEW_LINE> <INDENT> self.prev_txid = prev_txid <NEW_LINE> self.prev_tx_out_idx = out_idx <NEW_LINE> self.signature = signature <NEW_LINE> self.pubkey = pubkey <NEW_LINE> <DEDENT> def can_unlock_txoutput_with(self, addr... | 一个输入引用之前的一个输出 | 62598fac4e4d5625663723d2 |
class ReplyKeyboardRemove(PyrogramType): <NEW_LINE> <INDENT> def __init__(self, selective: bool = None): <NEW_LINE> <INDENT> super().__init__(None) <NEW_LINE> self.selective = selective <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def read(o): <NEW_LINE> <INDENT> return ReplyKeyboardRemove( selective=o.selective ) <NEW... | Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and
display the default letter-keyboard. By default, custom keyboards are displayed until a new keyboard is sent
by a bot. An exception is made for one-time keyboards that are hidden immediately after the user presses a
... | 62598facf7d966606f747f91 |
class RateLimitError(ApiResponseError): <NEW_LINE> <INDENT> pass | Raised when the 3rd-party service's rate limit has been hit | 62598fac3d592f4c4edbae78 |
class MainEngine: <NEW_LINE> <INDENT> def __init__(self, broker, config_path='me.json'): <NEW_LINE> <INDENT> self.user = easytrader.use(broker) <NEW_LINE> self.user.read_config(config_path) <NEW_LINE> self.user.autologin() <NEW_LINE> self.event_engine = EventEngine() <NEW_LINE> self.quotation_engine = Quotation(self.ev... | 主引擎,负责行情 / 事件驱动引擎 / 交易 | 62598fac9c8ee82313040147 |
class Gripper: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.activated = False <NEW_LINE> <DEDENT> def step(self): <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> def activate(self, objects): <NEW_LINE> <INDENT> del objects <NEW_LINE> return <NEW_LINE> <DEDENT> def release(self): <NEW_LINE> <INDENT> r... | Base gripper class. | 62598faccc0a2c111447afbd |
class ThreadParallelShareDict(ParallelShareDictFw): <NEW_LINE> <INDENT> def _init(self, tag): <NEW_LINE> <INDENT> _gdict = RunTool.get_global_var('ThreadParallelShareDict' + tag) <NEW_LINE> if _gdict is None: <NEW_LINE> <INDENT> _gdict = dict() <NEW_LINE> RunTool.set_global_var('ThreadParallelShareDict' + tag, _gdict) ... | 线程共享字典对象(基于ParallelShareDictFw的实现) | 62598fac7b25080760ed745b |
class Button(Label): <NEW_LINE> <INDENT> state = OptionProperty('normal', options=('normal', 'down')) <NEW_LINE> background_normal = StringProperty('data/images/button.png') <NEW_LINE> background_down = StringProperty('data/images/button_pressed.png') <NEW_LINE> def __init__(self, **kwargs): <NEW_LINE> <INDENT> super(B... | Button class, see module documentation for more information.
:Events:
`on_press`
Fired when the button is pressed.
`on_release`
Fired when the button is released (i.e., the touch/click that
pressed the button goes away). | 62598facfff4ab517ebcd791 |
class Level1Design(SPMCommand): <NEW_LINE> <INDENT> input_spec = Level1DesignInputSpec <NEW_LINE> output_spec = Level1DesignOutputSpec <NEW_LINE> _jobtype = 'stats' <NEW_LINE> _jobname = 'fmri_spec' <NEW_LINE> def _format_arg(self, opt, spec, val): <NEW_LINE> <INDENT> if opt in ['spm_mat_dir', 'mask_image']: <NEW_LINE>... | Generate an SPM design matrix
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=61
Examples
--------
>>> level1design = Level1Design()
>>> level1design.inputs.timing_units = 'secs'
>>> level1design.inputs.interscan_interval = 2.5
>>> level1design.inputs.bases = {'hrf':{'derivs': [0,0]}}
>>> level1design.inputs.se... | 62598fac23849d37ff851061 |
class ProxyResource(Resource): <NEW_LINE> <INDENT> _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, } <NEW_LINE> def __init... | The resource model definition for a ARM proxy resource.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: Fully qualified resource ID for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:varty... | 62598fac7047854f4633f386 |
class Ascent(Segment): <NEW_LINE> <INDENT> def __defaults__(self): <NEW_LINE> <INDENT> self.tag = 'Ascent Segment' <NEW_LINE> <DEDENT> def initialize(self): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def unpack(self,x): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def dynamic... | Ascent Segment: general flight with thrust control vector | 62598fac7c178a314d78d449 |
class IcebergSetPattern(SetPattern): <NEW_LINE> <INDENT> MIN_SUP = 0 <NEW_LINE> @classmethod <NEW_LINE> def fix_desc(cls, desc): <NEW_LINE> <INDENT> if len(desc) < cls.MIN_SUP: <NEW_LINE> <INDENT> return cls.bottom() <NEW_LINE> <DEDENT> return desc <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def intersection(cls, desc1... | Generalizes SetPattern to allow for a minimal cardinality representation | 62598fac8a43f66fc4bf2129 |
class CustomJSONEncoder(JSONEncoder): <NEW_LINE> <INDENT> def default(self, obj): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if isinstance(obj, date): <NEW_LINE> <INDENT> return obj.isoformat() <NEW_LINE> <DEDENT> iterable = iter(obj) <NEW_LINE> <DEDENT> except TypeError: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> ... | Use ISO 8601 for dates | 62598fac91f36d47f2230e7c |
class ILicenseGroup(interfaces.IMetadataGroup): <NEW_LINE> <INDENT> pass | Placeholder interface for differentiating between regular groups and
license-selector metadata groups. | 62598fac1b99ca400228f506 |
class Solution: <NEW_LINE> <INDENT> def reachEndpoint(self, map): <NEW_LINE> <INDENT> n=len(map) <NEW_LINE> if n==0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> m=len(map[0]) <NEW_LINE> if m==0: <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> visited=[[False for _ in range(m)] for _ in range(n)] <NEW_LINE... | @param map: the map
@return: can you reach the endpoint | 62598fac8e71fb1e983bba60 |
@singleton <NEW_LINE> class IdWorker(object): <NEW_LINE> <INDENT> __instance = None <NEW_LINE> def __init__(self, datacenter_id=1, worker_id=2, sequence=0): <NEW_LINE> <INDENT> if worker_id > MAX_WORKER_ID or worker_id < 0: <NEW_LINE> <INDENT> raise ValueError('worker_id值越界') <NEW_LINE> <DEDENT> if datacenter_id > MAX_... | 用于生成IDs | 62598fac7b180e01f3e49027 |
class Subscriber(PortalContent, DefaultDublinCoreImpl, PNLContentBase): <NEW_LINE> <INDENT> bounces = None <NEW_LINE> factory_type_information = { 'id': 'Subscriber', 'portal_type': 'Subscriber', 'meta_type': 'Subscriber', 'description': 'A newletter subscriber (has no sense oudside a NewsletterTheme object)', 'content... | Subscriber class | 62598fac85dfad0860cbfa4a |
class ProxmoxHost(): <NEW_LINE> <INDENT> def __init__(self, name, status): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.status = status <NEW_LINE> self.child_vms = [] <NEW_LINE> self.per_cpu_mhz = 0 <NEW_LINE> self.cpu_count = 0 <NEW_LINE> self.max_mhz = 0 <NEW_LINE> self.max_memory = 0 <NEW_LINE> self.allocate... | Represents a Proxmox Host, we pass in the name and status
and it keeps track of it's memory, cpu, running vms, etc | 62598face1aae11d1e7ce7fa |
class Sql(object): <NEW_LINE> <INDENT> def __init__(self, connection, _verbose=True): <NEW_LINE> <INDENT> self.connection = connection <NEW_LINE> self._verbose = _verbose | Interfaces with specific database via raw sql for manipulating
database schema. | 62598fac097d151d1a2c0fd6 |
class APIError(Exception): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.value) | API version compatibility error. | 62598fac30dc7b766599f7fb |
class SunOSVirtual(Virtual): <NEW_LINE> <INDENT> platform = 'SunOS' <NEW_LINE> def get_virtual_facts(self): <NEW_LINE> <INDENT> zonename = self.module.get_bin_path('zonename') <NEW_LINE> if zonename: <NEW_LINE> <INDENT> rc, out, err = self.module.run_command(zonename) <NEW_LINE> if rc == 0 and out.rstrip() != "global":... | This is a SunOS-specific subclass of Virtual. It defines
- virtualization_type
- virtualization_role
- container | 62598faca79ad1619776a013 |
class IPlugin(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def get_info(cls): <NEW_LINE> <INDENT> return {} <NEW_LINE> <DEDENT> def __init__(self): <NEW_LINE> <INDENT> self.active = False <NEW_LINE> self.jumble = None <NEW_LINE> self.path = None <NEW_LINE> self.folder = None <NEW_LINE> <DEDENT> def activate(sel... | The most simple interface to be inherited when creating a plugin. | 62598facd268445f26639b5a |
class TestPauseMonitor(CustomClusterTestSuite): <NEW_LINE> <INDENT> @CustomClusterTestSuite.with_args("--logbuflevel=-1") <NEW_LINE> def test_jvm_pause_monitor_logs_entries(self): <NEW_LINE> <INDENT> impalad = self.cluster.get_first_impalad() <NEW_LINE> impalad.kill(signal.SIGSTOP) <NEW_LINE> time.sleep(5) <NEW_LINE> i... | Class for pause monitor tests. | 62598fac5166f23b2e243387 |
class ConfigurationError(PrivateError): <NEW_LINE> <INDENT> pass | Private Error
Used to indicated errors due to the current
configuration of the application. | 62598facb7558d58954635d7 |
class ContractConstructor: <NEW_LINE> <INDENT> def __init__(self, web3, abi, bytecode,vmtype, *args, **kwargs): <NEW_LINE> <INDENT> self.web3 = web3 <NEW_LINE> self.abi = abi <NEW_LINE> self.bytecode = bytecode <NEW_LINE> self.vmtype = vmtype <NEW_LINE> self.data_in_transaction = self._encode_data_in_transaction(*args,... | Class for contract constructor API. | 62598fac45492302aabfc47f |
class DistanceMixin: <NEW_LINE> <INDENT> lng_name = 'lng' <NEW_LINE> lat_name = 'lat' <NEW_LINE> manager_name = 'objects' <NEW_LINE> def distance(self, meters): <NEW_LINE> <INDENT> lng = getattr(self, self.lng_name, None) <NEW_LINE> lat = getattr(self, self.lat_name, None) <NEW_LINE> manager = getattr(self.__class__, s... | Search for nearby objects
Example:
class Supermarket(DistanceMixin, models.Model):
lng = models.FloatField()
lat = models.FloatField()
name = models.CharField(max_length=100)
# All McDonald's 200 meters from the supermarket
supermarket = Supermarket.objects.get(name=u"Монетка").distance(200).filter(name=... | 62598fac6aa9bd52df0d4e76 |
class ExternalSubtitle(Subtitle): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def from_path(cls, path): <NEW_LINE> <INDENT> extension = '' <NEW_LINE> for e in EXTENSIONS: <NEW_LINE> <INDENT> if path.endswith(e): <NEW_LINE> <INDENT> extension = e <NEW_LINE> break <NEW_LINE> <DEDENT> <DEDENT> if not extension: <NEW_LINE>... | Subtitle in a file next to the video file | 62598fac67a9b606de545f7b |
class ConfigEntry: <NEW_LINE> <INDENT> def __init__(self, key1: str, key2: str, default: str = ""): <NEW_LINE> <INDENT> self.key1 = key1 <NEW_LINE> self.key2 = key2 <NEW_LINE> self.default = default <NEW_LINE> self.env_var_name = f"SPEASY_{self.key1}_{self.key2}".upper().replace('-', '_') <NEW_LINE> <DEDENT> def get(se... | Configuration entry class. Used to set and get configuration values.
Attributes
----------
key1: str
Module or category name
key2: str
Entry name
default: str
Default value given by ctor
env_var_name: str
Environment variable name to use to set this entry
Methods
-------
get:
Get entry current val... | 62598fac01c39578d7f12d2d |
class MissingAFDOData(failures_lib.StepFailure): <NEW_LINE> <INDENT> pass | Exception thrown when necessary AFDO data is missing. | 62598facd486a94d0ba2bf7c |
class Player(models.Model): <NEW_LINE> <INDENT> player_id = models.AutoField(primary_key=True) <NEW_LINE> user = models.ForeignKey( User, on_delete=models.CASCADE, related_name='players', ) <NEW_LINE> room = models.ForeignKey( Room, on_delete=models.CASCADE, related_name='players', ) <NEW_LINE> score = models.IntegerFi... | Player in a room | 62598fac627d3e7fe0e06e5c |
class Cron(object): <NEW_LINE> <INDENT> __shared_state = dict( app_jobs = SortedDict(), thread = None, ) <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.__dict__ = self.__shared_state <NEW_LINE> <DEDENT> def get_job(self, app_label, job_name): <NEW_LINE> <INDENT> return self.app_jobs.get(app_la... | Stores jobs to be run at indicated times. | 62598fac379a373c97d98fc2 |
class HashFile(ClientActionStub): <NEW_LINE> <INDENT> in_rdfvalue = rdf_client.FingerprintRequest <NEW_LINE> out_rdfvalues = [rdf_client.FingerprintResponse] | Hash an entire file using multiple algorithms. | 62598facbaa26c4b54d4f261 |
class ActionTypeFailureMessage(TestCase, ActionTypeTestsMixin): <NEW_LINE> <INDENT> def getValidMessage(self): <NEW_LINE> <INDENT> return { "action_type": "myapp:mysystem:myaction", "action_status": "failed", "exception": "exceptions.RuntimeError", "reason": "because", } <NEW_LINE> <DEDENT> def getSerializer(self, acti... | Tests for L{ActionType} validation of action failure messages. | 62598fac7047854f4633f389 |
class ChallengesNotFoundError(IOError): <NEW_LINE> <INDENT> pass | Exception raised when Challenges are not loaded | 62598fac2ae34c7f260ab091 |
class ProtectedItemOperationResultsOperations: <NEW_LINE> <INDENT> models = _models <NEW_LINE> def __init__(self, client, config, serializer, deserializer) -> None: <NEW_LINE> <INDENT> self._client = client <NEW_LINE> self._serialize = serializer <NEW_LINE> self._deserialize = deserializer <NEW_LINE> self._config = con... | ProtectedItemOperationResultsOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~azure.mgmt.recoveryserv... | 62598fac435de62698e9bda5 |
class WorkunitClientToFinish(Exception): <NEW_LINE> <INDENT> def __init__(self, explanation): <NEW_LINE> <INDENT> self.text = explanation <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.text | we received a 410 (probably while attempting to download a WU) | 62598fac66673b3332c3037b |
class PendingConfiguration(vas.shared.PendingConfigurations.PendingConfiguration): <NEW_LINE> <INDENT> def __init__(self, client, location): <NEW_LINE> <INDENT> super(PendingConfiguration, self).__init__(client, location, 'group-instance', Instance) | A configuration file that is pending
:ivar str content: The configuration's content
:ivar `vas.web_server.Instances.Instance` instance: The instance that owns the configuration
:ivar str path: The configuration's path
:ivar `vas.shared.S... | 62598fac851cf427c66b826c |
class ClientFakeSuccess: <NEW_LINE> <INDENT> def __init__(self, host="127.0.0.1", port=5037): <NEW_LINE> <INDENT> self._devices = [] <NEW_LINE> <DEDENT> def devices(self): <NEW_LINE> <INDENT> return self._devices <NEW_LINE> <DEDENT> def device(self, serial): <NEW_LINE> <INDENT> device = DeviceFake(serial) <NEW_LINE> se... | A fake of the `adb_messenger.client.Client` class when the connection and shell commands succeed. | 62598faca79ad1619776a015 |
class InvalidError(ValueError): <NEW_LINE> <INDENT> pass | Raised when validator fails | 62598fac4e4d5625663723d5 |
class DirEntry(object): <NEW_LINE> <INDENT> def __init__(self, filesystem): <NEW_LINE> <INDENT> self._filesystem = filesystem <NEW_LINE> self.name = '' <NEW_LINE> self.path = '' <NEW_LINE> self._inode = None <NEW_LINE> self._islink = False <NEW_LINE> self._isdir = False <NEW_LINE> self._statresult = None <NEW_LINE> sel... | Emulates os.DirEntry. Note that we did not enforce keyword only
arguments. | 62598fac5166f23b2e243389 |
class HeatRecoveryBoiler(FossilSteamSupply): <NEW_LINE> <INDENT> def __init__(self, steamSupplyRating2=0.0, CombustionTurbines=None, *args, **kw_args): <NEW_LINE> <INDENT> self.steamSupplyRating2 = steamSupplyRating2 <NEW_LINE> self._CombustionTurbines = [] <NEW_LINE> self.CombustionTurbines = [] if CombustionTurbines ... | The heat recovery system associated with combustion turbines in order to produce steam for combined cycle plantsThe heat recovery system associated with combustion turbines in order to produce steam for combined cycle plants
| 62598fac7d43ff24874273da |
class snakesLadders(): <NEW_LINE> <INDENT> def __init__(self, sense): <NEW_LINE> <INDENT> self.board = [] <NEW_LINE> self.snakes = [] <NEW_LINE> self.ladders = [] <NEW_LINE> self.sense = sense <NEW_LINE> self.sense.clear() <NEW_LINE> <DEDENT> def addSnake(self,headX,headY,tailX,tailY): <NEW_LINE> <INDENT> self.snakes.a... | Creates the board and holds variables that control the game. | 62598facbe383301e02537a9 |
class LevelsActionsLinks(flourish.page.RefineLinksViewlet): <NEW_LINE> <INDENT> pass | Manager for Actions links. | 62598fac3539df3088ecc262 |
class VUID(models.Model): <NEW_LINE> <INDENT> project = models.ForeignKey('Project') <NEW_LINE> filename = models.TextField() <NEW_LINE> upload_date = models.DateTimeField(auto_now_add=True) <NEW_LINE> file = models.FileField(upload_to=vuid_location) <NEW_LINE> upload_by = models.ForeignKey(User, null=True, on_delete=m... | Represents the uploaded file used to generate VoiceSlot object | 62598fac4e4d5625663723d6 |
class QTextDocumentFragment(): <NEW_LINE> <INDENT> def fromHtml(self, QString, QTextDocument=None): <NEW_LINE> <INDENT> return QTextDocumentFragment <NEW_LINE> <DEDENT> def fromPlainText(self, QString): <NEW_LINE> <INDENT> return QTextDocumentFragment <NEW_LINE> <DEDENT> def isEmpty(self): <NEW_LINE> <INDENT> return Fa... | QTextDocumentFragment()
QTextDocumentFragment(QTextDocument)
QTextDocumentFragment(QTextCursor)
QTextDocumentFragment(QTextDocumentFragment) | 62598fac4f88993c371f04e2 |
class Controller(common.QuantumController): <NEW_LINE> <INDENT> _attachment_ops_param_list = [{ 'param-name': 'id', 'required': True}, ] <NEW_LINE> _serialization_metadata = { "application/xml": { "attributes": { "attachment": ["id"], } }, } <NEW_LINE> def __init__(self, plugin): <NEW_LINE> <INDENT> self._resource_name... | Port API controller for Quantum API | 62598facf7d966606f747f95 |
class MessageEventSubscriber(object): <NEW_LINE> <INDENT> def __init__(self, streaming_client): <NEW_LINE> <INDENT> self.__streaming_client = streaming_client <NEW_LINE> self.__listener = None <NEW_LINE> self.__realtime_client = None <NEW_LINE> <DEDENT> def subscribe(self, listener, auth, topic): <NEW_LINE> <INDENT> se... | classdocs | 62598fac3d592f4c4edbae7c |
class ConfigValidator: <NEW_LINE> <INDENT> def __init__(self, config_file): <NEW_LINE> <INDENT> self.config_file = config_file <NEW_LINE> <DEDENT> def validate(self): <NEW_LINE> <INDENT> cron = { 'check': str, 'cleanup': str, 'image-update': str, } <NEW_LINE> images = { 'name': str, 'base-image': str, 'min-ram': int, '... | Check the layout and certain configuration options | 62598fac2c8b7c6e89bd3776 |
class SelectizeWidget(JinjaWidget): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(SelectizeWidget, self).__init__('forms/selectize_widget.html') <NEW_LINE> <DEDENT> def __call__(self, field, **kwargs): <NEW_LINE> <INDENT> choices = [] <NEW_LINE> if field.data is not None: <NEW_LINE> <INDENT> choices... | Renders a selectizer-based widget | 62598fac5fc7496912d4825a |
class TestDNSCheckConfirm: <NEW_LINE> <INDENT> @pytest.fixture(scope="module") <NEW_LINE> def setup(self): <NEW_LINE> <INDENT> config = DnstestConfig() <NEW_LINE> config.server_test = "test" <NEW_LINE> config.server_prod = "prod" <NEW_LINE> config.default_domain = ".example.com" <NEW_LINE> config.have_reverse_dns = Tru... | Test DNS checks, using stubbed name resolution methods that return static values.
The code in this class checks the logic of dnstest.py's confirm_name method, which takes
a record name and verifies that the results are the same from prod and test servers. | 62598facfff4ab517ebcd795 |
class Adaptive( Agent ): <NEW_LINE> <INDENT> def __call__( self, history, state = {} ): <NEW_LINE> <INDENT> if not state.has_key('sequence'): <NEW_LINE> <INDENT> state['sequence'] = [True, True, True, True, True, True, False, False, False, False, False] <NEW_LINE> <DEDENT> if len(history[0])>1: <NEW_LINE> <INDENT> if n... | Adaptive strategy.
| 62598fac76e4537e8c3ef55e |
class UploadFile(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=50) <NEW_LINE> file = models.FileField(upload_to='./upload') <NEW_LINE> ctime = models.DateTimeField(auto_now_add=True) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> db_table = 't_upload_file' | 上传的文件 | 62598fac7c178a314d78d44d |
class HubUser(TimeStampedModel): <NEW_LINE> <INDENT> user = models.ForeignKey(USER_MODEL, related_name="hub_users") <NEW_LINE> hub = models.ForeignKey(Hub, related_name="hub_users") <NEW_LINE> is_admin = models.BooleanField(default=False) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> ordering = ['hub', 'user'] <NEW_LINE> ... | ManyToMany through field relating Users to Hub.
It is possible for a User to be a member of multiple hubs, so this
class relates the HubUser to the User model using a ForeignKey
relationship, rather than a OneToOne relationship.
Authentication and general user information is handled by the User class
and the contrib.... | 62598facbaa26c4b54d4f263 |
class MsgStartup(SBP): <NEW_LINE> <INDENT> _parser = Struct("MsgStartup", ULInt32('reserved'),) <NEW_LINE> def __init__(self, sbp=None, **kwargs): <NEW_LINE> <INDENT> if sbp: <NEW_LINE> <INDENT> self.__dict__.update(sbp.__dict__) <NEW_LINE> self.from_binary(sbp.payload) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> sup... | SBP class for message MSG_STARTUP (0xFF00).
You can have MSG_STARTUP inherent its fields directly
from an inherited SBP object, or construct it inline using a dict
of its fields.
The system start-up message is sent once on system
start-up. It notifies the host or other attached devices that
the system has ... | 62598fac16aa5153ce4004b3 |
class load_plugin(Event): <NEW_LINE> <INDENT> pass | Call me with pl ug-in to load | 62598fac8e7ae83300ee9053 |
class PacketListStopField(PacketListField): <NEW_LINE> <INDENT> __slots__ = ["count_from", "length_from", "stop"] <NEW_LINE> def __init__(self, name, default, cls, count_from=None, length_from=None, stop=None): <NEW_LINE> <INDENT> PacketListField.__init__(self, name, default, cls, count_from=count_from, length_from=len... | Custom field that contains a list of packets until a 'stop' condition is met.
| 62598fac10dbd63aa1c70b64 |
class ResourceLink(common.Object): <NEW_LINE> <INDENT> @property <NEW_LINE> def name(self): <NEW_LINE> <INDENT> return self._data['name'] <NEW_LINE> <DEDENT> @property <NEW_LINE> def description(self): <NEW_LINE> <INDENT> return self._data['description'] <NEW_LINE> <DEDENT> @property <NEW_LINE> def recycle(self): <NEW_... | Represents a Hue resourcelink. | 62598facadb09d7d5dc0a53b |
class SingletonQuery(Query): <NEW_LINE> <INDENT> def __init__(self, sense): <NEW_LINE> <INDENT> self.sense = sense <NEW_LINE> <DEDENT> def clause(self): <NEW_LINE> <INDENT> if self.sense: <NEW_LINE> <INDENT> return "album_id ISNULL", () <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> return "NOT album_id ISNULL", () <NEW... | Matches either singleton or non-singleton items. | 62598fac56ac1b37e630219d |
class AddVCenterRequest(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'properties': {'key': 'properties', 'type': 'AddVCenterRequestProperties'}, } <NEW_LINE> def __init__( self, *, properties: Optional["AddVCenterRequestProperties"] = None, **kwargs ): <NEW_LINE> <INDENT> super(AddVCenterRequest,... | Input required to add vCenter.
:param properties: The properties of an add vCenter request.
:type properties: ~azure.mgmt.recoveryservicessiterecovery.models.AddVCenterRequestProperties | 62598faccc0a2c111447afc2 |
class _better_cache: <NEW_LINE> <INDENT> def __init__(self, repositories): <NEW_LINE> <INDENT> self._items = collections.defaultdict(list) <NEW_LINE> self._scanned_cats = set() <NEW_LINE> self._repo_list = [ repo for repo in reversed(list(repositories)) if repo.location is not None ] <NEW_LINE> <DEDENT> def __getitem__... | The purpose of better_cache is to locate catpkgs in repositories using ``os.listdir()`` as much as possible, which
is less expensive IO-wise than exhaustively doing a stat on each repo for a particular catpkg. better_cache stores a
list of repos in which particular catpkgs appear. Various dbapi methods use better_cache... | 62598face1aae11d1e7ce7fc |
class VolumeController(wsgi.Controller): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.volume_api = volume.API() <NEW_LINE> super(VolumeController, self).__init__() <NEW_LINE> <DEDENT> @extensions.expected_errors(404) <NEW_LINE> def show(self, req, id): <NEW_LINE> <INDENT> context = req.environ['nova... | The Volumes API controller for the OpenStack API. | 62598fac99cbb53fe6830e89 |
class EventUpdate(EventBase): <NEW_LINE> <INDENT> event = models.ForeignKey(Event) <NEW_LINE> status = models.SmallIntegerField(choices=STATUS_CHOICES) <NEW_LINE> message = models.TextField(null=True, blank=True) <NEW_LINE> date_created = models.DateTimeField(auto_now_add=True, editable=False) <NEW_LINE> def __unicode_... | An ``EventUpdate`` contains a single update to an ``Event``. The latest update
will always be reflected within the event, carrying over it's ``status`` and ``message``. | 62598face5267d203ee6b8bb |
class TestArchRootPyPIInstall(TestCase): <NEW_LINE> <INDENT> _shell = None <NEW_LINE> _PROMPT = r'\[root@.* /\]# ' <NEW_LINE> @classmethod <NEW_LINE> def setUpClass(cls): <NEW_LINE> <INDENT> cls._shell = pexpect.spawn('docker run --rm -it base/archlinux', timeout=90) <NEW_LINE> <DEDENT> def test_install(self): <NEW_LIN... | As root, install Kytos from PyPI using pip in Archlinux.
This test reproduces kytos#465. | 62598facd268445f26639b5c |
class GSBFrame(VLBIFrameBase): <NEW_LINE> <INDENT> _header_class = GSBHeader <NEW_LINE> _payload_class = GSBPayload <NEW_LINE> @classmethod <NEW_LINE> def fromfile(cls, fh_ts, fh_raw, payloadsize=1 << 24, nchan=1, bps=4, complex_data=False, valid=True, verify=True): <NEW_LINE> <INDENT> header = cls._header_class.fromfi... | Frame encapsulating GSB Rawdump or Phased data.
For Rawdump data, lines in the timestamp file are associated with single
blocks of raw data. For Phased data, the lines are associated with one or
two polarisations, each consisting of two blocks of raw data. Hence, the
raw data come from two or four files.
Parameters
... | 62598fac3539df3088ecc264 |
class PlanningProblem: <NEW_LINE> <INDENT> def getStartState(self): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def getGhostStartStates(self): <NEW_LINE> <INDENT> util.raiseNotDefined() <NEW_LINE> <DEDENT> def getGoalState(self): <NEW_LINE> <INDENT> util.raiseNotDefined() | This class outlines the structure of a planning problem, but doesn't implement
any of the methods (in object-oriented terminology: an abstract class).
You do not need to change anything in this class, ever. | 62598fac45492302aabfc483 |
class InputLine(BrowsableObject): <NEW_LINE> <INDENT> def sum(self, code, from_date, to_date=None): <NEW_LINE> <INDENT> if to_date is None: <NEW_LINE> <INDENT> to_date = datetime.now().strftime('%Y-%m-%d') <NEW_LINE> <DEDENT> self.cr.execute( "SELECT sum(amount) as sum" "FROM hr_payslip as hp, hr_payslip_input as pi " ... | a class that will be used into the python code, mainly for
usability purposes | 62598faca17c0f6771d5c1e7 |
class _FromGrouping(FromClause): <NEW_LINE> <INDENT> __visit_name__ = 'grouping' <NEW_LINE> def __init__(self, element): <NEW_LINE> <INDENT> self.element = element <NEW_LINE> <DEDENT> @property <NEW_LINE> def columns(self): <NEW_LINE> <INDENT> return self.element.columns <NEW_LINE> <DEDENT> @property <NEW_LINE> def _hi... | Represent a grouping of a FROM clause | 62598fac67a9b606de545f7f |
class URLRequestStats(object): <NEW_LINE> <INDENT> def __init__(self, statsproto): <NEW_LINE> <INDENT> self.rpcstatslist = [] <NEW_LINE> self.timestamp = statsproto.start_timestamp_milliseconds() * 0.001 <NEW_LINE> self.totalresponsetime = int(statsproto.duration_milliseconds()) <NEW_LINE> for t in statsproto.individua... | Statistics associated with each URL request.
For each URL request, keep track of list of RPCs, statistics
associated with each RPC, and total response time for that
URL request. | 62598fac2c8b7c6e89bd3778 |
class AFGHEncrypter(CommonEncrypter): <NEW_LINE> <INDENT> name = "afgh1-aes" <NEW_LINE> attributes = ("passphrase", "key") <NEW_LINE> iv_size = 16 <NEW_LINE> aes_key_size = 32 <NEW_LINE> hash_size = 32 <NEW_LINE> aes_mode = CryptoAES.MODE_CFB <NEW_LINE> afgh_key_size = 32 <NEW_LINE> afgh_decrypt_method = "decrypt_my" <... | AFGH proxy re-encryption combined with AES.
This class is to encrypt and decrypt whatever is encrypted for us | 62598faceab8aa0e5d30bd3e |
class HTTP_FILTER_AUTHENT(object): <NEW_LINE> <INDENT> def __new__(cls): <NEW_LINE> <INDENT> raise Exception('This class just for typing, can not be instanced!') <NEW_LINE> <DEDENT> @property <NEW_LINE> def User(self)->'str': <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @property <NEW_LINE> def Password(self)->'str': <... | A Python representation of an ISAPI
HTTP_FILTER_AUTHENT structure. | 62598fac498bea3a75a57ad0 |
class Enemy(Role, object): <NEW_LINE> <INDENT> _uid = Role._uid <NEW_LINE> def __init__(self, family, health, attack, jump_height, texture_path): <NEW_LINE> <INDENT> super(Enemy, self).__init__(family, health, attack, jump_height, texture_path) <NEW_LINE> self._hostile = True <NEW_LINE> <DEDENT> @property <NEW_LINE> de... | The actor will be an enemy to/able to be fought by the player.
| 62598fac76e4537e8c3ef560 |
class ClientSalaryHistoryView(Viewable): <NEW_LINE> <INDENT> id = ClientSalaryHistory.id <NEW_LINE> date = ClientSalaryHistory.date <NEW_LINE> new_salary = ClientSalaryHistory.new_salary <NEW_LINE> user = Person.name <NEW_LINE> tables = [ ClientSalaryHistory, LeftJoin(LoginUser, LoginUser.id == ClientSalaryHistory.user... | Store information about a client's salary history
| 62598fac99cbb53fe6830e8a |
class HeteroskedasticDecoder(nn.Module): <NEW_LINE> <INDENT> def __init__(self, x_dim, rep_dim, y_dim, hid_dim, num_hid): <NEW_LINE> <INDENT> super(HeteroskedasticDecoder, self).__init__() <NEW_LINE> self.x_dim = x_dim <NEW_LINE> self.rep_dim = rep_dim <NEW_LINE> self.y_dim = y_dim <NEW_LINE> self.hid_dim = hid_dim <NE... | Maps target inputs x and samples of the latent representaion z
(which encodes the context points) to target outputs y. Predicts both
the mean and variance of the process.
Parameters
----------
x_dim : int
Dimension of the x values.
rep_dim : int
Dimension of the representation variable (r+z).
y_dim : int
... | 62598fac4428ac0f6e6584d7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.