code
stringlengths
4
4.48k
docstring
stringlengths
1
6.45k
_id
stringlengths
24
24
class AgentService(service.MultiService): <NEW_LINE> <INDENT> def __init__(self, web_ui_port): <NEW_LINE> <INDENT> service.MultiService.__init__(self) <NEW_LINE> director = Director() <NEW_LINE> self.scheduler_service = SchedulerService(director) <NEW_LINE> self.scheduler_service.setServiceParent(self) <NEW_LINE> if no...
Manage all services related to the ooniprobe-agent daemon.
62599071adb09d7d5dc0be43
class CountableWidgetTestCase(FacetedTestCase): <NEW_LINE> <INDENT> def afterSetUp(self): <NEW_LINE> <INDENT> self.request = self.app.REQUEST <NEW_LINE> <DEDENT> def test_widget_empty_count(self): <NEW_LINE> <INDENT> data = {} <NEW_LINE> widget = CountableWidget(self.portal, self.request, data=data) <NEW_LINE> self.ass...
Test
6259907160cbc95b063659da
class BaseType(TypeMeta('BaseTypeBase', (object, ), {})): <NEW_LINE> <INDENT> MESSAGES = { 'required': u"This field is required.", 'choices': u"Value must be one of {0}.", } <NEW_LINE> def __init__(self, required=False, default=None, serialized_name=None, choices=None, validators=None, deserialize_from=None, serialize_...
A base class for Types in a Schematics model. Instances of this class may be added to subclasses of ``Model`` to define a model schema. Validators that need to access variables on the instance can be defined be implementing methods whose names start with ``validate_`` and accept one parameter (in addition to ``self``)...
625990712ae34c7f260ac9c3
class OpenTagError(NestingError): <NEW_LINE> <INDENT> def __init__(self, tagstack, tag, position=(None, None)): <NEW_LINE> <INDENT> self.tag = tag <NEW_LINE> msg = 'Tag <%s> is not allowed in <%s>' % (tag, tagstack[-1]) <NEW_LINE> HTMLParseError.__init__(self, msg, position)
Exception raised when a tag is not allowed in another tag.
62599071fff4ab517ebcf0f3
class SessionStore(SessionBase): <NEW_LINE> <INDENT> def __init__(self, session_key=None): <NEW_LINE> <INDENT> self.redis = redis.Redis( host=getattr(settings, "REDIS_HOST", None), port=getattr(settings, "REDIS_PORT", None), db=getattr(settings, "REDIS_DB", None)) <NEW_LINE> super(SessionStore, self).__init__(session_k...
A redis-based session store.
625990714527f215b58eb60c
class TestClusterInstanceInfo(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 testClusterInstanceInfo(self): <NEW_LINE> <INDENT> pass
ClusterInstanceInfo unit test stubs
62599071f548e778e596ce66
class echoList_args(TBase): <NEW_LINE> <INDENT> def __init__(self, lst=None,): <NEW_LINE> <INDENT> self.lst = lst <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> L = ['%s=%r' % (key, value) for key, value in self.__dict__.items()] <NEW_LINE> return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) <NEW_LIN...
Attributes: - lst
62599071009cb60464d02e11
class StdoutRedirect(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, queue): <NEW_LINE> <INDENT> super(StdoutRedirect, self).__init__() <NEW_LINE> stringio = io.StringIO('') <NEW_LINE> self.sys_module = sys.modules['sys'] <NEW_LINE> setattr(self.sys_module, 'stdout', stringio) <NEW_LINE> self.queue = queue <N...
This shunts stdout data to a queue that feeds a tkinter.Text window.
62599071bf627c535bcb2da5
class Comment(CharacterData): <NEW_LINE> <INDENT> nodeName = '#comment' <NEW_LINE> nodeType = Node.COMMENT_NODE <NEW_LINE> __slots__ = Node.TEXT_SLOTS
Comment http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-1728279322
625990717c178a314d78e858
class TobyStandardWorker(TobyBaseWorker): <NEW_LINE> <INDENT> def __init__(self, *args, **kwargs): <NEW_LINE> <INDENT> class Executor(TobyBaseExecutor): <NEW_LINE> <INDENT> def setup(self): <NEW_LINE> <INDENT> self.kwargs['sample_object_instance'] = None <NEW_LINE> <DEDENT> <DEDENT> TobyBaseWorker.__init__(self, *args,...
The standard Toby Worker
625990718a43f66fc4bf3a6e
class RetryTaskError(Exception): <NEW_LINE> <INDENT> def __init__(self, message, exc, *args, **kwargs): <NEW_LINE> <INDENT> self.exc = exc <NEW_LINE> Exception.__init__(self, message, exc, *args, **kwargs)
The task is to be retried later.
625990714c3428357761bb8e
class DomainQueuer: <NEW_LINE> <INDENT> def __init__(self, service, authenticated=False): <NEW_LINE> <INDENT> self.service = service <NEW_LINE> self.authed = authenticated <NEW_LINE> <DEDENT> def exists(self, user): <NEW_LINE> <INDENT> if self.willRelay(user.dest, user.protocol): <NEW_LINE> <INDENT> orig = filter(None,...
An SMTP domain which add messages to a queue intended for relaying.
62599071a8370b77170f1ca4
class MaximalRectangleImplStack(MaximalRectangle): <NEW_LINE> <INDENT> def maximal_rectangle(self, matrix): <NEW_LINE> <INDENT> histograms = self.construct_histograms_from_matrix(matrix) <NEW_LINE> return max(self.largest_rectangle_area_in_histogram(heights) for heights in histograms) <NEW_LINE> <DEDENT> @staticmethod ...
Time: O(nm) Space: O(nm) 采用算法强化班中讲到的单调栈。 要做这个题之前先做直方图最大矩阵(Largest Rectangle in Histogram) 这个题。 这个题其实就是包了一层皮而已。一行一行的计算以当前行为矩阵的下边界时,最大矩阵是什么。 计算某一行为下边界时的情况,就可以转换为直方图最大矩阵问题了。
62599071be8e80087fbc096a
class CsvResultDescriptor(object): <NEW_LINE> <INDENT> def __init__(self, file_path): <NEW_LINE> <INDENT> self.file_path = file_path <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return 'CSV results at %s' % os.path.join(os.path.abspath('.'), self.file_path) <NEW_LINE> <DEDENT> def _repr_html_(self): <NEW...
Provides IPython Notebook-friendly output for the feedback after a ``.csv`` called.
6259907123849d37ff852991
class WinFileTestCase(TestCase, LoaderModuleMockMixin): <NEW_LINE> <INDENT> FAKE_RET = {'fake': 'ret data'} <NEW_LINE> if salt.utils.platform.is_windows(): <NEW_LINE> <INDENT> FAKE_PATH = os.sep.join(['C:', 'path', 'does', 'not', 'exist']) <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> FAKE_PATH = os.sep.join(['path', '...
Test cases for salt.modules.win_file
62599071442bda511e95d9c5
class getBootstrapInfo_result(object): <NEW_LINE> <INDENT> thrift_spec = ( (0, TType.STRUCT, 'success', (BootstrapInfo, BootstrapInfo.thrift_spec), None, ), ) <NEW_LINE> def __init__(self, success=None,): <NEW_LINE> <INDENT> self.success = success <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot....
Attributes: - success
625990714428ac0f6e659e0f
class CookiePostHandlerMiddleware(object): <NEW_LINE> <INDENT> def process_response(self, request, response): <NEW_LINE> <INDENT> if hasattr(request, '_orig_cookies') and request.COOKIES != request._orig_cookies: <NEW_LINE> <INDENT> for k,v in request.COOKIES.iteritems(): <NEW_LINE> <INDENT> if request._orig_cookies.ge...
This middleware modifies updates the response will all modified cookies. This should be the last middleware you load.
6259907116aa5153ce401db4
class PRAC2D(CrackProperty): <NEW_LINE> <INDENT> type = 'PRAC2D' <NEW_LINE> _field_map = { 1: 'pid', 2:'mid', 3:'thick', 4:'iPlane', 5:'nsm', 6:'gamma', 7:'phi', } <NEW_LINE> def __init__(self, card=None, data=None, comment=''): <NEW_LINE> <INDENT> CrackProperty.__init__(self, card, data) <NEW_LINE> if comment: <NEW_LI...
CRAC2D Element Property Defines the properties and stress evaluation techniques to be used with the CRAC2D structural element.
625990714f88993c371f118e
class BaseView(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> raise NotImplementedError('This interface cannot be instantiated.') <NEW_LINE> <DEDENT> @classmethod <NEW_LINE> def load_builder_file(cls, path_parts, root=None, domain=''): <NEW_LINE> <INDENT> _id = "/".join(path_parts) <NEW_LINE> if _...
Interface for views.
62599071bf627c535bcb2da7
class RevertButton(Button): <NEW_LINE> <INDENT> _id = _wx.ID_REVERT <NEW_LINE> _default_label = _(u'Revert')
A button with the label 'Revert'. Resets pending changes back to the default state or undoes any alterations made by the user. See Button for documentation on button events.
625990714e4d562566373ce2
class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): <NEW_LINE> <INDENT> _sendfile_compatible = constants._SendfileMode.TRY_NATIVE <NEW_LINE> def __init__(self, loop, sock, protocol, waiter=None, extra=None, server=None): <NEW_LINE> <INDENT> super().__init__...
Transport for connected sockets.
625990711b99ca40022901a3
class Model: <NEW_LINE> <INDENT> def __init__(self, world_path, robot_path, motion_path, output_path, model_path): <NEW_LINE> <INDENT> self.world = World(world_path) <NEW_LINE> self.robot = Robot(robot_path) <NEW_LINE> self.planner = Planner(self.robot, self.world, motion_path, output_path, model_path) <NEW_LINE> <DEDE...
The governing class for the simulation model. Represents all the data within the simulation, which can be manipulated and interacted with.
6259907191f36d47f2231afc
class EventActionLoader(BaseEweLoader): <NEW_LINE> <INDENT> input_parameters_out = Identity() <NEW_LINE> output_parameters_out = Identity()
EventItem and Action item loaders. In addition to BaseEweLoader, it keeps the list of input and output parameters in the output.
6259907167a9b606de547711
class Psi3SPTest(GenericSPTest): <NEW_LINE> <INDENT> b3lyp_energy = -10300 <NEW_LINE> @unittest.skip('atommasses not implemented yet') <NEW_LINE> def testatommasses(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> @unittest.skip('Psi3 did not print partial atomic charges') <NEW_LINE> def testatomcharges(self): <NEW_...
Customized restricted single point HF/KS unittest
625990717d847024c075dcb4
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> @property <NEW_LINE> def size(self): <NEW_LINE> <INDENT> return self.width <NEW_LINE> <DEDENT> @size.setter <NEW_LINE> def size(self, value): <NEW_LINE...
Module Representation of Square
625990714a966d76dd5f07c6
class All(CAReduce): <NEW_LINE> <INDENT> __props__ = ("axis",) <NEW_LINE> def __init__(self, axis=None): <NEW_LINE> <INDENT> CAReduce.__init__(self, scalar.and_, axis) <NEW_LINE> <DEDENT> def _output_dtype(self, idtype): <NEW_LINE> <INDENT> return "bool" <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> if sel...
Applies `logical and` to all the values of a tensor along the specified axis(es).
625990711f5feb6acb1644ce
class UserModel(_db.Model): <NEW_LINE> <INDENT> __tablename__ = 'users' <NEW_LINE> id = _db.Column(_db.Integer, primary_key=True) <NEW_LINE> user = _db.Column(_db.String(20), unique=True) <NEW_LINE> password = _db.Column(_db.String(30)) <NEW_LINE> def __init__(self,user,password): <NEW_LINE> <INDENT> self.user = user <...
Model para los usuarios registrados
62599071baa26c4b54d50b87
class Solution: <NEW_LINE> <INDENT> def fourSum(self, numbers, target): <NEW_LINE> <INDENT> numLen, res, d = len(numbers), set(), {} <NEW_LINE> if numLen < 4: return [] <NEW_LINE> numbers.sort() <NEW_LINE> for p in xrange(numLen): <NEW_LINE> <INDENT> if p != numbers.index(numbers[p]): <NEW_LINE> <INDENT> continue <NEW_...
@param numbersbers : Give an array numbersbersbers of n integer @param target : you need to find four elements that's sum of target @return : Find all unique quadruplets in the array which gives the sum of zero.
6259907197e22403b383c7df
class UpdatePlanetInput(graphene.InputObjectType, PlanetAttribute): <NEW_LINE> <INDENT> id = graphene.ID(required=True, description="Global Id of the planet.")
Arguments to update a planet.
625990717047854f46340c92
class TestTrackerDjangoInstantiation(TestCase): <NEW_LINE> <INDENT> @override_settings(TRACKING_BACKENDS=SIMPLE_SETTINGS.copy()) <NEW_LINE> def test_django_simple_settings(self): <NEW_LINE> <INDENT> backends = self._reload_backends() <NEW_LINE> assert len(backends) == 1 <NEW_LINE> tracker.send({}) <NEW_LINE> assert lis...
Test if backends are initialized properly from Django settings.
625990712c8b7c6e89bd50c3
class NotCorrectTileError(Exception): <NEW_LINE> <INDENT> pass
Used to indicate that a tile is not the type of tile expected
62599071435de62698e9d6e2
class _Feature(object): <NEW_LINE> <INDENT> _type = None <NEW_LINE> _coordinates = () <NEW_LINE> @property <NEW_LINE> def __geo_interface__(self): <NEW_LINE> <INDENT> return { 'type': self._type, 'coordinates': tuple(self._coordinates) } <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.to_wkt() <N...
Base class
62599071e1aae11d1e7cf47b
class OpenApiDocument(Document): <NEW_LINE> <INDENT> def __init__(self, version, url=None, title=None, description=None, media_type=None, content=None): <NEW_LINE> <INDENT> super(OpenApiDocument, self).__init__( url=url, title=title, description=description, media_type=media_type, content=content ) <NEW_LINE> self._ver...
OpenAPI-compliant document provides: - Versioning information
62599071796e427e53850054
class gui: <NEW_LINE> <INDENT> label = 'Gui' <NEW_LINE> stock_id = 'gtk-new' <NEW_LINE> __order__ = ['uses', 'location'] <NEW_LINE> class uses: <NEW_LINE> <INDENT> rtype = types.boolean <NEW_LINE> label = 'Uses Gui' <NEW_LINE> default = True <NEW_LINE> <DEDENT> class location: <NEW_LINE> <INDENT> label = 'File location...
Options relating to graphical user interfaces
625990713539df3088ecdb72
class Deck(object): <NEW_LINE> <INDENT> def __init__(self, n_decks=1): <NEW_LINE> <INDENT> simple_cards = list(itertools.product(RANKS, SUITS)) <NEW_LINE> self.cards = [Card(*tuple) for tuple in simple_cards] * n_decks <NEW_LINE> self.shuffle() <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return ' '.join(...
One or multiple decks of playing cards
62599071cc0a2c111447c73f
class RHContributionACLMessage(RHManageContributionBase): <NEW_LINE> <INDENT> def _process(self): <NEW_LINE> <INDENT> mode = ProtectionMode[request.args['mode']] <NEW_LINE> return jsonify_template('forms/protection_field_acl_message.html', object=self.contrib, mode=mode, endpoint='contributions.acl')
Render the inheriting ACL message
62599071be8e80087fbc096c
@attrs.define(kw_only=True) <NEW_LINE> class CharacterScopedArtifact: <NEW_LINE> <INDENT> hash: int <NEW_LINE> points_used: int <NEW_LINE> reset_count: int <NEW_LINE> tiers: colelctions.Sequence[ArtifactTier]
Represetns per-character artifact data.
62599071d486a94d0ba2d89b
class SklearnWrapper(BaseBiclusteringAlgorithm, metaclass=ABCMeta): <NEW_LINE> <INDENT> def __init__(self, constructor, **kwargs): <NEW_LINE> <INDENT> self.wrapped_algorithm = constructor(**kwargs) <NEW_LINE> <DEDENT> def run(self, data): <NEW_LINE> <INDENT> self.wrapped_algorithm.fit(data) <NEW_LINE> biclusters = [] <...
This class defines the skeleton of a wrapper for the scikit-learn package.
625990714e4d562566373ce3
class CI(RegistroDecomp): <NEW_LINE> <INDENT> mnemonico = "CI" <NEW_LINE> def __init__(self): <NEW_LINE> <INDENT> super().__init__(CI.mnemonico, True) <NEW_LINE> self._dados = [ 0, 0, "", 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ] <NEW_LINE> <DEDENT> def le(self): <NEW_LINE> <INDENT> reg_contrato = Registro...
Registro que define contratos de importação de energia.
62599071e76e3b2f99fda2df
class UserManager(UserManager): <NEW_LINE> <INDENT> def _create_user(self, first_name, last_name, password, is_staff, is_superuser, **extra_fields): <NEW_LINE> <INDENT> now = timezone.now() <NEW_LINE> user = self.model(first_name=first_name, last_name=last_name, is_staff=is_staff, is_superuser=is_superuser, is_active=T...
- Custom Manager for the User Model
6259907156b00c62f0fb41ac
class HelloApiView(APIView): <NEW_LINE> <INDENT> serializer_class = serializers.HelloSerializer <NEW_LINE> def get(self,request,format=None): <NEW_LINE> <INDENT> an_apiview =[ 'Uses http methods as functions (get,post,put,patch,delete)', 'It is similar to a traditional django view' 'Gives you the most control over your...
Test API view
6259907132920d7e50bc7924
class FieldsFromTextFile(PipelineAction): <NEW_LINE> <INDENT> def __init__(self, output): <NEW_LINE> <INDENT> PipelineAction.__init__(self, 'FieldsFromTextFile', output) <NEW_LINE> <DEDENT> def _execute(self, ifiles, pipeline=None): <NEW_LINE> <INDENT> if len(ifiles) > 1: <NEW_LINE> <INDENT> env.logger.warning( 'Only t...
Read a text file, guess its delimeter, field name (from header) and create field descriptions. If a vcf file is encountered, all fields will be exported. File Flow: extract format of input and output format. INPUT ==> Get Format ==> OUTPUT Raises: Raise a RuntimeError if this action failed to guess format (f...
62599071f548e778e596ce6b
class EventTime: <NEW_LINE> <INDENT> def __init__(self,year, daqTime): <NEW_LINE> <INDENT> self.year = year <NEW_LINE> self.daqTime = daqTime <NEW_LINE> dtpair = self._make_datetime_pair() <NEW_LINE> self.dateTime = dtpair[0] <NEW_LINE> self.utcTenthNanoSecond = dtpair[1] <NEW_LINE> <DEDENT> def _make_datetime_pair(sel...
The EventTime class. The purpose of this class is to translate IceCube time, which constist of the year and tenths of nanoseconds since the beginning of the year, to a format that is more user-friendly. This class uses python's datetime module. @todo: Implement math operations. @todo: Clean up the interface so the te...
6259907176e4537e8c3f0e5c
class BuildSequence(BuildSteps): <NEW_LINE> <INDENT> def run(self, *args, **kwargs): <NEW_LINE> <INDENT> logger.info('running jobs in a build sequence.') <NEW_LINE> for job in self.stage: <NEW_LINE> <INDENT> logger.info('running {0}'.format(job[0].__name__)) <NEW_LINE> job[0](*job[1]) <NEW_LINE> <DEDENT> return True
A subclass of :class:~stages.BuildSteps` that executes jobs in the order they were added to the :class:~stages.BuildSteps` object. :returns: ``True`` upon completion.
62599071aad79263cf430093
class Model(): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.product_set = set() <NEW_LINE> <DEDENT> @property <NEW_LINE> def products(self): <NEW_LINE> <INDENT> return list(self.product_set) <NEW_LINE> <DEDENT> @property <NEW_LINE> def variables(self): <NEW_LINE> <INDENT> raise NotImplementedError <...
Base model source class.
625990711b99ca40022901a4
class UserViewSet(ViewSetModelMixin, viewsets.ViewSet): <NEW_LINE> <INDENT> serializer_class = UserSerializer
User profiles CRUD operations
6259907167a9b606de547712
class TokenAuthBackend(BasicAuthBackend): <NEW_LINE> <INDENT> def __init__(self, user_loader, auth_header_prefix='Token'): <NEW_LINE> <INDENT> super(TokenAuthBackend, self).__init__(user_loader, auth_header_prefix) <NEW_LINE> <DEDENT> def _extract_credentials(self, req): <NEW_LINE> <INDENT> auth = req.get_header('Autho...
Implements Simple Token Based Authentication. Clients should authenticate by passing the token key in the "Authorization" HTTP header, prepended with the string "Token ". For example: Authorization: Token 401f7ac837da42b97f613d789819ff93537bee6a Args: user_loader(function, required): A callback function t...
62599071baa26c4b54d50b89
@Packet(type='request') <NEW_LINE> class PacketQueryUser(NamedTuple): <NEW_LINE> <INDENT> user: str <NEW_LINE> query_password_hash: bool <NEW_LINE> def handle(self, conn: Connection) -> None: <NEW_LINE> <INDENT> try: <NEW_LINE> <INDENT> pw = getpwnam(self.user) <NEW_LINE> <DEDENT> except KeyError: <NEW_LINE> <INDENT> t...
This packet is used to get information about a group via pwd.getpw*.
625990719c8ee82313040df6
@plugins.register <NEW_LINE> class AtmosphericTidesComParser(LineParser): <NEW_LINE> <INDENT> def setup_parser(self): <NEW_LINE> <INDENT> return dict(comments="#", names=("xyz", "A1", "B1", "A2", "B2"), dtype=("U2", "f8", "f8", "f8", "f8"))
A parser for reading coefficents for atmospheric tides center of mass corrections
6259907197e22403b383c7e1
class ValueTypeNotDefinedError(FeatureError): <NEW_LINE> <INDENT> pass
Exception raised when a feature value's type isn't defined.
6259907199cbb53fe68327c7
class Action16(Action): <NEW_LINE> <INDENT> def execute(self, instance): <NEW_LINE> <INDENT> raise NotImplementedError('%s not implemented' % ( str(self)))
Set Transparency->Toggle Parameters: 0: ((unknown 25022))
625990712ae34c7f260ac9c8
class AsciiMap(object): <NEW_LINE> <INDENT> def __init__(self, lattice=None): <NEW_LINE> <INDENT> self.lattice = lattice or {} <NEW_LINE> <DEDENT> def readMap(self, text): <NEW_LINE> <INDENT> self.lattice = {} <NEW_LINE> for row, line in enumerate(reversed(text.strip().splitlines())): <NEW_LINE> <INDENT> line = line.st...
Base class for maps. These should be able to read and write ASCII maps.
625990717b180e01f3e49cd3
class VersionInfo(tuple): <NEW_LINE> <INDENT> __slots__ = () <NEW_LINE> _fields = ('major', 'minor', 'micro', 'modifier') <NEW_LINE> def __new__(cls, major, minor=0, micro=0, modifier='release'): <NEW_LINE> <INDENT> assert isinstance(major, int) <NEW_LINE> assert isinstance(minor, int) <NEW_LINE> assert isinstance(micr...
Version number. This is a variation on a `namedtuple`. Example: VersionInfo(1, 2, 0) == VersionInfo(major=1, minor=2, micro=0, modifier='release') == (1, 2, 0)
6259907244b2445a339b75cd
class BaseProductImage(models.Model, metaclass=deferred.ForeignKeyBuilder): <NEW_LINE> <INDENT> image = image.FilerImageField(on_delete=models.CASCADE) <NEW_LINE> product = deferred.ForeignKey( BaseProduct, on_delete=models.CASCADE, ) <NEW_LINE> order = models.SmallIntegerField(default=0) <NEW_LINE> class Meta: <NEW_LI...
ManyToMany relation from the polymorphic Product to a set of images.
6259907256ac1b37e6303951
class createChat_args(object): <NEW_LINE> <INDENT> def __init__(self, request=None,): <NEW_LINE> <INDENT> self.request = request <NEW_LINE> <DEDENT> def read(self, iprot): <NEW_LINE> <INDENT> if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None: <...
Attributes: - request
6259907260cbc95b063659dd
class Consumer(object): <NEW_LINE> <INDENT> def __init__(self, key, secret, callback_uri=None): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> self.secret = secret <NEW_LINE> self.callback_uri = callback_uri
Represents a client key, or a record of credentials for API access. Public instance variables: key -- The API client key secret -- The API client secret callback_uri -- (optional) The URI to the callback for the application, to which the end user will be redirected to once they have granted ...
6259907223849d37ff852995
class Revolve(Srf): <NEW_LINE> <INDENT> def __init__(self, curve, pnt=(0., 0., 0.), vector=(1., 0., 0.), theta=2.*math.pi): <NEW_LINE> <INDENT> if not isinstance(curve, crv.Crv): <NEW_LINE> <INDENT> raise NURBSError('Input curve not derived from Crv class!') <NEW_LINE> <DEDENT> T = translate(-np.asarray(pnt, np.float))...
Construct a surface by revolving the profile curve around an axis defined by a point and a unit vector. srf = nrbrevolve(curve,point,vector[,theta]) INPUT: curve - NURB profile curve. pnt - coordinate of the point. (default: [0, 0, 0]) vector - rotation axis. (default: [1, 0, 0]) theta - angle to revolve curve ...
625990724e4d562566373ce5
class Share(models.Model): <NEW_LINE> <INDENT> shared_by = models.ForeignKey(User, on_delete=models.CASCADE, related_name='problem_builder_shared_by') <NEW_LINE> submission_uid = models.CharField(max_length=32) <NEW_LINE> block_id = models.CharField(max_length=255, db_index=True) <NEW_LINE> shared_with = models.Foreign...
The XBlock User Service does not permit XBlocks instantiated with non-staff users to query for arbitrary anonymous user IDs. In order to make sharing work, we have to store them here.
625990724f88993c371f1190
class NPointMessyCrossoverOperator(CrossoverOperator): <NEW_LINE> <INDENT> def __init__(self, points=2): <NEW_LINE> <INDENT> self._points = int(points) <NEW_LINE> <DEDENT> @property <NEW_LINE> def points(self): <NEW_LINE> <INDENT> return self._points <NEW_LINE> <DEDENT> @staticmethod <NEW_LINE> def get_total_weight(par...
N-point variable-length crossover.
6259907276e4537e8c3f0e5e
class SupportsQasmWithArgsAndQubits(Protocol): <NEW_LINE> <INDENT> def _qasm_(self, qubits: Tuple['cirq.Qid'], args: QasmArgs) -> Union[None, NotImplementedType, str]: <NEW_LINE> <INDENT> pass
An object that can be turned into QASM code if it knows its qubits. Returning `NotImplemented` or `None` means "don't know how to turn into QASM". In that case fallbacks based on decomposition and known unitaries will be used instead.
6259907216aa5153ce401db8
class Taxi(Car): <NEW_LINE> <INDENT> def __init__(self, name, fuel, price_per_km): <NEW_LINE> <INDENT> super().__init__(name, fuel) <NEW_LINE> self.price_per_km = price_per_km <NEW_LINE> self.current_fare_distance = 0 <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "{}, {}km on current fare, ${:.2f}/k...
Specialised version of a Car that includes fare costs.
6259907266673b3332c31cde
class SingleCycleLinkList(object): <NEW_LINE> <INDENT> def __init__(self, node=None): <NEW_LINE> <INDENT> self.__head = node <NEW_LINE> if node: <NEW_LINE> <INDENT> node.next = node <NEW_LINE> <DEDENT> <DEDENT> def is_empty(self): <NEW_LINE> <INDENT> return self.__head is None <NEW_LINE> <DEDENT> def length(self): <NEW...
单向循环链表功能的实现
625990727d847024c075dcb8
class classifyLinesOperation(abstractFilterOperation): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def apply(self, img, paramDict): <NEW_LINE> <INDENT> horizontal = [paramDict['h' + str(i)] for i in (1,2,3,4)] <NEW_LINE> verticals = [paramDict['v' + str(i)] for i in (1,2,3,4)] ...
Classify rows and columns as one or zero. One stands for 'yes there is a mouse in this line', zero stands for 'there is no mouse in this line'. The return type is a list containing two lists. The first with the classification of the rows and the second with classification of columns. Naturaly, the size of the first lis...
6259907267a9b606de547713
class XMLEncoder(object): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.bits = list() <NEW_LINE> <DEDENT> def encode(self, data, wrapper=None): <NEW_LINE> <INDENT> if wrapper: <NEW_LINE> <INDENT> self.bits.append('<%s>' % wrapper) <NEW_LINE> <DEDENT> self.toxml(data) <NEW_LINE> if wrapper: <NEW_LINE>...
XML in python doesn't have easy encoding or custom getter options like JSONEncoder so we do it ourselves.
62599072dd821e528d6da5f1
class Solution: <NEW_LINE> <INDENT> def isValidBST(self, root: TreeNode) -> bool: <NEW_LINE> <INDENT> if not root: <NEW_LINE> <INDENT> return True <NEW_LINE> <DEDENT> if not self.compare(root.left, root.val, True) or not self.compare(root.right, root.val, False): <NEW_LINE> <INDENT> return False <NEW_LINE> <DEDENT> ret...
cost: 180ms >5.03 https://leetcode.com/submissions/detail/212553748/
62599072627d3e7fe0e08767
class Trip: <NEW_LINE> <INDENT> VIEW = "view_trip" <NEW_LINE> EDIT = "change_trip" <NEW_LINE> CREATE = "add_trip" <NEW_LINE> DELETE = "delete_trip"
Trip permissions
625990722ae34c7f260ac9ca
class Post: <NEW_LINE> <INDENT> class Body(RefsBody): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> class Header(Schema): <NEW_LINE> <INDENT> X_GitHub_Media_Type = fields.String(data_key='X-GitHub-Media-Type', description='You can check the current version of media type in responses.\n') <NEW_LINE> Accept = fields.Strin...
Create a Reference
625990725fcc89381b266dc7
class DatestampedLogFile(BaseLogFile, object): <NEW_LINE> <INDENT> datestampFormat = DATE_FORMAT <NEW_LINE> def __init__(self, name, directory, defaultMode=None): <NEW_LINE> <INDENT> self.basePath = os.path.join(directory, name) <NEW_LINE> BaseLogFile.__init__(self, name, directory, defaultMode) <NEW_LINE> self.lastPat...
A LogFile which always logs to files suffixed with the current date. The date format used as a suffix is controlled by the `datestampFormat` attribute.
6259907263b5f9789fe86a43
class ValuesEqual(MapEqual): <NEW_LINE> <INDENT> transform = attrgetter('value')
Validates that the values of multiple elements are equal. A :class:`MapEqual` that compares the :attr:`~flatland.schema.base.Element.value` of each element. Example: .. testcode:: from flatland import Schema, String from flatland.validation import ValuesEqual class MyForm(Schema): password = String ...
62599072435de62698e9d6e6
class WinRMListener(msrest.serialization.Model): <NEW_LINE> <INDENT> _attribute_map = { 'protocol': {'key': 'protocol', 'type': 'str'}, 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, } <NEW_LINE> def __init__( self, *, protocol: Optional[Union[str, "ProtocolTypes"]] = None, certificate_url: Optional[str] ...
Describes Protocol and thumbprint of Windows Remote Management listener. :ivar protocol: Specifies the protocol of listener. :code:`<br>`:code:`<br>` Possible values are: :code:`<br>`\ **http** :code:`<br>`:code:`<br>` **https**. Possible values include: "Http", "Https". :vartype protocol: str or ~azure.mgmt.compute...
625990727b180e01f3e49cd4
class SelectButtonModeSelector(ModeSelectorComponent): <NEW_LINE> <INDENT> def __init__(self, mixer, buttons): <NEW_LINE> <INDENT> assert isinstance(mixer, MixerComponent) <NEW_LINE> assert isinstance(buttons, tuple) <NEW_LINE> assert len(buttons) == 8 <NEW_LINE> ModeSelectorComponent.__init__(self) <NEW_LINE> self._mi...
Class that reassigns buttons on the AxiomPro to different mixer functions
62599072796e427e53850058
class Index(Resource): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> return set_response_headers(jsonify(get_doc().entrypoint.get()))
Class for the EntryPoint.
6259907232920d7e50bc7927
class FacultyMemberSerializer(BaseFacultyMemberSerializer): <NEW_LINE> <INDENT> designation = serializers.CharField( source='get_designation_display', read_only=True, ) <NEW_LINE> class Meta: <NEW_LINE> <INDENT> model = swapper.load_model('kernel', 'FacultyMember') <NEW_LINE> fields = [ 'id', 'person', 'department', 'e...
Serializer for FacultyMember objects
62599072cc0a2c111447c741
class Mower: <NEW_LINE> <INDENT> def __init__(self, position: Position, orientation: Orientation, grid_size: Tuple[int, int]): <NEW_LINE> <INDENT> self._position = position <NEW_LINE> self._orientation = orientation <NEW_LINE> self._grid_size = grid_size <NEW_LINE> self._position.restrict_to_grid(self._grid_size) <NEW_...
A structure that encapsulates a mower's position and orientation.
6259907244b2445a339b75ce
class GraphConvolution(nn.Module): <NEW_LINE> <INDENT> def __init__(self, in_features, out_features, adjmat, bias=True): <NEW_LINE> <INDENT> super(GraphConvolution, self).__init__() <NEW_LINE> self.in_features = in_features <NEW_LINE> self.out_features = out_features <NEW_LINE> self.adjmat = adjmat <NEW_LINE> self.weig...
Simple GCN layer, similar to https://arxiv.org/abs/1609.02907.
625990723d592f4c4edbc7c2
class ZenodoJSONSerializer(JSONSerializer): <NEW_LINE> <INDENT> def preprocess_record(self, pid, record, links_factory=None): <NEW_LINE> <INDENT> result = super(ZenodoJSONSerializer, self).preprocess_record( pid, record, links_factory=links_factory ) <NEW_LINE> if isinstance(record, Record) and '_files' in record: <NEW...
Zenodo JSON serializer. Adds or removes files from depending on access rights and provides a context to the request serializer.
6259907221bff66bcd724548
class ChainComplexes(Category_module): <NEW_LINE> <INDENT> def super_categories(self): <NEW_LINE> <INDENT> from sage.categories.all import Fields, FreeModules, VectorSpaces <NEW_LINE> base_ring = self.base_ring() <NEW_LINE> if base_ring in Fields(): <NEW_LINE> <INDENT> return [VectorSpaces(base_ring)] <NEW_LINE> <DEDEN...
The category of all chain complexes over a base ring. EXAMPLES:: sage: ChainComplexes(RationalField()) Category of chain complexes over Rational Field sage: ChainComplexes(Integers(9)) Category of chain complexes over Ring of integers modulo 9 TESTS:: sage: TestSuite(ChainComplexes(RationalFie...
62599072a8370b77170f1cab
class SocialSerializer(serializers.Serializer): <NEW_LINE> <INDENT> code = serializers.CharField(allow_blank=False, trim_whitespace=True,)
Serializer which accepts an OAuth2 code.
6259907255399d3f05627dfa
class Tag(models.Model): <NEW_LINE> <INDENT> STATUS_NORMAL = 1 <NEW_LINE> STATUS_DELETE = 0 <NEW_LINE> STATUS_ITEMS = ( (STATUS_NORMAL, '正常'), (STATUS_DELETE, '删除'), ) <NEW_LINE> name = models.CharField(max_length=10, verbose_name="名称") <NEW_LINE> status = models.PositiveIntegerField(default=STATUS_NORMAL, choices=STAT...
Docstring for Tag.
6259907267a9b606de547714
class PasswordUpdateView(LoginRequiredMixin, NextMixin , FormMessageMixin, generic.FormView): <NEW_LINE> <INDENT> template_name = 'account/password_update.html' <NEW_LINE> form_class = PasswordChangeForm <NEW_LINE> default_next_url = reverse_lazy('kdo-profile-update') <NEW_LINE> form_valid_message = _("Your password ha...
Update the current user's password.
6259907297e22403b383c7e4
class XToolTimeoutError(AssertionError): <NEW_LINE> <INDENT> def __init__(self, value="Timed Out"): <NEW_LINE> <INDENT> self.value = value <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return repr(self.value)
Thrown when a timeout occurs in the `timeout` context manager.
62599072097d151d1a2c2954
class TypeOfApp(models.Model): <NEW_LINE> <INDENT> app_name = models.CharField(u'应用名字',max_length=255) <NEW_LINE> update_time = models.DateTimeField(u'更新时间', auto_now=True) <NEW_LINE> def __str__(self): <NEW_LINE> <INDENT> return self.app_name <NEW_LINE> <DEDENT> class Meta: <NEW_LINE> <INDENT> verbose_name = '应用类型' <N...
记录app信息到
625990725fcc89381b266dc8
class EcbMode(object): <NEW_LINE> <INDENT> def __init__(self, block_cipher): <NEW_LINE> <INDENT> self._state = VoidPointer() <NEW_LINE> result = raw_ecb_lib.ECB_start_operation(block_cipher.get(), self._state.address_of()) <NEW_LINE> if result: <NEW_LINE> <INDENT> raise ValueError("Error %d while instatiating the ECB m...
*Electronic Code Book (ECB)*. This is the simplest encryption mode. Each of the plaintext blocks is directly encrypted into a ciphertext block, independently of any other block. This mode is dangerous because it exposes frequency of symbols in your plaintext. Other modes (e.g. *CBC*) should be used instead. See `NIS...
625990723346ee7daa3382d0
class UndeclaredKeyError(Exception): <NEW_LINE> <INDENT> pass
Indicates that a key was required but not predeclared.
62599072435de62698e9d6e8
class _ServingEnvToAsync(AsyncVectorEnv): <NEW_LINE> <INDENT> def __init__(self, serving_env, preprocessor=None): <NEW_LINE> <INDENT> self.serving_env = serving_env <NEW_LINE> self.prep = preprocessor <NEW_LINE> self.action_space = serving_env.action_space <NEW_LINE> if preprocessor: <NEW_LINE> <INDENT> self.observatio...
Internal adapter of ServingEnv to AsyncVectorEnv.
6259907238b623060ffaa4c5
class TestEnvSetup(unittest.TestCase): <NEW_LINE> <INDENT> def test_init(self): <NEW_LINE> <INDENT> venv = Environment("testName") <NEW_LINE> self.assertEqual(venv.name, "testName") <NEW_LINE> <DEDENT> def test_foo(self): <NEW_LINE> <INDENT> pass
Test the environment properly initialises
62599072167d2b6e312b8200
class Object(Visitable): <NEW_LINE> <INDENT> def __init__(self, name, type): <NEW_LINE> <INDENT> self._visitorName = 'visit_object' <NEW_LINE> self.name = name <NEW_LINE> self.typeName = type
This class represents the AST node for a pddl object.
62599072379a373c97d9a902
class Tag(db.Model): <NEW_LINE> <INDENT> id = db.Column(db.Integer, primary_key=True)
tag model
625990727b180e01f3e49cd5
class Stopwatch: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.reset() <NEW_LINE> self.start() <NEW_LINE> <DEDENT> def reset(self): <NEW_LINE> <INDENT> self.elapsed = datetime.timedelta(0) <NEW_LINE> with contextlib.suppress(AttributeError): <NEW_LINE> <INDENT> del self.start_time <NEW_LINE> <DEDENT>...
A simple stopwatch which starts automatically. >>> w = Stopwatch() >>> _1_sec = datetime.timedelta(seconds=1) >>> w.split() < _1_sec True >>> import time >>> time.sleep(1.0) >>> w.split() >= _1_sec True >>> w.stop() >= _1_sec True >>> w.reset() >>> w.start() >>> w.split() < _1_sec True It should be possible to launch...
62599072aad79263cf430098
class Schemas(object): <NEW_LINE> <INDENT> IMAGE_SCHEMA = '/v2/schemas/image' <NEW_LINE> IMAGES_SCHEMA = '/v2/schemas/images' <NEW_LINE> IMAGE_MEMBER_SCHEMA = '/v2/schemas/member' <NEW_LINE> IMAGE_MEMBERS_SCHEMA = '/v2/schemas/members' <NEW_LINE> TASK_SCHEMA = '/v2/schemas/task' <NEW_LINE> TASKS_SCHEMA = '/v2/schemas/t...
@summary: Types denoting a schema
625990724f6381625f19a11a
class GetVideoResultSet(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. ((json) The response from Khan Academy.)
62599072ac7a0e7691f73dcc
@attrs(auto_attribs=True) <NEW_LINE> class MeasureValuePair(object): <NEW_LINE> <INDENT> measure: Measure <NEW_LINE> value: CheaperFraction <NEW_LINE> @classmethod <NEW_LINE> def from_string_list(cls, string_pairs: str): <NEW_LINE> <INDENT> result = ( value.split('=')[:2] for value in string_pairs ) <NEW_LINE> return [...
A duplet, usually used for scripting a chart with freeform data.
6259907256b00c62f0fb41b2
class TestBaseReporter(unittest.TestCase): <NEW_LINE> <INDENT> def test_report_mongo_command_raises_not_implemented_error(self): <NEW_LINE> <INDENT> reporter = mongodog.reporters.BaseReporter() <NEW_LINE> self.assertRaises(NotImplementedError, reporter.report_mongo_command, {})
Unit tests for BaseReporter class
62599072a8370b77170f1cad
class Registro0001(Registro): <NEW_LINE> <INDENT> campos = [ CampoFixo(1, 'REG', '0001'), Campo(2, 'IND_MOV'), ]
ABERTURA DO BLOCO 0
625990724428ac0f6e659e17
class Server(threading.Thread): <NEW_LINE> <INDENT> def __init__(self, port): <NEW_LINE> <INDENT> self.chunk_queue = Queue.Queue() <NEW_LINE> self.port = port <NEW_LINE> self._abort = False <NEW_LINE> threading.Thread.__init__(self) <NEW_LINE> <DEDENT> def run(self): <NEW_LINE> <INDENT> print('Server is Running') <NEW_...
Server class that should be run on each machine that wants to act as a computational entity for the system. Extends threading. Thread to make the server threaded and thus nonblocking
62599072a219f33f346c80ed
class AutoMinorLocator(Locator): <NEW_LINE> <INDENT> def __init__(self, n=None): <NEW_LINE> <INDENT> self.ndivs = n <NEW_LINE> <DEDENT> def __call__(self): <NEW_LINE> <INDENT> if self.axis.get_scale() == 'log': <NEW_LINE> <INDENT> warnings.warn('AutoMinorLocator does not work with logarithmic ' 'scale') <NEW_LINE> retu...
Dynamically find minor tick positions based on the positions of major ticks. The scale must be linear with major ticks evenly spaced.
62599072f548e778e596ce70
class TestVarUnitsToKelvin(BaseTest): <NEW_LINE> <INDENT> def test_subprocess_called_correctly(self): <NEW_LINE> <INDENT> fix = VarUnitsToKelvin('ts_components.nc', '/a') <NEW_LINE> fix.apply_fix() <NEW_LINE> self.mock_subprocess.assert_called_once_with( "ncatted -h -a units,ts,o,c,'K' " "/a/ts_components.nc", stderr=s...
Test VarUnitsToKelvin
6259907255399d3f05627dfc
class NullAction (Action): <NEW_LINE> <INDENT> def __init__ (self, manager, prop_set): <NEW_LINE> <INDENT> assert isinstance(prop_set, property_set.PropertySet) <NEW_LINE> Action.__init__ (self, manager, [], None, prop_set) <NEW_LINE> <DEDENT> def actualize (self): <NEW_LINE> <INDENT> if not self.actualized_: <NEW_LINE...
Action class which does nothing --- it produces the targets with specific properties out of nowhere. It's needed to distinguish virtual targets with different properties that are known to exist, and have no actions which create them.
625990724f88993c371f1192
class StdOutListener(StreamListener): <NEW_LINE> <INDENT> def on_status(self, status): <NEW_LINE> <INDENT> text = status.text <NEW_LINE> try: <NEW_LINE> <INDENT> Coords.update(status.coordinates) <NEW_LINE> XY = (Coords.get('coordinates')) <NEW_LINE> <DEDENT> except: <NEW_LINE> <INDENT> Box = status.place.bounding_box....
A listener handles tweets that are the received from the stream. This is a basic listener that inserts tweets into MySQLdb.
6259907291f36d47f2231b00
class HTTPTransparentRedirect(Exception): <NEW_LINE> <INDENT> def __init__(self, url): <NEW_LINE> <INDENT> super(HTTPTransparentRedirect, self).__init__(url) <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "url=%r" % self.args[0] <NEW_LINE> <DEDENT> def __repr__(self): <NEW_LINE> <INDENT> return "%s(u...
Raising an instance of HTTPTransparentRedirect will cause the Application to silently redirect a request to a new URL.
6259907297e22403b383c7e6