code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class MagicClass: <NEW_LINE> <INDENT> def __init__(self, radius=0): <NEW_LINE> <INDENT> self.__radius = 0 <NEW_LINE> if type(radius) is not int and type(radius) is not float: <NEW_LINE> <INDENT> raise TypeError('radius must be a number') <NEW_LINE> <DEDENT> self.__radius = radius <NEW_LINE> <DEDENT> def area(self): <NE... | Magic Class | 6259905116aa5153ce4019ba |
class FoodProduct(Product): <NEW_LINE> <INDENT> __tablename__ = 'food_product' <NEW_LINE> id = Column(Integer, ForeignKey('product.id'), primary_key=True) <NEW_LINE> allergens = relationship('Allergen', secondary=product_allergens) <NEW_LINE> customer_id = Column(Integer, ForeignKey('customer.id')) <NEW_LINE> customer ... | Food product model class. | 6259905107f4c71912bb0902 |
class MftFlagsField(BaseField): <NEW_LINE> <INDENT> @property <NEW_LINE> def value(self): <NEW_LINE> <INDENT> flag_choices = { 0x01: 'In use', 0x02: 'Directory', } <NEW_LINE> if self.raw: <NEW_LINE> <INDENT> flags = self.unpack() <NEW_LINE> try: <NEW_LINE> <INDENT> return flag_choices[flags] <NEW_LINE> <DEDENT> except ... | Stores the MFT Flags | 6259905129b78933be26ab29 |
class TestPinotDbEngineSpec(TestDbEngineSpec): <NEW_LINE> <INDENT> def test_pinot_time_expression_sec_one_1d_grain(self): <NEW_LINE> <INDENT> col = column("tstamp") <NEW_LINE> expr = PinotEngineSpec.get_timestamp_expr(col, "epoch_s", "P1D") <NEW_LINE> result = str(expr.compile()) <NEW_LINE> self.assertEqual( result, "D... | Tests pertaining to our Pinot database support | 6259905123e79379d538d9c4 |
class SectorAIModel(DBModelBase): <NEW_LINE> <INDENT> areaConquest = DBModelProperty(factory=SectorAIACModel) | AI strategy settings for sector
| 625990524e696a045264e887 |
class SiteRules: <NEW_LINE> <INDENT> def __init__(self, file_rules): <NEW_LINE> <INDENT> cfg = configparser.ConfigParser() <NEW_LINE> cfg.read(file_rules) <NEW_LINE> try: <NEW_LINE> <INDENT> self.source = cfg.get('main', 'source') <NEW_LINE> self.lenta = str(cfg.get('main', 'news_lenta')).split(',') <NEW_LINE> self.bas... | Правила парсинга новостный сайтов | 625990520fa83653e46f63ae |
class Message(MessageBased): <NEW_LINE> <INDENT> pass | A Message is a node in a Room's Log. It corresponds to a chat message,
or a post, or any broadcasted event in a room that should appear in the log. | 625990523cc13d1c6d466c08 |
class ProductProperty(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name_plural = _('Product Properties') <NEW_LINE> <DEDENT> PT_SINGLE_VALUE = 0 <NEW_LINE> PROPERTY_TYPES = ( (PT_SINGLE_VALUE, 'Single Value'), ) <NEW_LINE> name = models.CharField(_('name'), max_length=40) <NEW_LINE> produc... | Represents a product object. | 62599052d486a94d0ba2d493 |
@dataclasses.dataclass(init=True, repr=True, eq=False, order=False, unsafe_hash=False, frozen=True) <NEW_LINE> class AaveSimpleEvent(AaveEvent): <NEW_LINE> <INDENT> asset: Asset <NEW_LINE> value: Balance <NEW_LINE> def serialize(self) -> Dict[str, Any]: <NEW_LINE> <INDENT> result = super().serialize() <NEW_LINE> result... | A simple event of the Aave protocol. Deposit or withdrawal | 625990520a50d4780f706824 |
class IOauthTwitterSettings(Interface): <NEW_LINE> <INDENT> client_id = schema.ASCIILine( title = _(u'client_id' , default=u'Twitter client ID'), description = _(u'help_client_id' , default=u"Alternatively, you can of course use the ID of an existing app."), required = True, ) <NEW_LINE> client_secret = schema.ASCIILin... | OAuth Twitter registry settings | 625990528da39b475be046b6 |
class ReversedEnumerable(Enumerable): <NEW_LINE> <INDENT> def __init__(self, enumerable): <NEW_LINE> <INDENT> super(ReversedEnumerable, self).__init__(enumerable) <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> stack = LifoQueue() <NEW_LINE> for element in self._iterable: <NEW_LINE> <INDENT> stack.put(eleme... | Class to hold state for reversing elements in a collection | 6259905230dc7b76659a0ce4 |
class ArchipackActiveManip: <NEW_LINE> <INDENT> def __init__(self, object_name): <NEW_LINE> <INDENT> self.object_name = object_name <NEW_LINE> self.stack = [] <NEW_LINE> self.manipulable = None <NEW_LINE> self.datablock = None <NEW_LINE> <DEDENT> @property <NEW_LINE> def dirty(self): <NEW_LINE> <INDENT> return ( self.m... | Store manipulated object
- object_name: manipulated object name
- stack: array of Manipulators instances
- manipulable: Manipulable instance | 62599052004d5f362081fa51 |
class Deporte(models.Model): <NEW_LINE> <INDENT> nombre = models.CharField(max_length=200) <NEW_LINE> descripcion = models.CharField(max_length=1000, blank=True, verbose_name='Descripción') <NEW_LINE> imagen = models.CharField(max_length=1000, verbose_name='Imágen', help_text='URL de la imagen del deporte') <NEW_LINE> ... | Describe un deporte. | 6259905291af0d3eaad3b2f4 |
class MemberView(LoginRequiredMixin, BaseView): <NEW_LINE> <INDENT> template_name = 'member.html' <NEW_LINE> def get(self, request, token): <NEW_LINE> <INDENT> room = self.get_object_or_404(PokerRoom, token=token) <NEW_LINE> member = PokerMember.objects.filter( room=room, user=self.user, is_active=True, ).first() <NEW_... | View for editing member data. | 62599052379a373c97d9a4f1 |
class pyTigerGraphLoading(pyTigerGraphBase): <NEW_LINE> <INDENT> def runLoadingJobWithFile(self, filePath: str, fileTag: str, jobName: str, sep: str = None, eol: str = None, timeout: int = 16000, sizeLimit: int = 128000000) -> dict: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = open(filePath, 'rb').read() <NEW_LI... | Loading job-specific functions. | 62599052dd821e528d6da3ab |
class NoneClientError(Exception): <NEW_LINE> <INDENT> def __init__(self, username): <NEW_LINE> <INDENT> self.username = username <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return 'Клиент с именем {} не найден'.format(self.username) | Клиент не найден. | 6259905299cbb53fe68323b5 |
class DescribeDatabasesResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TotalCount = None <NEW_LINE> self.Items = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TotalCount = params.get("TotalCount") <NEW_LINE> s... | DescribeDatabases response structure.
| 62599052009cb60464d02a0a |
class RBiovizbase(RPackage): <NEW_LINE> <INDENT> homepage = "http://bioconductor.org/packages/biovizBase/" <NEW_LINE> git = "https://git.bioconductor.org/packages/biovizBase.git" <NEW_LINE> version('1.24.0', commit='ae9cd2ff665b74a8f45ed9c1d17fc0a778b4af6c') <NEW_LINE> depends_on('r@3.4.0:3.4.9', when='@1.24.0') <... | The biovizBase package is designed to provide a set of
utilities, color schemes and conventions for genomic data.
It serves as the base for various high-level packages for
biological data visualization. This saves development effort
and encourages consistency. | 6259905210dbd63aa1c720b1 |
class PBNBoxCollection(BoxCollection): <NEW_LINE> <INDENT> @property <NEW_LINE> def _resource_type(self): <NEW_LINE> <INDENT> return PBNBox | Represent a collection of boxen.
:param connection: A RestClient instance
:param path: The canonical path to the Box collection resource | 6259905294891a1f408ba15d |
class Test_write__valid_x_cube_attributes(tests.IrisTest): <NEW_LINE> <INDENT> def test_valid_range_saved(self): <NEW_LINE> <INDENT> cube = tests.stock.lat_lon_cube() <NEW_LINE> cube.data = cube.data.astype('int32') <NEW_LINE> vrange = np.array([1, 2], dtype='int32') <NEW_LINE> cube.attributes['valid_range'] = vrange <... | Testing valid_range, valid_min and valid_max attributes. | 62599052b7558d5895464990 |
class EdfGenerator(gen.Generator): <NEW_LINE> <INDENT> def __init__(self, scheduler, templates, options, params): <NEW_LINE> <INDENT> super(EdfGenerator, self).__init__(scheduler, templates, self.__make_options() + options, params) <NEW_LINE> <DEDENT> def __make_options(self): <NEW_LINE> <INDENT> return [gen.Generator.... | Creates sporadic task sets with the most common Litmus options. | 6259905230c21e258be99cd6 |
class GuiBoundingRectGetter(qg.QGraphicsRectItem): <NEW_LINE> <INDENT> def __init__(self, scene, signal): <NEW_LINE> <INDENT> super(GuiBoundingRectGetter, self).__init__(0, 0, VID_DIM[1], VID_DIM[0], scene=scene) <NEW_LINE> self.setPen(qClear) <NEW_LINE> self.setBrush(qClear) <NEW_LINE> self.setZValue(2) <NEW_LINE> sel... | Finds and returns user defined bounding coords | 62599052498bea3a75a58ff3 |
class Sheet(Component): <NEW_LINE> <INDENT> def __init__(self,id=Id()): <NEW_LINE> <INDENT> Component.__init__(self,id=id) | Defines a schematic sheet.
A sheet is a collection of components representing a schematic meant to be
encapsulated into one unit.
A sheet has two renderings, internal and external. The internal rendering
shows the components the sheet is made up of. The external rendering
presents the sheet as a box with named ports... | 6259905223849d37ff852591 |
class OFFLOAD_STATUS4res(BaseObj): <NEW_LINE> <INDENT> _strfmt1 = "{1}" <NEW_LINE> def __init__(self, unpack): <NEW_LINE> <INDENT> self.set_attr("status", nfsstat4(unpack)) <NEW_LINE> if self.status == const.NFS4_OK: <NEW_LINE> <INDENT> self.set_attr("resok", OFFLOAD_STATUS4resok(unpack), switch=True) | union switch OFFLOAD_STATUS4res (nfsstat4 status) {
case const.NFS4_OK:
OFFLOAD_STATUS4resok resok;
default:
void;
}; | 625990523cc13d1c6d466c0b |
class KeyAttribute(parsing.Nonterm): <NEW_LINE> <INDENT> def reducePlain(self, element): <NEW_LINE> <INDENT> self.element = element.value <NEW_LINE> <DEDENT> def __repr__( self ): <NEW_LINE> <INDENT> return repr(self.element) | %nonterm | 62599052e64d504609df9e37 |
class V1PodTemplate(object): <NEW_LINE> <INDENT> operations = [ { 'class': 'ApiV1', 'type': 'create', 'method': 'create_podtemplate', 'namespaced': False }, { 'class': 'ApiV1', 'type': 'update', 'method': 'replace_namespaced_podtemplate', 'namespaced': True }, { 'class': 'ApiV1', 'type': 'delete', 'method': 'delete_nam... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 62599052b830903b9686eee4 |
class NoLicenseAvailableForTask(BaseException): <NEW_LINE> <INDENT> pass | Raised to interrupt the dispatch iteration on an entry point node. | 62599052dc8b845886d54a91 |
class Lagrangian: <NEW_LINE> <INDENT> def __init__(self,json_dict): <NEW_LINE> <INDENT> self.Vi = InputFields() <NEW_LINE> self.Vi.get_info(json_dict['velocity']) <NEW_LINE> self.Vi.get_mfds() <NEW_LINE> self.Vi.get_grid() <NEW_LINE> self.Vi.get_interpolants() <NEW_LINE> self.boundaries = [] <NEW_LINE> <DEDENT> def F(s... | This class provides pure Lagrangian kernels.
The particle just follows the local velocity flow field.
Attributes:
-Vi (function): The interpolant function, to evaluate the
local flow velocity field V(r(t),t). | 62599052097d151d1a2c2544 |
class TextInput(Input): <NEW_LINE> <INDENT> input_type = 'text' | Render a single-line text input. | 62599052d99f1b3c44d06b6e |
class Changeish(object): <NEW_LINE> <INDENT> is_reportable = False <NEW_LINE> def __init__(self, project): <NEW_LINE> <INDENT> self.project = project <NEW_LINE> self.build_sets = [] <NEW_LINE> self.dequeued_needing_change = False <NEW_LINE> self.current_build_set = BuildSet(self) <NEW_LINE> self.build_sets.append(self.... | Something like a change; either a change or a ref | 62599052f7d966606f74931f |
class pltfm_mgr_pwr_supply_present_get_result(object): <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.BOOL, 'success', None, None, ), (1, TType.STRUCT, 'ouch', (InvalidPltfmMgrOperation, InvalidPltfmMgrOperation.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None, ouch=None,): <NEW_LINE> <INDENT> self.su... | Attributes:
- success
- ouch | 62599052d7e4931a7ef3d54d |
class SubPixels: <NEW_LINE> <INDENT> block_width: int <NEW_LINE> block_height: int <NEW_LINE> bit_size: int = 0b1111 <NEW_LINE> def __init_subclass__(cls): <NEW_LINE> <INDENT> cls.chars_by_name = chars_by_name = { key: value for key, value in cls.__dict__.items() if key.isupper() } <NEW_LINE> cls.chars_to_name = mirror... | Used internally to emulate pixel setting/resetting/reading inside unicode block characters
Requires that the subclasses contain a listing and other mappings
of all block characters to be used in order, so that
bits in numbers from 0 to `bit_size` will match the "pixels" on the corresponding block character.
Although ... | 6259905229b78933be26ab2c |
class TCPCommunicator(Communicator): <NEW_LINE> <INDENT> def __init__(self, host='', port=9637): <NEW_LINE> <INDENT> super(TCPCommunicator, self).__init__() <NEW_LINE> self.host = host <NEW_LINE> self.port = port <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> logger.info('TCPCommunicator started') <NEW_LINE> so... | Socket communicator class for EnOcean radio | 62599052d6c5a102081e35ec |
class Block(pygame.sprite.Sprite): <NEW_LINE> <INDENT> def __init__(self, color, x, y): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.image = pygame.Surface([block_width, block_height]) <NEW_LINE> self.image.fill(color) <NEW_LINE> self.rect = self.image.get_rect() <NEW_LINE> self.rect.x = x <NEW_LINE> self.rec... | This class represents each block that will get knocked out by the ball
It derives from the "Sprite" class in Pygame | 6259905245492302aabfd9a8 |
class Audit(BaseAction): <NEW_LINE> <INDENT> @tornado.web.authenticated <NEW_LINE> def get(self): <NEW_LINE> <INDENT> if not self.accessAdmin(): <NEW_LINE> <INDENT> self.write("Permission Denied.") <NEW_LINE> return <NEW_LINE> <DEDENT> x = {'a':self.get_argument('a',''), 'p':self.get_argument('p',0), 'psz':self.get_arg... | 管理审计日志 | 6259905276d4e153a661dce2 |
class Endpoint(object): <NEW_LINE> <INDENT> __version = '0.0.1' <NEW_LINE> def __init__(self, endpoint_url, client_id = None, client_secret = None): <NEW_LINE> <INDENT> if client_id is None: <NEW_LINE> <INDENT> client_id = str(keyring.get_password('Addigy', 'ClientID')) <NEW_LINE> <DEDENT> if client_secret is None: <NE... | Use GET, POST, PUT, and DELETE methods with Addigy endpoints.
<Subclass>.__init__ pass endpoint_url to Endpoint.__init__, and subclass
methods pass params, json, etc. | 625990523617ad0b5ee07615 |
class FiniteJoinSemilattice(FinitePoset): <NEW_LINE> <INDENT> Element = JoinSemilatticeElement <NEW_LINE> def _repr_(self): <NEW_LINE> <INDENT> s = "Finite join-semilattice containing %s elements"%self._hasse_diagram.order() <NEW_LINE> if self._with_linear_extension: <NEW_LINE> <INDENT> s += " with distinguished linear... | We assume that the argument passed to FiniteJoinSemilattice is the
poset of a join-semilattice (i.e. a poset with least upper bound
for each pair of elements).
TESTS::
sage: J = JoinSemilattice([[1,2],[3],[3]])
sage: TestSuite(J).run()
::
sage: P = Poset([[1,2],[3],[3]])
sage: J = JoinSemilattice(P)... | 6259905207d97122c4218179 |
class aMSNSplashScreen(base.aMSNSplashScreen): <NEW_LINE> <INDENT> def __init__(self, amsn_core, parent): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def show(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def hide(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def set_text(self, text): <NEW_LINE> <INDENT> p... | This is the splashscreen for ncurses | 625990526e29344779b01b18 |
class ConfigParser: <NEW_LINE> <INDENT> config = {} <NEW_LINE> @staticmethod <NEW_LINE> def parse_config(filename): <NEW_LINE> <INDENT> filename = os.path.normpath(os.path.expanduser(filename)) <NEW_LINE> with open(filename) as config_file: <NEW_LINE> <INDENT> config_dict = yaml.load(config_file) <NEW_LINE> <DEDENT> Co... | Wrapper class for the config.
Before first use call parse_config_file
or you will get an empty config object | 625990523cc13d1c6d466c0d |
class ConsumerListCommand(PulpCliCommand): <NEW_LINE> <INDENT> _ALL_FIELDS = ['id', 'display_name', 'description', 'bindings', 'notes'] <NEW_LINE> def __init__(self, context, name=None, description=None): <NEW_LINE> <INDENT> name = name or 'list' <NEW_LINE> description = description or _('lists a summary of consumers r... | List the consumers that are currently registered with the Pulp server. | 62599052d486a94d0ba2d498 |
class Attribute(object): <NEW_LINE> <INDENT> __slots__ = ( "name", "default", "validator", "repr", "cmp", "hash", "init", "metadata", "type", "converter", ) <NEW_LINE> def __init__( self, name, default, validator, repr, cmp, hash, init, convert=None, metadata=None, type=None, converter=None, ): <NEW_LINE> <INDENT> boun... | *Read-only* representation of an attribute.
:attribute name: The name of the attribute.
Plus *all* arguments of :func:`attr.ib`.
For the version history of the fields, see :func:`attr.ib`. | 62599052e5267d203ee6cdbe |
class MathEffect(Effect): <NEW_LINE> <INDENT> def __init__(self, noise=0.15, fill=(0,0,0,0)): <NEW_LINE> <INDENT> self.fill = rgba(fill) <NEW_LINE> self.above = noise > 0 <NEW_LINE> self.noise = abs(noise) <NEW_LINE> <DEDENT> def eqn(self, x, n, size): <NEW_LINE> <INDENT> dh = self.noise <NEW_LINE> if not self.above: n... | Effect based on y < f(x) or y > f(x) | 625990524e696a045264e88a |
class PhoneVerificationForm(Form): <NEW_LINE> <INDENT> verification_code = TextField('Verification code', [Required(),]) | A basic verification form to take in the user's verification code
attempt. | 62599052a8ecb033258726e7 |
class CLHEP2042( Clhep.Clhep ): <NEW_LINE> <INDENT> def __init__( self ): <NEW_LINE> <INDENT> super( CLHEP2042, self ).__init__( "clhep-2.0.4.2", "clhep-2.0.4.2.tgz" ) <NEW_LINE> return | Clhep 2.0.4.2, install package. | 62599052cad5886f8bdc5ae9 |
class Solution(object): <NEW_LINE> <INDENT> def firstBadVersion(self, n): <NEW_LINE> <INDENT> class Wrap: <NEW_LINE> <INDENT> def __getitem__(self, i): <NEW_LINE> <INDENT> return isBadVersion(i) <NEW_LINE> <DEDENT> <DEDENT> return bisect.bisect(Wrap(), False, 0, n) | 用python 的库bisect来实现,指定0-n这样的list区间,然后对每个数进行isBadVersion(i)判断
这里用到了__getitem__(self, i)的魔法方法,使得区间的每个数可以用索引访问,当为false时返回结果
Runtime: 12 ms, faster than 93.14% of Python online submissions for First Bad Version.
Memory Usage: 11.8 MB, less than 44.40% of Python online submissions for First Bad Version. | 62599052379a373c97d9a4f6 |
class HRInsuranceModel(S3Model): <NEW_LINE> <INDENT> names = ("hrm_insurance", ) <NEW_LINE> def model(self): <NEW_LINE> <INDENT> T = current.T <NEW_LINE> insurance_types = {"SOCIAL": T("Social Insurance"), "HEALTH": T("Health Insurance"), } <NEW_LINE> insurance_type_represent = S3Represent(options = insurance_types) <N... | Data Model to track insurance information of staff members | 6259905276d4e153a661dce3 |
class TextureCubeMap(Texture): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> Texture.__init__(self, gl.GL_TEXTURE_CUBE_MAP, *args, **kwargs) | Representation of a cube map, to store texture data for the
6 sided of a cube. Used for instance to create environment mappings.
Inherits :class:`texture.Texture`.
This class is not yet implemented. | 625990528e71fb1e983bcf9b |
class PokemonWikiDownloader(object): <NEW_LINE> <INDENT> def __init__(self, wiki_downloader: WikiDownloader): <NEW_LINE> <INDENT> self.wiki_downloader = wiki_downloader <NEW_LINE> <DEDENT> def download_pokemon(self, pokemon: str): <NEW_LINE> <INDENT> self.wiki_downloader.download(pokemon + '_(Pokémon)') | Downloads Pokemon Wikimedia file. | 6259905230dc7b76659a0ce7 |
class GeoprocessingApiUserRateThrottle(UserRateThrottle): <NEW_LINE> <INDENT> def allow_request(self, request, view): <NEW_LINE> <INDENT> if request.user and request.user.username == settings.CLIENT_APP_USERNAME: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> return UserRateThrottle.allow_request(self, r... | Only throttle "real" users of the API, not the client app | 625990524e4d5625663738d9 |
class PersonalInfo(Model): <NEW_LINE> <INDENT> __table__ = 'resume_personalinfo' <NEW_LINE> @staticmethod <NEW_LINE> def get_my_profile(): <NEW_LINE> <INDENT> personal_info = PersonalInfo.find(1) <NEW_LINE> if personal_info: <NEW_LINE> <INDENT> return personal_info | PersonalInfo Model. | 625990523c8af77a43b689a8 |
class MathJax: <NEW_LINE> <INDENT> def __call__(self, x, combine_all=False): <NEW_LINE> <INDENT> return self.eval(x, combine_all=combine_all) <NEW_LINE> <DEDENT> def eval(self, x, globals=None, locals=None, mode='display', combine_all=False): <NEW_LINE> <INDENT> x = latex(x, combine_all=combine_all) <NEW_LINE> prefix =... | Render LaTeX input using MathJax. This returns a :class:`MathJaxExpr`.
EXAMPLES::
sage: from sage.misc.latex import MathJax
sage: MathJax()(3)
<html><script type="math/tex; mode=display">\newcommand{\Bold}[1]{\mathbf{#1}}3</script></html>
sage: MathJax()(ZZ)
<html><script type="math/tex; mode=dis... | 62599052379a373c97d9a4f7 |
class LinksysWRT54GL(cgm_devices.DeviceBase): <NEW_LINE> <INDENT> identifier = 'wrt54gl' <NEW_LINE> name = "WRT54GL" <NEW_LINE> manufacturer = "Linksys" <NEW_LINE> url = 'http://www.linksysbycisco.com/' <NEW_LINE> architecture = 'brcm47xx' <NEW_LINE> radios = [ cgm_devices.IntegratedRadio('wifi0', _("Integrated wireles... | Linksys WRT54GL device descriptor. | 62599052e76e3b2f99fd9ed0 |
class HourGlass(nn.Module): <NEW_LINE> <INDENT> def __init__(self,n=4,f=128): <NEW_LINE> <INDENT> super(HourGlass,self).__init__() <NEW_LINE> self._n = n <NEW_LINE> self._f = f <NEW_LINE> self._init_layers(self._n,self._f) <NEW_LINE> <DEDENT> def _init_layers(self,n,f): <NEW_LINE> <INDENT> setattr(self,'res'+str(n)+'_1... | 不改变特征图的高宽 | 6259905263d6d428bbee3ca3 |
class DemoView(BrowserView): <NEW_LINE> <INDENT> def __init__(self, context, request): <NEW_LINE> <INDENT> self.context = context <NEW_LINE> self.request = request <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> return super(DemoView, self).__call__() | This does nothing so far
| 625990528da39b475be046bd |
class AtomicWriter(object): <NEW_LINE> <INDENT> def __init__(self, path, mode): <NEW_LINE> <INDENT> self.path = path <NEW_LINE> self.mode = mode <NEW_LINE> <DEDENT> def commit(self, writer): <NEW_LINE> <INDENT> writer.flush() <NEW_LINE> os.rename(writer.name, self.path) <NEW_LINE> <DEDENT> def rollback(self, writer): <... | Helper class for performing atomic writes.
:param path: Path to the file.
:param mode: Mode to open the file with. | 625990522ae34c7f260ac5b9 |
class Deque(object): <NEW_LINE> <INDENT> def __init__(self, limit = 10): <NEW_LINE> <INDENT> self.queue = [] <NEW_LINE> self.limit = limit <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return ' '.join([str(i) for i in self.queue]) <NEW_LINE> <DEDENT> def isEmpty(self): <NEW_LINE> <INDENT> return len(self.q... | isEmpty : checks whether the deque is empty
isFull : checks whether the deque is full
insertRear : inserts an element at the rear end of the deque
insertFront : inserts an element at the front end of the deque
deleteRear : deletes an element from the rear end of the deque
deleteFront : deletes an element fro... | 625990526e29344779b01b1c |
class ServerHeartbeatSucceededEvent(_ServerHeartbeatEvent): <NEW_LINE> <INDENT> __slots__ = ('__duration', '__reply', '__awaited') <NEW_LINE> def __init__(self, duration, reply, connection_id, awaited=False): <NEW_LINE> <INDENT> super(ServerHeartbeatSucceededEvent, self).__init__(connection_id) <NEW_LINE> self.__durati... | Fired when the server heartbeat succeeds.
.. versionadded:: 3.3 | 6259905271ff763f4b5e8c81 |
class UsernameConfiguration(AWSProperty): <NEW_LINE> <INDENT> props: PropsDictType = { "CaseSensitive": (boolean, False), } | `UsernameConfiguration <http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cognito-userpool-usernameconfiguration.html>`__ | 6259905223e79379d538d9ce |
class Seccion: <NEW_LINE> <INDENT> def __init__(self, nombre, tipo, propiedades, material, qy=None): <NEW_LINE> <INDENT> self.qy = qy <NEW_LINE> self.propiedadesGeometricas = propiedades <NEW_LINE> self.material = material <NEW_LINE> self.nombre = nombre <NEW_LINE> if tipo == TipoSeccion.RECTANGULAR: <NEW_LINE> <INDENT... | Clase que representa la sección de los elementos a utilizar, asi como los materiales que la componen
Args:
nombre (str): Nombre definido para la sección a crear
tipo (Tipo): Geometría de la sección transversal (Rectangular, Circular o General)
propiedades (list): Dimensiones en metros relacionadas al tipo ... | 62599052435de62698e9d2d6 |
class AdminUserAPI(Resource): <NEW_LINE> <INDENT> method_decorators = [admin_required] <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> self.put_parser = parser(False) <NEW_LINE> super(AdminUserAPI, self).__init__() <NEW_LINE> <DEDENT> @marshal_with(admin_user_fields) <NEW_LINE> def get(self, key_id): <NEW_LINE> <IND... | GET, PUT, DELETE on _other_ users | 62599052379a373c97d9a4f9 |
class IloVirtualMediaAgentDeploy(base.DeployInterface): <NEW_LINE> <INDENT> def get_properties(self): <NEW_LINE> <INDENT> return COMMON_PROPERTIES <NEW_LINE> <DEDENT> def validate(self, task): <NEW_LINE> <INDENT> driver_utils.validate_boot_mode_capability(task.node) <NEW_LINE> driver_utils.validate_secure_boot_capabili... | Interface for deploy-related actions. | 625990520c0af96317c577cb |
class CreateCommitError(Exception): <NEW_LINE> <INDENT> pass | The creation of a commit has failed or was aborted. | 62599052a8ecb033258726eb |
class T7(SortTest): <NEW_LINE> <INDENT> def sink(self, Q: list, k: int, n: int): <NEW_LINE> <INDENT> while 2 * k <= n: <NEW_LINE> <INDENT> j = 2 * k <NEW_LINE> if j < n and Q[j] < Q[j + 1]: <NEW_LINE> <INDENT> j += 1 <NEW_LINE> <DEDENT> if Q[j] < Q[k]: <NEW_LINE> <INDENT> break <NEW_LINE> <DEDENT> Q[j], Q[k] = Q[k], Q[... | 堆排序 | 625990523539df3088ecd77a |
class BootKExec(Boot): <NEW_LINE> <INDENT> def __init__(self, parent, parameters): <NEW_LINE> <INDENT> super(BootKExec, self).__init__(parent) <NEW_LINE> self.action = BootKexecAction() <NEW_LINE> self.action.section = self.action_type <NEW_LINE> self.action.job = self.job <NEW_LINE> parent.add_action(self.action, para... | Expects a shell session, checks for kexec executable and
prepares the arguments to run kexec, | 625990528da39b475be046bf |
class TestMediaFileListResponse(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def testMediaFileListResponse(self): <NEW_LINE> <INDENT> model = kinow_client.models.media_file_list_response.MediaFileLi... | MediaFileListResponse unit test stubs | 62599052b7558d5895464994 |
class EggDrop: <NEW_LINE> <INDENT> def __init__( self, n: int, e: int): <NEW_LINE> <INDENT> if n < 0: <NEW_LINE> <INDENT> raise ValueError("Number of floors should be positive.") <NEW_LINE> <DEDENT> if e < 0: <NEW_LINE> <INDENT> raise ValueError("Number of eggs should be positive.") <NEW_LINE> <DEDENT> self.n = n <NEW_... | Run dynamic programming routine to solve egg drop problem. | 62599052cad5886f8bdc5aeb |
class FavouriteManager(object): <NEW_LINE> <INDENT> def __init__(self, session): <NEW_LINE> <INDENT> self._session = session <NEW_LINE> <DEDENT> @property <NEW_LINE> def _favourite_ids(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> return map(int, self._session.get('favourite', '').split(',')) <NEW_LINE> <DEDENT> ... | Favourite manager | 62599052baa26c4b54d50783 |
class RectDelta(XY): <NEW_LINE> <INDENT> pass | X/Y rectangle delta data item | 62599052d53ae8145f919937 |
class QIMatch(DataProcessor): <NEW_LINE> <INDENT> def get_train_examples(self, data_dir,fname=None): <NEW_LINE> <INDENT> if fname!=None: <NEW_LINE> <INDENT> return self._create_examples( self._read_tsv(os.path.join(data_dir, fname)), "train") <NEW_LINE> <DEDENT> return self._create_examples( self._read_tsv(os.path.join... | Processor for the CoLA data set (GLUE version). | 6259905271ff763f4b5e8c83 |
class Course(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=50, unique=True, verbose_name='课程名称') <NEW_LINE> price = models.PositiveSmallIntegerField(verbose_name='价格') <NEW_LINE> period = models.PositiveSmallIntegerField(verbose_name='课程周期(月)', default=5) <NEW_LINE> outline = models.TextField(ve... | 课程表 | 62599052a219f33f346c7cda |
class LockedSet: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.inner = set() <NEW_LINE> self.lock = threading.Lock() <NEW_LINE> <DEDENT> def add(self, element): <NEW_LINE> <INDENT> with self.lock: <NEW_LINE> <INDENT> prelength = len(self.inner) <NEW_LINE> self.inner.add(element) <NEW_LINE> return pre... | Wrapper around a set() with a lock and atomic move. | 625990528e7ae83300eea56c |
class qZ(object): <NEW_LINE> <INDENT> def __init__(self, fa_dim): <NEW_LINE> <INDENT> self.fa_dim = fa_dim <NEW_LINE> self.aug_dim = fa_dim + 1 <NEW_LINE> self.prior = None <NEW_LINE> self.set_default_priors() <NEW_LINE> self.mu = None <NEW_LINE> self.cov = None <NEW_LINE> self.prec = None <NEW_LINE> self.expt2 = None ... | z = qZ(data_len, fa_dim) | 6259905224f1403a9268633a |
class OCIObjectStoragePrefixSensor(BaseOCIObjectStorageSensor): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super().__init__(*args, **kwargs) <NEW_LINE> <DEDENT> def poke(self, context): <NEW_LINE> <INDENT> self.log.info('Poking for prefix %s in bucket %s', self.prefix, self.bucket_name... | Prefix sensor for OCI Object Storage | 6259905223849d37ff852599 |
class SwitchView(base_widget): <NEW_LINE> <INDENT> def __init__(self, contr: base_controller, parent: base_widget, idstr: str, attrdct: dict, jsel) -> None: <NEW_LINE> <INDENT> super().__init__(contr, parent, idstr, attrdct, jsel) <NEW_LINE> self.view_lst: T.List[BasicView] = [] <NEW_LINE> self.view_dct: T.Dict[str, Ba... | An html div element that has a list of other div elements.
Only one of these is visible at any one time, one is able to switch
between them.
Note:
this works by setting and removing the hidden HTML5 attribute
of the elements.
This will only work with list elements that support this attribute, such
as div elements.
E.g... | 6259905230c21e258be99cde |
class InvalidJWEKeyType(JWException): <NEW_LINE> <INDENT> def __init__(self, expected, obtained): <NEW_LINE> <INDENT> msg = 'Expected key type %s, got %s' % (expected, obtained) <NEW_LINE> super(InvalidJWEKeyType, self).__init__(msg) | Invalid JWE Key Type.
This exception is raised when the provided JWK Key does not match
the type required by the sepcified algorithm. | 62599052596a89723612901a |
class BatchNormalizationLayer(StemCell): <NEW_LINE> <INDENT> def __init__(self, batch_mean=None, batch_std=None, is_test=0, **kwargs): <NEW_LINE> <INDENT> super(BatchNormalizationLayer, self).__init__(**kwargs) <NEW_LINE> self.batch_mean = batch_mean <NEW_LINE> self.batch_std = batch_std <NEW_LINE> self.set_mode(self.i... | Batch normalization layer
Parameters
----------
.. todo:: | 62599052e64d504609df9e3b |
class ExampleBlock(Block): <NEW_LINE> <INDENT> def __init__(self, parent, idevice): <NEW_LINE> <INDENT> Block.__init__(self, parent, idevice) <NEW_LINE> self.contentElement = TextAreaElement(idevice.content) <NEW_LINE> self.contentElement.height = 250 <NEW_LINE> <DEDENT> def process(self, request): <NEW_LINE> <INDENT> ... | ExampleBlock can render and process ExampleIdevices as XHTML
GenericBlock will replace it..... one day | 62599052097d151d1a2c254c |
class Footer(QWidget): <NEW_LINE> <INDENT> def __init__(self, manager, parent=None): <NEW_LINE> <INDENT> super(Footer, self).__init__(parent=parent) <NEW_LINE> self.__manager = manager <NEW_LINE> self.version = self.__manager.version <NEW_LINE> self.initUI() <NEW_LINE> <DEDENT> def initUI(self): <NEW_LINE> <INDENT> sel... | Footer Class.
Args:
manager (class: "Manager"): The hestia manager.
parent (class: "QtWidgets.QWidget", optional): The parent widget. Defaults to None. | 62599052a8ecb033258726ed |
class EncoderBlock(HybridBlock): <NEW_LINE> <INDENT> def __init__(self, opts, num_unit, num_filters, trans_block=True): <NEW_LINE> <INDENT> super(EncoderBlock, self).__init__() <NEW_LINE> self.eblock = HybridSequential() <NEW_LINE> if trans_block: <NEW_LINE> <INDENT> self.eblock.add(TransitionBlock(opts, num_filters=nu... | Return a block in Encoder | 6259905263b5f9789fe86648 |
class TableWidgetWrapper(WidgetWrapper): <NEW_LINE> <INDENT> def createWidget(self, schema_param=None): <NEW_LINE> <INDENT> self._schema_param = schema_param <NEW_LINE> self._database = None <NEW_LINE> self._schema = None <NEW_LINE> self._combo = QComboBox() <NEW_LINE> self._combo.setEditable(True) <NEW_LINE> self.refr... | WidgetWrapper for ParameterString that create and manage a combobox widget
with existing tables from a parent schema parameter. | 6259905291af0d3eaad3b2ff |
class Guide(guide.ComponentGuide): <NEW_LINE> <INDENT> compType = TYPE <NEW_LINE> compName = NAME <NEW_LINE> description = DESCRIPTION <NEW_LINE> author = AUTHOR <NEW_LINE> url = URL <NEW_LINE> email = EMAIL <NEW_LINE> version = VERSION <NEW_LINE> def postInit(self): <NEW_LINE> <INDENT> self.save_transform = ["root", "... | Component Guide Class | 62599052d99f1b3c44d06b76 |
class DropWorseModels(tf.keras.callbacks.Callback): <NEW_LINE> <INDENT> def __init__(self, model_dir, monitor, log_dir, keep_best=2): <NEW_LINE> <INDENT> super(DropWorseModels, self).__init__() <NEW_LINE> self._model_dir = model_dir <NEW_LINE> self._filename = "model-{:04d}" + SAVE_FORMAT_WITH_SEP <NEW_LINE> self._log_... | Designed around making `save_best_only` work for arbitrary metrics and thresholds between metrics | 625990528da39b475be046c1 |
class IKContentFile(ContentFile): <NEW_LINE> <INDENT> def __init__(self, filename, content, format=None): <NEW_LINE> <INDENT> self.file = ContentFile(content) <NEW_LINE> self.file.name = filename <NEW_LINE> mimetype = getattr(self.file, 'content_type', None) <NEW_LINE> if format and not mimetype: <NEW_LINE> <INDENT> mi... | Wraps a ContentFile in a file-like object with a filename and a
content_type. A PIL image format can be optionally be provided as a content
type hint. | 62599052d7e4931a7ef3d554 |
class member: <NEW_LINE> <INDENT> def __init__(self, func, decorators): <NEW_LINE> <INDENT> self.__name__ = func.__name__ <NEW_LINE> for deco in reversed(decorators): <NEW_LINE> <INDENT> func = deco(func) <NEW_LINE> <DEDENT> self.target = func <NEW_LINE> self.decorators = decorators <NEW_LINE> <DEDENT> def __get__(self... | The result type of the ``@inheritly`` decorator | 6259905221a7993f00c67444 |
class CircleViz(MapViz): <NEW_LINE> <INDENT> def __init__(self, data, label_property=None, color_property=None, color_stops=None, color_default='grey', color_function_type='interpolate', *args, **kwargs): <NEW_LINE> <INDENT> super(CircleViz, self).__init__(data, *args, **kwargs) <NEW_LINE> self.template = 'circle' <NEW... | Create a circle map | 62599052cad5886f8bdc5aec |
class kpoints_class(object): <NEW_LINE> <INDENT> def __init__(self, nk = 1): <NEW_LINE> <INDENT> self.nk = nk <NEW_LINE> self.weight = [2.0 / nk] * nk | store information related to kpoints | 62599052287bf620b62730c6 |
class NameToLabelTests(TestCase): <NEW_LINE> <INDENT> def test_nameToLabel(self): <NEW_LINE> <INDENT> nameData = [ ("f", "F"), ("fo", "Fo"), ("foo", "Foo"), ("fooBar", "Foo Bar"), ("fooBarBaz", "Foo Bar Baz"), ] <NEW_LINE> for inp, out in nameData: <NEW_LINE> <INDENT> got = util.nameToLabel(inp) <NEW_LINE> self.assertE... | Tests for L{nameToLabel}. | 62599052004d5f362081fa57 |
class IntegerLyraType(LyraType): <NEW_LINE> <INDENT> def __repr__(self): <NEW_LINE> <INDENT> return "int" | Integer type representation. | 6259905271ff763f4b5e8c85 |
class SpatialDropout1D(Dropout): <NEW_LINE> <INDENT> @interfaces.legacy_spatialdropout1d_support <NEW_LINE> def __init__(self, rate, **kwargs): <NEW_LINE> <INDENT> super(SpatialDropout1D, self).__init__(rate, **kwargs) <NEW_LINE> self.input_spec = InputSpec(ndim=3) <NEW_LINE> <DEDENT> def _get_noise_shape(self, inputs)... | Spatial 1D version of Dropout.
This version performs the same function as Dropout, however it drops
entire 1D feature maps instead of individual elements. If adjacent frames
within feature maps are strongly correlated (as is normally the case in
early convolution layers) then regular dropout will not regularize the
act... | 6259905207d97122c4218181 |
class HwSupply(HwModule.HwModule): <NEW_LINE> <INDENT> INTR_SWITCHON = 'hw_supply.switchOn' <NEW_LINE> def __init__(self,engine,motehandler): <NEW_LINE> <INDENT> self.engine = engine <NEW_LINE> self.motehandler = motehandler <NEW_LINE> self.moteOn = False <NEW_LINE> HwModule.HwModule.__init__(self,'HwSupp... | rief Emulates the mote's power supply | 6259905207f4c71912bb0910 |
class DefensiveReflexAgent(ReflexCaptureAgent): <NEW_LINE> <INDENT> def choosePowers(self, gameState, powerLimit): <NEW_LINE> <INDENT> validPowers = LEGAL_POWERS[:] <NEW_LINE> powers = util.Counter() <NEW_LINE> opponentPowers = self.getOpponentTeamPowers(gameState) <NEW_LINE> if 'speed' in opponentPowers: <NEW_LINE> <I... | A reflex agent that keeps its side Pacman-free. Again,
this is to give you an idea of what a defensive agent
could be like. It is not the best or only way to make
such an agent. | 6259905216aa5153ce4019c2 |
class Atome(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.nom="" <NEW_LINE> self.symbole="" <NEW_LINE> self.valence=0 <NEW_LINE> self.indice=0 <NEW_LINE> self.etage_ox=[] <NEW_LINE> self.latex=" latex " <NEW_LINE> self.formule=" formule " | Un atome est défini par un nom, un symbole et une valence | 6259905255399d3f056279f6 |
class SelectableConfig(AppConfig): <NEW_LINE> <INDENT> name = 'selectable' <NEW_LINE> def ready(self): <NEW_LINE> <INDENT> from . import registry <NEW_LINE> registry.autodiscover() | App configuration for django-selectable. | 62599052ac7a0e7691f739b8 |
class DictType(Type): <NEW_LINE> <INDENT> def __init__(self, of_key, of_value): <NEW_LINE> <INDENT> super(DictType, self).__init__( qualifiers=of_key.qualifiers.union(of_value.qualifiers), of_key=of_key, of_value=of_value ) <NEW_LINE> <DEDENT> def iscombined(self): <NEW_LINE> <INDENT> return any(of.iscombined() for of ... | Type holding a dict of stuff of the same key and value type
>>> DictType(NamedType('int'), NamedType('float'))
pythonic::types::dict<int,float> | 62599052e5267d203ee6cdc6 |
class PasswordExpiredException(SuiteException): <NEW_LINE> <INDENT> pass | Exception raised when password of logged user is expired. | 6259905273bcbd0ca4bcb767 |
class GroupSerializer(serializers.ModelSerializer): <NEW_LINE> <INDENT> def to_representation(self, instance): <NEW_LINE> <INDENT> ret = super(GroupSerializer, self).to_representation(instance) <NEW_LINE> ret['userCnt'] = instance.user_set.all().count() <NEW_LINE> return ret <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <... | group序列化类 | 62599052009cb60464d02a16 |
class RepoGroupAPI(PulpAPI): <NEW_LINE> <INDENT> PATH = 'v2/repo_groups/' <NEW_LINE> def repo_groups(self): <NEW_LINE> <INDENT> return self.server.GET(self.PATH) <NEW_LINE> <DEDENT> def create(self, id, display_name, description, notes): <NEW_LINE> <INDENT> data = {'id': id, 'display_name': display_name, 'description':... | Connection class to access consumer specific calls | 6259905245492302aabfd9b1 |
class BlogSpider(Spider): <NEW_LINE> <INDENT> start_urls = ['http://www.ruanyifeng.com/blog/archives.html'] <NEW_LINE> request_config = { 'RETRIES': 3, 'DELAY': 0, 'TIMEOUT': 20 } <NEW_LINE> concurrency = 10 <NEW_LINE> async def parse(self, res): <NEW_LINE> <INDENT> items = await MyItem.get_items(html=res.html) <NEW_LI... | 针对博客源 http://www.ruanyifeng.com/blog/archives.html 的爬虫
这里为了模拟ua,引入了一个ruia的第三方扩展
- ruia-ua: https://github.com/howie6879/ruia-ua
- pipenv install ruia-ua
- 此扩展会自动为每一次请求随机添加 User-Agent | 6259905263b5f9789fe8664a |
class Kwarwp(): <NEW_LINE> <INDENT> GLIFOS = { "&": "https://i.imgur.com/dZQ8liT.jpg", "^": "https://imgur.com/8jMuupz.png", ".": "https://i.imgur.com/npb9Oej.png", "_": "https://i.imgur.com/sGoKfvs.jpg", "#": "https://imgur.com/ldI7IbK.png", "@": "https://imgur.com/tLLVjfN.png", "~": "https://i.imgur.com/UAETaiP.gif",... | Arena onde os desafios ocorrem.
:param vitollino: Empacota o engenho de jogo Vitollino.
:param mapa: Um texto representando o mapa do desafio. | 6259905210dbd63aa1c720bc |
class XNDefenseBundle: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.ru = 0 <NEW_LINE> self.ll = 0 <NEW_LINE> self.tl = 0 <NEW_LINE> self.gauss = 0 <NEW_LINE> self.ion = 0 <NEW_LINE> self.plasma = 0 <NEW_LINE> self.small_dome = 0 <NEW_LINE> self.big_dome = 0 <NEW_LINE> self.defender_rocket = 0 <NEW_L... | holds all info about planet's defenses count | 62599052507cdc57c63a627d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.