code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class User(BASE): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> __tablename__ = 'Users' <NEW_LINE> identifier = Column('user_id', Integer, primary_key=True) <NEW_LINE> username = Column('username', String) <NEW_LINE> password = Column('password', String) <NEW_LINE> privileged = Co... | This is a container class for the USERS table. | 62598fb510dbd63aa1c70c87 |
class Die: <NEW_LINE> <INDENT> def __init__(self, num_sides=6): <NEW_LINE> <INDENT> self.num_sides = num_sides <NEW_LINE> <DEDENT> def roll(self): <NEW_LINE> <INDENT> return randint(1, self.num_sides) | A class representing a single die. | 62598fb53d592f4c4edbaf92 |
class Opportunities(object): <NEW_LINE> <INDENT> def __init__(self, client): <NEW_LINE> <INDENT> self.client = client <NEW_LINE> <DEDENT> def query(self, **kwargs): <NEW_LINE> <INDENT> response = self._get(path='/do/query', params=kwargs) <NEW_LINE> result = response.get('result') <NEW_LINE> if result['total_results'] ... | A class to query and use Pardot opportunities.
Opportunity field reference: http://developer.pardot.com/kb/api-version-3/object-field-references/#opportunity | 62598fb591f36d47f2230f11 |
class LegacyTestBodhiOverrideUntagged(Base): <NEW_LINE> <INDENT> expected_title = "bodhi.buildroot_override.untag" <NEW_LINE> expected_subti = "lmacken expired a buildroot override for fedmsg-1.0-1" <NEW_LINE> expected_link = "https://bodhi.fedoraproject.org/overrides/fedmsg-1.0-1" <NEW_LINE> expected_icon = "https://a... | The `Bodhi Updates System <https://bodhi.fedoraproject.org>`_
publishes messages on this topic whenever a user explicitly removes a
previously requested buildroot override. | 62598fb50fa83653e46f4fb1 |
class Request(object): <NEW_LINE> <INDENT> def __init__(self, params=None): <NEW_LINE> <INDENT> Logger.logDebug(params) <NEW_LINE> self.set_action_id('__start__') <NEW_LINE> if params is None: <NEW_LINE> <INDENT> self.set_params({}) <NEW_LINE> <DEDENT> elif type(params) is str: <NEW_LINE> <INDENT> self.set_params(HttpU... | classdocs | 62598fb5a05bb46b3848a93d |
class InitializeUserForm(forms.Form): <NEW_LINE> <INDENT> nickname = forms.CharField(widget=forms.TextInput(attrs={'size': 25})) <NEW_LINE> email = forms.EmailField() <NEW_LINE> is_group = forms.BooleanField(required=False) | For adding a user account and regrecord for a person before they have
actually filled out any form or given any info. Designed for pre-reg'ing
conference lists and the like. (Made for openSF in 2012) | 62598fb54428ac0f6e6585f3 |
class AccountAdmin(admin.ModelAdmin): <NEW_LINE> <INDENT> list_display = ('user', 'email', 'first_name', 'last_name') <NEW_LINE> search_fields = ('user', 'email', 'first_name', 'last_name') <NEW_LINE> def formfield_for_dbfield(self, db_field, **kwargs): <NEW_LINE> <INDENT> formfield = ( super(AccountAdmin, self) .formf... | Admin class for Account model | 62598fb5cc0a2c111447b0e5 |
class CompoundSeqExpression(object): <NEW_LINE> <INDENT> def __init__(self, exprseq_list): <NEW_LINE> <INDENT> self.exprseq_list = exprseq_list <NEW_LINE> <DEDENT> def __iter__(self): <NEW_LINE> <INDENT> return iter(self.exprseq_list) <NEW_LINE> <DEDENT> def __getitem__(self, idx): <NEW_LINE> <INDENT> return self.exprs... | A class that represent a list of Expression Sequence. | 62598fb556ac1b37e63022bd |
class MultipleInstancesException(Exception): <NEW_LINE> <INDENT> pass | Exception for multiple possible instances found in pdf. | 62598fb5a8370b77170f04b0 |
class LoginTransaction_Node(transactions.LoginTransaction, AbstractNodeTransaction): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> State = LoginTransactionState_Node <NEW_LINE> @unpauses_incoming <NEW_LINE> def on_begin(self): <NEW_LINE> <INDENT> assert isinstance(self.message.username, str), repr(self.me... | LOGIN transaction on the Node. | 62598fb597e22403b383afd8 |
class FormsAdminUserPermission(BasePermission): <NEW_LINE> <INDENT> def has_permission(self, request, view): <NEW_LINE> <INDENT> return AdminUser.objects.filter( user_id=request.user ).exists() | Allow requests for logged-in admin users | 62598fb58a43f66fc4bf224d |
class AddressesUUIDTemplate(xmlutil.TemplateBuilder): <NEW_LINE> <INDENT> def construct(self): <NEW_LINE> <INDENT> root = xmlutil.TemplateElement('addresses', selector='addresses') <NEW_LINE> elem = xmlutil.SubTemplateElement(root, 'network', selector=xmlutil.get_items) <NEW_LINE> make_network(elem) <NEW_LINE> return x... | Not currently used -JLH. | 62598fb55166f23b2e2434ae |
@attr.s(auto_attribs=True, slots=True, frozen=True) <NEW_LINE> class Server: <NEW_LINE> <INDENT> host: bytes <NEW_LINE> port: int <NEW_LINE> priority: int = 0 <NEW_LINE> weight: int = 0 <NEW_LINE> expires: int = 0 | Our record of an individual server which can be tried to reach a destination.
Attributes:
host: target hostname
port:
priority:
weight:
expires: when the cache should expire this record - in *seconds* since
the epoch | 62598fb5283ffb24f3cf3960 |
class TestRepr(BaseDataset): <NEW_LINE> <INDENT> def test_repr_open(self): <NEW_LINE> <INDENT> ds = self.f.create_dataset('foo', (4,)) <NEW_LINE> self.assertIsInstance(repr(ds), basestring) <NEW_LINE> self.f.close() <NEW_LINE> self.assertIsInstance(repr(ds), basestring) | Feature: repr(Dataset) behaves sensibly | 62598fb5fff4ab517ebcd8b9 |
class EEAgentClient(object): <NEW_LINE> <INDENT> def __init__(self, dashi): <NEW_LINE> <INDENT> self.dashi = dashi <NEW_LINE> <DEDENT> def launch_process(self, eeagent, upid, round, run_type, parameters): <NEW_LINE> <INDENT> self.dashi.fire(eeagent, "launch_process", u_pid=upid, round=round, run_type=run_type, paramete... | Client that uses ION to send messages to EEAgents
| 62598fb5167d2b6e312b7046 |
class PkgConfig(PackagerBase): <NEW_LINE> <INDENT> name = 'pkgconfig' <NEW_LINE> pkgtype = 'pkgconfig' <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> PackagerBase.__init__(self) <NEW_LINE> <DEDENT> def supported(self): <NEW_LINE> <INDENT> return sysutils.which('pkg-config') is not None <NEW_LINE> <DEDENT> def _pack... | Uses pkg-config. Can't really install stuff, but is useful for
finding out if something is already installed. | 62598fb560cbc95b06364418 |
class DeleteTest(unittest.TestCase): <NEW_LINE> <INDENT> loaded_db = 0 <NEW_LINE> def setUp(self): <NEW_LINE> <INDENT> load_database("GenBank/cor6_6.gb") <NEW_LINE> self.server = BioSeqDatabase.open_database(driver=DBDRIVER, user=DBUSER, passwd=DBPASSWD, host=DBHOST, db=TESTDB) <NEW_LINE> self.db = self.server["biosql-... | Test proper deletion of entries from a database. | 62598fb599cbb53fe6830fa9 |
class BackProjection: <NEW_LINE> <INDENT> def __init__(self, R, Radj, image_size: tuple): <NEW_LINE> <INDENT> def Rfun(x: torch.Tensor) -> torch.Tensor: <NEW_LINE> <INDENT> x_np = x.detach().cpu().numpy() <NEW_LINE> y_np = R(x_np) <NEW_LINE> return x.new(y_np) <NEW_LINE> <DEDENT> def Radjfun(y: torch.Tensor) -> torch.T... | Backprojection class to use with torch. Runs on CPU. | 62598fb57047854f4633f4af |
class RSAVerifier(base.Verifier): <NEW_LINE> <INDENT> def __init__(self, public_key): <NEW_LINE> <INDENT> self._pubkey = public_key <NEW_LINE> <DEDENT> @_helpers.copy_docstring(base.Verifier) <NEW_LINE> def verify(self, message, signature): <NEW_LINE> <INDENT> message = _helpers.to_bytes(message) <NEW_LINE> try: <NEW_L... | Verifies RSA cryptographic signatures using public keys.
Args:
public_key (
cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey):
The public key used to verify signatures. | 62598fb5379a373c97d990e9 |
class CreateCustomerView(Frame): <NEW_LINE> <INDENT> def __init__(self, master, controller): <NEW_LINE> <INDENT> Frame.__init__(self,master) <NEW_LINE> self.master = master <NEW_LINE> self.controller = controller <NEW_LINE> self.entries = [] <NEW_LINE> self.initialize_ui() <NEW_LINE> <DEDENT> def initialize_ui(self): <... | View to enter customer information | 62598fb57d847024c075c491 |
class ConfigurationSetup(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> sys_config = os.path.join('/etc', APPNAME, '%s.conf' % APPNAME) <NEW_LINE> user_config = os.path.join(HOME, '.%s.conf' % APPNAME) <NEW_LINE> if os.path.exists(user_config): <NEW_LINE> <INDENT> self.config_file = user_config <N... | Parse arguments from a Configuration file.
Note that anything can be set as a 'Section' in the argument file. | 62598fb5dc8b845886d5368b |
class Transaction(models.Model): <NEW_LINE> <INDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = 'Transaction' <NEW_LINE> verbose_name_plural = 'Transactions' <NEW_LINE> <DEDENT> ACTION_TYPE_CREATED = 'CREATED' <NEW_LINE> ACTION_TYPE_DEPOSITED = 'DEPOSITED' <NEW_LINE> ACTION_TYPE_WITHDRAWN = 'WITHDRAWN' <NEW_LINE> A... | This deals with money operations. deposits, extractions, loans and transferences | 62598fb5e5267d203ee6b9d2 |
class TransactionHandler(Handler): <NEW_LINE> <INDENT> SUPPORTED_PROTOCOL = TransactionMessage.protocol_id <NEW_LINE> def setup(self) -> None: <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def handle(self, message: Message) -> None: <NEW_LINE> <INDENT> tx_message = cast(TransactionMessage, message) <NEW_LINE> if ( tx_me... | This class implements the transaction handler. | 62598fb5b7558d5895463701 |
class TestNotificationThread(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 testNotificationThread(self): <NEW_LINE> <INDENT> pass | NotificationThread unit test stubs | 62598fb55fdd1c0f98e5e062 |
class ExtendedAffineWeylGroupW0P(GroupSemidirectProduct, BindableClass): <NEW_LINE> <INDENT> def __init__(self, E): <NEW_LINE> <INDENT> def twist(w,l): <NEW_LINE> <INDENT> return E.exp_lattice()(w.action(l.value)) <NEW_LINE> <DEDENT> GroupSemidirectProduct.__init__(self, E.classical_weyl(), E.exp_lattice(), twist=twist... | Extended affine Weyl group, realized as the semidirect product of the finite Weyl group
by the translation lattice.
INPUT:
- `E` -- A parent with realization in :class:`ExtendedAffineWeylGroup_Class`
EXAMPLES::
sage: ExtendedAffineWeylGroup(['A',2,1]).W0P()
Extended affine Weyl group of type ['A', 2, 1] rea... | 62598fb5498bea3a75a57bf5 |
@_TFVolume.register("bessel-approx") <NEW_LINE> class TFBesselApproxVolume(_TFVolume): <NEW_LINE> <INDENT> def __init__( self, log_scale: bool = True, volume_temperature: float = 1.0, intersection_temperature: float = 1.0, ) -> None: <NEW_LINE> <INDENT> super().__init__(log_scale) <NEW_LINE> self.volume_temperature = v... | Uses the Softplus as an approximation of
Bessel function. | 62598fb54a966d76dd5eefac |
class UserModelTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> User.query.delete() <NEW_LINE> Message.query.delete() <NEW_LINE> FollowersFollowee.query.delete() <NEW_LINE> self.u1 = User( id=1000, email="test@test.com", username="testuser", password=HASHED_PASSWORD ) <NEW_LINE> db.session.a... | Test views for messages. | 62598fb5796e427e5384e869 |
class TdExtractDebugData: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.data = [{ 'name': None, 'result': None, 'regions': [{ 'points': [], 'box': [], 'flt_params': {} }] }] <NEW_LINE> self.enable = False <NEW_LINE> <DEDENT> def setEnable(self, flag): <NEW_LINE> <INDENT> self.enable = bool(flag) <NEW... | Debug数据
| 62598fb567a9b606de5460a4 |
class Response(): <NEW_LINE> <INDENT> def __init__(self, pdf_document=None, status=False, error_message=""): <NEW_LINE> <INDENT> self.pdf_document = pdf_document <NEW_LINE> self.status = status <NEW_LINE> self.error_message = error_message <NEW_LINE> self.current_date = datetime.today() <NEW_LINE> <DEDENT> def... | The object to be returned in the api. It contains the request status and the pdf document.
Args:
pdf_document (list, optional): the bytes list of the downloaded document. Defaults to None.
status (bool, optional): true if the capture was correct. Defaults to False.
error_message (str, optional): if there's... | 62598fb54f6381625f19952b |
class Server(object): <NEW_LINE> <INDENT> def __init__(self, settings, logger): <NEW_LINE> <INDENT> self.settings = settings <NEW_LINE> self.logger = logger <NEW_LINE> handlers = [ (r'/', _get_handler(settings, logger)) ] <NEW_LINE> self.app = web.Application( handlers, autoreload=settings.DEBUG, debug=settings.DEBUG )... | Main manager for the server application | 62598fb5a17c0f6771d5c30b |
class StorageBase(object): <NEW_LINE> <INDENT> def __init__(self, node=None): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def start(self, iface='', network='', bootstrap=[], cb=None): <NEW_LINE> <INDENT> raise NotImplementedError() <NEW_LINE> <DEDENT> def set(self, key, value, cb=None): <NEW_LINE> <INDENT> raise NotIm... | Base class for implementing storage plugins.
All functions in this class should be async and never block
All functions takes a callback parameter:
cb: The callback function/object thats callaed when request is done
The callback is as follows:
start/stop:
status: True or False
set:
key: Th... | 62598fb510dbd63aa1c70c8c |
class _RecurrentARHMMMixin(_InputARHMMMixin): <NEW_LINE> <INDENT> def add_data(self, data, covariates=None, strided=False, **kwargs): <NEW_LINE> <INDENT> T = data.shape[0] <NEW_LINE> if covariates is None: <NEW_LINE> <INDENT> covariates = np.zeros((T, 0)) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> assert covariates.... | In the "recurrent" version, the data also serve as covariates. | 62598fb58e7ae83300ee9175 |
class MFEuclideanRandomOptimiser(RandomOptimiser): <NEW_LINE> <INDENT> def __init__(self, func_caller, worker_manager, call_fidel_to_opt_prob=0.25, *args, **kwargs): <NEW_LINE> <INDENT> super(MFEuclideanRandomOptimiser, self).__init__(func_caller, worker_manager, *args, **kwargs) <NEW_LINE> self.call_fidel_to_opt_prob ... | A class which optimises in Euclidean spaces using random evaluations and
multi-fidelity. | 62598fb5ec188e330fdf8966 |
class Resize2(object): <NEW_LINE> <INDENT> def __init__(self,size,interpolation=Image.BILINEAR): <NEW_LINE> <INDENT> assert isinstance(size, int) or (isinstance(size, Iterable) and len(size) == 2) <NEW_LINE> self.size = size <NEW_LINE> self.interpolation = interpolation <NEW_LINE> <DEDENT> def __call__(self, img, mask)... | Resize the input PIL Image to the given size.
Args:
size (sequence or int): Desired output size. If size is a sequence like
(h, w), output size will be matched to this. If size is an int,
smaller edge of the image will be matched to this number.
i.e, if height > width, then image will be re... | 62598fb5be383301e02538d1 |
class IDataPointGraphPointInfo(IColorGraphPointInfo): <NEW_LINE> <INDENT> lineType = schema.Choice(title=_t('Line Type'), vocabulary='complexGraphLineType', order=5) <NEW_LINE> lineWidth = schema.TextLine(title=_t('Line Width'), order=6) <NEW_LINE> stacked = schema.Bool(title=_t('Stacked'), order=7) <NEW_LINE> skipCalc... | Adapts DataPoint GraphPoint. | 62598fb555399d3f056265ea |
@register_criterion("sequence_nll") <NEW_LINE> class SequenceNegativeLoglikelihoodCriterion(BaseSequenceLossCriterion): <NEW_LINE> <INDENT> def forward(self, model, sample, reduce=True): <NEW_LINE> <INDENT> translations, bleu_scores = self.generate_translations(model, sample) <NEW_LINE> nll_loss = self.compute_nll(mode... | SeqNLL loss from https://arxiv.org/pdf/1711.04956.pdf. | 62598fb55fcc89381b2661b7 |
class JobBookingBarDelegate(AbstractDelegate): <NEW_LINE> <INDENT> def __init__(self, parent, *args): <NEW_LINE> <INDENT> AbstractDelegate.__init__(self, parent, *args) <NEW_LINE> <DEDENT> def paint(self, painter, option, index): <NEW_LINE> <INDENT> if index.data(QtCore.Qt.UserRole) == cuegui.Constants.TYPE_JOB and ... | Delegate for the job booking bar. | 62598fb5a8370b77170f04b3 |
class HelpOperation(Operation): <NEW_LINE> <INDENT> def __init__(self,args=[]): <NEW_LINE> <INDENT> Operation.__init__(self, args) <NEW_LINE> self.lista=["help","find","describe","config","getconfig","delconfig","wget","selectrow","download","open","log"] <NEW_LINE> <DEDENT> def run(self,q=Query()): <NEW_LINE> <INDENT>... | Help operation class | 62598fb563b5f9789fe85242 |
class Scope(Enum): <NEW_LINE> <INDENT> Base = auto() <NEW_LINE> OneLevel = auto() <NEW_LINE> SubTree = auto() | LDAP search scope enumeration | 62598fb5236d856c2adc94aa |
class WindowsSha256File(FactBase): <NEW_LINE> <INDENT> shell_executable = 'ps' <NEW_LINE> def command(self, name): <NEW_LINE> <INDENT> return ( 'if (Test-Path "{0}") {{ ' '(Get-FileHash -Algorithm SHA256 "{0}").hash' ' }}' ).format(name) <NEW_LINE> <DEDENT> def process(self, output): <NEW_LINE> <INDENT> return output[0... | Returns a SHA256 hash of a file. | 62598fb521bff66bcd722d3f |
class GwElementManagerButton(GwAction): <NEW_LINE> <INDENT> def __init__(self, icon_path, action_name, text, toolbar, action_group): <NEW_LINE> <INDENT> super().__init__(icon_path, action_name, text, toolbar, action_group) <NEW_LINE> self.element = GwElement() <NEW_LINE> <DEDENT> def clicked_event(self): <NEW_LINE> <IN... | Button 67: Element Manager | 62598fb5f548e778e596b67a |
class _Immutable: <NEW_LINE> <INDENT> def __setattr__(self, name, value): <NEW_LINE> <INDENT> if not hasattr(self, '_immutable_init') or self._immutable_init is not self: <NEW_LINE> <INDENT> raise TypeError("object doesn't support attribute assignment") <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> super().__... | Immutable mixin class | 62598fb55fdd1c0f98e5e065 |
class PoolActionAvailability(IntEnum): <NEW_LINE> <INDENT> FULLY_OPERATIONAL = 0 <NEW_LINE> NO_IPC_REQUESTS = 1 <NEW_LINE> NO_POOL_CHANGES = 2 <NEW_LINE> NO_WRITE_IO = 3 <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> if self is PoolActionAvailability.FULLY_OPERATIONAL: <NEW_LINE> <INDENT> return "fully_operational" ... | What category of interactions a pool is enabled for. | 62598fb5956e5f7376df56e9 |
@dataclass <NEW_LINE> class Block(Statement): <NEW_LINE> <INDENT> statements: List[Statement] <NEW_LINE> def accept(self, visitor): <NEW_LINE> <INDENT> visitor.visit_block(self) | A block statement | 62598fb567a9b606de5460a6 |
class HTTP404(HTTP4xx): <NEW_LINE> <INDENT> CODE = 404 <NEW_LINE> def __init__(self, exc=None): <NEW_LINE> <INDENT> super().__init__(self.CODE, "Resource not found", exc=exc) | 404 Not Found
The requested resource could not be found but may be available in the future.
Subsequent requests by the client are permissible. | 62598fb51b99ca400228f59c |
class QuietExit(Exception): <NEW_LINE> <INDENT> pass | Simple exception used as a message from functions to the main. What it means is that the inner function
already handled the error and the main is not printing any info. | 62598fb5283ffb24f3cf3964 |
class ActionBase(object): <NEW_LINE> <INDENT> interface.implements(CommandInterface) <NEW_LINE> NAMESPACE = 'OVERRIDE_ME_NS' <NEW_LINE> NAME = 'OVERRIDE_ME_NAME' <NEW_LINE> def do(self, aDocument, cursor_position): <NEW_LINE> <INDENT> raise NotImplementedError <NEW_LINE> <DEDENT> def to_xml_etree(self): <NEW_LINE> <IND... | Base Action for any Action that can be compouned to build an
Operation | 62598fb5fff4ab517ebcd8bd |
class Address(models.Model): <NEW_LINE> <INDENT> contact = models.ForeignKey(Contact) <NEW_LINE> street1 = models.CharField(max_length=80) <NEW_LINE> street2 = models.CharField(max_length=80, blank=True) <NEW_LINE> addressee = models.CharField(max_length=80) <NEW_LINE> state = models.CharField(max_length=50, blank=True... | Address model with flags for default billin and shipping address | 62598fb557b8e32f52508188 |
class TheoreticalDihedral( NoeCompleteness ): <NEW_LINE> <INDENT> def __init__(self, project, **kwds): <NEW_LINE> <INDENT> NoeCompleteness.__init__(self, project, **kwds) <NEW_LINE> self.project = project <NEW_LINE> self.lib = TheoreticalDihedralLib() <NEW_LINE> self.variance = None <NEW_LINE> self.write... | Small class akin to NoeCompleteness super class. | 62598fb5f548e778e596b67b |
class MergeEdgeFeaturesSlurm(MergeEdgeFeaturesBase, SlurmTask): <NEW_LINE> <INDENT> pass | MergeEdgeFeatures on slurm cluster
| 62598fb53346ee7daa3376b3 |
class Apps(models.Model): <NEW_LINE> <INDENT> module_id = models.IntegerField() <NEW_LINE> name = models.CharField(unique=True, max_length=191) <NEW_LINE> slug = models.CharField(unique=True, max_length=191) <NEW_LINE> description = models.TextField(blank=True, null=True) <NEW_LINE> status = models.BooleanField(default... | Save licensed modules/app on user database | 62598fb54e4d5625663724f9 |
class ContainerSettings(Model): <NEW_LINE> <INDENT> _validation = { 'image_source_registry': {'required': True}, } <NEW_LINE> _attribute_map = { 'image_source_registry': {'key': 'imageSourceRegistry', 'type': 'ImageSourceRegistry'}, } <NEW_LINE> def __init__(self, image_source_registry): <NEW_LINE> <INDENT> self.image_... | Settings for the container to be downloaded.
:param image_source_registry: Registry to download the container from.
:type image_source_registry: :class:`ImageSourceRegistry
<azure.mgmt.batchai.models.ImageSourceRegistry>` | 62598fb576e4537e8c3ef67e |
class UserSignupTestCase(TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.payload_invalid_username = {keys.USERNAME: 'A$3'} <NEW_LINE> self.payload_invalid_password = {keys.USERNAME: 'bhirendra', keys.PASSWORD: ' 1 g % '} <NEW_LINE> self.payload_invalid_email = {keys.USERNAME: 'bhirendra', keys... | Test cases for user signup | 62598fb5be383301e02538d3 |
class ZhttpServerOptions(object): <NEW_LINE> <INDENT> allow_destruct = False <NEW_LINE> def __init__(self, *args): <NEW_LINE> <INDENT> if len(args) == 2 and type(args[0]) is c_void_p and isinstance(args[1], bool): <NEW_LINE> <INDENT> self._as_parameter_ = cast(args[0], zhttp_server_options_p) <NEW_LINE> self.allow_dest... | zhttp server. | 62598fb5be8e80087fbbf13f |
class LandingType(models.Model): <NEW_LINE> <INDENT> name = models.CharField('Landing type name', max_length=255, blank=False, null=False) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return u"%s" % self.name | Landing page type | 62598fb55fdd1c0f98e5e066 |
class GeneralFMaximizer(object): <NEW_LINE> <INDENT> def __init__(self, beta, n_labels): <NEW_LINE> <INDENT> self.beta = beta <NEW_LINE> self.n_labels = n_labels <NEW_LINE> <DEDENT> def __matrix_W_F2(self): <NEW_LINE> <INDENT> W = np.ndarray(shape=(self.n_labels, self.n_labels)) <NEW_LINE> for i in np.arange(1, self.n_... | Implementation of the GFM algorithm
| 62598fb563b5f9789fe85244 |
class ProfileMapping( OktaObject ): <NEW_LINE> <INDENT> def __init__(self, config=None): <NEW_LINE> <INDENT> super().__init__(config) <NEW_LINE> if config: <NEW_LINE> <INDENT> self.links = config["links"] if "links" in config else None <NEW_LINE> self.id = config["id"] if "id" in config el... | A class for ProfileMapping objects. | 62598fb5a05bb46b3848a943 |
class ProjectPoint2Image(nn.Module): <NEW_LINE> <INDENT> def __init__(self, K, im_width, im_height, uv_only=False): <NEW_LINE> <INDENT> super(ProjectPoint2Image, self).__init__() <NEW_LINE> self.K = K <NEW_LINE> self.im_width = im_width <NEW_LINE> self.im_height = im_height <NEW_LINE> ui, vi = np.meshgrid(range(im_widt... | Differentiable renderer for point cloud | 62598fb501c39578d7f12e52 |
class AddComment(handlers.Handler): <NEW_LINE> <INDENT> @handlers.check_logged_in() <NEW_LINE> @handlers.check_entry_exists() <NEW_LINE> @handlers.check_user_owns_entry() <NEW_LINE> def post(self, entry_entity): <NEW_LINE> <INDENT> comment_text = handlers.sanitize(self.request.get('comment')) <NEW_LINE> if not comment_... | Add a comment to a particular post | 62598fb55fdd1c0f98e5e067 |
class SourceAttributes: <NEW_LINE> <INDENT> IF = 'if' <NEW_LINE> ORDERBY = 'orderby' <NEW_LINE> LIMIT = "limit" <NEW_LINE> CUSTOM_TAG_ATTR = 'tag' <NEW_LINE> CHARACTERISTIC = 'characteristic' <NEW_LINE> QUESTION_TYPE = 'questiontype' <NEW_LINE> MATRIX_VALUESET = 'valueset' <NEW_LINE> RESPONSE_VALUE = 'value' <NEW_LINE>... | message source attributes: present in original source | 62598fb544b2445a339b69df |
class PtHeekCountdownStates: <NEW_LINE> <INDENT> kHeekCountdownStart = 0 <NEW_LINE> kHeekCountdownStop = 1 <NEW_LINE> kHeekCountdownIdle = 2 | (none) | 62598fb563d6d428bbee2886 |
class GetPastEventsResultSet(ResultSet): <NEW_LINE> <INDENT> def get_Response(self): <NEW_LINE> <INDENT> return self._output.get('Response', None) | Retrieve the value for the "Response" output from this choreography execution. ((XML) The response from Last.fm.) | 62598fb51b99ca400228f59d |
class Tuple(Element, atom.tuple.Tuple): <NEW_LINE> <INDENT> def __init__(self, item=None, default=()): <NEW_LINE> <INDENT> Element.__init__(self) <NEW_LINE> atom.tuple.Tuple.__init__(self, item, default) | Tuple element | 62598fb59c8ee823130401df |
class BatchProducer(object): <NEW_LINE> <INDENT> ACK_NOT_REQUIRED = 0 <NEW_LINE> ACK_AFTER_LOCAL_WRITE = 1 <NEW_LINE> ACK_AFTER_CLUSTER_COMMIT = -1 <NEW_LINE> DEFAULT_ACK_TIMEOUT = 2000 <NEW_LINE> DEFAULT_MESSAGE_LIMIT = 1000000 <NEW_LINE> def __init__(self, client, partitioner=None, req_acks=ACK_AFTER_CLUSTER_COMMIT, ... | A producer which distributes messages to partitions based on the key
and send batches
Params:
client - The Kafka client instance to use
partitioner - A partitioner class that will be used to get the partition
to send the message to. Must be derived from Partitioner
req_acks - A value indicating the acknowledgement... | 62598fb5283ffb24f3cf3966 |
class DotV2TestCase(unittest.TestCase): <NEW_LINE> <INDENT> def test_vec2_getitem(self): <NEW_LINE> <INDENT> from pedemath.vec2 import dot_v2 <NEW_LINE> a = Vec2(2, 3) <NEW_LINE> b = Vec2(1, 4) <NEW_LINE> result = dot_v2(a, b) <NEW_LINE> self.assertEqual(result, 14) | Ensure dot_v2 returns the dot product. | 62598fb566673b3332c304a6 |
class SuiteBuilder(object): <NEW_LINE> <INDENT> def __init__(self, baseCase): <NEW_LINE> <INDENT> self.baseCase = baseCase <NEW_LINE> self.modifierSets = [] <NEW_LINE> self._modifierLookup = {k.__name__: k for k in getInputModifiers(InputModifier)} <NEW_LINE> <DEDENT> def __len__(self): <NEW_LINE> <INDENT> return len(s... | Class for constructing a CaseSuite from combinations of modifications on base inputs.
Attributes
----------
baseCase : armi.cases.case.Case
A Case object to perturb
modifierSets : list(tuple(InputModifier))
Contains a list of tuples of ``InputModifier`` instances. A single case is
constructed by running a... | 62598fb5cc0a2c111447b0ec |
class LogRequestHandler(DatagramRequestHandler): <NEW_LINE> <INDENT> def handle(self): <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> data = self.rfile.getvalue() <NEW_LINE> data = data.decode('utf-8') <NEW_LINE> log_record = json.loads(data) <NEW_LINE> logger_instance = LoggerInstance(log_record['name'],log_record['time... | 日志服务处理流程 | 62598fb557b8e32f52508189 |
class UserAddonSettingsSerializer(JSONAPISerializer): <NEW_LINE> <INDENT> id = ser.CharField(source='config.short_name', read_only=True) <NEW_LINE> user_has_auth = ser.BooleanField(source='has_auth', read_only=True) <NEW_LINE> links = LinksField({ 'self': 'get_absolute_url', 'accounts': 'account_links', }) <NEW_LINE> c... | Overrides UserSerializer to make id required. | 62598fb58a349b6b43686315 |
class NatSrcRuleSet(Resource): <NEW_LINE> <INDENT> PROPERTIES = [ "zone_from", "zone_to", "$rules", "$rules_count" ] <NEW_LINE> def __init__(self, junos, name=None, **kvargs): <NEW_LINE> <INDENT> if name is None: <NEW_LINE> <INDENT> Resource.__init__(self, junos, name, **kvargs) <NEW_LINE> return <NEW_LINE> <DEDENT> se... | [edit security nat source rule-set <name>] | 62598fb5d486a94d0ba2c0ab |
class Fact(object): <NEW_LINE> <INDENT> def __init__(self, lex=None, semtype=None, syntype='fact',subcat=None): <NEW_LINE> <INDENT> self.lex = lex <NEW_LINE> self.semtype = semtype <NEW_LINE> self.syntype = syntype <NEW_LINE> self.subcat = subcat <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.le... | Facts. They totally cheat and are treated like strings. | 62598fb5f548e778e596b67d |
class FreqStack3: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.counter = itertools.count(0) <NEW_LINE> self.pq = [] <NEW_LINE> self.count_map = collections.defaultdict(int) <NEW_LINE> <DEDENT> def push(self, x): <NEW_LINE> <INDENT> seq_num = next(self.counter) <NEW_LINE> self.count_map[x] += 1 <NEW_... | Improved version:
Priority Queue + HashMap | 62598fb5379a373c97d990f0 |
class WNC(TalkerSentence): <NEW_LINE> <INDENT> fields = ( ("Distance, Nautical Miles", "dist_nautical_miles"), ("Distance Nautical Miles Unit", "dist_naut_unit"), ("Distance, Kilometers", "dist_km"), ("Distance, Kilometers Unit", "dist_km_unit"), ("Origin Waypoint ID", "waypoint_origin_id"), ("Destination Waypoint ID",... | Distance, Waypoint to Waypoint
| 62598fb591f36d47f2230f15 |
class get_memberships_for_an_activity___activity_leader(TestCase): <NEW_LINE> <INDENT> def __init__(self , session=None): <NEW_LINE> <INDENT> super().__init__(session) <NEW_LINE> self.url = hostURL + 'api/memberships/activity/' + activity_code <NEW_LINE> <DEDENT> def test(self): <NEW_LINE> <INDENT> response = api.get(s... | Verify that a regular member can fetch memberships for an activity.
Pre-Conditions:
Valid Authentication Header.
Expectations:
Endpoint -- api/memberships/activity/:id
Expected Status Code -- 200 OK
Expected Response Content -- A list of json Objects. | 62598fb5a219f33f346c68df |
class LanguageServiceGrpcTransport(object): <NEW_LINE> <INDENT> _OAUTH_SCOPES = ( "https://www.googleapis.com/auth/cloud-language", "https://www.googleapis.com/auth/cloud-platform", ) <NEW_LINE> def __init__( self, channel=None, credentials=None, address="language.googleapis.com:443" ): <NEW_LINE> <INDENT> if channel i... | gRPC transport class providing stubs for
google.cloud.language.v1 LanguageService API.
The transport provides access to the raw gRPC stubs,
which can be used to take advantage of advanced
features of gRPC. | 62598fb54e4d5625663724fb |
class RowProxy(BaseRowProxy): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> def __contains__(self, key): <NEW_LINE> <INDENT> return self._parent._has_key(key) <NEW_LINE> <DEDENT> def __getstate__(self): <NEW_LINE> <INDENT> return { '_parent': self._parent, '_row': tuple(self) } <NEW_LINE> <DEDENT> def __setstate__(self... | Proxy values from a single cursor row.
Mostly follows "ordered dictionary" behavior, mapping result
values to the string-based column name, the integer position of
the result in the row, as well as Column instances which can be
mapped to the original Columns that produced this result set (for
results that correspond t... | 62598fb53d592f4c4edbaf9a |
class AtfaDeviceManager(object): <NEW_LINE> <INDENT> def __init__(self, atft_manager): <NEW_LINE> <INDENT> self.atft_manager = atft_manager <NEW_LINE> <DEDENT> def GetSerial(self): <NEW_LINE> <INDENT> AtftManager.CheckDevice(self.atft_manager.atfa_dev) <NEW_LINE> self.atft_manager.atfa_dev.Oem('serial') <NEW_LINE> <DED... | The class to manager ATFA device related operations. | 62598fb5ec188e330fdf896a |
class GitOpen(InterfaceNonView): <NEW_LINE> <INDENT> def __init__(self, path, revision): <NEW_LINE> <INDENT> InterfaceNonView.__init__(self) <NEW_LINE> self.vcs = rabbitvcs.vcs.VCS() <NEW_LINE> self.git = self.vcs.git(path) <NEW_LINE> if revision: <NEW_LINE> <INDENT> revision_obj = self.git.revision(revision) <NEW_LINE... | This class provides a handler to open tracked files. | 62598fb523849d37ff85118d |
class PlotHistogram(PlotStream): <NEW_LINE> <INDENT> format = 'histogram' <NEW_LINE> def __init__(self, streamObj, *args, **keywords): <NEW_LINE> <INDENT> PlotStream.__init__(self, streamObj, *args, **keywords) <NEW_LINE> <DEDENT> def _extractData(self, dataValueLegit=True): <NEW_LINE> <INDENT> data = {} <NEW_LINE> dat... | Base class for Stream plotting classes.
| 62598fb5f9cc0f698b1c5339 |
class Categorizable(object): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def declare_categorizable(cls, category_type, single, plural, ation): <NEW_LINE> <INDENT> setattr( cls, plural, association_proxy( ation, 'category', creator=lambda category: Categorization( category_id=category.id, category_type=category.__class_... | Subclasses **MUST** provide a declared_attr method that defines the
relationship and association_proxy. For example:
.. code-block:: python
@declared_attr
def control_categorizations(cls):
return cls.categorizations(
'control_categorizations',
'control_categories',
100,
... | 62598fb55fdd1c0f98e5e068 |
class DualMotorController: <NEW_LINE> <INDENT> @abstractmethod <NEW_LINE> def set_speeds(self, speed_left, speed_right): <NEW_LINE> <INDENT> pass | Abstract base class for dual motor controllers. | 62598fb55fcc89381b2661b9 |
class ValidActions(collections.namedtuple( "ValidActions", ["types", "functions"])): <NEW_LINE> <INDENT> __slots__ = () | The set of types and functions that are valid for an agent to use.
Attributes:
types: A namedtuple of the types that the functions require. Unlike TYPES
above, this includes the sizes for screen and minimap.
functions: A namedtuple of all the functions. | 62598fb501c39578d7f12e54 |
class ResultCallback(CallbackBase): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(ResultsCallback, self).__init__(*args, **kwargs) <NEW_LINE> self.task_ok = {} <NEW_LINE> self.task_unreachable = {} <NEW_LINE> self.task_failed = {} <NEW_LINE> self.task_skipped = {} <NEW_LINE> self.ta... | A sample callback plugin used for performing an action as results come in
If you want to collect all results into a single object for processing at
the end of the execution, look into utilizing the ``json`` callback plugin
or writing your own custom callback plugin | 62598fb52c8b7c6e89bd389f |
class PlaceHandler(web.RequestHandler): <NEW_LINE> <INDENT> @web.asynchronous <NEW_LINE> def get(self, uuid, fragment=None): <NEW_LINE> <INDENT> if uuid is None or fragment is None: <NEW_LINE> <INDENT> api.request_place(uuid, session=session) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> raise Exception('Invalid UUID: ... | Handles create (POST), retrieve (GET), update (PUT), delete (DELETE),
and query (GET) for Places. | 62598fb566656f66f7d5a4cb |
class LogTests(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.logfile = "/var/log/docker/install.log" <NEW_LINE> self.install_log = Log() <NEW_LINE> <DEDENT> def test_logfile(self): <NEW_LINE> <INDENT> assert os.path.exists(self.logfile) == 1 <NEW_LINE> <DEDENT> def test_write_log(sel... | Tests for log.py | 62598fb5cc0a2c111447b0ed |
class BaseHandler(webapp2.RequestHandler): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> super(BaseHandler, self).__init__(*args, **kwargs) <NEW_LINE> urlfetch.set_default_fetch_deadline(60) <NEW_LINE> <DEDENT> def check_csrf(self): <NEW_LINE> <INDENT> origin = self.request.headers.get('o... | Base class for Handlers that render Jinja templates. | 62598fb5d486a94d0ba2c0ac |
@tf_export("IndexedSlicesSpec") <NEW_LINE> class IndexedSlicesSpec(type_spec.TypeSpec): <NEW_LINE> <INDENT> __slots__ = ["_shape", "_values_dtype", "_indices_dtype", "_dense_shape_dtype", "_indices_shape"] <NEW_LINE> value_type = property(lambda self: IndexedSlices) <NEW_LINE> def __init__(self, shape=None, dtype=dtype... | Type specification for a `tf.IndexedSlices`. | 62598fb5009cb60464d015fd |
class PageWrapper(ParamWrapper): <NEW_LINE> <INDENT> def __init__(self, param): <NEW_LINE> <INDENT> ParamWrapper.__init__(self, param) <NEW_LINE> <DEDENT> def getLabel(self): <NEW_LINE> <INDENT> return self._param.getLabel() <NEW_LINE> <DEDENT> @QtCore.Signal <NEW_LINE> def changed(self): <NEW_LINE> <INDENT> pass <NEW_... | Gui class, which maps a ParamPage. | 62598fb5283ffb24f3cf3968 |
class UpdateCatalanCollectionbyUserHandler(baseapp.BaseAppHandler): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> logging.info('fixing catalan') <NEW_LINE> place_query = db.GqlQuery( 'SELECT __key__ FROM PlacedLit WHERE user_email = :1', 'espaisescrits@gmail.com') <NEW_LINE> collection = collections.Collection... | update catalan users | 62598fb5adb09d7d5dc0a668 |
class Circle: <NEW_LINE> <INDENT> def __init__(self, a=0, b=0, r=0): <NEW_LINE> <INDENT> self.a = a <NEW_LINE> self.b = b <NEW_LINE> self.r = r <NEW_LINE> self.A = -2*self.a <NEW_LINE> self.B = -2*self.b <NEW_LINE> self.C = (self.a**2)+(self.b**2)-(self.r**2) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> r... | (x-a)^2 + (y-b)^2 = r^2
or
x^2 + y^2 + Ax + By + C = 0 | 62598fb53346ee7daa3376b5 |
class TransformVisitor(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.transforms = collections.defaultdict(list) <NEW_LINE> <DEDENT> def _transform(self, node): <NEW_LINE> <INDENT> cls = node.__class__ <NEW_LINE> if cls not in self.transforms: <NEW_LINE> <INDENT> return node <NEW_LINE> <DEDEN... | A visitor for handling transforms.
The standard approach of using it is to call
:meth:`~visit` with an *astroid* module and the class
will take care of the rest, walking the tree and running the
transforms for each encountered node. | 62598fb567a9b606de5460ab |
class Capabilities(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self._flags = set() <NEW_LINE> <DEDENT> def set_flag(self, flag): <NEW_LINE> <INDENT> self._flags.add(flag) <NEW_LINE> <DEDENT> def clear_flag(self, flag): <NEW_LINE> <INDENT> self._flags.remove(flag) <NEW_LINE> <DEDENT> def __conta... | Representation of VM capabilities. | 62598fb5aad79263cf42e8af |
class AddDataToProjectDataHandler(BaseHandler): <NEW_LINE> <INDENT> mongodb_service = syringe.inject('mongodb-service') <NEW_LINE> @authenticated_async <NEW_LINE> @tornado.web.asynchronous <NEW_LINE> def post(self, p_id, d_id): <NEW_LINE> <INDENT> datasets = self.mongodb_service.add_dataset_to_project( user=self.curren... | This method is used to delete data set belongd to given project,
we are useing the get request to trigger delete, this is very bad
approach, we need to use delete method to acomplish this task. | 62598fb51f5feb6acb162cfa |
class TestVoiceprintApi(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.api = openapi_client.api.voiceprint_api.VoiceprintApi() <NEW_LINE> <DEDENT> def tearDown(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def test_delete(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def t... | VoiceprintApi unit test stubs | 62598fb54e4d5625663724fd |
class Listener(models.Model): <NEW_LINE> <INDENT> mount = models.ForeignKey(Mount, related_name='listeners') <NEW_LINE> user = models.CharField(max_length=20) <NEW_LINE> password = models.CharField(max_length=20) <NEW_LINE> start = models.DateTimeField() <NEW_LINE> end = models.DateTimeField() <NEW_LINE> duration = mod... | A model representing a listener to a mount. Instances of this model are
only created after the listener is disconnected | 62598fb5aad79263cf42e8b0 |
@dataclass <NEW_LINE> class RedactedEvent(Event): <NEW_LINE> <INDENT> type: str = field() <NEW_LINE> redacter: str = field() <NEW_LINE> reason: Optional[str] = field() <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> reason = ", reason: {}".format(self.reason) if self.reason else "" <NEW_LINE> return "Redacted event o... | An event that has been redacted.
Attributes:
type (str): The type of the event that has been redacted.
redacter (str): The fully-qualified ID of the user who redacted the
event.
reason (str, optional): A string describing why the event was redacted,
can be None. | 62598fb55fcc89381b2661ba |
class APIError(Exception): <NEW_LINE> <INDENT> pass | Bucket for errors related to server responses. | 62598fb5baa26c4b54d4f394 |
class account_partner_balance(osv.osv_memory): <NEW_LINE> <INDENT> _inherit = 'account.partner.balance' <NEW_LINE> def _print_report(self, cr, uid, ids, data, context=None): <NEW_LINE> <INDENT> res = super(account_partner_balance, self)._print_report(cr, uid, ids, data, context=context) <NEW_LINE> res['report_name'] = ... | This wizard will provide the partner balance report by periods, between any two dates. | 62598fb521bff66bcd722d44 |
class MinimaxAgentN( SearchAgent ): <NEW_LINE> <INDENT> def getAction( self, gameState ): <NEW_LINE> <INDENT> legalActions = gameState.getLegalActions(0) <NEW_LINE> nextStatesFromLegalActions = [gameState.generateSuccessor(0, action) for action in legalActions] <NEW_LINE> values = [self.miniMaxValue(1, nextGameState, s... | Minimax agent with n ghosts. | 62598fb5a8370b77170f04ba |
class ErrClusterConfig(Exception): <NEW_LINE> <INDENT> def __init__(self, cluster): <NEW_LINE> <INDENT> super().__init__("The cluster configuration for %s is not available." % cluster) | Cluster configuration not found
We need the configuration during the binding to set the connection string
Constructor
Args:
cluster (str): Atlas cluster name | 62598fb54a966d76dd5eefb4 |
class RefundSuccessfulSubOrder(resource.Resource): <NEW_LINE> <INDENT> app = 'mall2' <NEW_LINE> resource = 'refund_successful_sub_order' <NEW_LINE> @login_required <NEW_LINE> def api_put(request): <NEW_LINE> <INDENT> order_id = int(request.POST['order_id']) <NEW_LINE> delivery_item_id = int(request.POST['delivery_item_... | 子订单退款成功 | 62598fb5cc0a2c111447b0ef |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.