code stringlengths 4 4.48k | docstring stringlengths 1 6.45k | _id stringlengths 24 24 |
|---|---|---|
class UserLogPageViewMixin(object): <NEW_LINE> <INDENT> @method_decorator(user_log_page_view) <NEW_LINE> def dispatch(self, request, *args, **kwargs): <NEW_LINE> <INDENT> return super(UserLogPageViewMixin, self).dispatch(request, *args, **kwargs) | A simple mix-in class to write an event on every request to the view.
events are written using the `user_log_page_view` decorator. | 62599077bf627c535bcb2e62 |
class RiskDecomposition(object): <NEW_LINE> <INDENT> def __init__(self, utility): <NEW_LINE> <INDENT> self.utility = utility <NEW_LINE> self.sdf_tree = BigStorageTree(utility.period_len, utility.decision_times) <NEW_LINE> self.sdf_tree.set_value(0, np.array([1.0])) <NEW_LINE> n = len(self.sdf_tree) <NEW_LINE> self.expe... | Calculate and save analysis of output from the EZ-Climate model.
Parameters
----------
utility : `Utility` object
object of utility class
Attributes
----------
utility : `Utility` object
object of utility class
sdf_tree : `BaseStorageTree` object
SDF for each node
expected_damages : ndarray
expected d... | 62599077aad79263cf43014d |
class Normalizer: <NEW_LINE> <INDENT> def __init__( self, key, center_axis=None, scale_axis=None, storage_dir=None, name=None ): <NEW_LINE> <INDENT> self.key = key <NEW_LINE> self.center_axis = None if center_axis is None else tuple(center_axis) <NEW_LINE> self.scale_axis = None if scale_axis is None else tuple(scale_a... | perform global mean and scale normalization.
| 625990773346ee7daa33832a |
class NotFound(EsStatsException): <NEW_LINE> <INDENT> pass | Exception raised when expected information is not found. | 62599077091ae356687065cf |
class FLMResidual(Layer): <NEW_LINE> <INDENT> def __init__(self, units, activation=None, kernel_initializer=None, batch_normalization=False, depth=None, feature_linear_modulation=False, unmatched_dimensions=False): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> assert( activation is not None ) <NEW_LINE> assert( ker... | Implements residual layer (Kaiming He et al., 2015)
Added batch normalization option
Add feature wise linear modulation
NOTE: if input and output dimensions are not equal
specify unmatched_dimensions=True, the residual
layer becomes: f(x) + A*x
instead of: f(x) + x | 625990775166f23b2e244d6c |
class ResPartner(geo_model.GeoModel): <NEW_LINE> <INDENT> _inherit = "res.partner" <NEW_LINE> geo_point = fields.GeoPoint('Addresses coordinate') | Add geo_point to partner using a function filed | 62599077a8370b77170f1d63 |
class ClosedPosition(Position): <NEW_LINE> <INDENT> def add_transaction(self, transaction): <NEW_LINE> <INDENT> self.basis += transaction.shares * transaction.open_price <NEW_LINE> self.mktval += transaction.shares * transaction.close_price <NEW_LINE> self.transactions.append(transaction) | Position subclass specifically for closed positions.
| 625990779c8ee82313040e52 |
class Query(ObjectType): <NEW_LINE> <INDENT> info = String() <NEW_LINE> devices = List(Device, pattern=String()) <NEW_LINE> device = Field(Device, name=String(required=True)) <NEW_LINE> domains = List(Domain, pattern=String()) <NEW_LINE> families = List(Family, domain=String(), pattern=String()) <NEW_LINE> members = Li... | This class contains all the queries. | 625990774428ac0f6e659ec5 |
class DescribeTimerScalingPoliciesResponse(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.TimerScalingPolicies = None <NEW_LINE> self.TotalCount = None <NEW_LINE> self.RequestId = None <NEW_LINE> <DEDENT> def _deserialize(self, params): <NEW_LINE> <INDENT> if params.get("TimerScalingPo... | DescribeTimerScalingPolicies返回参数结构体
| 625990774e4d562566373d99 |
class OfficialDocument(models.Model): <NEW_LINE> <INDENT> _name = 'school.official_document' <NEW_LINE> _inherit = ['mail.activity.mixin'] <NEW_LINE> name = fields.Char('Name',compute='compute_name') <NEW_LINE> @api.depends('student_id.name','type_id.name') <NEW_LINE> def compute_name(self): <NEW_LINE> <INDENT> for doc... | Official Document | 6259907723849d37ff852a4d |
class ExampleParser(transform.Transform): <NEW_LINE> <INDENT> def __init__(self, features): <NEW_LINE> <INDENT> super(ExampleParser, self).__init__() <NEW_LINE> if isinstance(features, dict): <NEW_LINE> <INDENT> self._ordered_features = collections.OrderedDict(sorted(features.items( ), key=lambda f: f[0])) <NEW_LINE> <... | A Transform that parses serialized `tensorflow.Example` protos. | 62599077627d3e7fe0e0881e |
class InfoLoggingEventSubscriber(LoggingEventSubscriber): <NEW_LINE> <INDENT> event_id = LOGGING_INFO_EVENT_ID | Event Notification Subscriber for informational logging events.
The "origin" parameter in this class' initializer should be the process' exchange name (TODO: correct?) | 62599077adb09d7d5dc0bf00 |
class Tag(models.Model): <NEW_LINE> <INDENT> name = models.CharField(max_length=20, unique=True) <NEW_LINE> used_count = models.IntegerField(default=1) <NEW_LINE> created_at = models.DateTimeField(auto_now_add=True) <NEW_LINE> def __unicode__(self): <NEW_LINE> <INDENT> return self.name <NEW_LINE> <DEDENT> class Meta: <... | 标签的数据模型 | 625990778a349b6b43687bf1 |
class Softsign(OnnxOpConverter): <NEW_LINE> <INDENT> @classmethod <NEW_LINE> def _impl_v1(cls, inputs, attr, params): <NEW_LINE> <INDENT> return inputs[0] / (_expr.const(1.) + Absolute.get_converter(1)(inputs, attr, params)) | Operator converter for Softsign.
| 62599077f9cc0f698b1c5f97 |
class Regular(_BaseTile): <NEW_LINE> <INDENT> pass | Regular tile. Does nothing. | 6259907744b2445a339b7629 |
class SecurityError(Exception): <NEW_LINE> <INDENT> pass | Raised when an action is denied due to security settings.
| 625990772c8b7c6e89bd5180 |
class GeniusTestHub(GeniusHubBase): <NEW_LINE> <INDENT> def __init__(self, zones_json, device_json, debug=None) -> None: <NEW_LINE> <INDENT> super().__init__("test_hub", username="test", debug=debug) <NEW_LINE> _LOGGER.info("Using GeniusTestHub()") <NEW_LINE> self._test_json["zones"] = zones_json <NEW_LINE> self._test_... | The test class for a Genius Hub - uses a test file. | 625990775fdd1c0f98e5f914 |
class Solution2: <NEW_LINE> <INDENT> def countConsistentStrings(self, allowed: str, words: List[str]) -> int: <NEW_LINE> <INDENT> consistent = 0 <NEW_LINE> for word in words: <NEW_LINE> <INDENT> if len(set(word).difference(allowed)) == 0: <NEW_LINE> <INDENT> consistent += 1 <NEW_LINE> <DEDENT> <DEDENT> return consisten... | Using hash set, for each word compare (letters) difference between a word and allowed.
Runtime: 288 ms, faster than 18.49% of Python3
Memory Usage: 16 MB, less than 92.44% of Python3
Time complexity: O(n*k)
Space complexity: O(1) | 6259907701c39578d7f14400 |
class D2(D1): <NEW_LINE> <INDENT> pass | Absorbs both verticalls | 6259907732920d7e50bc79df |
class TileCache: <NEW_LINE> <INDENT> def __init__(self, width=32, height=None): <NEW_LINE> <INDENT> self.width = width <NEW_LINE> self.height = height or width <NEW_LINE> self.cache = {} <NEW_LINE> <DEDENT> def __getitem__(self, filename): <NEW_LINE> <INDENT> key = (filename, self.width, self.height) <NEW_LINE> try: <... | Load the tilesets lazily into global cache | 62599077be8e80087fbc0a2b |
class ImageDQ: <NEW_LINE> <INDENT> def __init__(self, data, dqparser=None): <NEW_LINE> <INDENT> ndim = 2 <NEW_LINE> data = np.asarray(data) <NEW_LINE> if data.ndim != ndim: <NEW_LINE> <INDENT> raise ValueError( f'Expected ndim={ndim} but data has ndim={data.ndim}') <NEW_LINE> <DEDENT> if 'int' not in data.dtype.name: <... | Class to handle DQ flags in an image.
Parameters
----------
data : ndarray
DQ data array to interpret.
dqparser : `DQParser` or `None`
DQ parser for interpretation. If not given, default is used.
Attributes
----------
data : ndarray
Same as input.
parser : `DQParser`
DQ parser for interpretation.
R... | 62599077aad79263cf430150 |
class IRequestHandlerStream(IFileStream): <NEW_LINE> <INDENT> def __init__(self, handler): <NEW_LINE> <INDENT> self.handler = handler <NEW_LINE> super(IRequestHandlerStream, self).__init__(handler.rfile) | SocketServer request handler input stream | 62599077a17c0f6771d5d879 |
class Portfolio(Base): <NEW_LINE> <INDENT> __tablename__ = 'portfolio' <NEW_LINE> username = Column(Text, primary_key=True) <NEW_LINE> stocks = Column(Unicode) | Create DB for unique user stock portfolio. | 625990775fdd1c0f98e5f915 |
class DirtyStrike(VariableStrike): <NEW_LINE> <INDENT> def __init__(self, T, K, A): <NEW_LINE> <INDENT> super(DirtyStrike, self).__init__(T, K) <NEW_LINE> self._A = A <NEW_LINE> <DEDENT> def strike(self, t): <NEW_LINE> <INDENT> ti = 0 <NEW_LINE> accC = 0 <NEW_LINE> for i in self._A.times: <NEW_LINE> <INDENT> if i > t: ... | Create a strike that is adjusted for outstanding interest. | 6259907755399d3f05627eab |
class TopologySpec(object): <NEW_LINE> <INDENT> def __init__(self, specs): <NEW_LINE> <INDENT> if not _as_set(specs).issuperset(set(["name", "topology"])): <NEW_LINE> <INDENT> raise InvalidTopologyError( "Each topology must specify tags 'name' and 'topology'" " Found: {0}".format(_as_list(specs))) <NEW_LINE> <DEDENT> s... | Topology level specification class. | 62599077a05bb46b3848bdf6 |
class RegUsers(Resource): <NEW_LINE> <INDENT> @staticmethod <NEW_LINE> @register_user_api.expect(user_register) <NEW_LINE> def post(): <NEW_LINE> <INDENT> parser = reqparse.RequestParser() <NEW_LINE> parser.add_argument('name', type=str, help='Rate cannot be converted', location=['json']) <NEW_LINE> parser.add_argument... | User Registration | 62599077796e427e53850111 |
class AggregatingRootSubclass(AggregatingRoot): <NEW_LINE> <INDENT> pass | Subclass of a class with aggregates. | 62599077627d3e7fe0e08820 |
class constrainOR(Constrain): <NEW_LINE> <INDENT> def __init__(self, list_constrains): <NEW_LINE> <INDENT> self._c = list_constrains <NEW_LINE> <DEDENT> def evaluate(self, x): <NEW_LINE> <INDENT> out = -np.inf <NEW_LINE> for constrain in self._c: <NEW_LINE> <INDENT> out = np.max((out, constrain.evaluate(x))) <NEW_LINE>... | inequality constraints | 6259907767a9b606de547771 |
class TokenStateModification: <NEW_LINE> <INDENT> def __init__(self, modification: Callable[[RunningToken], None]) -> None: <NEW_LINE> <INDENT> self.modification = modification <NEW_LINE> <DEDENT> @pedantic <NEW_LINE> def change_token(self, token: RunningToken) -> None: <NEW_LINE> <INDENT> token_before = token.copy() <... | This class defines a modification on a RunningToken and changes it via a
defined callable function. | 6259907744b2445a339b762a |
class Session(ndb.Model): <NEW_LINE> <INDENT> name = ndb.StringProperty(required=True) <NEW_LINE> highlights = ndb.StringProperty() <NEW_LINE> speaker = ndb.StringProperty() <NEW_LINE> duration = ndb.IntegerProperty() <NEW_LINE> typeOfSession = ndb.StringProperty() <NEW_LINE> date ... | Session -- Session object | 62599077460517430c432d25 |
class VenueTest(BaseTest, unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.location = telegram.Location(longitude=1., latitude=0.) <NEW_LINE> self.title = 'title' <NEW_LINE> self._address = '_address' <NEW_LINE> self.foursquare_id = 'foursquare id' <NEW_LINE> self.json_dict = { 'locatio... | This object represents Tests for Telegram Venue. | 6259907799fddb7c1ca63aa2 |
class NoSuchMatcherException(Exception): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> super(NoSuchMatcherException, self).__init__("No such matcher: %s" % name) | to be thrown when no matcher with a given name was found | 6259907799cbb53fe683287e |
class MapsNoVsync(MapsBenchmark): <NEW_LINE> <INDENT> tag = 'novsync' <NEW_LINE> @classmethod <NEW_LINE> def Name(cls): <NEW_LINE> <INDENT> return 'maps.novsync' <NEW_LINE> <DEDENT> def SetExtraBrowserOptions(self, options): <NEW_LINE> <INDENT> options.AppendExtraBrowserArgs('--disable-gpu-vsync') | Runs the Google Maps benchmark with Vsync disabled | 6259907732920d7e50bc79e1 |
class TestViewtopicPhpbbB6T2259706ffset15(unittest.TestCase): <NEW_LINE> <INDENT> def setUp(self): <NEW_LINE> <INDENT> self.board_id = 6 <NEW_LINE> self.topic_id = 2259706 <NEW_LINE> self.offset = 15 <NEW_LINE> self.html_path = os.path.join('tests', 'phpbb.b6.t2259706.offset15.htm') <NEW_LINE> with open(self.html_path,... | phpBB v3
https://www.phpbb.com/community/viewtopic.php?f=6&t=2259706&start=15
Has an attachment class without any file/link/image | 62599077ad47b63b2c5a91e8 |
class Wheat(Crop): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__(1,3,6) <NEW_LINE> self._type = "Wheat" <NEW_LINE> <DEDENT> def grow(self,light,water): <NEW_LINE> <INDENT> if light >= self._light_need and water >= self._water_need: <NEW_LINE> <INDENT> if self._status == "Seedling" and wat... | a wheat crop | 62599077aad79263cf430152 |
class _Attribute(object): <NEW_LINE> <INDENT> def __init__(self, name, help_text=None, required=False, fallthroughs=None, completer=None, value_type=None): <NEW_LINE> <INDENT> if re.search(r'[A-Z]', name) and re.search('r[a-z]', name): <NEW_LINE> <INDENT> raise ValueError( 'Invalid attribute name [{}]: Attribute names ... | A base class for concept attributes.
Attributes:
name: The name of the attribute. Used primarily to control the arg or flag
name corresponding to the attribute. Must be in all lower case.
help_text: String describing the attribute's relationship to the concept,
used to generate help for an attribute flag.
... | 625990772ae34c7f260aca80 |
class StartUp: <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.font = 'big' <NEW_LINE> <DEDENT> def on_start_up(self): <NEW_LINE> <INDENT> custom_fig = Figlet(font=self.font) <NEW_LINE> application_name = custom_fig.renderText("Tweeting Mill") <NEW_LINE> iteration = "v.0.1.0 - A Twitter CLI Tool" <NEW_... | On Start up this will display an options page of the CLI tool
with a nice ASCII terminal banner | 625990772c8b7c6e89bd5183 |
@api_rest.route('/totalProducts/') <NEW_LINE> class DeleteProduct(SecureResource): <NEW_LINE> <INDENT> def get(self): <NEW_LINE> <INDENT> return total_products() | Unsecure Resource Class: Inherit from Resource | 625990777d43ff24874280e1 |
class NotProvided: <NEW_LINE> <INDENT> pass | Simple class to be used as constant for default parameters.
The goal is to be able to pass explicitly ``None``
Examples
--------
>>> def foo(param=NotProvided):
... if param is NotProvided:
... print('Param not provided')
... elif param is None:
... print('Param is None')
... else:
... ... | 625990774e4d562566373d9d |
class TestDB(unittest.TestCase): <NEW_LINE> <INDENT> def test_insertar(self): <NEW_LINE> <INDENT> client = MongoClient('localhost',27017) <NEW_LINE> dbUsuario = client.usuarios.usuarios <NEW_LINE> DAO.insertarNuevoUsuario(555) <NEW_LINE> cursor = dbUsuario.find_one({'_id':555}) <NEW_LINE> self.assertTrue(cursor != None... | def setUp(self):
client = MongoClient('localhost',27017)
dbUsuario = client.usuarios.usuarios
#print(dbUsuario.remove({'_id':555}))
return | 62599077796e427e53850113 |
class NestedValidationError(ValidationError): <NEW_LINE> <INDENT> def __init__(self, message): <NEW_LINE> <INDENT> if isinstance(message, dict): <NEW_LINE> <INDENT> self._messages = [message] <NEW_LINE> <DEDENT> else: <NEW_LINE> <INDENT> self._messages = message <NEW_LINE> <DEDENT> <DEDENT> @property <NEW_LINE> def mes... | The default ValidationError behavior is to stringify each item in the list
if the messages are a list of error messages.
In the case of nested serializers, where the parent has many children,
then the child's `serializer.errors` will be a list of dicts. In the case
of a single child, the `serializer.errors` will be a... | 62599077d486a94d0ba2d952 |
class MightySummoner(Feature): <NEW_LINE> <INDENT> name = "Mighty Summoner" <NEW_LINE> source = "Druid (Circle of the Shepherd)" | Starting at 6th level, beasts and fey that you conjure are more resilient
than normal. Any beast or fey summoned or created by a spell that you cast
gains the. following benefits:
-- The creature appears with more hit points than normal: 2 extra hit
points per Hit Die it has.
-- The damage from its natural weapons is... | 625990774f88993c371f11ee |
@irc_message_representation <NEW_LINE> class InviteMessage(MessageType("invite", ["user", "channel"])): <NEW_LINE> <INDENT> pass | Invites the user of the given nickname to join the specified channel. | 625990778a349b6b43687bf5 |
class CodeRegionType: <NEW_LINE> <INDENT> VALID_CODE_REGIONS_COUNT = 4 <NEW_LINE> ANNOTATIONS, BUG_REPRODUCER_ASSISTANT, FUNCTION, CLASS = range(VALID_CODE_REGIONS_COUNT) | Enum constants to classify "code regions", for instance: class, function, etc. | 62599077aad79263cf430153 |
class AIThreadEvent(Event): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> super().__init__() <NEW_LINE> self.connected=False | Helper class so I can tell the calling engine that we connected okay | 62599077d268445f2663a82b |
class DanaEquivalence(unittest.TestCase): <NEW_LINE> <INDENT> def test_connections_random(self): <NEW_LINE> <INDENT> for pycon, ccon, src_shape, tgt_shape, wgt_shape in [ (pydana.OneToOne, cdana.OneToOne, 4, 4, 4), (pydana.OneToAll, cdana.OneToAll, 4, 4, 4), (pydana.AssToMot, cdana.AssToMot, 16, 4, 4), (pydana.... | Tests aimed at verifying that dana and cdana produce the exact same ouputs. | 6259907744b2445a339b762b |
class MSC(EECert): <NEW_LINE> <INDENT> def __init__(self, pem): <NEW_LINE> <INDENT> self.policy_binding = None <NEW_LINE> super().__init__(pem) <NEW_LINE> assert self.validate() <NEW_LINE> <DEDENT> def parse(self, pem): <NEW_LINE> <INDENT> certs = pem_to_certs(pem) <NEW_LINE> if not certs: <NEW_LINE> <INDENT> return <N... | Multi-signature certificate. | 625990774c3428357761bc52 |
class FileListView(generic.ListView): <NEW_LINE> <INDENT> model = UploadFile | アップロードされたファイルの一覧ページ | 6259907799cbb53fe6832880 |
class FrameAnnotation(Annotation): <NEW_LINE> <INDENT> def __init__(self, nbsock): <NEW_LINE> <INDENT> self.nbsock = nbsock <NEW_LINE> self.buf = None <NEW_LINE> self.lnum = 0 <NEW_LINE> self.disabled = False <NEW_LINE> self.is_set = False <NEW_LINE> self.sernum = nbsock.sernum.last <NEW_LINE> <DEDENT> def set_buf_lnum... | The frame annotation is the sign set in the current frame. | 6259907763b5f9789fe86b00 |
@alias <NEW_LINE> class Type(BlogCollaboratorType): <NEW_LINE> <INDENT> pass | Short blog type alias | 6259907756b00c62f0fb426d |
class IpAddress(Model): <NEW_LINE> <INDENT> _validation = { 'ports': {'required': True}, 'type': {'required': True, 'constant': True}, 'fqdn': {'readonly': True}, } <NEW_LINE> _attribute_map = { 'ports': {'key': 'ports', 'type': '[Port]'}, 'type': {'key': 'type', 'type': 'str'}, 'ip': {'key': 'ip', 'type': 'str'}, 'dns... | IP address for the container group.
Variables are only populated by the server, and will be ignored when
sending a request.
:param ports: The list of ports exposed on the container group.
:type ports: list[~azure.mgmt.containerinstance.models.Port]
:ivar type: Specifies if the IP is exposed to the public internet. De... | 6259907732920d7e50bc79e3 |
class Group(Statement): <NEW_LINE> <INDENT> def __init__(self, identifier, group_statements, validate_identifier = True): <NEW_LINE> <INDENT> if not isinstance(group_statements, GroupStatements): <NEW_LINE> <INDENT> raise TypeError("group_statements is not an instance of GroupStatements") <NEW_LINE> <DEDENT> self.state... | Represents a PDS group statement.
Parameters
- `identifier` (:obj:`str`)
Identifier of the group.
- `group_statements` (:class:`GroupStatements`)
Nested statements of the group.
- `validate_identifier` (:obj:`True` or :obj:`False`)
Whether `identifier` should be checked to see if it'... | 62599077e1aae11d1e7cf4dd |
class WekaBayes(object): <NEW_LINE> <INDENT> def __init__(self, labels, algorithm='K2'): <NEW_LINE> <INDENT> self.algorithm = algorithm <NEW_LINE> self.labels = deepcopy(labels) <NEW_LINE> self.model = None <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return "WekaBayes(algorithm='{}')".format(self.algorit... | I don't care anymore - Phil Collins
We don't need no water let the motherfucker burn. | 62599077ec188e330fdfa242 |
class ProductImage(models.Model): <NEW_LINE> <INDENT> image = models.ImageField(upload_to='products') <NEW_LINE> product = models.ForeignKey(Product, related_name='images', on_delete=models.CASCADE) | Каритнки к продукту | 625990771f5feb6acb164591 |
class DetectorDevice(models.Model): <NEW_LINE> <INDENT> externalId = models.CharField(max_length=32, unique=True) <NEW_LINE> def getDict(self): <NEW_LINE> <INDENT> dict = {} <NEW_LINE> dict['deviceId'] = self.externalId <NEW_LINE> return dict <NEW_LINE> <DEDENT> def __str__(self): <NEW_LINE> <INDENT> return self.extern... | device which detects beacons, now only cellphones | 62599077ad47b63b2c5a91ea |
class CompareReport: <NEW_LINE> <INDENT> file = None <NEW_LINE> def __init__(self, index, reason): <NEW_LINE> <INDENT> self.index = index <NEW_LINE> self.reason = reason | When two files don't match, this tells you how they don't match
This is necessary because the system that is doing the actual
comparing may not be the one printing out the reports. For speed
the compare information can be pipelined back to the client
connection as an iter of CompareReports. | 62599077a17c0f6771d5d87b |
class Verbosity(Enum): <NEW_LINE> <INDENT> minimal = 0 <NEW_LINE> normal = 1 <NEW_LINE> verbose = 2 <NEW_LINE> very_verbose = 3 <NEW_LINE> def __ge__(self, other): <NEW_LINE> <INDENT> if self.__class__ is other.__class__: <NEW_LINE> <INDENT> return self.value >= other.value <NEW_LINE> <DEDENT> return NotImplemented <NE... | Verbosity enum. | 625990779c8ee82313040e55 |
class DBScraper(DatedScraper): <NEW_LINE> <INDENT> options_form = DBScraperForm <NEW_LINE> def _login(self, username, password): <NEW_LINE> <INDENT> pass <NEW_LINE> <DEDENT> def _initialize(self): <NEW_LINE> <INDENT> self._login(self.options['username'], self.options['password']) | Base class for (dated) scrapers that require a login | 625990774428ac0f6e659ecb |
class ACLToken(rdfvalue.RDFProtoStruct): <NEW_LINE> <INDENT> protobuf = flows_pb2.ACLToken <NEW_LINE> supervisor = False <NEW_LINE> def Copy(self): <NEW_LINE> <INDENT> result = super(ACLToken, self).Copy() <NEW_LINE> result.supervisor = False <NEW_LINE> return result <NEW_LINE> <DEDENT> def CheckExpiry(self): <NEW_LINE... | The access control token. | 6259907760cbc95b06365a3b |
class IBanner(form.Schema, IImageScaleTraversable): <NEW_LINE> <INDENT> image = NamedBlobImage( title=_(u"Banner Image"), required=True, ) <NEW_LINE> text = RichText( title=_(u"Formated Banner Text"), description=_(u"Optional banner text with html formatting. If you " u"leave this field empty the description will be us... | A singel banner containing images and captions | 6259907776e4537e8c3f0f1b |
class IndexPage: <NEW_LINE> <INDENT> allowed_methods = {'GET', 'POST'} <NEW_LINE> @faucets.produces('text/html', 'application/json') <NEW_LINE> @faucets.consumes('text/html') <NEW_LINE> @faucets.template('index.html') <NEW_LINE> def get(self, data, name, **query): <NEW_LINE> <INDENT> return {'name': name} <NEW_LINE> <D... | The IndexPage class is the handler for two of the routes below.
See the app.routes.add calls down below for more details on how
this class is used by the application. | 625990778a349b6b43687bf7 |
class seriousAdverseOutcomeProp(SchemaProperty): <NEW_LINE> <INDENT> _prop_schema = 'seriousAdverseOutcome' <NEW_LINE> _expected_schema = 'MedicalEntity' <NEW_LINE> _enum = False <NEW_LINE> _format_as = "ForeignKey" | SchemaField for seriousAdverseOutcome
Usage: Include in SchemaObject SchemaFields as your_django_field = seriousAdverseOutcomeProp()
schema.org description:A possible serious complication and/or serious side effect of this therapy. Serious adverse outcomes include those that are life-threatening; result in death, dis... | 62599077f9cc0f698b1c5f9a |
class ProjectedWaitResource(Resource): <NEW_LINE> <INDENT> def __init__(self, population): <NEW_LINE> <INDENT> Resource.__init__(self) <NEW_LINE> self.population = population <NEW_LINE> <DEDENT> def render_GET(self, request): <NEW_LINE> <INDENT> start = time.time() - 24 * 60 * 60 <NEW_LINE> end = start + 1 * 60 *60 <NE... | I estimate the average wait time over the next hour by calculating the
average waittime over this hour yesterday. | 625990777c178a314d78e8b9 |
class Divide(Node): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> Node.__init__(self, name=name) <NEW_LINE> self.numerator = core.Port(name=self.__own__("numerator")) <NEW_LINE> self.denominator = core.Port(name=self.__own__("denominator")) <NEW_LINE> self._inputs.extend([self.numerator, self.denomi... | Compute the ratio of two inputs. | 625990774c3428357761bc54 |
class JobFailure(TowerCLIError): <NEW_LINE> <INDENT> exit_code = 99 | An exception class for job failures that require error codes within
the Tower CLI. | 6259907799fddb7c1ca63aa4 |
class ContactLogDetail(generics.RetrieveUpdateDestroyAPIView): <NEW_LINE> <INDENT> serializer_class = ContactLogSerializer <NEW_LINE> permission_classes = (permissions.IsAuthenticated, ) <NEW_LINE> def get_queryset(self): <NEW_LINE> <INDENT> return ContactLog.objects.filter( family__organizations__in=Organization.objec... | The contact log describes an in-person or telephone contact between an employee and a client, other
than a home visit. Read access is based on the user's read access to the family, write access requires
write access to the family, read access to the employee, and that the family_member be linked to the
family either as... | 6259907716aa5153ce401e77 |
class FQ12(FQP): <NEW_LINE> <INDENT> degree = 12 <NEW_LINE> FQ12_MODULUS_COEFFS = None <NEW_LINE> def __init__(self, coeffs: Sequence[IntOrFQ]) -> None: <NEW_LINE> <INDENT> if self.FQ12_MODULUS_COEFFS is None: <NEW_LINE> <INDENT> raise AttributeError("FQ12 Modulus Coeffs haven't been specified") <NEW_LINE> <DEDENT> sel... | The 12th-degree extension field | 6259907726068e7796d4e2da |
class GoogleVisionAPIFaceExtractor(GoogleVisionAPIExtractor): <NEW_LINE> <INDENT> request_type = 'FACE_DETECTION' <NEW_LINE> response_object = 'faceAnnotations' <NEW_LINE> def _to_df(self, result, handle_annotations=None): <NEW_LINE> <INDENT> annotations = result._data <NEW_LINE> if handle_annotations == 'first': <NEW_... | Identifies faces in images using the Google Cloud Vision API. | 62599077aad79263cf430156 |
class RandomLengthListFactory(Factory): <NEW_LINE> <INDENT> def __init__(self, factory=None, min_items=0, max_items=1): <NEW_LINE> <INDENT> super(RandomLengthListFactory, self).__init__() <NEW_LINE> self._factory = factory <NEW_LINE> self._min_items = min_items <NEW_LINE> self._max_items = max_items <NEW_LINE> <DEDENT>... | A factory that returns on each iteration a list of of between `min` and `max` items, returned
from calls to the given factory.
Example,
>> import testdata
>> f = RandomLengthListFactory(testdata.CountingFactory(1), 3, 8).generate(5)
>> list(f)
[[1, 2, 3], [4, 5, 6, 7], [8, 9, 10], [11, 12,13, 14, 15]] | 62599077097d151d1a2c2a13 |
class ZombieBot_RandomCoinFlip(object): <NEW_LINE> <INDENT> def __init__(self, name): <NEW_LINE> <INDENT> self.name = name <NEW_LINE> <DEDENT> def turn(self, gameState): <NEW_LINE> <INDENT> results = roll() <NEW_LINE> while results and random.randint(0, 1) == 0: <NEW_LINE> <INDENT> results = roll() | After the first roll, this bot always has a fifty-fifty chance of deciding to roll again or stopping. | 62599077f548e778e596cf2e |
class EsProcessEvents(BaseModel): <NEW_LINE> <INDENT> version = IntegerField(help_text="Version of EndpointSecurity event") <NEW_LINE> seq_num = BigIntegerField(help_text="Per event sequence number") <NEW_LINE> global_seq_num = BigIntegerField(help_text="Global sequence number") <NEW_LINE> pid = BigIntegerField(help_te... | Process execution events from EndpointSecurity. | 625990772ae34c7f260aca84 |
class rule_021(Rule): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> Rule.__init__(self, 'generic', '021', oToken) <NEW_LINE> self.bInsertWhitespace = False | This rule checks the semicolon is not on it's own line.
**Violation**
.. code-block:: vhdl
U_FIFO : FIFO
generic (
G_WIDTH : integer
)
;
**Fix**
.. code-block:: vhdl
U_FIFO : FIFO
generic (
G_WIDTH : integer
); | 625990779c8ee82313040e56 |
class HumanPlayer(Player): <NEW_LINE> <INDENT> def get_move(self, game): <NEW_LINE> <INDENT> game.display_game_board() <NEW_LINE> while True: <NEW_LINE> <INDENT> print("") <NEW_LINE> move = input("Choose your spot: ") <NEW_LINE> try: <NEW_LINE> <INDENT> move = int(move) - 1 <NEW_LINE> <DEDENT> except ValueError: <NEW_L... | A type of player that will ask for human input to indicate a move | 625990774a966d76dd5f0889 |
class ROSPkgException(roslib_electric.exceptions.ROSLibException): <NEW_LINE> <INDENT> pass | Base class of package-related errors. | 625990774f88993c371f11f0 |
class Solution(object): <NEW_LINE> <INDENT> def countAndSay(self, n): <NEW_LINE> <INDENT> if n <= 1: <NEW_LINE> <INDENT> return "1" <NEW_LINE> <DEDENT> pre_str = '1' <NEW_LINE> for i in range(2, n+1): <NEW_LINE> <INDENT> index = 0 <NEW_LINE> current_str = '' <NEW_LINE> while index < len(pre_str): <NEW_LINE> <INDENT> po... | Quite straight-forward solution.
We generate k-th string, and from k-th string we generate k+1-th string,
until we generate n-th string. | 6259907760cbc95b06365a3c |
class Plotter: <NEW_LINE> <INDENT> def __init__(self, opts): <NEW_LINE> <INDENT> self.xrange = copy.copy(opts.xrange) <NEW_LINE> self.yrange = copy.copy(opts.yrange) <NEW_LINE> self.bgirange = copy.copy(opts.intparams.background) <NEW_LINE> self.pkrange = copy.copy(opts.intparams.peak) <NEW_LINE> self.gp = Gnuplot.Gnup... | Class to run GNUplot | 62599077379a373c97d9a9c1 |
class JobScheduleEnableOptions(Model): <NEW_LINE> <INDENT> _attribute_map = { 'timeout': {'key': '', 'type': 'int'}, 'client_request_id': {'key': '', 'type': 'str'}, 'return_client_request_id': {'key': '', 'type': 'bool'}, 'ocp_date': {'key': '', 'type': 'rfc-1123'}, 'if_match': {'key': '', 'type': 'str'}, 'if_none_mat... | Additional parameters for enable operation.
:param timeout: The maximum time that the server can spend processing the
request, in seconds. The default is 30 seconds. Default value: 30 .
:type timeout: int
:param client_request_id: The caller-generated request identity, in the
form of a GUID with no decoration such a... | 6259907766673b3332c31d9d |
class StatusTestCase(BasicTestCase): <NEW_LINE> <INDENT> def test_status_creation(self): <NEW_LINE> <INDENT> rv = self.client.post('/set/up/', data=dict(value="True")) <NEW_LINE> self.assertEqual(201, rv.status_code) <NEW_LINE> <DEDENT> def test_status_existence(self): <NEW_LINE> <INDENT> rv = self.client.post('/set/up... | Test basic status operations | 6259907744b2445a339b762d |
class InstancesView(object): <NEW_LINE> <INDENT> def __init__(self, instances, req=None): <NEW_LINE> <INDENT> self.instances = instances <NEW_LINE> self.req = req <NEW_LINE> <DEDENT> def data(self): <NEW_LINE> <INDENT> data = [] <NEW_LINE> for instance in self.instances: <NEW_LINE> <INDENT> data.append(self.data_for_in... | Shows a list of SimpleInstance objects. | 6259907856b00c62f0fb4271 |
class ItemsAppsConfig(AppConfig): <NEW_LINE> <INDENT> name = 'pmanagement.items' <NEW_LINE> verbose_name = 'items' | Items app config | 625990787d847024c075dd7a |
class SSSBApartmentLoader(ItemLoader): <NEW_LINE> <INDENT> default_input_processor = MapCompose(str.strip, is_empty) <NEW_LINE> apt_name_in = MapCompose(remove_extra_middle_spaces) <NEW_LINE> apt_name_out = TakeFirst() <NEW_LINE> apt_price_in = MapCompose(get_first_space) <NEW_LINE> apt_price_out = TakeFirst() <NEW_LIN... | Class for loading items for SSSBApartmentSpider.
| 625990785166f23b2e244d76 |
class Base(Message): <NEW_LINE> <INDENT> pass | Базовый класс для сообщений для локаторов. | 62599078ec188e330fdfa246 |
class IPortletTemplate(Interface): <NEW_LINE> <INDENT> pass | Portlet Template | 62599078ad47b63b2c5a91ee |
class TransformablePortAspects(PortAspects, Transformable): <NEW_LINE> <INDENT> def __create_ports__(self, ports): <NEW_LINE> <INDENT> ports = self.create_ports(ports) <NEW_LINE> ports = ports.transform_copy(self.transformation) <NEW_LINE> return ports | Factory class that automatically transform ports. | 6259907826068e7796d4e2dc |
class CVSBinaryFileEOLStyleSetter(SVNPropertySetter): <NEW_LINE> <INDENT> propname = 'svn:eol-style' <NEW_LINE> def set_properties(self, s_item): <NEW_LINE> <INDENT> if self.propname in s_item.svn_props: <NEW_LINE> <INDENT> return <NEW_LINE> <DEDENT> if s_item.cvs_rev.cvs_file.mode == 'b': <NEW_LINE> <INDENT> s_item.sv... | Set the eol-style to None for files with CVS mode '-kb'. | 62599078f548e778e596cf2f |
class IOpenIDPersistentIdentity(Interface): <NEW_LINE> <INDENT> account = Attribute('The `IAccount` for the user.') <NEW_LINE> openid_identity_url = Attribute( 'The OpenID identity URL for the user.') <NEW_LINE> openid_identifier = Attribute( 'The OpenID identifier used with the request.') | An object that represents a persistent user identity URL.
This interface is generally needed by the UI. | 62599078097d151d1a2c2a15 |
class NumberLocale(VegaLiteSchema): <NEW_LINE> <INDENT> _schema = {'$ref': '#/definitions/NumberLocale'} <NEW_LINE> def __init__(self, currency=Undefined, decimal=Undefined, grouping=Undefined, thousands=Undefined, minus=Undefined, nan=Undefined, numerals=Undefined, percent=Undefined, **kwds): <NEW_LINE> <INDENT> super... | NumberLocale schema wrapper
Mapping(required=[decimal, thousands, grouping, currency])
Locale definition for formatting numbers.
Attributes
----------
currency : :class:`Vector2string`
The currency prefix and suffix (e.g., ["$", ""]).
decimal : string
The decimal point (e.g., ".").
grouping : List(float)
... | 62599078f548e778e596cf30 |
class SurgeryHistory(AbstractModel): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> self.SurgeryName = None <NEW_LINE> self.SurgeryDate = None <NEW_LINE> self.PreoperativePathology = None <NEW_LINE> self.IntraoperativePathology = None <NEW_LINE> self.PostoperativePathology = None <NEW_LINE> self.DischargeD... | 手术史
| 625990785fdd1c0f98e5f91d |
class HttxPassManager(HttxObject): <NEW_LINE> <INDENT> def __init__(self): <NEW_LINE> <INDENT> HttxObject.__init__(self) <NEW_LINE> self.passmanager = HTTPPasswordMgrWithDefaultRealm() <NEW_LINE> <DEDENT> def __deepcopy__(self, memo): <NEW_LINE> <INDENT> clone = self.__class__() <NEW_LINE> with self.lock: <NEW_LINE> <... | An object manages username and password for url and realms
with locking semantics to be used in L{HttxOptions}
@ivar passmanager: storage for username, password credentials
@type passmanager: HTTPPasswordMgrWithDefaultRealm | 62599078a8370b77170f1d6e |
class TestConfig(Config): <NEW_LINE> <INDENT> ENV = "test" <NEW_LINE> TESTING = True <NEW_LINE> DEBUG = True <NEW_LINE> SQLALCHEMY_DATABASE_URI = 'sqlite://' <NEW_LINE> BCRYPT_LOG_ROUNDS = 4 <NEW_LINE> WTF_CSRF_ENABLED = False | Test configuration | 62599078283ffb24f3cf5248 |
class _PartialDict(dict): <NEW_LINE> <INDENT> def __missing__(self, key): <NEW_LINE> <INDENT> return _AsIsFormat(key) | Simple derived dict that returns an as-is formatter for missing keys.
To partially format a string use, e.g.:
`string.Formatter().vformat('{name} {job} {bye}',(),_PartialDict(name="me", job="you"))`
which gives `me you {bye}` | 625990784428ac0f6e659ecf |
class text_record(resource_record): <NEW_LINE> <INDENT> def __init__(self, api, soap_entity, soap_client): <NEW_LINE> <INDENT> super(text_record, self).__init__(api, soap_entity, soap_client) | Instantiate Text TXT record.
:param api: API instance used by the entity to communicate with BAM.
:param soap_entity: the SOAP (suds) entity returned by the BAM API.
:param soap_client: the suds client instance. | 6259907855399d3f05627eb3 |
class MqCtx(context.changectx): <NEW_LINE> <INDENT> def __init__(self, repo, patch_name): <NEW_LINE> <INDENT> self.name = patch_name <NEW_LINE> self._rev = self.name <NEW_LINE> self._repo = repo <NEW_LINE> self._queue = self._repo.mq <NEW_LINE> self.path = self._queue.join(self.name) <NEW_LINE> <DEDENT> @property <NEW_... | Base class of mq patch context (changectx, filectx, etc.) | 625990783d592f4c4edbc82d |
class AnonymousSurvey(): <NEW_LINE> <INDENT> def __init__(self, question): <NEW_LINE> <INDENT> self.question = question <NEW_LINE> self.responses = [] <NEW_LINE> <DEDENT> def show_question(self): <NEW_LINE> <INDENT> print(self.question) <NEW_LINE> <DEDENT> def store_response(self, new_response): <NEW_LINE> <INDENT> sel... | 收集匿名调查问卷的答案 | 62599078cc0a2c111447c7a1 |
class LZlswIndex(indexes.SearchIndex, indexes.Indexable): <NEW_LINE> <INDENT> text = indexes.CharField(document=True, use_template=True) <NEW_LINE> company_name = indexes.CharField(model_attr='company_name',null=True) <NEW_LINE> industry_involved = indexes.CharField(model_attr='industry_involved', null=True) <NEW_LINE>... | ANlmy索引数据模型类 | 625990784527f215b58eb670 |
@skipIf(NO_MOCK, NO_MOCK_REASON) <NEW_LINE> class SensorTestCase(TestCase): <NEW_LINE> <INDENT> def test_sense(self): <NEW_LINE> <INDENT> with patch.dict(sensors.__salt__, {'cmd.run': MagicMock(return_value='A:a B:b C:c D:d')}): <NEW_LINE> <INDENT> self.assertDictEqual(sensors.sense('chip'), {'A': 'a B'}) | Test cases for salt.modules.sensors | 6259907876e4537e8c3f0f1f |
class Level1Design(SPMCommand): <NEW_LINE> <INDENT> input_spec = Level1DesignInputSpec <NEW_LINE> output_spec = Level1DesignOutputSpec <NEW_LINE> _jobtype = 'stats' <NEW_LINE> _jobname = 'fmri_spec' <NEW_LINE> def _format_arg(self, opt, spec, val): <NEW_LINE> <INDENT> if opt in ['spm_mat_dir', 'mask_image']: <NEW_LINE>... | Generate an SPM design matrix
http://www.fil.ion.ucl.ac.uk/spm/doc/manual.pdf#page=61
Examples
--------
>>> level1design = Level1Design()
>>> level1design.inputs.timing_units = 'secs'
>>> level1design.inputs.interscan_interval = 2.5
>>> level1design.inputs.bases = {'hrf':{'derivs': [0,0]}}
>>> level1design.inputs.se... | 62599078aad79263cf430159 |
class ReadConfig: <NEW_LINE> <INDENT> def __init__(self, filename): <NEW_LINE> <INDENT> self.config = configparser.ConfigParser() <NEW_LINE> self.config['Basic'] = { 'CHANGE_DATA': True, 'CHANGE_ADDR': True, 'IP_ADDR': '223.90.40.4' } <NEW_LINE> self.config.read(filename, encoding='utf-8') <NEW_LINE> <DEDENT> def get_b... | 读取配置文件类 | 62599078460517430c432d29 |
class RuleValueList(object): <NEW_LINE> <INDENT> __metaclass__ = ABCMeta <NEW_LINE> def __init__(self, in_str_list, usage_type, usage_contained_type): <NEW_LINE> <INDENT> self.in_str = in_str_list <NEW_LINE> self.usage_type = usage_type <NEW_LINE> self.usage_contained_type = usage_contained_type <NEW_LINE> return <NEW_... | Represent a value in | 6259907871ff763f4b5e914c |
class HTMLField(models.TextField): <NEW_LINE> <INDENT> def formfield(self, **kwargs): <NEW_LINE> <INDENT> defaults = { 'widget': HtmlInput } <NEW_LINE> defaults.update(kwargs) <NEW_LINE> defaults['widget'] = HtmlInput(attrs={'placeholder': self.verbose_name}) <NEW_LINE> return super(HTMLField, self).formfield(**default... | A large string field for HTML content. It uses the TinyMCE widget in
forms. | 625990787cff6e4e811b73e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.