code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class PaymentMethodForm(ModelForm): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(PaymentMethodForm, self).__init__(*args, **kwargs) <NEW_LINE> self.fields["image"].widget = LFSImageInput() <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> model = PaymentMethod <NEW_LINE> exclude ... | Form to edit a payment method.
| 62598f360a366e3fb87dba8e |
class EspolSearch(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.driver = webdriver.Chrome(executable_path='Drivers\\chromedriver.exe') <NEW_LINE> self.driver.get("http://www.espol.edu.ec/es/educacion/grado/catalogo") <NEW_LINE> <DEDENT> def test_extract_data(self): <NEW_LINE> <INDENT... | Test class to extract data in ESPOL'S website | 62598f363cc13d1c6d46482b |
class EmailBackend(ModelBackend): <NEW_LINE> <INDENT> def authenticate(self, email=None, password=None): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> user = User.objects.get(email__iexact=email) <NEW_LINE> if check_password(password, user.password): <NEW_LINE> <INDENT> return user <NEW_LINE> <DEDENT> else: <NEW_LINE> <... | Checks user's email instead of username | 62598f36091ae35668703cc7 |
class AttributeProxy(BaseProxy): <NEW_LINE> <INDENT> def __getattribute__(self, name): <NEW_LINE> <INDENT> obj = object.__getattribute__(self, "_obj") <NEW_LINE> if hasattr(obj, name): <NEW_LINE> <INDENT> return getattr(obj, name) <NEW_LINE> <DEDENT> return object.__getattribute__(self, name) <NEW_LINE> <DEDENT> def __... | Wraps an object, but allows getting setting of attributes on wrapper | 62598f36eab8aa0e5d30ae34 |
class Examresult(models.Model): <NEW_LINE> <INDENT> result_exam = models.ForeignKey('Exam', verbose_name=u'Іспит', blank=False, null=True,) <NEW_LINE> result_student = models.ForeignKey('Student', verbose_name=u'Студент', blank=False, null=True,) <NEW_LINE> mark = models.CharField(max_length=256, blank=False, verbose_n... | Examresult model | 62598f360a366e3fb87dba94 |
class MessageBox(SizedWidget): <NEW_LINE> <INDENT> maxChars = 35 <NEW_LINE> def __init__(self, width, height, message, fullyDisplay=False): <NEW_LINE> <INDENT> SizedWidget.__init__(self, width, height) <NEW_LINE> self.message = message <NEW_LINE> self.charsShown = 0 <NEW_LINE> self.font = pygame.font.SysFont("Times New... | Represents a message box on the screen | 62598f363cc13d1c6d464831 |
class BulkEditAnalyseDto(object): <NEW_LINE> <INDENT> swagger_types = { 'analyses': 'list[IdReference]', 'name': 'str', 'linguist': 'IdReference' } <NEW_LINE> attribute_map = { 'analyses': 'analyses', 'name': 'name', 'linguist': 'linguist' } <NEW_LINE> def __init__(self, analyses=None, name=None, linguist=None): <NEW_L... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f360a366e3fb87dba96 |
class Block2Cache: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._completes = TimeoutDict(numbers.MAX_TRANSMIT_WAIT) <NEW_LINE> <DEDENT> async def extract_or_insert(self, req: Message, response_builder: types.CoroutineType): <NEW_LINE> <INDENT> block_key = _extract_block_key(req) <NEW_LINE> if req.op... | A cache of responses to a give block key.
Use this when result rendering is expensive, not idempotent or has varying
output -- otherwise it's often better to calculate the full response again
and serve chunks. | 62598f36091ae35668703ccf |
class Space: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.cells = [] <NEW_LINE> self.timestep = 0 <NEW_LINE> <DEDENT> def plot(self, ax=None): <NEW_LINE> <INDENT> return plot_cells(self.cells, ax) <NEW_LINE> <DEDENT> def add_cell(self, cell): <NEW_LINE> <INDENT> self.cells.append(cell) <NEW_LINE> se... | Space tracks the locations of cells within a space | 62598f36187af65679d29467 |
class PublishUpdate8Test(BaseTest): <NEW_LINE> <INDENT> fixtureCmds = [ "aptly repo create repo1", "aptly repo create repo2", "aptly publish repo -skip-signing -component=main,contrib -architectures=i386 -distribution=squeeze repo1 repo2", ] <NEW_LINE> runCmd = "aptly publish update -skip-signing squeeze" <NEW_LINE> go... | publish update: update empty repos to empty repos | 62598f36627d3e7fe0e05f4c |
class SFDXOrgTask(SFDXBaseTask): <NEW_LINE> <INDENT> salesforce_task = True <NEW_LINE> def _init_options(self, kwargs): <NEW_LINE> <INDENT> super(SFDXOrgTask, self)._init_options(kwargs) <NEW_LINE> self.options['command'] = self._add_username(self.options['command']) <NEW_LINE> if self.options.get('extra'): <NEW_LINE> ... | Call the sfdx cli with a workspace username | 62598f36187af65679d29468 |
class TD0(SarsaLambda): <NEW_LINE> <INDENT> def __init__(self, env: FiniteActionEnvironment): <NEW_LINE> <INDENT> super().__init__(env, lam=0) | SarsaLambda with lambda=0 is equivalent to TD(0) | 62598f364c34283577619399 |
class AccountSummaryView(RedirectView): <NEW_LINE> <INDENT> url = reverse_lazy(settings.OSCAR_ACCOUNTS_REDIRECT_URL) | View that exists for legacy reasons and customisability. It commonly gets
called when the user clicks on "Account" in the navbar, and can be
overridden to determine to what sub-page the user is directed without
having to change a lot of templates. | 62598f364c3428357761939b |
class FormElement(AbstractPluginModel): <NEW_LINE> <INDENT> plugin_uid = models.CharField( _("Plugin UID"), max_length=255, unique=True, editable=False, choices=get_registered_form_element_plugins() ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> abstract = False <NEW_LINE> verbose_name = _("Form element plugin") <NEW_LIN... | Form field plugin. Used when ``fobi.settings.RESTRICT_PLUGIN_ACCESS``
is set to True.
:Properties:
- `plugin_uid` (str): Plugin UID.
- `users` (django.contrib.auth.models.User): White list of the users
allowed to use the form element plugin.
- `groups` (django.contrib.auth.models.Group): White list ... | 62598f3626238365f5fabc58 |
class OptProblem(ArchitectureAssembly): <NEW_LINE> <INDENT> solution = Dict({}, iotype="in", desc="Dictionary of expected values for " "all des_vars and coupling_vars.") <NEW_LINE> def check_solution(self, strict=False): <NEW_LINE> <INDENT> error = {} <NEW_LINE> try: <NEW_LINE> <INDENT> for k, v in self.get_parameters(... | Class for specifying test problems for optimization
algorithms and architectures. | 62598f3615fb5d323ce7ddf2 |
class _NameSanitizer(_NameIndexer): <NEW_LINE> <INDENT> def __init__(self, identifier_regex_str, internal_prefix='_sani_temp', map_valid_vals=True, extra_checks=lambda x: True, allow_duplicates=False): <NEW_LINE> <INDENT> if identifier_regex_str[-1] != '$': <NEW_LINE> <INDENT> identifier_regex_str += '$' <NEW_LINE> <DE... | Sanitizes the names so that names can be used in places that don't allow
for arbitrary names while not mangling valid names.
Put the values you want to validate into make_valid_string the first time
you want to sanitize a particular string (or before the first time), and
retrieve from the _NameSanitizer through indexi... | 62598f3626238365f5fabc5a |
@attr.s(auto_attribs=True, init=False) <NEW_LINE> class DashboardAppearance(model.Model): <NEW_LINE> <INDENT> page_side_margins: Optional[int] = None <NEW_LINE> page_background_color: Optional[str] = None <NEW_LINE> tile_title_alignment: Optional[str] = None <NEW_LINE> tile_space_between: Optional[int] = None <NEW_LINE... | Attributes:
page_side_margins: Page margin (side) width
page_background_color: Background color for the dashboard
tile_title_alignment: Title alignment on dashboard tiles
tile_space_between: Space between tiles
tile_background_color: Background color for tiles
tile_shadow: Tile shadow on/off
... | 62598f36187af65679d2946d |
class AppStore(enum.IntEnum): <NEW_LINE> <INDENT> UNSPECIFIED = 0 <NEW_LINE> UNKNOWN = 1 <NEW_LINE> APPLE_ITUNES = 2 <NEW_LINE> GOOGLE_PLAY = 3 | App store type in an app extension.
Attributes:
UNSPECIFIED (int): Not specified.
UNKNOWN (int): Used for return value only. Represents value unknown in this version.
APPLE_ITUNES (int): Apple iTunes.
GOOGLE_PLAY (int): Google Play. | 62598f374c342835776193a5 |
class FractionWithFactoredDenominatorSum(list): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return ' + '.join(repr(r) for r in self) <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> from operator import methodcaller <NEW_LINE> return (sorted(self, key=methodcaller('_total_order_key_')) =... | A list representing the sum of :class:`FractionWithFactoredDenominator`
objects with distinct denominator factorizations.
AUTHORS:
- Alexander Raichev (2012-06-25)
- Daniel Krenn (2014-12-01) | 62598f374c342835776193a7 |
class ReleaseCommand(Command): <NEW_LINE> <INDENT> user_options = [('sign', 's', 'GPG-sign the Git tag and release files')] <NEW_LINE> def initialize_options(self): <NEW_LINE> <INDENT> self.sign = False <NEW_LINE> <DEDENT> def finalize_options(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def run(self): <NEW_LINE... | Tag and push a new release. | 62598f37627d3e7fe0e05f5c |
class KDBXmlExtension: <NEW_LINE> <INDENT> def __init__(self, unprotect=True): <NEW_LINE> <INDENT> self._salsa_buffer = bytearray() <NEW_LINE> self.salsa = Salsa20( sha256(self.header.ProtectedStreamKey), KDB4_SALSA20_IV) <NEW_LINE> self.in_buffer.seek(0) <NEW_LINE> self.tree = objectify.parse(self.in_buffer) <NEW_LINE... | The KDB4 payload is a XML document. For easier use this class provides
a lxml.objectify'ed version of the XML-tree as the `obj_root` attribute.
More importantly though in the XML document text values can be protected
using Salsa20. Protected elements are unprotected by default (passwords are
in clear). You can overrid... | 62598f3726238365f5fabc64 |
class DocumentSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = Document <NEW_LINE> fields = ['name', 'pdf'] | Serializer for documents to JSON | 62598f370a366e3fb87dbaaa |
class Hitwh_News(Base): <NEW_LINE> <INDENT> __tablename__ = 'hitwh' <NEW_LINE> id = Column(Integer, primary_key=True) <NEW_LINE> title = Column(String(50)) <NEW_LINE> link = Column(String(50)) <NEW_LINE> detail = Column(String(100)) <NEW_LINE> uploader = Column(String(20)) | hitwh新闻网页爬取存储 | 62598f374c342835776193a9 |
class MolFromTypedColumnReader(object): <NEW_LINE> <INDENT> def __init__(self, smiles_file): <NEW_LINE> <INDENT> self._smiles_file = smiles_file <NEW_LINE> self._smiles_column_name = None <NEW_LINE> self._tcr = None <NEW_LINE> <DEDENT> def initialise(self, column_sep='\t', type_sep=':', header=None, smiles_column_name=... | Creates molecules from a typed column file, exposing the results
as an iterator. | 62598f3715fb5d323ce7ddfe |
class File: <NEW_LINE> <INDENT> def __init__(self) -> None: <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self._expected_docstrings = [] <NEW_LINE> self._status = FileStatus.ANALYZED <NEW_LINE> <DEDENT> def collect_docstring(self, identifier: str, has_docstring: bool, ignore_reason: str = None): <NEW_LINE> <INDENT>... | The information about docstrings for a single file. | 62598f374c342835776193ab |
class PortSelector: <NEW_LINE> <INDENT> def __init__(self, client, ports, qn): <NEW_LINE> <INDENT> self.__client = client <NEW_LINE> self.__ports = ports <NEW_LINE> self.__qn = qn <NEW_LINE> <DEDENT> def __getattr__(self, name): <NEW_LINE> <INDENT> default = self.__dp() <NEW_LINE> if default is None: <NEW_LINE> <INDENT... | The B{port} selector is used to select a I{web service} B{port}.
In cases where multiple ports have been defined and no default has been
specified, the port is found by name (or index) and a L{MethodSelector}
for the port is returned. In all cases, attribute access is
forwarded to the L{MethodSelector} for either the ... | 62598f3726238365f5fabc68 |
class WeightLogAccessTestCase(WorkoutManagerTestCase): <NEW_LINE> <INDENT> def test_access_shared(self): <NEW_LINE> <INDENT> url = reverse('manager:log:log', kwargs={'pk': 1}) <NEW_LINE> self.user_login('admin') <NEW_LINE> response = self.client.get(url) <NEW_LINE> self.assertEqual(response.status_code, 200) <NEW_LINE>... | Test accessing the weight log page | 62598f37091ae35668703ce5 |
class pyflakes(defs.option): <NEW_LINE> <INDENT> rtype = types.boolean <NEW_LINE> default = True | Use Pyflakes to check. | 62598f37c4546d3d9def6ad2 |
class NamespaceNoDeploymentError(Exception): <NEW_LINE> <INDENT> pass | A Namespace does not have any Deployment objects | 62598f37627d3e7fe0e05f62 |
class LibratoReport(ReportBase): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.source = kwargs.pop('source', None) <NEW_LINE> self.report = librato.connect(*args, **kwargs) <NEW_LINE> self.report.set_timeout(1) <NEW_LINE> super(LibratoReport, self).__init__() <NEW_LINE> <DEDENT> def ... | Report to Librato over http
http://github.com/librato/python-librato | 62598f3726238365f5fabc6a |
class ATPFLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self, reduction: str = 'mean', alpha=1.0, gamma=2.0): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.reduction = reduction <NEW_LINE> self.gamma = gamma <NEW_LINE> self.alpha = alpha <NEW_LINE> self.smooth = 1e-7 <NEW_LINE> <DEDENT> def forward(self, ... | Adaptive threshold pair-wised focal loss | 62598f37c4546d3d9def6ad3 |
class DemoFrame(wx.Frame): <NEW_LINE> <INDENT> def __init__(self, title = "Micro App"): <NEW_LINE> <INDENT> wx.Frame.__init__(self, None , -1, title) <NEW_LINE> MenuBar = wx.MenuBar() <NEW_LINE> FileMenu = wx.Menu() <NEW_LINE> item = FileMenu.Append(wx.ID_ANY, text = "&Open") <NEW_LINE> self.Bind(wx.EVT_MENU, self.OnOp... | This window displays a button | 62598f374c342835776193b1 |
class FailedToUnlockError(RsyncSystemBackupError): <NEW_LINE> <INDENT> pass | Raised when cryptdisks_start_ fails to unlock the encrypted device. | 62598f373cc13d1c6d46484f |
class Entity(object): <NEW_LINE> <INDENT> def __init__(self, world, pos, image): <NEW_LINE> <INDENT> self.world = world <NEW_LINE> self.pos = vec2(pos[0], pos[1]) <NEW_LINE> self.vel = vec2(0, 0) <NEW_LINE> self.base_image = image <NEW_LINE> self.image = self.base_image <NEW_LINE> self.image_rect = self.base_image.get_... | Class for a single Entity.
An entity is a single object that updates, renders, can be created
or destroyed. A player, enemy, building, bullet, etc. are all excamples
of entities. Second most important class (behind the engine). | 62598f37187af65679d29475 |
class PartialUpdateInstanceRequest(_messages.Message): <NEW_LINE> <INDENT> instance = _messages.MessageField('Instance', 1) <NEW_LINE> updateMask = _messages.StringField(2) | Request message for BigtableInstanceAdmin.PartialUpdateInstance.
Fields:
instance: The Instance which will (partially) replace the current value.
updateMask: The subset of Instance fields which should be replaced. Must
be explicitly set. | 62598f37c4546d3d9def6ad5 |
@ewrap.EntryWrapper.pvm_type('VirtualPersistentMemoryVolume', child_order=_VIRT_PMEM_EL_ORDER) <NEW_LINE> class VirtualPMEMVolume(ewrap.EntryWrapper, ewrap.WrapperSetUUIDMixin): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def bld(cls, adapter, lpar_id, name, size, affinity=True): <NEW_LINE> <INDENT> vpmemvol = super(Vi... | Class VirtualPersistentMemoryVolume.
This corresponds to the abstract VirtualPersistentMemoryVolume
object in the PowerVM schema. | 62598f3726238365f5fabc70 |
class WildFireAttack(FireAttack): <NEW_LINE> <INDENT> def __init__(self, game, pos, dir, in_battle): <NEW_LINE> <INDENT> super().__init__(game, pos, dir, in_battle) <NEW_LINE> self.game.battle.projectiles.remove(self) <NEW_LINE> self.game.battle.wild_projectiles.add(self) | A child class of FireAttack, with different groups for colliding with the player's pokemon instead of themselves. | 62598f37c4546d3d9def6ad7 |
class Square(Side): <NEW_LINE> <INDENT> def __init__(self, color): <NEW_LINE> <INDENT> self.name = color | class to represent each square on each side of a cube. | 62598f3715fb5d323ce7de0e |
class XEP_0196(BasePlugin): <NEW_LINE> <INDENT> name = 'xep_0196' <NEW_LINE> description = 'XEP-0196: User Gaming' <NEW_LINE> dependencies = {'xep_0163'} <NEW_LINE> stanza = stanza <NEW_LINE> def plugin_end(self): <NEW_LINE> <INDENT> self.xmpp['xep_0030'].del_feature(feature=UserGaming.namespace) <NEW_LINE> self.xmpp['... | XEP-0196: User Gaming | 62598f37627d3e7fe0e05f6e |
class TestVariable(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.data = { "uri": "file:///tas.nc", "id": "tas|tas1", "domain": "d0", "mime_type": "application/netcdf", } <NEW_LINE> self.d0 = cwt.Domain(time=(1980, 2000), name="d0") <NEW_LINE> <DEDENT> def test_to_dict(self): <NEW_LIN... | Variable Test Case. | 62598f37c4546d3d9def6adb |
class PhpBBForeignKey(models.ForeignKey): <NEW_LINE> <INDENT> def get_db_prep_save(self, value, connection): <NEW_LINE> <INDENT> if value in ("", None): <NEW_LINE> <INDENT> value = 0 <NEW_LINE> <DEDENT> return super(PhpBBForeignKey, self).get_db_prep_save(value, connection) | phpBB stores a None ForeignKey as a numeric 0 | 62598f3715fb5d323ce7de14 |
class ParallelLocalRun(object): <NEW_LINE> <INDENT> def __init__(self, data_connection, tmp_folder, n_simul, calc_script): <NEW_LINE> <INDENT> self.dc = data_connection <NEW_LINE> self.n_simul = n_simul <NEW_LINE> self.calc_script = calc_script <NEW_LINE> self.tmp_folder = tmp_folder <NEW_LINE> self.running_pids = [] <... | Class that allows for the simultaneous relaxation of
several candidates on the same computer.
The method is based on starting each relaxation with an
external python script and then monitoring when the
relaxations are done adding in the resulting structures
to the database.
Parameters:
data_connection: DataConnec... | 62598f3726238365f5fabc7c |
class SourceActionLog(models.Model): <NEW_LINE> <INDENT> CSV_CHECK = _("CSV-CHECK") <NEW_LINE> CSV_IMPORT = _("CSV-IMPORT") <NEW_LINE> RUN_TYPE = [ (CSV_CHECK, CSV_CHECK), (CSV_IMPORT, CSV_IMPORT) ] <NEW_LINE> runtype = models.CharField( max_length=50, choices=RUN_TYPE) <NEW_LINE> run_date = models.DateTimeField( blank... | Log source actions. | 62598f37091ae35668703cf9 |
class subscribe_after_transition(_SimpleSubscriber): <NEW_LINE> <INDENT> event = IAfterTransition | Decorator for registering an event listener for when a transition has
been done on an object | 62598f37c4546d3d9def6adc |
class LocaleBorg(object): <NEW_LINE> <INDENT> initialized = False <NEW_LINE> @classmethod <NEW_LINE> def initialize(cls, locales, initial_lang): <NEW_LINE> <INDENT> assert initial_lang is not None and initial_lang in locales <NEW_LINE> cls.reset() <NEW_LINE> cls.locales = locales <NEW_LINE> encodings = {} <NEW_LINE> fo... | Provide locale related services and autoritative current_lang.
current_lang is the last lang for which the locale was set
and is meant to be set only by LocaleBorg.set_locale.
python's locale code should not be directly called from code outside of
LocaleBorg, they are compatibilty issues with py version and OS suppor... | 62598f374c342835776193c3 |
class IAddLCForm(form.Schema): <NEW_LINE> <INDENT> city = schema.TextLine( title=u"City", description=u"City name of a LC", ) <NEW_LINE> cp_fullname = schema.TextLine( title=u"CP full name", description=u"Contact person full name", ) <NEW_LINE> cp_username = schema.TextLine( title=u"CP username", description=u"Contact ... | Define form fields for adding new LC. | 62598f3715fb5d323ce7de18 |
class UserChangeForm(forms.ModelForm): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> model = User <NEW_LINE> fields = SHARED_FORM_FIELDS <NEW_LINE> widgets = {'country': CountrySelectWidget()} <NEW_LINE> <DEDENT> def clean_password(self): <NEW_LINE> <INDENT> return self.initial["password"] | A form for updating users. Includes all the fields on
the user, but replaces the password field with admin's
password hash display field. | 62598f373cc13d1c6d464861 |
class KegbotFileSystemStorage(FileSystemStorage): <NEW_LINE> <INDENT> def url(self, name): <NEW_LINE> <INDENT> be = get_kegbot_backend() <NEW_LINE> base_url = be.get_base_url() <NEW_LINE> if not self.base_url.startswith(base_url): <NEW_LINE> <INDENT> self.base_url = urllib.parse.urljoin(base_url, self.base_url) <NEW_LI... | Default storage backend that crafts absolute urls from KegbotSite.base_url.
Since the storage backed is not a singleton within django request
processing (and thus there's not a single object we can pre-configure
with the base URL), this custom backend seems necessary. | 62598f3815fb5d323ce7de1a |
class Attenuator(TestbedDevice): <NEW_LINE> <INDENT> def __init__(self, prog_name): <NEW_LINE> <INDENT> TestbedDevice.__init__(self, prog_name) <NEW_LINE> self.dev_type = "ATTENUATOR" | The class of attenuator device.
| 62598f38c4546d3d9def6ae0 |
class Words: <NEW_LINE> <INDENT> def __init__(self, in_csv: IO): <NEW_LINE> <INDENT> self.three2eight: List[List[str]] = [[], [], [], [], [], []] <NEW_LINE> read_rows, used_rows = 0, 0 <NEW_LINE> for row in csv.DictReader(in_csv): <NEW_LINE> <INDENT> read_rows += 1 <NEW_LINE> word = row.get('Word', '').upper() <NEW_LIN... | Make high-frequency words available for the grid. | 62598f38187af65679d29480 |
class Frame: <NEW_LINE> <INDENT> def __init__(self, parent): <NEW_LINE> <INDENT> self.bindings = {} <NEW_LINE> self.parent = parent <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> if self.parent is None: <NEW_LINE> <INDENT> return "<Global Frame>" <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> s = sorted('{0... | An environment frame binds Scheme symbols to Scheme values. | 62598f380a366e3fb87dbaca |
class PostsConfig(AppConfig): <NEW_LINE> <INDENT> name = 'posts' | Configs for posts app. | 62598f380a366e3fb87dbacc |
class memoize(dict): <NEW_LINE> <INDENT> def __init__(self, f): <NEW_LINE> <INDENT> self.f = f <NEW_LINE> update_wrapper(self, f) <NEW_LINE> <DEDENT> def __call__(self, *args): <NEW_LINE> <INDENT> return self[args] <NEW_LINE> <DEDENT> def __missing__(self, key): <NEW_LINE> <INDENT> ret = self[key] = self.f(*key) <NEW_L... | Memoization decorator for functions taking one or more arguments. | 62598f384c342835776193cb |
class PendingAuthAnonymous(PendingAuth): <NEW_LINE> <INDENT> log = make_logger() <NEW_LINE> AUTHMETHOD = u'anonymous' <NEW_LINE> def hello(self, realm, details): <NEW_LINE> <INDENT> self._realm = realm <NEW_LINE> self._authid = details.authid <NEW_LINE> if self._config[u'type'] == u'static': <NEW_LINE> <INDENT> self._a... | Pending authentication information for WAMP-Anonymous authentication. | 62598f383cc13d1c6d464869 |
class VCTreeStatusLexer(RegexLexer): <NEW_LINE> <INDENT> name = 'VCTreeStatus' <NEW_LINE> aliases = ['vctreestatus'] <NEW_LINE> filenames = [] <NEW_LINE> mimetypes = [] <NEW_LINE> tokens = { 'root': [ (r'^A \+ C\s+', Generic.Error), (r'^A\s+\+?\s+', String), (r'^M\s+', Generic.Inserted), (r'^C\s+', Generic.Error), (r... | For colorizing output of version control status commands, like "hg
status" or "svn status".
.. versionadded:: 2.0 | 62598f38eab8aa0e5d30ae72 |
class FeatureFusion(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_channels, out_channels, reduction=4): <NEW_LINE> <INDENT> super(FeatureFusion, self).__init__() <NEW_LINE> mid_channels = out_channels // reduction <NEW_LINE> self.conv_merge = conv1x1_block( in_channels=in_channels, out_channels=out_channels) <N... | Feature fusion block.
Parameters:
----------
in_channels : int
Number of input channels.
out_channels : int
Number of output channels.
reduction : int, default 4
Squeeze reduction value. | 62598f3815fb5d323ce7de22 |
class Post(Article): <NEW_LINE> <INDENT> def __init__(self, content, metadata, path): <NEW_LINE> <INDENT> super().__init__(content, metadata, path) <NEW_LINE> self.metadata['date'] = dp.parse(self.metadata['date']) <NEW_LINE> self.metadata['url'] = self.metadata['date'].strftime('%Y/%m/') + self.metadata['slug'] | Holds information about an individual post. | 62598f38462c4b4f79dbaaf7 |
class CustomerInitiatedReturnRisk(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> lazy_import() <NEW_LINE> return { 'score': (Sign... | 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... | 62598f384c342835776193cf |
class ClasseFonction(Fonction): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def init_types(cls): <NEW_LINE> <INDENT> cls.ajouter_types(cls.titre_salle, "Salle") <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def titre_salle(salle): <NEW_LINE> <INDENT> return salle.titre | Retourne le titre d'une salle. | 62598f3815fb5d323ce7de24 |
class findAccMissionInfo_result: <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (AccountMission, AccountMission.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot.__cl... | Attributes:
- success | 62598f383cc13d1c6d46486d |
class RESTClientTest(unittest.TestCase): <NEW_LINE> <INDENT> @patch('eots.client.treq') <NEW_LINE> def test_auth_is_used_when_passed(self, treq_mock): <NEW_LINE> <INDENT> username, password = 'user', 'hunter2' <NEW_LINE> client = RESTClient('http://base/', auth=(username, password)) <NEW_LINE> client.retrieve('resource... | Test basic authentication in eots. | 62598f3826238365f5fabc8e |
class OffScreenCanvasTarget: <NEW_LINE> <INDENT> def __init__(self, width, height): <NEW_LINE> <INDENT> from fsleyes.gl.textures import RenderTexture <NEW_LINE> self.__width = width <NEW_LINE> self.__height = height <NEW_LINE> self.__target = RenderTexture( '{}({})_RenderTexture'.format( type(self).__name__, id(self))... | Base class for canvas objects which support off-screen rendering. | 62598f3815fb5d323ce7de2c |
class RewardSampler(nn.Module): <NEW_LINE> <INDENT> def __init__(self, opt, vocab): <NEW_LINE> <INDENT> super(RewardSampler, self).__init__() <NEW_LINE> self.logger = opt.logger <NEW_LINE> self.alpha = opt.alpha_sent <NEW_LINE> assert self.alpha > 0, 'set alpha to a nonzero value, otherwise use the default loss' <NEW_L... | Sampling the sentences wtr the reward distribution
instead of the captionig model itself | 62598f383cc13d1c6d464875 |
class HarmonyCallback(NamedTuple): <NEW_LINE> <INDENT> connected: NoParamCallback <NEW_LINE> disconnected: NoParamCallback <NEW_LINE> config_updated: NoParamCallback <NEW_LINE> activity_starting: ActivityCallback <NEW_LINE> activity_started: ActivityCallback | Callback type for Harmony Hub notifications. | 62598f38462c4b4f79dbab04 |
class Schedule(BaseTable): <NEW_LINE> <INDENT> send_strategy = ( (1, "始终发送"), (2, "仅失败发送"), (3, "从不发送") ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> verbose_name = "定时任务" <NEW_LINE> db_table = "Schedule" <NEW_LINE> <DEDENT> name = models.CharField("任务名称", unique=True, null=False, max_length=100) <NEW_LINE> identity = m... | 定时任务信息表 | 62598f38187af65679d2948b |
class Blob(ParserBase): <NEW_LINE> <INDENT> def __init__(self, length=None): <NEW_LINE> <INDENT> if length != None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> if int(length) != length: <NEW_LINE> <INDENT> raise TypeError('Length must be int-like.') <NEW_LINE> <DEDENT> if length < 0: <NEW_LINE> <INDENT> raise ValueErr... | Class for a binary blob. Creates a bytes object from a
memoryview, and a memoryview from bytes. | 62598f38627d3e7fe0e05f94 |
class GPGNotSpecifiedError(Exception): <NEW_LINE> <INDENT> pass | The gpg object should be explicitly created when FB is encrypting data | 62598f3815fb5d323ce7de34 |
class TrackedFile(db.Model): <NEW_LINE> <INDENT> __table_args__ = ( db.UniqueConstraint('hook_id', 'path', name='unique_tracked_file_within_hook'), ) <NEW_LINE> id = db.Column(db.Integer, primary_key=True) <NEW_LINE> hook_id = db.Column(db.Integer, db.ForeignKey('hook.id'), nullable=False) <NEW_LINE> path = db.Column(d... | Reflecs a :term:`tracked file`. | 62598f383cc13d1c6d46487d |
class SubsequentOperation(models.Model): <NEW_LINE> <INDENT> _name = "l10n_br_fiscal.subsequent.operation" <NEW_LINE> _description = "Subsequent Operation" <NEW_LINE> _rec_name = "fiscal_operation_id" <NEW_LINE> _order = "sequence" <NEW_LINE> sequence = fields.Integer( string="Sequence", default=10, help="Gives the seq... | We must be aware that some subsequent operations do not generate
financial moves | 62598f384c342835776193e3 |
class ImportSomeData(Operator, ImportHelper): <NEW_LINE> <INDENT> bl_idname = "import_test.some_data" <NEW_LINE> bl_label = "Import a Quake3 BSP" <NEW_LINE> filename_ext = ".bsp" <NEW_LINE> filter_glob = StringProperty( default="*.bsp", options={'HIDDEN'}, ) <NEW_LINE> scale_factor = FloatProperty( name="Scale factor",... | Import a Quake 3 BSP level | 62598f3826238365f5fabca0 |
class DiscretisedEnv(gym.Wrapper): <NEW_LINE> <INDENT> def __init__(self, env, n_bins=10): <NEW_LINE> <INDENT> gym.Wrapper.__init__(self, env) <NEW_LINE> self.env = env <NEW_LINE> self.cart_position_high = env.observation_space.high[0] <NEW_LINE> self.cart_velocity_high = env.observation_space.high[1] <NEW_LINE> self.p... | Wrapper for getting discredited observation in cartpole
Inspired by https://medium.com/@tuzzer/cart-pole-balancing-with-q-learning-b54c6068d947 | 62598f380a366e3fb87dbae6 |
class ClipboardPDU(PDU): <NEW_LINE> <INDENT> def __init__(self, msgType, msgFlags, payload=None): <NEW_LINE> <INDENT> PDU.__init__(self, payload) <NEW_LINE> self.msgType = msgType <NEW_LINE> self.msgFlags = msgFlags | Not a PDU, just a base class for every other clipboard PDUs.
https://msdn.microsoft.com/en-us/library/cc241097.aspx | 62598f39462c4b4f79dbab10 |
class InfiniteMap: <NEW_LINE> <INDENT> def __init__(self, d: Dict[A, B], default: Optional[B]) -> None: <NEW_LINE> <INDENT> self.d = d <NEW_LINE> self.default = default <NEW_LINE> <DEDENT> def __str__(self) -> str: <NEW_LINE> <INDENT> return f'InfiniteMap({self.d}, {self.default})' <NEW_LINE> <DEDENT> def __repr__(self... | An InfiniteMap is a possibly infinite map modeled by a simple if-then-else
function. For example, the function
def f(x):
if x == 1:
return 'one'
elif x == 4:
return 'four'
else:
return None
represents the finite map {1: 'one', 4: 'four'} whereas the func... | 62598f39eab8aa0e5d30ae8e |
class Pattern(ElementRepresentative): <NEW_LINE> <INDENT> def __init__(self, xsdElement, parent): <NEW_LINE> <INDENT> ElementRepresentative.__init__(self, xsdElement, parent) <NEW_LINE> self.value = self.xsdElement.get('value') <NEW_LINE> self.getContainingType().patterns.append(self.value) <NEW_LINE> <DEDENT> def getN... | The class for the pattern tag. Subclass of
*ElementRepresentative*. | 62598f39462c4b4f79dbab12 |
class KFold(object): <NEW_LINE> <INDENT> def __init__(self, idxs, n_folds=4): <NEW_LINE> <INDENT> assert n_folds >= 3 <NEW_LINE> assert isinstance(idxs, numpy.ndarray) <NEW_LINE> self.n_folds = n_folds <NEW_LINE> self.runs = [] <NEW_LINE> folds = numpy.split(idxs, self.n_folds) <NEW_LINE> for run_n in xrange(self.n_fol... | KFold CrossValidation with support for validation sets | 62598f39c4546d3d9def6af1 |
class Director: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def construct(car_builder: CarBuilder): <NEW_LINE> <INDENT> car_builder.set_body() <NEW_LINE> car_builder.set_wheel() <NEW_LINE> car_builder.set_steering_wheel() <NEW_LINE> car_builder.set_engine() <NEW_LINE> return car_builder.get_result() | 指挥者 | 62598f393cc13d1c6d464889 |
class OptimizationStageResults(SchemaBase, abc.ABC): <NEW_LINE> <INDENT> provenance: Dict[str, str] = Field( {}, description="The versions of the software used to generate the results." ) <NEW_LINE> status: Status = Field("waiting", description="The status of the optimization.") <NEW_LINE> error: Optional[Error] = Fiel... | The base class for data models which store the results of an optimization. | 62598f39187af65679d29492 |
class ObjectTempNode(Node): <NEW_LINE> <INDENT> _fields = ['node'] <NEW_LINE> def __init__(self, node, incref=False): <NEW_LINE> <INDENT> assert not isinstance(node, ObjectTempNode) <NEW_LINE> self.node = node <NEW_LINE> self.llvm_temp = None <NEW_LINE> self.type = getattr(node, 'type', node.variable.type) <NEW_LINE> s... | Coerce a node to a temporary which is reference counted. | 62598f390a366e3fb87dbaee |
class RO_AttrDictWrapper(AttrDictWrapper): <NEW_LINE> <INDENT> def __setattr__(self, attr, value): <NEW_LINE> <INDENT> self[attr] <NEW_LINE> raise AttributeError("'%s' object attribute '%s' is read-only" % (self.__class__.__name__, attr)) | Read-only version of AttrDictWrapper. | 62598f3915fb5d323ce7de43 |
class Bar: <NEW_LINE> <INDENT> percentage_characters = 5 <NEW_LINE> time_characters = 11 <NEW_LINE> def __init__(self, total, message=None, columns=None): <NEW_LINE> <INDENT> self.total = total <NEW_LINE> self.characters = self._calculate_characters(columns) <NEW_LINE> self.value = 0 <NEW_LINE> self.percentage = 0 <NEW... | Use this class to display progress.
Make sure your command line interface understands ANSI escape codes. | 62598f39eab8aa0e5d30ae95 |
class BaseDenseHead(nn.Module, metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super(BaseDenseHead, self).__init__() <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def loss(self, **kwargs): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @abstractmethod <NEW_LINE> def get_bboxes(self, **kwa... | Base class for DenseHeads | 62598f39c4546d3d9def6af4 |
class IsOwnerOrReadonly(permissions.BasePermission): <NEW_LINE> <INDENT> def has_object_permission(self, request, view, obj): <NEW_LINE> <INDENT> if request.method in permissions.SAFE_METHODS: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return obj.owner == request.user | Custom permission to only allow owners of an object to edit it. | 62598f39462c4b4f79dbab19 |
class IceSat_iceThicknessDiff(IceDiagnosticPlot): <NEW_LINE> <INDENT> def __init__(self, env): <NEW_LINE> <INDENT> super(IceSat_iceThicknessDiff, self).__init__() <NEW_LINE> self._name = 'IceSat Ice Thickness Diff Plots' <NEW_LINE> self._shortname = 'IceSat_iceThicknessDiff' <NEW_LINE> self._template_file = 'IceSat_ice... | IceSat Ice Thickness Diff Plots
| 62598f3915fb5d323ce7de4b |
class ConnectionDeny(Exception): <NEW_LINE> <INDENT> BAD_REQUEST = 400 <NEW_LINE> FORBIDDEN = 403 <NEW_LINE> NOT_FOUND = 404 <NEW_LINE> NOT_ACCEPTABLE = 406 <NEW_LINE> REQUEST_TIMEOUT = 408 <NEW_LINE> INTERNAL_SERVER_ERROR = 500 <NEW_LINE> NOT_IMPLEMENTED = 501 <NEW_LINE> SERVICE_UNAVAILABLE = 503 <NEW_LINE> def __init... | Throw an instance of this class to deny a WebSocket connection
during handshake in :meth:`autobahn.websocket.protocol.WebSocketServerProtocol.onConnect`. | 62598f393cc13d1c6d464897 |
class ProjectsService(base_api.BaseApiService): <NEW_LINE> <INDENT> _NAME = u'projects' <NEW_LINE> def __init__(self, client): <NEW_LINE> <INDENT> super(ContainerV1beta1.ProjectsService, self).__init__(client) <NEW_LINE> self._upload_configs = { } <NEW_LINE> <DEDENT> def GetIamPolicy(self, request, global_params=None):... | Service class for the projects resource. | 62598f390a366e3fb87dbafa |
class MockServerResults(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = data <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> def get_data_copy(*args): <NEW_LINE> <INDENT> return deepcopy(self.data) <NEW_LINE> <DEDENT> return get_data_copy | TODO | 62598f39187af65679d29499 |
class Provider(object): <NEW_LINE> <INDENT> languages = set() <NEW_LINE> video_types = (Episode, Movie) <NEW_LINE> required_hash = None <NEW_LINE> subtitle_class = None <NEW_LINE> user_agent = 'Subliminal/%s' % __short_version__ <NEW_LINE> def __enter__(self): <NEW_LINE> <INDENT> self.initialize() <NEW_LINE> return sel... | Base class for providers.
If any configuration is possible for the provider, like credentials, it must take place during instantiation.
:raise: :class:`~subliminal.exceptions.ConfigurationError` if there is a configuration error | 62598f390a366e3fb87dbafb |
class ProcAllocationError(Exception): <NEW_LINE> <INDENT> def __init__(self, sub_idx, requested, remaining): <NEW_LINE> <INDENT> super(ProcAllocationError, self).__init__('') <NEW_LINE> self.sub_idx = sub_idx <NEW_LINE> self.requested = requested <NEW_LINE> self.remaining = remaining | Exception raised when processor allocation fails.
Attributes
----------
sub_idx : int
Index into the parent's _subsystems_allprocs list.
requested : int
Number of processes requested by the indexed subsystem.
remaining : int
Number of processes available to the indexed subsystem. | 62598f39627d3e7fe0e05fb2 |
class UpdateSecretKey(AppBaseView): <NEW_LINE> <INDENT> def put(self, request, *args, **kwargs): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> secret_key = request.data.get("secret_key", None) <NEW_LINE> if not secret_key: <NEW_LINE> <INDENT> code = 400 <NEW_LINE> result = general_message(code, "no secret_key", "请输入密钥")... | 修改部署秘钥 | 62598f393cc13d1c6d46489b |
class NewsItemCreator(models.Model): <NEW_LINE> <INDENT> news_item = models.ForeignKey(NewsItem) <NEW_LINE> user = models.ForeignKey(User) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> unique_together = (('news_item', 'user'),) <NEW_LINE> ordering = ('news_item',) | Represents an add-on created-by relationship between
a User and a NewsItem without interfering with the
NewsItem model. | 62598f3915fb5d323ce7de53 |
class MongoDB(object): <NEW_LINE> <INDENT> __instance = None <NEW_LINE> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> self.client = self.__connection <NEW_LINE> <DEDENT> def __new__(cls, *args, **kwargs): <NEW_LINE> <INDENT> if not cls.__instance: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> Lock.acquire() <... | mongodb class | 62598f39627d3e7fe0e05fb4 |
class V1beta1HorizontalPodAutoscalerSpec(object): <NEW_LINE> <INDENT> operations = [ ] <NEW_LINE> swagger_types = { 'scale_ref': 'V1beta1SubresourceReference', 'min_replicas': 'int', 'max_replicas': 'int', 'cpu_utilization': 'V1beta1CPUTargetUtilization' } <NEW_LINE> attribute_map = { 'scale_ref': 'scaleRef', 'min_repl... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62598f39187af65679d2949b |
class GrowthData(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = "Growth Data" <NEW_LINE> <DEDENT> child = models.ForeignKey( Child, blank=True, null=True, on_delete=models.CASCADE, ) <NEW_LINE> date_recorded = models.DateField(auto_now=True) <NEW_LINE> height_cm = models.Decima... | Defines growth data for child updates | 62598f394c34283577619401 |
class ImmutablePort(port.Port): <NEW_LINE> <INDENT> properties_schema = { k: _copy_schema_immutable(v) for k, v in port.Port.properties_schema.items() } | Ensure an existing port doesn't change. | 62598f39462c4b4f79dbab29 |
class PropSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> def human_format(self, num): <NEW_LINE> <INDENT> magnitude = 0 <NEW_LINE> while abs(num) >= 1000: <NEW_LINE> <INDENT> magnitude += 1 <NEW_LINE> num /= 1000.0 <NEW_LINE> <DEDENT> return '$%.2f%s' % (num, ['', 'K', 'M', 'B', 'T', 'P'][magnitude]) <NEW... | Basic property serializer.
Used when retrieving a property object. | 62598f390a366e3fb87dbb01 |
class ArgumentParsingError(HTTPError): <NEW_LINE> <INDENT> def __init__(self, log_message=None, *args, status_code=400, **kwargs): <NEW_LINE> <INDENT> super().__init__(status_code, log_message, *args, **kwargs) | This exception is raised if an error occured while parsing query or body
parameters in the context of core API. | 62598f39462c4b4f79dbab2b |
class Account: <NEW_LINE> <INDENT> __slot__ = ["balance", "lock"] <NEW_LINE> def __init__(self, balance=0): <NEW_LINE> <INDENT> self.balance = balance <NEW_LINE> self.lock = RLock() | Account class. | 62598f393cc13d1c6d4648a1 |
class Record: <NEW_LINE> <INDENT> aakeys = 'ARNDCQEGHILKMFPSTWYV' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.key = None <NEW_LINE> self.desc = '' <NEW_LINE> self.ref = '' <NEW_LINE> self.authors = '' <NEW_LINE> self.title = '' <NEW_LINE> self.journal = '' <NEW_LINE> self.correlated = dict() <NEW_LINE> self... | Amino acid index (AAindex) Record | 62598f3a462c4b4f79dbab2f |
@urls.register <NEW_LINE> class Role(generic.View): <NEW_LINE> <INDENT> url_regex = r'keystone/roles/(?P<id>[0-9a-f]+|default)$' <NEW_LINE> @rest_utils.ajax() <NEW_LINE> def get(self, request, id): <NEW_LINE> <INDENT> if id == 'default': <NEW_LINE> <INDENT> return api.keystone.get_default_role(request).to_dict() <NEW_L... | API for a single role.
| 62598f3a0a366e3fb87dbb07 |
class InterfaceInline(admin.TabularInline): <NEW_LINE> <INDENT> form = InterfaceAdminForm <NEW_LINE> model = Interface <NEW_LINE> extra = 0 <NEW_LINE> fields = ('link', 'interface_id', 'border_router', 'host', 'public_ip_', 'public_port', 'bind_ip_', 'bind_port', 'type', 'active', ) <NEW_LINE> readonly_fields = tuple([... | Inline to show the interface and the associated link in the AS change page.
This is mostly read-only for now. | 62598f3aeab8aa0e5d30aeaf |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.