code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class build_py_binary(_build_py): <NEW_LINE> <INDENT> def find_package_modules(self, package, package_dir): <NEW_LINE> <INDENT> module_files = glob(os.path.join(package_dir, "*.py")) <NEW_LINE> module_files += glob(os.path.join(package_dir, "*.pyc")) <NEW_LINE> setup_script = os.path.abspath(self.distribution.script_n... | Copy .pyc files in addition to .py | 6259901b507cdc57c63a5b7f |
class Fileset: <NEW_LINE> <INDENT> def __init__(self, directory): <NEW_LINE> <INDENT> self.directory = directory <NEW_LINE> self.dates = {} <NEW_LINE> self.weeks = defaultdict(list) <NEW_LINE> self.months = defaultdict(list) <NEW_LINE> self.years = defaultdict(list) <NEW_LINE> if not os.path.isdir(directory): <NEW_LINE... | Read directory of NAME files,
extract subset corresponding to given time period | 6259901b91af0d3eaad3ac00 |
class BaseDataSource(object): <NEW_LINE> <INDENT> def __init__(self, uri, columns): <NEW_LINE> <INDENT> self._pretty_to_raw_columns = columns <NEW_LINE> self._raw_to_pretty_columns = dict(x[::-1] for x in columns.items()) <NEW_LINE> if len(self._pretty_to_raw_columns) != len(self._raw_to_pretty_columns): <NEW_LINE> <IN... | Base DataSource, must extend at least _columns, _row_column_values, and _value | 6259901bd18da76e235b783c |
class TwitterCredential(Credential): <NEW_LINE> <INDENT> id = Column(Integer, ForeignKey('credential.id'), primary_key=True) <NEW_LINE> identifier = Column(BigInteger, nullable=False, unique=True) <NEW_LINE> token = Column(String) <NEW_LINE> token_secret = Column(String) <NEW_LINE> __tablename__ = 'twitter_credential' ... | Information about Twitter User | 6259901b796e427e5384f55d |
class FailedShowsDb(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._query_get_all = 'SELECT path FROM failed_shows' <NEW_LINE> self._query_get = 'SELECT path FROM failed_shows WHERE path=?' <NEW_LINE> self._query_set = 'INSERT INTO failed_shows VALUES (?)' <NEW_LINE> self._query_delete = 'DEL... | Failed shows db. | 6259901b30c21e258be995f2 |
class Interval: <NEW_LINE> <INDENT> def __init__(self, chrom: str, start: int, end: int): <NEW_LINE> <INDENT> self.chrom = chrom <NEW_LINE> assert (start <= end) <NEW_LINE> self.start = start <NEW_LINE> self.end = end <NEW_LINE> <DEDENT> def __eq__(self, other): <NEW_LINE> <INDENT> return (self.chrom == other.chrom) an... | Stores a Genomic interval | 6259901b462c4b4f79dbc7e9 |
class Com(object): <NEW_LINE> <INDENT> def __init__(self, comPort='COM1',baudrate=9600): <NEW_LINE> <INDENT> self.ser = serial.Serial(str(comPort),baudrate) <NEW_LINE> <DEDENT> def connect(self): <NEW_LINE> <INDENT> if not self.ser.is_open: <NEW_LINE> <INDENT> self.ser.open() <NEW_LINE> <DEDENT> return self.ser.is_open... | classdocs | 6259901b287bf620b62729c8 |
class LTLfLast(LTLfFormula): <NEW_LINE> <INDENT> def to_nnf(self) -> LTLfFormula: <NEW_LINE> <INDENT> return LTLfAnd([LTLfWeakNext(LTLfFalse()), LTLfNot(LTLfEnd())]).to_nnf() <NEW_LINE> <DEDENT> def negate(self) -> LTLfFormula: <NEW_LINE> <INDENT> return self.to_nnf().negate() <NEW_LINE> <DEDENT> def find_labels(self) ... | Class for the LTLf Last formula. | 6259901b63f4b57ef0086462 |
class BitbakeController(object): <NEW_LINE> <INDENT> def __init__(self, connection): <NEW_LINE> <INDENT> self.connection = connection <NEW_LINE> <DEDENT> def _runCommand(self, command): <NEW_LINE> <INDENT> result, error = self.connection.connection.runCommand(command) <NEW_LINE> if error: <NEW_LINE> <INDENT> raise Exce... | This is the basic class that controlls a bitbake server.
It is outside the scope of this class on how the server is started and aquired | 6259901bbf627c535bcb2293 |
class UnversionedSigner(UnversionedVerifier): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def Read(location): <NEW_LINE> <INDENT> return UnversionedSigner(readers.FileReader(location)) <NEW_LINE> <DEDENT> def IsAcceptablePurpose(self, purpose): <NEW_LINE> <INDENT> return purpose == keyinfo.SIGN_AND_VERIFY <NEW_LINE> <... | Capable of both signing and verifying. This outputs standard signatures
(i.e. HMAC-SHA1, DSA-SHA1, RSA-SHA1) that contain no key versioning. | 6259901b507cdc57c63a5b85 |
class TestLoopbackContext(unittest.TestCase): <NEW_LINE> <INDENT> def _check_loopback_context_manager(self, cm, guard, items): <NEW_LINE> <INDENT> with cm: <NEW_LINE> <INDENT> self.assertItemsEqual(guard.locked_items, items) <NEW_LINE> for item in items: <NEW_LINE> <INDENT> self.assertIn(item, guard) <NEW_LINE> <DEDENT... | Unit tests that exercise the LoopbackGuard class through
the LoopbackContext context manager. | 6259901b287bf620b62729cc |
class SampleGroup(db.Model): <NEW_LINE> <INDENT> __tablename__ = 'sample_groups' <NEW_LINE> id = db.Column(UUID(as_uuid=True), primary_key=True, server_default=db.text('uuid_generate_v4()')) <NEW_LINE> organization_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organizations.id')) <NEW_LINE> name = db.Column(db.Stri... | MetaGenScope Sample Group model. | 6259901bd18da76e235b7840 |
class TestArchiveBotFunctions(TestCase): <NEW_LINE> <INDENT> net = False <NEW_LINE> def test_str2time(self): <NEW_LINE> <INDENT> date = datetime(2017, 1, 1) <NEW_LINE> self.assertEqual(archivebot.str2time('0d'), timedelta(0)) <NEW_LINE> self.assertEqual(archivebot.str2time('4000s'), timedelta(seconds=4000)) <NEW_LINE> ... | Test functions in archivebot. | 6259901b8c3a8732951f7348 |
class InvalidDependencyError(spack.error.SpecError): <NEW_LINE> <INDENT> def __init__(self, pkg, deps): <NEW_LINE> <INDENT> self.invalid_deps = deps <NEW_LINE> super(InvalidDependencyError, self).__init__( 'Package {0} does not depend on {1}'.format( pkg, spack.util.string.comma_or(deps))) | Raised when a dependency in a spec is not actually a dependency
of the package. | 6259901bd164cc6175821d65 |
class IDCCutInfoSchema(schema.ResponseSchema): <NEW_LINE> <INDENT> fields = { "City": fields.Str(required=False, load_from="City"), "CutType": fields.Str(required=False, load_from="CutType"), "EndTime": fields.Int(required=False, load_from="EndTime"), "IDCName": fields.Str(required=False, load_from="IDCName"), "Provinc... | IDCCutInfo - 机房割接信息 | 6259901bbe8e80087fbbfe5a |
class SMSKingErrorCodeResponse(SMSKingErrorResponse): <NEW_LINE> <INDENT> def __init__(self, url, status_code, response, error_code): <NEW_LINE> <INDENT> super(SMSKingErrorCodeResponse, self).__init__(url, status_code, response) <NEW_LINE> self.error_code = error_code <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <... | 已知錯誤,帶有錯誤代碼 | 6259901b462c4b4f79dbc7f1 |
class UnnamedIntegerParameter(Rule): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Rule.__init__(self, name='unnamed-int', description='Unnamed integer parameter', suggestion='Provide a name for this parameter.') <NEW_LINE> <DEDENT> pattern = re.compile(FUNC_PROT_PATTERN) <NEW_LINE> int_types = 'uint8_t|u... | Provide meaningful names for integer parameters if able.
The majority of function prototypes will suffer from having unnamed integer parameters,
as their meaning might be difficult to derive without.
<br/><br/>
There are exceptions, of course; a good example is a math function such as `max(int, int)`
where adding para... | 6259901b507cdc57c63a5b89 |
class RestMissingParameter(RestDispException404): <NEW_LINE> <INDENT> pass; | Missing parameter. | 6259901b5e10d32532ce3ff9 |
class Segment(Base, PtmBase): <NEW_LINE> <INDENT> __tablename__ = 'segments' <NEW_LINE> plan_id = Column(Integer, ForeignKey('activity_plans.id'), nullable=False) <NEW_LINE> pace_id = Column(Integer, ForeignKey('paces.id'), nullable=False) <NEW_LINE> position = Column(Integer) <NEW_LINE> length = Column(Integer, nullab... | Segment object containing both a Pace and a time in seconds, tied to an
ActivityPlan.
This functions as a join table which maps ActivityPlans, using a doubly
linked list structure to enforce an ordering of Segments in an ActivityPlan. | 6259901bac7a0e7691f732d2 |
class FlickrObject(object): <NEW_LINE> <INDENT> __converters__ = [] <NEW_LINE> __display__ = [] <NEW_LINE> __metaclass__ = FlickrAutoDoc <NEW_LINE> def __init__(self, **params): <NEW_LINE> <INDENT> params["loaded"] = False <NEW_LINE> self._set_properties(**params) <NEW_LINE> <DEDENT> def _set_properties(self, **params)... | Base Object for Flickr API Objects.
Flickr Objects are dynamically created from the
named arguments given to the constructor. | 6259901bd18da76e235b7842 |
class Network: <NEW_LINE> <INDENT> def __init__(self, root_factory=None): <NEW_LINE> <INDENT> self.root = root_factory(self) if root_factory else None <NEW_LINE> <DEDENT> @property <NEW_LINE> def root(self): <NEW_LINE> <INDENT> return self.__root <NEW_LINE> <DEDENT> @root.setter <NEW_LINE> def root(self, value): <NEW_L... | Represents a node network constructed of #NetworkNode objects. Its main
purpose is to contain the root node. When a network is constructed, you
may specifiy a factory function that returns a new #NetworkNode, our you
may bind a root node after the network is constructed.
A network may place constraints on node naming ... | 6259901b5e10d32532ce3ffa |
class Square(Rectangle): <NEW_LINE> <INDENT> def __init__(self, size, x=0, y=0, id=None): <NEW_LINE> <INDENT> super().__init__(size, size, x, y, id) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "[Square] ({}) {}/{} - {}".format( self.id, self.x, self.y, self.width) <NEW_LINE> <DEDENT> @property <NE... | Represents a class called Square that inherits from Rectangle
with a private instance attributes called size, x, y
and id (from Base) | 6259901bbf627c535bcb229b |
class WordsList(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=256) <NEW_LINE> description = models.CharField(max_length=256) <NEW_LINE> owner = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL) <NEW_LINE> public = models.BooleanField(default=False) <NEW_LINE> order = mode... | A list of words. The list is owned by a drawer, if it was created
by one.
Public lists are displayed as a choice for everyone in the server, while
private ones are only for authenticated user who created their own lists. | 6259901b21a7993f00c66d66 |
class ThreeLevelCaseSplitter(BaseSplitter): <NEW_LINE> <INDENT> def __init__(self, data_path, img_to_mask, train_name='train', val_name='val', test_name='test', middle_folder='Image', img_filter=None, cache_path=None, force_cache=False): <NEW_LINE> <INDENT> self.middle_folder = middle_folder <NEW_LINE> super(ThreeLevel... | If the folder has two depth which means the structure is :
Root => train => Image/Mask => cases => imgs
=> dev => Image/Mask => cases => imgs
=> test => Image/Mask => cases => imgs | 6259901b796e427e5384f569 |
class GxKMLSOEPage(CoClass): <NEW_LINE> <INDENT> _reg_clsid_ = GUID('{F2F7A0A5-EBAA-440D-972A-AA0BF7E821BB}') <NEW_LINE> _idlflags_ = [] <NEW_LINE> _typelib_path_ = typelib_path <NEW_LINE> _reg_typelib_ = ('{C0FC1503-7E6F-11D2-AABF-00C04FA375F1}', 10, 2) | KML SOE properties page. | 6259901b8c3a8732951f734c |
class BencodeParser(interface.FileObjectParser): <NEW_LINE> <INDENT> _BENCODE_RE = re.compile(b'd[0-9]') <NEW_LINE> NAME = 'bencode' <NEW_LINE> DATA_FORMAT = 'Bencoded file' <NEW_LINE> _plugin_classes = {} <NEW_LINE> def ParseFileObject(self, parser_mediator, file_object): <NEW_LINE> <INDENT> header_data = file_object.... | Parser for bencoded files. | 6259901bac7a0e7691f732d4 |
class AnimatedDecorator(decorator.Decorator): <NEW_LINE> <INDENT> default_message = 'loading' <NEW_LINE> spinner = SpinnerController() <NEW_LINE> animation = AnimationController() <NEW_LINE> _enabled = True <NEW_LINE> def __init__(self, message=None, fpadding=space_wave): <NEW_LINE> <INDENT> super(AnimatedDecorator, se... | The animated decorator from hell
You can use this these way:
@animated
def slow():
heavy_stuff()
As well with custom messages
@animated('WOOOOW')
def download_the_universe():
while True:
pass
with animated('loool'):
stuff_from_hell() | 6259901bbe8e80087fbbfe5e |
class PickupRequest(request.Request): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def get_url(cls): <NEW_LINE> <INDENT> return "/pickup" <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def get_usages(cls): <NEW_LINE> <INDENT> return [ apidocs.UsageDoc('?boxid=<i>boxid</i>&token=<i>token</i>', 'pick up a dropped box', '?box... | Pick up a dropped box | 6259901bd18da76e235b7843 |
class CheckingAccount(Account): <NEW_LINE> <INDENT> def __init__(self, id, name): <NEW_LINE> <INDENT> super(CheckingAccount, self).__init__(id, name) <NEW_LINE> self.overdrafitlimit = 30000 <NEW_LINE> <DEDENT> def withdraw(self, amount): <NEW_LINE> <INDENT> if amount <= self.balance + self.overdrafitlimit: <NEW_LINE> <... | This is a CheckingAccount derived from Account class. | 6259901b91af0d3eaad3ac10 |
class PointMatcher(object): <NEW_LINE> <INDENT> def __init__(self, patt): <NEW_LINE> <INDENT> self.re_patt = re.compile(r"([^#@]+)(#\d+|@[\d\.:]+)?") <NEW_LINE> self.set_patt(patt) <NEW_LINE> <DEDENT> def set_patt(self, patt): <NEW_LINE> <INDENT> self.patt = None <NEW_LINE> self.path = None <NEW_LINE> self.indextype = ... | System for selecting subsets of bins based on a search range
syntax extended from Professor weight files:
Path structure: /path/parts/to/histo[syst_variation]@xmin:xmax
or: /path/parts/to/histo[syst_variation]#nmin:nmax
TODO: Extend to multi-dimensional ranges i.e. @xmin:xmax,#nymin:nymax,... | 6259901bbf627c535bcb229f |
class Policy(object): <NEW_LINE> <INDENT> __metaclass__ = PolicyType <NEW_LINE> default = False <NEW_LINE> name = None <NEW_LINE> resource = None <NEW_LINE> providers = [] <NEW_LINE> signature = () <NEW_LINE> def __init__(self, resource): <NEW_LINE> <INDENT> self.resource = resource <NEW_LINE> <DEDENT> @classmethod <NE... | A policy is a representation of a resource. A policy requires a
certain argument signature to be present before it can be used. There may
be multiple policies selected for a resource, in which case all argument
signatures must be conformant.
Providers must provide all selected policies to be a valid provider for
the r... | 6259901b796e427e5384f56d |
class ReportedDebugContextBase(DebugContextBase): <NEW_LINE> <INDENT> def report_trigger(self, source_ref, target_ref): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def report_pretrigger(self, source_ref, target_ref): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def report_push... | Base class for connection and trigger listener callbacks | 6259901bd18da76e235b7845 |
class ToolbarGrabar(Gtk.Toolbar): <NEW_LINE> <INDENT> __gtype_name__ = 'ToolbarGrabar' <NEW_LINE> __gsignals__ = { "stop": (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, [])} <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> Gtk.Toolbar.__init__(self) <NEW_LINE> self.modify_bg(0, get_colors("drawingplayer")) <NEW_LINE>... | Informa al usuario cuando se está grabando
desde un streaming. | 6259901b507cdc57c63a5b91 |
class Oauth2RequestAuthorizer(requests.auth.AuthBase): <NEW_LINE> <INDENT> def __init__(self, access_token): <NEW_LINE> <INDENT> self.access_token = access_token <NEW_LINE> <DEDENT> def __call__(self, request): <NEW_LINE> <INDENT> request.headers['Authorization'] = 'Bearer {}'.format( self.access_token) <NEW_LINE> retu... | authorization header for requests
| 6259901b462c4b4f79dbc7f9 |
class CheckQosScripts(rootfs_boot.RootFSBootTest): <NEW_LINE> <INDENT> def runTest(self): <NEW_LINE> <INDENT> board = self.dev.board <NEW_LINE> board.sendline('\nopkg list | grep qos-scripts') <NEW_LINE> try: <NEW_LINE> <INDENT> board.expect('qos-scripts - ', timeout=4) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> r... | Package "qos-scripts" is not installed. | 6259901b5e10d32532ce3ffd |
class WinkBinarySensorDevice(WinkDevice, BinarySensorDevice, Entity): <NEW_LINE> <INDENT> def __init__(self, wink, hass): <NEW_LINE> <INDENT> super().__init__(wink, hass) <NEW_LINE> if hasattr(self.wink, 'unit'): <NEW_LINE> <INDENT> self._unit_of_measurement = self.wink.unit() <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE... | Representation of a Wink binary sensor. | 6259901b5166f23b2e2441c3 |
@admin.register(User) <NEW_LINE> class UserAdmin(DjangoUserAdmin): <NEW_LINE> <INDENT> fieldsets = ( (None, {'fields': ('email', 'password')}), (_('Personal info'), {'fields': ('first_name', 'last_name')}), (_('Permissions'), {'fields': ('is_active', 'is_staff', 'is_superuser', 'groups', 'user_permissions')}), (_('Impo... | Define admin model for custom User model with no username field. | 6259901b30c21e258be99604 |
@public <NEW_LINE> class WampRawSocketServerFactory(WampRawSocketFactory): <NEW_LINE> <INDENT> protocol = WampRawSocketServerProtocol <NEW_LINE> def __init__(self, factory, serializers=None): <NEW_LINE> <INDENT> if callable(factory): <NEW_LINE> <INDENT> self._factory = factory <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDE... | Twisted-based WAMP-over-RawSocket server protocol factory. | 6259901bd18da76e235b7846 |
class MobilePlans(db.Model): <NEW_LINE> <INDENT> __tablename__ = tablename <NEW_LINE> id = db.Column(db.Integer, Sequence('mobileplan_seq'), primary_key=True) <NEW_LINE> name = db.Column(db.String(250)) <NEW_LINE> sms = db.Column(db.String(250)) <NEW_LINE> data = db.Column(db.String(250)) <NEW_LINE> voice = db.Column(d... | docstring for MobilePlans | 6259901bbf627c535bcb22a3 |
class NonNegativeInteger(Integer): <NEW_LINE> <INDENT> errormsg = _('Value must be a non-negative integer, not %r.') <NEW_LINE> def setValue(self, v): <NEW_LINE> <INDENT> if v < 0: <NEW_LINE> <INDENT> self.error(v) <NEW_LINE> <DEDENT> super(NonNegativeInteger, self).setValue(v) | Value must be a non-negative integer. | 6259901b6fece00bbaccc7a8 |
class Number(BuiltinField): <NEW_LINE> <INDENT> @property <NEW_LINE> def _model_type(self): <NEW_LINE> <INDENT> return six.integer_types + (float,) | Combined Integer and Float field | 6259901b287bf620b62729db |
class Application: <NEW_LINE> <INDENT> url = "https://bilibili.com" <NEW_LINE> cookie_file = "cookie.txt" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> cookie = Path(self.cookie_file).read_text().rstrip() <NEW_LINE> uid = dict([ item.split("=") for item in cookie.split("; ") ]).get("DedeUserID") <NEW_LINE> self.__... | Bilibili Client | 6259901b30c21e258be99606 |
class DeploysRequest(Request, Additive): <NEW_LINE> <INDENT> dirname: str = "deploys" <NEW_LINE> endpoint: str = "deployments" <NEW_LINE> def mkdeploy(self, data): <NEW_LINE> <INDENT> deploy = Deploy(data) <NEW_LINE> deploy.statuses_request = StatusRequest(deploy) <NEW_LINE> deploy.commit_request = CommitRequest(deploy... | Class for requesting a list of deployments.
https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#deployments | 6259901b507cdc57c63a5b95 |
class TenantProperties(): <NEW_LINE> <INDENT> def __init__(self, credentials): <NEW_LINE> <INDENT> self.manager = clients.Manager(credentials) <NEW_LINE> self.creds = self.manager.credentials <NEW_LINE> self.network = None <NEW_LINE> self.subnet = None <NEW_LINE> self.router = None <NEW_LINE> self.security_groups = {} ... | helper class to save tenant details
id
credentials
network
subnet
security groups
servers
access point | 6259901b56b00c62f0fb36b2 |
class Scene(namedtuple('Scene', ['scene'])): <NEW_LINE> <INDENT> TYPE ='scene' <NEW_LINE> def __repr____(self): <NEW_LINE> <INDENT> return self.scene | Signfies a new scene
Parameters
----------
act : int
act number | 6259901c21a7993f00c66d72 |
class PKCS5PaddingTestCase(T.TestCase): <NEW_LINE> <INDENT> VECTORS = ( ("", 1, "\x01"), ("abcd", 8, "abcd\x04\x04\x04\x04"), ("abcdefg\x00", 16, "abcdefg\x00\x08\x08\x08\x08\x08\x08\x08\x08"), ) <NEW_LINE> def test_pad(self): <NEW_LINE> <INDENT> for unpadded, bs, padded in self.VECTORS: <NEW_LINE> <INDENT> T.assert_eq... | Test our PKCS#5 padding | 6259901c8c3a8732951f7359 |
class PlatformNotSupported(PlatformError): <NEW_LINE> <INDENT> pass | Base class for the unsupported platform errors. | 6259901cac7a0e7691f732e0 |
class IpFilter(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.Switch = None <NEW_LINE> self.FilterType = None <NEW_LINE> self.Filters = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.Switch = params.get("Switch") <NEW_LINE> self.FilterType = params.ge... | IP黑白名单。
| 6259901c0a366e3fb87dd7ee |
class StravaRedirect(generic.RedirectView): <NEW_LINE> <INDENT> def get_redirect_url(self, approval_prompt="auto", scope="write", *args, **kwargs): <NEW_LINE> <INDENT> from website.apps.stravauth.utils import get_stravauth_url <NEW_LINE> return get_stravauth_url(approval_prompt, scope) | Redirects to the Strava oauth page | 6259901c796e427e5384f577 |
class CGPCholCache(CParamObject): <NEW_LINE> <INDENT> __swig_setmethods__ = {} <NEW_LINE> for _s in [CParamObject]: <NEW_LINE> <INDENT> __swig_setmethods__.update(getattr(_s, '__swig_setmethods__', {})) <NEW_LINE> <DEDENT> __setattr__ = lambda self, name, value: _swig_setattr(self, CGPCholCache, name, value) <NEW_LINE>... | Proxy of C++ limix::CGPCholCache class. | 6259901c30c21e258be9960c |
class NetworkUpdateSelfConnection(NetworkUpdateConnection): <NEW_LINE> <INDENT> def __init__(self, timestamp, newConn, networkId): <NEW_LINE> <INDENT> NetworkUpdateConnection.__init__(self, timestamp, None, newConn, networkId) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "You are now connected to %... | The user have made a new connection | 6259901cd164cc6175821d77 |
class MPBlockConnector(object): <NEW_LINE> <INDENT> def __init__(self, send_array, recv_array, send_ev, recv_ev, conf_ev, remote_conf_ev): <NEW_LINE> <INDENT> self._send_array = send_array <NEW_LINE> self._recv_array = recv_array <NEW_LINE> self._send_ev = send_ev <NEW_LINE> self._recv_ev = recv_ev <NEW_LINE> self._con... | Handles directed data exchange between two blocks using the
multiprocessing module. | 6259901cd18da76e235b784a |
class Queue(BaseQueue): <NEW_LINE> <INDENT> prefix = "entry-" <NEW_LINE> def __init__(self, client, path): <NEW_LINE> <INDENT> super(Queue, self).__init__(client, path) <NEW_LINE> self._children = [] <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return super(Queue, self).__len__() <NEW_LINE> <DEDENT> def g... | A distributed queue with optional priority support.
This queue does not offer reliable consumption. An entry is removed
from the queue prior to being processed. So if an error occurs, the
consumer has to re-queue the item or it will be lost. | 6259901cbf627c535bcb22ab |
class WormHoleFile(OffsetedFile): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> if 'wormhole' in kwargs: <NEW_LINE> <INDENT> self.target, self.source, self.wormlen = kwargs.pop('wormhole') <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self.target, self.source, self.wormlen = [0, 0, 0] <NE... | Redirects an offset-range to another offset in a file. Because
everbody likes wormholes.
I even chose that name before WH were mainsteam (Interstellar) | 6259901c6fece00bbaccc7b0 |
class Boolean(Argument): <NEW_LINE> <INDENT> serializer = serializers.Boolean() <NEW_LINE> def clean(self, instance, value): <NEW_LINE> <INDENT> if isinstance(value, six.string_types): <NEW_LINE> <INDENT> if value.lower() in ("1", "yes", "on", "true"): <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> else: <NEW_LINE... | Represents a boolean. "1", "yes", "on" and "true" are all considered
to be True boolean values. Anything else is False. | 6259901c5166f23b2e2441cd |
class KnownInstrumentOptimizationProblem: <NEW_LINE> <INDENT> def __init__(self, inst_array, start_dt, end_dt): <NEW_LINE> <INDENT> prices = [] <NEW_LINE> for iname in inst_array: <NEW_LINE> <INDENT> i = Instrument.get_instrument(iname) <NEW_LINE> price_i = i.get_bar_collection_timeframe(Period.get_period("H1"), start_... | The KnownInstrumentOptimizationProblem class encapsulates an optimization problem where the
associated financial securities are already known to the system and some price data is
available in the database. | 6259901c9b70327d1c57fb7b |
class DatasetRenderer(DatasetAction): <NEW_LINE> <INDENT> def __init__(self, dest, size=256, room_size=6.05): <NEW_LINE> <INDENT> self.dest = dest <NEW_LINE> self.size = size <NEW_LINE> self.count = 0 <NEW_LINE> self.renderer = TopDownView(size=self.size, length_cap=room_size) <NEW_LINE> data_dir = utils.get_data_root_... | Pre-render top-down view of
each room in the house (floor, walls and objects) | 6259901c796e427e5384f57b |
class Queue(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.__front = None <NEW_LINE> self.__rear = None <NEW_LINE> self.__size = 0 <NEW_LINE> <DEDENT> def enqueue(self, newItem): <NEW_LINE> <INDENT> newNode = Node(newItem,None) <NEW_LINE> if self.isEmpty(): <NEW_LINE> <INDENT> self.__front = ... | Link-based queue implementation. | 6259901ca8ecb0332587201a |
class FlavorError(ValueError): <NEW_LINE> <INDENT> pass | Unsupported or unavailable flavor or flavor conversion.
This exception is raised when an unsupported or unavailable flavor
is given to a dataset, or when a conversion of data between two
given flavors is not supported nor available. | 6259901cbe8e80087fbbfe70 |
class ServerResponse(object): <NEW_LINE> <INDENT> def __init__(self, line): <NEW_LINE> <INDENT> self.code = None <NEW_LINE> self.message = [] <NEW_LINE> self.will_continue=False <NEW_LINE> line = line.split(' ') <NEW_LINE> if len(line) > 0: <NEW_LINE> <INDENT> self.code = line[0] <NEW_LINE> l = self.code.split("-") <NE... | SMTP Server message.
It always begins with a code
(sometimes folowed by a dash(-),
which means server will send another message),
and possibly server's comment. | 6259901c5e10d32532ce4004 |
class MetaBasicParser(type): <NEW_LINE> <INDENT> def __new__(metacls, name, bases, namespace): <NEW_LINE> <INDENT> global _MetaBasicParser <NEW_LINE> cls = type.__new__(metacls, name, bases, namespace) <NEW_LINE> if len(bases) > 1: <NEW_LINE> <INDENT> raise TypeError("%s must inherit from an unique parent," " use Gramm... | Metaclass for all parser. | 6259901c6fece00bbaccc7b4 |
@parser(Specs.swift_proxy_server_conf) <NEW_LINE> class SwiftProxyServerConf(IniConfigFile): <NEW_LINE> <INDENT> pass | This class is to parse the content of the ``/etc/swift/proxy-server.conf``.
The swift proxy - server configuration file
``/etc/swift/proxy-server.conf`` is in the standard 'ini' format and is
read by the :py:class:`insights.core.IniConfigFile` parser class.
Sample configuration file::
[DEFAULT]
bind_port = 8... | 6259901cbf627c535bcb22b1 |
class Paginator(object): <NEW_LINE> <INDENT> def __init__(self, data): <NEW_LINE> <INDENT> self.data = deepcopy(data) <NEW_LINE> self.data_text = 'This text will appear on the page.' <NEW_LINE> self.first_page_number = 1 <NEW_LINE> <DEDENT> def get_data(self, sort_info=None): <NEW_LINE> <INDENT> if not self.data: <NEW_... | Calculates a results set, possibly sorted, and paginated. | 6259901c287bf620b62729e9 |
class Clients(db.Model): <NEW_LINE> <INDENT> __clients__ = "clients" <NEW_LINE> id = db.Column( db.Integer, primary_key=True, autoincrement=True, comment="ID клиента" ) <NEW_LINE> name = db.Column(db.String, nullable=False, comment="Имя клиента") <NEW_LINE> is_vip = db.Column(db.Boolean, nullable=False, comment="Флаг V... | Таблица с клиентами. | 6259901c8c3a8732951f7363 |
class Book(BaseModel): <NEW_LINE> <INDENT> id = models.CharField( max_length=30, primary_key=True, help_text=( "The primary identifier of this title, we get this value " "from publishers." ) ) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return u"Book %s" % self.id <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <I... | Main storage for a Book object. | 6259901cbe8e80087fbbfe74 |
class SpeechProjectsLocationsLogDataStatsListRequest(_messages.Message): <NEW_LINE> <INDENT> parent = _messages.StringField(1, required=True) | A SpeechProjectsLocationsLogDataStatsListRequest object.
Fields:
parent: Required. Resource name of the parent. Has the format :-
"projects/{project_id}/locations/{location_id}" | 6259901c925a0f43d25e8e43 |
class Process(object): <NEW_LINE> <INDENT> def __init__(self, name, exe, args, desc=None, proc_type=None, expand=True, bank_env=None, log_dir=None): <NEW_LINE> <INDENT> if args: <NEW_LINE> <INDENT> for key, value in bank_env.items(): <NEW_LINE> <INDENT> if value is not None: <NEW_LINE> <INDENT> args = args.replace('${'... | Define a process to execute | 6259901c21a7993f00c66d7e |
class Genre(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200, help_text='Enter a book genre(e.g. Science Fiction)') <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.name | Model representing book genre. | 6259901c6fece00bbaccc7b8 |
class Sunward(Vej): <NEW_LINE> <INDENT> def axis(self, init): <NEW_LINE> <INDENT> from .util import mhat <NEW_LINE> if np.iterable(init): <NEW_LINE> <INDENT> r = np.array(list((i.r for i in init))) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> r = init.r <NEW_LINE> <DEDENT> m, hat = mhat(r) <NEW_LINE> i = m == 0 <NEW_L... | Ejection velocity cone centered on the sunward vector.
| 6259901c9b70327d1c57fb83 |
class TestCountDatasets(unittest.TestCase): <NEW_LINE> <INDENT> def test(self): <NEW_LINE> <INDENT> with open("auth/nyc-open-data.json", "r") as f: <NEW_LINE> <INDENT> auth = json.load(f) <NEW_LINE> <DEDENT> result = pysocrata.count_resources(**auth) <NEW_LINE> assert {'dataset', 'href', 'file', 'map'}.issuperset(set(r... | Tests that counting datasets works as expected. This is a networked test against the New York City Open Data
Portal. | 6259901c925a0f43d25e8e45 |
class Topic: <NEW_LINE> <INDENT> def __init__(self, name: str, words: List): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> self.words = words | A topic containing words | 6259901c21a7993f00c66d80 |
class LagrangeInterpolation: <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> def lagrange_polynomial(i, x_points, x): <NEW_LINE> <INDENT> num, dem = 1, 1 <NEW_LINE> for j in range(len(x_points)): <NEW_LINE> <INDENT> if x_points[j] != i: <NEW_LINE> <INDENT> num *= x - x_points[j] <NEW_LINE> dem *= (i-x_points[j]) <NEW_LINE... | Class that brings statics methods for works that should be done without
taking creating the same objects as Encryption needs | 6259901c507cdc57c63a5ba7 |
class PartName(Enum): <NEW_LINE> <INDENT> VALUES = ( "night", "morning", "day", "evening", ) | Название времени суток. Возможные значения: | 6259901cbf627c535bcb22b7 |
class LogCaptureTests(TestCase): <NEW_LINE> <INDENT> log = Logger() <NEW_LINE> def test_capture(self): <NEW_LINE> <INDENT> foo = object() <NEW_LINE> with capturedLogs() as captured: <NEW_LINE> <INDENT> self.log.debug("Capture this, please", foo=foo) <NEW_LINE> self.log.info("Capture this too, please", foo=foo) <NEW_LIN... | Tests for L{LogCaptureTests}. | 6259901c925a0f43d25e8e47 |
class AreAllWellFormatted(object): <NEW_LINE> <INDENT> def match(self, actual): <NEW_LINE> <INDENT> for key, value in actual.iteritems(): <NEW_LINE> <INDENT> if key == 'content-length' and not value.isdigit(): <NEW_LINE> <INDENT> return InvalidFormat(key, value) <NEW_LINE> <DEDENT> elif key == 'x-timestamp' and not re.... | Specific matcher to check the correctness of formats of values of Swift's
response headers
This matcher checks the format of values of response headers.
When checking the format of values of 'specific' headers such as
X-Account-Meta-* or X-Object-Manifest for example, those values must be
checked in each test code. | 6259901cac7a0e7691f732ef |
class PluginMixin(APIMixin): <NEW_LINE> <INDENT> pass | Used to bridge between a Core API and a Plugin, via Python's awesome support for multi-inheritance. | 6259901c5166f23b2e2441d9 |
class HelloWorldTest(unittest.TestCase): <NEW_LINE> <INDENT> def test_hello_world(self): <NEW_LINE> <INDENT> self.assertEqual("Hello World!", solutions.hello_world.hello_world()) | Example test suite | 6259901ca8ecb03325872026 |
class Message(object): <NEW_LINE> <INDENT> def __init__( self, address_from: Address, address_to: Address ): <NEW_LINE> <INDENT> super(Message, self).__init__() <NEW_LINE> self._address_from = address_from <NEW_LINE> self._address_to = address_to <NEW_LINE> <DEDENT> @property <NEW_LINE> def address_from(self) -> Addres... | Сообщение, передающееся по сети. | 6259901c507cdc57c63a5bab |
class OryxTransientZip(object): <NEW_LINE> <INDENT> def __init__(self, zfilename): <NEW_LINE> <INDENT> self.zipcreated = '' <NEW_LINE> if os.path.exists(zfilename): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> elif os.path.exists(zfilename[:-4]): <NEW_LINE> <INDENT> zfile = ZipFile(zfilename, 'w') <NEW_LINE> for filena... | Utils to extract data from oryx zip files
Waveforms can be stored in either a zip file with the same name as
the .tsr file, or it can be stored in a subfolder with the same name
as the .tsr file.
Note: Oryx deprecated saving as zip | 6259901cd18da76e235b7852 |
class PacketPokerPlayerArrive(PacketPokerPlayerInfo): <NEW_LINE> <INDENT> info = PacketPokerPlayerInfo.info + ( ('blind', 'late', 'bs'), ('remove_next_turn', False, 'bool'), ('sit_out', True, 'bool'), ('sit_out_next_turn', False, 'bool'), ('auto', False, 'bool'), ('auto_blind_ante', False, 'bool'), ('wait_for', False, ... | Semantics: the player "serial" is seated at the game "game_id".
Descriptive information for the player such as "name" and "outfit"
is provided.
Direction: server => client
Context: this packet is the server answer to successfull
:class:`PACKET_POKER_SEAT <pokerpackets.networkpackets.PacketPokerSeat>` request. The a... | 6259901c91af0d3eaad3ac2c |
class ValidationError(Exception): <NEW_LINE> <INDENT> pass | Something is generally not valid | 6259901cac7a0e7691f732f3 |
class ImageSource(metaclass=abc.ABCMeta): <NEW_LINE> <INDENT> def __enter__(self): <NEW_LINE> <INDENT> self.begin() <NEW_LINE> <DEDENT> def __exit__(self, exc_type, exc_val, exc_tb): <NEW_LINE> <INDENT> self.shutdown() <NEW_LINE> <DEDENT> @property <NEW_LINE> @abc.abstractmethod <NEW_LINE> def sequence_type(self): <NEW... | An abstract class representing a place to get images from.
This generalizes datasets from previous versions,
and simulators, the big addition of this iteration.
The new usage structure for image sources is the with statement, i.e.:
```
with image_source:
while not image_source.is_complete():
image, timesta... | 6259901c0a366e3fb87dd802 |
class ObjectExtractionApplet(StandardApplet): <NEW_LINE> <INDENT> def __init__(self, name="Object Extraction", workflow=None, projectFileGroupName="ObjectExtraction", interactive=True): <NEW_LINE> <INDENT> super(ObjectExtractionApplet, self).__init__(name=name, workflow=workflow) <NEW_LINE> self._serializableItems = [ ... | Calculates object features for each object in an image.
Features are provided by plugins, which are responsible for
performing the actual computation. | 6259901c796e427e5384f58b |
class ShapeDetector: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def detect(self, c): <NEW_LINE> <INDENT> shape = 'unidentified' <NEW_LINE> peri = cv2.arcLength(c, True) <NEW_LINE> approx = cv2.approxPolyDP(c, 0.03 * peri, True) <NEW_LINE> if len(approx) <= 6: <NEW_LINE> <INDENT... | Takes a shape/contourgroup and returns the nearest shape based on rules set in this class. | 6259901cbe8e80087fbbfe81 |
class EntryDetailView(FormMixin, DetailView): <NEW_LINE> <INDENT> model = Entry <NEW_LINE> template_name = 'entradas/ver.html' <NEW_LINE> form_class = ComentaryForm <NEW_LINE> success_url = '.' <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> qs = super(EntryDetailView, self).get_queryset().filter(anulate=False) ... | vista para ver una entrada | 6259901c287bf620b62729f7 |
class ParseError(EntropyException): <NEW_LINE> <INDENT> pass | Parse error. | 6259901c8c3a8732951f7371 |
class ConfigSection(Config): <NEW_LINE> <INDENT> def __init__(self, key=_ANONYMOUS, members=None, **kwargs): <NEW_LINE> <INDENT> super(ConfigSection, self).__init__(key, default={}, **kwargs) <NEW_LINE> self.members = members or {} <NEW_LINE> for member in members.values(): <NEW_LINE> <INDENT> assert member.key is not ... | A section of configuration variables whose names are known
a priori. For example, this can be used to group configuration
for a cluster. | 6259901c91af0d3eaad3ac32 |
class use_cut: <NEW_LINE> <INDENT> force = _internal._constants.CPX_USECUT_FORCE <NEW_LINE> purge = _internal._constants.CPX_USECUT_PURGE <NEW_LINE> filter = _internal._constants.CPX_USECUT_FILTER | Constants to specify when to use the added cut. | 6259901cbf627c535bcb22c1 |
class Member(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=200) <NEW_LINE> catagory = models.ForeignKey(Catagory) <NEW_LINE> gender = models.CharField(choices=GENDER_CHOICES, max_length=50) <NEW_LINE> description = models.TextField() <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return s... | This models stores information about member and to which | 6259901cac7a0e7691f732f9 |
class DiceLoss(nn.Module): <NEW_LINE> <INDENT> def __init__(self, background=False): <NEW_LINE> <INDENT> super(DiceLoss, self).__init__() <NEW_LINE> self.SMOOTH = 0.0001 <NEW_LINE> self.background = background <NEW_LINE> <DEDENT> def forward (self, pred, gt): <NEW_LINE> <INDENT> nclasses = gt.size()[1] <NEW_LINE> if (s... | Dice Loss (Ignore background - channel 0)
Arguments:
@param prediction: tensor with predictions classes
@param groundtruth: tensor with ground truth mask | 6259901c287bf620b62729f9 |
class IGuestProcess(IProcess): <NEW_LINE> <INDENT> __uuid__ = 'dfa39a36-5d43-4840-a025-67ea956b3111' <NEW_LINE> __wsmap__ = 'managed' | Implementation of the :py:class:`IProcess` object
for processes on the guest. | 6259901c30c21e258be99624 |
class Value(): <NEW_LINE> <INDENT> def __init__(self, value): <NEW_LINE> <INDENT> self.possible_values = [] <NEW_LINE> self.value = int(value) <NEW_LINE> <DEDENT> def remove_value(self, value): <NEW_LINE> <INDENT> if int(value) in self.possible_values: <NEW_LINE> <INDENT> self.possible_values.remove(int(value)) <NEW_LI... | A Value in a square
Stores its value, possible values location,
and whether it has been propagted or not | 6259901c91af0d3eaad3ac35 |
class CreateHeartbeatPayloadOwnerTeam(object): <NEW_LINE> <INDENT> swagger_types = { 'name': 'str', 'id': 'str' } <NEW_LINE> attribute_map = { 'name': 'name', 'id': 'id' } <NEW_LINE> def __init__(self, name=None, id=None): <NEW_LINE> <INDENT> self._name = None <NEW_LINE> self._id = None <NEW_LINE> self.discriminator = ... | NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually. | 6259901c21a7993f00c66d90 |
class UpdateHandler(InboundMailHandler): <NEW_LINE> <INDENT> with open('config.yaml', 'r') as f: <NEW_LINE> <INDENT> doc = yaml.load(f); <NEW_LINE> <DEDENT> appname = doc["appname"] <NEW_LINE> @classmethod <NEW_LINE> def get_update(cls, body): <NEW_LINE> <INDENT> def _cleaner(s, break_list): <NEW_LINE> <INDENT> clean_t... | Handler for incoming update emails from subscribers. | 6259901c56b00c62f0fb36d2 |
class SocketEndpoint(Model): <NEW_LINE> <INDENT> name = fields.StringField(max_length=64, primary_key=True) <NEW_LINE> allowed_methods = fields.JSONField() <NEW_LINE> links = fields.LinksField() <NEW_LINE> class Meta: <NEW_LINE> <INDENT> parent = CustomSocket <NEW_LINE> endpoints = { 'detail': { 'methods': ['get'], 'pa... | OO wrapper around endpoints defined in CustomSocket instance.
Look at the custom socket documentation for more details.
:ivar name: :class:`~syncano.models.fields.StringField`
:ivar calls: :class:`~syncano.models.fields.JSONField`
:ivar links: :class:`~syncano.models.fields.LinksField` | 6259901c30c21e258be99627 |
class AvatarHash(Row): <NEW_LINE> <INDENT> _TABLE_ = 'avatar_hash' <NEW_LINE> _PRIMARY_KEYS_ = ['hash_id'] <NEW_LINE> _COLUMNS_ = [ 'hash_id', 'hashalgo', 'hashdata' ] <NEW_LINE> @property <NEW_LINE> def hashstr(self): <NEW_LINE> <INDENT> return base64.a85encode(self.hashdata) <NEW_LINE> <DEDENT> def __r... | A hash of users' avatars and their scores. | 6259901dac7a0e7691f732ff |
class TestCreate(BaseGroup): <NEW_LINE> <INDENT> def test_create(self): <NEW_LINE> <INDENT> grp = self.f.create_group('foo') <NEW_LINE> self.assertIsInstance(grp, Group) <NEW_LINE> <DEDENT> def test_create_intermediate(self): <NEW_LINE> <INDENT> grp = self.f.create_group('foo/bar/baz') <NEW_LINE> self.assertEqual(grp.n... | Feature: New groups can be created via .create_group method | 6259901d56b00c62f0fb36d4 |
class DescribeMaliciousRequestsResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TotalCount = None <NEW_LINE> self.MaliciousRequests = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> self.TotalCount = params.get("Total... | DescribeMaliciousRequests返回参数结构体
| 6259901dd164cc6175821d96 |
class ServerAction(models.Model): <NEW_LINE> <INDENT> pass | TODO: Track server actions like timing out players after a given length of inactivity | 6259901d5e10d32532ce4011 |
class RecipeRetrieveSerializer(BaseRecipeSerializer): <NEW_LINE> <INDENT> categories = CategorySerializer(many=True, read_only=True) <NEW_LINE> tags = TagSerializer(many=True, read_only=True) <NEW_LINE> class Meta(BaseRecipeSerializer.Meta): <NEW_LINE> <INDENT> fields = BaseRecipeSerializer.Meta.fields + ( 'comments_co... | This serializer is used to retrieve Recipe instance. | 6259901d91af0d3eaad3ac3b |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.